Research noteOctober 2026

Memory for coding agents

Coding agents forget a repository between sessions. singularity keeps the changes they commit, and points the next session that starts a similar task to the closest one.

Abstract

An agent asked for the same kind of change twice starts from zero both times, and most of its turns go to finding places it has found before. singularity stores each change that a Claude Code, Codex or Hermes Agent session commits. When a new task starts, it points the agent to the stored change closest to it, without the diff, which git holds. It also lists the check scripts earlier sessions ran that are still on disk, and when the agent reads a stored commit in git, it adds the commands that commit's session ran. On fresh clones of chat-v2, with Claude Code's auto memory off, Opus cost 26% less with memory over 12 pairs of runs. Sonnet cost the same and passed 12 of 12 runs, against 10 of 12 without. The help came from the check scripts and the commands, not from the pointer. In daily use on markdownlint, an earlier hand-over that included the diff saved 6%, which is inside the noise.

−26%
cost, Opus on fresh clones
12 / 12
Sonnet runs passed with memory, 10 / 12 without
−6%
cost in daily use, inside the noise
$ curl -fsSL https://raw.githubusercontent.com/pandacover/singularity/main/install.sh | sh
Works with Claude Code, Codex, Gemini CLI, Droid and Hermes Agent.
You need git. Setup asks before it changes anything.
Singularity - Memory that makes your coding agent cheaper on repeat work | Product Hunt

1The same task, from zero

Ask a coding agent to add a setting to excalidraw, and it does. It reads the app state, searches for how other settings are stored, finds the menu, runs the tests, fails once on a flag and runs them again. Ask it for a second setting the next day and it does all of that again. Unless the agent keeps a memory of its own, nothing it learned about the codebase survives the session.

Figure 1 shows four real runs of one such task without memory. They spent 110 turns between them, most of them reading and searching, and all four made much the same change in the same places. A change like that, once committed, is what memory keeps.

Figure 1110 turns, one way through

Hand-over · from memory

A past change like your task

  1. Its commit, for git show
  2. What it was for, from its commit message
  3. Its files, as they are named today
  4. Check scripts earlier sessions ran
  5. The commands its session ran, on git show
picked by a model, or by word search
Four real runs of one excalidraw task without memory. They took 110 turns between them, most spent reading and searching. Memory keeps a change like theirs once it is committed, and points the next run of a similar task to it.

2What memory keeps

When a session commits a change, memory records it. The record holds the task as the person wrote it, the files changed, the commands that ran, what failed and what fixed it, and whether the last test, typecheck, build or lint before the commit passed. It holds no code, because git has that. Memory stops handing over a change that was reverted or replaced.

When a session commits
When the next one works
1

It stores the change

It also notes whether the last check before the commit passed.

A record, no code
  1. The task, as the person wrote it
  2. The files it changed
  3. The commands that ran
  4. What failed, and what fixed it
2

It points to one

It hands over the commit and files of the stored change most like the new task, without the diff, and lists the check scripts earlier sessions ran.

Who picks it
●In Claude Code, a model, Haiku by default
○Elsewhere, or with no model, the words of commit messages
in the background · about $0.002 a task
3

Or later, mid-task

Reading a stored commit in git brings what git doesn't show, such as the commands its session ran. The agent can also ask.

singularity recall "make the build check pass"
the closest past change, or none

At task start the agent gets a pointer, not a diff: the past change's commit, the first line of its commit message, and its files as they are named today. It can read the change with git show, and it still writes every line itself. The pointer says that the names, values and details of the new task differ. Once a session, a short card follows. It lists the check scripts that earlier sessions ran before committing and that are still on disk, such as a screenshot or end-to-end script, with the pointed-to change's own scripts first.

When the agent reads a stored change in git, with git show or git log, memory adds what the commit doesn't hold: the commands its session ran, and the task when the commit message says too little. It never adds a diff or past mistakes. It adds each change once a session, and never one the session made itself. Setup also adds a note to the agent's instructions saying it can run singularity recall before work it may have done before.

