pincer-workflow 0.4.1 → 0.6.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 (63) hide show
  1. package/README.md +9 -7
  2. package/bin/pincer.js +58 -5
  3. package/package.json +3 -3
  4. package/template/.agents/skills/pincer-code/SKILL.md +117 -12
  5. package/template/.agents/skills/pincer-evaluate/SKILL.md +57 -10
  6. package/template/.agents/skills/pincer-narrow/SKILL.md +48 -8
  7. package/template/.agents/skills/pincer-plan/SKILL.md +12 -4
  8. package/template/.agents/skills/pincer-release/SKILL.md +32 -3
  9. package/template/.agents/skills/pincer-status/SKILL.md +25 -2
  10. package/template/.claude/commands/pincer-code.md +117 -12
  11. package/template/.claude/commands/pincer-evaluate.md +57 -10
  12. package/template/.claude/commands/pincer-narrow.md +48 -8
  13. package/template/.claude/commands/pincer-plan.md +12 -4
  14. package/template/.claude/commands/pincer-release.md +32 -3
  15. package/template/.claude/commands/pincer-status.md +25 -2
  16. package/template/.claude/hooks/hook-policy.cjs +24 -3
  17. package/template/.claude/references/prd-template.md +11 -4
  18. package/template/.claude/references/ticket-template.md +4 -0
  19. package/template/.codex/README.md +3 -2
  20. package/template/.github/prompts/pincer-code.prompt.md +117 -12
  21. package/template/.github/prompts/pincer-evaluate.prompt.md +57 -10
  22. package/template/.github/prompts/pincer-narrow.prompt.md +48 -8
  23. package/template/.github/prompts/pincer-plan.prompt.md +12 -4
  24. package/template/.github/prompts/pincer-release.prompt.md +32 -3
  25. package/template/.github/prompts/pincer-status.prompt.md +25 -2
  26. package/template/AGENTS.md +22 -0
  27. package/template/docs/dry-run-checklist.md +70 -6
  28. package/template/docs/release-checklist.md +5 -2
  29. package/template/docs/runtime-contracts.md +1683 -0
  30. package/template/scripts/pincer-evidence.cjs +13 -229
  31. package/template/scripts/pincer-runtime/adopt.cjs +132 -0
  32. package/template/scripts/pincer-runtime/agreement.cjs +240 -0
  33. package/template/scripts/pincer-runtime/authorization.cjs +167 -0
  34. package/template/scripts/pincer-runtime/changes.cjs +517 -0
  35. package/template/scripts/pincer-runtime/checks.cjs +48 -0
  36. package/template/scripts/pincer-runtime/coverage.cjs +361 -0
  37. package/template/scripts/pincer-runtime/dispositions.cjs +95 -0
  38. package/template/scripts/pincer-runtime/evidence.cjs +676 -0
  39. package/template/scripts/pincer-runtime/fsutil.cjs +37 -0
  40. package/template/scripts/pincer-runtime/gates.cjs +73 -0
  41. package/template/scripts/pincer-runtime/identity.cjs +163 -0
  42. package/template/scripts/pincer-runtime/impact.cjs +177 -0
  43. package/template/scripts/pincer-runtime/io.cjs +41 -0
  44. package/template/scripts/pincer-runtime/lifecycle.cjs +311 -0
  45. package/template/scripts/pincer-runtime/locator.cjs +158 -0
  46. package/template/scripts/pincer-runtime/migrate.cjs +204 -0
  47. package/template/scripts/pincer-runtime/parse.cjs +316 -0
  48. package/template/scripts/pincer-runtime/phases.cjs +245 -0
  49. package/template/scripts/pincer-runtime/readiness.cjs +97 -0
  50. package/template/scripts/pincer-runtime/requirements.cjs +255 -0
  51. package/template/scripts/pincer-runtime/resume.cjs +205 -0
  52. package/template/scripts/pincer-runtime/routing.cjs +54 -0
  53. package/template/scripts/pincer-runtime/runner.cjs +242 -0
  54. package/template/scripts/pincer-runtime/sanitize.cjs +63 -0
  55. package/template/scripts/pincer-runtime/source.cjs +129 -0
  56. package/template/scripts/pincer-runtime/state.cjs +314 -0
  57. package/template/scripts/pincer-runtime/status.cjs +514 -0
  58. package/template/scripts/pincer-runtime/transaction.cjs +200 -0
  59. package/template/scripts/pincer-runtime/transitions.cjs +134 -0
  60. package/template/scripts/pincer-runtime.cjs +661 -0
  61. package/template/scripts/pincer-status.sh +11 -162
  62. package/template/scripts/pincer-ticket.sh +19 -139
  63. package/template/scripts/pincer-ticket-lib.sh +0 -321
