AI Coding Is Incredible — Until Your Agent Forgets Everything
Claude writes incredible code. But every session starts like it has amnesia. Here's how I gave my AI agents persistent memory across 50 repos.
I'm going to say something that sounds like a contradiction: AI coding agents are the biggest productivity leap I've experienced in 15 years of programming, and they are also fundamentally broken.
Claude Code writes production TypeScript that I ship without changes. Cursor refactors entire modules in seconds. I've watched an agent debug a race condition in my WebSocket handler by reading the code, forming a hypothesis, adding logging, and finding the root cause faster than I could have opened the right file. The productivity gain is not hype. It's real and it's massive.
But every single session starts from zero.
The amnesia problem
I open Claude Code on one of my projects. It knows nothing. It doesn't know that this project deploys to Cloudflare Workers, not Vercel. It doesn't know that the database has a quirky migration from three months ago that makes the schema look wrong but is actually intentional. It doesn't know that I spent two hours yesterday debugging a Supabase RLS policy and the fix was a one-line change. It doesn't know my coding standards -- that I use kebab-case for files, PascalCase for components, that I never use emojis in code.
So I explain. Every time.
"This project uses Supabase with pgvector for embeddings. We deploy via Vercel Pro with 16 cron jobs. The processing pipeline runs every 2 minutes. Here's how the classification works..."
Multiply this by 50 repositories and you start to understand the problem. The context-loading overhead eats the productivity gain. You spend 10 minutes explaining things the agent already helped you build last week. It's like working with a brilliant colleague who gets a full memory wipe every night.
The workarounds everyone is building
If you've spent any time on r/ClaudeAI or r/ObsidianMD recently, you've seen the wave. People are building elaborate "second brain" systems to feed context to their coding agents. The setups usually look something like this:
A meticulously organized Obsidian vault with folders for each project. Architecture decision records. Coding standards documents. Debug logs. Then a workflow that copies relevant notes into a prompt or a CLAUDE.md file before each coding session.
These are genuinely smart solutions. I respect the craft that goes into them. The best ones include decision logs with timestamps, architecture diagrams in Mermaid, and running lists of "things the agent needs to know." Some people have built custom Obsidian plugins that generate context files automatically.
I tried this approach. I maintained a CLAUDE.md file in each repo, updated it after significant sessions, kept architecture notes current. It worked. For about three projects.
The scaling wall
Here's where the Obsidian-as-memory approach breaks down: it doesn't survive portfolio scale.
When you have 50 repos, manually maintaining context files is a second full-time job. You fix a critical bug in project A, and you need to update the CLAUDE.md in that repo. But the fix also revealed a pattern that applies to projects B, C, and D -- do you update all four files? You change your deployment strategy from Cloudflare Workers to Vercel Pro -- do you grep through every repo and update every context file?
You don't. Nobody does. The files go stale. The agent reads outdated context and makes wrong decisions based on it. Stale context is worse than no context because it's confidently wrong.
I also noticed a subtler problem: the best insights happen at the worst times for documentation. You're deep in a debugging session, you finally understand why the rate limiter fails under load, and the last thing you want to do is switch to Obsidian and write a structured note about it. You think "I'll document this later." You never do. The insight evaporates.
What I actually wanted
I started thinking about what the system should look like if I designed it for how I actually work, not how I aspire to work.
First, capture has to be zero friction. If it takes more than 3 seconds, I won't do it. That means voice notes from my phone while walking the dog. A CLI command at my desk. A Telegram message. Paste something into a web inbox. Forward an email. The system meets me where I am, not the other way around.
Second, classification has to be automatic. I don't want to file things into folders or tag them manually. When I say "the Supabase RLS fix for omnus was to add a policy on the fragments table," the system should know that's a debug insight, it belongs to the omnus project, it's operational knowledge, and it should be routed to that project's context files.
Third, security has to be baked in. I've accidentally pasted API keys into prompts. Everyone has. The system needs to scan every piece of input with deterministic regex patterns before any LLM sees it. Not after. Before.
Fourth, export has to be file-based. Not an MCP server. Not an API the agent needs to authenticate with. Just Markdown files sitting in the repo, right next to the code. Every coding agent already knows how to read files. You run terso sync and the context appears in .terso/generated/. The agent picks it up naturally.
Auto-generated CLAUDE.md
This is the piece that changed everything for me.
Instead of manually maintaining a CLAUDE.md file in each repo, it's generated from a knowledge base. The system knows the project's architecture, coding standards, recent decisions, deployment setup, and active issues. It assembles a CLAUDE.md that's always current because it's derived from structured data, not maintained by hand.
When I change my deployment target for a project, that fact gets captured once. The next time CLAUDE.md is generated, it reflects the change. When I make an architecture decision, it flows into the decision log section automatically. When a teammate (or a previous coding session) discovers a gotcha, it appears in the "things to know" section.
The generated file has frontmatter with timestamps and source IDs so the agent can distinguish it from hand-written docs. It's disposable -- regenerated on every sync. The source of truth is the knowledge base, not the file.
The session observer
The last piece closes the loop: a Claude Code hook that watches what happens during coding sessions.
When I finish a session where I refactored the authentication flow, the observer captures what changed. Which files were modified. What decisions were made. What the agent learned about the codebase. It posts this back to the knowledge base as a new ingestion.
This creates a flywheel. The agent reads context at the start of a session. It makes decisions during the session. Those decisions get captured automatically. The context improves. The next session starts smarter.
I'm not manually writing decision records anymore. The system observes my coding sessions and extracts the decisions for me. The debug insight I'd never bother to document? It gets captured because the session observer saw me spend 40 minutes on a problem and then make a targeted fix.
The missing abstraction
The Obsidian crowd is right about the core insight: AI agents need persistent memory to be useful. Where I think the approach falls short is in assuming that memory should be a note-taking app that a human maintains.
The missing piece isn't a better note-taking app. It's an automated knowledge pipeline. Capture from anywhere, classify automatically, scan for secrets, route to the right project, export as files that agents already know how to read. No manual curation. No folder taxonomies. No weekly review sessions where you reorganize your vault.
I still use Obsidian for personal notes and thinking. It's a great tool for that. But for the specific problem of "make AI coding agents remember things across sessions and across projects," the answer is infrastructure, not a notebook.
The system I built processes about 30-40 ingestions per day across my 50 repos. It auto-classifies with high enough confidence that I only review about 15 items per week. Everything else flows through automatically: captured, classified, routed, exported, ready for the next coding session.
When I open Claude Code on a project I haven't touched in a month, it reads the .terso/ directory and just knows. The architecture. The deployment setup. The decisions. The recent bugs. The coding standards. No re-explaining. No context-loading ritual. No copy-pasting from Obsidian.
It starts where we left off. That's how it should have always worked.