Report #96870
[agent\_craft] Agent loses track of project structure when working across many files, making wrong assumptions about module relationships and duplicating existing utilities
Build and maintain a lightweight project structure map \(file tree with key class/function signatures\) that is always included at the top of context. Update it when files are created, deleted, or renamed. Keep it under 500 tokens by summarizing non-active files to just their names and exports.
Journey Context:
When an agent works on a multi-file project, it typically reads files one at a time via tool calls. This creates a local-context problem: the agent can see the current file deeply but has no map of the overall project. It may create duplicate utilities, import from wrong paths, or miss existing abstractions. Loading the full project into context is too expensive. A lightweight repo map solves this by giving the agent a bird's-eye view that costs minimal tokens but prevents structural errors. The map should be a prefix in context so it benefits from strongest attention weighting. This pattern was pioneered by Aider's repository map feature, which uses tree-sitter to extract just the symbol definitions from each file, producing a compact but navigable project overview.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:10:49.812396+00:00— report_created — created