Mohamed Ashraf Elsaed

Why AI coding agents forget between sessions

By Mohamed Ashraf ElsaedPublished 2 min read

In my experience, AI coding agents start each session without the last one. You explain the repository, the deploy rule and the odd naming convention on Monday, and on Tuesday the agent asks again. Switch from one tool to another and the memory does not follow you.

Aletheia (npm package aletheia-mem) is my answer: one SQLite file on your machine that every tool reads and writes. This post explains the design, what works today and what does not.

The problem in three parts

  1. Sessions end. The model’s context is gone when the session closes.
  2. Each tool keeps its own instructions. Claude Code, Codex, Cursor and Gemini CLI each read their own instruction file, such as CLAUDE.md, AGENTS.md and GEMINI.md.
  3. You cannot inspect or move it. When memory lives inside a product, you cannot search it, edit it or take it with you.

How Aletheia works

A hook is a small command that a tool runs at fixed moments, such as the start of a session or after a tool call. Aletheia installs hooks into each supported tool; only Claude Code, Command Code and Codex CLI have been run for real (see below). They do four things:

  1. Capture what happened, where the tool offers the event: prompts, tool calls and the end of a turn.
  2. Redact secrets and <private> blocks before anything is stored. Redaction is pattern based, so it is not complete.
  3. Store the result in one SQLite file with full-text search (FTS5).
  4. Return a short context block when the next session starts.

Any tool can also read the same store over MCP, REST or the command line.

npm install -g aletheia-mem
aletheia-server
aletheia install claude-code          # dry run: prints every file it would change
aletheia install claude-code --write  # MCP entry, hooks and a rules block, with backups

What I checked, and what I did not

Hooks have run in real sessions of Claude Code (two days of use), Command Code (one short session) and Codex CLI (one interactive session). That is one user on one machine, and it is the project’s own record in its status and limits page. Cursor, Gemini CLI and Windsurf are config written from their documentation, not tested on a real install. Answer accuracy is not measured; the benchmarks measure retrieval only.

What I would do differently

I would have written the claims table before the features. The documentation now says what was checked and what was not.

Next

The next post compares Aletheia with claude-mem using numbers you can re-run for the Aletheia rows.

Sources

This post was drafted with AI assistance. I reviewed every claim and ran the commands shown.

About the project: Aletheia.

Mohamed Ashraf Elsaed
Mohamed Ashraf Elsaed
Technical Lead at Convertedin, Cairo. I build tools for AI coding agents and write about Laravel, Node and engineering.