@brainervirus/workit-claude-code 7.5.2 → 7.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-claude-code",
3
- "version": "7.5.2",
3
+ "version": "7.7.0",
4
4
  "private": false,
5
5
  "description": "Workit Claude Code plugin — session and per-turn task context, branch policy on git shell commands, workit method skills, and verifier/reviewer/implementer agents",
6
6
  "keywords": [
@@ -39,8 +39,8 @@
39
39
  "build": "bun scripts/build.ts"
40
40
  },
41
41
  "devDependencies": {
42
- "@brainervirus/workit-cli": "^7.5.2",
43
- "@brainervirus/workit-core": "^7.5.2"
42
+ "@brainervirus/workit-cli": "^7.7.0",
43
+ "@brainervirus/workit-core": "^7.7.0"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=24"
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: architecture
3
+ description: Rank cited deepening refactors from churn and ledger friction; never applied unapproved. Use for architecture.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Architecture: deepen the modules that cause friction
8
+
9
+ User-invoked: offer it, never start it yourself. It proposes and grills; it
10
+ never refactors without the user's approval. Use the words in
11
+ `references/vocabulary.md` exactly and the domain words in `GLOSSARY.md`.
12
+
13
+ ## Deepening
14
+
15
+ 1. **Scope by YAGNI.** A direction the user names wins. Otherwise find hot
16
+ spots: churn (`git log --since=6.months --name-only --format=`, counted per
17
+ file, skipping lockfiles, version-bump manifests, generated files, docs and
18
+ `chore(release)` commits), friction in `workit ledger list --last 200`
19
+ (failed checks and verdicts, rulings, `retro:` decisions) and
20
+ `workit test-audit <paths> --json`. State the window and paths in one line.
21
+ 2. **Settled decisions stand.** Read `GLOSSARY.md`, `CODING_STANDARDS.md` and
22
+ ADRs when present. Never re-litigate an ADR without new evidence.
23
+ 3. **Explore organically.** A read-only explorer (Claude Code: Explore; or
24
+ you) walks the hot spots under the limits in `references/vocabulary.md`
25
+ and returns cited friction. Run the deletion test on every suspect.
26
+ 4. **Report 3-5 ranked candidates, then stop and wait for approval.** Each:
27
+ - files and modules;
28
+ - the friction, with **2 or more cited occurrences** (commit, ledger row,
29
+ PR, test-audit finding); a one-off is not a candidate;
30
+ - an interface sketch: what callers see, what moves behind the seam;
31
+ - what gets simpler and what becomes testable through that interface;
32
+ - **merge danger**: one-way or two-way door, plus blast radius (callers,
33
+ packages, public surface).
34
+ The text list is primary; offer an HTML report only if the host renders one.
35
+ 5. **Grill the chosen one**: numbered questions, each with a recommended
36
+ answer; challenge a weak premise with evidence first. Settle the interface,
37
+ the seam, the tests to replace and the migration order; a module named for
38
+ a new concept gets its glossary entry (call the Skill tool with `workit:shape`).
39
+ 6. **Hand off on approval.** Several slices go into a plan for
40
+ `workit fanout plan <plan.json>`, with scopes and dependencies
41
+ (call the Skill tool with `workit:fanout`). One slice goes to a build (call the Skill tool with `workit:implement`). Record the
42
+ choice with `workit ledger decision "architecture: <id>" --why "<why>"`;
43
+ offer an ADR for a lasting rejection so the next run does not repeat it.
44
+
45
+ ## Instruction files
46
+
47
+ Restructure AGENTS.md or CLAUDE.md in three escalating passes, **each its own
48
+ commit in one PR**, so the user can drop the later ones: remove no-ops;
49
+ progressive disclosure into topic files; coding rules to `CODING_STANDARDS.md`
50
+ and mechanical rules to checks. No commit adds a `workit knowledge lint`
51
+ finding. Never scaffold an empty file (`references/instruction-files.md`).
52
+
53
+ ## Test sweep
54
+
55
+ Run `workit test-audit <paths> --json` over the suite or one hot spot and
56
+ report findings by module, worst first. On approval, the bad tests are
57
+ replaced (call the Skill tool with `workit:test-audit`).
58
+
59
+ ## Example
60
+
61
+ Bad: "The CLI is messy, so I split router.ts in five." Uncited, unapproved.
62
+
63
+ Good: "1. Check runner (check.ts, evidence.ts), 3 occurrences: commits a1b2c3
64
+ and d4e5f6 edit both for one fix; ledger row 41 is a `check` red on a hidden
65
+ timeout. Sketch: `runCheck(spec)` returns evidence, the timeout behind it, so
66
+ timeouts test without a shell. Two-way door, 2 callers in one package."
67
+
68
+ ## Check
69
+
70
+ ```sh
71
+ workit knowledge lint # no new finding after each instruction-files commit
72
+ ```
@@ -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
+ (call the Skill tool with `workit:ship`).
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 (call the Skill tool with `workit:test-audit`). Until then it stays.
@@ -8,60 +8,60 @@ description: Run independent slices in parallel - one worker per isolated worktr
8
8
  Fan out only independent slices: disjoint files, no shared mutable state, each
9
9
  verifiable alone. Code-coupled work stays with one owner, who fans out after
10
10
  the blocking part lands. A worker whose whole job is re-running one command is
11
- ceremony; do it yourself.
11
+ ceremony; do it yourself. Workit never spawns agents; you do.
12
12
 
13
13
  1. **Plan the slices** (call the Skill tool with `workit:shape`) in a plan file (`references/brief.md`):
14
- per slice an id, branch, TIER, the file-scope manifest (SCOPE globs),
15
- `owns` for shared files (lockfile, registry, barrels), `dependsOn` only for
16
- a real dependency (independent PRs off trunk are the default), and the
17
- brief fields. `workit fanout plan <plan.json>` refuses an empty or
18
- placeholder (`<goal>`, `TBD`) brief field (exit 2) and two slices that may
19
- write one file (exit 3) with a fix: an owner for a shared file, or a
20
- dependency that serializes them. Apply it and re-run: refuse to spawn while
21
- a field is empty or the plan is refused. Its `waves` say which slices may
22
- run together; keep 4-6 in flight.
23
- 2. **Brief each worker** from its slice with the fixed template: GOAL, SCOPE,
24
- CONTEXT (pointers, not pasted text), ACCEPTANCE (Given/When/Then), VERIFY
25
- (exact commands), TIER, TIMEBOX, SCRATCH, FORBIDDEN, REPORT, STANDING.
26
- STANDING is every standing order and user directive so far, pasted
27
- verbatim into each spawn and respawn: directives decay across resumes.
28
- 3. **Spawn all workers in one message**, in the background, each in its own
29
- worktree: Claude Code's `implementer` agent (first command `workit git
30
- branch <branch> --base <base>`); elsewhere `workit fanout worktree create
31
- <slice>`, which prints the SCRATCH dir. Refill from `fanout status`.
32
- 4. **Judge liveness by side effects only:** `workit fanout status` (head age,
33
- PR, CI, verdict, landed; STUCK past the TIMEBOX, default 30 min). Stop a
34
- stuck worker and observe that it exited (a timeout is not proof). Removing
35
- a worktree drops its uncommitted changes: `workit fanout worktree release
36
- <slice>` records `git status` in the ledger first and refuses them without
37
- `--force` (native worktrees: record `git -C <wt> status --short` first).
38
- Respawn in `MODE: resume` (brief, directives, last report), same branch.
39
- Never two live workers on one branch. Replace at most twice, then re-slice
40
- or report the gap. Never chain resumes.
41
- 5. **Verify each slice independently.** A fresh agent that did not write it
42
- (Claude Code: the `verifier` agent) runs VERIFY and verify-<app>, then
43
- `workit ledger verdict <result> --branch <b> --how "<evidence>"` under the
44
- session you started it with (`WORKIT_SESSION_ID=<lead>-v<n>`, set by you,
45
- never chosen by the author; Claude Code: the hook names one).
46
- A worker's report is a pointer, never evidence.
47
- 6. **Fan in** with `workit fanout check`: out-of-scope files (any file outside
48
- it stops the fan-in), and `git merge-tree` conflicts with trunk and between
49
- siblings, charged to the slice that lands later. Fix what it names (an
50
- out-of-scope edit becomes a follow-up slice) until it exits 0. A slice
51
- whose PR merged reads as landed; its dependents stop waiting. Then
52
- `workit ledger check --branch <b>` per slice, land in `fanout status` order
53
- and release the worktrees you made. Stacks: `workit stack plan <bottom> …
54
- <top>` once, then `stack sync` and `land`. Only you touch topology: workers
55
- never rebase, retarget or merge. Then ship (call the Skill tool with `workit:ship`).
14
+ per slice an id, branch, TIER, SCOPE globs, `owns` for shared files,
15
+ `dependsOn` only for a real dependency, and the brief fields. `workit fanout
16
+ plan <plan.json>` refuses an empty or placeholder brief field (exit 2) and
17
+ 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** with `workit fanout brief <slice>`: plan
24
+ fields, standing orders, SCRATCH, session id, fan-in rule. Never hand-edit
25
+ 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. Pick the model from TIER (`references/orchestration.md`).
29
+ Claude Code: the `implementer` agent; elsewhere first `workit fanout
30
+ worktree create <slice>`.
31
+ 5. **Judge liveness by side effects only:** `workit fanout status` (head age,
32
+ PR, CI, verdict, landed; STUCK past the TIMEBOX). Stop a stuck worker and
33
+ observe that it exited (a timeout is not proof). Removing a worktree drops
34
+ its uncommitted changes: `workit fanout worktree release <slice>` records
35
+ `git status` in the ledger first and refuses them without `--force`. Never
36
+ two live workers on one branch.
37
+ 6. **Retry once, then escalate.** A stuck or failed slice gets one retry with
38
+ a fresh brief (`workit fanout brief <slice> --mode resume`, same branch);
39
+ if that fails too, re-slice it, take it over, or report the gap. Never
40
+ chain resumes. A hard slice may race instead: N attempts, keep the best
41
+ verdict (`references/orchestration.md`).
42
+ 7. **Verify by the workspace `verification` setting** (`workit grant show`).
43
+ A report is a pointer, never evidence. `self`: a verifier that wrote none
44
+ of the slices, or you if you wrote none. `independent` or high risk: a
45
+ separate verifier session, never yours (doctrine: the ledger only refuses
46
+ authors). One verifier may take a batch of slices, one verdict per branch
47
+ (`workit ledger verdict <result> --branch <b> --how "<evidence>"`), in a
48
+ session never chosen by the author. A review panel on separate models only at high risk.
49
+ 8. **Fan in** with `workit fanout check`: out-of-scope files (any file outside
50
+ it stops the fan-in) and `git merge-tree` conflicts with trunk and between
51
+ siblings. Fix what it names until it exits 0; a merged slice reads as
52
+ landed. Then `workit ledger check --branch <b>` per slice, land in `fanout
53
+ status` order, release the worktrees you made, and `workit ledger standing
54
+ clear`. Only you touch topology: workers never rebase, retarget or merge,
55
+ except the integration-tip merge in integration mode. Then ship
56
+ (call the Skill tool with `workit:ship`).
56
57
 
57
58
  ## Example
58
59
 
59
60
  Bad brief: "Do the API part and add tests." (no scope, no acceptance, no
60
61
  verify command, so nobody can tell when it is done)
61
62
 
62
- Good brief: `references/brief.md` (GOAL: `GET /v1/usage` returns daily run
63
- counts; SCOPE: `src/routes/usage.ts`, `test/usage.test.ts`; VERIFY:
64
- `workit check test`; ...).
63
+ Good brief: the output of `workit fanout brief usage-endpoint`
64
+ (`references/brief.md` shows one).
65
65
 
66
66
  ## Check
67
67
 
@@ -1,8 +1,11 @@
1
1
  # Worker brief template
2
2
 
3
- Every field is required. A brief with an empty field is not spawned. Point to
4
- files and ledger rows instead of pasting their content. Size the slice so the
5
- worker finishes it in about 150k tokens of context; split a larger one first.
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.
6
9
 
7
10
  ```md
8
11
  MODE: <new | resume (a replacement continuing an existing branch)>
@@ -16,11 +19,12 @@ VERIFY: <exact commands, e.g. `workit check test`, the verify-<app> feature to d
16
19
  TIER: <mundane | standard | hard: how much model the slice needs>
17
20
  TIMEBOX: <wall clock or turn budget; past it without a new commit you will be replaced>
18
21
  SCRATCH: <your own temp dir: the one `fanout worktree create` printed, else `mktemp -d`; never a shared path>
19
- FORBIDDEN: <no edits outside SCOPE; no rebase, retarget, merge or force-push; no new dependencies; ...>
22
+ FORBIDDEN: <no edits outside SCOPE; no new dependencies; ...>
23
+ FAN-IN: <one PR per slice: no rebase, retarget, merge or force-push | integration: merge the integration tip before reporting, nothing else>
20
24
  REPORT: branch, head SHA, files changed, each VERIFY command with its exit code,
21
25
  each ACCEPTANCE line met / not met, rulings you made (`workit ledger ruling`),
22
26
  anything out of scope as a follow-up, not a diff.
23
- STANDING: <the standing orders, verbatim: user preferences and every directive given so far>
27
+ STANDING: <the standing orders, verbatim: `workit ledger standing add` records each one>
24
28
  export WORKIT_SESSION_ID=<lead>-w<n> (set by the lead; a verifier brief gets <lead>-v<n>)
25
29
  ```
26
30
 
@@ -40,7 +44,8 @@ VERIFY: `workit check test`; verify-api feature "usage"
40
44
  TIER: standard
41
45
  TIMEBOX: 45 minutes
42
46
  SCRATCH: ../app-wt/usage-endpoint/.workit-scratch
43
- FORBIDDEN: no edits outside SCOPE; no schema migration; no rebase or force-push; no new packages
47
+ FORBIDDEN: no edits outside SCOPE; no schema migration; no new packages
48
+ FAN-IN: one PR per slice. Never rebase, retarget, merge or force-push: the lead owns topology.
44
49
  REPORT: as in the template
45
50
  STANDING: conventional commits; no comments that restate code; ask nothing, record rulings instead
46
51
  ```
@@ -55,7 +60,9 @@ stack); `worktree` defaults to `../<repo>-wt/<id>`. `owns` claims a shared
55
60
  file another slice's glob also matches. Globs that match no file yet are compared
