pincer-workflow 0.2.3 → 0.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.
Files changed (35) hide show
  1. package/README.md +19 -14
  2. package/bin/pincer.js +47 -11
  3. package/package.json +2 -2
  4. package/template/.agents/skills/pincer-code/SKILL.md +62 -17
  5. package/template/.agents/skills/pincer-evaluate/SKILL.md +85 -15
  6. package/template/.agents/skills/pincer-narrow/SKILL.md +67 -22
  7. package/template/.agents/skills/pincer-plan/SKILL.md +62 -25
  8. package/template/.agents/skills/pincer-release/SKILL.md +31 -12
  9. package/template/.agents/skills/pincer-status/SKILL.md +5 -3
  10. package/template/.claude/commands/pincer-code.md +61 -16
  11. package/template/.claude/commands/pincer-evaluate.md +85 -15
  12. package/template/.claude/commands/pincer-narrow.md +65 -20
  13. package/template/.claude/commands/pincer-plan.md +57 -20
  14. package/template/.claude/commands/pincer-release.md +30 -11
  15. package/template/.claude/commands/pincer-status.md +5 -3
  16. package/template/.claude/hooks/block-dangerous.sh +7 -18
  17. package/template/.claude/hooks/hook-policy.cjs +351 -0
  18. package/template/.claude/hooks/ticket-guard.sh +6 -63
  19. package/template/.claude/references/prd-template.md +41 -9
  20. package/template/.claude/references/ticket-template.md +37 -4
  21. package/template/.codex/README.md +4 -4
  22. package/template/.github/prompts/pincer-code.prompt.md +61 -16
  23. package/template/.github/prompts/pincer-evaluate.prompt.md +85 -15
  24. package/template/.github/prompts/pincer-narrow.prompt.md +65 -20
  25. package/template/.github/prompts/pincer-plan.prompt.md +57 -20
  26. package/template/.github/prompts/pincer-release.prompt.md +30 -11
  27. package/template/.github/prompts/pincer-status.prompt.md +5 -3
  28. package/template/AGENTS.md +11 -5
  29. package/template/docs/dry-run-checklist.md +143 -27
  30. package/template/docs/release-checklist.md +35 -0
  31. package/template/scripts/pincer-evidence.cjs +292 -0
  32. package/template/scripts/pincer-status.sh +83 -26
  33. package/template/scripts/pincer-ticket-lib.sh +321 -0
  34. package/template/scripts/pincer-ticket.sh +58 -47
  35. package/template/scripts/sync-prompts.sh +6 -1
@@ -7,20 +7,34 @@ description: "Create a PRD through brief discovery, codebase scan, and an archit
7
7
 
8
8
  # $pincer-plan — PRD Creation
9
9
 
10
- You are turning a task brief into a compact PRD. This runs inside a short delivery
11
- timebox (~2 hours total), so discovery is brief and the PRD is lean. The PRD feeds
10
+ You are turning a task brief into a reviewable PRD. Scale discovery and detail to
11
+ the change's uncertainty, risk, and any time budget the user supplied. The PRD feeds
12
12
  `$pincer-narrow` next.
13
13
 
14
- **Initial request:** the text that follows the `$pincer-plan` mention in the user's message (ask for it if there is none)
15
-
16
- First run `scripts/pincer-status.sh`. If a PRD already exists, say so and ask whether
17
- this is a new version of it (`.prd/prd-v{N+1}.md` — old versions are never overwritten)
18
- or a fresh start; if tickets are in progress, stop and point at `$pincer-code` instead.
19
-
20
- ## Phase 1: Discovery (~5 min)
21
-
22
- 1. If `the text that follows the `$pincer-plan` mention in the user's message (ask for it if there is none)` contains the brief, extract what you can before asking anything.
23
- Never ask a question the brief already answers.
14
+ Choose the planning profile and record why it fits: `profile: small` for bounded
15
+ scope, low risk, known behavior and straightforward verification; otherwise
16
+ `standard` (the default). Few changed lines alone do not qualify migrations,
17
+ authorization boundaries, uncertain requirements and broad effects need proper
18
+ investigation even for a tiny patch. Honor an explicit budget the user supplied;
19
+ there is no default timebox, and a budget never silently cuts requirements —
20
+ record any cut in Out of Scope.
21
+
22
+ **Initial request:** the text that follows the `$pincer-plan` mention in the user's message (ask only if the required input is missing)
23
+
24
+ First run `scripts/pincer-status.sh`. If a PRD already exists, preserve it and select
25
+ the next unused numeric version for this change. Use the brief and repository state to
26
+ distinguish a revision from a new change; ask only if that distinction changes scope or
27
+ architecture. If tickets for the current PRD are in progress, resume `$pincer-code`
28
+ unless the user explicitly authorized a separate change.
29
+
30
+ ## Phase 1: Discovery
31
+
32
+ 1. If `the text that follows the `$pincer-plan` mention in the user's message (ask only if the required input is missing)` contains the brief, extract what you can before asking anything.
33
+ Never ask a question the brief already answers. Preserve or link the original
34
+ brief in the PRD, and record the desired outcome, assumptions and exclusions.
35
+ If the user supplied a PRD, review it: keep its meaning and existing requirement
36
+ IDs; do not silently replace either. Where its structure needs adapting to the
37
+ template, record a mapping table (`their section or ID → R-NN`) inside the PRD.
24
38
  2. Ask only the questions whose answers would change the architecture or scope.
