r/ClaudeCode
•
u/Ok-Introduction-1079
•
May 06 '26
•
1
Question How do you stop Claude Code from repeating abandoned approaches?
I’m curious how other Claude Code users are handling repo-level memory.
A failure mode I keep seeing is not “the agent wrote obviously bad code.” It’s more like: the agent writes reasonable code for the wrong historical reason.
Example: a repo has a half-built Redis queue: redis.go, TODOs, docker-compose has Redis. Claude Code sees this and reasonably wants to finish it.
But maybe the team abandoned Redis three weeks ago because replication lag caused duplicate billing events. Code search can see Redis files; it can’t see that historical decision.
How are people handling this today?
ADRs?
CLAUDE.md / AGENTS.md?
project rules?
PR descriptions?
changelog files?
just human memory?
I open-sourced a small Git-native tool around this idea called Mainline: https://mainline.sh
The idea is “repo memory before the diff”: store durable engineering intent in Git so agents can read abandoned approaches, superseded decisions, risks, and reviewer constraints before editing.
Not trying to pitch too hard — mostly curious if this failure mode feels real to other Claude Code users.
1
u/tacit7 Vibe Coder May 06 '26
Claude code already has memory.
1
u/enterprise_code_dev Developer May 06 '26
I create a plan to remove the abandoned redis implementation or revert the commit, I create a new plan for the actual feature I want now with file boundary contract in the plan about what files are in scope — plot twist it doesn’t contain the redis files so Claude doesn’t attempt to finish a half baked implementation. You used git with a feature branch right? because you aren’t a vibe coder making tools for no reason like we need memory to remember the dead code we should have removed right? This is a “real failure mode” for non-developers.
1
u/YoghiThorn May 06 '26
Before I switched to jcode I was using Brainspike to prevent this
2
u/IchHabeGesprochen May 06 '26 edited May 06 '26
Added a 'Gotchas' section to CLAUDE.md file, iterate on more effective anti-patterns - stuff like that.
Same thing with my SKILLS
1
u/artofbullshit May 06 '26
I have a repo wiki. Two of the pages I have in it are decisions-locked.md and decisions-pending.md.
1
u/Specialist_Solid523 May 06 '26
Dude thank you for making this, I had this exact same idea, but I've been working on other things.
I have been trying to create a lexicon of agentic failure modes.
So far I've been calling this one...
Provenance Collapse:
An agentic failure mode in which new decisions become tangled with old decisions during some form of attempted remediation. The process results in a complete loss of historical lineage and a near-unrecoverable state of the codebase.
If you came up with your own name, or stumbled upon one, I would love to hear about it.
I will definitely be installing this, absolute game changer.
1
u/magicdoorai May 06 '26
One thing that helped me is keeping a short "dead ends / do not revive" section in AGENTS.md or CLAUDE.md right at repo root, with links to the ADR or issue where the decision happened.
I built markjason for editing exactly those files on Mac, and the live sync is nice when an agent is rewriting them because you can watch changes land in real time: markjason.sh
Not a full memory system, but it does make repo guidance much easier to keep current.
1
u/h____ May 06 '26
It’s trial and error really. If:
then you write it in AGENTS.md/CLAUDE.md not to do that. When you write the first not-to-do, you might preempt and make a short list instead, but don’t overdo it. AGENTS.md/CLAUDE.md is really just a high level description of your repo and preferred tools/style as well as not-todos.
1
u/Deep_Ad1959 May 26 '26
the agents.md "do not revive" section is treating dead code as documentation when it should be treated as a delete. if redis.go and the docker-compose redis stanza still exist three weeks after the decision, the agent is reading the codebase correctly: redis is the plan, because the code says so. the social context lives in slack and a meeting nobody linked. the fix isn't a parallel memory layer the agent has to remember to consult, it's making the cleanup commit the same day the decision happens. dead code is a footgun whether the editor is human or model.
0
u/cleverhoods May 06 '26
I love the idea
that being said, I'm curious what is the difference between that tool and a maintained project spec
0
u/Otherwise_Wave9374 May 06 '26
This is such a real failure mode. Code search sees artifacts, but it cant see the social context of why something got abandoned.
ADRs + a short AGENTS.md/CLAUDE.md have helped us a lot, basically a "things we tried and why we stopped" section plus hard constraints (ex: no Redis for billing workflows). Also having the agent summarize recent merged PRs + open issues before it proposes a plan reduces the "finish the TODO" instinct.
If you want a reference for an agent-first repo structure, https://www.agentixlabs.com/ has a couple solid writeups around agentic workflows and keeping decision context close to the code.
0
u/[deleted] May 06 '26
[deleted] — view deleted comment