56
61
  through a sample path. Use `/` as the separator; a backslash only escapes
57
62
  literal brackets: `"app/\\[id\\]/page.tsx"`. A `timebox` such as `45 minutes`
58
- is the slice's STUCK threshold in `workit fanout status`.
63
+ is the slice's STUCK threshold in `workit fanout status`. `"fanIn":
64
+ "integration"` (with an integration branch as `trunk`) is the one-PR mode in
65
+ `orchestration.md`; the default `"prs"` lands one PR per slice.
59
66
 
60
67
  ```json
61
68
  {
@@ -90,7 +97,7 @@ is the slice's STUCK threshold in `workit fanout status`.
90
97
  }
91
98
  ```
92
99
 
93
- ## Worker rules (paste into the brief when the host has no implementer agent)
100
+ ## Worker rules (`workit fanout brief` appends them as RULES)
94
101
 
95
102
  1. First command. `MODE: new`: `workit git branch <branch> --base <base>` (the
96
103
  worktree may start on a name that breaks branch policy). `MODE: resume`:
@@ -0,0 +1,117 @@
1
+ # Running a fanout
2
+
3
+ How the lead picks models, keeps workers flowing, retries, races, verifies
4
+ and fans in. Workit records and checks; the host's own subagents run the work.
5
+
6
+ ## TIER to model
7
+
8
+ TIER is a field of each slice and of its brief. Map it where the host lets you
9
+ pick a model per spawn; nothing in the workspace config routes it.
10
+
11
+ | TIER | Claude Code (`model` on the Agent call) | Hosts without a per-spawn model |
12
+ | --- | --- | --- |
13
+ | scouting (read-only search, not a slice) | `haiku` | host default |
14
+ | mundane | `sonnet` | host default |
15
+ | standard | omit it (inherits yours) | host default |
16
+ | hard | omit it (inherits yours); consider a race | host default |
17
+
18
+ OpenCode takes a subagent's model from its agent config: pick a configured
19
+ agent whose model fits the TIER, else the default. Codex, Cursor and Pi run
20
+ every worker on the host's model, so TIER only sizes the timebox and decides
21
+ whether to race.
22
+
23
+ ## Rolling window
24
+
25
+ Keep 4-6 workers in flight on Claude Code; elsewhere as many as the host runs
26
+ in the background, never more than 6. Do not wait for a whole wave: when one
27
+ worker finishes (its notification, or a new head or PR in `workit fanout
28
+ status`), verify it, then spawn the next slice from `spawnable` in the same
29
+ status output. A slice whose dependencies landed, or a stacked child whose
30
+ parent is verified, appears there by itself.
31
+
32
+ ## Retry, then escalate
33
+
34
+ A slice is retried when it is STUCK, its worker exits without meeting
35
+ ACCEPTANCE, or its verdict fails. Stop the worker and observe that it exited.
36
+ Release its worktree: `workit fanout worktree release <slice>` (native
37
+ worktrees: record `git -C <wt> status --short` first). Then spawn one fresh
38
+ worker with `workit fanout brief <slice> --mode resume`: same branch, and the
39
+ brief points at its head and its ledger rows (last report, verdicts,
40
+ rulings). If the retry fails too, escalate instead of a third worker:
41
+ re-slice it smaller (`workit fanout plan` again), take it over yourself, or
42
+ report the gap to the user.
43
+
44
+ ## Race a hard slice
45
+
46
+ When a hard slice has an uncertain approach and a cheap VERIFY, run 2-3
47
+ attempts at once instead of retrying in series. `workit fanout brief <slice>
48
+ --attempt <n>` gives each attempt its own branch (`<branch>-try<n>`), session
49
+ and scratch dir. Each attempt needs its own worktree: Claude Code's
50
+ `implementer` isolates natively; on other hosts `fanout worktree create` makes
51
+ only the slice's own worktree, so run the attempts one after another there.
52
+ Verify every attempt, keep the one with the best verdict (accepted first,
53
+ then the fewest changed files, then the earliest), point the slice branch at
54
+ it (`git branch <branch> <winner>`), have the verifier record the verdict on
55
+ `<branch>` (same head), and delete the losing attempt branches.
56
+
57
+ ## Verification
58
+
59
+ Follow the workspace `verification` setting (`workit grant show`); the
60
+ worker never records a verdict on its own work.
61
+
62
+ - `self` (the default): a verifier that wrote none of the slices records the
63
+ verdicts. A lead that authored none of the slices may record them in its
64
+ own session.
65
+ - `independent`, and any slice at high risk: a separate verifier session
66
+ records them, never the lead's own; at high risk one verifier per slice,
67
+ plus a review panel (below). This is doctrine, not enforced: the ledger
68
+ only tells a branch's authors from everyone else, and a lead that wrote
69
+ none of it counts as independent.
70
+
71
+ Which session id a verdict carries, per host:
72
+
73
+ - Claude Code: subagents inherit your `WORKIT_SESSION_ID`, so the
74
+ SubagentStart hook names each `verifier` and `reviewer` its own session
75
+ (`<lead>:<agent id>`), passed as `--session`; that one wins over any
76
+ `<lead>-v<n>` in a brief. An `implementer` uses the session its brief
77
+ exports for its workit commands.
78
+ - Other hosts: the session the brief sets wins: `export
79
+ WORKIT_SESSION_ID=<lead>-w-<slice>` from `workit fanout brief` for a
80
+ worker, `<lead>-v<n>` (or `--as verifier`) for a verifier you start.
81
+
82
+ A batch verifier takes several slices on one surface in one session: for
83
+ each branch it checks out the head, runs that slice's VERIFY, and records its
84
+ own `workit ledger verdict <result> --branch <b> --how "<evidence>"`. Every
85
+ verdict is keyed to that branch's head SHA; a slice whose head moves after
86
+ it needs a new one. Batch at most what fits one context, about 4 slices.
87
+
88
+ ## Review panel (high risk only)
89
+
90
+ At risk=high only, 2-3 fresh reviewers (call the Skill tool with `workit:review`), each on a model
91
+ other than the author's (Claude Code: a different `model`), each records
92
+ `workit ledger verdict <result> --kind review --branch <b> --how "<findings>"`.
93
+ Land only when every panel verdict passes. Below high risk a panel costs
94
+ more than it finds.
95
+
96
+ ## Integration-branch fan-in (one PR)
97
+
98
+ Only when the user wants one PR for the whole fanout:
99
+
100
+ 1. Cut the integration branch (`workit git branch <integration> --base
101
+ <trunk>`) and plan with `"fanIn": "integration"` and `--trunk
102
+ <integration>`. Planning refuses integration mode on origin's default
103
+ branch.
104
+ 2. Every brief then tells the worker to merge the integration tip into its
105
+ branch before reporting (the fast-forward rule). That merge is the only
106
+ one a worker makes, and only in this mode.
107
+ 3. Land each verified slice with `git merge --ff-only <slice-branch>` in the
108
+ integration checkout. Not a fast-forward (the tip moved since the worker
109
+ merged)? Resume the worker to merge again; never a merge commit of your own.
110
+ 4. `workit fanout check` gates against the integration branch; a slice whose
111
+ tip is on it reads as landed. When all have landed, ship the integration
112
+ branch as one PR (call the Skill tool with `workit:ship`).
113
+
114
+ ## Stacks
115
+
116
+ For stacked slices (`dependsOn` one parent): `workit stack plan <bottom> …
117
+ <top>` once, then `workit stack sync` and `workit stack land`.