Setup and safety

Worktrees, heavy-job slots, and managed dev servers

Keep parallel crews from colliding or saturating your machine: per-builder Git worktrees, the 1–4 slot heavy-job queue, guarded dev servers, shared dev stacks, file claims, and crew digests.

  • Updated December 1, 2026
  • 7 min read
  • 3 primary sources
  • 4 steps
  • You act in steps 1, 2 and 3

What you get

What you get

SafeguardDefault & capWhat it prevents
Builder Git worktreesOne linked worktree per code builder under <project>/.worktree/<agent>-<task>Two builders overwriting each other’s edits in the same working tree
Heavy-job queue2 slots default (1–4 configurable, machine-wide)Four parallel cargo test or Playwright suites saturating CPU and RAM
Managed dev serversFree port assigned; 3 per agent, 12 per computerPort collisions, leaked background servers, and unguarded home-folder access
Shared dev stack1 workspace-owned stack in .cmdbrief/project.yaml (opt-in)Every crew member booting its own Docker Compose or database copy
Inspect live slot holders, queued jobs, and running servers from the sidebar’s shared-machine strip or Analytics › Machine.

Running several coding agents in one repository fails in predictable ways: colliding edits, four test suites pegging every core, duplicate dev servers fighting over port 3000, and leads getting interrupted every ten seconds by individual status pings. CmdBrief pairs per-builder Git worktrees, a machine-wide heavy-job queue, guarded dev servers, file claims, and batched crew digests so parallel crews stay fast and predictable.

Isolate code builders in Git worktrees

You do thisProject panel or .cmdbrief/project.yaml

When a project uses Git worktree mode (git: worktree, toggleable in the project panel), each code builder a lead starts with cmdbrief_agent_start receives its own linked worktree at <project>/.worktree/<agent>-<task> on a dedicated branch. CmdBrief writes /.worktree/ to .git/info/exclude (never dirtying your tracked .gitignore), stores agent transcripts in the main checkout so history outlives the worktree, and shares pnpm package stores across worktrees.

  • Scope of automatic worktrees: CmdBrief creates worktrees for the code builders a lead agent starts. For standalone sessions you launch yourself, use separate checkouts or claude --worktree (see Run multiple Claude Code sessions).
  • Branch handback: When a builder’s commits land on the integration branch (origin/HEAD, main, or master), CmdBrief notifies the lead automatically with the branch name, commit count, and latest commit subject.
  • Automatic cleanup with branch preservation: Once the lead parks the builder (cmdbrief_agent_park) or closes its pane, CmdBrief sweeps merged, clean worktrees off disk while keeping their Git branches (restarting that member later recreates a worktree from its branch). Dirty or unmerged worktrees are kept and reported.
  • Worktree upkeep: Background checks scan every 6 hours, and leads can inspect or clean landed worktrees and build outputs with cmdbrief_worktree_upkeep.
  • Cargo worktree note (0.5.100+): CmdBrief never copies compiled Rust artifacts between checkouts, so a worktree’s first Rust build compiles its dependencies cleanly with CARGO_INCREMENTAL=0 set automatically to keep build folders compact.

Check it worked

  • Project checkoutgit worktree listEach active code builder appears under <project>/.worktree/<agent>-<task> on its own branch.

Tune the machine-wide heavy-job queue (1–4 slots)

You do thisSettings › Coordination › Heavy jobs, or sidebar shared-machine strip › Adjust limits…

Every workspace on your computer shares one heavy-job queue. By default, 2 heavy jobs run at once; adjust Heavy jobs at once between 1 and 4 in Settings › Coordination › Heavy jobs (or via Adjust limits… in the sidebar’s shared-machine panel).

  • Automatic shims on `PATH`: With workspace coordination on, CmdBrief places lightweight shims for cargo, npm, npx, pnpm, and playwright (plus xcodebuild and xcrun via Device Hub) first on PATH inside agent shells.
  • What takes a slot: Full suites and builds—cargo test, cargo nextest run, npm test, pnpm test, test:unit, e2e, playwright test, vitest run, jest, cypress run, and xcodebuild build|test|build-for-testing|test-without-building|archive.
  • What passes straight through: Focused single-file or filtered tests (cargo test <filter>, -p <crate> <filter>, *.spec.*, *.test.*, -t/--grep), watch modes, --help, npm ci, pnpm install, cargo check, cargo clippy, pnpm lint, and pnpm typecheck.
  • Explicit MCP tools: For unshimmed heavy commands—or sandboxed Codex runs whose shell cannot open CmdBrief’s socket—agents call cmdbrief_heavy_acquire (kind: build, test, e2e, simulator_build, install), cmdbrief_heavy_release, and cmdbrief_heavy_list.
  • Timeouts & bypass: Shims wait up to 5 minutes in queue (exiting 75 and naming slot holders if still full); any slot auto-releases after 30 minutes or when its shim exits. Set CMDBRIEF_HEAVY_SHIM=off for a one-off bypass, or CMDBRIEF_NPM_REUSE=off to disable safe npm ci node_modules reuse.

Check it worked

  • Sidebar shared-machine stripClick the strip while two agents run full test suitesActive holders show their tool, subcommand, and elapsed time; extra full runs queue first-come until a slot frees.

Run managed dev servers and opt-in shared dev stacks

You do thisSidebar shared-machine strip and .cmdbrief/project.yaml

