pi-gauntlet 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +300 -0
- package/LICENSE +24 -0
- package/README.md +278 -0
- package/agents/code-reviewer.md +48 -0
- package/agents/conformance-reviewer.md +139 -0
- package/agents/implementer.md +40 -0
- package/agents/spec-council-member.md +47 -0
- package/agents/spec-council-synthesizer.md +39 -0
- package/agents/spec-reviewer.md +47 -0
- package/agents/spec-summarizer.md +42 -0
- package/bin/install-agents.mjs +141 -0
- package/extensions/phase-tracker.ts +622 -0
- package/extensions/plan-tracker.ts +308 -0
- package/extensions/verify-before-ship.ts +132 -0
- package/package.json +43 -0
- package/skills/brainstorming/SKILL.md +290 -0
- package/skills/dispatching-parallel-agents/SKILL.md +192 -0
- package/skills/finishing-a-development-branch/SKILL.md +311 -0
- package/skills/receiving-code-review/SKILL.md +200 -0
- package/skills/requesting-code-review/SKILL.md +115 -0
- package/skills/requesting-code-review/code-reviewer.md +166 -0
- package/skills/roasting-the-spec/SKILL.md +139 -0
- package/skills/subagent-driven-development/SKILL.md +223 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +25 -0
- package/skills/subagent-driven-development/implementer-prompt.md +113 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +68 -0
- package/skills/systematic-debugging/SKILL.md +151 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/reference/rationalizations.md +61 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/test-driven-development/SKILL.md +230 -0
- package/skills/test-driven-development/reference/examples.md +99 -0
- package/skills/test-driven-development/reference/rationalizations.md +65 -0
- package/skills/test-driven-development/reference/when-stuck.md +31 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/using-git-worktrees/SKILL.md +193 -0
- package/skills/verification-before-completion/SKILL.md +169 -0
- package/skills/verification-before-completion/reference/conformance-check.md +220 -0
- package/skills/writing-plans/SKILL.md +244 -0
- package/skills/writing-skills/SKILL.md +429 -0
- package/skills/writing-skills/reference/anthropic-best-practices.md +1130 -0
- package/skills/writing-skills/reference/persuasion.md +187 -0
- package/skills/writing-skills/reference/testing-skills-with-subagents.md +384 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification-before-completion
|
|
3
|
+
description: Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **Related skills:** Follow up with `/skill:requesting-code-review` before merging. Done? `/skill:finishing-a-development-branch`.
|
|
7
|
+
|
|
8
|
+
# Verification Before Completion
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Claiming work is complete without verification is dishonesty, not efficiency.
|
|
13
|
+
|
|
14
|
+
**Core principle:** Evidence before claims, always.
|
|
15
|
+
|
|
16
|
+
**Violating the letter of this rule is violating the spirit of this rule.**
|
|
17
|
+
|
|
18
|
+
If a tool result contains a ⚠️ workflow warning, stop immediately and address it before continuing.
|
|
19
|
+
|
|
20
|
+
## Boundaries
|
|
21
|
+
- Run verification commands: yes
|
|
22
|
+
- Read code and output: yes
|
|
23
|
+
- Edit source code: no
|
|
24
|
+
|
|
25
|
+
## The Iron Law
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If you haven't run the verification command in this message, you cannot claim it passes.
|
|
32
|
+
|
|
33
|
+
## The Gate Function
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
BEFORE claiming any status or expressing satisfaction:
|
|
37
|
+
|
|
38
|
+
1. IDENTIFY: What command proves this claim?
|
|
39
|
+
2. RUN: Execute the FULL command (fresh, complete)
|
|
40
|
+
3. READ: Full output, check exit code, count failures
|
|
41
|
+
4. VERIFY: Does output confirm the claim?
|
|
42
|
+
- If NO: State actual status with evidence
|
|
43
|
+
- If YES: State claim WITH evidence
|
|
44
|
+
5. ONLY THEN: Make the claim
|
|
45
|
+
|
|
46
|
+
Skip any step = lying, not verifying
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Common Failures
|
|
50
|
+
|
|
51
|
+
| Claim | Requires | Not Sufficient |
|
|
52
|
+
|-------|----------|----------------|
|
|
53
|
+
| Tests pass | Test command output: 0 failures | Previous run, "should pass" |
|
|
54
|
+
| Linter clean | Linter output: 0 errors | Partial check, extrapolation |
|
|
55
|
+
| Build succeeds | Build command: exit 0 | Linter passing, logs look good |
|
|
56
|
+
| Bug fixed | Test original symptom: passes | Code changed, assumed fixed |
|
|
57
|
+
| Regression test works | Red-green cycle verified | Test passes once |
|
|
58
|
+
| Agent completed | VCS diff shows changes | Agent reports "success" |
|
|
59
|
+
| Requirements met | Line-by-line checklist | Tests passing |
|
|
60
|
+
| Intent delivered (loop closed) | Fresh reviewer audits code+doc vs origin spec + prompt (`reference/conformance-check.md`) | Plan-vs-code review, tests passing |
|
|
61
|
+
|
|
62
|
+
## Rationalization Prevention
|
|
63
|
+
|
|
64
|
+
| Excuse | Reality |
|
|
65
|
+
|--------|---------|
|
|
66
|
+
| "Should work now" | RUN the verification |
|
|
67
|
+
| "I'm confident" | Confidence ≠ evidence |
|
|
68
|
+
| "Just this once" | No exceptions |
|
|
69
|
+
| "Linter passed" | Linter ≠ compiler |
|
|
70
|
+
| "Agent said success" | Verify independently |
|
|
71
|
+
| "I'm tired" | Exhaustion ≠ excuse |
|
|
72
|
+
| "Partial check is enough" | Partial proves nothing |
|
|
73
|
+
| "Different words so rule doesn't apply" | Spirit over letter |
|
|
74
|
+
|
|
75
|
+
## Red Flags - STOP
|
|
76
|
+
|
|
77
|
+
- Using "should", "probably", "seems to"
|
|
78
|
+
- Expressing satisfaction before verification ("Great!", "Perfect!", "Done!", etc.)
|
|
79
|
+
- About to commit/push/PR without verification
|
|
80
|
+
- Trusting agent success reports without checking outputs
|
|
81
|
+
- Relying on partial verification
|
|
82
|
+
- Thinking "just this once"
|
|
83
|
+
- Tired and wanting work over
|
|
84
|
+
- **ANY wording implying success without fresh evidence**
|
|
85
|
+
|
|
86
|
+
## Key Patterns
|
|
87
|
+
|
|
88
|
+
The shape of an honest claim is `[Run command] [See: verbatim output] "claim"`. The verbatim output is the contract — paste it, don't summarize it from memory.
|
|
89
|
+
|
|
90
|
+
**Tests:**
|
|
91
|
+
```
|
|
92
|
+
✅ [Run test command] [See: 34/34 pass] "All tests pass"
|
|
93
|
+
❌ "Should pass now" / "Looks correct"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Regression tests (TDD Red-Green):**
|
|
97
|
+
```
|
|
98
|
+
✅ Write → Run (pass) → Revert fix → Run (MUST FAIL) → Restore → Run (pass)
|
|
99
|
+
❌ "I've written a regression test" (without proving red-green)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Build:**
|
|
103
|
+
```
|
|
104
|
+
✅ [Run build] [See: exit 0] "Build passes"
|
|
105
|
+
❌ "Linter passed" (linter ≠ build)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Requirements:**
|
|
109
|
+
```
|
|
110
|
+
✅ Re-read plan → Create checklist → Verify each → Report gaps or completion
|
|
111
|
+
❌ "Tests pass, phase complete"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Intent conformance (closing loop):**
|
|
115
|
+
```
|
|
116
|
+
✅ Dispatch fresh reviewer → audit code+doc vs ORIGIN (spec + prompt, not the plan) → reconcile drift → report gaps
|
|
117
|
+
❌ "Plan-vs-code review passed, so the intent is delivered"
|
|
118
|
+
```
|
|
119
|
+
Single-step plan-vs-code review inherits drift the plan introduced; this loop
|
|
120
|
+
confronts the outcome against the origin. Follow `reference/conformance-check.md`.
|
|
121
|
+
|
|
122
|
+
**Agent delegation:**
|
|
123
|
+
```
|
|
124
|
+
✅ Agent reports success → Check VCS diff → Verify changes → Report actual state
|
|
125
|
+
❌ Trust "agent says success"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Why This Matters
|
|
129
|
+
|
|
130
|
+
From recurring failure modes:
|
|
131
|
+
|
|
132
|
+
- Partner says "I don't believe you" — trust broken.
|
|
133
|
+
- Undefined functions shipped — would crash.
|
|
134
|
+
- Missing requirements shipped — incomplete features.
|
|
135
|
+
- Time wasted on false completion → redirect → rework.
|
|
136
|
+
- Violates: **Honesty is a core value. If you lie, you'll be replaced.**
|
|
137
|
+
|
|
138
|
+
## When To Apply
|
|
139
|
+
|
|
140
|
+
**ALWAYS before:**
|
|
141
|
+
- ANY variation of success/completion claims
|
|
142
|
+
- ANY expression of satisfaction
|
|
143
|
+
- ANY positive statement about work state
|
|
144
|
+
- Committing, PR creation, task completion
|
|
145
|
+
- Moving to next task
|
|
146
|
+
- Delegating to agents
|
|
147
|
+
|
|
148
|
+
**Rule applies to:**
|
|
149
|
+
- Exact phrases and paraphrases
|
|
150
|
+
- Implications of success
|
|
151
|
+
- ANY communication suggesting completion/correctness
|
|
152
|
+
|
|
153
|
+
## Enforcement
|
|
154
|
+
|
|
155
|
+
The `verify-before-ship` extension shipped by pi-gauntlet watches `git commit`, `git push`, and `gh pr create`. If you have not run a passing recognised verification command since your last source-file edit in this session, an advisory warning is injected into the tool result. The warning clears automatically after a fresh passing run.
|
|
156
|
+
|
|
157
|
+
Defaults recognise `make ci`, `make test`, `npm test`, `pnpm test`, `yarn test`, `pytest`, `rspec`, `cargo test`, `go test`. Projects can override (or narrow) the list via `settings.json#piGauntlet.verifyBeforeShip.testCommands`.
|
|
158
|
+
|
|
159
|
+
Before running the verification gate, call `phase_tracker({ action: "start", phase: "verify" })`.
|
|
160
|
+
|
|
161
|
+
When all verification passes, mark the verify phase complete:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
phase_tracker({ action: "complete", phase: "verify" })
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Project overrides
|
|
168
|
+
|
|
169
|
+
If `.pi/gauntlet-overrides.md` exists, read it. Any sections relevant to this skill — by name match, by topic (routing, verification, worktrees, etc.), or by workflow convention — override or extend the instructions above. Project-local `AGENTS.md` is already in context — check it for project-specific routing tables, service paths, and verification commands.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Deliverable Conformance Check
|
|
2
|
+
|
|
3
|
+
Tests passing proves the code runs. It does **not** prove the code does what was
|
|
4
|
+
asked. This check confronts deliverables (code **and** docs) against the
|
|
5
|
+
requirements.
|
|
6
|
+
|
|
7
|
+
## Why this is distinct from code review
|
|
8
|
+
|
|
9
|
+
Work flows `prompt/spec → plan → code/doc`. Each hop is lossy: the plan can
|
|
10
|
+
drop or reinterpret a requirement, and code can drift from the plan. Reviewing
|
|
11
|
+
**plan vs code** (what `/skill:requesting-code-review` does) is *single-step*
|
|
12
|
+
verification — it confirms the last hop, but inherits any drift the plan already
|
|
13
|
+
introduced.
|
|
14
|
+
|
|
15
|
+
This check is the **closing loop**: confront the final outcome (code + doc)
|
|
16
|
+
against the *origin* (spec + original prompt), skipping the plan. It catches
|
|
17
|
+
requirements lost anywhere in the chain, not just in the last step. Run it even
|
|
18
|
+
when plan-vs-code review passed clean — they measure different things against
|
|
19
|
+
different reference points.
|
|
20
|
+
|
|
21
|
+
## Dispatch a fresh reviewer (primary path)
|
|
22
|
+
|
|
23
|
+
The main session built the thing — it has confirmation bias. Delegate the check
|
|
24
|
+
to a fresh-context **`conformance-reviewer`** — a persona built for exactly this
|
|
25
|
+
gate: its priorities are requirement coverage and intent fidelity, not code
|
|
26
|
+
quality, and it emits a per-requirement coverage verdict rather than a bug list.
|
|
27
|
+
It reads the requirements vs the diff cold and cannot see session history, so
|
|
28
|
+
pass in:
|
|
29
|
+
|
|
30
|
+
- The **spec** (path).
|
|
31
|
+
- The **original prompt** (verbatim — it holds inline requirements + any ticket ref).
|
|
32
|
+
- The **diff** to audit (code + docs).
|
|
33
|
+
|
|
34
|
+
Dispatch it as its **own** call — do not fold the conformance check into the
|
|
35
|
+
whole-PR code-quality review. Fusing the two subordinates intent-coverage to a
|
|
36
|
+
code-quality system prompt and compresses the conformance result to an
|
|
37
|
+
afterthought. Code quality is one dispatch; conformance is another.
|
|
38
|
+
|
|
39
|
+
The persona ships model-free. Read the active preset's settings at
|
|
40
|
+
`$PI_CODING_AGENT_DIR/settings.json` for `piGauntlet.closureReview.model` and
|
|
41
|
+
inject it **call-site** on the dispatch (`model:` if set, else omit to inherit the
|
|
42
|
+
parent's model) — the same mechanism the spec-council chair uses. If the configured
|
|
43
|
+
model is unreachable, retry once with the inherited model. Point it at the strongest
|
|
44
|
+
reasoning model the preset can reach — this is the last correctness gate.
|
|
45
|
+
`thinking` stays frontmatter-pinned at `xhigh` and is not call-site overridable, so
|
|
46
|
+
the config supplies only `model`.
|
|
47
|
+
|
|
48
|
+
Self-checking in the main session is the fallback when delegation isn't possible.
|
|
49
|
+
|
|
50
|
+
## Source of truth (priority order)
|
|
51
|
+
|
|
52
|
+
| Order | Source | Why |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| 1 | The written spec (`doc/specs/…`) | Canonical. Brainstorm already fetched the ticket, reconciled its ACs, recorded deviations here. |
|
|
55
|
+
| 2 | Original prompt | Catches inline requirements never folded into the spec. |
|
|
56
|
+
| 3 | Re-fetch the ticket | **Fallback only**, when no spec exists. Skip when a spec exists — the live ticket may have drifted. |
|
|
57
|
+
|
|
58
|
+
Project's issue-tracker skill (for the fallback) is named in `.pi/gauntlet-overrides.md`.
|
|
59
|
+
|
|
60
|
+
## Drift = red flag
|
|
61
|
+
|
|
62
|
+
Spec vs prompt/ticket disagree → **STOP and reconcile**, do not absorb silently.
|
|
63
|
+
|
|
64
|
+
- Intentional, recorded deviation → spec wins (it was review-gated).
|
|
65
|
+
- Unrecorded divergence → spec silently dropped/altered a requirement = conformance
|
|
66
|
+
failure. Fix spec or code, re-verify. No completion claim over unreconciled drift.
|
|
67
|
+
|
|
68
|
+
## Coverage rule
|
|
69
|
+
|
|
70
|
+
Default: **1 requirement source = 1 spec = code covering every requirement.**
|
|
71
|
+
The requirement source is whatever sits at the top of the priority table — a
|
|
72
|
+
ticket if there is one, otherwise the spec + original prompt. No ticket is fine;
|
|
73
|
+
spec + prompt is a first-class source, not a degraded one. "Every requirement" =
|
|
74
|
+
explicit acceptance criteria / spec clauses **+** implicit notes (ticket body,
|
|
75
|
+
comments, or inline in the prompt). Source and solution must end in sync.
|
|
76
|
+
|
|
77
|
+
Multi-spec effort → allowed **only if the spec explicitly says** it covers a
|
|
78
|
+
defined subset and names the deferred requirements. Silent partial coverage = failure.
|
|
79
|
+
|
|
80
|
+
## When the check finds gaps
|
|
81
|
+
|
|
82
|
+
The reviewer **proposes, it does not dispose.** It emits structured gap blocks
|
|
83
|
+
(see `agents/conformance-reviewer.md`); the orchestrator (the main session running
|
|
84
|
+
the verify gate) drives disposition, fixes, and re-audit. The reviewer never edits,
|
|
85
|
+
dispatches, or re-audits itself.
|
|
86
|
+
|
|
87
|
+
### CONFORMS
|
|
88
|
+
|
|
89
|
+
Record the verdict in the completion summary's closure section and proceed.
|
|
90
|
+
|
|
91
|
+
### GAPS — disposition menu
|
|
92
|
+
|
|
93
|
+
Do **not** auto-proceed and do **not** auto-fix. Render the enumerated gap list —
|
|
94
|
+
each as `Gn [VERDICT] origin — remediation (recommended: fix|accept|rescope)` — then
|
|
95
|
+
a numbered prompt (a chat turn cannot express a bare keystroke):
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
[1] apply all recommended dispositions
|
|
99
|
+
[2] review per-gap (override fix/accept/rescope before applying)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`[1]` applies each gap's `recommended` disposition, **except** any gap whose
|
|
103
|
+
`recommended` is `accept` or `rescope`: list those and require an explicit confirming
|
|
104
|
+
reply before their spec edits land (accept/rescope rewrite the origin — never on the
|
|
105
|
+
unconfirmed fast path). `[2]` prompts a per-gap override, then applies.
|
|
106
|
+
|
|
107
|
+
Disposition semantics:
|
|
108
|
+
|
|
109
|
+
- `fix` — dispatch a remediation unit (below), then re-audit. For an `UNAUTHORIZED`
|
|
110
|
+
gap, "fix" = **remove** the unrequested code.
|
|
111
|
+
- `accept` — the **main session** (not a subagent) folds the deviation into the spec as
|
|
112
|
+
a dated decision (template below). For `UNAUTHORIZED`, accept = keep the behavior,
|
|
113
|
+
document it as intended.
|
|
114
|
+
- `rescope` — the main session records the requirement in the spec as an explicit
|
|
115
|
+
out-of-scope / deferred item, dated.
|
|
116
|
+
|
|
117
|
+
Dated-decision template (append to the spec's decisions/deviations section):
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
- YYYY-MM-DD accept|rescope Gn: <requirement/behavior> — <one-line rationale> (conformance gate)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Commit accept/rescope spec edits BEFORE any fix wave dispatches:** pi-cohort
|
|
124
|
+
rejects a dirty tree on a `worktree: true` dispatch, and the re-audit must read the
|
|
125
|
+
amended spec. If a round has only accept/rescope and no `fix`, the edits land, the
|
|
126
|
+
verdict is recorded, and no re-audit runs.
|
|
127
|
+
|
|
128
|
+
### Fix dispatch — reuse dispatching-parallel-agents mechanics
|
|
129
|
+
|
|
130
|
+
Fixes reuse the `dispatching-parallel-agents` fan-out primitive. Invoke **no**
|
|
131
|
+
`phase_tracker` / `plan_tracker` calls and do **not** enter `subagent-driven-development`
|
|
132
|
+
Parallel-Wave Mode (that mode opens with `phase_tracker({ phase: "implement" })`, which
|
|
133
|
+
errors while the verify phase is `in_progress`, and needs a plan the fix loop lacks).
|
|
134
|
+
|
|
135
|
+
**Precondition — worktree required.** Fix-via-dispatch needs a worktree HEAD to branch
|
|
136
|
+
from. On the ad-hoc `finishing-a-development-branch` paths that run in a normal repo
|
|
137
|
+
(`GIT_DIR == GIT_COMMON`) or detached HEAD, there is no such HEAD: the menu offers
|
|
138
|
+
`accept` / `rescope` and **manual fix-in-place** only; unresolved gaps route to escalation.
|
|
139
|
+
The loop below applies only when the gate already runs inside a worktree.
|
|
140
|
+
|
|
141
|
+
**Wave grouping** comes from the reviewer's `Parallel-safe:` line: `disjoint` gaps form
|
|
142
|
+
one parallel wave; any `conflicts` pair splits into separate serial waves. A pair conflicts
|
|
143
|
+
on **file OR runtime-resource** overlap - two gaps whose fixes touch disjoint files but whose
|
|
144
|
+
verification shares a `touched-resources` entry (DB/schema, port, fixture, external service,
|
|
145
|
+
shared temp path) are **not** parallel-safe and run in separate serial waves, identical to
|
|
146
|
+
planned-execution wave grouping. This is why the reviewer certifies both axes.
|
|
147
|
+
|
|
148
|
+
**Dispatch shape** (mirrors `dispatching-parallel-agents`):
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
subagent({
|
|
152
|
+
context: "fresh",
|
|
153
|
+
worktree: true,
|
|
154
|
+
cwd: "<abs worktree path, from git rev-parse --show-toplevel>",
|
|
155
|
+
tasks: [
|
|
156
|
+
{ agent: "implementer",
|
|
157
|
+
task: "Close conformance gap G1. Origin requirement: <origin>. What's missing: " +
|
|
158
|
+
"<remediation>. Satisfy the requirement; do not expand scope. " +
|
|
159
|
+
"Ownership boundary — modify only: <touched-files>." },
|
|
160
|
+
// one task per disjoint gap in this wave
|
|
161
|
+
],
|
|
162
|
+
})
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
- Unit = `implementer`, fresh context, `worktree: true`, `cwd` = the conformance
|
|
166
|
+
worktree. Pass `touched-files` as an explicit ownership boundary.
|
|
167
|
+
- **Integrate** serially via `git apply` back onto the worktree HEAD — the fix ships in
|
|
168
|
+
the same worktree and rides `finishing-a-development-branch`'s squash. No new merge machinery.
|
|
169
|
+
- **Failure handling is inherited verbatim** from `dispatching-parallel-agents`
|
|
170
|
+
"Review and Integrate": textual conflict → re-run one agent sequentially with the
|
|
171
|
+
other's integrated changes as context; semantic conflict (applies clean, suite fails)
|
|
172
|
+
→ re-run the offending task sequentially on integrated HEAD; a failed agent → integrate
|
|
173
|
+
the successes, then retry the failure with fresh context including the integrated changes.
|
|
174
|
+
A `BLOCKED` / `NEEDS_CONTEXT` return surfaces to the user.
|
|
175
|
+
- **`code-reviewer` over the integrated fix delta, once per round** (not per gap) — gap
|
|
176
|
+
fixes land after the branch's final code review, so review the round's cumulative diff.
|
|
177
|
+
- **`spec-reviewer` is excluded** — plan-vs-code is the wrong reference point; the re-audit
|
|
178
|
+
checks fixes against the origin.
|
|
179
|
+
- **Test gate** on the integrated tree after the round's waves apply, using the project's
|
|
180
|
+
canonical test command. A failure re-enters the failure-handling rules above.
|
|
181
|
+
|
|
182
|
+
One round = dispatch waves → serial integrate → `code-reviewer` on round delta → test
|
|
183
|
+
gate → re-audit.
|
|
184
|
+
|
|
185
|
+
### Delta re-audit + cap
|
|
186
|
+
|
|
187
|
+
Re-dispatch `conformance-reviewer` for a delta-scoped re-audit. Pass:
|
|
188
|
+
|
|
189
|
+
- the **full prior conformance report** — every row including DELIVERED rows and their
|
|
190
|
+
`evidence` `file:line` (needed for the regression guard), not just gap IDs;
|
|
191
|
+
- the **fix diff** for the round.
|
|
192
|
+
|
|
193
|
+
The reviewer (not the orchestrator) computes the regression intersection: it re-verifies
|
|
194
|
+
the gaps marked `fix` this round **plus** any previously-DELIVERED requirement whose
|
|
195
|
+
`evidence` file appears in the fix diff. It reuses `G1..Gn`, marking each `DELIVERED`,
|
|
196
|
+
still-open with its prior verdict, or introducing `Gn+1`.
|
|
197
|
+
|
|
198
|
+
- The re-audit dispatch carries the **same call-site `model:` injection** as the initial
|
|
199
|
+
audit (when `piGauntlet.closureReview.model` is set, the phase-tracker closure guard
|
|
200
|
+
requires every `conformance-reviewer` dispatch to specify `model:`).
|
|
201
|
+
- New or still-open gaps within the cap re-enter the menu above.
|
|
202
|
+
- **Cap: read `piGauntlet.closureReview.maxFixRounds`** (default `2`; missing/non-integer
|
|
203
|
+
→ `2`; `< 0` → `0`). `0` = audit-only: `GAPS` renders an accept/rescope-only menu and any
|
|
204
|
+
unresolved gap escalates instead of dispatching a fix.
|
|
205
|
+
- **On non-convergence** (cap reached with open gaps): **escalate to human** with the
|
|
206
|
+
per-gap round-by-round verdict trail. No silent re-loop, no auto-ship.
|
|
207
|
+
|
|
208
|
+
No completion claim stands over a gap that is neither fixed, accepted, nor rescoped.
|
|
209
|
+
"Surface, don't auto-fix": the orchestrator presents options, the user decides.
|
|
210
|
+
|
|
211
|
+
## Checklist
|
|
212
|
+
|
|
213
|
+
- [ ] Located canonical requirements (spec → prompt → ticket fallback)
|
|
214
|
+
- [ ] Enumerated every requirement: explicit ACs / spec clauses + implicit notes + inline prompt reqs
|
|
215
|
+
- [ ] Checked spec ↔ prompt/ticket drift; reconciled any divergence
|
|
216
|
+
- [ ] Each requirement mapped to where it's satisfied (code/doc) + evidence
|
|
217
|
+
- [ ] Multi-spec? Subset declared in spec; deferred ACs noted as out of scope
|
|
218
|
+
- [ ] Gaps reported, or all rows satisfied
|
|
219
|
+
|
|
220
|
+
Can't check all boxes (or unreconciled drift)? Not complete. Report the gap.
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-plans
|
|
3
|
+
description: Use when you have a spec or requirements for a multi-step task, before touching code
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **Related skills:** Reached via the auto-chain from `/skill:brainstorming` (not a direct human entry point). On completion this skill auto-invokes `/skill:subagent-driven-development`.
|
|
7
|
+
|
|
8
|
+
# Writing Plans
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Translate an approved spec into bite-sized, ordered, TDD-shaped tasks. Assume the engineer is skilled but has zero context for this codebase and limited taste — document file paths, exact commands, expected output, and test design.
|
|
13
|
+
|
|
14
|
+
DRY. YAGNI. TDD. Frequent commits.
|
|
15
|
+
|
|
16
|
+
**Announce at start:** "I'm using the writing-plans skill to create the implementation plan."
|
|
17
|
+
|
|
18
|
+
Before drafting the plan, call `phase_tracker({ action: "start", phase: "plan" })`.
|
|
19
|
+
|
|
20
|
+
**Input:** an approved spec in `<project>/doc/specs/<filename>.md` (produced by `/skill:brainstorming`).
|
|
21
|
+
|
|
22
|
+
**Save plans to:** the sibling `doc/plans/` directory next to the spec. The plan filename matches the spec filename exactly — same date, same Linear ID (if any), same topic slug, no `-design` suffix.
|
|
23
|
+
|
|
24
|
+
| Spec path | Plan path |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `doc/specs/2025-05-26-foo.md` | `doc/plans/2025-05-26-foo.md` |
|
|
27
|
+
| `doc/specs/2025-05-26-PROJ-1234-foo.md` | `doc/plans/2025-05-26-PROJ-1234-foo.md` |
|
|
28
|
+
| `<service>/doc/specs/<name>.md` | `<service>/doc/plans/<name>.md` |
|
|
29
|
+
|
|
30
|
+
If no spec exists, send the work back to `/skill:brainstorming`. Do not invent a plan without a spec.
|
|
31
|
+
|
|
32
|
+
## Boundaries
|
|
33
|
+
|
|
34
|
+
- Read code and docs: yes
|
|
35
|
+
- Write the plan to the sibling `doc/plans/` of the spec: yes
|
|
36
|
+
- Edit or create any other files: no
|
|
37
|
+
- Write implementation code: never inside this skill. After Self-Review + `phase_tracker` complete, auto-invoke `/skill:subagent-driven-development` to execute.
|
|
38
|
+
- Land the plan on `main`: no — the plan commit goes on the worktree branch (same branch as the spec)
|
|
39
|
+
|
|
40
|
+
## Scope Check
|
|
41
|
+
|
|
42
|
+
Before writing the plan, check the spec one more time for hidden subsystem boundaries:
|
|
43
|
+
|
|
44
|
+
- Does this touch 2+ independent services / contracts / schemas?
|
|
45
|
+
- Are there phases where intermediate state needs to be deployable?
|
|
46
|
+
|
|
47
|
+
If yes, decompose into separate plans and call it out:
|
|
48
|
+
|
|
49
|
+
> "The spec covers A and B. I'd split into two plans, executed in order. OK?"
|
|
50
|
+
|
|
51
|
+
A single plan should land in one PR worth of work. Multi-PR sequences get separate plans.
|
|
52
|
+
|
|
53
|
+
## File Structure
|
|
54
|
+
|
|
55
|
+
**Before drafting tasks, map the files.**
|
|
56
|
+
|
|
57
|
+
List the files this implementation will create, modify, or delete. Group by component. This forces the design decisions out of the task list and into a single review surface.
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
## Files
|
|
61
|
+
|
|
62
|
+
**Create:**
|
|
63
|
+
- `src/services/foo.py`
|
|
64
|
+
- `tests/services/test_foo.py`
|
|
65
|
+
|
|
66
|
+
**Modify:**
|
|
67
|
+
- `src/controllers/bar.rb` (add `create` action)
|
|
68
|
+
- `db/migrate/YYYYMMDDHHMMSS_add_baz.rb`
|
|
69
|
+
|
|
70
|
+
**Delete:**
|
|
71
|
+
- `src/services/legacy_foo.ts`
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
If you can't list the files, the spec isn't ready. Send it back to `/skill:brainstorming`.
|
|
75
|
+
|
|
76
|
+
## Wave Grouping
|
|
77
|
+
|
|
78
|
+
Group tasks into **waves** so the executor can parallelize independent work (see `subagent-driven-development` Parallel-Wave Mode). A wave is a maximal set of tasks that (a) have no ordering dependency on each other, (b) own **pairwise-disjoint files**, and (c) contend on **no shared mutable runtime resource** (same DB/schema, port, fixture file, external service, shared temp path).
|
|
79
|
+
|
|
80
|
+
- Tasks nest under `## Wave N — <label>` headers; `### Task N` headers sit inside a wave.
|
|
81
|
+
- A wave with one task is legal (runs sequentially). A pure dependency chain yields one task per wave — no parallelism, which is correct.
|
|
82
|
+
- Each wave after the first states its dependency on prior waves.
|
|
83
|
+
|
|
84
|
+
**File-ownership contract.** The per-task `**Files:**` block *is* the ownership declaration — no new syntax. Rule: **within a wave, the union of every task's declared paths must be pairwise disjoint.** Globs are allowed for `Modify` when exact paths are unknown, but must not overlap another same-wave task's paths. A task that must touch another's file belongs in a later wave.
|
|
85
|
+
|
|
86
|
+
**Runtime-resource disjointness.** File-disjoint is necessary but not sufficient: two tasks with disjoint files that both mutate the same DB, bind the same port, or share a fixture are **not** parallel-safe and must land in different waves. The executor auto-selects parallel for *every* multi-task wave, so this grouping is the sole parallel-safety guarantee — there is no selection-time judgment downstream. No new mandatory per-task syntax; when a shared runtime resource is the reason two file-disjoint tasks sit in different waves, record it in an inline note on the later wave.
|
|
87
|
+
|
|
88
|
+
```markdown
|
|
89
|
+
## Wave 1 — Foundations
|
|
90
|
+
|
|
91
|
+
Parallel-safe: Tasks 1–3 own disjoint files (see each task's Files block).
|
|
92
|
+
|
|
93
|
+
### Task 1: ...
|
|
94
|
+
### Task 2: ...
|
|
95
|
+
### Task 3: ...
|
|
96
|
+
|
|
97
|
+
## Wave 2 — Wire-up
|
|
98
|
+
|
|
99
|
+
Depends on Wave 1: Task 4 consumes the API introduced by Task 1.
|
|
100
|
+
|
|
101
|
+
### Task 4: ...
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Bite-Sized Task Granularity
|
|
105
|
+
|
|
106
|
+
Each step is **one action, 2-5 minutes**:
|
|
107
|
+
|
|
108
|
+
- "Write the failing test" — step
|
|
109
|
+
- "Run it, confirm it fails" — step
|
|
110
|
+
- "Implement minimal code to pass" — step
|
|
111
|
+
- "Run tests, confirm green" — step
|
|
112
|
+
- "Commit" — step
|
|
113
|
+
|
|
114
|
+
## Plan Document Header
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
# [Feature Name] Implementation Plan
|
|
118
|
+
|
|
119
|
+
> **REQUIRED SUB-SKILL:** Use the subagent-driven-development skill to implement this plan task-by-task.
|
|
120
|
+
|
|
121
|
+
**Goal:** [one sentence]
|
|
122
|
+
|
|
123
|
+
**Architecture:** [2-3 sentences]
|
|
124
|
+
|
|
125
|
+
**Tech Stack:** [key tech/libraries]
|
|
126
|
+
|
|
127
|
+
**Spec:** `<project>/doc/specs/<same-filename-as-this-plan>.md`
|
|
128
|
+
|
|
129
|
+
**Linear:** `E-XXXX` (omit if no ticket)
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Task Structure
|
|
135
|
+
|
|
136
|
+
Each task uses `- [ ]` checkbox steps so execution tools (and humans) can track progress.
|
|
137
|
+
|
|
138
|
+
```markdown
|
|
139
|
+
### Task N: [Component Name]
|
|
140
|
+
|
|
141
|
+
**TDD scenario:** [New feature — full TDD cycle | Modifying tested code — run existing tests first | Trivial change — use judgment]
|
|
142
|
+
|
|
143
|
+
**Files:**
|
|
144
|
+
- Create: `exact/path/to/file.py`
|
|
145
|
+
- Modify: `exact/path/to/existing.py:123-145`
|
|
146
|
+
- Test: `tests/exact/path/to/test.py`
|
|
147
|
+
|
|
148
|
+
- [ ] **Step 1: Write the failing test**
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
def test_specific_behavior():
|
|
152
|
+
result = function(input)
|
|
153
|
+
assert result == expected
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
- [ ] **Step 2: Run test, confirm failure**
|
|
157
|
+
|
|
158
|
+
Run: `uv run pytest tests/path/test.py::test_name -v`
|
|
159
|
+
Expected: FAIL with "function not defined"
|
|
160
|
+
|
|
161
|
+
- [ ] **Step 3: Write minimal implementation**
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
def function(input):
|
|
165
|
+
return expected
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
- [ ] **Step 4: Run test, confirm pass**
|
|
169
|
+
|
|
170
|
+
Run: `uv run pytest tests/path/test.py::test_name -v`
|
|
171
|
+
Expected: PASS
|
|
172
|
+
|
|
173
|
+
- [ ] **Step 5: Commit**
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
git add tests/path/test.py src/path/file.py
|
|
177
|
+
git commit -m "<imperative subject> (ref E-XXXX)"
|
|
178
|
+
```
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## No Placeholders
|
|
182
|
+
|
|
183
|
+
Every plan failure mode:
|
|
184
|
+
|
|
185
|
+
- ❌ `# TODO: add validation` — implementer can't infer "validation" of what, against what schema, with what error message.
|
|
186
|
+
- ❌ `# Implement the rest of the function` — incomplete code is invalid code.
|
|
187
|
+
- ❌ "Add tests for edge cases" — name the edge cases.
|
|
188
|
+
- ❌ "Wire it up to the existing system" — give file paths and call sites.
|
|
189
|
+
- ❌ "Similar to Task N" — repeat the code. Implementers (and subagents with fresh context) may read tasks out of order; pointing at a sibling task is not a substitute for showing the code.
|
|
190
|
+
- ❌ References to types, functions, methods, or fields not defined in any task in this plan. If it shows up in Task 5, it must be introduced by Task 1–4 or already exist in the codebase (with a file:line citation).
|
|
191
|
+
- ❌ `[fill in]`, `<example>`, `xxx` markers anywhere in the doc.
|
|
192
|
+
- ❌ "Probably also need to update the docs" — either yes (which doc) or no.
|
|
193
|
+
|
|
194
|
+
If a decision is genuinely open, put it in an explicit **Open Questions** section at the top and resolve before execution starts.
|
|
195
|
+
|
|
196
|
+
## Self-Review (Before Handoff)
|
|
197
|
+
|
|
198
|
+
After drafting the plan and before announcing it complete, run three checks yourself. This is a checklist you run yourself — not a subagent dispatch.
|
|
199
|
+
|
|
200
|
+
- **Spec coverage.** Cross-reference the spec's components/decisions/constraints against the plan. Does every spec section map to one or more tasks? If a spec decision has no implementation task, the plan is missing work or the spec was overspecified.
|
|
201
|
+
- **Placeholder scan.** Grep the doc for `TODO`, `TBD`, `xxx`, `[fill in]`, `<example>`, `etc.`, "probably", "something like". Resolve or convert each into an explicit Open Question.
|
|
202
|
+
- **Type / API consistency.** Function signatures and field names that appear in multiple tasks must match exactly. The plan is its own contract — internal contradictions surface as bugs during execution.
|
|
203
|
+
- **Wave disjointness.** For every multi-task wave, confirm the tasks' `Files:` sets are pairwise disjoint **and** that no two tasks contend on a shared mutable runtime resource (DB/schema, port, fixture, external service, shared temp path). Either kind of overlap = mis-grouped wave; split or re-order before handoff.
|
|
204
|
+
|
|
205
|
+
Fix what this review finds before handoff.
|
|
206
|
+
|
|
207
|
+
## Remember
|
|
208
|
+
|
|
209
|
+
- Exact file paths always
|
|
210
|
+
- Complete code in plan (not "add validation")
|
|
211
|
+
- Exact commands with expected output
|
|
212
|
+
- Reference relevant skills
|
|
213
|
+
- DRY, YAGNI, TDD, frequent commits
|
|
214
|
+
- Group dependency-free, file-disjoint tasks into the same wave; order waves so each wave's dependencies are satisfied by earlier waves
|
|
215
|
+
- If the plan exceeds ~8 tasks, split into phases with checkpoints
|
|
216
|
+
|
|
217
|
+
## Execution Handoff
|
|
218
|
+
|
|
219
|
+
After saving the plan, mark the planning phase complete:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
phase_tracker({ action: "complete", phase: "plan" })
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Then auto-select the execution mode and proceed — no pause, no picker. The mode is a pure function of the plan's wave structure:
|
|
226
|
+
|
|
227
|
+
- **If any wave contains ≥2 tasks → Parallel-Wave Mode.** The strengthened Wave Grouping contract (files + runtime-resource disjoint) guarantees every multi-task wave is parallel-safe.
|
|
228
|
+
- **Otherwise (pure dependency chain, one task per wave) → Sequential Mode.**
|
|
229
|
+
|
|
230
|
+
Announce the selected mode in one line (transparency), then auto-invoke `/skill:subagent-driven-development` in this session. Do not wait for confirmation — the spec gate already happened, and the plan is a mechanical derivative. The only pauses from here are in-flight STOPs (`BLOCKED` / `NEEDS_CONTEXT`) and the end gate, both owned by the executor.
|
|
231
|
+
|
|
232
|
+
## Red Flags — STOP
|
|
233
|
+
|
|
234
|
+
- Plan contains TODO / TBD / placeholder text
|
|
235
|
+
- File structure section absent
|
|
236
|
+
- Task step is "5+ minutes of work" (split it)
|
|
237
|
+
- Step lists don't use `- [ ]` checkboxes
|
|
238
|
+
- Two tasks reference the same function with different signatures
|
|
239
|
+
- Self-review skipped
|
|
240
|
+
- About to start executing the plan yourself
|
|
241
|
+
|
|
242
|
+
## Project overrides
|
|
243
|
+
|
|
244
|
+
If `.pi/gauntlet-overrides.md` exists, read it. Any sections relevant to this skill — by name match, by topic (routing, verification, worktrees, etc.), or by workflow convention — override or extend the instructions above. Project-local `AGENTS.md` is already in context — check it for project-specific routing tables, service paths, and verification commands.
|