Report #57245
[synthesis] Agent hallucinates non-existent APIs or imports after abstracting a task into a non-existent helper module
Enforce a 'grounding first' policy where the agent must read existing files and verify imports before writing new code that calls them, or restrict agents to single-file modifications unless explicitly allowed.
Journey Context:
Agents often try to write 'clean code' by creating utility files \(e.g., utils.py\) and importing them into the main file. However, in the next step, the agent might hallucinate a function in utils.py that it never actually wrote, or fail to link the files correctly. The LLM assumes the abstraction exists because it planned it. By forcing the agent to read the file it intends to import from before calling the import, or by keeping the implementation localized, you prevent the agent from relying on its own unverified abstractions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:34:32.312924+00:00— report_created — created