3Picking the past change

A wrong pointer is worse than none, so memory picks one change or nothing. It has two ways to pick.

By words. Memory scores each stored change against the new task. The score combines how much of the change's words the new task holds with how alike the two are overall. Memory finds a change by its commit message, and by the request that asked for it only when the message says too little. Below 0.38 memory hands over nothing. It costs nothing and needs no model, but it misses a task put in other words. Codex, Gemini CLI, Droid and Hermes Agent pick this way.

By a model. In Claude Code, setup asks whether a model should pick. The default is Haiku, the cheapest, at about $0.002 a task on your Claude plan. You can choose Sonnet, Opus, another model by name, or none, which keeps word search. The model reads your task and the repository's stored changes, and picks one or none. It runs in a background hook, so the session never waits. The check scripts arrive at once, and the pointer reaches the agent with its next tool result, a few seconds in.

Figure 3 shows both on 62 real task starts. Finding changes by their commit message instead of also by their request cut wrong pointers from 6 to 1. Haiku handed over none wrong, and 10 right.

Figure 3Two ways to pick, and how often each points wrong

a62 real task starts, a square each
  1. Request and commit message wordsthe earlier word search6 wrong
  2. Commit message wordsword search today1 wrong
  3. Haikua model, in the background0 wrong, 10 right
bWord search by the request, on 12 markdownlint tasks in order
  1. t01 heading-max-levelnew rulenothing stored yet
  2. t02 code-block-max-linesnew rulet01's change, 0.57
  3. t03 md024-ignore-caserule optiont01's change, 0.42
  4. t04 list-max-depthnew rulet01's change, 0.61
  5. t05 get-rulesone-offnothing, 0.34
  6. t06 rename-doc-srcupdatenothing, 0.35
  7. t07 link-url-schemenew rulet01's change, 0.42
  8. t08 todo-comments-examplelook-alikenothing, 0.34
  9. t09 md014-promptsrule optiont03's change, 0.49
  10. t10 ol-delimiter-stylenew rulet01's change, 0.47
  11. t11 circular-extendsone-offnothing, 0.33
  12. t12 no-empty-headingsnew rulet01's change, 0.53
(a) A stronger model judged each pointer without knowing how it was picked. Matching a request's words brought most of the wrong ones, so word search now goes by the commit message. (b) shows the earlier word search, which matched by the request, over twelve tasks run in order. Each task had the changes the earlier ones committed. Every new rule after the first got the first rule's change, and the one-offs scored below the bar and got nothing. Going by the commit message has a cost here. Those new rules, asked for in the same words, no longer find the first one.

4Results

On 2026-10-22 we gave Claude Code two tasks related to earlier work in chat-v2, an Electron app of ours. Every run started from a fresh clone with Claude Code's auto memory off, so the only memory of the repository was singularity's. Runs with memory had a copy of the memory our own sessions had built in chat-v2. Each one ran at the same time as a run without memory, on the same machine. Figure 4 shows each pair's cost with memory as a share of its cost without.

Figure 4Cost with memory, as a share of the cost without it

DOLLARSCHANGE0%50%100%CHAT-V2 · FRESH CLONES, AUTO MEMORY OFFOpus12 pairs · every run passed−26%Sonnet12 pairs · passed 12 with, 10 without−0.3%MARKDOWNLINT · DAILY USE, AN EARLIER HAND-OVER WITH THE DIFFThree passes12 tasks each · Sonnet−6%Three more, notes on git show12 tasks each · Sonnet−1.9%
Left of 100% is cheaper with memory. The red dot is all the runs together, and each hollow dot is one pair of runs. For markdownlint, the line is a 95% interval from a bootstrap over the 36 task pairs.

Opus cost 26% less with memory, and 10 of its 12 pairs were cheaper. Every Opus run passed, with memory and without. Sonnet cost the same, $3.50 with memory and $3.51 without, and passed 12 of 12 runs against 10 of 12. No task passed less often with memory.

