terraphim / terraphim/terraphim-ai
Phase 2: Add Validation Pipeline via Hooks (Week 2)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 62
- Forks
- 5
- Avg merge
- 2h 27m
- Merged PRs (30d)
- 1
Description
Part of Epic #270
Objective
Implement 4-layer validation pipeline using rust-genai + MCP hooks.
Tasks
1. Wrap rust-genai Client with Validation
Location: crates/terraphim_multi_agent/src/genai_llm_client.rs
Create ValidatedGenAiClient with:
- Pre-LLM validators (context, permissions, token budget)
- Post-LLM validators (parsing, confidence, security)
2. Add Hooks to MCP Server
Location: crates/terraphim_mcp_server/src/lib.rs
- Pre-tool validation hooks
- Post-tool validation hooks
- Use existing permission system
3. Implement Knowledge-Graph-Based Security
Location: crates/terraphim_rolegraph/src/repository_security.rs
- RepositorySecurityGraph structure
- Command matching via automata
- Synonym resolution via thesaurus
- Learning system for user decisions
4. Command Extraction
Location: crates/terraphim_automata/src/command_matcher.rs
Extract commands from LLM output:
- Backticks
- Code blocks
- Shell prompts
- Natural language
Success Criteria
- 4-layer validation working
- Commands validated in <10µs
- Security graph per repository
- Learning system reduces prompts
Time: 1 week
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the four named entry points: genai_llm_client.rs, the MCP server lib.rs, repository_security.rs, and command_matcher.rs, along with epic #270. Trace how validation, permissions, command extraction, and learning are currently represented before planning the cross-cutting changes. Done means the four-layer pipeline works, commands validate in under 10µs, each repository has a security graph, and learning reduces prompts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- ai, backend-api-design, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100