Skip to content
Sign in

deepwork

Multi-agent workflows on iii with the kanban board as the task list: parallel implementation tickets, tests and independent verification/review once per integrated wave, and bounded rounds. Code goals get a dev flow: autonomous reversible decisions with optional design/plan approval, tickets in isolated git worktrees, batch validation, a branch review and a kept branch unless you explicitly choose another finish.

Install0.8.1

# With the iii engine running

iii call directory::download-kit kit=iii/deepwork@0.8.1
421Installs
30Last 7 days
1Today
30 days

Exact versions are immutable. Every profile and skill is stored by its SHA-256, so updates show exactly what changed.

v0.8.0 → v0.8.1

Release notes · v0.8.1
  • A dev run starts from the remote's default branch, not from the branch you are on. Before, the base was the branch git status named. A run started on a branch already merged five days earlier built on code 30 commits behind main: its research read an email path main had already replaced, and its commits conflicted when moved onto main for the PR.
    • The base is git symbolic-ref refs/remotes/origin/HEAD (e.g. origin/main), else origin/main when it exists, else (no origin) the branch git status names.
    • It is fetched to refs/remotes/<base> with an explicit refspec right before the worktree is created, so a narrow remote.origin.fetch can't leave it stale; the run branch doesn't track it (--no-track).
    • The PR targets, and the merge option merges into, the base without its origin/ prefix (main).
    • The Plan card, or the run ticket, says when your uncommitted changes are left out; the run ticket says when commits of your checkout (unpushed, or on an unmerged branch) are.
    • The merge option says it merges into your main checkout, and asks you to check it out when root is on another branch.
    • A run from before 0.8.1 resumes on the Base: its ticket names.

Profiles

