Skip to content
sangleshubhamPublic

About

Combine claude + codex

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agentkit

Claude Code on Opus plans, routes and reviews; Codex (GPT-6.1 Sol, through the openai/codex-plugin-cc plugin) writes the code; a Claude Opus complex-implementer subagent takes only high-risk units. agentkit is one bash file that sets this up on a machine and in any repo.

You -> Opus session (plan, route) --default--> codex:codex-rescue (Codex, Sol)
                                   \--high-risk--> complex-implementer (Opus)
       both --> reviewer (Opus): PASS -> commit on agent/<unit> | FIX (max 2) | ESCALATE

Install (once per machine)

git clone <your-private-remote>/agent-kit.git ~/.agent-kit   # or keep it anywhere
~/.agent-kit/agentkit install

install installs Claude Code and the Codex CLI if missing, writes ~/.codex/config.toml only if you have none, installs the codex@openai-codex plugin at user scope, and links agentkit into ~/.local/bin. Then sign in once:

claude setup-token          # headless; export CLAUDE_CODE_OAUTH_TOKEN=<token>
codex login --device-auth   # or copy ~/.codex/auth.json from a laptop

Set up a project (once per repo, safe to re-run)

cd ~/work/<repo> && agentkit init
# review AGENTS.md (Commands section), then commit the result
File Read by Written by init
AGENTS.md Codex and Claude Created once with detected install/test/lint commands; never overwritten. An existing CLAUDE.md is moved here (backup kept).
CLAUDE.md Claude @AGENTS.md on line 1, plus the orchestration rules between agentkit:begin/end markers (refreshed on every run).
.claude/agents/reviewer.md, complex-implementer.md Claude Refreshed while they carry the "managed by agentkit" marker.
.claude/settings.json Claude Merged: model (only if unset), plugin enabled, marketplace declared.
.codex/config.toml Codex Model, effort, approval_policy = "never", workspace-write, network off.
~/.codex/config.toml Codex Appends a [projects."<repo>"] trust_level = "trusted" entry so the project config applies.
.gitignore git Adds .worktrees/.

Override models at setup time: CODEX_MODEL=<id> CODEX_EFFORT=xhigh CLAUDE_MODEL=claude-opus-5-5 agentkit init. Set CODEX_NETWORK=true for a project where Codex itself must install packages.

Commands

Command What it does
agentkit install Machine setup (above).
agentkit init [dir] Project setup (above). Works from inside a linked worktree too; it always targets the main checkout.
agentkit wt <name> [base] [--no-install] Creates .worktrees/<name> on branch agent/<name> from base exactly as given (default: the branch checked out in the main checkout; pass origin/main to start from the remote), installs dependencies there (npm/pnpm/yarn, uv, poetry, go; bare pip is skipped with a warning), and prints only the path on stdout.
agentkit codex <name> [--resume] [--model m] [--effort e] [prompt...] Runs a Codex task through the plugin's runtime with the unit's worktree as Codex's workspace (write access there only). Prompt from args, --prompt-file <f>, or stdin. --resume continues that worktree's last Codex thread.
agentkit codex <name> status|result|cancel Job status, output or cancel for that worktree.
agentkit rm <name> Removes a clean unit worktree; keeps the branch.
agentkit doctor [dir] One line per machine and project check; exits non-zero if anything is missing.

Daily use

tmux new -As work
cd ~/work/<repo> && claude
> APP-1234: <ticket text>. Plan, route, and bring every unit to review PASS.

Approve the plan and route table, watch a unit with agentkit codex <unit> status (or result), read the final report, then push the agent/ branch and raise the PR yourself. To take over a Codex run, use the codex resume <session-id> line printed at the end of its output.

Changes from the original plan, and why

  • Builders never commit. Codex's workspace-write sandbox keeps .git read-only, so it cannot git add/commit. Builders leave changes uncommitted; the reviewer reads git diff HEAD and untracked files; Opus commits after PASS.
  • Units go to Codex through agentkit codex <unit>, not codex:codex-rescue. The rescue subagent always runs Codex at the git top level of the Claude session, so Codex could write to the main checkout and every other unit's worktree, ran npm test against unchanged code, and --resume picked the newest thread in the whole repo (or refused while any other unit was running). agentkit codex calls the same plugin runtime with --cwd <worktree>: Codex's sandbox, commands and resume thread are all scoped to that unit. /codex:rescue is still there for ad-hoc questions.
  • Dependent units chain branches. Unit B is created from agent/<A> after A passes review, and wt uses an explicit base exactly as given (no silent swap to origin/<base>), so the reviewer diffs against the right ref.
  • Symlinked instruction files. A CLAUDE.md -> AGENTS.md symlink is replaced by a real CLAUDE.md; a symlinked AGENTS.md stops init. Otherwise the Claude-only rules would leak into the file Codex reads.
  • Trust is read, not assumed. A project you once marked untrusted in Codex is reported by init and doctor instead of being treated as trusted.
  • wt installs dependencies. Codex runs with network off, so a fresh worktree would have no node_modules.
  • Worktree-safe roots. init, wt and rm resolve the main checkout even when run inside .worktrees/<x>, so worktrees never nest.
  • Logs on stderr, so path=$(agentkit wt x) works; doctor checks are argument-safe (no eval) and check the configured model, not the default one.
  • Input validation for CODEX_EFFORT, CODEX_NETWORK and model ids; a .gitignore or config.toml without a trailing newline is no longer corrupted.

Guardrails

  • Never enable the plugin's review gate (/codex:setup --enable-review-gate): it runs Codex after every Claude reply and can drain both plans.
  • Fix rounds are capped at 2, then the unit escalates to Opus.
  • Agents push only agent/ branches; protect main on the remote.
  • On a shared VPS, run everything as a dedicated non-root agent user with a deploy key that can push feature branches only.

Tests

bash tests/run.sh
uvx --from shellcheck-py shellcheck -x agentkit tests/*.sh

About

Combine claude + codex

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages