# Claude Code forgets between sessions, and the fix is not a bigger context

*A larger window would replay the transcript. What the next session needs is the decision and the option you turned down, kept as a record.*

Monday, close to six. You and Claude Code have spent two hours on invoice numbering. Sequential per tenant, gap-free, because auditors in two of your markets insist on it. You tried a global sequence first and it fell over on the tenant export. The diff is committed. Tuesday morning you open a fresh session, describe a small change to the same module, and the agent suggests a global sequence. It has the code in front of it. It has no idea the code was fought over.

The instinct is to ask for more context, yesterday's transcript or a window big enough to hold it. I think that instinct is wrong, and not only because windows fill up. A transcript is session state. It records the search, the false starts, the tool calls, the files that turned out not to matter. All of it was scaffolding for a conclusion, worthless once the conclusion exists. Replay it into the next session and you buy the noise at full price, with the ruling somewhere around line four thousand.

What needed to survive Monday is two sentences. Invoice numbers are sequential per tenant because the auditors say so. A global sequence was tried and rejected because it broke the tenant export. The conclusion and the rejected option. Everything else can go.

Those two sentences are not state. They are a decision, and decisions have a different shape from context. They carry an author and a date. They hold across hundreds of sessions until someone changes them on purpose, and then the old one should still be findable, with the reason it lost, or the next agent will propose it again. Files hold the code's current shape and CLAUDE.md holds standing instructions, and [what persists between sessions](https://kgai.dev/blog/claude-code-memory-between-sessions) is worth knowing exactly. Neither holds the ruling.

We build kgai around that distinction, a decision memory for AI dev teams, so weigh what follows accordingly. Decisions land in an append-only, immutable log, and the graph the agent queries is a deterministic projection of that log. Recording happens at the write boundary, through a skill and hooks, so Monday's ruling is captured on Monday. Tuesday's agent asks about the invoice module and gets back only the decisions in force there. Changing your mind means recording a new decision that supersedes the old one through an explicit link with a reason. The dead end stays queryable, which is [the whole point of keeping them](https://kgai.dev/blog/dead-ends-are-documentation). Recall is lexical matching plus graph traversal, no embeddings in the read path, so two machines with the same log give the same answer.

None of this needs a daemon or a server. Team sync is opt-in through an S3 bucket you own, and each writer appends to a shard of their own, so parallel writes never produce a textual conflict. MIT licensed, shipped as a Claude Code plugin with a standalone kg CLI.

A bigger context would let Tuesday's agent reread Monday. A record lets it know what Monday decided.

## Try kgai

Two commands, MIT, nothing leaves your machine until you configure a bucket:

```
claude plugin marketplace add kgaidev/kgai
claude plugin install kgai@kgai-marketplace
```

Source: https://github.com/kgaidev/kgai
See how kgai compares to other tools: https://kgai.dev/compare
All notes: https://kgai.dev/blog/

---

Canonical: https://kgai.dev/blog/claude-code-forgets-sessions · Written by kgai maintainers · kgai is MIT open source