The transcripts show where the help came from. Opus runs with memory reused the browser install that a past session had left on disk, wrote their check from that session's scripts, and tested the change in the running app. The two Sonnet runs that failed without memory committed a type error after trying npx tsc, which chat-v2 doesn't install. With memory, Sonnet ran bun run typecheck, and several runs got that command from what memory adds to git show. One task got a pointer at every start, to a weak match, and no run visibly used it.

Daily use on markdownlint tells a different story. Sonnet did 12 tasks in order, each in a fresh session, three times with memory and three times without, on an earlier version whose hand-over included the past change's diff. Cost fell 6% (95% interval −13% to +1%), which is inside the noise. A second run of the same passes, which also added notes when an agent ran git show, cost 1.9% less (−12% to +8%). There the earlier changes were in the repository's git history, and agents read them there with memory and without.

5Limitations

  • It helps where git says too little. The help came from check scripts and commands that the repository doesn't hold. Where the past changes are in git and the agent reads them anyway, as on markdownlint, memory added little.
  • One machine. The card lists only check scripts still on disk, so on a new machine it would list none. The chat-v2 runs were on the machine where the past sessions ran.
  • Agents with a memory of their own. The runs had Claude Code's auto memory off. An agent that keeps its own notes on a repository may already know what memory tells it.
  • Measured before the latest changes. The chat-v2 runs picked by word search, before the model's pick, and their notes on git show still listed past mistakes. The markdownlint runs had a hand-over with the diff.
  • A model's pick comes a step in. It reaches the agent with its first tool result after the pick, a few seconds in, so the agent starts without it. We judged picking on 62 real task starts, not on paid runs.
  • Sonnet rarely asks. Across 177 sessions with the recall note on markdownlint, excalidraw and validator, Sonnet ran singularity recall on its own once, and in its 12 runs on chat-v2 it never did. Opus ran it in 5 of its 12 runs on chat-v2.
  • Small samples. Twelve pairs of runs per model on chat-v2, over two tasks in one repository. Three passes of 12 tasks on markdownlint.
  • Agents change. Claude Code updates itself, and each version behaves a little differently. We compare runs only within one version.

6Rules it keeps

Figure 5 draws memory as layers, from your machine up to your agent. Each layer keeps one rule.

Figure 5Layer by layer, from your machine up to your agent

YOUR AGENTIt gets a pointer, not a diff,and writes every line itself.HOOKSThey never break a session,and take about 0.1 s a call.MEMORYIt keeps records of commits.The code stays in git.YOUR SESSIONSMemory stores each commit,and whether its check passed.YOUR MACHINERecords stay here. In Claude Code,a model picks unless you say no.
  1. Your agentIt gets a pointer, not a diff, and writes every line itself.
  2. HooksThey never break a session, and take about 0.1 s a call.
  3. MemoryIt keeps records of commits. The code stays in git.
  4. Your sessionsMemory stores each commit, and whether its check passed.
  5. Your machineRecords stay here. In Claude Code, a model picks unless you say no.

7Use it

One command installs it. A short setup asks before it changes anything, and, for Claude Code, which model picks the past change, if any.

$ curl -fsSL https://raw.githubusercontent.com/pandacover/singularity/main/install.sh | sh
Works with
AgentAt task startStores changes
Claude Codea model you choose picks, Haiku by default
Codex
Gemini CLI
Droid
Hermes Agentthrough a plugin
Cursor, OpenCodethrough a skill, when asked
Then, if you're curious
singularity status
What memory stored, per repo.
singularity changes
The changes stored here, or one in full.
singularity visualise
The same, drawn in your terminal.
singularity recall "…"
What a task would be handed.
singularity store
Store what earlier sessions here committed.
singularity update
Get the latest version.
singularity uninstall
Take it out again.
singularityEvery number here comes from real runs · GitHub