This document defines the recommended way to run Claude and Codex in parallel on SkillHub without letting them overwrite each other.
Legacy aliases agent-worktrees and agent-sync still work as compatibility shims, but the canonical command set is parallel-init, parallel-sync, parallel-up, and parallel-down.
- Keep Claude and Codex isolated while they write code.
- Reserve a single browser test environment at
http://localhost:3000. - Make integration predictable before opening a pull request.
Do not let two agents write to the same checkout at the same time.
Instead, use three sibling git worktrees per task:
...-claude-<task>: Claude writes code here...-codex-<task>: Codex writes code here...-integration-<task>: merged result, browser verification, final regression
Only the integration worktree should run make dev-all. That keeps http://localhost:3000 and http://localhost:8080 as a single source of truth for the merged feature.
All worktrees share the same local Docker dependency project name, so make dev and make dev-all reuse one set of Postgres, Redis, and MinIO containers across checkouts.
From the main repository:
make parallel-init TASK=legal-pagesThis creates:
../skillhub-claude-legal-pages../skillhub-codex-legal-pages../skillhub-integration-legal-pages
And matching local branches:
agent/claude/legal-pagesagent/codex/legal-pagesagent/integration/legal-pages
You can override the base branch or destination root:
make parallel-init TASK=legal-pages PARALLEL_BASE_REF=origin/main PARALLEL_WORKTREE_ROOT=/Users/wowo/workspaceIf you are iterating on this workflow itself before it lands on origin/main, create the worktrees from your current branch instead:
make parallel-init TASK=legal-pages PARALLEL_BASE_REF=HEADKeep the split coarse and explicit before either agent starts:
- Claude: requirements, review, copy, UI structure, edge cases, regression review
- Codex: implementation, wiring, scripts, tests, refactors, fixes
Avoid assigning the same file to both agents. If both agents must touch one file, switch to sequential editing for that file.
Run each agent only in its assigned worktree:
- Claude works in
../skillhub-claude-<task> - Codex works in
../skillhub-codex-<task>
Each agent should commit its own work before integration.
From the integration worktree:
cd ../skillhub-integration-legal-pages
make parallel-upThis does both routine steps in one command:
- merges the default source branches into the current integration branch
- starts the integration worktree with
make dev-all
The default source branches are:
agent/claude/legal-pagesagent/codex/legal-pages
If you need manual control, you can still split the flow:
cd ../skillhub-integration-legal-pages
make parallel-sync
make dev-allIf needed, you can override the source list on either command:
make parallel-sync SOURCES="agent/claude/legal-pages agent/codex/legal-pages"
make parallel-up SOURCES="agent/claude/legal-pages agent/codex/legal-pages"If a merge conflict happens, resolve it in the integration worktree. Do not resolve it inside the Claude or Codex worktree unless you intentionally want to rewrite that branch.
Run the local stack only in the integration worktree:
cd ../skillhub-integration-legal-pages
make parallel-upThen verify the merged result in the browser:
- Web UI:
http://localhost:3000 - Backend:
http://localhost:8080
When you are done:
make parallel-downBefore opening a PR from the integration branch:
- Run the smallest relevant local verification first, for example
pnpm --dir web typecheckor backend tests. - From the integration worktree, run
make parallel-up. - Verify the final merged behavior in
http://localhost:3000. - Run
make stagingif the change needs Docker-path or smoke-test confidence.
- If one agent’s branch goes in the wrong direction, reset or discard that branch only in its own worktree.
- If integration becomes messy, recreate only the integration worktree branch from the original base and merge again.
- If ports are already in use, make sure no Claude or Codex worktree is running its own local stack.
There are two safe choices:
- Open the PR from the integration branch after merged verification passes.
- Or cherry-pick the validated commits onto a clean feature branch and open the PR from there.
For this repository, the simplest path is usually:
- Claude branch commits
- Codex branch commits
- In the integration worktree, run
make parallel-up - Verify on
localhost:3000 - Open the PR from integration
make parallel-init TASK=legal-pages
cd ../skillhub-integration-legal-pages
make parallel-up
open http://localhost:3000
make parallel-down