Skip to content

fix: #6 — feat(codex): Codex adapter (Mode A + Mode B + skill)#16

Merged
MiaoDX merged 1 commit into
mainfrom
claude-issue-6
May 2, 2026
Merged

fix: #6 — feat(codex): Codex adapter (Mode A + Mode B + skill)#16
MiaoDX merged 1 commit into
mainfrom
claude-issue-6

Conversation

@MiaoDX

@MiaoDX MiaoDX commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #6.

Adds the Codex adapter assets — Mode A skill + per-agent invocation pin, and a shell wrapper for Mode B recap (since Codex has no Stop-equivalent hook).

Mode A

  • adapters/codex/skills/scripture-lookup/SKILL.md — manual fallback skill, contains no scripture text (verse content is fetched from the bundled MCP at runtime).
  • adapters/codex/skills/scripture-lookup/agents/openai.yaml — pins allow_implicit_invocation: false for the OpenAI/Codex model (Codex equivalent of Claude's disable-model-invocation: true).
  • [features] codex_hooks = true and the UserPromptSubmit hook live in the config.toml snippet init --target=codex already writes (issue feat(core): stdio MCP server + CLI subcommands #4); the inline [[bible:John 3:16]] marker is recognized by lookup-from-prompt.

Mode B

  • adapters/codex/wrapper/cdx (POSIX bash) and adapters/codex/wrapper/cdx.ps1 (PowerShell) wrap codex, capture its exit code, then run scripture-mcp recap --terminal and exit with the captured code. Recap fires on success and on non-zero exit.
  • scripture-mcp init --target=codex --recap=on now prints the alias-setup instructions for the wrapper. (We do not auto-edit the user's shell rc files.)
  • README documents the limitation honestly: launching codex directly bypasses the recap. This is a deliberate physical-isolation trade-off — it guarantees the recap text can never enter a future Codex model_call input.

Codex skill path

README explicitly notes the official-docs / OSS-repo disagreement on ~/.codex/skills vs $CODEX_HOME/skills vs ~/.agents/skills. We use ~/.codex/skills to match the same ~/.codex/config.toml location init writes to.

Tests

  • adapters/adapters_test.go: structural assertions on the skill, the agents/openai.yaml pin, and both wrappers (capture exit → recap → exit with captured code).
  • Skill body is verified scripture-free against every bundled verse.
  • internal/cli/init_test.go: --target=codex --recap=on prints the cdx alias hint; --recap=off does not.

Test plan

  • go build ./...
  • go test ./...
  • go vet ./...
  • Manual smoke: cdx --help → recap fires after codex --help exits (requires a real codex install; not exercised in CI)

Generated by Claude Code

Mode A: scripture-lookup skill at adapters/codex/skills/scripture-lookup/
with agents/openai.yaml pinning allow_implicit_invocation: false (Codex
equivalent of Claude's disable-model-invocation). Marker syntax for the
existing UserPromptSubmit hook is the inline [[bible:John 3:16]] form
already recognized by lookup-from-prompt.

Mode B: cdx shell wrappers (POSIX bash + PowerShell) wrap codex and run
scripture-mcp recap --terminal after exit, preserving the wrapped exit
code. Codex has no Stop-equivalent hook, so the recap fires from the
wrapping shell — physically outside any model_call input. README and
init --target=codex --recap=on now print the alias-setup steps and the
honest limitation: launching codex directly bypasses the recap.

Embed assets via embed.FS and add structural tests asserting the skill
contains no scripture text and the wrappers capture exit, recap, then
exit with the captured code.

Closes #6
@MiaoDX MiaoDX marked this pull request as ready for review May 2, 2026 02:17
@MiaoDX MiaoDX merged commit b144737 into main May 2, 2026
1 check passed
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.

feat(codex): Codex adapter (Mode A + Mode B)

2 participants