25
39
  Batch them (max 3–4 at once). Typical ones:
26
40
  - What does "done" look like — what will be run, demoed, or reviewed at the end?
@@ -29,9 +43,10 @@ or a fresh start; if tickets are in progress, stop and point at `$pincer-code` i
29
43
  3. If the project has a frontend, ask one design question: "What should this feel like,
30
44
  and what should it NOT look like?" Capture the answer for the Visual Direction section.
31
45
 
32
- Summarize your understanding in 3–5 sentences and confirm before moving on.
46
+ Summarize your understanding in 3–5 sentences. Existing authorization in the request or
47
+ session carries forward; ask only about an unresolved choice that materially changes the result.
33
48
 
34
- ## Phase 2: Codebase scan (conditional, ~5 min)
49
+ ## Phase 2: Codebase scan (conditional)
35
50
 
36
51
  If the repo already contains source code, launch 1–2 `codebase-explorer` agents in parallel
37
52
  (one for architecture/structure, one for patterns relevant to the feature). Read the 2–3 most
@@ -46,7 +61,7 @@ touches are load-bearing, what test coverage protects them (run the suite, don't
46
61
  and the blast radius + rollback story for the change. Record these in the PRD's
47
62
  Architecture section. Greenfield speed assumptions do not transfer to brownfield work.
48
63
 
49
- ## Phase 3: Architecture (~5 min)
64
+ ## Phase 3: Architecture
50
65
 
51
66
  Propose the architecture: components, data flow, integration points, and key decisions.
52
67
  - Recommend one approach; mention an alternative only when the trade-off is real.
@@ -59,23 +74,45 @@ Propose the architecture: components, data flow, integration points, and key dec
59
74
  - Verify the contract of any external API the plan builds on (one live request or the
60
75
  current official docs) before designing around it — endpoint shapes remembered from
61
76
  training data are guesses.
62
- - Bias every decision toward "finishable in the remaining time". Cut before you gold-plate.
77
+ - Respect any explicit delivery budget. Record deliberate cuts in Out of Scope.
63
78
 
64
- **Gate (heavy):** Ask for explicit approval of the architecture before writing the PRD.
79
+ Prepare the full draft before seeking any approval still required. The user should review a
80
+ concrete scope and architecture; do not repeat an approval already given for the same decision.
65
81
 
66
- ## Phase 4: Write the PRD (~5 min)
82
+ ## Phase 4: Write the PRD
67
83
 
68
84
  1. Load `.claude/references/prd-template.md` and write all core sections.
69
- 2. Include optional sections only when they earn their space in the timebox.
70
- 3. Save to `.prd/prd-v1.md` (create `.prd/` if needed) with frontmatter:
85
+ In Requirements, assign stable `R-NN` IDs within the selected PRD: a revision
86
+ keeps existing IDs and adds new ones, never renumbers. Every requirement has
87
+ observable acceptance scenarios, the relevant failure paths, and the existing
88
+ behavior it must preserve — `$pincer-narrow` maps each scenario to a ticket and
89
+ a check, and `$pincer-evaluate` dispositions every ID.
90
+ 2. Include optional sections when risk or the product context warrants them.
91
+ 3. Save to the next unused `.prd/prd-v{N}.md` (create `.prd/` if needed), with `N`
92
+ matching the filename and frontmatter:
71
93
  ```yaml
72
94
  ---
73
- version: 1
95
+ version: {N}
74
96
  status: draft
75
97
  date: {today}
98
+ profile: small # only when small; omit for standard
76
99
  ---
77
100
  ```
78
- 4. If `.git/` doesn't exist, run `git init` and make an initial commit containing the
79
- PRD and this `.claude/` setup planning should be visible in the history.
80
-
81
- Finish with: "PRD saved to `.prd/prd-v1.md`. Run `$pincer-narrow` to break it into work items."
101
+ 4. If `.git/` doesn't exist, run `git init`. Commit the PRD and only the intended setup
102
+ paths after inspecting existing staged work; planning should be visible in history
103
+ without absorbing unrelated brownfield changes.
104
+
105
+ Present the saved draft and obtain approval only when the same scope/architecture was not
106
+ already authorized. Finish with: "PRD saved to `.prd/prd-v{N}.md`. Run `$pincer-narrow`
107
+ to break it into work items."
108
+
109
+ ## Authorization rule (shared by plan, narrow, code and evaluate)
110
+
111
+ Reuse explicit authorization for the same scope and decisions; ask only about a
112
+ material choice not already authorized, and prepare the concrete proposal before
113
+ asking. A decision the user delegated (for example "pick the architecture") does not
114
+ need another approval when you exercise it, but a newly discovered consequential
115
+ choice is surfaced before implementation. Record the authorization basis and the
116
+ scope it covers in the PRD or the handover. An agent-written record or a status
117
+ field is not authenticated human approval. When resuming without the context that
118
+ granted authorization, do not invent it — ask.
@@ -7,28 +7,47 @@ description: "Audit the repo against the workflow checklist — pass/fail per it
7
7
 
8
8
  # $pincer-release — Workflow Audit
9
9
 
10
- You are auditing the current repo state against `docs/dry-run-checklist.md`. Read-only:
11
- report pass/fail, never fix anything — fixes belong to the stage commands.
10
+ You are auditing the current repo state against `docs/release-checklist.md`. Read-only:
11
+ report pass/fail, never fix anything — fixes belong to the stage commands. Release does
12
+ not repair tickets, rewrite evidence, change PRD state, or publish. A check that mutates
13
+ the candidate invalidates the audit: if `git status --short` is not empty afterwards,
14
+ the verdict is FAIL and names the mutation. The verdict is reported to the user; a
15
+ durable runtime-owned release record is later work.
12
16
 
13
- **Requested stage:** the text that follows the `$pincer-release` mention in the user's message (ask for it if there is none)
17
+ **Requested stage:** the text that follows the `$pincer-release` mention, if any (when omitted, use the playbook's documented default)
14
18
 
15
19
  ## Steps
16
20
 
17
- 1. Read `docs/dry-run-checklist.md` — it is the source of truth for what to check.
18
- 2. Run `scripts/pincer-status.sh` to determine which stages have run (it reads `.prd/`,
19
- `tickets/`, `NOTES.md`; add `git log`). If `the text that follows the `$pincer-release` mention in the user's message (ask for it if there is none)` names a stage, check only up
21
+ 1. Read `docs/release-checklist.md` — it is the source of truth for product-candidate
22
+ readiness. `docs/dry-run-checklist.md` is a separate manual platform trial and must
23
+ not impose toy-project or Pincer-kit assumptions on this audit.
24
+ 2. Run `scripts/pincer-status.sh` to determine the selected PRD and which stages have run
25
+ (it reads `.prd/`, associated `tickets/`, `NOTES.md`; add `git log`). If `the text that follows the `$pincer-release` mention, if any (when omitted, use the playbook's documented default)`
26
+ names a stage, check only up
20
27
  to that stage.
21
28
  3. Check every applicable item mechanically where possible:
22
29
  - File existence and frontmatter: read the files.
23
30
  - Commit format and story: `git log --oneline`.
24
- - Receipts: every done ticket carries `verified:` (a status warning means one was
25
- marked done by hand). Re-run at least two checks with
26
- `scripts/pincer-ticket.sh verify T-{NN}` on a done ticket it re-checks without
27
- touching the receipt and report actual output.
31
+ - Receipts: every done ticket carries current `last_check` and `verified` evidence;
32
+ any status warning fails the audit. Do not call `pincer-ticket.sh` from Release:
33
+ it writes receipts and would invalidate the evaluated candidate.
34
+ - Evidence: `scripts/pincer-status.sh` runs the shared validator
35
+ (`scripts/pincer-evidence.cjs`) against the manifest `NOTES.md` names. The `Notes`
36
+ line must read `current` and the `Evidence` line `ok`; any other text fails the
37
+ audit with that diagnostic. Do not re-implement evidence checks and do not accept
38
+ screenshots described in chat: read the manifest's `checks`, requirement
39
+ dispositions and `visual_review`. Validation establishes that the record is
40
+ consistent, not that the commands ran — say so if asked.
41
+ - Every file the manifest lists is tracked, and `git status --short` is empty before
42
+ and after the audit.
43
+ - Run the repository's candidate-wide release gate directly (`npm test`, or the
44
+ equivalent declared by the project) and report its actual output. Any failure
45
+ blocks PASS. Confirm `git status --short` remains clean afterward.
28
46
  4. For judgment items (tickets genuinely S/M, history reads as a story), give your
29
47
  verdict AND one sentence of evidence — never a bare pass.
30
48
  5. Present a table: checklist item | pass/fail/skipped | evidence. Order by stage.
31
- 6. End with a one-line verdict: "PASS — workflow artifacts complete" or
32
- "FAIL — {n} items failed; fix via {command}". For each failure, name the command
49
+ 6. End with a one-line verdict naming the candidate: "PASS — candidate {sha}: workflow
50
+ artifacts complete" or "FAIL — candidate {sha}: {n} items failed; fix via {command}".
51
+ Fixes go through a new ticket, a new candidate and a new evaluation. For each failure, name the command
33
52
  file (`.claude/commands/*.md`) whose instructions should be tightened if the
34
53
  failure is a workflow bug rather than a run mistake.
@@ -13,11 +13,13 @@ start of a session. Read-only: change nothing.
13
13
  ## Steps
14
14
 
15
15
  1. Run `scripts/pincer-status.sh`. It reads the artifacts on disk (`.prd/`, `tickets/`,
16
- `NOTES.md`) and prints the PRD state, every ticket with its state and clock-based
17
- elapsed time, what is blocked, build time against the budget, any warnings (a ticket
18
- marked done without a verification receipt), and the next command to run.
16
+ `NOTES.md`) and prints the PRD state and profile, every ticket with its state and
17
+ clock-based elapsed time, what is blocked, wall-clock build time while a ticket is in
18
+ progress or against an explicit user budget, the evidence verdict for the evaluated
19
+ candidate, any warnings (each readiness problem once), and the next command to run.
19
20
  2. Report in three lines: where the workflow is, what is in progress or blocked, and the
