feat: Codex startup parity (#633)#658
Conversation
Extract context-surfacing logic from Claude's SessionStart hook into a reusable generate_startup_context() function. Add `synapt recall startup` CLI command with --compact and --json modes so Codex (and any other tool) gets the same journal/reminder/channel context Claude gets automatically. Update codex-loop.sh to auto-inject startup context before each prompt. **Premium boundary**: OSS only. This is public recall infrastructure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement. To sign, please comment on this PR with the following exact text:
You can also re-trigger the CLA check by commenting I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
laynepenney
left a comment
There was a problem hiding this comment.
LGTM. Clean DRY refactor with a useful Codex parity addition.
Extraction: generate_startup_context() correctly pulls the 9-step startup logic out of cmd_hook without changing behavior. The refactor in cmd_hook reduces to a single loop, which is exactly right. Same output, single source of truth.
codex-loop.sh: Startup injection is safe — || true prevents failure if synapt isn't installed, empty-string check prevents injecting a blank prefix. The --no-startup escape hatch is the right design for automated/test callers.
Minor note: generate_startup_context() calls channel_join('dev', role='human') (step 7), which creates a presence row for the calling process. In Codex's headless loop, this will register a new presence entry each run. Same behavior as the old cmd_hook path, so not a regression — but worth tracking if agent presence gets noisy. Non-blocking.
Boundary: OSS recall infrastructure. No premium content, no identity/org writes.
11 new tests, 46 existing CLI tests still passing. At 0 reviews — needs 2 before merge.
laynepenney
left a comment
There was a problem hiding this comment.
LGTM. Second review.
The extraction is clean: generate_startup_context() returns list[str] so callers choose formatting (print, join, JSON-wrap). cmd_hook reduces to a two-line loop. Side effects (archiving, background indexing, enrichment) stay in cmd_hook where they belong.
The compact mode properly flattens multi-line blocks via splitlines + rejoin, preventing prompt bloat in Codex's headless exec path. The codex-loop.sh integration is safe: || true + empty-string guard + --no-startup escape hatch.
11 tests with full coverage of all three output modes plus empty-context edge cases. Ready to merge.
laynepenney
left a comment
There was a problem hiding this comment.
Opus review: LGTM. Clean DRY refactor extracting generate_startup_context() from cmd_hook(). The shared function returns context lines; callers decide how to emit them (print in cmd_hook, JSON/compact in cmd_startup, prompt prefix in codex-loop.sh).
Key design decisions:
- Side effects (background indexing, enrichment, archiving) remain in cmd_hook only, not in the shared function. Correct: Codex has its own lifecycle.
--no-startupflag on codex-loop.sh for opt-out.- Startup context injected before the user prompt in codex-loop (
[Recall context] ... ${PROMPT}).
Tests: 4 test classes covering generate_startup_context (empty, journal, reminders, channel), cmd_startup (plain, compact, JSON, empty), and CLI registration. Good coverage with appropriate mocking boundaries.
At 2 reviews (Layne + Opus). Meets policy.
Summary
SessionStarthook into a reusablegenerate_startup_context()functionsynapt recall startupCLI command with--compactand--jsonoutput modescodex-loop.shto auto-inject startup context before each prompt via--no-startupopt-out flagcmd_hookto use the shared function (DRY, same behavior)Premium boundary: OSS only. Public recall infrastructure enabling cross-tool startup parity.
What Codex gets now
When
codex-loop.shruns (or any tool callssynapt recall startup):Test plan
test_startup.pycoveringgenerate_startup_context(),cmd_startupoutput modes, and CLI registrationsynapt recall startup,--compact, and--jsonmodes end-to-endCloses #633
🤖 Generated with Claude Code