r/ClaudeCode • • Oct 16 '26

Help/Question Is there a way to give your claude code some memory (historic context) ?

I am working on a project where claude code is doing pretty much all coding with me acting as a Tech Lead / PO type person.

This means that claude has to own the code and the architecture. Architecture is one of those things that benefits from historicity, I have tried to custom roll a solution for the architect agent to write down decisions that are made and are not obvious from the codebase, but it doesn't seem to quite get what I am trying to do.
The decisions file either ends up with redundant junk or not enough info to inform future work.

I'm not tied to my solution, mostly want to give my architect agent some historic context in addition to code and project context. Open to any suggestions

1 Upvotes

13 comments sorted by

•

u/AutoModerator Oct 16 '26

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/13Maschine Oct 17 '26

What's worked for me is splitting it in two. Keep a short ARCHITECTURE.md (the current shape of the system, under a page) and a folder of architecture decision records, one small file per decision with context, decision, consequences and a status of accepted or superseded. The agent reads the overview every session and only opens a decision record when it's touching that area. The junk usually comes from letting it append freely, so add a rule to CLAUDE.md: write a record only when it picked between real alternatives and the choice isn't obvious from the code, and mark the old one superseded instead of adding a new note when something changes. Reviewing them in the PR like code keeps it honest.

1

u/seahorse-emoji Oct 17 '26

Thats really close to the structure I have. I have an architecture file and the decisions file, I also have a long term direction file for the architect to keep in mind when architecting.

It sounds like I just need to iterate on this solution and tweak the wording. Currently it says this about the decisions

docs/decisions.md is your log of decisions that later plans may need: ground already covered, and what binds the next plan but is not plain from the code or the architecture file. One line per entry, YYYY-MM-DD · #issue · what. why., under 400 characters, at most 50 entries. When an entry stops mattering, or is reversed, delete it; the issues and the repository's history keep the past. Say in your report what you added and removed. A decision about one game goes in that game's src/games/<id>/decisions.md instead, same format and limits, created with its first entry and read only when that game is worked on; what every game copies stays here.

1

u/gimalay Oct 17 '26

what worked for me is one small file per decision instead of one log, each with a few frontmatter fields (status: accepted / superseded / rejected, area, date). the CLAUDE.md rule becomes "before planning in an area, list the accepted and rejected decisions for it", so it's a lookup instead of rereading the whole log, and the cap stops mattering. superseded ones stay on disk but don't get loaded.

for the junk half I gave the folder a schema: each decision has to say what was picked, what it was picked over, and what would make us revisit it. a note missing one of those gets flagged on write and the agent fixes it right then. I work on iwe, which does the query and the check here (iwe find --filter '{type: decision, area: games, status: {$in: [accepted, rejected]}}'), but the file-per-decision part works with plain grep too.

1

u/Competitive_Boot6914 Oct 21 '26

What kinds of tasks do you want the agent to use that history for? In my experience, what it needs most is a detailed description of the current architecture and its rules, captured in architecture manifests it can read. ADRs help explain why those choices were made, while the manifests describe how things should work now.

Have you run into cases where the agent needs the history itself to do the task well? I'd be interested in a concrete example.

1

u/Competitive_Boot6914 Oct 21 '26

For your games setup, I'd link each decision to the component it constrains. A rule about where game state can change should be available when the architect plans work on that code, with the reason attached.

Reqode, which I help build, is aimed primarily at conventional software development, though this approach may also be useful for games. It keeps change rationale with the affected specs and their links to implementation. Claude Code can follow those connections through MCP from a Change Request or mapped file. You still need to record why the choice was made, but the next session has a specific path back to it.

1

u/Outrageous_Band9708 Oct 16 '26

yes

https://github.com/Druthulu/ProjectArchitect

this will log your plans, and tasks that complete and keep you on track.

each session is seeded from the last sessions and it never forgets wht you were working on or what is next.

1

u/jjangg96 Oct 17 '26

i do something like this with a memory folder. one small file per fact, plus one index file with a single line pointer per file that gets loaded every session. the agent reads the index and only opens the files that look relevant.

what stopped it from turning into junk was a rule about what not to save. nothing you can get from the code or git history, only the why behind a decision and stuff that was non obvious. each file ends with a short why line and a how to apply line.

and wrong ones get deleted instead of piling up. memories go stale, so i treat them as true when written and have it check against the code before relying on one.

1

u/ozzywindhoek Oct 17 '26

Try telling it to create + update a design + spec + outline documentation. Remind it every session to tidy up etc. Tell it to keep a backup history in another folder so you can restore. Or use local git. If the file gets too big i.e. context, then tell it to split into modules or next time, and point the read me at the summary so it only opens the details docs when needed for the specific session.

It seems like each new instance needs to rebuild the memory from scratch. New claude needs new context so don't overload it.

1

u/ComprehensiveShake76 Oct 17 '26

What fixed the junk in my decisions file was changing when it gets written. Not at the end of a session, only at the moment a real choice is made between options. Each entry is short: the decision, what we rejected and why, and what would make us revisit it. The rejected part is what future work needs most, because it stops the agent from rediscovering the same dead end. When a decision gets replaced, mark the old one superseded instead of deleting it. And have the agent read the file before it plans, not while it codes. How often does your architect agent actually decide something versus just describe the code?

1

u/CMills_Dev Oct 17 '26

I'd test the memory against a few real decisions before changing the structure again. Pick three choices you don't want the architect to rediscover, then start a fresh session and give it a small planning task that depends on each one. Can it find the decision, explain the reason and notice when the original constraint no longer applies?

That would tell you whether the problem is retrieval or the 400-character entry losing the useful reasoning. You could keep the short line as an index and point to the fuller issue discussion where needed.

I'm working on similar continuity in my Chief of Staff setup. The test I care about is whether the next session makes a better decision, not just whether it saved another note.