20
21
  next command. Quote the `Next` line as-is.
21
22
  3. If a ticket is `in_progress`, read it and `git status`, then offer to resume it with
22
23
  `$pincer-code T-{NN}`. If the script printed a warning, surface it — a done ticket
23
24
  without a receipt was marked by hand and needs `scripts/pincer-ticket.sh verify T-{NN}`.
25
+ Never restore a ticket file from git to clear a warning; a failed attempt is a record.
@@ -5,8 +5,9 @@ argument-hint: "Ticket numbers (optional — defaults to all open tickets in ord
5
5
 
6
6
  # /pincer-code — Ticket Implementation
7
7
 
8
- You are implementing the tickets in `tickets/` sequentially. Mostly autonomous: after the
9
- user confirms the starting point, run continuously and report progress between tickets.
8
+ You are implementing the tickets in `tickets/` sequentially. The approved PRD, ticket
9
+ breakdown, and existing session authorization define the work; run continuously and report
10
+ progress between tickets unless a material scope or design decision appears.
10
11
 
11
12
  **Initial request:** $ARGUMENTS
12
13
 
@@ -14,14 +15,15 @@ Ticket state lives in the ticket file's frontmatter and is written **only** by
14
15
  `scripts/pincer-ticket.sh` (`start` → `verify` → `done`). `verify` runs the ticket's
15
16
  Verification block and stamps a receipt only on a green exit; `done` refuses without a
16
17
  receipt that matches the current check, or with unticked acceptance criteria. Never edit
17
- `status`, `started`, `verified`, or `finished` by hand — on Claude Code a hook blocks it.
18
+ `status`, `started`, `last_check`, `verified`, or `finished` by hand — on Claude Code a hook blocks it.
18
19
 
19
20
  ## Before the loop
20
21
 
21
22
  Run `scripts/pincer-status.sh`. It lists every ticket's state, what is blocked, elapsed
22
23
  build time from the clock, and the next action. If a ticket is `in_progress`, you are
23
24
  resuming: read it, check `git status` / `git diff` for uncommitted work, and continue
24
- from wherever the receipt says you are. Confirm the starting point with the user, then go.
25
+ from wherever the receipt says you are. Do not ask the user to reconfirm unchanged,
26
+ previously authorized work.
25
27
 
26
28
  ## Loop (per ticket, in dependency order)
27
29
 
@@ -37,14 +39,17 @@ from wherever the receipt says you are. Confirm the starting point with the user
37
39
  conventions, and nothing else.
38
40
  3. **Verify:** `scripts/pincer-ticket.sh verify T-{NN}` — runs the Verification block and
39
41
  writes the receipt only if it exits 0. Red → fix and re-run; report the actual output,
40
- not assumptions. Green output is the definition of done, not your confidence.
42
+ not assumptions. Green output is the definition of done, not your confidence. If the
43
+ check only validated syntax or a build, say so — that is not behavioral proof. A
44
+ visual judgment is recorded separately in evaluation, not as the receipt, and a tool
45
+ the check needs but cannot run yields an explicit `unverified` result, never
46
+ fabricated output.
41
47
  4. **Self-review the diff** before committing: silent failures (empty catches,
42
48
  un-awaited promises), leftover debug code, drift from the ticket's acceptance criteria.
43
49
  Then a security sweep of the same diff:
44
- - No secret values: run
45
- `git diff | grep -iE '(api[_-]?key|secret|token|password)[[:space:]]*[:=]'`
46
- and treat any hit that isn't a `process.env` reference or a name in
47
- `.env.example` as a blocker.
50
+ - Check for secret-like assignments without printing values. If a scanner reports a
51
+ possible secret, report only its file and line until the value is safely redacted;
52
+ environment references and names in `.env.example` are allowed.
48
53
  - External input touched by this diff is validated server-side, and untrusted
49
54
  content (user input, LLM output) is escaped where rendered — per the
50
55
  Security defaults in `AGENTS.md`.
@@ -53,14 +58,41 @@ from wherever the receipt says you are. Confirm the starting point with the user
53
58
  5. **Close the ticket:** tick every verified acceptance-criteria checkbox (`- [ ]` → `- [x]`;
54
59
  editing the checkboxes is allowed), then `scripts/pincer-ticket.sh done T-{NN}`. A
55
60
  criterion that was cut is a scope change to record in the PRD, not a box to skip.
56
- Commit code and ticket file together: `git add -A && git commit -m "T-{NN}: {title}"`.
57
- 6. Give a one-line progress update using the elapsed figure from
58
- `scripts/pincer-status.sh` ("T-02 done, 3 remaining, 38m elapsed of 75m") and continue.
61
+ Inspect `git status --short`, preserve pre-existing staged work, and stage only the
62
+ explicit paths changed for this ticket plus its ticket file. Review `git diff --cached`
63
+ before committing as `T-{NN}: {title}`.
64
+ 6. Give a one-line progress update ("T-02 done, 3 remaining") and continue. Quote the
65
+ wall-clock elapsed figure from `scripts/pincer-status.sh` when it shows one — it
66
+ appears while a ticket is in progress or a budget is set, and it is not a measure
67
+ of active execution time.
59
68
 
