Skip to content

feat(hooks): add Codex lifecycle snapshots and bounded context - #23

Merged
robinv8 merged 4 commits into
mindmuxai:mainfrom
davidfilat:feat/codex-lifecycle-hooks
Sep 9, 2026
Merged

robinv8 merged 4 commits into
mindmuxai:mainfrom
davidfilat:feat/codex-lifecycle-hooks

Conversation

@davidfilat

@davidfilat davidfilat commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Codex users can now opt into project-local brain context with brain install-hooks --agent codex and remove it with brain uninstall-hooks --agent codex. The existing Claude Code default is preserved. Fixes #22.

The shared installer preserves unrelated settings and hook commands, rejects foreign scripts and symlinks, and installs one SessionStart handler for startup, resume, clear, and compaction. The hook uses the existing CLI to resolve redirected brains, fails open, and limits Codex execution to five seconds.

Codex snapshots retain complete UTF-8 rows within 8 KiB and direct the agent to fetch the full index when truncated. Codex wiring complements Astra's native notes/history with page references and current-page reads. Installation never changes model settings, enables experiments, or writes memory automatically.

Validation

  • All 49 tests pass on Node 18.20.8, 20.20.2, and 22.22.2.
  • Pinned Codex CLI 0.153.4 with an isolated configuration and local mock Responses endpoint: verified configuration discovery/trust, startup, resume after app-server restart, and manual/automatic compaction context delivery in model requests.
  • A synthetic slow CLI timed out after 5,003 ms; the Codex turn still completed.
  • A 500-page multilingual fixture shrank from 22,321 to 8,164 injected bytes; five-run median latency was 62.6 ms uncapped versus 64.4 ms bounded. This is an output-size improvement, not a claimed latency or token-count improvement.

Compatibility limits

Codex CLI 0.153.4 is the tested supported baseline; older releases were not validated. The hook requires Node 18+ and POSIX sh/awk. Its generated absolute command requires uninstalling before moving a project and reinstalling at the destination.

Live Astra experimental-rollover recall and desktop behavior remain unverified. The available sign-in cannot exercise the launch-gated experiment, and a mock endpoint does not prove native notes/history behavior. The documentation explicitly retains wired instructions and CLI reads as the fallback.

@sunshineg
sunshineg requested review from joyqi and robinv8 September 7, 2026 05:14

@robinv8 robinv8 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This is a careful, opt-in Codex SessionStart integration that keeps the Claude Code default intact. The shared installer quotes absolute Codex commands, refuses symlinks and foreign scripts, merges without clobbering unrelated hook groups, and the hook fails open, resolves brainRoot, covers startup|resume|clear|compact, and prefix-truncates to 8 KiB of whole UTF-8 rows. Hook tests (19/19) pass locally; remaining nits are generated-text formatting and one jargon comment in the shipped script.

Issue counts by severity

  • bugs: 0
  • suggestions: 1
  • nits: 1

Comment thread skills/brain-page/bin/brain.mjs
Comment thread skills/brain-setup/hooks/session-start Outdated
@robinv8
robinv8 merged commit 65f616a into mindmuxai:main Sep 9, 2026
3 checks passed
@robinv8

robinv8 commented Sep 9, 2026

Copy link
Copy Markdown
Member

Thanks for the Codex hooks — merged.

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.

Add Codex lifecycle-hook support to brain install-hooks

2 participants