@workit-dev/cursor 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/.cursor-plugin/plugin.json +38 -0
  2. package/README.md +56 -43
  3. package/assets/logo.svg +4 -0
  4. package/assets/templates/workit-contract.md +13 -0
  5. package/commands/wk-architecture.md +5 -0
  6. package/commands/wk-bdd.md +5 -0
  7. package/commands/wk-continue.md +5 -0
  8. package/commands/wk-debug.md +5 -0
  9. package/commands/wk-deslop.md +5 -0
  10. package/commands/wk-fanout.md +5 -0
  11. package/commands/wk-implement.md +5 -0
  12. package/commands/wk-retro.md +5 -0
  13. package/commands/wk-review.md +5 -0
  14. package/commands/wk-shape.md +5 -0
  15. package/commands/wk-ship.md +5 -0
  16. package/commands/wk-test-audit.md +5 -0
  17. package/commands/wk-verify-app.md +5 -0
  18. package/dist/cursor-session-start.js +27182 -0
  19. package/dist/mcp-server.js +30655 -0
  20. package/dist/workit-hook.js +24510 -0
  21. package/hooks/hooks-cursor.json +48 -0
  22. package/hooks/launch-runtime.mjs +276 -0
  23. package/hooks/launch.mjs +137 -0
  24. package/hooks/node-resolve.mjs +249 -0
  25. package/hooks/workit-paths.mjs +242 -0
  26. package/mcp.json +8 -0
  27. package/package.json +54 -6
  28. package/rules/workit-contract.mdc +38 -0
  29. package/skills/workit-architecture/SKILL.md +72 -0
  30. package/skills/workit-architecture/agents/openai.yaml +3 -0
  31. package/skills/workit-architecture/references/instruction-files.md +52 -0
  32. package/skills/workit-architecture/references/vocabulary.md +53 -0
  33. package/skills/workit-bdd/SKILL.md +53 -0
  34. package/skills/workit-continue/SKILL.md +54 -0
  35. package/skills/workit-debug/SKILL.md +45 -0
  36. package/skills/workit-deslop/SKILL.md +58 -0
  37. package/skills/workit-fanout/SKILL.md +71 -0
  38. package/skills/workit-fanout/references/brief.md +141 -0
  39. package/skills/workit-fanout/references/orchestration.md +169 -0
  40. package/skills/workit-implement/SKILL.md +71 -0
  41. package/skills/workit-retro/SKILL.md +72 -0
  42. package/skills/workit-retro/agents/openai.yaml +3 -0
  43. package/skills/workit-retro/references/sources.md +35 -0
  44. package/skills/workit-retro/references/steering.md +39 -0
  45. package/skills/workit-review/SKILL.md +66 -0
  46. package/skills/workit-review/references/impact.md +24 -0
  47. package/skills/workit-shape/SKILL.md +71 -0
  48. package/skills/workit-shape/references/diagrams.md +17 -0
  49. package/skills/workit-shape/references/knowledge.md +61 -0
  50. package/skills/workit-shape/references/mockups.md +15 -0
  51. package/skills/workit-shape/references/slicing.md +44 -0
  52. package/skills/workit-ship/SKILL.md +71 -0
  53. package/skills/workit-ship/references/changelog.md +44 -0
  54. package/skills/workit-ship/references/pr-body.md +32 -0
  55. package/skills/workit-ship/references/release.md +39 -0
  56. package/skills/workit-test-audit/SKILL.md +54 -0
  57. package/skills/workit-verify-app/SKILL.md +68 -0
  58. package/skills/workit-verify-app/references/template.md +51 -0
