fix(plugins): author Codex checkpoints after compaction#1138
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: 54d5813ce0
ℹ️ 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>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c9a3217c5
ℹ️ 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>
Why
Codex lifecycle capture was treating harness telemetry as durable knowledge.
bm hook flushprojected sparse SessionStart/PreCompact envelopes into synthetic
sessionandtool_ledgernotes, which produced low-value session garbage instead of useful handoffs.
The attempted automatic checkpoint path had a second mismatch: Codex ignores PreCompact
stdout, and the transcript adapter expected a Claude-shaped transcript rather than Codex
response_itemevents. Hooks could be enabled and visibly capture events without the activeagent ever authoring an actual checkpoint.
The Codex marketplace instructions also made it easy to sparse-checkout only
plugins/codex,which omits the repository marketplace manifest and causes the "marketplace root does not
contain a supported manifest" installation error.
What Changed
basic-memory hook flushnow archivesvalid envelopes locally and never writes knowledge-graph notes.
Stop blocks once and asks the active model to run
codex:bm-checkpointfrom its compactedworking context.
response_item.payloadtranscript records, includinginput_textandoutput_text, for checkpoint context.redactKeysandredactPathsto every authored checkpointfield, failing closed instead of writing when the privacy gate cannot be satisfied.
session/tool_ledgerrecall from the Claude and Codex skills and updatehook status language to report archived trace and pending checkpoint requests.
.agents/pluginsandplugins/codex; the marketplace manifest should not move.Implementation Details
src/basic_memory/hooks/archive.pyowns the trace-only flush path. Invalid envelopes remainpending for inspection; valid envelopes move into the private processed archive under the
existing retention and locking rules.
src/basic_memory/hooks/checkpoint_requests.pystores one atomic, owner-only request per Codexsession. The first Stop emits a
decision: blockresponse; the re-entrant Stop clears therequest and continues when
stop_hook_activeis true, preventing a loop.fallback manufactures memory from lifecycle payloads.
bm-checkpointnow scrubs title, directory, tags, frontmatter, body, repo/PR evidence, andembedded paths before
write_note; required path fields use[REDACTED_PATH]instead ofleaking or disappearing.
src/basic_memory/hooks/projector.pyremains as a compatibility re-export while the graphprojection implementation is removed.
f802a01ddd0d6eab5b83cc7c684619776b7df1db, which already contains the Stop command. Keepingthe pin in a second commit avoids a wrapper/runtime circular dependency.
Testing
Automated
uv run pytest -q --no-cov tests/hooks tests/cli/test_hook_command.py tests/cli/test_coding_session_context.py plugins/codex/hooks tests/test_codex_plugin_package.py: 238 passedjust package-check-codex: passed against the final hook pinjust fast-check: passedjust package-check: passed across Claude Code, Codex, shared skills, Hermes, and OpenClaw packagesjust doctor: passeduv run python /Users/phernandez/.codex/skills/.system/plugin-creator/scripts/validate_plugin.py plugins/codex: passedgit diff --check: passedManual
Stop returned the one-time block instruction, and the re-entrant Stop returned
{"continue": true}.envelopes and checkpoint requests returned to zero.
sessionandtool_ledgernotes after the exact flush timestamp: 0 results, provingthe flush path no longer promotes telemetry into the graph.
Risks / Follow-ups
skill correctly. The loop guard fails open, the privacy policy fails closed before writing,
and neither path falls back to synthetic telemetry notes.
a separate, explicit cleanup operation.
and the plugin is refreshed in a new Codex thread.