@gtrabanco/pi-agentic-workflow 0.1.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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.es.md +154 -0
  3. package/README.md +148 -0
  4. package/dist/config/defaults.d.ts +8 -0
  5. package/dist/config/defaults.js +11 -0
  6. package/dist/config/load.d.ts +19 -0
  7. package/dist/config/load.js +76 -0
  8. package/dist/config/merge.d.ts +4 -0
  9. package/dist/config/merge.js +43 -0
  10. package/dist/config/schema.d.ts +21 -0
  11. package/dist/config/schema.js +144 -0
  12. package/dist/config/types.d.ts +53 -0
  13. package/dist/config/types.js +12 -0
  14. package/dist/extension/factory.d.ts +47 -0
  15. package/dist/extension/factory.js +49 -0
  16. package/dist/extension/index.d.ts +4 -0
  17. package/dist/extension/index.js +84 -0
  18. package/dist/routing/catalogue.d.ts +35 -0
  19. package/dist/routing/catalogue.js +79 -0
  20. package/dist/routing/dispatch.d.ts +34 -0
  21. package/dist/routing/dispatch.js +191 -0
  22. package/dist/routing/state.d.ts +13 -0
  23. package/dist/routing/state.js +65 -0
  24. package/dist/routing/types.d.ts +90 -0
  25. package/dist/routing/types.js +3 -0
  26. package/dist/settings/console.d.ts +55 -0
  27. package/dist/settings/console.js +266 -0
  28. package/dist/settings/store.d.ts +3 -0
  29. package/dist/settings/store.js +24 -0
  30. package/dist/settings/view.d.ts +11 -0
  31. package/dist/settings/view.js +46 -0
  32. package/package.json +59 -0
  33. package/skills/audit-docs/SKILL.md +171 -0
  34. package/skills/audit-pr/SKILL.md +201 -0
  35. package/skills/audit-pr/references/01_MERGE_GATES.md +24 -0
  36. package/skills/audit-pr/references/02_CLOSURE_AND_SCOPE_GATES.md +83 -0
  37. package/skills/audit-pr/references/03_AUDIT_PROCESS.md +69 -0
  38. package/skills/audit-pr/references/04_VERDICT.md +69 -0
  39. package/skills/audit-pr/references/05_ROUTING_AND_GUARDRAILS.md +58 -0
  40. package/skills/audit-pr/references/PORTABILITY.md +17 -0
  41. package/skills/design-feature/SKILL.md +162 -0
  42. package/skills/design-feature/references/INTERVIEW.md +52 -0
  43. package/skills/design-feature/references/PORTABILITY.md +15 -0
  44. package/skills/design-feature/references/UPSERT_EXAMPLE.md +8 -0
  45. package/skills/design-feature/references/WRITE_AND_UPSERT.md +92 -0
  46. package/skills/discover-repository-state/SKILL.md +83 -0
  47. package/skills/execute-phase/SKILL.md +115 -0
  48. package/skills/execute-phase/references/BATCH_AND_PORTABILITY.md +54 -0
  49. package/skills/execute-phase/references/CLOSEOUT.md +74 -0
  50. package/skills/execute-phase/references/DESCOPE.md +35 -0
  51. package/skills/execute-phase/references/EXECUTION_CONTRACT.md +147 -0
  52. package/skills/execute-phase/references/FOLDING.md +73 -0
  53. package/skills/execute-phase/references/FORGE_BODY.md +24 -0
  54. package/skills/execute-phase/references/HANDOFF.md +21 -0
  55. package/skills/execute-phase/references/OPPORTUNISTIC_FINDING.md +45 -0
  56. package/skills/execute-phase/references/PREFLIGHT.md +152 -0
  57. package/skills/execute-phase/references/UNIT_LOOP.md +88 -0
  58. package/skills/execute-phase/references/WORKFLOWS_FEATURE.md +37 -0
  59. package/skills/execute-phase/references/WORKFLOWS_FIX.md +43 -0
  60. package/skills/execute-phase/references/WORKFLOWS_LEGACY.md +26 -0
  61. package/skills/execute-phase/references/WORKFLOWS_SMALL_PHASED.md +38 -0
  62. package/skills/fold-findings/SKILL.md +141 -0
  63. package/skills/fold-findings/references/FOLD_POLICY.md +43 -0
  64. package/skills/fold-findings/references/FOLD_PROCESS.md +41 -0
  65. package/skills/generate-docs/SKILL.md +145 -0
  66. package/skills/generate-docs/references/ADAPTERS.md +15 -0
  67. package/skills/generate-docs/references/ADAPTER_DISCOVERY.md +33 -0
  68. package/skills/generate-docs/references/GENERATION_PROCESS.md +90 -0
  69. package/skills/init-workspace/SKILL.md +152 -0
  70. package/skills/init-workspace/references/BOOTSTRAP_DISCOVERY.md +70 -0
  71. package/skills/init-workspace/references/BOOTSTRAP_WRITE.md +58 -0
  72. package/skills/init-workspace/references/PORTABILITY.md +16 -0
  73. package/skills/init-workspace/references/UPGRADE.md +83 -0
  74. package/skills/log-session/SKILL.md +159 -0
  75. package/skills/loop-review-fold/SKILL.md +168 -0
  76. package/skills/orchestration-envelope/SKILL.md +81 -0
  77. package/skills/orchestration-envelope/references/TURN_CONTRACT.md +21 -0
  78. package/skills/phase-contract/SKILL.md +82 -0
  79. package/skills/plan-feature/SKILL.md +179 -0
  80. package/skills/plan-feature/references/ROUTING.md +83 -0
  81. package/skills/plan-feature-from-issue/SKILL.md +140 -0
  82. package/skills/plan-feature-scaffold/SKILL.md +93 -0
  83. package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +76 -0
  84. package/skills/plan-fix/SKILL.md +115 -0
  85. package/skills/plan-fix/references/PLANNING_PROCESS.md +118 -0
  86. package/skills/plan-fix/references/SPEC_CONTRACT.md +22 -0
  87. package/skills/planning-preflight/SKILL.md +130 -0
  88. package/skills/product-audit/SKILL.md +225 -0
  89. package/skills/product-audit/references/AUDIT_DIMENSIONS.md +24 -0
  90. package/skills/product-audit/references/AUDIT_PROCESS.md +85 -0
  91. package/skills/resolve-repository-state/SKILL.md +79 -0
  92. package/skills/review-a11y/SKILL.md +60 -0
  93. package/skills/review-brand/SKILL.md +65 -0
  94. package/skills/review-change/SKILL.md +156 -0
  95. package/skills/review-change/references/ADVERSARIAL_RECOMMENDATION.md +31 -0
  96. package/skills/review-change/references/ADVERSARIAL_SETUP.md +86 -0
  97. package/skills/review-change/references/ADVERSARIAL_SYNTHESIS.md +53 -0
  98. package/skills/review-change/references/OUTPUT_AND_GUARDRAILS.md +85 -0
  99. package/skills/review-change/references/PERSIST_AND_DECIDE.md +151 -0
  100. package/skills/review-change/references/PORTABILITY.md +74 -0
  101. package/skills/review-change/references/REVIEW_PROCESS.md +86 -0
  102. package/skills/review-code/SKILL.md +69 -0
  103. package/skills/review-debt/SKILL.md +72 -0
  104. package/skills/review-design/SKILL.md +60 -0
  105. package/skills/review-implementation/SKILL.md +108 -0
  106. package/skills/review-implementation/references/CLASSIFY.md +96 -0
  107. package/skills/review-implementation/references/FIND.md +35 -0
  108. package/skills/review-perf/SKILL.md +79 -0
  109. package/skills/review-security/SKILL.md +65 -0
  110. package/skills/review-seo/SKILL.md +65 -0
  111. package/skills/review-verify/SKILL.md +66 -0
  112. package/skills/ship-roadmap/SKILL.md +120 -0
  113. package/skills/ship-roadmap/references/ADVANCE.md +90 -0
  114. package/skills/ship-roadmap/references/AUDIT_AND_MERGE.md +64 -0
  115. package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +26 -0
  116. package/skills/ship-roadmap/references/FOUNDING.md +101 -0
  117. package/skills/ship-roadmap/references/GUARDRAILS.md +56 -0
  118. package/skills/ship-roadmap/references/MODEL_ROUTING.md +14 -0
  119. package/skills/ship-roadmap/references/PORTABILITY.md +34 -0
  120. package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +93 -0
  121. package/skills/ship-roadmap/references/STOP_CONDITIONS.md +9 -0
  122. package/skills/ship-roadmap/references/TERMINAL_REPORT.md +34 -0
  123. package/skills/triage-issue/SKILL.md +148 -0
  124. package/skills/triage-issue/references/AUDIT_FINDINGS.md +35 -0
  125. package/skills/triage-issue/references/FOLD_LEDGER.md +32 -0
  126. package/skills/triage-issue/references/ISSUE_PROCESS.md +101 -0
  127. package/skills/triage-issue/references/LABELS.md +83 -0
  128. package/skills/triage-issue/references/REVIEW_FINDING_PROCESS.md +41 -0
  129. package/skills/verification-contract/SKILL.md +77 -0
  130. package/skills/workflow-status/SKILL.md +143 -0
  131. package/skills/workflow-status/references/CRASH_RECOVERY.md +66 -0
  132. package/skills/workflow-status/references/ENVELOPE_CORE.md +107 -0
  133. package/skills/workflow-status/references/ENVELOPE_FIELDS.md +77 -0
  134. package/skills/workflow-status/references/GUARDRAILS.md +17 -0
  135. package/skills/workflow-status/references/PORTABILITY.md +14 -0
  136. package/skills/workflow-status/references/SENSOR_CORE.md +95 -0
  137. package/skills/workflow-status/references/SENSOR_SIGNALS.md +128 -0
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: audit-docs
3
+ user-invocable: true
4
+ version: 2.0.1
5
+ argument-hint: "[--fix]"
6
+ author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
7
+ license: MIT
8
+ description: >
9
+ Audit cross-document coherence: docs ↔ roadmap ↔ code ↔ fix index ↔ issues.
10
+ Finds drift — features in docs/ not in the roadmap (or vice versa), fix-index
11
+ entries already merged/closed, broken documentation-map links, dependency
12
+ cycles, artifacts in the wrong language, naming-convention violations — and
13
+ reports them ranked by severity, fixing only low-risk items on request.
14
+ On Claude Code and want hand-tuned per-skill model/effort tiers? Install the `#claude` branch instead (`npx skills add gtrabanco/agentic-workflow#claude`) — see the README. This branch is model-agnostic: the skill inherits whatever model and effort your agent session is already using.
15
+ Triggers: "check doc consistency", "are the docs in sync", "audit the docs",
16
+ "doc coherence review", "did the docs drift", "validate the roadmap".
17
+ ---
18
+
19
+ # Audit Docs
20
+
21
+ A read-first audit answering "do the docs still match reality?" Produces a
22
+ findings report; it does not silently rewrite docs.
23
+
24
+ ## Turn contract — verify before ending the turn
25
+
26
+ ```
27
+ ✓ The AUDIT DOCS fixed-format report was printed, ending in `Decision: PASS | FAIL`
28
+ ✓ No doc was rewritten without explicit --fix / user go-ahead
29
+ ✓ The closing `→ Next:` block is printed as the ABSOLUTE last output
30
+ ```
31
+
32
+ About to end the turn with any box unchecked? The turn is NOT done — complete
33
+ the missing box first (weak models drop end-of-document duties; this list is
34
+ first on purpose).
35
+
36
+ ## When to use
37
+
38
+ - Before a release or milestone, after merging several features/fixes, or
39
+ whenever the doc set might have drifted from the code and issues.
40
+
41
+ ## Step 0 — Discover the project (always first)
42
+
43
+ Per the agent guide's **Workflow conventions** + **documentation map**, then read
44
+ what THIS skill needs: the roadmap, the fix index + template, and the feature
45
+ folder layout — the map tells you which links and invariants to check.
46
+
47
+ ## Checks
48
+
49
+ Run these and collect findings (cite paths/lines/issue numbers each):
50
+
51
+ 1. **Roadmap ↔ feature folders.** Every `docs/features/<NN>-<slug>/` is in the
52
+ roadmap, and every roadmap entry has a folder (or is explicitly "scheduled").
53
+ 2. **Feature dependencies.** SPEC `Depends on` / `Branch` fields are valid; no
54
+ dependency cycles; ordering is consistent with the roadmap.
55
+ 3. **Fix index hygiene.** Every entry maps to an **open** issue and an unmerged
56
+ branch; flag entries whose issue is closed or whose PR merged (should have
57
+ been removed). Flag open fix branches missing from the index.
58
+ 4. **Documentation-map links resolve.** Every file the map references exists;
59
+ flag "scheduled, not yet authored" items so they aren't mistaken for drift.
60
+ 5. **Broken intra-doc links.** Relative links/anchors point at real
61
+ files/sections.
62
+ 6. **Issue references.** Acceptance/known-issues lines referencing `#N` aren't
63
+ pointing at long-closed issues without note.
64
+ 7. **Language & naming conventions.** Artifacts in the project's docs language
65
+ (this repo: **English**); file/dir naming matches conventions (e.g.
66
+ kebab-case TS files, PascalCase components).
67
+ 8. **Invariant tags.** If the project uses invariant/decision IDs (e.g.
68
+ INV-/D-/KI-), spot-check that referenced IDs exist where claimed.
69
+ 9. **PR-link integrity on `done` rows.** Every roadmap row (and fix-index
70
+ entry) with status `done` carries a linked PR reference —
71
+ `done · [#<pr>](<pr-url>)`. For each bare `done`, find its PR in the forge
72
+ (`gh pr list --state all --head feat/<NN>-<slug>` or by title) and propose
73
+ the row update; a `done` with no PR found at all is HIGH severity (the unit
74
+ may never have been closed out).
75
+
76
+ **Workflow discipline (checks 10–14)** — the executor skills enforce these at
77
+ write time; this audit verifies they actually held. Each check is mechanical:
78
+ run the command shown, don't infer.
79
+
80
+ 10. **Phase naming.** `grep -rnE '\bS[0-9]+\b|\bStep [0-9]' docs/features/*/{PLAN,TASKS,progress}.md`
81
+ must return nothing — plans use `P1, P2, …` ("phases") only. Any hit: LOW
82
+ (rename), plus check the executor argument still resolves.
83
+ 11. **Per-phase doc discipline.** For every M/L feature `in-progress`/`done`:
84
+ completed phases are ticked in `TASKS.md`, `progress.md` has one entry per
85
+ completed phase, and (features planned under the current template) the
86
+ final phase ends with the literal close-out tasks (open PR + print URL,
87
+ link roadmap row, push the link commit). A `done` feature with unticked
88
+ tasks or a phase missing from `progress.md`: HIGH.
89
+ 12. **Branch & PR discipline vs the forge.** For every `done` unit: its PR
90
+ exists, targets the default branch, has a non-empty body, and carries
91
+ `Closes #<n>` when the unit is issue-born (SPEC references an issue).
92
+ Also scan recent default-branch history (`git log --first-parent`) for
93
+ feature/fix-scoped changes committed directly without a PR: HIGH.
94
+ 13. **Generated-docs provenance (only when the documentation map declares a
95
+ `Docs site` block; otherwise state n/a).** Scan the declared content dir
96
+ for pages carrying `generated-by: agentic-workflow/generate-docs`. For
97
+ each: (a) its `source-unit` exists in the roadmap or fix index — no match
98
+ is an **orphan** (MEDIUM: propose deletion or re-attribution); (b) the
99
+ unit's PR merged **after** the page's `updated` date with commits touching
100
+ the page's subject paths — that page is **stale** (LOW: propose
101
+ `/generate-docs <unit>` to refresh). Cite page path + unit per finding.
102
+ 14. **Commit format & dependency discipline.** Sample the unit branches'
103
+ commits: `<type>(<scope>): <summary>` conventional format (violations:
104
+ LOW). Every `in-progress`/`done` row's `Depends on:` closure was merged —
105
+ a unit built on unmerged deps is HIGH unless `decisions.md` records a
106
+ user-forced override (`--force`), which downgrades it to LOW (documented
107
+ risk).
108
+
109
+ Adapt the list to what the project has; skip checks for absent structures and
110
+ say so.
111
+
112
+ ## Process
113
+
114
+ 1. Discover, then run the checks with `grep`, file reads, and the forge CLI
115
+ (per Workflow conventions; examples use `gh`).
116
+ 2. Produce the findings report — **return exactly** (fixed output contract):
117
+
118
+ ```
119
+ AUDIT DOCS — scope: <docs tree / roadmap / fix index / issues checked>
120
+
121
+ | # | Check (1-13) | Finding | Sev | Evidence | Proposed fix |
122
+ |---|-------------|---------|-----|----------|--------------|
123
+ | 1 | <which> | <what> | high|low | <path:line / #issue> | <smallest action> |
124
+
125
+ Checks run: <n>/13 (skipped: <which + why — absent structures only>)
126
+ Summary: <1-2 sentences>
127
+ Decision: PASS | FAIL (FAIL if any high-severity finding is open)
128
+ ```
129
+
130
+ Sev: **high** = misleading or broken; **low** = cosmetic.
131
+ 3. **Fix only on request.** With explicit `--fix` (or user go-ahead), apply the
132
+ low-risk corrections (remove a merged fix-index row, fix a dead link, register
133
+ a missing roadmap entry, add a verified PR link to a bare `done` row). Leave judgment calls to the user.
134
+
135
+ ## Guardrails
136
+
137
+ - Read-first; never bulk-rewrite docs unprompted.
138
+ - Distinguish genuine drift from intentionally "scheduled/deferred" items —
139
+ don't report deliberate tradeoffs as errors.
140
+ - Keep changes surgical and within docs; no code or behavior changes.
141
+
142
+ ## Portability (agents other than Claude Code)
143
+
144
+ The workflow is the contract; Claude Code features are conveniences. On an
145
+ agent that lacks one, apply the fallback — never skip the step the feature
146
+ enables:
147
+
148
+ - **No slash-command menu** — where this skill says `/<skill>`, open that
149
+ skill's `SKILL.md` (wherever your agent installed the skills) and follow it
150
+ literally, in a fresh conversation: hand-offs assume a clean context.
151
+ - **No per-skill `model:`/`effort:`** — on the `#claude` branch the frontmatter pins these tiers; here, pick tiers yourself:
152
+ these are mostly mechanical cross-document checks — a mid-tier model is
153
+ enough; escalate to your strongest only for a deep audit.
154
+
155
+ ## Relationship to other skills
156
+
157
+ - Complements `plan-feature` (which *creates* the docs this audits) and
158
+ `triage-issue` (which keeps the fix index honest).
159
+ - Run standalone anytime; no required predecessor.
160
+
161
+ ## Done when
162
+
163
+ - A severity-ranked findings report exists, and any approved low-risk fixes are
164
+ applied — with genuine deferrals left untouched and labeled as such.
165
+ - **The closing `→ Next:` block is printed:**
166
+
167
+ ```
168
+ → Next: apply the approved low-risk fixes, then re-run /audit-docs to confirm clean
169
+ · real drift (not cosmetic) → /triage-issue · a concrete defect → /plan-fix
170
+ · already clean → nothing to do
171
+ ```
@@ -0,0 +1,201 @@
1
+ ---
2
+ name: audit-pr
3
+ user-invocable: true
4
+ version: 4.3.1
5
+ argument-hint: <pr-number> (optional — defaults to the current branch's PR)
6
+ author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
7
+ license: MIT
8
+ description: >
9
+ Audit a whole PR against the delivery contract and return MERGE-READY or
10
+ evidenced blockers with the full URL. Consumes the current review-change
11
+ REVIEW-PASS receipt instead of re-running review axes; posts a SHA-bound
12
+ ready comment; never edits or merges. Triggers: "audit-pr", "is this PR
13
+ ready", "merge gate".
14
+ ---
15
+
16
+ # Audit PR
17
+
18
+ The manager's **"can this ship?"** gate. A read-first audit over the *entire* PR —
19
+ its SPEC, all phases, docs, CI status, and review receipt — that returns a single
20
+ verdict: **merge-ready** or a ranked list of **blockers**. **Never edits,
21
+ refactors, or merges.** The human merges, or an active
22
+ `ship-roadmap --fullauto` invocation consumes the SHA-bound verdict and performs
23
+ its separate fail-closed merge step.
24
+
25
+ `audit-pr` does **not** re-review the diff. It consumes the current SHA-bound
26
+ `review-change` receipt (the `REVIEW-PASS` comment marker) as the review
27
+ evidence, blocks on a missing or stale receipt routed to `/review-change`, and
28
+ independently evaluates only the delivery gates below.
29
+
30
+ ## Turn contract — verify before ending the turn
31
+
32
+ ```
33
+ ✓ The review receipt was consumed from one PR snapshot: `headRefOid` + newest
34
+ matching `review-change:pass` marker fetched together; absent or any SHA
35
+ mismatch → blocker routed to `/review-change`, current → its scope/axes/
36
+ acceptance coverage/manual checks acknowledged without re-review
37
+ ✓ The verdict block was printed in the fixed format: `VERDICT: MERGE-READY | BLOCKED` with ranked, evidenced blockers
38
+ ✓ The PR's FULL URL is printed in the verdict header (the user may be juggling
39
+ several projects and agents without a CI monitor — the link in the chat is
40
+ the contract, never "PR #N" alone)
41
+ ✓ MERGE-READY verdict? Then the MERGE-READY comment was POSTED on the PR
42
+ (`gh pr comment --body-file` RUN, idempotent by SHA marker) — a comment,
43
+ never a commit-message tag. BLOCKED → no comment posted
44
+ ✓ Nothing was edited, refactored, or merged; merge authorization is outside
45
+ this skill and cannot be inherited from docs or an earlier session
46
+ ✓ No review pass was composed or reconstructed: a missing/stale receipt is a
47
+ blocker, never a prompt to re-run review axes from this skill
48
+ ✓ Closure integrity was evaluated and its result stated explicitly: pass /
49
+ blocker / warning / n-a (fix-governed PRs are always n-a; never skipped
50
+ silently)
51
+ ✓ Scope integrity (descope) was evaluated and its result stated explicitly:
52
+ pass / blocker / n-a (no unit-referencing issues born on the branch → n-a;
53
+ never skipped silently)
54
+ ✓ Architectural-invariant preservation was evaluated and its result stated
55
+ explicitly: pass / blocker / n-a (no project document → n-a; never skipped)
56
+ ✓ The closing `→ Next:` block is printed as the ABSOLUTE last output
57
+ ```
58
+
59
+ About to end the turn with any box unchecked? The turn is NOT done — complete
60
+ the missing box first (weak models drop end-of-document duties; this list is
61
+ first on purpose).
62
+
63
+ ## When to use
64
+
65
+ - After the work is "done" and before merging — the final gate once `review-change`
66
+ is clean (its `REVIEW-PASS` receipt is posted) and all phases are committed.
67
+ - When you want one defensible answer to "is this PR actually ready?" rather than
68
+ trusting that every loose end was tied off.
69
+
70
+ `review-change` reviews the *diff* for quality and posts its SHA-bound receipt;
71
+ `audit-pr` consumes that receipt and audits the *PR as a unit of delivery* — that
72
+ everything the SPEC promised is present, traceable, and green. A missing or stale
73
+ receipt is a blocker routed back to `/review-change`, never re-litigated here.
74
+
75
+ ## Scope
76
+
77
+ The whole pull request: the branch vs. the default base, **plus** its SPEC and
78
+ planning artifacts, the roadmap entry, the doc map, the PR body, issue links, and
79
+ CI. Default target is the current branch's PR; accept a PR number to target another.
80
+
81
+ ## Step 0 — Discover the project & the PR (always first)
82
+
83
+ 1. **Project contract.** Per the agent guide's **Workflow conventions** +
84
+ **documentation map**, then read what THIS skill needs: the roadmap and the
85
+ project's verification gate (type-check / tests / build / CI). Do **not** load
86
+ full feature/fix templates — the SPEC below is the only planning artifact this
87
+ audit reads (AC 14).
88
+ 2. **The PR.** Identify it and read it in full (forge CLI per the project's
89
+ Workflow conventions — examples use `gh`):
90
+ ```sh
91
+ gh pr view <N> --json number,url,title,body,baseRefName,headRefName,headRefOid,isDraft,mergeable,mergeStateStatus,files,commits,statusCheckRollup,closingIssuesReferences
92
+ ```
93
+ If no PR number is given, resolve the current branch's PR
94
+ (`gh pr view --json ...`). If none exists yet, audit the branch vs. the default
95
+ base and say "no PR open yet" — the contract still applies.
96
+ 3. **The SPEC.** Locate the governing SPEC — `docs/features/<NN>-<slug>/` (feature)
97
+ or `docs/fix/<n>-<topic>/` (fix) — and its planning artifacts (`PLAN.md`,
98
+ `TASKS.md`, `progress.md`, `testing.md`, `known-issues.md`, `decisions.md`) when
99
+ present. The SPEC is the source of truth for what "done" means.
100
+
101
+ ## Step 1 — Consume the review receipt (always, before any gate)
102
+
103
+ The review evidence is the SHA-bound `REVIEW-PASS` receipt `review-change` posts
104
+ on the PR — **never** a re-review composed here. Fetch `headRefOid` and the PR's
105
+ comments together, then find the **newest** comment carrying the marker
106
+ `<!-- review-change:pass sha=<40-hex> contract=v1 -->`:
107
+
108
+ ```sh
109
+ gh pr view <N> --json headRefOid,comments
110
+ ```
111
+
112
+ - **current** — marker `sha` equals that snapshot's `headRefOid` (the current
113
+ head SHA). Acknowledge
114
+ its scope/axes, acceptance coverage, invariant result, and manual checks as the
115
+ review evidence, then evaluate the delivery gates below.
116
+ - **absent** — no matching marker on the PR → **BLOCKER**: no review evidence at
117
+ the head; route to `/review-change`.
118
+ - **stale** — a marker exists but its `sha` does not equal `headRefOid`. Any SHA
119
+ mismatch voids the receipt → **BLOCKER**: route to `/review-change` for a
120
+ re-review. Do not use a local `git diff` to override the PR-head comparison.
121
+
122
+ Never compose, reconstruct, or "spot-check" the review from the diff to clear a
123
+ missing/stale receipt — that is `review-change`'s turn, and re-litigating axes
124
+ here is exactly what the receipt gate removes (AC 13).
125
+
126
+
127
+ ## Progressive loading — mandatory audit route
128
+
129
+ The reference allowlist is exactly the six linked paths below. Never invent or
130
+ read another `references/` path. After discovery and the Step 1 receipt check,
131
+ every audit loads and applies exactly these five mandatory resources in order:
132
+
133
+ 1. [01 merge gates](references/01_MERGE_GATES.md) for delivery, CI, traceability,
134
+ review-receipt, and mergeability evidence.
135
+ 2. [02 closure and scope gates](references/02_CLOSURE_AND_SCOPE_GATES.md) for
136
+ capability closure and descope provenance.
137
+ 3. [03 audit process](references/03_AUDIT_PROCESS.md) to gather, decide, persist
138
+ blockers, and post the SHA-bound MERGE-READY comment.
139
+ 4. [04 verdict](references/04_VERDICT.md) before output, then
140
+ [05 routing and guardrails](references/05_ROUTING_AND_GUARDRAILS.md). These
141
+ mandatory resources own the `docs/workflow/REPOSITORY_STATE.md` evidence
142
+ rules and Architectural invariants gate.
143
+
144
+ Read [portability](references/PORTABILITY.md) only when the declared forge or
145
+ agent actually lacks a named primitive; otherwise skip it. The project artifact
146
+ `docs/workflow/REPOSITORY_STATE.md` is evidence, not a skill reference. All
147
+ resources are one hop from this file. Missing evidence or a missing required
148
+ resource is a blocker; never infer a pass.
149
+
150
+ ## Merge ownership
151
+
152
+ This skill **never merges**, including when project docs contain `merge: auto`,
153
+ the user previously approved a merge, or a tool retained an earlier permission.
154
+ Those signals cannot change this skill's read-first boundary.
155
+
156
+ The **sole automated merge authority** is the AUDIT stage of an actively invoked
157
+ `ship-roadmap --continue --fullauto` run. Its MERGE-READY comment is evidence,
158
+ not permission; the repository wrapper independently verifies that comment,
159
+ the forge's current head/default base, green checks, and the `merge: fullauto`
160
+ decision fetched at that head. The wrapper owns fresh sync checks, transient
161
+ state, merge execution, cleanup, and the automerge PR comment. A standalone/
162
+ manual call to this skill always hands the MERGE-READY URL to the human.
163
+
164
+
165
+ ## Portability
166
+
167
+ Translate forge commands, never the gate semantics. Use the explicit fallbacks
168
+ in [portability](references/PORTABILITY.md).
169
+
170
+ ## Relationship to other skills
171
+
172
+ ```
173
+ execute-phase (all phases done) ─▶ review-change (REVIEW-PASS receipt posted) ─▶ audit-pr ─▶ merge
174
+
175
+ blockers ─┬─ receipt absent/stale ──▶ /review-change ──────┘ (re-review, re-audit)
176
+ ├─ in-scope ──▶ execute-phase ────────┘ (fold, re-audit)
177
+ ├─ out-of-scope ──▶ plan-fix
178
+ └─ deferral ──▶ triage-issue
179
+ ```
180
+
181
+ - Consumes the `review-change` `REVIEW-PASS` receipt (its scope/axes, acceptance
182
+ coverage, invariant result, manual checks) plus the artifacts of `plan-feature` /
183
+ `plan-fix` / `execute-phase` (SPEC, phases, docs, `Closes #N`).
184
+ - `audit-docs` is the cross-document coherence check; `audit-pr` is per-PR merge
185
+ readiness; `product-audit` is the periodic, product-wide full sweep.
186
+
187
+ ## Done when
188
+
189
+ - The review receipt was consumed: a current marker was acknowledged, or a
190
+ missing/stale one became a blocker routed to `/review-change` (never re-reviewed
191
+ here).
192
+ - Every applicable gate has a pass / blocker / n-a verdict backed by cited evidence.
193
+ - A single top-line verdict (**MERGE-READY** or **BLOCKED** with ranked blockers) is
194
+ reported **with the PR's full URL in the header**, each blocker routed, with the
195
+ human's manual-verification list explicit.
196
+ - On MERGE-READY the merge owner is explicit: a standalone audit hands the URL
197
+ to the human; an active `ship-roadmap --fullauto` AUDIT stage receives the
198
+ SHA-bound verdict and owns every later merge check.
199
+ - The **closing `→ Next:` block is printed** (merge link → then the next unit via
200
+ `/plan-feature --next` or `/triage-issue`; BLOCKED → the routed fix, then re-audit).
201
+ - Nothing was edited, refactored, or merged.
@@ -0,0 +1,24 @@
1
+ ## Merge-readiness contract
2
+
3
+ Check each gate; cite evidence (file:line, criterion, check name, issue number).
4
+ A gate that can't be confirmed is a **blocker**, not a pass — never assume green.
5
+
6
+ | Gate | What it means | Blocker when |
7
+ |---|---|---|
8
+ | **Acceptance coverage** | The receipt's acceptance-coverage field accounts for every SPEC acceptance criterion (review-change verified the mapping). This gate confirms the receipt *names* the criteria — it never remaps diff hunks to criteria itself. | The receipt omits a criterion the SPEC lists, or its coverage field is absent/generic. |
9
+ | **All phases complete** | Feature: every phase in `PLAN.md`/`TASKS.md` is done and logged in `progress.md`. Fix: the SPEC is fully implemented. | Any unchecked task or unimplemented phase without an explicit, tracked deferral. |
10
+ | **Scope integrity (creep)** | The PR implements the SPEC and no more; out-of-scope work was split out. | Undocumented scope creep, or in-scope work missing. |
11
+ | **Docs updated** | Every "Affected docs" criterion is satisfied; per-phase docs (`progress`/`testing`/`known-issues`/`decisions`) reflect reality; the doc map still resolves. **Never merge with documentation still pending.** | A doc the map or SPEC requires is stale, missing, pending, or contradicts the code. |
12
+ | **Traceability** | `Closes #N` is in the PR body when the work is issue-born (from `plan-feature-from-issue` or `plan-fix`); the roadmap/fix-index entry matches, is **still present** (removed only *after* merge, never before), and carries the linked PR reference (`done · [#<pr>](<pr-url>)`). | Issue-born work without `Closes #N`; a roadmap/index entry out of sync; the entry dropped before merge; or a `done` row without its PR link. |
13
+ | **Verification gate / CI** | The project's gate passes — type-check, tests, build — and `statusCheckRollup` is green at the current head. | Any required check failing, pending, or absent where the project requires one. |
14
+ | **Mergeability** | Branch is off the default base, independently mergeable (no conflicts), not stacked on another PR, not draft. | Wrong base, conflicts, stacked dependency, or still draft. |
15
+ | **Review receipt** | A current `REVIEW-PASS` receipt is posted on the PR: the newest comment carrying `<!-- review-change:pass sha=<40-hex> contract=v1 -->` whose `sha` equals the PR's current head SHA. Its scope/axes, acceptance coverage, invariant result, and manual checks are the review evidence this audit consumes. | Receipt absent, or its marker `sha` predates the current head (any later commit voids it). The blocker routes to `/review-change`; never re-review the diff from here (AC 13). |
16
+ | **Closure integrity** | The governing **feature** SPEC's capability closure was taken and recorded — `design-feature` was actually run, not bypassed. Fix-governed PRs: `n/a` (no closure block by design). | A present `Capability closure` block has a blank row, or a resolved non-`n/a` row with no matching acceptance criterion. |
17
+ | **Scope integrity (descope)** | An issue born during this unit that maps to an unmet SPEC acceptance criterion or phase task has a matching, user-approved, dated `## Amendments` entry — descoped scope was recorded, not silently exported. Detection is two-path: a slug/issue-number text match, **or** an issue linked from an `## Amendments` row (`#89`) — either is sufficient to enumerate the issue, so a descoped issue with a generic title/body is not invisible to the gate. | An issue born since branch divergence that references this unit (by either detection path) maps to an unmet criterion/task with no matching `## Amendments` entry, or an `## Amendments` row that is undated, unapproved, or unlinked to an issue. |
18
+ | **Architectural invariants** | The **receipt** records the invariant result review-change took against the optional project invariant document; this gate confirms that result is explicit (`pass | blocker | n-a`) and does not reclassify it (AC 13). No document → `n/a: no project invariants declared`, not a blocker. | The receipt's invariant result is absent/ambiguous, or a recorded `blocker`/`violates`/`introduces`/`changes` lacks the cited decision the review surfaced. |
19
+
20
+ > The review evidence is the receipt, never a re-review: verify the newest
21
+ > `review-change:pass` marker's `sha` against the PR's head (Step 1). A current
22
+ > receipt passes this gate regardless of its axes' content — the audit consumes,
23
+ > it does not re-litigate. A missing or stale receipt is a blocker routed to
24
+ > `/review-change`.
@@ -0,0 +1,83 @@
1
+ ## Closure and scope gates
2
+
3
+ > **Closure integrity — fixed output.** Detection is purely mechanical: grep the
4
+ > governing SPEC for a `Capability closure` heading — match the heading text, not
5
+ > a fixed level (SPECs nest it as `### Capability closure` under `## Product half`;
6
+ > older ones use `## Capability closure`) — never dates, never versions, never
7
+ > judgment.
8
+ > - **Fix-governed PR** (`docs/fix/<n>-<topic>/SPEC.md`) → **n/a**, always. Fix
9
+ > SPECs carry no closure block by design; never emit a warning for one.
10
+ > - **Feature SPEC, block present** → evaluate the three boxes, each a blocker
11
+ > on failure:
12
+ > 1. the block exists in the SPEC (true whenever this path is reached)
13
+ > 2. zero blank rows — every entity/capability/role row is either filled
14
+ > (UI + API + test) or carries an explicit `n/a: <reason>`
15
+ > 3. every resolved non-`n/a` row maps to a listed acceptance criterion
16
+ > `n/a: <reason>` is a **fully valid, passing** row — the gate verifies the
17
+ > decision was *taken and recorded*, never that UI/API surface exists. Never
18
+ > push a blank row into inventing surface to pass this gate.
19
+ > - **Feature SPEC, block absent** → the SPEC predates or bypassed
20
+ > `design-feature`. Never a blocker — emit a dated **warning**, PR still
21
+ > merges:
22
+ > ```
23
+ > design-debt: closure absent, SPEC predates the rule (dated <YYYY-MM-DD>)
24
+ > ```
25
+ > This warning is itself the **retrofit trigger**: the next unit of work that
26
+ > touches this feature must fill the closure via `/design-feature <slug>`
27
+ > (upsert — fills only the missing rows, destroys nothing recorded) *before*
28
+ > that new work is planned. See `design-feature`'s upsert semantics for the
29
+ > other half of this contract.
30
+
31
+ > **`done` ≠ merge-ready.** A unit flips to `done` when its PR opens (built, not
32
+ > merged — merge state lives in the forge). So a `done` roadmap row is *not* evidence
33
+ > of merge-readiness: this gate still has to pass on its own. The two things this gate
34
+ > most often catches on a `done`-but-unmerged unit are **pending docs** and a
35
+ > **prematurely-removed issue/fix-index entry** — both are blockers.
36
+
37
+ > **Scope integrity (descope) — fixed output.** A cheap way to look finished is
38
+ > to quietly convert unfinished SPEC scope into a follow-up issue — the unit
39
+ > reads as done, the scope silently moved to the backlog. This gate catches it
40
+ > mechanically, keyed off the same `## Amendments` log `execute-phase`'s
41
+ > descope guard writes to (single source — see that skill's *Descope guard*
42
+ > section):
43
+ > 1. List issues **born since the branch diverged**
44
+ > (`git log <base>..HEAD --format=%ad --date=short | tail -1` for the
45
+ > earliest commit date, then `gh issue list --state all --search
46
+ > "created:>=<date>"`) that **reference this unit**, via **either** of two
47
+ > detection paths — a hit on either is sufficient, run both, never only the
48
+ > first:
49
+ > - **text match** — title/body mentions the feature/fix slug or issue
50
+ > number, or
51
+ > - **`## Amendments` link** (`#89`) — the issue is linked from a row in
52
+ > the governing SPEC's `## Amendments` section (the same log
53
+ > `execute-phase`'s descope guard writes to — single source, see that
54
+ > skill's *Descope guard*), **regardless of the issue's own title/body
55
+ > text**. This closes the coverage gap a generic-titled or slug-unaware
56
+ > descoped issue leaves in the text-match path alone: an issue linked
57
+ > from an amendment row is unambiguously about this unit no matter what
58
+ > it's titled.
59
+ > 2. For each such issue (from either path), run the per-issue checklist:
60
+ > - ✓ the SPEC criterion/task it touches is still **met in the PR** — pass,
61
+ > it's discovered work or already covered, or
62
+ > - ✓ a matching `## Amendments` entry exists in the governing SPEC
63
+ > (dated, **user-approved**, and **linked** to this issue's number) — pass,
64
+ > the descope was properly recorded
65
+ > - neither holds → **BLOCKER**.
66
+ > 3. Symmetrically, every `## Amendments` row in the governing SPEC must itself
67
+ > be dated, user-approved, and link a real, existing issue — an `## Amendments`
68
+ > row missing any of those is also a **BLOCKER** (a hollow amendment is the
69
+ > same failure as no amendment at all).
70
+ > - **Scope:** any SPEC-governed PR — **feature and fix** alike, both carry
71
+ > acceptance criteria a lazy run could export. No issues born during the unit,
72
+ > or none referencing it → the gate **passes** (nothing was exported).
73
+ > - This gate never re-litigates whether the *original* criterion was reasonable
74
+ > — only whether its descope, if any, was recorded and approved before the
75
+ > issue was filed.
76
+ > - **Backstop, not primary.** `execute-phase`'s creation-time descope guard
77
+ > (`skills/execute-phase/SKILL.md` *Descope guard*) is the **primary**
78
+ > control — it stops a descope from ever reaching an issue without an
79
+ > approved `## Amendments` entry first. This gate is the **backstop** that
80
+ > catches what the primary control missed (a descope-filed issue from a
81
+ > session that bypassed the guard, or a hand-filed issue). The `## Amendments`
82
+ > -link detection path (`#89`) widens this backstop's *coverage* only — it
83
+ > changes nothing about `execute-phase`'s own contract or precedence.
@@ -0,0 +1,69 @@
1
+ ## Process
2
+
3
+ 1. **Gather** — Step 0: project contract, PR, SPEC + artifacts, CI status.
4
+ 2. **Consume the review receipt** — Step 1: fetch the PR's `headRefOid` and
5
+ comments in one query (`gh pr view <N> --json headRefOid,comments`) and take
6
+ the **newest** marker
7
+ `<!-- review-change:pass sha=<40-hex> contract=v1 -->`. Its `sha` must equal
8
+ that query's `headRefOid` current head SHA. Any mismatch is stale; do not
9
+ use a local diff to preserve a receipt for a different PR head.
10
+ - **current** → acknowledge scope/axes, acceptance coverage, invariant result,
11
+ manual checks; continue to the gates.
12
+ - **absent / stale** → **BLOCKER** (no review evidence at the head), routed to
13
+ `/review-change`; never re-review from here.
14
+ 3. **Walk the contract** — evaluate every gate above against evidence. For each,
15
+ record pass / blocker / n-a with the specific artifact or check that proves it.
16
+ 4. **Confirm deferrals are real** — for anything postponed (an unchecked task, a
17
+ review finding, a known issue), verify a tracked issue + trigger exists. A
18
+ deferral with no destination is a blocker, not a pass.
19
+ 5. **Decide** — one verdict:
20
+ - **MERGE-READY** — every applicable gate passes (including a current receipt);
21
+ list the few things the human should still eyeball (the manual-verification
22
+ items the receipt surfaced).
23
+ - **BLOCKED** — one or more gates fail; output the ranked blocker list.
24
+ 6. **Persist blockers to the fold ledger (BLOCKED verdict only).** Every blocker
25
+ on a **BLOCKED** verdict is, by definition, fix-now — merge is gated on it.
26
+ Append each to the unit's fix-now fold ledger `review-findings.md` (same
27
+ location and fixed schema
28
+ `| id | file:line | axis | severity | class | route | folded |` as
29
+ `review-change`'s persist step) — the **same ledger**, not a separate one
30
+ (D4: the fold cycle consumes one list). **Merged unit → no write** — check
31
+ `gh pr view --json state`; `MERGED` skips the persist step entirely. For
32
+ each blocker: `file:line` = the cited evidence location (the gate name
33
+ when no single line applies); `axis` = the gate name (e.g. `Review
34
+ receipt`, `Docs`, `Traceability`); `severity` = `high` (a blocker gates
35
+ the merge by definition); `class` = `fix-now`; `route` = the routing this
36
+ skill's own Routing section assigns to that kind of blocker; `folded`
37
+ starts `no`.
38
+ Re-runs **dedupe by `file:line` + axis**, identical to `review-change`'s
39
+ rule — a blocker already on the ledger at that `file:line`+axis is not
40
+ re-appended; a genuinely new blocker gets the next `Fn` id.
41
+ 7. **Post the MERGE-READY comment on the PR (MERGE-READY only).** The verdict
42
+ must be visible on the PR itself — as a **comment**, never in a commit
43
+ message (a commit trailing "MERGE-READY" pollutes history and goes stale
44
+ the moment the branch moves). Write the body to a file (Markdown rule —
45
+ see Guardrails) and run
46
+ `gh pr comment <N> --body-file <path>` with exactly this body:
47
+
48
+ ```markdown
49
+ <!-- audit-pr:merge-ready sha=<head SHA> -->
50
+ ## ✅ audit-pr: MERGE-READY
51
+
52
+ - **Audited head:** `<head SHA>` · CI: <green|local-gate-green>
53
+ - **Review receipt:** `REVIEW-PASS` at `<head SHA>` (consumed, not re-reviewed)
54
+ - **Date:** <YYYY-MM-DD>
55
+ - **Before merge, a human should still verify:**
56
+ - <manual-verification item — or "nothing">
57
+
58
+ Any commit after `<head SHA>` voids this verdict — re-run `audit-pr`.
59
+ ```
60
+
61
+ **Idempotent:** first check the existing comments
62
+ (`gh pr view <N> --json comments`) for the `<!-- audit-pr:merge-ready -->`
63
+ marker — same SHA already commented → skip (say so); older SHA → post the
64
+ new comment (the newest marker wins). Never post a comment for a BLOCKED
65
+ verdict — blockers go in the chat report only, so the PR page never shows
66
+ a stale green flag.
67
+ 8. **Report** — the verdict block below, always headed by the PR's full URL.
68
+ In an active `ship-roadmap --fullauto` AUDIT stage, return the verdict to the
69
+ conductor; never run its merge wrapper from this skill.
@@ -0,0 +1,69 @@
1
+ ## Verdict format
2
+
3
+ ```
4
+ PR #<N> — <title>
5
+ URL: <full PR URL — always printed; the user works across several projects
6
+ and not every agent shows a CI monitor or PR list>
7
+ Base: <default> ← Head: <branch> @ <head SHA> CI: <green|failing|pending>
8
+
9
+ VERDICT: MERGE-READY | BLOCKED (<count> blockers)
10
+
11
+ Blockers (ranked):
12
+ 1. [<gate>] <what's wrong> — evidence: <file:line | check | criterion>
13
+ → fix: <smallest action to clear it> (<route>)
14
+ ...
15
+
16
+ Warnings (non-blocking — never change the verdict):
17
+ - design-debt: closure absent, SPEC predates the rule (dated <YYYY-MM-DD>)
18
+
19
+ Non-blocking nits:
20
+ - <minor item> — <pointer>
21
+
22
+ Before merge, a human should still verify:
23
+ - <manual-verification item from the review-change receipt>
24
+
25
+ → Next:
26
+ Print the ONE verdict bullet that matches, THEN — if a closure warning fired —
27
+ also print the closure bullet (a warning never blocks, so it co-occurs with a
28
+ MERGE-READY verdict; the two lines print together, never one instead of the other):
29
+ · MERGE-READY, standalone/manual audit → you merge: <full PR URL>, then
30
+ /plan-feature --next (the next roadmap unit) or pick an issue with /triage-issue
31
+ · MERGE-READY inside active ship-roadmap --fullauto → return this SHA-bound
32
+ verdict to the conductor; it runs the transient merge wrapper
33
+ · BLOCKED → clear the top blocker (routed above), then re-run /audit-pr
34
+ · Receipt absent/stale blocker → /review-change (re-review at the head), then
35
+ re-run /audit-pr — never re-review from this audit
36
+ · Closure warning (in addition to the verdict above) or a closure blocker →
37
+ /design-feature <slug> — fills the missing closure rows (upsert, destroys
38
+ nothing) before further work on this feature is planned; re-run /audit-pr after
39
+ · Scope-bleed blocker → record the missing `## Amendments` entry (user-approved,
40
+ dated, linking the issue) in the governing SPEC, or re-classify the issue as
41
+ genuinely discovered work via /triage-issue; re-run /audit-pr after
42
+ ```
43
+
44
+ If MERGE-READY, omit the blocker list and state it plainly: nothing blocks merge.
45
+ The `→ Next:` block is always printed — on MERGE-READY it repeats the **full PR
46
+ URL** (merge it yourself, or the merged link) and points the user at the next
47
+ concrete unit so a finished feature never dead-ends at the merge.
48
+
49
+ Example (generic — substitute your project's numbers and gates):
50
+
51
+ ```
52
+ PR #142 — Add CSV export to the reports view
53
+ Base: main ← Head: feat/14-csv-export CI: green
54
+
55
+ VERDICT: BLOCKED (2 blockers)
56
+
57
+ Blockers (ranked):
58
+ 1. [Tests] Export handler has no test — acceptance criterion "export
59
+ round-trips the rows" is unverified
60
+ → fix: add an integration test for the handler (fold into the current phase)
61
+ 2. [Traceability] PR body is missing `Closes #131` for issue-born work
62
+ → fix: add `Closes #131` to the PR body (execute-phase)
63
+
64
+ Non-blocking nits:
65
+ - Help text wording diverges from the other commands — docs/USAGE.md
66
+
67
+ Before merge, a human should still verify:
68
+ - The exported file opens cleanly in a spreadsheet app (visual)
69
+ ```