@@ -0,0 +1,3 @@
1
+ # Codex: user-invoked only (the counterpart of disable-model-invocation).
2
+ policy:
3
+ allow_implicit_invocation: false
@@ -0,0 +1,52 @@
1
+ # Instruction-files mode (AGENTS.md, CLAUDE.md)
2
+
3
+ Instruction files are paid for in every session that reads them. Restructure
4
+ them in three escalating passes. Each pass is its own commit in one PR, in
5
+ this order, so the user can keep pass 1 and drop pass 3. Run
6
+ `workit knowledge lint` before pass 1 and after every commit: no commit adds
7
+ a finding, and the lint exits 0 after the last pass, or the report lists the
8
+ findings that remain and why.
9
+
10
+ After each commit, run `workit check test`. A sentence a test pins stays,
11
+ unless the user approves changing that test. Commit each pass with
12
+ `workit git commit -m "<type>: <pass>" -- <paths>`, then open the PR
13
+ (read the `workit-ship` skill's SKILL.md and follow it).
14
+
15
+ Before pass 1, report the current byte counts and the plan for each pass, then
16
+ wait for approval. A pass with nothing to do is skipped and said so, not
17
+ padded.
18
+
19
+ ## Pass 1: remove no-ops
20
+
21
+ Delete lines that would change no behavior if removed: "be thorough", "write
22
+ clean code", "follow best practices", restated defaults of the host, notes
23
+ about one past session, `path:line` references, and rules whose mistake a type,
24
+ lint or check now prevents. Nothing moves in this pass; it only deletes.
25
+
26
+ ## Pass 2: progressive disclosure
27
+
28
+ Keep the root file to what every session needs: commands, workflow, and
29
+ "Read before <task>: <file>" pointers. Move topic detail (testing, release,
30
+ hosts, architecture) into topic files under an existing docs folder, one file
31
+ per topic, each opened by when to read it. Move text verbatim first; rewording
32
+ belongs in pass 1 or a later change. Every pointer from AGENTS.md or
33
+ CLAUDE.md must resolve (the lint's `broken-link` rule). The lint does not read
34
+ topic files: check their own links and content by hand.
35
+
36
+ ## Pass 3: standards and checks
37
+
38
+ - A judgment rule a reviewer must weigh goes to `CODING_STANDARDS.md`; the
39
+ root file keeps one pointer to it.
40
+ - A mechanical rule (a forbidden import, a naming pattern, a file that must
41
+ exist) becomes a check instead of prose: a lint rule, a test, or a
42
+ configured `workit check <name>`. Show the check failing on a planted
43
+ violation, then delete the sentence.
44
+ - No rule lives in two files (`duplicate-rule`).
45
+
46
+ ## Never
47
+
48
+ - Create a file without its first real entry in the same commit. The lint
49
+ flags a scaffolded `CODING_STANDARDS.md` or `GLOSSARY.md` (`scaffold-file`);
50
+ for a topic file, that check is yours.
51
+ - Squash the passes into one commit, or mix a behavior change into them.
52
+ - Grow the root file past the lint's byte budget (`agents-budget`).
@@ -0,0 +1,53 @@
1
+ # Deepening vocabulary
2
+
3
+ Use these words exactly in every candidate. Do not drift into "component",
4
+ "service", "API" or "boundary".
5
+
6
+ | Term | Meaning |
7
+ | --- | --- |
8
+ | Module | Anything with an interface and an implementation: a function, a file, a package, a slice across tiers |
9
+ | Interface | Everything a caller must know: types, invariants, ordering, error modes, configuration, cost |
10
+ | Depth | Behavior a caller or test reaches per unit of interface learned. Deep: much behind little. Shallow: the interface is nearly as complex as the implementation |
11
+ | Seam | Where behavior can change without editing that place; where an interface lives |
12
+ | Adapter | A concrete thing that fills a seam (production, in-memory, fake) |
13
+ | Leverage | What callers gain from depth: one implementation pays back across many call sites and tests |
14
+ | Locality | What maintainers gain: change, bugs and verification concentrate in one place |
15
+
16
+ ## Tests to run on a suspect
17
+
18
+ - **Deletion test.** Imagine deleting the module. Complexity vanishes: it was
19
+ a pass-through, so inline it. Complexity reappears across callers: it earns
20
+ its keep. A deepening concentrates complexity; it does not just move it.
21
+ - **Interface is the test surface.** Tests that must reach past the interface
22
+ mean the module has the wrong shape.
23
+ - **One adapter is a hypothetical seam; two are a real one.** Do not add a
24
+ port unless something varies across it (production and test count).
25
+
26
+ ## What the explorer looks for
27
+
28
+ - One concept that needs a hop through many small modules to understand.
29
+ - Shallow modules: wide interface, thin implementation.
30
+ - Pure helpers extracted only for tests while the bugs live in how they are
31
+ called (no locality).
32
+ - Coupled modules leaking through their seams: one fix edits both (churn shows
33
+ them changing together).
34
+ - Code that is untested, or hard to test through its current interface.
35
+
36
+ The explorer is read-only (on Claude Code, the Explore agent). It reads code,
37
+ git history, `workit ledger list` and `workit test-audit` output only: never
38
+ session transcripts and never another workspace. It copies no secret, token
39
+ or personal data into its findings. It returns only cited findings (file,
40
+ commit, ledger row), never a refactor.
41
+
42
+ ## Dependency categories (how the deeper module is tested)
43
+
44
+ 1. In-process (pure, in-memory): merge and test through the new interface.
45
+ 2. Local stand-in exists (temp dir, in-memory store): test with the stand-in;
46
+ the seam stays internal.
47
+ 3. Owned but remote (your own service): a port at the seam, an in-memory
48
+ adapter in tests.
49
+ 4. Third party: an injected port, a fake adapter in tests.
50
+
51
+ Replace, do not layer. An old test on a shallow module is deleted only after
52
+ naming the break it catches and showing that a test at the deeper interface
53
+ fails on that planted break (read the `workit-test-audit` skill's SKILL.md and follow it). Until then it stays.
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: workit-bdd
3
+ description: Turn requirements into Given/When/Then scenarios, agree the test seam, and work test-first in vertical RED/GREEN slices. Use for BDD, TDD, acceptance criteria, scenarios, Given/When/Then, write a test first.
4
+ ---
5
+
6
+ # Behavior first: Given/When/Then
7
+
8
+ 1. **Write the scenarios.** One behavior each, in the caller's words:
9
+ `Given <state>, When <action>, Then <observable result>`. Include the
10
+ unhappy paths callers depend on (denied, empty, invalid, timeout).
11
+ 2. **Agree the seam.** The highest stable interface the scenario can be
12
+ observed through: a CLI verb, a public function, an HTTP route; ideally one
13
+ per feature. Do not test at a seam nobody agreed to. Note what each seam
14
+ catches and misses (a unit seam misses wiring; a CLI seam misses nothing
15
+ the user sees but runs slower) and cover each miss once, elsewhere.
16
+ 3. **Name tests after scenarios.** The name is the Given/When/Then sentence;
17
+ the body is arrange, act, assert. Expected values come from the scenario (a
18
+ literal from a worked example, the spec, an external contract), never from
19
+ the code under test. No tautological tests: a test must fail if the
20
+ behavior breaks, never restate the implementation.
21
+ 4. **Build in vertical slices, never horizontal ones** (every test first,
22
+ then every implementation: tests written ahead of any code assert guessed
23
+ internals). Write one vertical RED slice that fails for
24
+ the missing behavior and run it through the CLI so the failure is observed:
25
+ `workit check test`. Make the smallest change, run the same check GREEN,
26
+ then take the next scenario. Any edit makes the observation stale; re-run
27
+ before you claim it. A recorded "tests pass" is a note, and an ad-hoc
28
+ `workit check -- <cmd>` never satisfies the gate: only the configured
29
+ `test` check does. No `test` detected? Create `.workit/checks.json`, copying
30
+ in every check the repo already runs: once it exists it replaces the
31
+ detected defaults.
32
+ 5. **Mock only at system boundaries:** network, clock, randomness, other
33
+ processes, sometimes the filesystem. Never the unit or its own
34
+ collaborators; use the real thing or an in-memory adapter behind a port.
35
+ 6. **Gherkin only where the repo already uses it** (`.feature` files with
36
+ playwright-bdd, cucumber, jest-cucumber). Otherwise test names carry it.
37
+
38
+ Reject noise: version-pin assertions, tests that mirror private structure,
39
+ assertions inside a possibly-empty loop, smoke-only renders, duplicates. If a
40
+ test still passes when every imported function returns `undefined`, rewrite it;
41
+ the audit finds these (read the `workit-test-audit` skill's SKILL.md and follow it).
42
+
43
+ ## Example
44
+
45
+ Bad: `test("calculateTotal works", () => expect(calculateTotal(items)).toBe(items.reduce((s, i) => s + i.price, 0)))`
46
+
47
+ Good: `test("Given two items of 5 and 10, When totalled, Then the total is 15", () => expect(calculateTotal([{ price: 5 }, { price: 10 }])).toBe(15))`
48
+
49
+ ## Check
50
+
51
+ ```sh
52
+ workit test-audit --diff && workit check test
53
+ ```
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: workit-continue
3
+ description: Keep work on track across interruptions and sessions - sort new input, checkpoint, hand off with a resume brief, and pick up by verifying inherited claims. Use for resume, pick up, handoff, new session, interruption, change of direction.
4
+ ---
5
+
6
+ # Continue without losing the thread
7
+
8
+ ## New input mid-task
9
+
10
+ - **Quick question:** answer it; change nothing else.
11
+ - **Same-task adjustment:** update the affected constraint and next step, then
12
+ keep going.
13
+ - **Separate request:** do not silently resume an old objective, and do not
14
+ drop the current one. Checkpoint it (below) if it must continue later, then
15
+ start the new work. Held items stay parked with their resume condition until
16
+ the user resumes them.
17
+
18
+ ## Checkpoint and hand off
19
+
20
+ ```sh
21
+ workit git commit -m "wip: <state>" --all # nothing lives only in your context
22
+ workit handoff --note "<state in one line>" --next "<next command>" --record
23
+ ```
24
+
25
+ The brief carries the branch, HEAD, dirty state, check freshness, verdict,
26
+ rulings and the next command. Add only what it cannot know: choices still
27
+ open, approaches that failed and why. Work spanning repos gets one brief per
28
+ checkout, each with its branch and delivery endpoint. Notes too long for
29
+ `--note` go in a file under `workit dir handoffs`; name its path in the note.
30
+
31
+ ## Pick up
32
+
33
+ 1. In the checkout: `workit handoff`, then `workit ledger list` and
34
+ `git log --oneline -10`.
35
+ 2. Trust the trail, verify the claims: re-run the checks the brief calls
36
+ stale, and confirm each "done" item against the goal on the real artifact
37
+ (a pushed SHA, a PR state, a running feature). Do not re-derive settled
38
+ decisions.
39
+ 3. Continue to the recorded endpoint with the brief's next command.
40
+
41
+ ## Example
42
+
43
+ Bad: a new session re-reads the whole codebase, re-asks the user which
44
+ approach to take, and redoes a finished slice.
45
+
46
+ Good: "`workit handoff`: feature/usage at 4be1, `test` stale, verdict none,
47
+ next `workit check test`. Re-ran it: exit 0. The brief says PR #42 is open:
48
+ `workit pr status` confirms, CI pending. Continuing to ship (read the `workit-ship` skill's SKILL.md and follow it)."
49
+
50
+ ## Check
51
+
52
+ ```sh
53
+ workit handoff # read: "next command" is set and no check is listed as stale
54
+ ```
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: workit-debug
3
+ description: Find a root cause before patching - start from a red-capable deterministic repro, rank hypotheses, bisect regressions, fix at the root with a regression test. Use for bug, broken, failing, flaky, regression, error, why does.
4
+ ---
5
+
6
+ # Debug from a red loop
7
+
8
+ ## Steps
9
+
10
+ 1. **Build the loop before any hypothesis.** One command that is red for the
11
+ user's exact symptom, deterministic, fast and runnable by you:
12
+ `workit check -- <repro>`. Shrink it until it fails in seconds. If the
13
+ symptom only shows on the running app, drive it with the project's
14
+ verify-<app> skill. No loop yet? Building it is the task; do not guess-patch.
15
+ 2. **Read the failure, not the summary:** the full error, the failing value,
16
+ and every caller on its path.
17
+ 3. **Rank three to five falsifiable hypotheses**, likeliest first. Test one at
18
+ a time with the loop or a tagged log line (`[DEBUG-<id>]`, removed at the
19
+ end with one grep). Keep a short hypothesis log so a dead idea stays dead.
20
+ 4. **Regression? Bisect it:** `git bisect start <bad> <good>` then
21
+ `git bisect run <repro>`. The first bad commit names the cause.
22
+ 5. **Fix at the root**, the one place every failing caller passes through.
23
+ Add a regression test at a seam that exercises the real bug pattern; if no
24
+ such seam exists, report that as a finding.
25
+ 6. **Stop rule:** after three dead hypotheses, write down what is measured and
26
+ what is inferred, widen the loop, or ask for the one fact only the user has.
27
+
28
+ Every shipped line traces to evidence from the loop. A "might help" retry or
29
+ guard is a hypothesis, not a fix.
30
+
31
+ ## Example
32
+
33
+ Bad: "Probably a race; added a retry." (no repro, nothing measured)
34
+
35
+ Good: "Repro: `workit check -- bun test lock.test.ts -t stale` red 10/10.
36
+ H1 dead pid not reclaimed - confirmed: `kill(pid, 0)` throws EPERM for another
37
+ user's pid and we treated it as dead. Fix: EPERM means alive. Loop green 10/10;
38
+ regression test pins the EPERM case."
39
+
40
+ ## Check
41
+
42
+ ```sh
43
+ workit check -- <repro> # red before the fix, green after
44
+ workit check test
45
+ ```
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: workit-deslop
3
+ description: Remove AI slop before a PR - dead code, comments that restate the code, filler prose - with a minimal diff and identical behavior. Use for deslop, clean up, slop, tidy before PR, remove dead code, trim the PR body.
4
+ ---
5
+
6
+ # Deslop code and prose
7
+
8
+ Deslop removes; it never changes behavior. Its depth follows the review lane.
9
+
10
+ 1. **Scan first, no agent:** `workit deslop scan --diff [<base>] --json`. It
11
+ classes each added comment `narration`, `marker` (TODO, FIXME, HACK),
12
+ `suppression` (a lint or type disable with no reason), `debug` (stray logs,
13
+ `debugger`, `[DEBUG-` tags) or `allowed`, runs `test-audit` on changed
14
+ tests, and prints the lane and its passes. A marker or a lint/type
15
+ suppression raises `self` to `focused`.
16
+ 2. **Run the lane's passes** (each lane adds to the one below):
17
+ - `none` (docs only): prose. Cut filler and hedging from the PR body and
18
+ docs; keep real symbol names and before-to-after numbers.
19
+ - `self`: delete every narration, marker and debug finding, plus dead code
20
+ from the repo's tools (`knip`, `ts-prune`, `vulture`, unused-lint rules).
21
+ - `focused`: a fresh-eyes no-comments pass and a test-quality lens. Hand
22
+ the diff, never your verdict, to a fresh reviewer: Claude Code and Codex,
23
+ the `reviewer` agent; OpenCode, a child session; Cursor, a Task subagent
24
+ marked `ROLE: reviewer`; Pi, a supervised worker. It deletes every added
25
+ comment off the keep list and triages `workit test-audit --diff`
26
+ (read the `workit-test-audit` skill's SKILL.md and follow it).
27
+ - `full`: also `workit test-audit --mutate --diff` and one architect
28
+ sketch of the simpler shape, reported, not applied.
29
+ 3. **The keep list** (everything else goes): a licence header, an external
30
+ quirk (a library, OS or spec behaving oddly), `prettier-ignore` and other
31
+ tool directives, a lint suppression with its reason (`-- <why>`), public
32
+ API docs, an issue or RFC link.
33
+ 4. **No workaround comments for our own code.** Fix the root in a separate
34
+ `refactor:` commit, or open an issue that carries the explanation and
35
+ delete the comment. A "do not remove" note becomes a test, a type or a
36
+ lint rule.
37
+ 5. **Record one line per PR** when checks pass again:
38
+ `workit deslop result --removed <n> --reshapes <n> --open <n>` writes
39
+ `deslop: lane focused, -42 lines, 3 reshapes, 1 open` to the ledger.
40
+ Nothing to clean is a valid result (`--removed 0`). When a tracked task
41
+ lists a `pre-pr-cleanup` requirement (≤6.x tasks), this is its evidence.
42
+
43
+ ## Example
44
+
45
+ Bad: keeping `// increment the counter` above `count += 1`, or deleting
46
+ `// eslint-disable-next-line no-await-in-loop -- the API rate-limits parallel calls`.
47
+
48
+ Good: the scan lists 6 narration, 1 marker and 1 bare `oxlint-disable`; the
49
+ lane rises to focused; narration and the marker go, the disable gains its
50
+ reason, a fresh reviewer drops two more comments, and a call-order assertion
51
+ on an internal mock becomes a result assertion:
52
+ `deslop: lane focused, -42 lines, 1 reshapes, 0 open`.
53
+
54
+ ## Check
55
+
56
+ ```sh
57
+ workit deslop scan --diff && workit check test && workit deslop result --removed <n>
58
+ ```
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: workit-fanout
3
+ description: Run independent slices in parallel - one worker per isolated worktree with a fixed brief and file-scope manifest, a non-author verifier per slice, results in the ledger. Use for fan out, parallelize, parallel agents, split the work, delegate, swarm.
4
+ ---
5
+
6
+ # Fan out parallel workers
7
+
8
+ Inline-first (workspace `delegation`): fan out only past a threshold, named as
9
+ each slice's `reason` (explore, parallel, backstop, high-risk-verify): an
10
+ explorer past ~3 tool calls or 10k tokens; parallel writers only for 2+ disjoint
11
+ units of ~100+ lines each. Coupled work stays with one owner. Workit never spawns.
12
+
13
+ 1. **Plan the slices** (read the `workit-shape` skill's SKILL.md and follow it) in a plan file under `workit dir plans`
14
+ (`references/brief.md`): per slice an id, branch, REASON, TIER, SCOPE globs,
15
+ `owns` for shared files, `dependsOn` only for a real dependency, and the brief
16
+ fields. `workit fanout plan <plan.json>` refuses an empty or placeholder brief
17
+ field (exit 2) and two slices that may write one file (exit 3) with a fix; apply it and re-run:
18
+ refuse to spawn while a field is empty or the plan is refused. One PR per
19
+ slice is the default; `"fanIn": "integration"` only when the user wants one
20
+ PR (`references/orchestration.md`).
21
+ 2. **Record standing orders** (`workit ledger standing add "<order>"`): every
22
+ user directive all workers share. Directives decay across resumes.
23
+ 3. **Brief each worker verbatim**: `workit fanout worktree create <slice>`
24
+ (every host), then `workit fanout brief <slice>` (WORKTREE, SCRATCH, rules).
25
+ Never hand-edit it; change the plan or the standing orders and render again.
26
+ 4. **Spawn in a rolling window**, in the background, each in its own worktree:
27
+ keep 4-6 in flight and refill from `spawnable` in `workit fanout status` as
28
+ each one finishes. Assign before spawn (OpenCode: `workit worker assign`); each prompt carries
29
+ the brief, or a pointer: its `WORKER`, `TIER`, `TIMEBOX` and `WORKTREE` lines plus "run `workit fanout brief <slice>` and follow it"
30
+ (budget and model hooks read those lines), so batched OpenCode launches each bind their worker.
31
+ Model: the brief's `model:` and `effort:` lines (`workit models show`), else TIER (`references/orchestration.md`).
32
+ Claude Code: the `implementer` agent; its spawn hook drops `isolation` and refuses a prompt without a WORKTREE line.
33
+ 5. **Judge liveness by side effects only:** `workit fanout status` (head age,
34
+ PR, CI, verdict, landed; STUCK past the TIMEBOX). Stop a stuck worker and
35
+ observe that it exited (a timeout is not proof); stop a finished one when its
36
+ report arrives (Claude Code: TaskStop). Never two live workers on one branch.
37
+ Removing a worktree drops its uncommitted changes: `workit fanout worktree
38
+ release <slice>` records `git status` in the ledger and refuses without `--force`.
39
+ 6. **Retry once, then escalate.** A stuck or failed slice gets one retry with
40
+ a fresh brief (`workit fanout brief <slice> --mode resume`, same branch);
41
+ if that fails too, re-slice it, take it over, or report the gap. Never
42
+ chain resumes. A fix round and recheck that both fail: a decider, not a
43
+ third round; product choices go to the user (`references/orchestration.md`).
44
+ 7. **Verify by the workspace `verification` setting** (`workit grant show`).
45
+ A report is a pointer, never evidence. `proportional` (default): each slice's lane (`workit pr status`) decides; none needs no verdict, self the author's `--self`, focused and full a verifier (Claude Code: the `model` and `effort` of `workit models show --role verifier`) after the last push; one verdict at a stack's top covers its unchanged lower PRs, and a stale one with `reverify: focused` re-checks only the new diff, reusing green CI. `self`: a verifier that wrote none
46
+ of the slices, or you if you wrote none. `independent` or high risk: a
47
+ separate verifier session, never yours (doctrine: the ledger only refuses
48
+ authors). One verifier may take a batch of slices, one verdict per branch
49
+ (`workit ledger verdict <result> --branch <b> --how "<evidence>"`), in a
50
+ session never chosen by the author. Spawn it with the brief's `verifier:` model (`workit models show --role verifier`). A review panel on separate models only at high risk.
51
+ 8. **Fan in** with `workit fanout check`: out-of-scope files (any file outside
52
+ it stops the fan-in) and `git merge-tree` conflicts with trunk and between
53
+ siblings. Fix what it names until it exits 0; a merged slice reads as
54
+ landed. Then `workit ledger check --branch <b>` per slice, land in `fanout
55
+ status` order, release the worktrees you made, and `workit ledger standing
56
+ clear`. Only you touch topology: workers never rebase, retarget or merge,
57
+ except the integration-tip merge in integration mode. Then ship
58
+ (read the `workit-ship` skill's SKILL.md and follow it) up to `defaultEndpoint` from `workit grant show`.
59
+
60
+ ## Example
61
+
62
+ Bad brief: "Do the API part and add tests." (no scope, acceptance or verify command: nobody can tell when it is done)
63
+
64
+ Good brief: the output of `workit fanout brief usage-endpoint` (`references/brief.md` shows one).
65
+
66
+ ## Check
67
+
68
+ ```sh
69
+ workit fanout check # exit 0: in scope, no conflicts, landing order printed
70
+ workit ledger check --branch <b> # per slice: accepted (current, passing, independent)
71
+ ```
@@ -0,0 +1,141 @@
1
+ # Worker brief template
2
+
3
+ `workit fanout brief <slice>` renders this brief from the plan, the standing
4
+ orders in force (`workit ledger standing list`) and the slice's scratch dir;
5
+ pass its output verbatim. The template below is what it fills in. Every field
6
+ is required. A brief with an empty field is not spawned. Point to files and
7
+ ledger rows instead of pasting their content. Size the slice so the worker
8
+ finishes it in about 150k tokens of context; split a larger one first.
9
+
10
+ ```md
11
+ MODE: <new | resume (a replacement continuing a branch with commits)>
12
+ WORKER: <slice id: a spawn prompt that names it binds that worker on OpenCode>
13
+ GOAL: <one observable outcome, in the user's terms>
14
+ SCOPE: <file-scope manifest: the globs this worker may write; everything else is read-only>
15
+ branch: <type>/<slug> base: <trunk or parent branch>
16
+ CONTEXT: <pointers: spec section, ledger decisions, the neighbour file to imitate>
17
+ ACCEPTANCE:
18
+ - Given <state>, When <action>, Then <observable result>
19
+ VERIFY: <exact commands, e.g. `workit check test`, the verify-<app> feature to drive>
20
+ TIER: <mundane | standard | hard: how much model the slice needs>
21
+ TIMEBOX: <wall clock, N tool calls (hard: 180, else 120) and the call by which the full gates ran (60%); past it without a new commit you will be replaced>
22
+ SCRATCH: <your own temp dir: the one `fanout worktree create` printed, else `mktemp -d`; never a shared path>
23
+ FORBIDDEN: <no edits outside SCOPE; no new dependencies; ...>
24
+ FAN-IN: <one PR per slice: no rebase, retarget, merge or force-push | integration: merge the integration tip before reporting, nothing else>
25
+ REPORT: branch, head SHA, files changed, each VERIFY command with its exit code,
26
+ each ACCEPTANCE line met / not met, rulings you made (`workit ledger ruling`),
27
+ anything out of scope as a follow-up, not a diff.
28
+ STANDING: <the standing orders, verbatim: `workit ledger standing add` records each one>
29
+ WORKTREE: <the path `workit fanout worktree create <slice>` made; the worker runs `workit <verb> --cwd <it> …` there>
30
+ <identity line, per the lead's host: see "Identity and git rules per host" below>
31
+ ```
32
+
33
+ ## Worked example
34
+
35
+ ```md
36
+ MODE: new
37
+ WORKER: usage-endpoint
38
+ GOAL: `GET /v1/usage` returns the workspace's run count per UTC day for the last 7 days.
39
+ SCOPE: src/routes/usage.ts, src/queries/usage.ts, test/usage.test.ts
40
+ branch: feature/usage-endpoint base: main
41
+ CONTEXT: spec docs/usage/spec.md "Behavior"; ledger decision "counts are per UTC day";
42
+ imitate src/routes/runs.ts for auth and error shape.
43
+ ACCEPTANCE:
44
+ - Given 3 runs today and 1 yesterday, When GET /v1/usage, Then the last two entries are {"runs":1} and {"runs":3}
45
+ - Given no auth header, When GET /v1/usage, Then the status is 401
46
+ VERIFY: `workit check test`; verify-api feature "usage"
47
+ TIER: standard
48
+ TIMEBOX: 45 minutes, 120 tool calls (run your full VERIFY gates by call 72)
49
+ SCRATCH: ~/.local/state/workit/worktrees/app/usage-endpoint/.workit-scratch
50
+ FORBIDDEN: no edits outside SCOPE; no schema migration; no new packages
51
+ FAN-IN: one PR per slice. Never rebase, retarget, merge or force-push: the lead owns topology.
52
+ REPORT: as in the template
53
+ STANDING: conventional commits; no comments that restate code; ask nothing, record rulings instead
54
+ WORKTREE: ~/.local/state/workit/worktrees/app/usage-endpoint (made by `workit fanout worktree create usage-endpoint`; yours alone)
55
+ ```
56
+
57
+ ## Plan file
58
+
59
+ `workit fanout plan <plan.json>` (keep it in `workit dir plans`) records the slices before any spawn. Each
60
+ slice carries the brief fields the plan checks (goal, scope, acceptance,
61
+ verify, forbidden must be filled; tier is mundane, standard or hard). `base`
62
+ defaults to the trunk, or to the branch of a single `dependsOn` slice (a
63
+ stack); `worktree` defaults to `<state>/worktrees/<repo>/<id>` (`workit dir state`). `owns` claims a shared
64
+ file another slice's glob also matches. Globs that match no file yet are compared
65
+ through a sample path. Use `/` as the separator; a backslash only escapes
66
+ literal brackets: `"app/\\[id\\]/page.tsx"`. A `reason` (`explore`, `parallel`, `backstop` or `high-risk-verify`) is rendered as the brief's `REASON:` line and is
67
+ required unless the workspace sets `delegation` to `lead-orchestrates`. A `timebox` such as `45 minutes`
68
+ is the slice's STUCK threshold in `workit fanout status`. `"fanIn":
69
+ "integration"` (with an integration branch as `trunk`) is the one-PR mode in
70
+ `orchestration.md`; the default `"prs"` lands one PR per slice.
71
+
72
+ ```json
73
+ {
74
+ "name": "usage",
75
+ "trunk": "main",
76
+ "slices": [
77
+ {
78
+ "id": "usage-endpoint",
79
+ "branch": "feature/usage-endpoint",
80
+ "tier": "standard",
81
+ "scope": ["src/routes/usage.ts", "src/queries/usage.ts", "test/usage.test.ts"],
82
+ "owns": ["package.json"],
83
+ "goal": "GET /v1/usage returns the run count per UTC day for the last 7 days",
84
+ "acceptance": ["Given no auth header, When GET /v1/usage, Then the status is 401"],
85
+ "verify": ["workit check test"],
86
+ "forbidden": ["no edits outside SCOPE", "no rebase or force-push"],
87
+ "reason": "parallel",
88
+ "context": "docs/usage/spec.md Behavior",
89
+ "timebox": "45 minutes"
90
+ },
91
+ {
92
+ "id": "usage-docs",
93
+ "branch": "docs/usage",
94
+ "tier": "mundane",
95
+ "dependsOn": ["usage-endpoint"],
96
+ "scope": ["docs/usage/**"],
97
+ "goal": "The API guide documents GET /v1/usage",
98
+ "acceptance": ["Given the guide, When a reader looks up usage, Then the response shape is shown"],
99
+ "verify": ["workit check docs"],
100
+ "forbidden": ["no edits outside SCOPE"]
101
+ }
102
+ ]
103
+ }
104
+ ```
105
+
106
+ ## Identity and git rules per host
107
+
108
+ `workit fanout brief` renders the identity line, the model lines and RULES 1
109
+ and 3 for the worker's host: `--host <host>` (claude_code, codex, opencode,
110
+ cursor, pi), else the lead's (`WORKIT_HOST`, or the host's own session
111
+ variable). With no known host it warns on stderr and names the valid ones.
112
+ RULE 3 carries the host's concrete Co-Authored-By line as a `--trailer`.
113
+
114
+ | Lead's host | Identity line | RULES 1 and 3 |
115
+ | --- | --- | --- |
116
+ | Claude Code | `Session: your env already has WORKIT_SESSION_ID (the lead's id)`; no `export`, no hand-minted id (SubagentStart issues `<lead>:<agent id>` only to verifiers and reviewers, never to an implementer, so the worker's commits carry the lead's id) | `workit git branch <branch> --base <base>`, `workit git commit -m <msg> -- <paths in SCOPE>` in the Workit worktree (the spawn hook drops `isolation`); only a host-isolated `.claude/worktrees/agent-<id>` takes plain git, as its SubagentStart text says, since that isolation refuses a git wrapper |
117
+ | OpenCode, Pi, Codex | `Session: your host already sets WORKIT_SESSION_ID in your shell`; export nothing (the host derives the id and an export cannot replace it) | `workit git branch <branch> --base <base>`, `workit git commit -m <msg> -- <paths in SCOPE>` |
118
+ | Cursor, CI, a plain terminal | `export WORKIT_SESSION_ID=<lead>-w-<slice>` (`+try<n>` for a race attempt): declared, not checked | the same `workit git` forms |
119
+
120
+ Once `workit fanout worktree create <slice>` made the worktree, the brief's
121
+ WORKTREE line names it and RULES 1 and 3 run against it on every host:
122
+ `workit git --cwd <worktree> commit …`, `workit check --cwd <worktree> <name>`,
123
+ one verb per call. The worktree is already on the branch (MODE new or resume),
124
+ so no branch command comes first. Without one, `MODE: resume` is
125
+ `git switch <branch>` (the branch exists), then continue from its head. A race
126
+ attempt (`--attempt <n>`) follows its host's row with the branch
127
+ `<branch>-try<n>`.
128
+
129
+ ## Worker rules (`workit fanout brief` appends them as RULES)
130
+
131
+ 1. Work only in WORKTREE, already on the branch, one verb per call against it
132
+ (`workit <verb> --cwd <worktree> …`); Workit's hooks deny an implementer's change
133
+ outside it. With no worktree made yet: create the branch (`MODE: new`) or
134
+ `git switch` to it (`MODE: resume`), as the table above says.
135
+ 2. Decide ambiguities yourself and record them:
136
+ `workit ledger ruling "<what>" --why "<why>" --cost-if-wrong "<cost>"`.
137
+ Stop only for an irreversible action, a security-sensitive one, or a side
138
+ effect outside the worktree.
139
+ 3. Commit with `workit git --cwd <worktree> commit -m "<msg>" --trailer "<host's Co-Authored-By>" -- <paths in SCOPE>`;
140
+ push only if the brief says so.
141
+ 4. Never record a verdict on your own work.