Context & code intelligence¶
These tools help the agent understand the code without reading it whole (token saving). Tramalia orchestrates them from tramalia context and/or wires them as MCP servers.
flowchart LR
classDef s fill:#5b4bdb,stroke:#8c68d9,color:#ffffff;
SR["Serena<br/><small>decides what to read (symbols)</small>"]:::s --> RP["Repomix / codebase-memory-mcp<br/><small>build the map/graph</small>"]:::s
RP --> CTX[".tramalia/context/<br/><small>derived memory</small>"]:::s Repomix — packaged snapshot¶
- What it is / scope: packages the repo into a single AI-friendly file (snapshot).
- Requires: Node.
- Install:
mise use npm:repomix· direct:npm i -g repomix· without installing:npx repomix. - Tramalia uses it in:
context— if present, it generates the snapshot; if not, Tramalia falls back to a stdlib tree. - Interacts with: feeds
.tramalia/context/; complements Serena (snapshot vs. live navigation).
Serena — live semantic navigation (MCP)¶
- What it is / scope: an MCP toolkit that uses language servers (LSP) so the agent reads only the exact symbol it's about to touch — surgical navigation, always fresh.
- Requires: uv + Python (runs via
uvx, no global install needed). - Install / wire:
tramalia initalready puts it in.mcp.json: - Tramalia uses it in: it wires it into
.mcp.json; the agent consumes it via MCP. The CLI doesn't invoke it directly. - Interacts with: it decides what to read before Repomix/codebase-memory build context; it reduces tokens during live work.
codebase-memory-mcp — structural code graph (MCP)¶
- What it is / scope: indexes the code into a persistent knowledge graph (158 languages, hybrid LSP + tree-sitter):
get_architecture, call graphs, impact analysis. ~99% fewer tokens than reading file by file. A more powerful alternative to Serena/Repomix as a context backend. - Requires: nothing (static binary, C/C++).
- Install: binary from the repo's releases. Important: use
--skip-configso it does not configure agents or write instructions outside Tramalia. - Tramalia uses it in: optional
contextbackend / query MCP server. - Interacts with / caution: only its query tools. Its
manage_adrand agent auto-configuration must not be used: ADRs live indocs/ai/05and rules inAGENTS.md(Tramalia's governance).
CodeGraph — pre-indexed graph with auto-sync (CLI + MCP)¶
- What it is / scope: a pre-built dependency graph in SQLite (FTS5): the
codegraph_exploretool returns "verbatim source + call flow + blast radius" in a single call, 20+ languages, with file-watchers keeping the index current. - Requires: nothing extra (the binary installs via npm; Node is only needed to install it, not at runtime).
- Install:
npm i -g @colbymchenry/codegraph(automated bydoctor/tramalia ui), thencodegraph initin the project. Caution: thecodegraph installwiring auto-configures agents — Tramalia does not automate that step; run only its query MCP server and leave the rules toAGENTS.md. - Tramalia uses it in:
doctordetects it (featurecontext); alternative/complement to Serena and codebase-memory-mcp.
Graphify — knowledge graph from code/docs/schemas (CLI + MCP + skill)¶
- What it is / scope: turns code, SQL, scripts, docs, papers, images or videos into a queryable graph (HTML visualization + markdown report + JSON). It's a CLI, an MCP server, and a skill at once.
- Requires: nothing extra (Python via
uv tool). - Install:
uv tool install graphifyythengraphify install(registers the skill). Used with/graphify .. - Tramalia uses it in:
doctordetects it (featurecontext); alternative/complement to Serena, codebase-memory-mcp and CodeGraph in the same slot.
markitdown — document ingestion to Markdown (CLI + MCP)¶
- What it is / scope: converts PDF, Word, Excel, PowerPoint, images (OCR), audio, HTML and EPub to LLM-friendly Markdown (Microsoft, MIT). CLI + MCP server (
markitdown-mcp, a single tool:convert_to_markdown). - Requires: Python ≥ 3.10.
- Install:
pip install "markitdown[all]"· MCP:pip install markitdown-mcp. - Tramalia uses it in:
doctordetects it (featurecontext). Its role is ingestion: bringing into the Markdown world the knowledge that lives in formats the agent doesn't read well — the PRD in.docx, the reference Excel, the client's PDF:markitdown requirements.docx -o docs/ai/09-specs-origin.md. - Interacts with: it competes with no one — it's the entry gate. It feeds what Serena and the graphs then navigate.
notebooklm-mcp — curated external knowledge (MCP, cloud)¶
- What it is / scope: an MCP server that lets the agent "ask" a Google NotebookLM notebook loaded with documentation — answers grounded in the sources you uploaded (no hallucination). It automates a real Chrome (Patchright) with your Google session.
- Requires: Node ≥ 18 + Chrome + a Google account (data goes to Google).
- Wire (manually, never by default):
- Tramalia and the hard rule: it does not appear in
doctornor in the generated.mcp.json(it runs vianpxand is a cloud service). Use it only with public third-party documentation — never upload private code, evidence or repo secrets. It's a different slot: not repo context nor memory — it's what others documented.
With several installed, which does the agent use? (context.backend)¶
Serena, CodeGraph, codebase-memory-mcp and Graphify compete for the same role — "what do I read to understand the code". If an agent alternates between them within the same project (one on one task, another on the next), the indexes drift and context becomes only half-reliable. Tramalia fixes one active backend per project, in .tramalia/config.json:
- Choose it:
tramalia context set <backend>(CLI) or thebkey intramalia ui— a selector with each option's scope and ideal use case, so you decide with information, not blindly. - See it:
tramalia context listshows all 4 options (installed or not) and which is active; it's also in.tramalia/context/tools.json → context_backend, which agents already consult (AGENTS.mdtells them to). - Default:
serena— the only one with no index to maintain or disk footprint. - Repomix and markitdown don't compete: they're point-in-time utilities (full snapshot / document ingestion) used whenever they apply, regardless of the active backend.
The criterion: which to mount and which to use¶
Three axes, in this order:
1 · What question does it answer? Each tool lives in a slot; choose by the question, not by fame:
| The question you have | Tool | Note |
|---|---|---|
| "Which exact symbol do I touch?" (live) | Serena | default — init already wires it |
| "Full snapshot of the repo for a prompt" | Repomix | one-off, not persistent |
| "What do I break if I touch X?" (impact, architecture) | CodeGraph or codebase-memory-mcp | tiebreaker below |
| "Code + docs + schemas in a single graph" | Graphify | multi-format |
| "This PDF/Word/Excel → context in Markdown" | markitdown | ingestion |
| "How is library X used per its official docs?" | notebooklm-mcp | external knowledge (cloud) |
2 · Local first. Local tools (Serena, graphs, markitdown, .tramalia/context/) save tokens and keep privacy. The agent should query the derived context and the local MCP tools before reading whole files — and only go to the cloud (NotebookLM) for public external knowledge.
3 · No overlap + graceful degradation. At most one graph at a time (CodeGraph, codebase-memory-mcp and Graphify compete for the same slot). And if a slot is empty, work continues normally: context falls back to a stdlib tree, the agent reads files directly — none of these tools is a requirement, all are accelerators.
Graph tiebreaker (when you could mount more than one):
- CodeGraph — if you work in the repo daily and want the surgical answer in one call (SQLite index with file-watcher auto-sync), and your language is among its 20+.
- codebase-memory-mcp — if the repo is polyglot or uses less common languages (158 languages, hybrid LSP), or you need architecture views (
get_architecture). - Graphify — if the value lies in joining code + docs + schemas into one queryable graph, more than in impact analysis.
- If two or more are already installed: use CodeGraph for day-to-day impact and codebase-memory-mcp for architecture analysis — and write the choice down in
AGENTS.mdso every agent follows the same one.
Tramalia doesn't compete with them: it declares them, detects them (doctor) and consumes their output in .tramalia/context/ or via MCP. You choose which one(s) to mount.