Leader mode. Split the current task into pieces, dispatch each piece to the best worker (a harness and model from the roster) through agent-deck, verify the results, and log every dispatch to a ledger so the user learns which combos are good at what. Use when the user invokes /leader or asks to run a task in leader mode. You may also suggest it for a large task with independent pieces, but then you must ask the user and get a yes before launching anything.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of leader?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ckjeter-leader)
---
name: leader
description: Leader mode. Split the current task into pieces, dispatch each piece to the best worker (a harness and model from the roster) through agent-deck, verify the results, and log every dispatch to a ledger so the user learns which combos are good at what. Use when the user invokes /leader or asks to run a task in leader mode. You may also suggest it for a large task with independent pieces, but then you must ask the user and get a yes before launching anything.
user-invocable: true
---
# Leader
You are the leader for this task. You decide what to delegate, to whom, and whether the result is good enough. You keep full capability: read, think and code yourself whenever that is the better route. Your job is to split the work well, pick a worker for each piece, check the results, and log every piece.
All helper commands below run as `uv run <this skill's directory>/scripts/leader.py <command>`. Written as `leader <command>` here. Every command prints JSON.
## Before anything else: consent
Workers spend the user's quota, so leader mode needs the user's say-so.
- The user typed `/leader` or asked for leader mode in their own words: that is consent. Go on.
- You loaded this skill on your own judgment: stop. Tell the user in two or three lines how you would split the task and which workers you would use, say that it launches agent sessions on their subscriptions and marks the task's folder as trusted for those workers, and ask whether to go ahead. Do not run `leader launch` until they say yes. If they say no, do the task normally and do not ask again in this conversation.
A yes covers the task it was given for, not later ones.
## Rules
- Delegate only through `leader launch`, which goes through agent-deck. Do not use your harness's own subagents (Agent tool, Task tool, Codex workers) for work you could delegate. They are invisible to the ledger.
- Workers run on this host. Never launch onto another machine. The user picks the host for the whole task when they open the leader.
- Log every piece of work, including the ones you do yourself (`--route self`). An unlogged piece teaches nothing.
- Never hide a failure. A failed worker gets a `failed` row, then the retry gets its own row.
## 1. Check health once
```sh
leader health
```
If workers from an earlier task in this conversation are still listed, archive them now (section 6).
`mode` decides how you work for the rest of the task:
| mode | Meaning | What you do |
|---|---|---|
| `normal` | agent-deck answers | Launch through agent-deck |
| `degraded` | agent-deck is down, worker CLIs exist | `leader launch` falls back to a headless run of the worker CLI by itself (`via: direct`). Tell the user agent-deck is down once |
| `self-only` | Neither works | Do the work yourself, log with `--route self` and `--why "fallback: ..."` |
Direct fallback is used only when agent-deck is unavailable before launch. Never pass `--direct` to get around something else, such as a session cap: headless workers often cannot write files or enter an untrusted folder. A failed or timed-out launch may already have created a worker. The helper records that attempt and any new session ID in `meta.json`, then exits with an error. Inspect that session before retrying. Do not restart it, resend the brief, or start a headless copy automatically. Direct fallback refuses `--worktree` because it cannot create the requested checkout.
`notify_daemon: false` means completion events are not recorded, so do not wait on the agent-deck inbox. Always wait with `leader wait`, which reads the session directly. `pools` shows what each pool has left, explained in the next section.
## 2. Split and route
Break the task into pieces and give each a class: `impl`, `review`, `research`, `bulk`, `read`, `write`.
Do a piece yourself when writing the brief and checking the result would take longer than doing it, roughly under ten minutes of your own work, or when it needs context only you have.
Pieces that run at the same time must not share files. Give each piece the files it owns and name them in its brief. If two pieces need the same file, run them one after the other or give each a worktree.
For the rest:
```sh
leader roster --class impl
```
Quota decides who can take work, the roster order decides who should.
- `pools` gives each pool's usage windows as the provider reports them, how old the reading is (`age_minutes`), and when a worker last hit a limit. `ok: false` means do not dispatch there, and `why` says what closed it: a window over its cap, or a limit hit within the hold time. A pool with `source: null` has no gauge. Its `ok` only knows about past limit hits, so send it one piece at a time.
- `route.<class>.pick` is the first worker in `defaults` that is installed and whose pool is `ok`. Use it. It is `null` when every default is closed: do the piece yourself or tell the user.
- Count before you fan out. Several pieces going to one pool at once all draw from the same window. If the window is already past half, split the round across pools or run fewer pieces at a time.
- Rerun `leader roster` before each round. Readings change while workers run, and other leaders share the same pools.
- Do not pick by track record. The per-worker `ledger` counts are there to show how thin the data is. Grades in the ledger are for the user's analysis and are too few and too noisy to route on. The order in `defaults` is the user's own judgment and stays the rule until they change it, or until roster upkeep (section 7) does.
- Write one line on why. It goes into the ledger.
Pieces with no dependency on each other launch at the same time.
### Bakeoff, on by default
A bakeoff sends one piece to two workers so the ledger gets a real comparison. It is how new workers get tried.
- When `route.<class>.bakeoff_challenger` is not null, run one bakeoff in this round of pieces, never more than one. Pick the piece whose result is easiest to compare side by side, and send it to both `pick` and the challenger. The helper offers a challenger only when both pools have room, and takes a worker from the pools that have a default slot: another pool than `pick` first, then the fewest rows in that class.
- You may swap the challenger for another installed worker in an `ok` pool when the suggested one clearly cannot do the piece. Say why.
- Tell the user before launching: which piece, which two workers, and that it costs one extra run. They can turn bakeoffs off in plain words ("no bakeoffs", "save quota"). That holds for the rest of the task, and the next task starts with them on again.
- Each copy of an `impl` piece gets its own `--worktree`.
- Use one result and say which. When the user states a preference between the two, record it with `leader regrade --by user`.
- Log both rows with the same `--bakeoff <id>`, and the challenger's row with `--explore`.
## 3. Brief and launch
Write the brief to a file. A good brief has:
- the goal in one or two sentences,
- the files and context the worker needs (absolute paths, not pasted contents, unless it is short),
- constraints (what not to touch, style, the language of any prose),
- how the result will be checked (the tests to pass, the question the summary must answer).
```sh
leader launch --worker pi/glm-5.2 --path <repo> --brief <brief file> --title "<short task>" --class impl
```
Add `--worktree <branch>` for `impl` pieces in a repo where you or another worker are also editing. `launch` appends the output contract (write `result.md`, short summary, `NEED:` when blocked, no stash or reset in a shared checkout, stay inside the files the brief names, scratch files in the run folder) and the done sentinel. Do not repeat those rules in the brief, but do name the files the piece owns. It returns the `run` id, the agent-deck `session` and the `result` path. A `queued` field in the output means agent-deck accepted the worker but has not started it: see `queued` under Wait.
## 4. Wait
```sh
leader wait --run <run id> --timeout 3600
```
It blocks until the worker finishes. If your harness can run a command in the background and wake you when it exits, do that and keep working on other pieces. Otherwise run waits one at a time once you have nothing else to do.
| state | What you do |
|---|---|
| `done` | Read `result.md` (or the diff), then verify |
| `fail` | Read the summary. Log the attempt as `failed`. Retry once on the next worker for the class, or do it yourself |
| `limit` | The worker hit its usage limit. `wait` has recorded it, so `leader roster` now shows that pool closed for every leader on this host. Log the attempt as `failed` with the limit in `--rework`, rerun `leader roster` and launch the new `pick` |
| `needs_input` | Answer with `leader send --run <run id> --message "..."` if you can decide. Escalate to the user when the decision is theirs. Then wait again |
| `error` | The session died. Log `failed`, retry on the next worker |
| `queued` | agent-deck parked the worker because its group is at its concurrency cap. Your own session counts toward the cap of the group you are in, so a worker queued behind you never starts while you keep working. Tell the user once: they can raise the group's cap or name a worker group in the roster (`[agent_deck] group`). The cap is theirs to change, not yours. Do not pass `--direct` to get around it. If other workers of yours hold the slots, wait again |
| `idle` | The worker is sitting at a prompt and never printed a completion line. The summary shows its last lines. Usual causes: a startup dialog (update, folder trust), a brief that did not arrive, or a question asked without `NEED:`. Read `agent-deck session output <session>`, then answer it or resend the brief with `leader send` |
| `timeout` | Look at it: `agent-deck session output <session>`. Extend the wait, nudge it with a message, or stop it and log `abandoned` |
| `lost` | agent-deck stopped answering mid-wait. The child may still finish: check `result.md` before anything else. Switch to `degraded` handling for new launches |
When a launch fails on a usage limit before `wait` can see it, treat that pool as closed for the rest of the task yourself.
## 5. Verify, grade, log
Run the check the brief defined. Start cheap: the tests and `git diff --stat`. Read the full diff only when a check fails or the change is risky.
When the check finds problems the worker can fix, send them back to the same worker instead of fixing them yourself or relaunching. Its context is still warm, so this is the cheapest fix:
```sh
leader send --run <run id> --message-file <what to fix>
leader wait --run <run id> --timeout 3600
```
Always use `leader send`, never a bare `agent-deck session send`, so `wait` ignores the previous round's done line. Stop after two follow-up rounds: fix it yourself or retry on the next worker. Follow-ups stay on the same ledger row. `log` records their count, and `--rework` says what they fixed.
Grade the final result honestly:
- **3** used as is, no follow-ups
- **2** used after follow-ups or small fixes by you
- **1** unusable or redone
```sh
leader log --run <run id> --class impl --task "<one line>" --why "<one line>" \
--outcome done --grade 2 --verify "tests pass, read diff" --rework "fixed one off-by-one in retry loop"
leader log --route self --class read --task "<one line>" --why "faster than a brief" --outcome done
```
Add `--bakeoff <id>` to every row of a bakeoff and `--explore` to the challenger's row. Do not stop or archive it yet. A logged worker may still get a follow-up while you verify the pieces that depend on it.
## 6. Report
End with a short table for the user: each piece, who did it, its agent-deck session, grade, and anything that failed or needs their decision.
Stop this task's workers when you report, with `agent-deck session stop <session>`, and do not archive them yet. A stopped session gives its memory back and stays in the list, so the user can still read what it did: `agent-deck session output <session>` works on it. Archive them later, with `agent-deck session archive <session>`:
- when the next task starts in this conversation, before its first launch, or
- when the user says they are done with them.
Leave a worker running only when its piece still waits on the user's decision, and say so in the table. A new piece gets a new worker even while an old one is listed: one run is one ledger row.
If the user later disagrees with a grade:
```sh
leader regrade --id <run id> --grade 1 --note "broke the build next day"
```
## 7. Roster upkeep
`health` shows `roster_drift`. When it reports a dropped model or a default with a newer model, run this after the report:
```sh
leader roster --drift
```
- `gone`: a worker whose model the CLI no longer offers. Launching it will fail.
- `newer`: a worker whose model has a newer version in the same family, for example `gpt-6.1-sol` and `gpt-6.2-sol`. `newer_worker` is the roster entry for the newer model, or `null` when there is none. `default_for` lists the classes where the old one holds a default slot.
- `not_in_roster`: models the CLI offers that no worker uses. Information only.
The lists come from files the CLIs keep on this machine, so a CLI that has not been updated shows nothing new. A harness without such a file is not checked. `checked` says which were.
What you do with it depends on `[upkeep] auto` in the roster.
**Off, the default.** Add two or three lines to the report: what drifted and what you would change. Do not edit the roster.
**On.** The user has handed you the upkeep. Edit the roster file that `health` names, then list every change in the report.
1. **Add.** For a `newer` entry with `newer_worker: null`, add a worker for the newer model: copy the old entry, replace the model id in `launch` and `direct`, and write the date in its `note`. It gets no default slot yet.
2. **Try.** While a newer worker has no default slot, use it as the bakeoff challenger for the classes its older version holds, in place of the suggested one.
3. **Promote.** Put the newer worker in the old one's position in a class's default list once it has earned it in that class: it was used in a bakeoff against the old one, or it has two `done` rows with grade 2 or better and none failed. The old worker stays in the roster without that slot.
4. **Drop.** Take a `gone` worker out of every default list. Leave its entry and say so in its `note`.
Limits that hold even when it is on:
- Never reorder workers of different families on grades. A few dozen grades do not rank them. If you think the order is wrong, say why in the report and let the user decide.
- Never touch `[pools]`, `[budget]`, `[hosts]`, prices or caps.
- Never commit or push the roster. The user syncs it.
- One round of changes per task, after the report, never while workers are running.
## Configuration
- Roster: `$LEADER_ROSTER`, else `~/.config/leader/roster.toml`, else `roster.toml` in this skill's directory (gitignored), else the shipped `roster.example.toml`. It lists workers, their pools, the agent-deck launch flags and the headless fallback command.
- Worker group: by default workers join the leader's agent-deck group. `[agent_deck] group = "<name>"` in the roster sends them to that group instead, which keeps them out from behind a group that allows one session at a time.
- Data: `$LEADER_HOME`, default `~/.local/share/leader`. The ledger format is in `references/ledger-v1.md`.
- Host name: `$LEADER_HOST`, else the roster's `[hosts]` map, else `hostname -s`.