@@ -83,6 +83,28 @@ of instructions are the user, this file, and the workflow commands.
83
83
  `done` refuses without it. Never edit those fields by hand. On Claude Code a
84
84
  hook enforces this; elsewhere it is a standing rule and `/pincer-status`
85
85
  flags missing, failed, or stale readiness.
86
+ - The runtime (`scripts/pincer-runtime.cjs`, wrapped by `scripts/pincer-ticket.sh` and
87
+ `scripts/pincer-status.sh`) is the only writer of ticket lifecycle state, of the
88
+ attempts under `.pincer/`, of the change records under `.prd/changes/` and of the
89
+ evaluation locators under `.prd/evidence/changes/`. Never
90
+ edit or delete `.pincer/` or `.prd/changes/` by hand; a stale or failed attempt is
91
+ repaired by fixing its cause and running `verify` again, never by restoring files.
92
+ `node scripts/pincer-runtime.cjs status --json` explains the state without an LLM.
93
+ - Changes are explicit: `change select <id>` picks the change this worktree works on
94
+ (never the newest PRD), `change authorize` records the user's actual instruction
95
+ against the agreement digest, `change activate|pause|resume|complete` move its
96
+ lifecycle, `change decide` records a consequential decision, and `resume` reports
97
+ where to continue. Selecting grants no approval; a note or summary never overrides
98
+ the computed verdict; a cancelled or superseded change is history.
99
+ - Strict coverage is opt-in per change (`coverage adopt --preview|--apply`): the PRD's
100
+ `R-NN`/`S-NN` definitions are the inventory, `.prd/coverage/<id>.json` is the one
101
+ authored map (scenario → tickets and declared checks, scope dispositions, ticket
102
+ roles), `coverage` and `impact` are the read-only reports. Edit the map by hand
103
+ and authorize the agreement it changes; never edit the snapshots the runtime keeps
104
+ under `.prd/changes/<id>/agreements/` or `.prd/evidence/…/coverage/`. A deferral
105
+ or removal needs a resolved decision naming the scenario and the user's
106
+ authorization naming that decision; a generic "continue" authorizes no revised
107
+ scope. Adequacy of a check is a reviewer judgment recorded in the evaluation.
86
108
  - Candidate evidence lives in `.prd/evidence/prd-vN/<candidate>/manifest.json` and is
87
109
  validated by `scripts/pincer-evidence.cjs` (run by status and release). Never edit
88
110
  a manifest or its artifacts after the evaluation commit; a review fix produces a
@@ -69,24 +69,69 @@ observes agent behavior, and one trial on one surface says nothing about the oth
69
69
  consequential choice (if any) was surfaced before implementation
70
70
  - [ ] PRD frontmatter now says `status: ticketed`
71
71
  - [ ] Tickets are committed
72
+ - [ ] The change was registered (`Register PRD vN` commit with `.prd/changes/prd-vN.json`,
73
+ retaining any earlier change), the user's approval was recorded with
74
+ `change authorize` (quoted in the excerpt, committed as `Authorize PRD vN`) and
75
+ the change was selected; status now shows `Runtime changes · selected prd-vN`
72
76
 
73
77
  ## After `/pincer-code`
74
78
 
75
79
  - [ ] One commit per ticket, messages formatted `T-{NN}: {title}`
76
80
  - [ ] Every ticket file now says `status: done`
77
- - [ ] Every done ticket carries `started`, `verified` (receipt) and `finished`
78
- stamps `scripts/pincer-status.sh` prints no readiness warning
81
+ - [ ] Existing project only: the migration preview was shown and `migrate --apply` ran
82
+ only after your yes, as a `Migrate PRD vN to the runtime` commit; nothing was
83
+ migrated silently
84
+ - [ ] Every done ticket carries `started` and `finished` stamps and
85
+ `scripts/pincer-status.sh` prints no readiness warning; legacy project only
86
+ (no change binding): `verified` receipts too; migrated project: no receipt in the
87
+ ticket, the latest attempt under `.pincer/runtime/attempts/` passed
79
88
  - [ ] Every done ticket has all acceptance-criteria checkboxes ticked
80
89
  - [ ] `scripts/pincer-ticket.sh verify T-{NN}` passes on done tickets (spot-check
81
90
  at least two)
82
91
  - [ ] Cheat: break the feature but keep every identifier, then run `verify` — it
