fix(plugins): prompt Codex checkpoints after compaction#1142
fix(plugins): prompt Codex checkpoints after compaction#1142phernandez wants to merge 5 commits into
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5aa5728829
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53136dd728
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: phernandez <paul@basicmachines.co>
Why
PR #1138 introduced a PreCompact-to-Stop request handshake so Codex could author durable
checkpoints instead of promoting lifecycle telemetry into graph notes. A real reinstall showed
that the request files accumulated while subsequent compactions produced no checkpoint notes:
the Stop continuation is not the reliable post-compaction entrypoint we assumed.
Codex does provide a deterministic post-compaction entrypoint:
SessionStartruns again with thecompacttrigger and the resumed agent has the compacted working context needed to write a usefulhandoff. This PR moves checkpoint prompting to that lifecycle event and removes the private
coordination machinery.
What Changed
codex:bm-checkpointwhen thetrigger is
compactand a primary Basic Memory project is configured.request file.
wiring, and status counter.
hooks in the same event.
SessionStart flow.
a2a3b1fd8aca21123c464064fff8feb7040d2af1.Implementation Details
Codex ignores PreCompact stdout, so PreCompact cannot directly ask the model to write a note.
After compaction,
_session_start()recognizes the Codexcompacttrigger and prefixes the normalBasic Memory orientation brief with the deliberate checkpoint instruction. The prompt is retained
even when the graph is temporarily unreachable, and
sessionProfileonly determines whether thecheckpoint skill writes a
codex_sessionorcoding_sessionnote.There is no background or synthetic-note fallback. The resumed agent remains responsible for
writing one useful, evidence-backed checkpoint from its compacted context. Lifecycle envelopes
remain private local trace and do not become graph notes.
The installer keeps the retired
stopcommand in its ownership matcher solely so upgrades canremove Basic Memory's old Stop hook without deleting unrelated user hooks.
Testing
Automated
git diff --check: passed.just fast-check: passed; type checking reported nine existing Python 3.14 asyncio deprecationwarnings.
BASIC_MEMORY_ENV=test LOGFIRE_IGNORE_NO_CONFIG=1 uv run pytest -q --no-cov tests/cli/test_hook_command.py tests/test_codex_plugin_package.py plugins/codex/hooks: 119 passed.just package-check: passed across the Claude Code, Codex, shared-skill, Hermes, and OpenClawpackage gates; Hermes reported 257 passed / 12 opt-in integration skips and OpenClaw reported
226 passed.
BASIC_MEMORY_ENV=test LOGFIRE_IGNORE_NO_CONFIG=1 just doctor: passed.Manual
contains the new SessionStart behavior.
origin/main.Risks / Follow-ups
SessionStartwithtrigger = "compact"; thepackage tests cover that contract and distinguish it from ordinary startup.
than deleting user-local data during upgrade.
installed cache can be proven against the merged package.