Stop coding agents hallucinating API changes: ground them in changelogs and PR diffs, not web search
Historical-Ladder739 · reddit · 2026-09-29
A developer breaks down why coding agents (Claude Code, Cursor, Codex) confidently invent nonexistent APIs: training cutoffs, plus generic web search that surfaces SEO articles and stale StackOverflow answers over raw code.
His three-part fix:
- Encode in CLAUDE.md / AGENTS.md that on any library import error, the agent must query the package's GitHub releases or changelog before writing code;
- Don't index just static docs, which lag active repos by weeks — use a dev-focused search index (e.g. Firecrawl developer search) to pull closed GitHub issues and merged PR diffs into context as clean markdown, pinpointing the exact commit where a signature changed;
- Cache fetched docs locally in a .context/docs/ scratchpad, reference them locally instead of searching every turn, and prune files when the feature branch merges.
His verdict: dropping generic web search and grounding agents in primary-source diffs eliminates hallucinated method calls immediately.
More from coding & agent
- ChatGPT, Claude and Gemini cite websites differently — how to get cited — sahilypatel · 2026-09-29
- Weeks with Opus 5.5 in Claude Code desktop: 'changed how I work' — g3off_record · 2026-09-29
- Manus co-founder Tao to demo Manus 2.0 live in founder briefing on Sep 30 — parker_lyman · 2026-09-29
- KernelZero-7B co-evolution beats Claude 4.5 Sonnet on CUDA kernel generation — Changxin Ke · 2026-09-29
- Triage agent design: 1-2 high-signal questions rescued B2B reps drowning in 60% low-intent chats — hubtyper · 2026-09-29
- Separating outcome memories from return memories in the Hindsight agent memory system — Harishkumar79 · 2026-09-29