60
- ## Timebox rules
69
+ ## Recovering a ticket file
61
70
 
62
- - The budget is ~75 minutes of build time, measured by `scripts/pincer-status.sh` from
63
- the first ticket's start stamp never estimated. If the remaining tickets won't fit,
71
+ Ticket lifecycle fields are written only by `scripts/pincer-ticket.sh`, and the guard
72
+ also blocks shell restores that would touch ticket files from the assistant's shell:
73
+ `git checkout`/`git restore`/`git switch` naming a ticket path or a normalized
74
+ pathspec that cannot be shown to stay outside `tickets/` (the whole tree, `.`, `:/`,
75
+ `:(top)`, globs, absolute or unexpanded paths, `tickets/…` in any spelling, a
76
+ `-C tickets` prefix), force flags (`-f`, `--force`, `--discard-changes`,
77
+ `--pathspec-from-file`), `git reset --hard|--merge|--keep`, `git stash` (except
78
+ `list`, `show`, `create`, `store`), `git clean -f` without a narrow pathspec,
79
+ `git checkout-index -a` and `git read-tree -u|--reset`, including when wrapped in
80
+ `bash -c`, `eval`, `nice`, `time`, `nohup`, `timeout` or `xargs`. Restoring HEAD
81
+ would erase a newer failed attempt and revive an old passing receipt. Branch
82
+ switches and file-specific restores outside `tickets/` stay allowed. The guard is a
83
+ pattern-based safety net for documented mistake forms, not a complete shell
84
+ boundary; the receipt and status checks remain the source of trust. When a ticket file is malformed or its state was hand
85
+ edited, preserve the malformed contents as they are, report the validation error that
86
+ the script or `scripts/pincer-status.sh` printed, and hand the repair to the user, who
87
+ performs it in their own terminal. Then return through the lifecycle — `start`,
88
+ `verify`, `done` — so the ticket carries fresh verification; a restored receipt is
89
+ never evidence. Do not recommend restoring source files or unrelated edits as routine
90
+ ticket repair. Automated recovery that preserves attempt history is later work (M1).
91
+
92
+ ## Budget rules
93
+
94
+ - If the user set `PINCER_BUILD_BUDGET_MIN` or stated another budget, use the elapsed
95
+ figure from `scripts/pincer-status.sh` rather than estimating. If the remaining tickets won't fit,
64
96
  stop and propose a scope cut: which remaining tickets to drop or shrink. Cutting scope
65
97
  deliberately beats an unfinished mess — record the cut in the PRD's Out of Scope.
66
98
  - If a ticket reveals the plan was wrong, stop and say so rather than silently diverging.
@@ -68,5 +100,18 @@ from wherever the receipt says you are. Confirm the starting point with the user
68
100
 
69
101
  ## When all tickets are done
70
102
 
71
- Update the PRD to `status: built`, then finish with:
103
+ Update the PRD to `status: built` and commit that change on its own (`PRD vN: built`).
104
+ The built transition is part of the candidate that `/pincer-evaluate` reviews; it is
105
+ never moved into a later evidence-only commit. Then finish with:
72
106
  "All tickets built. Run `/pincer-evaluate` for a final quality pass."
107
+
108
+ ## Authorization rule (shared by plan, narrow, code and evaluate)
109
+
110
+ Reuse explicit authorization for the same scope and decisions; ask only about a
111
+ material choice not already authorized, and prepare the concrete proposal before
112
+ asking. A decision the user delegated (for example "pick the architecture") does not
113
+ need another approval when you exercise it, but a newly discovered consequential
114
+ choice is surfaced before implementation. Record the authorization basis and the
115
+ scope it covers in the PRD or the handover. An agent-written record or a status
116
+ field is not authenticated human approval. When resuming without the context that
117
+ granted authorization, do not invent it — ask.
@@ -10,23 +10,42 @@ run the pipeline, then present results.
10
10
 
11
11
  ## Steps
12
12
 
