Dev.to · 13 min read

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

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

You are fixing a bug. 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. Elephant on GitHub 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 felt unnecessary. So Elephant's own journal stays local. No Elephant account. No Elephant cloud. No analytics pipeline. No telemetry. No mysterious checkbox saying: Help us improve Elephant by uploading the private repository that pays your salary. The database lives on your machine. Sensitive keys and common credential formats are redacted before persistence. This is defense-in-depth, not magic. If somebody has unrestricted access to your laptop, Elephant is not going to defeat the concept of computer security. The elephant remembers. It is not Batman. Native continuity vs portable recovery There is another boring engineering reality. Not every coding harness exposes enough lifecycle information for automatic capture. It would have been much easier to put twenty logos on the README and write: Supports everything. Open-source README engineering is significantly easier than software engineering. Instead, Elephant distinguishes levels of support. Some hosts can provide native lifecycle capture and automatic recovery. Others can participate through recovery skills, MCP surfaces, rules files, or repository-level instructions. The current project includes integrations or recovery surfaces across tools including Claude Code, Codex, GitHub Copilot CLI, Gemini, Pi, Hermes, OpenCode, Cursor, Windsurf, Cline, Kiro and other compatible hosts. The exact capability differs by harness. Which is less impressive than saying “universal.” But more useful. Software eventually has to interact with reality. Reality has terrible developer experience. Installing it You install Elephant in the harnesses between which you want continuity. For example, in Claude Code the repository currently documents: /plugin marketplace add vishesh9131/elephant then: /plugin install elephant@elephant For Codex: codex plugin marketplace add vishesh9131/elephant Then install Elephant from the marketplace through /plugins. There are native/recovery setup paths for the other supported hosts as well; the repository keeps the current commands and platform matrix. Python 3.11+ is required for the local kernel and lifecycle hooks. Once installed, the point is that Elephant should mostly disappear. I did not want another command that developers must remember to run before the thing designed to remember things can remember things. That would be conceptually embarrassing. Explicit resume still exists Sometimes you actually want to ask for the previous session. Elephant supports explicit recovery too. Depending on the host, that may be something like: /elephant:resume or: $resume or simply: resume my previous session The exact surface depends on the coding harness. Again, because the coding harnesses are actually different. I checked. Why build this now? AI coding has created an interesting situation. The models are becoming increasingly capable of long, autonomous technical work. Which makes losing their context more annoying, not less. If an agent spends thirty seconds answering a question and forgets afterward, who cares? If an agent spends forty-five minutes: exploring the repository, forming hypotheses, changing six files, running tests, rejecting two approaches, discovering an undocumented invariant, then its working context has value. The model didn't merely produce text. It accumulated state. And as developers increasingly move between different coding agents, that state needs to become portable. There is already visible developer demand around shared context and handoffs between Claude, Codex, Gemini and similar tools. Developers are building utilities for context packaging, shared memory and multi-agent workflows because switching agents otherwise means repeatedly reconstructing project state. The problem is becoming a category rather than an isolated annoyance. The interesting question is therefore no longer: Which coding agent should own my project? It might be: Why should any coding agent own the memory? Models should probably be replaceable We currently treat AI coding tools somewhat like IDEs. Pick one. Configure it. Develop habits around it. Defend it online for reasons that become increasingly personal. But models are moving quickly. One model may be better at debugging. Another may be better at planning. Another may have a larger context window. One may have available quota. One may simply not be down today. So perhaps the model should be a replaceable worker. The project state should survive the worker. That means: project + working state + history + Git evidence should not belong exclusively to Claude. Or Codex. Or Gemini. The model is executing the work. The memory belongs to the project. That is the larger idea behind Elephant. Is this “long-term memory for AI”? Kind of. But that phrase has become sufficiently broad that it can now mean almost anything involving a database. Elephant is intentionally narrower. It is not trying to remember your childhood. It does not need to know your favourite programming language from six months ago. It does not construct a psychological profile because you used var once. Its immediate job is much more boring: Allow another coding agent to continue the work. That constraint is useful. Because “memory” sounds like an AI research problem. “Handoff” sounds like an engineering problem. Engineering problems have tests. So I added tests Elephant's conformance flow is basically: capture ↓ checkpoint ↓ switch harness ↓ recover ↓ verify Git state The project tests journaling, redaction, recovery, MCP behaviour, manifests and cross-harness continuation. Because the worst possible outcome for a memory tool is: Elephant: I remember everything. Developer: Great. What were we doing? Elephant: Something with authentication. At that point we have reinvented my actual memory. Why call it Elephant? Because elephants supposedly never forget. This is convenient branding. The alternative name was probably something like: Cross-Harness Context Persistence Orchestration Kernel. Which sounds like a project whose documentation begins with Kubernetes. So: Elephant. The slightly uncomfortable conclusion We spent years trying to make AI coding agents more autonomous. Now they can inspect repositories. Run commands. Edit files. Write tests. Debug failures. Reason across large codebases. And one of the remaining workflow problems is remarkably human: Shift change. One worker leaves. Another worker arrives. Nobody wrote down what happened. Except now the workers are artificial intelligences with billion-parameter neural networks and the handover process is still: “Okay bro, basically…” That seemed fixable. So I built Elephant. The model can forget. The project shouldn't have to. Check out Elephant on GitHub If you use multiple coding agents, try killing one in the middle of something interesting. For once, that is an installation test.

This is a summary aggregated from Dev.to. Read the complete article on the original site:

Read full article at Dev.to

More AI & Machine Learning News