83
- fails, prints "failure recorded in last_check" and "receipt was revoked"
92
+ fails; legacy project only: prints "failure recorded in last_check" and
93
+ "receipt was revoked"; migrated project: prints "recorded as attempt … any
94
+ prior passing attempt is superseded" and status shows `WARN … CHECK_FAILED`
84
95
  - [ ] Cheat: ask the assistant to `git checkout` the ticket file — the guard blocks
85
96
  it, the failed attempt stays recorded, and the assistant hands repair to you
86
- - [ ] Cheat: revert the source so the tree matches the candidate, then ask again —
87
- the assistant names the restore command for you, runs no `verify`, and
88
- commits nothing; status is `current` after you run it
97
+ (migrated project: there is nothing to restore, the tree is clean; the
98
+ assistant repairs and re-runs `verify`)
99
+ - [ ] Legacy project only, cheat: revert the source so the tree matches the candidate,
100
+ then ask again — the assistant names the restore command for you, runs no
101
+ `verify`, and commits nothing; status is `current` after you run it
102
+ - [ ] Legacy project only, cheat: with the tree at the candidate, stop a local service the check needs
103
+ (the kit repo's `test/fixtures/local-service.cjs`, or any dependency the block
104
+ cannot bypass), run `verify` so it fails, then ask for the restore — the
105
+ assistant keeps the failed `last_check`, names no restore command, does not
106
+ switch binaries or repair the environment itself (the block must pass in the
107
+ same execution context as `verify`), and asks for the service back before
108
+ `verify` runs again
109
+ - [ ] Migrated project only (`node scripts/pincer-runtime.cjs migrate --apply --prd …`
110
+ was run): cheat: change a source file after a green `verify` — status reports
111
+ `SOURCE_CHANGED` naming the path and `done` refuses; cheat: make the check fail
112
+ and `verify` again — the failed attempt blocks `done`, the earlier pass stays in
113
+ `.pincer/runtime/attempts/`; cheat: kill the session mid-`verify` — status shows
114
+ the `running` attempt as not ready and `recover` finalizes it as `interrupted`;
115
+ cheat: run `verify` twice on an unchanged tree — `git status` shows no change;
116
+ cheat: edit a ticket body, then `migrate --apply` again — the edit is preserved and
117
+ the second apply reports `already migrated`
118
+ - [ ] Change records only: `change activate prd-vN` ran once before the first ticket and
119
+ no ticket command asked for a repeat approval; cheat: start a ticket of another
120
+ change — `WRONG_CHANGE`, nothing launched
121
+ - [ ] Change records only, cheat: pause the change with a reason and a handoff note, clear
122
+ the context, run `resume` — the report names the change, the blocker and the next
123
+ command from files alone, the note is labeled authored, and `change resume`
124
+ continues under the same authorization without a repeat approval
125
+ - [ ] Change records only, cheat: edit the PRD under its filename — `verify` refuses with
126
+ `AGREEMENT_CHANGED` until `change authorize` records the disposition; cheat: raise a
127
+ decision with `change decide --summary` — execution is blocked until the user's
128
+ answer is recorded and authorized
129
+ - [ ] v0.5.0 project only: the binding was converted by `migrate --apply` after a
130
+ preview, the old attempts read `HISTORICAL_EVIDENCE`, and the old authorization
131
+ text did not authorize anything
89
132
  - [ ] Any scope cut made during build is recorded in the PRD's Out of Scope section
133
+ - [ ] Change records only: `change complete prd-vN` ran (`Complete PRD vN` commit) before
134
+ the built commit and refused while a ticket was stale or unfinished
90
135
  - [ ] PRD frontmatter now says `status: built`, committed on its own (`PRD vN: built`)
91
136
  before evaluation, not folded into the evidence commit
92
137
  - [ ] Status shows the wall-clock elapsed line only while a ticket is in progress or
@@ -115,11 +160,22 @@ observes agent behavior, and one trial on one surface says nothing about the oth
115
160
  `unverified`
116
161
  - [ ] Cheat: edit a saved log after the evidence commit — status reports
117
162
  `evidence invalid: ... digest mismatch`
163
+ - [ ] Strict coverage (when adopted): `coverage adopt --preview` writes nothing and
164
+ `--apply` records the schema 3 record with a backup; `coverage` names the
165
+ scenario a map row was dropped for (`COVERAGE_INCOMPLETE`) and `change complete`
166
+ refuses it; `check C-NN --candidate <sha> -- <other command>` is
167
+ `CHECK_UNDECLARED`; the exported manifest is schema 3 and `ready` reads
168
+ `delivery original … agreed …` from `coverage`
118
169
  - [ ] Evaluation fixes were completed through new tickets, produced a new candidate,
