This directory contains role-based knowledge graph (KG) configurations for terraphim_grep.
.terraphim/
├── config.toml # Role definitions and settings
├── kg/ # Knowledge graph concept files
│ ├── ai-engineer/ # AI/ML concepts
│ ├── devops/ # DevOps concepts
│ └── rust-engineer/ # Rust concepts
├── thesaurus-*.json # Auto-generated Aho-Corasick thesauri
└── role-*.json # Role-specific LLM configurations
- 6 concepts: Caddy, Docker Compose, GitHub Actions, Monitoring, Secrets
- 37 synonyms for fast matching
- 9 concepts: Concurrency, Error Handling, Ownership, Performance, Serde, Testing, Tokio, Traits, WebAssembly
- 92 synonyms for fast matching
- 6 concepts: Agent Patterns, Embedding, LLM, Prompt Engineering, Providers, RAG
- 61 synonyms for fast matching
Thesaurus JSON files are auto-generated from KG markdown files. Each markdown file contains synonyms:: directives that are extracted and compiled into an Aho-Corasick automaton for fast substring matching.
If you modify KG markdown files, regenerate the thesaurus:
cargo run --bin terraphim-grep -- generate-thesaurus --role rust-engineerOr manually update the JSON file by extracting synonyms from all markdown files in the role directory.
Thesaurus JSON structure:
{
"concepts": [
{
"name": "Concept Name",
"synonyms": ["synonym1", "synonym2"],
"relationships": ["related1", "related2"]
}
]
}When terraphim_grep is run with --kg-path and --answer, the RLM synthesis step extracts new concepts from the LLM response and persists them as markdown files:
terraphim-grep --role rust-engineer --kg-path .terraphim/kg/rust-engineer --answer "how does tokio work"New concepts are written to kg_path/learned-<slug>.md with synonyms and relationships.
terraphim-grep --role devops --thesaurus .terraphim/thesaurus-devops.json --paths . "pipeline"Paths are repo-relative — the root of the repository is the default haystack root.
Use --paths . to search the entire repository or specify subdirectories relative to
the repo root.
OPENROUTER_API_KEY=sk-or-... terraphim-grep --role devops \
--thesaurus .terraphim/thesaurus-devops.json \
--paths . --answer "pipeline"When adding new concepts:
- Create a markdown file in
kg/{role}/ - Include synonyms using the
synonyms::directive - Regenerate the thesaurus JSON
- Test with
terraphim-grep --role {role} --answer "your query"
Additional Terraphim-AI domain roles (fleet standard §8):
| Role | shortname | KG |
|---|---|---|
| Terraphim AI Developer | taidev |
.terraphim/kg-taidev/ |
| Terraphim AI Architect | taiarch |
.terraphim/kg-taiarch/ |
These coexist with the existing Rust Engineer / kg/<role>/ layout.
python3 .terraphim/scripts/bootstrap.py # materialize {REPO} + refresh thesauriSkills manifest: .terraphim/skills.toml (tsm install <name>).
Repo agent memory: memory/ at repo root.
Fleet roles use repo-relative haystack and KG paths (., crates, memory, …).
scripts/bootstrap.py regenerates thesauri and normalizes absolute/{REPO} paths
that resolve inside this repo back to relative form. Foreign absolute haystacks
are left untouched. The script never writes machine-absolute paths into tracked config.