1 change
modifiedagents/deepwork.md+6-6
@@ -109,7 +109,7 @@
109109 ## Step A: start (first turn)
110110
111111 1. `kanban::config::info {}`. `columns[].id` must include backlog, todo, in_progress and done; otherwise stop and name the missing one. Stop as well if `concurrency`, `max_rounds`, `attempts`, `deadline_min`, `verify_deadline_min` or a given `max_items` is not a positive integer, if `min_free_gb` is not a non-negative integer (0 turns the disk check off), if `isolation` is neither `ticket` nor `shared`, or if `judges` lists more than 8 models. If `judges` is set, call `directory::agents::get {"id":"deepwork-verifier"}`: a non-null `model` (its own or inherited, e.g. from a local `agents/default.md`) would override every judge's model, so stop and say to remove it.
112-2. Pick the flow, in one reply: `shell::exec {"command":"git","args":["status","--porcelain=v1","-b"]}`, `shell::exec {"command":"git","args":["rev-parse","--show-toplevel","--show-prefix"]}` and `coder::tree {"path":".","max_depth":2}` (a goal that is a ticket key: also `kanban::ticket::get` it). The dev flow runs when flow=dev, or flow=auto and the goal changes code or files and git status succeeded. In the dev flow, stop and say why on a detached HEAD, with more than 7 judges, when `--show-prefix` is not empty (run deepwork from the repository's top folder), or when the files the goal or its ticket names (or the repository it names) are not under root: say which folder to start the run from, and never search the disk for the repository. flow=dev outside a git repository stops too. In the dev flow: base = the branch git status names; root = the `--show-toplevel` path; slug = 2–5 words of the goal in kebab-case plus `-<last 6 chars of your session id>`; branch = `deepwork/<slug>`; W = `<root>/.worktrees/<slug>`; with isolation=ticket, ticket KEY's worktree W_K = `<root>/.worktrees/<slug>-<key lowercased>` on branch `deepwork/<slug>-<key lowercased>` (never `deepwork/<slug>/<key>`: git refuses a branch under a name that is itself a branch). If git status lists changes, W starts from base's last commit without them: say so on the Plan card (approve=auto/off: on R).
112+2. Pick the flow, in one reply: `shell::exec {"command":"git","args":["status","--porcelain=v1","-b"]}`, `shell::exec {"command":"git","args":["rev-parse","--show-toplevel","--show-prefix"]}`, `shell::exec {"command":"git","args":["symbolic-ref","--short","refs/remotes/origin/HEAD"]}` and `coder::tree {"path":".","max_depth":2}` (a goal that is a ticket key: also `kanban::ticket::get` it). The dev flow runs when flow=dev, or flow=auto and the goal changes code or files and git status succeeded. In the dev flow, stop and say why on a detached HEAD, with more than 7 judges, when `--show-prefix` is not empty (run deepwork from the repository's top folder), or when the files the goal or its ticket names (or the repository it names) are not under root: say which folder to start the run from, and never search the disk for the repository. flow=dev outside a git repository stops too. In the dev flow: base = what `symbolic-ref` printed, the remote's default branch (e.g. `origin/main`), never the branch you are on: that branch can be days behind or already merged, and a run built on it conflicts with the default branch and reads code that is no longer there. When `symbolic-ref` fails (no `origin/HEAD`), run `shell::exec {"command":"git","args":["rev-parse","--verify","--quiet","refs/remotes/origin/main"]}`: base = `origin/main` when it succeeds, else (no `origin`) the branch git status names. Base branch = base without its `origin/` prefix; root = the `--show-toplevel` path; slug = 2–5 words of the goal in kebab-case plus `-<last 6 chars of your session id>`; branch = `deepwork/<slug>`; W = `<root>/.worktrees/<slug>`; with isolation=ticket, ticket KEY's worktree W_K = `<root>/.worktrees/<slug>-<key lowercased>` on branch `deepwork/<slug>-<key lowercased>` (never `deepwork/<slug>/<key>`: git refuses a branch under a name that is itself a branch). W starts from base's last commit without the changes git status lists: when it lists any, say so on the Plan card (approve=auto/off: on R).
113113 3. Resolve the lead model (`lead_model`, Arguments) and, in the dev flow, the verify model (`verify_model`), then the functions the items need. Plain flow: one `directory::search_functions` naming every capability, then one `engine::functions::info {"function_ids":[…]}` for the ids you pick. Dev flow: the project's test, build and lint commands, read from the tree, run with `shell::exec {command, args[], cwd: W}`, and Setup = the install command a fresh copy of the repository needs before those commands run (a Node project: its package manager's offline install), or `none` (a Cargo project, which builds in its own worktree). Setup runs in every fresh copy: W at Step A.9 and, with isolation=ticket, each ticket worktree. Never point two worktrees at one build directory such as `CARGO_TARGET_DIR`: Cargo keys artifacts by the path inside the repository, so siblings would run each other's binaries. Every lead task names the commands (`Functions:`) and ends that text with this recipe, verbatim, for a long run (every phase agent and the critic follow it):
114114 ```
115115 Long run (anything over ~90 s: the first build or test run in a fresh worktree, the full suite, a command that hit the 120 s cap), one reply, calls in order:
@@ -144,13 +144,13 @@
144144 - In the plain flow with synthesize=on, plan no item that only merges or summarises other items' results: the synthesis step writes the final report.
145145 - For discovery, create one `Discover: <what to enumerate>` item whose Deliverable is `new_items` and add the line `List at most <max_items − items created> items.`
146146 8. **Plan** (approve=on, plan_only=off; auto/off continue directly): `harness::ask {"questions":[{"header":"Plan","question":"Start <R>: <n> tickets<dev flow: on branch <branch>>? The plan and the tickets are on <R>.<the preflight line, if any>","options":[{"label":"Start"},{"label":"Stop"}]}]}`. While the card is unanswered, every user message answers it: `Start`, `continue`, `yes` or `start` = Start; any other text asks for changes: run **Replan** (Step G), then ask again. `Stop`: cancel every item (see Lanes), comment `stopped before start` on R, move R to done and end.
147-9. **Worktree** (dev flow), with cwd = root: `shell::exec {"command":"git","args":["worktree","add","<W>","-b","<branch>","<base>"]}`, then `shell::exec {"command":"git","args":["check-ignore","-q",".worktrees/"]}`. If the add fails, comment the error on R and finish (Step G) with `blocked: worktree`: that branch and path are not this run's, so Step G runs no git command and asks no Finish question. If check-ignore exits non-zero, exclude it locally: `shell::exec {"command":"sh","args":["-c","echo .worktrees/ >> \"$(git rev-parse --git-common-dir)/info/exclude\""]}`. Then check the disk: `shell::exec {"command":"df","args":["-Pk","<W>"]}`; the fourth column of its second line is the free space in KB. Under min_free_gb × 1048576, comment `⛔ Needs you — the disk has <free> GB free, under min_free_gb=<n>. Free space, then start again with resume=<R>.` on R and finish (Step G) with `blocked: disk`: phases on a full disk fail without verdicts, and every round after them is spent on repairs. W stays for a resume (Step A-R.2 runs Setup and the baseline it never had); Step G runs no git command on it and asks no Finish question. Then run the Setup command, if any, with cwd = W (a failure is `baseline: not run: setup failed: <error>`), then the project's test, lint and typecheck (or build) commands with cwd = W as one long run (the recipe in Step A.3, as one `sh -c` that runs each and prints each exit code; label `dw <R> baseline`), and end the turn with `waiting on <job_id>` unless its `shell::status` shows the job already ended. On that wake (Step D, Baseline), or on that ended record, write `progress.baseline`: `green` (every command exit 0), `red: <command>: <failures from its output>` (any non-zero) or `not run: <why>` (the wake expired, or the job could not start). Comment on R only when it is not green: `⚠ The base branch already fails before any change: <command>: <failures>. Validation ignores these and fails only on new failures.` or `⚠ The base branch was not checked: <why>.`, then go on to step 10. A red baseline adds `Known red at base: <command>: <failing tests, files or rules>` to the Functions text of every later task, so checks fail a batch only for new failures, never for these.
147+9. **Worktree** (dev flow), with cwd = root. When base starts with `origin/`, first, alone in its reply: `shell::exec {"command":"git","args":["fetch","origin","+refs/heads/<base branch>:refs/remotes/<base>"]}` (the explicit destination updates `<base>` even when the configured refspec leaves it out); if it fails, comment `⚠ Could not fetch <base>: <error>. The branch starts from its last fetched commit.` on R and go on. Then, in one reply, `shell::exec {"command":"git","args":["rev-list","--count","<base>..HEAD"]}` and `shell::exec {"command":"git","args":["worktree","add","--no-track","<W>","-b","<branch>","<base>"]}`. A count above 0 means commits of your checkout that W leaves out (unpushed, or a branch not yet merged): comment `⚠ The branch starts from <base>; the <count> commits on <the branch git status names> that are not on it are left out.` on R. Then `shell::exec {"command":"git","args":["check-ignore","-q",".worktrees/"]}`. If the add fails, comment the error on R and finish (Step G) with `blocked: worktree`: that branch and path are not this run's, so Step G runs no git command and asks no Finish question. If check-ignore exits non-zero, exclude it locally: `shell::exec {"command":"sh","args":["-c","echo .worktrees/ >> \"$(git rev-parse --git-common-dir)/info/exclude\""]}`. Then check the disk: `shell::exec {"command":"df","args":["-Pk","<W>"]}`; the fourth column of its second line is the free space in KB. Under min_free_gb × 1048576, comment `⛔ Needs you — the disk has <free> GB free, under min_free_gb=<n>. Free space, then start again with resume=<R>.` on R and finish (Step G) with `blocked: disk`: phases on a full disk fail without verdicts, and every round after them is spent on repairs. W stays for a resume (Step A-R.2 runs Setup and the baseline it never had); Step G runs no git command on it and asks no Finish question. Then run the Setup command, if any, with cwd = W (a failure is `baseline: not run: setup failed: <error>`), then the project's test, lint and typecheck (or build) commands with cwd = W as one long run (the recipe in Step A.3, as one `sh -c` that runs each and prints each exit code; label `dw <R> baseline`), and end the turn with `waiting on <job_id>` unless its `shell::status` shows the job already ended. On that wake (Step D, Baseline), or on that ended record, write `progress.baseline`: `green` (every command exit 0), `red: <command>: <failures from its output>` (any non-zero) or `not run: <why>` (the wake expired, or the job could not start). Comment on R only when it is not green: `⚠ The base branch already fails before any change: <command>: <failures>. Validation ignores these and fails only on new failures.` or `⚠ The base branch was not checked: <why>.`, then go on to step 10. A red baseline adds `Known red at base: <command>: <failing tests, files or rules>` to the Functions text of every later task, so checks fail a batch only for new failures, never for these.
148148 10. With plan_only=on, end the turn here; its last line is exactly `plan on <R>: <n> tickets; start with args: resume=<R>`. Otherwise continue with Step B in the same turn.
149149
150150 ## Step A-R: resume (first turn with resume=<R>)
151151
152152 Adopt an earlier run from its board state. Replaces Step A.2 to A.9:
153-1. Run Step A.1 and resolve `lead_model` and `verify_model` as in Step A.3, then read R's `/description` and `/labels` (Reading R): stop unless the ticket exists and carries `dw:run`. From its description take `Goal:`, `Args:` (your message's args override single values), `Flow:`, `Orchestrator session:` (old = that session id) and, in the dev flow, `Base:`, `Branch:` and `Worktree:` (W); slug = the part of `Branch:` after `deepwork/`. The run's project and release are R's own fields.
153+1. Run Step A.1 and resolve `lead_model` and `verify_model` as in Step A.3, then read R's `/description` and `/labels` (Reading R): stop unless the ticket exists and carries `dw:run`. From its description take `Goal:`, `Args:` (your message's args override single values), `Flow:`, `Orchestrator session:` (old = that session id) and, in the dev flow, `Base:` (base; base branch as in Step A.2), `Branch:` and `Worktree:` (W); slug = the part of `Branch:` after `deepwork/`. The run's project and release are R's own fields.
154154 2. Dev flow: `shell::exec {"command":"git","args":["rev-parse","--show-toplevel","--show-prefix"]}` (root; stop when `--show-prefix` is not empty) and `shell::exec {"command":"git","args":["worktree","list","--porcelain"]}`: stop with `blocked: worktree <W> is missing` unless it lists W on `Branch:` (finish that branch by hand, or start a new run). W then counts as created by this run (Step G). Resolve the functions and Setup as in Step A.3, read `progress` (`state::get {"scope":"dw-<R lowercased>","key":"progress"}`; Run pointer for a run without one), and carry a `red` baseline into `Known red at base`. When the baseline is null (the earlier run stopped before it, e.g. on `blocked: disk`), run Step A-R.3 first (it moves the run pointer's `owner` to you and creates `progress`, so the baseline's wake is yours), then Step A.9 from its disk check, with cwd = W: the disk check, Setup and the baseline. On its wake, record the baseline as Step A.9 says and continue with Step A-R.4, not Step A.10.
155155 3. First, when the run pointer's `batch` (or, on a run from before the pointer, R's `Batch: <scope>` line) names a scope whose manifest `session` is still working (`harness::status`: `running`, `awaiting_functions`, or `completed` with `expects_wake:true`) and `harness::status {"session_id":"<old>"}` is `running` or `awaiting_functions`, end here with `blocked: <old> is mid-turn while its batch runs; resume once it parks`: stopping it would cascade into the batch, and leaving it running lets it dispatch beside you. Otherwise rewrite R's description: `Args:` = the resolved args, `Orchestrator session:` = `<own>`, `Lead model:` (and `Verify model:`) = the one resolved now, plus one `Resumed: <old> → <own>` line per resume, everything else unchanged. If R is not in `in_progress` (a finished run, a blocked one, or a plan_only one), update it there with `"remove_labels":["blocked","unfinished","unverified","pending"]`. Then preflight as in Step A.6, but replace only the run pointer's `owner` (create it when missing), keep its `batch` (create it with scope null only when missing) and keep its `progress` (create it when missing, from the comments as Run pointer says, with thread null). A run from before the pointer may carry a `Batch: <scope>` line in R's description: write that scope to the pointer's `batch` first, and drop the line from R's description only after that write returns `swapped:true`.
156156 4. `kanban::ticket::list {"parent_id":"<R>"}`, not compact: outcomes are labels, and the rest of this step reads these rows. If the run pointer's `batch` names a scope, read `state::get {"scope":"<scope>","key":"manifest"}` and inspect its `session` with `harness::status` before any work in W. When that batch lead is still working (`running`, `awaiting_functions`, or `completed` with `expects_wake:true`), adopt it, never stop it: a stop SIGKILLs its phases' jobs, so a suite that faults a shared system would skip its restore. To adopt, arm a wake on it as in Step E.1 but with barrier id `<scope>-adopted` (a shared id would let only one orchestrator wake), `expect:["batch"]`, label `dw <R> batch adopted r<N>` and the expiry computed from R's `Args:` as read in Step A-R.1 (the batch was spawned with those, not with this message's overrides); then `state::get` its `batch` key: when a result is already there, remove that wake with `harness::unobserve` and let Step B's Repair first finalize or repair it. The lead keeps working because the pointer still names its scope (deepwork-lead). A finished or missing session needs neither (the earlier turn may have ended before spawning it), and round N repairs that batch first (Step B). Keep the pointer either way. Its manifest tickets are integrated on the run branch, so they are never re-queued: one in `todo`, or in `backlog` with outcome `unverified`, `blocked` or `unfinished`, moves back to `in_progress` (`"remove_labels":O`) for the repair, and one already in `in_progress` stays there. Old sessions: an earlier orchestrator may still be parked on a wake. Step A-R.3 already moved R to you, so it ends without acting when it wakes (Step D); `harness::stop {"session_id":"<old>"}` ends it now if it is running (with a batch to adopt it is parked, Step A-R.3; never stop a parked one then: a stop cascades into its running children, the batch lead included). Then `harness::stop` `<old>-<key lowercased>` for each other subtask in `in_progress` (see Names and rules). A stop error, or a lead still `running` afterwards, parks the ticket in `backlog` with outcome `stuck` and the comment `⏸ Stuck — session <old lead> is still running and refused to stop: <error>. Stop it from the console, then move this card to To do.`; otherwise move it to `todo`. Every other subtask in `backlog` with outcome `unfinished` (the earlier run ended before it ran or finished) moves to `todo` too, with `"remove_labels":O`. The next lead task of each re-queued ticket carries `Retry: re-queued on resume. Continue from what is already committed for this card (its ticket branch, or the run branch); never start over.` When any of these is not empty, post a progress line (Comment discipline): `Resumed — retrying <keys> · fixing validation of <keys> · stuck <keys>`, leaving out the empty parts; otherwise post nothing (a plan_only run starting adds no line).
@@ -311,9 +311,9 @@
311311 - `## Evidence`, dev flow, when this run created W: the base check (`progress.baseline`), the latest validation (each command → its result, and its commit), the branch review verdict (`none` for a null critic) and `git log --oneline <base>..<branch>` (run it with cwd = W in this reply). With isolation=shared, name the commits of every ticket that is not verified or accepted (`(<KEY>)` in their message): they are on the branch too; with isolation=ticket, unintegrated commits are on the ticket branches kept in step 1, and integrated but unverified commits remain on the run branch.
312312 - `## Plan`: plan changes, removed tickets, canceled tickets, tier fallbacks (Leads) and the `Follow-ups` ticket.
313313 - `## Run details`: rounds run, C (read in this turn's report reply; written as in Names and rules), the stop reason in plain words (`validation unverified: <reason>` for `batch unverified: <reason>`), and in the dev flow the branch and the worktree.
314-4. **Finish choice** (dev flow, only when this run created W). With a stuck batch writer, keep the branch/worktree and report the session; skip this choice and every mutating git operation on W. Otherwise approve=on: `harness::ask {"questions":[{"header":"Finish","question":"How should <branch> finish?","options":[{"label":"Merge into <base>","description":"local merge, then remove the worktree"},{"label":"Push and open a PR"},{"label":"Open a PR and merge when CI is green","description":"push, open the PR, watch its checks, then squash-merge it"},{"label":"Keep the branch","description":"branch and worktree stay as they are"}]}]}`; the turn ends. The card holds at most four options (`harness::ask`), so Discard is the free-text answer `Discard`. On the answer, do only what it says, with cwd = root:
315- - Merge: `git status --porcelain=v1 -b --untracked-files=no` must show `<base>` with no changes, else say so and keep. Then `git merge --no-ff --no-edit <branch>` alone in its reply. On a conflict, `git merge --abort` and keep. Only after a clean merge, `git worktree remove <W>`; if it refuses, quote it, keep the worktree and the branch, and report `merged; worktree kept`. Otherwise `git branch -d <branch>`.
316- - PR, and PR with merge: `git push -u origin <branch>`, then `gh pr create --base <base> --head <branch> --title "<R title>" --body "<the report>"` (or a registered PR function you find with `directory::search_functions`); `<n>` = the PR number at the end of the URL it prints. Then **Land**.
314+4. **Finish choice** (dev flow, only when this run created W). With a stuck batch writer, keep the branch/worktree and report the session; skip this choice and every mutating git operation on W. Otherwise approve=on: `harness::ask {"questions":[{"header":"Finish","question":"How should <branch> finish?","options":[{"label":"Merge into <base branch>","description":"local merge into your <base branch> checkout, then remove the worktree"},{"label":"Push and open a PR"},{"label":"Open a PR and merge when CI is green","description":"push, open the PR, watch its checks, then squash-merge it"},{"label":"Keep the branch","description":"branch and worktree stay as they are"}]}]}`; the turn ends. The card holds at most four options (`harness::ask`), so Discard is the free-text answer `Discard`. On the answer, do only what it says, with cwd = root:
315+ - Merge: `git status --porcelain=v1 -b --untracked-files=no` must show `<base branch>` with no changes, else say so (check out <base branch> and answer again) and keep. Then `git merge --no-ff --no-edit <branch>` alone in its reply. On a conflict, `git merge --abort` and keep. Only after a clean merge, `git worktree remove <W>`; if it refuses, quote it, keep the worktree and the branch, and report `merged; worktree kept`. Otherwise `git branch -d <branch>`.
316+ - PR, and PR with merge: `git push -u origin <branch>`, then `gh pr create --base <base branch> --head <branch> --title "<R title>" --body "<the report>"` (or a registered PR function you find with `directory::search_functions`); `<n>` = the PR number at the end of the URL it prints. Then **Land**.
317317 - Keep: nothing.
318318 - Discard (the typed answer): `git worktree remove --force <W>`, then `git branch -D <branch>`.
319319 - **Land** (both PR options; the user's Finish answer covers pushing this branch again and, for the merge option, merging; the long-run recipe of Step A.3 applies to you):

Workers

0 changes

No worker changes.

Skills

0 changes

No skill changes.

Capabilities

0 changes

This update grants no new capabilities.

Search the registry

Find workers, kits and executables, or jump to a page.