| id | TD-024 | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| title | "Agent Mind" — a generated repo digest injected into the warmed system prefix | ||||||||
| status | proposed | ||||||||
| date | 2026-06-22 | ||||||||
| supersedes | |||||||||
| superseded_by | |||||||||
| tags |
|
A human working a repo for a week does not re-read every file each morning — they hold a mental model (architecture, the files that matter, the constraints, the gotchas). Local agents have none: every task rebuilds context from zero, and the agentic benchmark shows the cost — the loop crawls and never converges fix-until-green. The model isn't the only bottleneck; context reconstruction is.
TD-023 already warms and KV-caches the static system head for free. The cheap, high-leverage next step is to make that head carry a project mental model — so it too is prefilled once and reused on every turn.
Generate a compact repo digest — call it the Agent Mind — and inject it into the warmed system prefix:
{ "architecture": "...", "critical_files": [...], "constraints": [...],
"known_bugs": [...], "patterns": [...] }Produced by a one-shot pass over the repo (a cheap local model summarizing the tree + key files, or a
deterministic repo-map), written to e.g. AGENTS.md / the system prompt, and cached by
carbon warm. The agent then starts each task already "knowing" the project instead of grepping it
back into existence.
- No engine patching. It's plain context engineering: digest → prepend to the system prompt → the existing TD-023 warm path caches it. Ships on llama.cpp today.
- Carbon doesn't own the loop — and doesn't need to. The agent loop is OpenCode (external npm, README). Agent Mind is delivered as injected context, not runtime state — exactly the seam Carbon controls.
- Composes with retrieval. TD-020 (NPU embeddings/RAG) is the dynamic side (retrieve the right chunk per query); Agent Mind is the static digest side. Together: a stable mental model in the warm prefix + per-task retrieval.
- Digest generator (
carbon mindor awarmpre-step): walk the repo → architecture summary + critical-file list + constraints. Start deterministic (tree + headers + a repo-map), optionally enrich with a small local model. - Inject + warm: write the digest into the system prompt /
AGENTS.md;carbon warmprefills and caches the now-larger prefix. - Incremental refresh: re-generate only on meaningful repo change (git diff trigger) — and re-warm, since any prefix edit invalidates the slot (TD-023).
- Prefix bloat. The digest grows the cached prefix → more KV RAM (precious under TD-006's ~2 GB KV budget) and less room for the task. Keep it tight (target ≤1–2K tokens) and measure the RAM hit.
- Staleness. A wrong/old digest actively misleads the agent. Refresh-on-change + keep it factual (paths, signatures) over interpretive.
- Digest quality. Auto-summaries hallucinate; prefer extracted facts to prose where possible.
On a real task in one of Guido's repos, with the Agent Mind warmed in vs a cold baseline: lower TTFT, fewer tool calls (grep/read round-trips), and equal-or-better task score on the agentic benchmark. A 30–50% drop in tool calls/time is "real optimization"; a 2–3× drop would argue this is an architecture, not a tweak.