MemoryRouter
Codex memory

Codex memory between sessions, fixed with hooks

Codex starts every session from AGENTS.md and the current repository state. The work you did together, the decisions behind the code, and the dead ends you ruled out are not in either one.

OpenAI. Sources checked 2026-09-25.

How Codex handles memory today

Codex builds context from AGENTS.md files in a layered order: global guidance first, then project files from the repository root down, then subtree files when it reads inside a directory. AGENTS.override.md can replace the global file. OpenAI documents a size cap, so very large AGENTS.md files get truncated rather than rejected.

Inside a session, Codex manages context as the window fills and compacts older conversation. The compaction output is the model’s summary of what happened, which is not the same thing as what you decided.

What Codex forgets

Codex does not forget the repository. It forgets the conversation that produced it.

The fix with MemoryRouter

The Codex package installs lifecycle hooks that recall relevant memory before the model runs and capture the completed turn after it. Compaction triggers a re-inject, so the session continues with its working context instead of a summary of it.

  1. 1

    Install the Codex package

    Scope the install to your user account, then authenticate when prompted. Node 18 or newer, and a current Codex build for full hook support.

    Install hooks

    npx -y memoryrouter-codex init --scope user
  2. 2

    Check health

    Run doctor and confirm the hooks are registered for the scope you chose.

    Verify

    npx -y memoryrouter-codex doctor --scope user
  3. 3

    Test a fresh session

    Finish a turn where you make a real decision, open a new session in the same project, and ask for the decision. It comes back without you restating it.

For a fully local install where the key never sits in shell history, the Codex guide documents a stdin variant that pipes the key from your clipboard.

Install for Codex

Install guide, verification steps, and removal commands on the Codex page. 14-day free trial.

Related

Codex memory FAQ

Sources

Sources checked 2026-09-25. Tool behavior changes; check the vendor docs before relying on a detail.

Start free