beetlebug▾
/

Run several agents on one repository

Two agents in one folder write over the changes of each other. Give each agent its own clone and its own branch with --clone and --branch.

Start two agents

jcode start --dir w-readme --clone hello --branch agent/readme \
    --model us.amazon.ergo-1.0 --brief brief-readme.md --isolation process
jcode start --dir w-test --clone hello --branch agent/test \
    --model us.amazon.ergo-1.0 --brief brief-test.md --isolation process \
    --run all --check 'test=sh test.sh'
jcode list
a2
a3
a2 running process turns 2/40 tokens 1703 (in1474 out229 cr0 cw0) $0.0 us.amazon.ergo-1.0 …
a3 running process turns 1/40 tokens 857 (in825 out32 cr0 cw0) $0.0 us.amazon.ergo-1.0 …

--clone hello makes the folder w-readme as a git clone of hello (a path or a URL), on the new branch agent/readme. The folder must not exist. jcode records the start commit, and diff compares with it.

--check 'test=sh test.sh' gives the agent the tool check with the name test. The check runs on the host, outside the sandbox, with a command that the agent cannot change. The agent sees only its output.

Wait for both

jcode wait a2 --timeout 300
jcode wait a3 --timeout 300
a2 done process turns 3/40 tokens 2739 (in2451 out288 cr0 cw0) us.amazon.ergo-1.0 …
a3 done process turns 15/40 tokens 94410 (in2665 out7404 cr74575 cw9766) us.amazon.ergo-1.0 …

wait returns when the agent is not running, or after the timeout.

Bring the work back

Each clone has its own branch. Read the diff of each agent, commit in its clone, and fetch the branch into the main repository:

jcode diff a2
git -C w-readme add -A && git -C w-readme commit -m "Add a README"
git -C hello fetch ../w-readme agent/readme

A git worktree

A work folder that is a git worktree has its git folders outside the folder. At the level process or vm, the agent cannot commit there, so start fails with the reason. Use --clone, or give each git folder with --write.

Limits