Use Codex worktrees and separate test environments when two agents keep breaking each other's changes or tests. Try Shared Kiro Crew when teammates need to pick up the same review or keep repeating the same instructions. A team can use both approaches, with a shared place to hand off work and a separate checkout and test environment for each task that changes code.
Say one agent adds an invoice export and another writes tests. Both report success. Then a second dev server fails on port 3000, a test resets the other agent's database, and the tests expect different CSV columns. Those are three different problems. Give the servers different ports, isolate test data, and agree on the CSV contract before either agent starts.
Which setup solves the problem I have today?
| Two agents edit the same files or switch each other's branch | Separate Git or Codex worktrees | Each writer sees its own checkout and can produce a separate diff. |
| Tests pass alone and fail when two sessions run together | Separate ports and disposable test resources per worktree | Each session owns the services and data its tests can change. |
| The second task depends on an API shape the first agent is still inventing | Agree on the contract first, or run the tasks in sequence | The test writer can work against an agreed behavior, and integration has a single owner. |
| Every reviewer has to re-explain the same rule | Put that rule in AGENTS.md or CI first | The team can review the rule in Git and verify it on every pull request. |
| Teammates need to resume the same session, share memory, or own a recurring review queue | Pilot Shared Kiro Crew on one repo | The team gets a shared place to see work in progress, corrections, and decisions. |
Codex worktrees are separate checkouts for working on a Git repository. Shared Kiro Crew is a team workspace you host and manage. It can run supported harnesses including Codex, so a team can use the same coding agent in either workflow. For file isolation within Crew, Kiro documents a separate working tree and branch for a bot working in a Git repository. Verify the checkout of each writing task before starting, especially if you assign multiple workers inside the same bot or session. Codex worktrees, Shared Kiro Crew, How Crew bots work
Why did my tests break after I put each agent in a worktree?
Git gives each checkout its own tracked files and index. A process started from another folder can still listen on the same machine and connect to the same database. Two sessions can also share an ignored configuration file, a cache directory, or a Docker Compose project if your setup points them there. Developers describe the same pattern in forum threads about missing .env files, servers on port 3000, shared database resets, and migrations that only collide at merge time. Git worktree documentation, Discussion about parallel integration tests, Discussion about using coding agents on the same repo
Two Git worktrees sharing port 3000 and one database, then using separate ports and databases.
Each worktree needs its own test port and database when both run integration tests at the same time.
What we checked in one local repo
In a disposable Git repo on Windows, we created two worktrees from the same commit and edited the same tracked file independently. Editing the feature checkout left the test checkout at the baseline. A Git-ignored .env.local from the original checkout was absent in both manual worktrees. Merging the two different edits to the same line produced a conflict. Two local listeners trying to bind to the same loopback port produced EADDRINUSE. With distinct ports, both could listen.
Local Node.js test showing EADDRINUSE when listeners share port 57133, and both listeners running on ports 57133 and 57134.
In the local Node.js test, a second listener on the same loopback port returned EADDRINUSE. Both listeners started on separate ports.
The product comparison uses current Kiro and OpenAI documentation. The local experiment exercised Git and localhost listeners. It included no Shared Crew team trial or product performance measurements.
| App starts locally, but the agent gets missing environment variables | Is this a fresh checkout? Are the expected files ignored? | Commit an .env.example with placeholders and provide a repeatable setup command. Generate per-worktree test settings. In local Codex-managed worktrees, .worktreeinclude can copy explicitly listed ignored setup files. It does not apply to worktrees you make manually or remote worktrees. |
| Second dev server exits or the browser shows the wrong branch | Check each server's address and the URL the browser or test runner uses. | Give each server its own port. Pass the port to the browser tests, redirects and callbacks. Record the URL in the task handoff. |
| Integration tests delete records or a worker claims another task's jobs | Look for the same database URL, queue name, cache prefix, or storage path across checkouts. | Give sessions disposable databases or isolated instances, plus distinct queue and cache namespaces. Use per-task temporary files and test accounts where relevant. Use a separate Compose project name and verify host port mappings and external volumes. |
| Both migrations work separately, but CI fails after the merge | Check whether both branches edit the same schema, migration history or generated types. | Assign schema changes to one owner. Merge that branch first, then update the dependent branch and rerun migrations and tests from the new base. |
| Tests fail on missing packages or pass with stale output | Check the lockfile, runtime version, dependency install and build directory in the new worktree. | Run the normal locked install per checkout. Keep mutable build output per checkout. Serialize dependency upgrades if tasks need to edit the same lockfile. |
Record the test resources before either agent starts. For example, use port 3101 and database invoice_app_test for implementation, and port 3102 and database invoice_qa_test for tests. Use synthetic data and throwaway credentials. Verify the connection target before migrations, fixtures or cleanup. If your app has only one usable test database, let agents edit separate checkouts and run integration tests one session at a time. Codex-managed worktree setup, Docker Compose project names, Pristren's example of a Next.js app, Postgres and a worker
How do I split the work so two agents can actually run in parallel?
Agree on what the feature should do before handing it to two agents. For the invoice export, specify the CSV columns, which invoices are included, how an empty export behaves, and how to escape values containing commas or quotes. Put those decisions in the issue or a tracked fixture. Then assign work that each agent can finish independently. Pristren's guide to executable specs for coding agents
| Role | Give it ownership of | Ask it to hand back |
|---|---|---|
| Implementation | Export module and its application wiring | Commit or diff, assumptions, and commands run. |
| Tests | Test files and fixtures based on the agreed contract | Tests that would catch a change to the agreed behavior, plus any cases it could not verify yet. |
| Review | The combined diff and acceptance criteria | Blocking findings with evidence from the combined changes. Keep this task read-only unless you assign a fix separately. |
Keep AGENTS.md, migrations, generated files and the lockfile with a single owner when the change touches them. If two tasks must change the same module, split by function only if responsibilities and interfaces are stable. Otherwise, have one writer handle the module and use another session for review or test design. Codex subagents are useful for separate investigations and read-only review. Explicitly assign worktrees when separate writers need their own checkouts. Codex subagents, Pristren’s AGENTS.md guide
Here is a task brief you can paste into either workflow. Adapt the file paths and commands to your repo.
Implement invoice CSV export from the starter commit recorded in the issue.
Use the agreed CSV fixture and acceptance criteria in the issue.
Own the export module and its application wiring. The test task owns tests
and fixtures. If the contract needs to change, report the proposed change
before editing it. Run only against your assigned test environment.
Hand back the commit or diff, the exact commands run, what passed, and
what still needs to be verified on the combined branch.
Pick one person to integrate. Review both diffs, merge in dependency order, and run CI on the combined commit. If the test branch needs symbols from the feature branch, its early failure against the starter commit may be expected. Once both are present, check that the tests pass and that they would catch a broken export. A branch that passes against its own assumptions tells you less than both branches passing against an agreed fixture.
Use the issue or PR to record the same handoff in both workflows. This gives the next teammate enough information to pick up the work even if their agent chat starts fresh.
Base commit and branch or PR:
Acceptance criteria and fixture:
Files or migration owned by this task:
Test environment and URL, with no credentials:
Commands run, results, and remaining checks:
Next decision and who owns it:
Why can't I check out the agent's branch in my main folder?
Git reserves a checked-out branch for the worktree that already holds it. Run git worktree list to find that folder. Review the edits there or use Codex Handoff to move the chat and its edits to Local when you need your usual IDE and setup. In a Codex-managed worktree, a detached HEAD is expected when the chat starts. If you want to keep or share the work, create a branch and commit the changes before cleaning up. Check the staged diff before committing. Git worktree documentation, Codex worktrees and Handoff
When the app creates the worktree, confirm which branch you started from and whether it had local changes. If you want two tasks to start from exactly the same state, use a clean base and record the commit hash. For a manual Git workflow, these commands create two checkouts from the current commit. Run them from the repo root and choose unused directory and branch names.
git worktree add -b agent/invoice-export ../invoice-export-agent HEAD
git worktree add -b agent/invoice-tests ../invoice-tests-agent HEAD
git worktree listNew checkouts need their own setup. Preserve work you want to keep as a commit or PR before removing the worktree. Run git worktree remove for finished manual worktrees once they are clean. In Codex-managed worktrees, review the app's retention settings if disk usage is a problem. Git and the Codex app document their respective cleanup behavior. Git cleanup, Codex worktree cleanup
When does Shared Kiro Crew pay off for a team?
Consider a team where a developer corrects an agent's export review on Monday. On Wednesday a teammate opens a similar PR and a fresh chat makes the same mistake. Add stable requirements to version control or CI first. If people still lose the rationale for a decision or the state of an ongoing review, a Shared Crew offers shared sessions, memory, skills and schedules. Kiro attributes messages and approvals to people inside the Crew. The team can decide whether to approve skill changes before the Crew starts using them. Kiro’s team workflow, Shared Crew documentation
Try one repeatable job before moving a whole team. Give the Crew a test repository and a PR review task. During the first review, correct how it checks a CSV export edge case. Have another teammate pick up a different PR, then check whether the rule was carried forward, whether they can see the earlier rationale, and how much they still have to re-explain. Keep any rule that must always run in your repository or CI. Review experiment notes before giving the Crew ongoing responsibilities. Kiro’s Shared Crew release notes
Can teammates see my sessions or use a connector I signed into?
In the documented Shared Crew release, members can see the sessions and use the tools available in that Crew. Sessions on the host run under the same OS account, and the current release does not provide per-person permissions within a Crew. Attribution tells you who requested or approved an action. Access is defined by what the Crew and its connected accounts can use. A personal tool account signed in from the shared environment can become available to other sessions there. Keep personal work in your own workspace and use a dedicated integration identity when the provider supports it. Give a review Crew only the repositories and permissions it needs. Use a different Crew for teammates who need a different access boundary. Shared Crew access and attribution
For an initial review pilot, let the Crew inspect the diff and report findings. Leave merge and deploy permissions with the people and checks that already own them. If someone leaves the pilot, remove their Crew access, check whether they were also granted access through a separate connection, and review any credentials shared outside the Crew. Shared Crew membership and connections
Why does a Crew disappear, or stop working after hours?
You run and maintain the host. If it sleeps, restarts without starting the service, or loses its connection, check the AWS console heartbeat and the gateway process before retrying jobs. If a teammate cannot see the Crew, check their assigned account, Crew membership, and the host's connection state. Use the host's service setup if it needs to stay online, and confirm what happens on restart before relying on a schedule. Back up the state you need for handoffs and test what is recoverable. Shared Crew setup and troubleshooting, Running Crew 24/7
Can I do this for free? What does a paid setup buy me?
| Git worktrees + existing team tools | Git worktrees, existing PRs and CI, a shared issue, and a tracked handoff template. No separate worktree fee. | Agent inference, CI minutes, or a test database if you exceed existing allowances or need hosted services. |
| Codex desktop worktrees | OpenAI currently lists included Codex usage on ChatGPT Free, subject to model and rollout limits. Use your account's available Codex surfaces and included usage for a small trial. | A paid plan or eligible credits for more usage. API-key sessions are billed separately. Several concurrent sessions still use the account's allowance. |
| Personal Kiro Crew | The Crew code is open source. Run it on a machine you have. Kiro lists a Free tier with 50 monthly credits for eligible individual use. | Inference beyond included usage, a paid provider or plan, or a host you rent. |
| AWS-managed Shared Crew identity on your host | Check the Create Crew screen for how your account bills the Crew seat. Kiro's public team-pooling plan lists $20 per seat per month, with 500 included credits per seat and optional add-on credits at $0.04 each. | Crew seat or subscription as shown in your account, inference, any external harness provider, and hosting. An always-on host and recurring jobs can add ongoing cost even for a small team. |
Pricing and eligibility checked December 2, 2026. Kiro's published team-pooling price is a reference for that billing option. Use the Create Crew screen to verify your actual subscription or pool assignment and any usage limits before you run a recurring task. Track cost per accepted PR, including failed runs and reruns. If you already use Git, CI and an agent subscription, compare the additional spend with the human time saved in handoffs. Kiro pricing, Shared Crew billing and setup, OpenAI Codex pricing and usage, KiroCrew source
How do I know whether the second agent or the shared workspace helped?
- Set a common baseline. Choose one feature, record the starter commit, and agree on the acceptance tests and what counts as review-ready.
- Run it with standalone Codex worktrees. Use your normal pull request process and separate test resources for each writer.
- Repeat in Shared Kiro Crew. Use equivalent test resources and the same harness and model where possible. Have another teammate take over review. Record any differences in model, host or permissions.
- Compare the accepted pull requests. Run the acceptance suite on each combined commit and compare elapsed time, handoff quality, interventions and cost.
| Time until review-ready | From assigning the task to passing the acceptance suite on the combined branch. Include setup and time waiting for approvals. |
| Human intervention | Times someone had to fix a merge, restore a test environment, repeat context, or correct the reviewer. |
| Handoff quality | Could a teammate find the commit, reproduce the test result and explain what remained open? |
| Cost | Included usage or credits consumed, overages, and any additional runner or host cost. |
If implementation and tests are tightly coupled, try one writer and a separate reviewer first. Compare the time to a green build with the two-writer trial. Include the time someone spends reconciling two patches or explaining a decision again.
Keep reading
- Put team instructions in AGENTS.md so developers and agents use the same repo rules.
- Choose between orchestration and a swarm when deciding how much work to run in parallel.
- Decide what context an agent should carry forward before putting team decisions into persistent memory.



Comments
Have a question or something to add? Sign in to join the discussion.