Repo Intelligence Graph
The repo intelligence graph is Tandem’s deterministic map of a workspace repo. It indexes files, symbols, imports, config references, docs headings, and graph edges so coding agents can orient before broad file discovery.
Use it as discovery evidence. Agents should still read concrete files before editing them or making final claims about their contents.
When the graph is created
The graph is created by the repo.index engine tool. It persists a snapshot at:
.tandem/repo-index.jsonIt also writes a human-debuggable export at:
.tandem/repo-graph.jsonThe .tandem/ directory must be ignored by git. Tandem Agents deliberately
skips the persistent refresh when .tandem/repo-index.json is not ignored, so
runtime artifacts do not accidentally become tracked source files.
Automatic use in Tandem Agents
ACA uses repo intelligence during the manager planning phase when the connected engine exposes the repo tools.
At the start of planning, ACA:
- checks whether
repo.context_bundleis available - refreshes the index with
repo.indexwhen that tool is available and the snapshot path is ignored - calls
repo.context_bundlefor the task - writes the bundle artifact into the run’s artifacts directory as
repo_context_bundle.json - records
repo_contextmetadata in the run blackboard and status file
If the tools are missing, denied, or fail, ACA falls back to its older heuristic repo discovery path and records that fallback in run state.
ACA does not have to use planning mode for the graph to exist. Planning is the automatic path. Manual and non-planning flows can call the same engine tools directly.
Manual trigger with the CLI
For direct CLI calls, run from the target repo and pass repo_path as ..
The standalone tool command does not infer a workspace root for absolute
paths.
cd /path/to/repotandem-engine tool --json '{"tool":"repo.index","args":{"repo_path":"."}}'For a local Tandem checkout:
cd /path/to/tandemtandem-engine tool --json '{"tool":"repo.index","args":{"repo_path":"."}}'Verify that query tools are reading the stored snapshot:
tandem-engine tool --json '{"tool":"repo.context_bundle","args":{"repo_path":".","path_scope":".","task":"Explain how repo intelligence is wired into Tandem Agents","limit":8}}'In the result metadata, index_source should be stored. If it is
ephemeral_scan_after_load_error:..., Tandem could not load the stored snapshot
and scanned the repo for that query instead.
If you cannot change directories first, include the same workspace context that normal Tandem sessions inject automatically:
tandem-engine tool --json '{"tool":"repo.index","args":{"__workspace_root":"/path/to/repo","__effective_cwd":"/path/to/repo","repo_path":"."}}'Manual trigger over HTTP
When the engine is running as a service, call the same tool through
POST /tool/execute:
curl -sS -X POST http://127.0.0.1:39731/tool/execute \ -H "content-type: application/json" \ -d '{"tool":"repo.index","args":{"__workspace_root":"/path/to/repo","__effective_cwd":"/path/to/repo","repo_path":"."}}'If your engine requires an API token, include the same authorization header you use for other Tandem engine requests.
Refresh after edits
After files change, refresh the index before relying on impact analysis or test target suggestions:
tandem-engine tool --json '{"tool":"repo.update_changed_files","args":{"repo_path":".","changed_files":["src/example.ts"]}}'The current implementation performs a safe full rescan and records
refresh_mode: full_rescan.
Tools agents should use
After the index exists, use these tools before broad grep, glob, or
semantic search:
repo.context_bundle: build a bounded task-oriented context bundlerepo.search: search indexed files, symbols, imports, config, and docsrepo.symbol: find symbols by name and optional kindrepo.neighbors: traverse related graph nodes from a file or symbolrepo.impact: summarize fallout from changed filesrepo.test_targets: return likely test targets from changed files
For task startup, prefer repo.context_bundle first. For post-edit validation,
refresh with repo.update_changed_files, then call repo.impact or
repo.test_targets.
Rebuild checklist
After repo intelligence changes land in Tandem, rebuild or restart whichever engine your agents are actually using.
For a local source checkout:
cd /path/to/tandemgit checkout maingit pull --ff-only origin maincargo build -p tandem-aiFor the Tandem Agents Compose stack, make sure the tandem-engine sidecar is
using a Tandem release or local package that contains the repo intelligence
tools, then rebuild/restart the stack:
cd /path/to/tandem-agents./scripts/build-containers.sh --build./scripts/build-containers.sh --up./scripts/run.sh --check-engineCheck tool availability before expecting ACA or Tandem Coder to use the graph:
curl -sS http://127.0.0.1:39731/tool/idsLook for repo.index, repo.context_bundle, and the other repo.* tools.
Troubleshooting
- If
repo.indexis missing, the running engine is older than the repo intelligence tool release. - If ACA falls back to heuristic discovery, inspect the run’s
repo_contextstatus metadata andrepo_context_bundle.jsonartifact. - If the snapshot is skipped, confirm
.tandem/is ignored by git in the target repo. - If query results are stale after edits, call
repo.update_changed_files. - If a query reports
ephemeral_scan_after_load_error, recreate the stored snapshot withrepo.index. - If
repo.context_bundlereturnsinvalid_envelope:readable_paths, passpath_scope:"."for local whole-repo reads or a narrower readable path for a scoped task.