Skip to content

feat(codex): report memory load and save status through systemMessage - #1648

Merged
doobidoo merged 3 commits into
doobidoo:mainfrom
dodoshell:codex-memory-status
Oct 22, 2026
Merged

doobidoo merged 3 commits into
doobidoo:mainfrom
dodoshell:codex-memory-status

Conversation

@dodoshell

@dodoshell dodoshell commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

The Codex hooks now report a one-line systemMessage when they load or save memories: Memory: loaded 8 project memories. on SessionStart (or Memory: retrieval failed, using 8 cached project memories. when only the cached context is available), and one combined Memory: saved 2 memories and a session summary. per Stop/PreCompact run.

Why

Successful loads and saves were silent, so there was no way to tell from Codex whether the integration was working. Fixes #1641

How it was verified

node codex/tests/memory-hook.test.js. The new tests cover fresh and cached retrieval, the context budget, an empty result, combined and single-kind saves, no-op checkpoints, confirmed duplicates, failed writes and SessionEnd. The tests that check a message fail on main and pass on this branch.

I'm on Windows, where two or three of the lock tests (one is flaky) and the three install-hooks tests already fail on main because of directory rename semantics and the python3 alias. They fail the same way with this change, so CI on Linux is the real check here.

Changelog fragment

No src/ change, so none added.

Notes for the reviewer

  • Only new writes count. A capture or summary that turns out to be a confirmed exact duplicate is checkpointed as before but not reported.
  • If a capture succeeds and the summary then fails, the run throws and nothing is reported. I preferred that to announcing partial progress from a failed run.
  • State files from before this change have a cached context but no count, so the cached message leaves the number out.

Agent Disclosure

I used Claude Code to help with this change, and I went through the diff, the tests and the description myself before opening this.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new blocking issue was established.

Summary

Adds one-line memory status messages through systemMessage.

  • Codex reports how many project memories it loads.
  • Codex reports new memories and summaries after checkpoints.

Both previous threads are unnumbered, so neither requires a numbered finding entry.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Hook event] --> B{SessionStart?}
  B -->|Yes| C[Retrieve memories or use cached context]
  C --> D[Return context and load status]
  B -->|No| E[Capture memories and save summary]
  E --> F[Checkpoint successful writes and confirmed duplicates]
  F --> G{SessionEnd?}
  G -->|Yes| H[Return no status]
  G -->|No| I[Report only new writes]
Loading

Reviews (3) · Last reviewed commit: "Merge branch 'main' into codex-memory-st..." · Reviewed by Greptile

SessionStart reports how many project memories were loaded, or that the
cached context is being used after a failed retrieval. Stop and PreCompact
report new captures and the session summary in one message. No-op
checkpoints, confirmed duplicates, failed writes and SessionEnd stay silent.

Fixes #1641
Comment thread codex/memory-hook.js Resolved
Comment thread codex/memory-hook.js Resolved
@doobidoo
doobidoo enabled auto-merge (squash) October 22, 2026 21:14
@doobidoo
doobidoo merged commit 168337a into doobidoo:main Oct 22, 2026
18 checks passed
@dodoshell
dodoshell deleted the codex-memory-status branch October 22, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex: show memory load and save status through hook systemMessage

2 participants