Skip to content

Add Codex compatibility layer for stepwise skills and agents - #12

Merged
nikeyes merged 9 commits into
mainfrom
feat/codex
Sep 4, 2026
Merged

Add Codex compatibility layer for stepwise skills and agents#12
nikeyes merged 9 commits into
mainfrom
feat/codex

Conversation

@nikeyes

@nikeyes nikeyes commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Summary

Adds an OpenAI Codex compatibility layer so the same skills and agents that already run under Claude Code also run under Codex, without duplicating content or forking the tree.

  • New codex/ directory with install.sh, uninstall.sh, transpile-agents.sh, and the nine generated codex/agents/*.toml (committed so marketplace installs don't need a working transpiler)
  • Skills are symlinked into ~/.agents/skills/; agents copied into ~/.codex/agents/
  • Every SKILL.md script line defaults \${CLAUDE_PLUGIN_ROOT} to \$HOME/.agents so it resolves under both harnesses
  • User-invoked skills opt out of implicit invocation via agents/openai.yaml (mirrors the disable-model-invocation flag they already carry for Claude Code)
  • New make install-codex, uninstall-codex, transpile-codex, check-codex targets — check-codex is wired into ci so a stale TOML or a bare \${CLAUDE_PLUGIN_ROOT} fails the build
  • test/codex-test.sh covers the transpilation contract; test/plugin-structure-test.sh picks up the coverage that was missing for the practice skills, review-pr-comments, and the whole research plugin
  • CLAUDE.md becomes a one-line pointer to a new AGENTS.md (single source of truth read by both Claude Code and Codex)

Test plan

  • make ci passes (41 tests, shellcheck, TOML syntax, \${CLAUDE_PLUGIN_ROOT} fallback, manifest validation)
  • codex/install.sh installs 16 skills + 9 agents; codex/uninstall.sh removes only what was installed (idempotent)
  • Reinstall on top of an existing install is a no-op
  • Manual: invoke /stepwise-core:research-codebase, /stepwise-git:commit, /stepwise-research:deep-research under Codex and verify sub-agents are spawned via forked sessions

Known limitations under Codex

  • research-codebase, create-plan, iterate-plan use \$ARGUMENTS, which Codex does not expand — pass the input in the message itself
  • Codex only delegates on an explicit instruction, so skills spell out the parallel spawns
  • Whether the Codex CLI honors allow_implicit_invocation: false is unverified (it is documented for the ChatGPT desktop app)

OpenAI Codex reads AGENTS.md and Claude Code reads CLAUDE.md; keeping
them as a single source of truth (AGENTS.md) with a one-line pointer
from CLAUDE.md avoids the drift that comes from maintaining two copies.
The four plugins already work under Claude Code. This commit lets the
same skill and agent sources run under OpenAI Codex without duplicating
content or maintaining a separate tree.

- codex/install.sh symlinks core/git/research skills into ~/.agents/skills
  and copies the transpiled agents into ~/.codex/agents; the symlinks
  keep repo edits visible to Codex immediately without reinstalling.
- codex/uninstall.sh removes only what install.sh created, so a
  hand-installed skill or third-party agent survives.
- codex/transpile-agents.sh rewrites each agent .md as a Codex TOML;
  the generated files under codex/agents/ are committed so users who
  install from the marketplace don't need a working transpiler.
- Makefile gets install-codex, uninstall-codex, transpile-codex and
  check-codex; check-codex is wired into ci so a stale TOML or a bare
  ${CLAUDE_PLUGIN_ROOT} in a SKILL.md fails the build.
- test/codex-test.sh covers the transpilation contract (name, tools,
  developer instructions, model mapping, sandbox policy). Helpers gain
  assert_equals and assert_fails for it.
- test/plugin-structure-test.sh gets the coverage that was missing for
  the practice skills, review-pr-comments, and the whole research plugin.
- README.md and AGENTS.md document the Codex path and its limitations
  (Codex doesn't expand $ARGUMENTS, and only delegates on explicit
  instruction).
Every user-invoked skill (create-plan, iterate-plan, implement-plan,
validate-plan, research-codebase, commit, review-pr-comments,
deep-research) ships an agents/openai.yaml with
allow_implicit_invocation: false. This mirrors the disable-model-invocation
flag those skills already carry for Claude Code, so under Codex they only
trigger when the user asks for them by name.
…Codex

Claude Code injects CLAUDE_PLUGIN_ROOT for every skill; Codex does not,
so shell lines like `bash ${CLAUDE_PLUGIN_ROOT}/skills/.../scripts/foo`
expanded to `bash /skills/.../scripts/foo` and blew up. Adding the
`:-$HOME/.agents` default resolves against the Codex install location
that install.sh always uses, and stays a no-op under Claude Code because
the variable is already set.
Users who install via `claude plugin marketplace add` never clone the
repo themselves; the full tree (Makefile, codex/) lands in
~/.claude/plugins/marketplaces/stepwise-dev/ instead. Document both
paths and call out that ~/.claude/plugins/cache/ is not usable for this
since it only carries what each plugin.json declares.
main migrated every agent to `model: inherit` for Bedrock, which the
transpiler rejected as an unknown model — merging the two branches left
`make ci` failing on all nine agents.

`inherit` is now just another entry in the model case, mapping to "pin
nothing": a Codex agent with no `model` key runs on the session's
configured model, which is what inherit means. The haiku/sonnet/opus
mappings stay for an agent that deliberately pins one.

Also:
- derive the list of skills needing an `agents/openai.yaml` from their
  `disable-model-invocation` frontmatter, so a new opt-out skill that
  forgets the file fails instead of passing a hardcoded loop
- `grep -qxE 'Write|Edit'`, since BRE alternation is a GNU/BSD extension
- document uninstall.sh and the inherit mapping in AGENTS.md
- minor bump on core, git and research for the openai.yaml files, with
  marketplace mirrored and patch-bumped

Claude-Session: https://claude.ai/code/session_014PJwGSZGFY3JiP1cSetPER
Verified against codex-cli 0.148.0: an agent role TOML without a `model`
key loads fine (the loader only requires name, description and
developer_instructions), while `model: inherit` in a SKILL.md frontmatter
makes the skill parser drop the annotation — not the skill.

Claude-Session: https://claude.ai/code/session_014PJwGSZGFY3JiP1cSetPER
@nikeyes
nikeyes merged commit 1ccdee9 into main Sep 4, 2026
1 check passed
@nikeyes
nikeyes deleted the feat/codex branch September 4, 2026 13:29
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.

1 participant