Repository navigation
feat(codex): report memory load and save status through systemMessage - #1648
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The Codex hooks now report a one-line
systemMessagewhen they load or save memories:Memory: loaded 8 project memories.on SessionStart (orMemory: retrieval failed, using 8 cached project memories.when only the cached context is available), and one combinedMemory: 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-hookstests already fail on main because of directory rename semantics and thepython3alias. 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
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.


Confidence Score: 5/5
The PR appears safe to merge; no new blocking issue was established.Summary
Adds one-line memory status messages through
systemMessage.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]Reviews (3) · Last reviewed commit: "Merge branch 'main' into codex-memory-st..." · Reviewed by Greptile