@brainervirus/workit-claude-code 7.2.0 → 7.4.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.2.0",
3
+ "version": "7.4.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.2.0",
43
- "@brainervirus/workit-core": "^7.2.0"
42
+ "@brainervirus/workit-cli": "^7.4.0",
43
+ "@brainervirus/workit-core": "^7.4.0"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=24"
@@ -10,41 +10,49 @@ 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
11
  ceremony; do it yourself.
12
12
 
13
- 1. **Slice** (workit-shape): each slice gets a branch, a file-scope manifest
14
- (the globs it may write) and, if it depends on another, its stack parent.
15
- 2. **Check disjointness.** No two manifests overlap. Shared files (lockfile,
16
- registry, barrel exports) belong to one slice, or to you after fan-in.
17
- 3. **Brief each worker** with the fixed template and refuse to spawn while a
18
- field is empty: GOAL, SCOPE (the manifest), CONTEXT (pointers, not pasted
19
- text), ACCEPTANCE (Given/When/Then), VERIFY (exact commands), TIMEBOX,
20
- FORBIDDEN, REPORT, STANDING. STANDING is every standing order and user
21
- directive so far, pasted verbatim into each spawn and respawn, because
22
- directives decay across resumes. Template: `references/brief.md`.
23
- 4. **Spawn all workers in one message**, in the background, each in its own
13
+ 1. **Plan the slices** (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 brief field
18
+ (exit 2) and two slices that may write one file (exit 3) with a fix: an
19
+ owner for a shared file, or a dependency that serializes them. Apply it and
20
+ re-run: refuse to spawn while a field is empty or the plan is refused.
21
+ Its `waves` say which slices may run together; keep 4-6 in flight.
22
+ 2. **Brief each worker** from its slice with the fixed template: GOAL, SCOPE,
23
+ CONTEXT (pointers, not pasted text), ACCEPTANCE (Given/When/Then), VERIFY
24
+ (exact commands), TIER, TIMEBOX, FORBIDDEN, REPORT, STANDING. STANDING is
25
+ every standing order and user directive so far, pasted verbatim into each
26
+ spawn and respawn, because directives decay across resumes.
27
+ 3. **Spawn all workers in one message**, in the background, each in its own
24
28
  worktree (Claude Code: the `implementer` agent; elsewhere
25
29
  `git worktree add --detach ../<repo>-wt/<slug> origin/<base>`). The first
26
30
  command a worker runs is `workit git branch <branch> --base <base>`.
27
- 5. **Judge liveness by side effects only:** new commits and pushes
31
+ 4. **Judge liveness by side effects only:** new commits and pushes
28
32
  (`git log <branch>`), PR and check changes (`workit pr status --branch <b>`).
29
33
  No progress past the timebox means stuck. Stop the old worker and observe
30
34
  that it exited (a timeout is not proof). `git worktree remove --force`
31
35
  drops its uncommitted changes, so first record `git -C <wt> status --short`
32
- in the ledger or your report; only then remove the worktree. Respawn with the brief in
33
- `MODE: resume` (consolidated: original, later directives, its last report):
36
+ in the ledger or your report; only then remove the worktree. Respawn with
37
+ the brief in `MODE: resume` (original, later directives, its last report):
34
38
  the new worker runs `git switch <branch>` in its fresh worktree instead of
35
39
  `workit git branch`. Never two live workers on one branch. Replace at most
36
40
  twice, then re-slice or report the gap. Never chain resumes.
37
- 6. **Verify each slice independently.** A fresh agent that did not write it
41
+ 5. **Verify each slice independently.** A fresh agent that did not write it
38
42
  (Claude Code: the `verifier` agent) runs VERIFY and verify-<app>, then
39
43
  `workit ledger verdict <result> --branch <b> --how "<evidence>"` under the
40
44
  session you started it with (`WORKIT_SESSION_ID=<lead>-v<n>`, set by you,
41
45
  never chosen by the author; Claude Code: the hook names one).
42
46
  A worker's report is a pointer, never evidence.
43
- 7. **Fan in.** Compare `git diff --name-only <base>...<b>` with the slice's
44
- SCOPE: any file outside it stops the fan-in with a report. Then
45
- `workit ledger check --branch <b>` for each slice; restack
46
- stacked slices with `workit stack sync`. Only you touch topology: workers
47
- never rebase, retarget or merge. Then workit-ship.
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 landed
51
+ slice reads as not found: re-plan without it and drop it from dependents'
52
+ `dependsOn`. Then `workit ledger check --branch <b>` per slice; land in its
53
+ order. Stacked slices: `workit stack plan <bottom> … <top>` once, then
54
+ `workit stack sync` and `land`. Only you touch topology: workers never
55
+ rebase, retarget or merge. Then workit-ship.
48
56
 
49
57
  ## Example
50
58
 
@@ -58,5 +66,6 @@ counts; SCOPE: `src/routes/usage.ts`, `test/usage.test.ts`; VERIFY:
58
66
  ## Check
59
67
 
60
68
  ```sh
69
+ workit fanout check # exit 0: in scope, no conflicts, landing order printed
61
70
  workit ledger check --branch <b> # per slice: accepted (current, passing, independent)
62
71
  ```
@@ -12,6 +12,7 @@ CONTEXT: <pointers: spec section, ledger decisions, the neighbour file to imitat
12
12
  ACCEPTANCE:
13
13
  - Given <state>, When <action>, Then <observable result>
14
14
  VERIFY: <exact commands, e.g. `workit check test`, the verify-<app> feature to drive>
15
+ TIER: <mundane | standard | hard: how much model the slice needs>
15
16
  TIMEBOX: <wall clock or turn budget; past it without a new commit you will be replaced>
16
17
  FORBIDDEN: <no edits outside SCOPE; no rebase, retarget, merge or force-push; no new dependencies; ...>
17
18
  REPORT: branch, head SHA, files changed, each VERIFY command with its exit code,
@@ -34,12 +35,56 @@ ACCEPTANCE:
34
35
  - Given 3 runs today and 1 yesterday, When GET /v1/usage, Then the last two entries are {"runs":1} and {"runs":3}
35
36
  - Given no auth header, When GET /v1/usage, Then the status is 401
36
37
  VERIFY: `workit check test`; verify-api feature "usage"
38
+ TIER: standard
37
39
  TIMEBOX: 45 minutes
38
40
  FORBIDDEN: no edits outside SCOPE; no schema migration; no rebase or force-push; no new packages
39
41
  REPORT: as in the template
40
42
  STANDING: conventional commits; no comments that restate code; ask nothing, record rulings instead
41
43
  ```
42
44
 
45
+ ## Plan file
46
+
47
+ `workit fanout plan <plan.json>` records the slices before any spawn. Each
48
+ slice carries the brief fields the plan checks (goal, scope, acceptance,
49
+ verify, forbidden must be filled; tier is mundane, standard or hard). `base`
50
+ defaults to the trunk, or to the branch of a single `dependsOn` slice (a
51
+ stack); `worktree` defaults to `../<repo>-wt/<id>`. `owns` claims a shared
52
+ file another slice's glob also matches. Globs that match no file yet are compared
53
+ through a sample path. Escape literal brackets: `"app/\\[id\\]/page.tsx"`.
54
+
55
+ ```json
56
+ {
57
+ "name": "usage",
58
+ "trunk": "main",
59
+ "slices": [
60
+ {
61
+ "id": "usage-endpoint",
62
+ "branch": "feature/usage-endpoint",
63
+ "tier": "standard",
64
+ "scope": ["src/routes/usage.ts", "src/queries/usage.ts", "test/usage.test.ts"],
65
+ "owns": ["package.json"],
66
+ "goal": "GET /v1/usage returns the run count per UTC day for the last 7 days",
67
+ "acceptance": ["Given no auth header, When GET /v1/usage, Then the status is 401"],
68
+ "verify": ["workit check test"],
69
+ "forbidden": ["no edits outside SCOPE", "no rebase or force-push"],
70
+ "context": "docs/usage/spec.md Behavior",
71
+ "timebox": "45 minutes"
72
+ },
73
+ {
74
+ "id": "usage-docs",
75
+ "branch": "docs/usage",
76
+ "tier": "mundane",
77
+ "dependsOn": ["usage-endpoint"],
78
+ "scope": ["docs/usage/**"],
79
+ "goal": "The API guide documents GET /v1/usage",
80
+ "acceptance": ["Given the guide, When a reader looks up usage, Then the response shape is shown"],
81
+ "verify": ["workit check docs"],
82
+ "forbidden": ["no edits outside SCOPE"]
83
+ }
84
+ ]
85
+ }
86
+ ```
87
+
43
88
  ## Worker rules (paste into the brief when the host has no implementer agent)
44
89
 
45
90
  1. First command. `MODE: new`: `workit git branch <branch> --base <base>` (the
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: retro
3
+ description: Find repeated friction in recent sessions; propose cited fixes ranked by enforcer strength, never applied. Use for retro.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Retro: turn repeated friction into enforcers
8
+
9
+ User-invoked: offer it, never start it yourself. Run it after a session, PR,
10
+ stack or fan-in, including ones that went well; a smooth session still shows
11
+ where agents searched too long, worked around a tool or re-ran a check. Retro
12
+ proposes and stops. Nothing changes until the user approves.
13
+
14
+ 1. **Scope.** Default: this repository's work since the last retro (its
15
+ `retro:` row in `workit ledger list --type decision`), else the last ~10
16
+ sessions. State the window in one line.
17
+ 2. **Read through workit, cheapest first.** Every finding cites these:
18
+ - `workit ledger list --last 200`: rulings (ambiguities the agent had to
19
+ settle), failed or self verdicts, handoffs, check runs, CI reruns.
20
+ - `workit pr status --pr <n>` for each recent PR: threads, failing checks.
21
+ - `git log --oneline -50`, plus reverts and fixups after review.
22
+ - `workit knowledge lint`: today's AGENTS.md and need-based files.
23
+ - Session transcripts **only if the user opts in**, and only this
24
+ workspace's (`references/sources.md`). Never read other projects.
25
+
26
+ Cite by location (ledger row, PR, commit, session file and line). Never
27
+ copy secrets, tokens or personal data from any source into the report.
28
+ 3. **Group into classes.** Navigation cost (many searches before the right
29
+ file, a stale doc followed), repeated mistakes, workarounds (a hand-run
30
+ command where a verb exists, a skipped step), unstable checks (the same
31
+ `workit check <name>` red then green with no change). A class needs **2 or
32
+ more cited occurrences**; a one-off is not a learning.
33
+ 4. **Name the strongest enforcer that works**, strongest first: architecture
34
+ or types (the mistake cannot be written) > lint rule > configured check
35
+ (`workit.checks.json`, `workit check <name>`) or CI job > test >
36
+ `CODING_STANDARDS.md` (judgment the reviewer reads) > AGENTS.md pointer
37
+ (navigation only). A mechanical rule gets a check, not prose: a check can
38
+ fail, a sentence cannot. From types to test, the proof is that the new
39
+ enforcer fails on the cited past mistake. A rule whose mistake can no
40
+ longer happen is deleted.
41
+ 5. **Upstream.** When a workit skill, verb or hook caused the friction,
42
+ propose an issue or PR on BrainerVirus/workit. Never fork a local copy.
43
+ The issue shows the workit behavior in a minimal synthetic reproduction:
44
+ no private repo name, path, code, ledger text, PR or thread quote, or
45
+ transcript. Show the exact draft body; file it only after the user approves.
46
+ 6. **Bloat guards.** AGENTS.md stays within 8 KB: each addition names what it
47
+ removes. Create `CODING_STANDARDS.md` or `GLOSSARY.md` only in the same
48
+ edit as its first real entry, never as a scaffold. Edit steering text by
49
+ `references/steering.md`; `workit knowledge lint` passes after the slice.
50
+ 7. **Report one ranked list, then stop:** Accepted (proposed), Backlog,
51
+ Dropped, each with its citations, enforcer and reason. Each approved item
52
+ becomes a normal slice (workit-implement, then workit-ship), a tracker
53
+ issue, or `.out-of-scope/<concept>.md` when rejected and likely to return.
54
+ Record the user's answer so the next retro starts there:
55
+ `workit ledger decision "retro: <accepted ids>" --why "<window>"`.
56
+
57
+ ## Example
58
+
59
+ Bad: "Agents seem lost in the build. Added 'read the build docs carefully' to
60
+ AGENTS.md." One vague occurrence, no citation, a no-op line, auto-applied.
61
+
62
+ Good: "Navigation, 3 occurrences (rulings 12, 19; PR #88 thread): agents sought
63
+ check names in package.json, missing `workit.checks.json`. Enforcer: AGENTS.md
64
+ pointer, +74 bytes, minus the stale Commands paragraph (-210). Unstable check,
65
+ 2 occurrences (ledger rows 31, 44: `e2e` red then green on one SHA): a debug
66
+ slice to fix the check. Approve?"
67
+
68
+ ## Check
69
+
70
+ ```sh
71
+ workit knowledge lint # exit 0 before and after each approved slice
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,35 @@
1
+ # Session transcripts (opt-in, this workspace only)
2
+
3
+ Transcripts are the most expensive source and can hold private material. Read
4
+ them only after the user says yes to a question such as "Also read the last 10
5
+ session transcripts for this workspace? (local files, read-only)". The default
6
+ is no: the ledger, `pr status` and git are enough for most retros.
7
+
8
+ ## Where they live
9
+
10
+ Typical locations; confirm each exists. Resolve the path from this workspace's
11
+ absolute path, never with a wildcard across projects. If a host's layout
12
+ differs from the one below, say so and skip it rather than search wider.
13
+
14
+ | Host | Location |
15
+ | --- | --- |
16
+ | Claude Code | `~/.claude/projects/<folder>/*.jsonl`, one folder per path from `git worktree list`: the absolute path with every `/` and `.` replaced by `-`. Compute each folder name; never glob for it |
17
+ | Codex | `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl`. To filter, parse only line 1 (`session_meta`) and read only its `cwd` field; skip files whose `cwd` is not this workspace without reading or reporting anything else from them |
18
+ | Cursor | `~/.cursor/projects/<workspace slug>/agent-transcripts/` |
19
+ | Pi | `~/.pi/agent/sessions/--<workspace path, / replaced by ->--/*.jsonl` |
20
+ | OpenCode | this project's sessions from `opencode session list`, read with `opencode export <id>` |
21
+
22
+ Linked worktrees of the same repository count as this workspace; other
23
+ repositories never do.
24
+
25
+ ## How to read them
26
+
27
+ - Newest first, at most the agreed number of sessions.
28
+ - On a host with subagents, one read-only analyst per lens, each returning
29
+ only cited occurrences (session file plus line or message index):
30
+ - navigation: searches and reads before the right file was found, stale docs
31
+ followed;
32
+ - tool economy: hand-run commands where a `workit` verb exists, repeated
33
+ reads of the same file, long outputs nobody used;
34
+ - repeated work: the same fix or check redone, a step undone later;
35
+ - request conflicts: instructions the agent had to reconcile or ask about.
@@ -0,0 +1,39 @@
1
+ # Editing steering text (AGENTS.md, CODING_STANDARDS.md, skills)
2
+
3
+ Steering text is paid for on every session that reads it. Each line must
4
+ change what an agent does; everything else is cost.
5
+
6
+ ## Write
7
+
8
+ - **Point, do not copy.** Link the file or name the command; never paste its
9
+ content. A pointer says when to follow it: "Read before editing a hook:
10
+ `docs/agents/hosts.md`".
11
+ - **Say what done looks like.** "Run `bun run check`; it must exit 0" beats
12
+ "make sure everything works".
13
+ - **Concrete over adjectives.** A command, a path, a number. Prefer the action
14
+ to take over a list of things to avoid.
15
+ - **One rule, one home.** A rule with an enforcer (type, lint, check, test)
16
+ appears in steering text at most as a pointer to that enforcer. The same
17
+ sentence in AGENTS.md and CODING_STANDARDS.md is a defect
18
+ (`duplicate-rule`).
19
+ - **Judgment goes to CODING_STANDARDS.md**, which the reviewer reads; only
20
+ navigation goes to AGENTS.md.
21
+
22
+ ## Cut
23
+
24
+ - **No-ops.** Delete lines that would not change any behavior if removed:
25
+ "be thorough", "write clean code", "keep it concise", "follow best
26
+ practices".
27
+ - **Session residue.** No notes about one session, no implementation detail
28
+ the code already shows, no `path:line` references (they go stale).
29
+ - **Dead rules.** A rule whose mistake can no longer happen (a type or check
30
+ now prevents it) is deleted, not kept "for context".
31
+
32
+ ## Budget
33
+
34
+ - AGENTS.md stays within 8 KB (`workit knowledge lint`, rule
35
+ `agents-budget`). A proposal that adds text names what it removes, or shows
36
+ the byte count still holds.
37
+ - A need-based file (`CODING_STANDARDS.md`, `GLOSSARY.md`) is created in the
38
+ same edit as its first real entry. Headers-only or "TBD" files fail the lint
39
+ (`scaffold-file`).
@@ -18,8 +18,9 @@ independent; `type-check-only` never proves a behavior change.
18
18
  3. Judge two axes separately, never merged or re-ranked:
19
19
  - **Spec:** does the diff do what the acceptance says? Missing, creep or
20
20
  wrong; quote the line.
21
- - **Standards:** repo rules first, then a smell baseline (unclear name, long
22
- function, duplicated logic, leaky abstraction). Judgment only; lint owns nits.
21
+ - **Standards:** repo rules first (`CODING_STANDARDS.md` when present),
22
+ then a smell baseline (unclear name, long function, duplicated logic,
23
+ leaky abstraction). Judgment only; lint owns nits.
23
24
  4. **Tests:** `workit test-audit --diff`. Would each new test fail if the
24
25
  behavior broke? Triage with workit-test-audit.
25
26
  5. **Blast radius:** for each touched contract, caller, config or migration,
@@ -10,11 +10,14 @@ user asks for one, say which trigger fired, and let the user decline.
10
10
  | Plan | more than one slice with dependencies, or work that will be resumed by someone else | `docs/<topic>/plan.md`, next to the spec |
11
11
  | ADR | the choice is hard to reverse **and** surprising **and** a real trade-off (all three) | `docs/adr/NNNN-<slug>.md` |
12
12
  | Glossary entry | a project term was ambiguous and you resolved it | `GLOSSARY.md` (create lazily) |
13
+ | Coding standard | a judgment-call rule a reviewer must check, recurring twice (workit-retro); a mechanical rule gets a check instead | `CODING_STANDARDS.md` (create lazily) |
13
14
  | Out of scope | a request was rejected and is likely to come back | `.out-of-scope/<concept>.md` |
14
15
 
15
16
  Never: a spec for a one-file mechanical fix, a plan that restates the spec,
16
17
  file paths or line numbers in a spec (they go stale), a glossary entry for a
17
18
  general programming term.
19
+ Create a lazy file only in the same edit as its first real entry, never as a
20
+ headers-only or TBD scaffold (`workit knowledge lint` flags one).
18
21
 
19
22
  ## Spec (scaled to the work)
20
23
 
@@ -53,7 +53,8 @@ the base keeps moving, or after 3 failed fix attempts on the same check.
53
53
  6. **Verified.** After the last push a non-author records a verdict
54
54
  (workit-review); `pr status` showing self-reviewed is not verified. Land only when granted: `workit stack land` (the
55
55
  contiguous verified run from the root) or `workit pr merge`.
56
- 7. **Observe it landed:** `workit verify-delivery pr` or `merge`.
56
+ 7. **Observe it landed:** `workit verify-delivery pr` or `merge`. At any endpoint
57
+ (stack land, fan-in too), after a failed verdict or a check red 3+ times: offer `/wk-retro`.
57
58
 
58
59
  ## Example
59
60