13
- 1. Run `scripts/pincer-status.sh`. Every ticket should be `done` with a receipt; if one
13
+ 1. Run `scripts/pincer-status.sh`. Review only tickets associated with the selected
14
+ PRD. Every such ticket should be `done` with a current receipt; if one
14
15
  is still open or in progress, stop and ask whether it was cut (then it goes in the
15
16
  PRD's Out of Scope) or should be finished first via `/pincer-code`. Then get the full
16
- diff of the session: `git log --oneline` and `git diff <first-commit>..HEAD`.
17
+ diff of the change: identify the actual base commit before this change from
18
+ its ticket commits and recorded context. If it cannot be established, resolve
19
+ that uncertainty before claiming a complete review. Record full commit IDs for
20
+ `base` and `candidate` (`git rev-parse HEAD`), then review `git diff <base>..<candidate>`.
21
+ The candidate is the clean, committed tree that already includes the implementation,
22
+ the ticket closures and the PRD `status: built` commit: `git status --short` must be
23
+ empty before review. If anything is uncommitted or the PRD is not yet built, return
24
+ to `/pincer-code`; do not review a dirty tree.
17
25
  2. Dispatch a `code-quality-reviewer` agent with: the diff, the PRD's Success Criteria and
18
26
  Scope sections, and the list of tickets. If the diff is large, split by area and
19
27
  dispatch two in parallel. (No subagents on this platform? Review the diff yourself
20
28
  in a separate pass, applying `.claude/agents/code-quality-reviewer.md` as the rubric.)
21
- 3. Yourself, in parallel, check spec compliance: does what was built match every ticket's
22
- acceptance criteria and the PRD scope? List any gaps.
29
+ Keep the reviewer's report or its explicit no-findings statement for step 9,
30
+ where it is saved as an artifact; a review that left no record cannot be audited.
31
+ 3. Yourself, in parallel, check spec compliance. For every requirement `R-NN` in the
32
+ PRD record one disposition: `delivered` (evidence on this candidate), `blocked`
33
+ (required behavior failed or was left unverified — this blocks PASS; do not relabel
34
+ it a known limitation to pass), or `deferred` (only with explicit user authorization;
35
+ record the scope decision in the PRD's Out of Scope and evaluate the revised
36
+ candidate). Compare what was built against every ticket's acceptance criteria and
37
+ the PRD scope, and list any gaps. Whether the requirement map is complete and each
38
+ check is semantically adequate is your judgment as reviewer — record that judgment
39
+ in the evaluation; the kit is not a mechanical traceability engine and does not
40
+ validate requirement-revision impact.
23
41
  4. If the project has a UI, look at it — don't only read the code. Start it, open it in
24
42
  the browser (screenshot via Chrome DevTools MCP if available), and check it against
25
43
  the PRD's Visual Direction and Success Criteria. Note anything visibly broken or off.
26
- 5. Run a mechanical security audit (cheap, ~2 min — do all of these):
27
- - Whole history, not just the tree:
28
- `git log -p | grep -iE '(api[_-]?key|secret|token|password)[[:space:]]*[:=]'`
29
- a secret committed then deleted is still leaked.
44
+ 5. Run a mechanical security audit:
45
+ - Inspect the relevant history with a secret scanner that redacts values, when one is
46
+ available. Otherwise review likely locations without copying candidate values into
47
+ output. Report file, line, and remediation only; a secret committed then deleted is
48
+ still leaked.
30
49
  - `.gitignore` covers `.env*` (except `.env.example`), and `git ls-files | grep -i env`
31
50
  shows only `.env.example`.
32
51
  - `npm audit --omit=dev` (or the ecosystem's equivalent) — report high/critical only.
@@ -36,15 +55,66 @@ run the pipeline, then present results.
36
55
  concrete bugs, silent failures, misleading code. Drop nitpicks and style opinions.
37
56
  7. Present findings as a short list with `file:line` references, ordered by severity.
38
57
  Security findings always rank above style-adjacent ones. For each, say whether you
39
- recommend fixing now (within the timebox) or noting as known-issue.
40
- 8. Fix what the user approves (or everything clearly broken, if time allows), verify,
41
- and commit as `review: fixes`.
42
- 9. Close out: write a brief `NOTES.md` at the repo root what was built, what was cut
58
+ recommend fixing now through a ticket or recording it as a known issue.
59
+ 8. Fix findings clearly within the authorized PRD through a new ticket associated with
60
+ that PRD. Use `pincer-ticket.sh` to start, verify, and close it, then make a scoped
61
+ `T-{NN}: {title}` commit. Ask only when a fix changes scope, architecture, or another
62
+ material decision; never make an ad-hoc `review: fixes` commit. Every fix commit
63
+ produces a new candidate: re-record `candidate`, re-run the checks against it, and
64
+ write fresh evidence in step 9 — never reuse a manifest from a previous candidate.
65
+ 9. Persist evidence for the candidate under `.prd/evidence/prd-vN/<candidate>/`:
66
+ - `checks/C-NN.log` — the command and a redacted summary or safe log of each
67
+ executable check. Never secrets, never an environment dump.
68
+ - `visual/<scenario>.png` — each visual capture from step 4, with its scenario,
69
+ viewport and observed result recorded in the manifest. When nothing renders,
70
+ record `visual_review: {applicable: false, reason}` and say why.
71
+ - `review/code-quality.md` — the reviewer's findings from step 2 with their
72
+ dispositions, or its explicit no-findings statement, recorded as a check of
73
+ kind `review` and referenced by the requirements it covers.
74
+ - `manifest.json` — evidence schema 1 (field list in the header of
75
+ `scripts/pincer-evidence.cjs`): selected PRD, full `base` and `candidate` IDs,
76
+ `created`, `environment` with tool limitations, `coverage_review` (your judgment
77
+ from step 3), one `requirements` entry per `R-NN` with its disposition, tickets
78
+ and check IDs, one `checks` entry per check with `kind`, `required`, `result`,
79
+ `command`, timestamp and artifact paths, and `artifacts` with digests from
80
+ `node scripts/pincer-evidence.cjs digest <file>...`.
81
+ A tool you cannot run yields a check with `result: unverified` and a note — never a
82
+ fabricated artifact. A deferred requirement carries `authorized_by` naming the
83
+ user's explicit authorization. Then run
84
+ `node scripts/pincer-evidence.cjs validate .prd/evidence/prd-vN/<candidate>/manifest.json --candidate <candidate> --prd .prd/prd-vN.md`
85
+ and correct the manifest until it prints `ok`; the same validator runs in status
86
+ and release. It checks the record's consistency, not that the commands ran.
87
+ 10. Close out: write a brief `NOTES.md` at the repo root with frontmatter:
88
+ ```yaml
89
+ ---
90
+ prd: .prd/prd-vN.md
91
+ base: <full reviewed base commit ID>
92
+ candidate: <full reviewed candidate commit ID>
93
+ evidence: .prd/evidence/prd-vN/<candidate>/manifest.json
94
+ ---
95
+ ```
96
+ Then commit NOTES.md, the manifest and its listed artifacts — and nothing else —
97
+ as `evaluate: PRD vN candidate <short sha>`. Status accepts this later commit only
98
+ when its diff from the candidate is limited to `NOTES.md` and the evidence files
99
+ the manifest lists; changes to source, tests, configuration, tickets, the PRD or
100
+ other evaluations require reevaluation. Legacy notes without these references
101
+ do not establish readiness. Then describe what was built, what was cut
43
102
  and why, known issues, and what you'd do next with more time. Then a **Handover**
44
103
  section, written for the stranger who inherits this repo in six months: how to get
45
104
  oriented (which file to read first), what each dependency is for and why it earned
46
105
  its place, and what breaks first as the code ages (the riskiest assumption, the
47
- least-tested path). Commit it. This is the first document a reviewer of this repo
48
- should read.
49
- 10. Suggest `/pincer-release` as the final step: "Run `/pincer-release` for a pass/fail audit of the
106
+ least-tested path). This is the first document a reviewer of this repo should read;
107
+ summarize the requirement dispositions from the manifest in it.
108
+ 11. Suggest `/pincer-release` as the final step: "Run `/pincer-release` for a pass/fail audit of the
50
109
  whole workflow's artifacts."
110
+
111
+ ## Authorization rule (shared by plan, narrow, code and evaluate)
112
+
113
+ Reuse explicit authorization for the same scope and decisions; ask only about a
114
+ material choice not already authorized, and prepare the concrete proposal before
115
+ asking. A decision the user delegated (for example "pick the architecture") does not
116
+ need another approval when you exercise it, but a newly discovered consequential
117
+ choice is surfaced before implementation. Record the authorization basis and the
118
+ scope it covers in the PRD or the handover. An agent-written record or a status
119
+ field is not authenticated human approval. When resuming without the context that
120
+ granted authorization, do not invent it — ask.
@@ -5,47 +5,92 @@ argument-hint: "Path to PRD (optional — defaults to the latest in .prd/)"
5
5
 
6
6
  # /pincer-narrow — PRD to Local Tickets
7
7
 
8
- You are decomposing the PRD into small, independently verifiable tickets stored as local
9
- markdown files (no external tracker needed). Target: 4–7 tickets that fit a ~75-minute
10
- build window.
8
+ You are decomposing the PRD into coherent, independently verifiable tickets stored as
9
+ local markdown files (no external tracker needed). Ticket count and size follow the
10
+ change's dependencies and risk, plus any budget the user supplied. There is no hard
11
+ one-to-two-ticket cap for small PRDs and no default timebox: cohesion and dependencies
12
+ decide the count. A breakdown that follows the PRD needs no second approval; a newly
13
+ discovered consequential choice is surfaced before implementation.
11
14
 
12
15
  **Initial request:** $ARGUMENTS
13
16
 
14
17
  ## Steps
15
18
 
16
- 1. Run `scripts/pincer-status.sh`. If tickets already exist, ask before adding to them
17
- new tickets continue the numbering, existing ones are never renumbered. Then read the
19
+ 1. Run `scripts/pincer-status.sh`. If tickets already exist for another PRD, leave them
20
+ as history. New tickets continue the numbering and existing ones are never renumbered.
21
+ If tickets already exist for this PRD, extend them only when the current request already
22
+ authorizes that work; otherwise present the concrete addition before asking. Then read the
18
23
  PRD (`$ARGUMENTS` or the latest `.prd/prd-v*.md`). If its status isn't `draft`, ask
19
24
  which PRD to use.
20
25
  2. Decompose into tickets. Rules:
21
- - Each ticket is one coherent unit: sized S or M, never L. Split anything larger.
22
- - Ticket 1 is always the walking skeleton: project scaffold + a thin end-to-end slice
23
- that runs. Everything after builds on a working base.
26
+ - Each ticket is one coherent unit. Use S, M, or L as relative scope indicators and
27
+ split work when that improves dependency order, verification, or ownership.
28
+ - For greenfield work, use a walking skeleton when it reduces integration risk. For
29
+ brownfield work, begin with the smallest protected vertical change; add a
30
+ characterization ticket before changing load-bearing code that lacks coverage.
24
31
  - Order by dependency; note blockers explicitly ("depends on T-01").
32
+ - Build the requirement map: for every `R-NN` in the PRD and each of its
33
+ scenarios, name the ticket that owns the implementation and the executable
34
+ check that exercises it, or an explicit review method when no executable check
35
+ exists. Record the IDs in each ticket's Context as `Implements: R-NN, R-MM`.
36
+ Enabling work that implements no requirement states its purpose in the ticket
37
+ Objective. Resolve missing coverage and conflicting criteria with the user
38
+ before implementation; do not start with an unmapped required scenario.
25
39
  - Every ticket gets a runnable command in its Verification block — a fenced `bash`
26
40
  block that exits 0 only when the ticket is done. `scripts/pincer-ticket.sh verify`
27
41
  runs it verbatim and stamps the receipt that `done` requires, so it must be
28
42
  non-interactive and self-contained (no "check by hand").
43
+ - Each Verification section opens with `Proves:` — what the check establishes and
44
+ which regression it detects. A check for an executable change must exercise
45
+ observable behavior (including relevant rejection paths and, in brownfield work,
46
+ preservation of existing behavior) and fail when the behavior is wrong, not only
47
+ when an identifier is renamed. Reuse adequate focused tests. A build, a syntax
48
+ check, or an identifier grep alone is not proof; static assertions are primary
49
+ evidence only for static contracts such as generated files, and `Proves:` says so.
50
+ - Adequacy is a judgment about what the command observes, never a word match: do
51
+ not call a command sufficient because it contains `grep`, `test`, or a runner
52
+ name, nor insufficient for lacking them. Manual visual judgment is recorded
53
+ separately in evaluation; a tool the check needs but cannot run yields an
54
+ explicit `unverified` result, never fabricated evidence or a silent waiver.
29
55
  - If the brief or stack implies automated tests, at least one ticket's verification
30
56
  command must be the test runner (e.g. `npm test`) — manual checks alone don't count.
31
57
  - Any ticket whose surface accepts external input (HTTP endpoint, form, file,
32
58
  LLM output) gets an acceptance criterion for the reject path — what invalid
33
59
  input produces (e.g. "empty goal → 400 with a clear message"), not only the
34
60
  happy path.
35
- - The walking skeleton (T-01) includes `.gitignore` covering `.env*` (except
36
- `.env.example`) and an `.env.example` naming any required secrets before
37
- any secret can exist in the repo.
38
- - Brownfield: a ticket that modifies load-bearing code with no test coverage
39
- is preceded by a characterization ticket — a test that pins the current
40
- behavior before any ticket is allowed to change it.
61
+ - A greenfield setup ticket includes `.gitignore` covering `.env*` (except
62
+ `.env.example`) and an `.env.example` naming any required secrets before any
63
+ secret can exist in the repo. In brownfield repositories, preserve and verify
64
+ the existing ignore and environment conventions.
41
65
  3. Write each ticket to `tickets/T-{NN}-{slug}.md` using
42
- `.claude/references/ticket-template.md`, with `status: open`. The other state fields
43
- (`started`, `verified`, `finished`) are added later by `scripts/pincer-ticket.sh`
66
+ `.claude/references/ticket-template.md`, with `status: open` and an explicit
67
+ `prd: .prd/prd-vN.md` naming the selected PRD. Never infer this association from
68
+ numbering or old notes. The other state fields
69
+ (`started`, `last_check`, `verified`, `finished`) are added later by `scripts/pincer-ticket.sh` —
44
70
  never write them yourself.
45
- 4. Present the ticket list (number, title, size, dependencies) as a table.
71
+ 4. Present the ticket list (number, title, size, dependencies) as a table, followed
72
+ by the requirement map as a second table (requirement · scenario · ticket · check
73
+ or review method). Whether the map is complete and each check is adequate is your
74
+ judgment as the author; say so rather than presenting the table as mechanical proof.
46
75
 
47
- **Gate (medium):** Ask for approval of the breakdown and build order. Adjust if pushed back.
76
+ Present the concrete breakdown and build order as a report, not a question. Reuse
77
+ existing authorization for the same scope and order.
48
78
 
49
- 5. After approval, update the PRD frontmatter to `status: ticketed`, commit the tickets
50
- (`git add .prd tickets && git commit`), and finish with:
79
+ 5. Finalize. A breakdown that follows the PRD is already authorized by the PRD: do not
80
+ ask whether to proceed. Update the selected PRD frontmatter to `status: ticketed`,
81
+ inspect existing staged changes, stage that PRD and the explicit new ticket paths,
82
+ review `git diff --cached`, and commit only those paths. Ask first — and finalize
83
+ once it is resolved — only when step 4 surfaced a newly discovered consequential
84
+ choice or a scope change the PRD does not cover. Finish with:
51
85
  "Tickets ready in `tickets/`. Run `/pincer-code` to start implementing."
86
+
87
+ ## Authorization rule (shared by plan, narrow, code and evaluate)
88
+
89
+ Reuse explicit authorization for the same scope and decisions; ask only about a
90
+ material choice not already authorized, and prepare the concrete proposal before
91
+ asking. A decision the user delegated (for example "pick the architecture") does not
92
+ need another approval when you exercise it, but a newly discovered consequential
93
+ choice is surfaced before implementation. Record the authorization basis and the
94
+ scope it covers in the PRD or the handover. An agent-written record or a status
95
+ field is not authenticated human approval. When resuming without the context that
96
+ granted authorization, do not invent it — ask.