Agents start preview servers through cmdbrief_devserver_start instead of leaving orphaned background shells on hardcoded ports. CmdBrief picks a free port (passed via PORT and {port}), runs the command directly with no shell (pipes, &&, redirects, $VARS, and inline node -e are rejected), strips API keys and SSH_AUTH_SOCK from the environment, waits up to 30 seconds for the port to answer, and writes logs to <app support>/dev-servers/<name>-<port>.log.

  • Fixed caps: Up to 3 dev servers per agent and 12 per computer. Right-click any server in the sidebar shared-machine strip to stop it, or let agents manage their own via cmdbrief_devserver_list and cmdbrief_devserver_stop.
  • Guard isolation (0.5.102+): On macOS and Linux, agent-started dev servers run inside CmdBrief’s guard—able to read and write only the agent’s checkout, a private temp folder, and isolated build/toolchain caches, never your home folder, keys, or sign-ins. A server that cannot run inside the guard (for example, one needing Docker) asks you once to allow that exact command and folder.
  • Auto-cleanup: An agent’s dev server stops automatically after 15 minutes with no active turn (unless keep_alive: true), when its owner stops, or when CmdBrief quits.

When a project needs a database, backend, or Docker stack shared by the whole crew, define one shared dev stack under dev_stack: in .cmdbrief/project.yaml:

.cmdbrief/project.yaml (shared dev stack)yaml
dev_stack:
  start: scripts/dev-up.sh
  url: http://localhost:5173
  health: http://localhost:8000/health
  stop: docker compose down              # optional: stops external services
  reset: scripts/dev-reset.sh            # optional: resets seed data
  ports: [5173, 8000, 5432]              # optional: reserved from agent dev servers
  accounts:                              # optional: dev-only test credentials
    - { role: admin, user: [email protected], password: dev-password }

Once allowed, the workspace owns the stack (it does not count toward the 12 agent-server cap, survives idle/parked members, adopts an already-healthy stack, health-checks every 30 seconds with one automatic restart on failure, and stops cleanly when CmdBrief quits). Agents cannot stop it.

Check it worked

  • Sidebar shared-machine stripCheck the running servers list after your first crew member startsThe stack appears as workspace · <project>-stack and every crew guide lists its URL, health check, and reset command.

Coordinate edits with file claims and crew digest reports

An agent can do thisWorkspace coordination room & Workspace settings

All panes in the same repository—including every linked worktree—share one local coordination room behind runtime/control.sock.

  • File claims (shared checkout): Agents declare edit intentions with cmdbrief_files_claim (up to 128 paths; directories include descendants). Claims are advisory: overlapping claims warn both agents and clear automatically on commit or turn end (or via cmdbrief_files_release).
  • Branch claims (worktrees): In linked worktrees, CmdBrief derives claims automatically from git diff --name-only <default>...HEAD rather than manual intent calls, warning both agents if two branches touch the same file.
  • Shared contracts: Listing shared interfaces under contracts: in .cmdbrief/project.yaml sends every active agent an fyi (without waking idle turns) whenever a commit modifies those paths.
  • Crew digest reports: Instead of interrupting the lead for every individual report, CmdBrief bundles crew report/fyi messages and 5-minute idle notices into one compact digest. By default (Auto), a report waits 5 minutes after its sender stops (2 minutes under 5-minute prompt cache), 1 minute after the whole crew finishes working, or at most 15 minutes if the sender keeps working—and steers immediately into a lead that is already in a turn. Adjust per workspace in Workspace settings › Crew reports reach the lead or Stage Options › Crew reports: Auto, Right away, 1 min, or 15 min. Direct requests (kind: request) and interrupt messages always bypass the hold.

If it fails

  • A shim exits with code 75 naming heavy-job slot holders

    The queue waited 5 minutes without a free slot. Run a focused filtered test (which bypasses the queue), wait for the active full run, raise Heavy jobs at once (up to 4), or offload builds to a Linux build machine.

  • A sandboxed Codex command prints a “no heavy-job slot” note

    Codex’s sandbox blocks the shim from opening CmdBrief’s socket. The note instructs the agent to take a slot explicitly via cmdbrief_heavy_acquire and release it with cmdbrief_heavy_release.

  • dev_stack does not start when the crew starts

    You do this

    Check that .cmdbrief/project.yaml has all three required keys (start, url, health) and that you clicked Allow on the confirmation prompt (or answered host:dev-stack: in Needs you).

  • A worktree was not removed after the builder parked

    CmdBrief only sweeps worktrees that are clean and merged onto the integration branch. Commit or merge remaining changes (or check git status inside .worktree/<name>) before removing it.

  • The lead waits too long for crew progress reports

    Switch Options › Crew reports on Stage from Auto to 1 min or Right away (or let the lead call cmdbrief_wait_for on a specific peer’s report, which delivers immediately).

Questions

Does CmdBrief create Git worktrees for sessions I open manually?

No. CmdBrief creates linked worktrees under .worktree/ for the code builders a lead starts in git: worktree mode. For manual sessions you open yourself, use separate checkouts or claude --worktree.

Do focused unit tests wait in the heavy-job queue?

No. Single-file and filtered runs (such as cargo test <filter>, -p <crate> <filter>, *.spec.*, *.test.*, or -t/--grep), as well as cargo check, cargo clippy, pnpm lint, and pnpm typecheck, pass straight through without taking a slot.

Can a shared dev_stack run commands automatically when I open a repo?

Never. CmdBrief never starts a dev_stack at launch or without approval. On first crew start it displays the exact start, stop, and reset commands for your explicit Allow, and re-prompts whenever any of those commands change.

Are file claims hard locks that block edits?

No. File claims (and worktree branch claims) are advisory—they warn overlapping agents immediately so they coordinate or stay in their lane without stalling tool execution.

Still unsure? Write to [email protected] or use the contact form. Contact CmdBrief →

Primary sources

Provider terms and product behavior can change. Confirm plan, pricing, model, and permission details in the current official documentation.

We use cookies to analyze site usage.