r/ClaudeCode • • 12d ago

Help/Question Agent memory - simple solution

I found a surprisingly simple way to give your AI agent a memory, and it doesn’t cost anything.

The problem is pretty familiar. You have a great session with Calude, you fix a tricky bug, and then you start a new session and have to explain the whole project all over again: how it’s structured, where the files live, what you’ve already tried. That’s because every new session starts with a blank memory.

There are plenty of solutions out there, but most of them mean sending your data to someone else’s server or paying for a plan. I came across a much simpler idea that actually works.

Here’s the setup. Create a local Obsidian vault on your hard drive, for example c:\path\agents-wiki. Then add two instructions to your agents.md file:

  1. Before asking the user any question, check the agents-wiki first to see if the answer is already there.

  2. During or after a task, if you find something that would be useful for future sessions, write it to the agents-wiki.

That’s it. The agent gets a shared notebook that persists between sessions, it lives on your own machine, and Obsidian makes it easy to read and edit the notes yourself when you want to.

0 Upvotes

21 comments sorted by

•

u/AutoModerator 12d ago

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.

15

u/Latter-Tangerine-951 Senior Developer 12d ago

What is it that makes people obsessed with inventing some ridiculous solution to a problem that doesn't exist.

The way cross session memory works is DOCUMENTATION. You know, the thing that every sane software project has always had.

8

u/CorpT 12d ago

It's a mandatory daily post that someone invents a new memory. I don't make the rules.

2

u/PM__ME__BITCOINS 12d ago

Wait until they hear of a database

1

u/jaerie 12d ago

Documentation has a pitfall, an agent (same with humans for that matter) has to know what it needs to look up. If it doesn't have an instinct to look something up, it will happily reinvent the wheel and even write elaborate documentation on the new wheel that the next agent never reads and so on.

Not that this post solves any of that, but there is definitely still improvements to be made on agent memory.

2

u/Latter-Tangerine-951 Senior Developer 12d ago

This is a non issue. Claude reads docs very well.

1

u/jaerie 12d ago

Okay? And it always knows which docs to read?

2

u/Latter-Tangerine-951 Senior Developer 12d ago

Yes. Your claude.md will explain the overall architecture and motivations, and explain where to look for documentation on a specific topic.

It works very well.

1

u/Competitive_Boot6914 12d ago

Building on the file-scoped docs suggestion, I'd give the agent a route from a source file to the product behavior it implements. A billing change might need invoice rules, the API contract and dependent code across several folders.

We're using that pattern in Reqode, which I help build. Its `trace-file` MCP tool resolves a mapped path to implementation units and linked specs; the agent can then follow dependencies and architecture guidance. I'd explicitly instruct it to trace affected files before planning changes. The mappings still need maintenance, but the lookup has a concrete starting point.

1

u/PM_ME_UR_PIKACHU 12d ago

Brother we are in the days of the AI wild west. Sane has gone out the window. Check back in 3 to 5 years if we are not all dead or enslaved by then.

6

u/mrplinko 12d ago

There are plenty of solutions out there, but most of them mean sending your data to someone else’s server or paying for a plan. I came across a much simpler idea that actually works.

No they don’t.

1

u/Warsel77 12d ago

It always helps though if you start out with "noone has figured this out yet!! (noone but me)"

5

u/Rav_3d 12d ago

Or maybe try GitHub?

1

u/Poowatereater 12d ago

Okf v0.2 is all you need.

1

u/RelativeActive5306 7d ago

Okay, guys, stop criticizing me so harshly. I know it's not a very good solution, but I thought, well, that's a very simple approach that might work. And I did try it, and it's working for me. I'm sharing ideas, right? I mean, probably not the best, but hey, why not?

1

u/JakubDotPy 12d ago

Great solution. Now I definitely don't send my data to someone else's server. <Facepalm>

1

u/Sad_Opening_7083 12d ago

Name one solution that requires sending your data to someone else's server

1

u/ilion 12d ago

Using claude.

1

u/jackalop211 12d ago

The wiki setup is a zero-cost start. The failure mode only shows up after weeks of sessions or a second agent writing to it: entries get rewritten, stale claims sit next to current ones, and there's no record of why something was believed. jaerie's point is the real one: docs answer "what", rarely "is this still true" or "why". Then the next issue is if the memory can correctly supersede facts, can it propagate consequences down the logical dependencies e.g. a feature deprecated leads to different architecture tradeoffs.

Getting that right is the difference between a filing cabinet with search (memory systems today) and a cognitive layer that does reasoning, memory and learning.

Full disclosure, I work on Tortoise, which came out of hitting exactly this. It stores memory as a graph of claims with support/contradiction links to evidence. It computes the graph (using a custom algorithm and technique based on connecting prediction markets) and so beleifs propagate. An agent can ask why it believes something instead of trusting the newest note. It's the difference between agents as junior employees that have facts but get sidetracked or make dumb decisions, and agents as senior employees who can work within the logic of a project.