⚙️ Free open-source AI coding workflow tool

Background Agent Worktree Launcher

Recreate the useful part of Cursor-style background coding agents with plain git worktrees: isolated branches, task packets, JSONL traces, and review gates before merge.

LiveFreeOpen SourceAI Coding
tools/agent_workflows/agent_worktree_launcher.sh \
  --repo . \
  --task "Add billing CSV export" \
  --base main \
  --out generated/background_agents/billing-export \
  --mode dry-run

What this tool does

A background coding agent is useful only when the async work is isolated and reviewable. This launcher turns a coding task into a safe worktree workflow instead of letting an agent mutate your active branch.

Isolated worktrees

Create or prepare a separate git worktree and branch for the agent so your current workspace stays clean.

Task packets

Generate a clear packet with scope, branch, worktree path, output requirements, and review expectations.

Review gates

Create review commands that save status, diff stats, and full patch output before anything is merged.

JSONL traces

Log the packet and review-gate events so async work can be inspected later instead of trusted blindly.

Dry-run first

Default to dry-run mode to generate the workflow files without modifying your repository.

Crazyrouter-ready

Use Crazyrouter as the OpenAI-compatible API layer when routing planner, implementer, reviewer, and verifier calls.

Quick start

Download the script, make it executable, and run it from your repository. Start with dry-run mode, inspect the generated packet, then switch to create mode when ready.

curl -L -o agent_worktree_launcher.sh \
  https://raw.githubusercontent.com/xujfcn/crazyrouter-tools/main/agent_workflows/agent_worktree_launcher.sh

chmod +x agent_worktree_launcher.sh

./agent_worktree_launcher.sh \
  --repo . \
  --task "Add async billing export validation in an isolated background branch" \
  --base main \
  --out generated/background_agents/billing-export \
  --mode dry-run

Generated output

The launcher creates a small workflow folder that can be handed to a human, Claude Code, Codex, OpenClaw, Cursor, or another coding agent.

generated/background_agents/billing-export/
├── README.md
├── trace.jsonl
├── commands/
│   ├── create-worktree.sh
│   └── review-before-merge.sh
└── packets/
    └── 01-background-agent.md

Recommended workflow

Generate the packet

Use dry-run mode first. Read the packet and make sure the scope is narrow enough for async work.

Create an isolated worktree

Run create mode only when your repository is clean. The script refuses to create a worktree if there are uncommitted changes.

Run your coding agent inside the worktree

Point your agent to the packet and worktree path. Keep all edits inside that branch.

Review before merge

Run the review command, inspect the saved diff, verify tests, then decide merge / request changes / abandon.

Why it fits Crazyrouter

Background agents multiply model calls. A real async coding workflow can include planning, implementation, adversarial review, fixes, and verification. Crazyrouter gives you one OpenAI-compatible endpoint for routing those steps across different models.

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_CRAZYROUTER_KEY",
    base_url="https://crazyrouter.com/v1"
)

Build async AI coding workflows without lock-in

Use git worktrees for isolation, task packets for scope, trace logs for observability, and Crazyrouter for flexible model routing.