|
1 | 1 | --- |
2 | 2 | name: do-task |
3 | | -description: Pick a task file from tasks/todo/, move it to tasks/inprogress/, implement the fix, run verification, and move it to tasks/review/. Use when the user wants to start work on one of the SEC-NNN (or any) task tickets and progress it from todo through implementation to ready-for-review. |
| 3 | +description: Implement the fix described in tasks/todo/<slug>.md, run the project's verification loop, and stop without committing. Use when the orchestrator dispatches a task into a fresh worktree and asks you to do the work. |
4 | 4 | --- |
5 | 5 |
|
6 | 6 | # do-task |
7 | 7 |
|
8 | | -Workflow: pick a single task md from `tasks/todo/`, move it to `tasks/inprogress/`, implement the fix, verify it builds, and move the file to `tasks/review/`. Pairs with `review-task` (which handles `review/` → `done/`). |
| 8 | +You are running inside a fresh git worktree that the task-orchestrator just created. The DB row owns the task's lifecycle (queued → inprogress → review → done) — your job is the **implementation**, nothing more. |
9 | 9 |
|
10 | | -## Step 1 — Pick the task |
| 10 | +## Inputs |
11 | 11 |
|
12 | | -- If the user passed an argument (e.g. `SEC-007` or `007` or a full filename), match it against `tasks/todo/*.md` (case-insensitive prefix match). If no match, list the files in `tasks/todo/` and stop. |
13 | | -- If no argument, list `tasks/todo/` sorted alphabetically and pick the first file. If the directory is empty, tell the user and stop. |
14 | | -- Read the file. It should contain a Severity, Location (file:line refs), Issue description, and proposed Fix. |
| 12 | +- **Argument**: the task slug. The spec lives at `tasks/todo/<slug>.md`. If no argument is passed, list `tasks/todo/*.md`, pick the alphabetically-first entry, and infer the slug from its filename. |
| 13 | +- **`CLAUDE.md`** at the worktree root (and per-directory) describes the project's conventions and verification loop. Read it before editing. |
15 | 14 |
|
16 | | -## Step 2 — Inspect repo state |
17 | | - |
18 | | -Run in parallel: |
19 | | -- `git status` (working tree must be clean of unrelated edits before starting — if it isn't, stop and ask the user how to proceed) |
20 | | -- `git log --oneline -5` (commit-style reference) |
| 15 | +Do **not** move, rename, or delete the spec md. The orchestrator excludes it from git via `.git/info/exclude`; leave it where it is. |
21 | 16 |
|
22 | | -If `tasks/inprogress/` already contains a file, stop and ask the user whether to resume that task or move it back to `todo/` first. Process **one** task at a time. |
| 17 | +## Step 1 — Read the spec |
23 | 18 |
|
24 | | -## Step 3 — Move to inprogress |
| 19 | +Read `tasks/todo/<slug>.md` in full. It should describe Severity, Location (file:line refs), the Issue, and a proposed Fix. |
25 | 20 |
|
26 | | -Use `git mv` so the move is tracked as a rename: |
| 21 | +## Step 2 — Inspect repo state |
27 | 22 |
|
28 | | -```bash |
29 | | -git mv tasks/todo/<filename>.md tasks/inprogress/<filename>.md |
30 | | -``` |
| 23 | +In parallel: |
| 24 | +- `git status` — expect exactly one untracked file: `tasks/todo/<slug>.md` (the spec the orchestrator just seeded). Anything else untracked or modified means something is wrong; stop and report. |
| 25 | +- `git log --oneline -5` — to match the project's commit-message style later. |
31 | 26 |
|
32 | | -## Step 4 — Implement the fix |
| 27 | +Read every file referenced in the spec's Location section before editing. |
33 | 28 |
|
34 | | -1. Read every file referenced in the task's Location section in full before editing. |
35 | | -2. Apply the proposed Fix, or an equivalent implementation that addresses the root cause. The Fix in the task md is a *suggestion* — deviate when there's a better approach, but never paper over the issue (e.g. swallowing an error instead of fixing it). |
36 | | -3. **Cover every call site listed in the task.** If the issue lists several locations, patch all of them. Do NOT search for similar patterns elsewhere — only fix what's explicitly described in the task. |
37 | | -4. **Stay focused.** Don't refactor unrelated code, rename symbols, or fix neighboring issues — those belong in their own task. If you find a new issue, drop a `tasks/todo/<NEW>.md` for it instead of expanding scope. |
38 | | -5. **Docs.** If the change is user-facing (new builtin, config flag, behavior change), update **all three** docs surfaces in the same change (per the project's documentation policy in `CLAUDE.md`): |
39 | | - - `www/docs/*.md` — source markdown. |
40 | | - - `www/app/views/docs/**/*.html.slv` — the matching rendered view. |
41 | | - - `www/public/js/search-index.json` — the docs-site search index. Add or update an `entries[]` record for the new builtin, method, or language feature so users can find it via the search box. Mirror the format of existing entries (`title`, `type`, `category`, `path`, `signature`, `description`, `keywords`). Missing entries here ship as silent regressions — the API is documented but unsearchable. |
| 29 | +## Step 3 — Implement |
42 | 30 |
|
43 | | -## Step 5 — Verify |
| 31 | +1. Apply the proposed Fix, or an equivalent that addresses the root cause. The Fix in the spec is a *suggestion* — deviate when there's a better approach, but never paper over the issue (e.g. swallowing an error instead of fixing it). |
| 32 | +2. **Cover every call site listed in the spec.** Patch all of them. Do **not** search for similar patterns elsewhere — only fix what the spec explicitly describes. |
| 33 | +3. **Stay in scope.** No drive-by refactors, renames, or fixes to neighboring issues. If you spot a separate problem, drop a `tasks/todo/<NEW-slug>.md` for it (the orchestrator will pick it up next ingest) and continue with the original task. |
| 34 | +4. **Docs.** If the change is user-facing (new API, config flag, behavior change) and `CLAUDE.md` describes a documentation policy, follow it — update every surface the policy names in the same change. |
44 | 35 |
|
45 | | -Run the relevant subset for the changes made: |
| 36 | +## Step 4 — Verify |
46 | 37 |
|
47 | | -- Rust changes: `cargo clippy --quiet -- -D warnings` and `cargo fmt --check` |
48 | | -- Tests: `cargo test <relevant>` if a targeted test exists; otherwise note in the summary that broader tests should be run. |
49 | | -- Soli changes: `soli test` if `tests/` covers the area. |
| 38 | +Run the project's verification loop **as defined in `CLAUDE.md`**. If `CLAUDE.md` lists explicit commands (lint / test / coverage / format), run those. If it doesn't, fall back to the obvious-for-the-stack equivalents — but read `CLAUDE.md` first. |
50 | 39 |
|
51 | | -If verification fails, fix the root cause. **Never** suppress warnings, skip hooks, or weaken assertions to make checks pass. If clippy fails on a pre-existing issue unrelated to your change, note it in your summary and continue. |
| 40 | +If verification fails, fix the root cause. **Never** suppress warnings, skip hooks (`--no-verify`), bypass signing, or weaken assertions to make checks pass. |
52 | 41 |
|
53 | | -## Step 6 — Move to review |
| 42 | +If a check fails on a pre-existing issue clearly unrelated to your change, note it in your summary and continue — but be conservative about that judgement. |
54 | 43 |
|
55 | | -```bash |
56 | | -git mv tasks/inprogress/<filename>.md tasks/review/<filename>.md |
57 | | -``` |
| 44 | +## Step 5 — Stop |
58 | 45 |
|
59 | | -Leave the implementation changes **uncommitted** in the working tree. The `review-task` skill is responsible for reviewing the diff and committing — pre-committing would force an amend or revert if review rejects the fix. |
| 46 | +Leave all implementation changes **uncommitted** in the working tree. The `review-task` skill, which the orchestrator runs immediately after, is responsible for reviewing the diff and creating the commit. Pre-committing forces an amend or revert if review rejects the fix. |
60 | 47 |
|
61 | | -End with a short summary to the user: which task, what was changed (file list), what was verified, and any follow-ups noted as new `todo/` files. |
| 48 | +End with a short summary to the user: |
| 49 | +- Which task (slug). |
| 50 | +- What was changed (file list). |
| 51 | +- What was verified (commands run + outcome). |
| 52 | +- Any follow-ups dropped as new `tasks/todo/<slug>.md` files. |
62 | 53 |
|
63 | 54 | ## Constraints |
64 | 55 |
|
65 | | -- Process exactly **one** task per invocation. Do not loop through `todo/`. |
66 | | -- **Never** skip hooks (`--no-verify`) or bypass signing. |
67 | | -- **Never** modify the task md content. The md is the historical record of the issue; if implementation surfaces follow-up work, create a separate `tasks/todo/<NEW>.md` rather than editing the original. |
68 | | -- **Never** commit. Leave changes staged-or-unstaged in the working tree for `review-task` to handle. |
69 | | -- If the user passed an explicit task argument that doesn't exist in `tasks/todo/`, stop and list the files that ARE there. Don't silently pick a different one. |
70 | | -- If verification fails and you can't fix it within the scope of this task, move the file **back** to `tasks/todo/` (`git mv`), revert your code changes, and report — don't leave a half-done task in `inprogress/`. |
| 56 | +- Process exactly **one** task per invocation. |
| 57 | +- **Never** use `pkill`, `kill`, `killall`, or any process-killing command. |
| 58 | +- **Never** commit, push, or skip hooks. |
| 59 | +- **Never** edit the spec md content. It's the historical record. Surface follow-ups via new `tasks/todo/<slug>.md` files instead. |
| 60 | +- **Never** `git mv` the spec between `tasks/todo/`, `tasks/inprogress/`, `tasks/review/`, etc. The DB tracks status; folder-shuffling is the old file-based queue. |
| 61 | +- If verification fails and you can't fix it within the scope of the spec, revert your changes (`git restore .`) and report — don't leave a half-done task in the worktree. |
| 62 | +- If the user passed a slug that doesn't have a matching `tasks/todo/<slug>.md`, stop and list what *is* there. Don't silently pick a different one. |
0 commit comments