Report #53737
[agent\_craft] Agent hallucinates non-existent libraries or project-specific APIs because it lacks project context
Inject a 'repo map' \(e.g., a tree of files and generated tags/signatures\) into the system prompt or first user message, rather than relying on the agent to discover it via file exploration.
Journey Context:
Agents waste many steps exploring the file system to understand the project's tech stack and available internal APIs, often making incorrect assumptions along the way. Pre-computing a concise map of dependencies and project structure and injecting it as static context gives the agent an accurate mental model immediately. The tradeoff is spending ~500-1000 tokens upfront, but it saves thousands of tokens and multiple tool calls in exploratory dead ends.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:41:38.805048+00:00— report_created — created