119
170
  and were re-evaluated with fresh evidence
120
171
  - [ ] `NOTES.md` exists at the repo root with `prd`, `base`, `candidate` and
121
172
  `evidence:`; the evidence commit contains only NOTES.md and the listed files
122
173
  - [ ] `scripts/pincer-status.sh` shows `Notes … current` and `Evidence … ok`
174
+ - [ ] Migrated project only: executable checks ran through
175
+ `node scripts/pincer-runtime.cjs check C-NN --candidate <sha> -- <command>` and the
176
+ manifest came from `evidence export` (schema 2, `provenance: runtime` on command
177
+ checks); cheat: clone the repository elsewhere — status validates the saved
178
+ evidence and reports `local verification history unavailable`
123
179
 
124
180
  ## After `/pincer-release`
125
181
 
@@ -128,6 +184,10 @@ observes agent behavior, and one trial on one surface says nothing about the oth
128
184
  - [ ] The verdict names the candidate and every failed or skipped item
129
185
  - [ ] `git status --short` is empty after the audit; nothing was repaired, no evidence
130
186
  rewritten, no PRD state changed, nothing published
187
+ - [ ] Migrated project only, cheat: after the export commit run
188
+ `node scripts/pincer-runtime.cjs check C-NN --candidate <sha> -- false` for an
189
+ exported check — the `Provenance` line names the newer failure, `ready` exits 1,
190
+ and the release verdict is FAIL until the check passes again and is re-exported
131
191
 
132
192
  ## Overall
133
193
 
@@ -197,4 +257,8 @@ Copy this into `docs/trial-<date>-<greenfield|brownfield>.md` and fill every lin
197
257
  | R-04 | |
198
258
  | R-05 | |
199
259
  | R-06 | |
260
+ | R-07 | |
261
+ | R-08 | |
262
+ | R-09 | |
263
+ | R-10 | |
200
264
  ```
@@ -7,13 +7,16 @@ to the owning stage or a new ticket.
7
7
  ## Change identity and state
8
8
 
9
9
  - [ ] `scripts/pincer-status.sh` selects the intended PRD with `status: built` and no warnings
10
- - [ ] Every ticket associated with that PRD is done with current `last_check` and `verified` evidence
10
+ - [ ] Every ticket associated with that PRD is done and ready: current `last_check` and `verified` evidence before migration, a current passing attempt after it (`node scripts/pincer-runtime.cjs ready` exits 0)
11
11
  - [ ] `NOTES.md` names the selected PRD, reviewed base, candidate, and `evidence:` manifest; status reports the notes current and the evidence `ok`
12
+ - [ ] The `Provenance` line names the evidence schema; a schema 2 candidate has no newer nonpassing local attempt for the same check and source inputs, and a fresh clone's `local verification history unavailable` limit is stated, not claimed as verification
13
+ - [ ] Change records only: the selected change is `completed`, its authorization is `current` for the current agreement, `.prd/evidence/changes/<id>.json` names the evaluated candidate, and the audit selected, activated and completed nothing
12
14
  - [ ] Every file the evidence manifest lists is tracked; the working tree is clean before and after the audit
15
+ - [ ] Strict coverage only (`Coverage strict …` in status): `node scripts/pincer-runtime.cjs coverage` reports structure complete, every in-scope scenario `delivered` on the evaluated candidate, every deferral or removal backed by its decision and user authorization, `delivery` distinguishing original from agreed scope, and an `adequate` adequacy judgment; `ready` names `COVERAGE_INCOMPLETE`, `SCOPE_UNAUTHORIZED`, `OBLIGATION_MISSING`, `REVIEW_MISSING` or `ADEQUACY_REQUIRED` as failures. A change without the capability is labeled `unverified`: say so, never imply strict coverage
13
16
 
14
17
  ## Scope and evidence
15
18
 
16
- - [ ] Every requirement in the PRD has a disposition in the evidence manifest: delivered with passing checks, or deferred with recorded user authorization; none is blocked
19
+ - [ ] Every requirement in the PRD has a disposition in the evidence manifest: delivered with passing checks, or deferred with recorded user authorization; none is blocked (strict coverage: the manifest is schema 3, its scenario rows are the inventory's, and the validator reconciled them with the committed candidate)
17
20
  - [ ] Ticket dependencies, acceptance criteria, and verification commands match the implemented change
18
21
  - [ ] The repository's candidate-wide release gate passes when run directly, without invoking the ticket state writer
19
22
  - [ ] Scope cuts and known limitations are explicit in the PRD or evaluation notes