Skip to content

Lead and worker agents

In Cortland, one agent can hand work to other agents. The agent you’re talking to becomes the lead. It starts workers in panes beside it, gives each one a brief, waits for them to report back, reviews what they did, and then tells you the result. Each worker is a real agent CLI (Claude Code, Codex, Pi, or Antigravity) in its own visible pane, so you can watch it, type into it, or stop it at any time.

The lead and its workers don’t have to be the same agent. A Claude lead can hand a job to Codex and then review Codex’s work, or the other way around.

  • Your conversation stays free. The lead holds the plan and the verdict. The building happens in another pane, so the session you’re talking to doesn’t fill up with file reads and test output.
  • Independent review. The lead didn’t write the code, so it reviews the diff and the tests the way a second person would, and sends the worker feedback until the work passes.
  • A second opinion from a different model. Pair a lead and a worker from different providers to have one model check the other.
  • Parallel work without collisions. Each worker can get its own worktree, or on Linux its own sandboxed pane.

Ask your agent in plain language:

Delegate this to a Codex worker. Review its diff and tests before you tell me it’s done.

  1. The lead starts one worker in a pane beside it. Cortland gives the worker your request word for word, plus when it counts as done.
  2. The worker builds. If it gets stuck, it asks the lead with cortland-ctl ask, and the question arrives in the lead’s input.
  3. The worker reports with cortland-ctl report. The lead reads the diff, runs the tests, and either accepts the work or sends feedback for another round.
  4. The lead tells you what was done and what it checked.

Agents know how to do this from the cortland-panes skill, which the agent hooks install.

Linux only

To make it a one-word habit, turn on the delegate skill that ships with Cortland, in Preferences → Agents or in config:

[skills]
delegate = true

Then say “delegate this” to your agent, or pick Delegate to Worker in the command palette. The skill runs the flow above as a one-worker task: the worker gets your request word for word, and the lead reviews the diff and the tests itself, sending feedback until the work passes or it needs you.

The worker defaults to the same family as the lead. Name another to switch, or say “cheap” for a lighter model:

delegate codex: add rate limiting to the public API

It’s off by default because each delegation starts a second agent session, which uses tokens. It only runs when you ask. If you already have a skill named delegate, Cortland leaves it alone: it only updates or removes the copies it installed.

On the Mac, you can write a small skill of your own that does the same, and mark it with cortland-palette: true in its frontmatter to run it from the command palette.

For bigger jobs, the lead creates a task and spawns one worker per part. Cortland writes the task’s record to .cortland/tasks/<id>.md.

Terminal window
cortland-ctl task new "Add rate limiting to the public API" --title rate-limit
cortland-ctl task spawn rate-limit --role implementer --part "middleware + config" \
--worktree rate-limit-impl -- claude
cortland-ctl task spawn rate-limit --role tests --part "integration tests" -- codex
cortland-ctl task status rate-limit

An agent started with task spawn gets Cortland’s brief as its first prompt: the request word for word, its part of the work, when it’s done, and how to ask and report. Workers talk to their lead with cortland-ctl ask and cortland-ctl report, and both are logged in the task file. The lead decides what happens next with task accept, task close, and task done.

Each task’s workers appear under it in the Agents panel, and task headers appear on their panes.

Under tasks sits a simpler building block: a worker process started beside the calling pane that reports back to it.

Terminal window
# Start a worker to the right; when it exits, the result is typed into
# this pane as <cortland from="tests">…</cortland>
cortland-ctl run --name tests --direction right -- npm test
# Block until a worker exits, messages this pane, finishes a turn, or needs input
cortland-ctl wait children --timeout 600000
# Send a labeled message into another agent's pane
cortland-ctl send reviewer "The API change is in; please re-check auth.ts"

Messages wait while you’re typing in the target pane, and they’re never typed into a bare shell.

Every pane has a short id, such as #482, shown on its tab or pane header, and you can give it a name (right-click → Rename Pane). Any command that takes a pane accepts the short id, the name, or the title of a tab with a single pane.