Your AI Coding Agent Has Amnesia. Somehow You Became the Memory.
DEV Community

Your AI Coding Agent Has Amnesia. Somehow You Became the Memory.

Not an interesting bug. An authentication bug. Which means somewhere, somebody wanted a user to remain logged in, and now six files are involved. You open Claude Code. Claude reads the repository. It checks the authentication flow. It finds the refresh-token logic. It reads some tests. It changes auth/session.py . One test fails. Claude investigates. It reads another file. It discovers that the test is not really testing what its name suggests. Normal software development. Forty-seven messages later, something beautiful happens. Claude finally understands the problem. Not approximately. Not β€œhere are three possible causes.” It actually understands it. You understand it. Claude understands it. The repository understands nothing because it is a folder. But still. For one brief moment, there is alignment. Then Claude says: You've hit your usage limit. Excellent. The only participant who understood the problem has died. So you open Codex Because we live in the future. We have multiple artificial intelligences capable of writing software. Surely this should help. You open the same repository in Codex. Codex looks at you with the optimism of a new employee on Monday morning. What would you like to work on? And now you realise something. Claude has lost the context. Codex never had the context. But you have the context. Congratulations. You are now middleware. Your job was software engineering. Your new job is explaining one artificial intelligence to another artificial intelligence. We automated programming and somehow created clerical work. The context-window promotion So you start typing. β€œWell, basically, we're fixing refresh-token rotation…” Then you explain the architecture. Then what Claude discovered. Then why the obvious fix didn't work. Then which files changed. Then the test that's still failing. Then the thing Claude tried before that. Then the thing that looked wrong but actually wasn't wrong. Then the thing that looked correct but was very wrong. Codex reads all this. You say: β€œGot it?” Codex says: β€œGot it.” You have no mechanism to verify this. This is now a trust-based economy. And the particularly stupid part is that most of this information already exists. The files exist. The Git diff exists. The tool calls happened. The errors happened. The conversation happened. The model responses happened. Your computer witnessed everything. But when you change coding agents, everybody behaves as though the previous forty minutes occurred in another civilisation. So I built Elephant. Not because AI agents need more intelligence. They need memory. What Elephant does The basic idea is embarrassingly simple. While your coding agent is working, Elephant records what is happening. Not after the session. Not when the model is almost dead. While it is happening. Prompts. Responses. Tool calls. Failures. File changes. Current objective. Git state. Recent session events. All of it goes into a local append-only journal. Then Elephant periodically creates what I call a recovery capsule. So instead of this: Claude: You've hit your usage limit. Codex: What are we working on? You: Okay. Sit down. It started yesterday... you get something closer to: Claude: You've hit your usage limit. [open same repo in Codex] Elephant: Recovered previous Claude Code session. Objective: Fix refresh-token rotation. State: Implementation complete. One integration test still failing. Changed: auth/session.py tests/test_rotation.py Codex: I found the failing test. Continuing from there. That is basically Elephant. The dead model does not have to explain what it was doing. Elephant was taking notes while it was alive. This turns out to be important. β€œWhy not just ask Claude to summarize before switching?” Yes. You can. This works beautifully under one condition: Claude must still be alive. Unfortunately the message: You've hit your usage limit. usually does not arrive three minutes before the usage limit. There is no: You have 847 tokens remaining. Please settle your affairs. The model does not gather its family. It does not write a will. It does not say: β€œTell Codex the bug is in rotate_token() .” It just stops. Asking a model at quota to summarize the session is like installing a fire alarm after the building has burned down. The summary would have been useful. Earlier. So Elephant doesn't depend on a dying model remembering to preserve its memory. It journals continuously. After completed turns, it checkpoints. Before compaction, it checkpoints. At session end, it checkpoints. When the host exposes interruption or quota-failure events, Elephant records those too. If the quota disappears without warning, the useful state is already on disk. There is no heroic final message. I don't trust software that requires heroism. There is another weird assumption in AI coding tools We talk about Claude Code, Codex, Gemini, Copilot, OpenCode and everything else as if they are completely separate working environments. But from the developer's perspective, they often aren't. The project is the same. The Git repository is the same. The bug is the same. The terminal is the same. The developer is unfortunately still the same. Only the model changed. Yet changing the model often resets the understanding of the work. Imagine doing this with human developers. Developer A works on a bug for four hours. At 4 PM his shift ends. Developer B sits at the same desk. You delete all of Developer A's notes. Then B says: β€œSo what does this company do?” We would call this poor management. With AI we call it a new session. One memory, multiple agents Elephant uses a shared local store: ~/.elephant/ β”œβ”€β”€ elephant.db └── transcripts/ Capture-capable integrations write into the same versioned event format. So the memory created while working in one supported harness can be recovered by another. The architecture is roughly: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Coding agents β”‚ β”‚ Claude Β· Codex Β· Hermes Β· OpenCode Β· Pi Β· ... β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Elephant β”‚ β”‚ redact Β· journal Β· checkpoint Β· inspect Git β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Continuation β”‚ β”‚ startup recovery Β· resume β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ The important architectural decision here is what Elephant doesn't do. It doesn't pretend every coding agent has the same API. Because they don't. That abstraction would look elegant for approximately three days. Then one provider would add an event. Another would rename a hook. A third would expose no hook at all. And eventually the universal interface would contain seventeen optional fields called things like: maybe_session_end_v2_final Instead, Elephant has one memory protocol and thin native adapters around it. The hosts remain different. The memory doesn't have to. What actually gets remembered? A useful handoff does not require the entire conversation to be shoved into another model. That would technically preserve context in the same way moving your entire house preserves your toothbrush. Elephant focuses on the state required to continue: - current objective; - last completed state; - last prompt and model response; - modified files; - current Git evidence; - recent tool/model failures; - recent session events; - transcript references when the host exposes them. The distinction between conversation history and working state matters. If I ask an agent to fix authentication and we spend thirty messages discovering that the problem is an incorrect cookie domain, the next agent doesn't necessarily need all thirty messages. It needs to know: Objective: Fix auth refresh failure. Finding: Cookie domain is incorrect in production config. Changed: config/auth.ts Remaining: Integration test still failing on refresh. Git: Working tree contains uncommitted changes. That is context. The forty-seven-message archaeological record is evidence. Useful sometimes. Not the first thing you need. Git gets the final vote Memory systems have a dangerous tendency. They remember something that was true and then confidently tell you it is true. This is especially bad in programming because the repository has the annoying habit of changing. Suppose Claude modifies three files. Elephant checkpoints. Then you manually revert one. Then you open Codex. What should happen? Option A: Elephant believes its memory and tells Codex the old file still contains Claude's change. Option B: Elephant checks reality. Elephant chooses B. Recovery compares the stored capsule's Git metadata with the live worktree. The files on disk win. Because memory is evidence. The repository is reality. This is also a surprisingly useful rule outside software engineering. But this is DEV Community, so we'll pretend I only meant Git. What happens when you're at 98% quota? Nothing. Because Elephant probably doesn't know you're at 98%. And neither does your plugin. This sounds like a missing feature until you notice the alternative is lying. Most coding harnesses do not expose an exact subscription percentage. So Elephant stores quota information as: exact estimated unknown If the host provides an exact signal, fine. If it doesn't, Elephant does not manufacture: CLAUDE QUOTA: 97.3% CRITICAL MEMORY MODE ACTIVATED because that would be theatre. The system is designed around the assumption that the agent may disappear unexpectedly. Continuous journaling makes exact quota prediction much less important. If the memory is already saved, you don't need to predict the precise second the model dies. Seatbelts do not predict crashes either. This has not prevented their adoption. Local-first because the context is not harmless A coding-agent conversation may contain: - proprietary code; - internal architecture; - environment details; - file paths; - debugging output; - credentials accidentally pasted into a terminal; - the increasingly desperate messages you send after the fourth failing test. Sending all of that to another memory SaaS by default

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.