@seanyao/roll 3.620.1 → 3.624.1
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 +46 -0
- package/dist/roll.mjs +4563 -3369
- package/package.json +1 -1
- package/lib/__pycache__/changelog_audit.cpython-314.pyc +0 -0
- package/lib/__pycache__/github_sync.cpython-314.pyc +0 -0
- package/lib/__pycache__/loop-fmt.cpython-314.pyc +0 -0
- package/lib/__pycache__/loop_result_eval.cpython-314.pyc +0 -0
- package/lib/__pycache__/loop_unstick.cpython-314.pyc +0 -0
- package/lib/__pycache__/model_prices.cpython-314.pyc +0 -0
- package/lib/__pycache__/prices_fetcher.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll-home.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll-loop-status.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll_git.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll_render.cpython-314.pyc +0 -0
- package/lib/__pycache__/slides-render.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/__init__.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/gemini.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/kimi.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/openai.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/pi.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/pi_emit.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/qwen.cpython-314.pyc +0 -0
- package/skills/README.md +0 -64
- package/skills/docs/skill-authoring.md +0 -74
- package/skills/reports/skill-audit-summary.md +0 -53
- package/skills/roll-.changelog/SKILL.md +0 -47
- package/skills/roll-.changelog/references/full-contract.md +0 -462
- package/skills/roll-.clarify/SKILL.md +0 -64
- package/skills/roll-.dream/SKILL.md +0 -47
- package/skills/roll-.dream/references/full-contract.md +0 -365
- package/skills/roll-.echo/SKILL.md +0 -118
- package/skills/roll-.qa/SKILL.md +0 -47
- package/skills/roll-.qa/references/full-contract.md +0 -256
- package/skills/roll-.review/SKILL.md +0 -148
- package/skills/roll-build/SKILL.md +0 -49
- package/skills/roll-build/references/full-contract.md +0 -968
- package/skills/roll-debug/SKILL.md +0 -48
- package/skills/roll-debug/assets/injectable-bb.js +0 -263
- package/skills/roll-debug/references/full-contract.md +0 -607
- package/skills/roll-design/SKILL.md +0 -52
- package/skills/roll-design/references/engineering-checklist.md +0 -298
- package/skills/roll-design/references/full-contract.md +0 -940
- package/skills/roll-doc-audit/SKILL.md +0 -51
- package/skills/roll-doc-audit/references/full-contract.md +0 -796
- package/skills/roll-doctor/SKILL.md +0 -211
- package/skills/roll-fix/SKILL.md +0 -49
- package/skills/roll-fix/references/full-contract.md +0 -672
- package/skills/roll-idea/SKILL.md +0 -62
- package/skills/roll-loop/SKILL.md +0 -50
- package/skills/roll-loop/references/full-contract.md +0 -534
- package/skills/roll-notes/SKILL.md +0 -107
- package/skills/roll-onboard/SKILL.md +0 -238
- package/skills/roll-peer/SKILL.md +0 -47
- package/skills/roll-peer/references/full-contract.md +0 -323
- package/skills/roll-propose/SKILL.md +0 -155
- package/skills/roll-review-pr/SKILL.md +0 -62
- package/skills/roll-spar/SKILL.md +0 -47
- package/skills/roll-spar/references/full-contract.md +0 -288
- package/skills/route-cases/skills.json +0 -216
- package/skills/scripts/audit-skills.mjs +0 -272
- package/skills/scripts/test-audit-skills.mjs +0 -39
- package/skills/tests/fixtures/skill-audit/block-skill/SKILL.md +0 -12
- package/skills/tests/fixtures/skill-audit/minimal-skill/SKILL.md +0 -8
- package/skills/tests/fixtures/skill-audit/quoted-skill/SKILL.md +0 -10
- package/skills/tests/fixtures/skill-audit/route-cases.json +0 -21
- package/skills/tests/fixtures/skill-audit/spoke-skill/SKILL.md +0 -12
- package/skills/tests/fixtures/skill-audit/spoke-skill/references/runbook.md +0 -3
|
@@ -1,968 +0,0 @@
|
|
|
1
|
-
# Full Contract Reference
|
|
2
|
-
|
|
3
|
-
This file preserves the detailed contract extracted from SKILL.md. Read it when the hub points here for exact workflow steps, templates, rubrics, or recovery branches.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Roll Build (Universal Delivery)
|
|
8
|
-
|
|
9
|
-
> Follows the Architecture Constraints, Development Discipline, and Engineering Common Sense defined in the project AGENTS.md.
|
|
10
|
-
|
|
11
|
-
One entry point. Any input. Full delivery.
|
|
12
|
-
|
|
13
|
-
## Trigger
|
|
14
|
-
|
|
15
|
-
**Input detection:**
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
Input received
|
|
19
|
-
├── matches "US-[A-Z]+-[0-9]+" → Story mode: read BACKLOG → TCR workflow
|
|
20
|
-
├── matches "FIX-[A-Z]+-[0-9]+" → redirect to $roll-fix
|
|
21
|
-
├── matches "IDEA-[0-9]+" → redirect to $roll-idea (lookup and expand)
|
|
22
|
-
└── anything else → Fly mode: clarify → design → execute
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
**Story mode** — use when:
|
|
26
|
-
- The user provides a `US-XXX` identifier
|
|
27
|
-
- An existing backlog Story needs to be executed
|
|
28
|
-
|
|
29
|
-
**Fly mode** — use when:
|
|
30
|
-
- The user has a vague one-sentence request
|
|
31
|
-
- No `US-XXX` exists yet; planning and execution are both needed
|
|
32
|
-
- No input at all — ask the user what they want to build
|
|
33
|
-
|
|
34
|
-
**Redirect to `$roll-fix`** when:
|
|
35
|
-
- Input matches `FIX-XXX` or `BUG-XXX` pattern
|
|
36
|
-
|
|
37
|
-
Do not use for:
|
|
38
|
-
- Pure analysis or research with no code changes (use `$roll-design`)
|
|
39
|
-
- Single-line hotfix with no planning needed (use `$roll-fix`)
|
|
40
|
-
|
|
41
|
-
## Core Philosophy
|
|
42
|
-
|
|
43
|
-
1. **Clarity over assumptions** — When scope is unclear, clarify first
|
|
44
|
-
2. **Just enough planning** — Plan to the level the uncertainty demands
|
|
45
|
-
3. **TCR rhythm** — Test-first, micro-steps, auto-commit on green, auto-revert on red
|
|
46
|
-
4. **Push to GitHub** — Complete implementation, commit, and push; code is on remote
|
|
47
|
-
5. **Stay reversible** — Every micro-step leaves the repo in a clean, green state
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Mode A: Story Mode (US-XXX input)
|
|
52
|
-
|
|
53
|
-
Activate when input is a `US-[A-Z]+-[0-9]+` identifier.
|
|
54
|
-
|
|
55
|
-
### Step A1: Pre-flight self-check (US-AGENT-007)
|
|
56
|
-
|
|
57
|
-
Before reading the Story in depth or splitting actions, **read the Agent profile** from the story's feature md and decide whether this cycle can realistically deliver it. The check is mechanical and turns on a single axis — the story's `est_min` estimate (US-AGENT-022 retired the old three-dimension type/est/risk routing; there is no per-agent capacity range, risk zone, or history threshold anymore):
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
inputs:
|
|
61
|
-
story.est_min (from **Agent profile:** block, US-AGENT-001)
|
|
62
|
-
story.chain_depth (0 unless already a downgrade product)
|
|
63
|
-
|
|
64
|
-
complexity tier (lib/loop_pick_agent.py, single source of truth):
|
|
65
|
-
est_min <= 8 → easy
|
|
66
|
-
8 < est_min <= 20 → default
|
|
67
|
-
est_min > 20 → hard
|
|
68
|
-
missing / illegal → default
|
|
69
|
-
|
|
70
|
-
verdict:
|
|
71
|
-
too_big when:
|
|
72
|
-
story.est_min is large enough that even the `hard` tier won't fit one
|
|
73
|
-
cycle — i.e. the work plainly composes too many files / behaviours to
|
|
74
|
-
land green in a single cycle — AND story.chain_depth == 0
|
|
75
|
-
(still have downgrade budget; don't burn a cycle on a guaranteed miss).
|
|
76
|
-
ok otherwise
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Output the verdict as the first line of the cycle response:
|
|
80
|
-
|
|
81
|
-
```yaml
|
|
82
|
-
verdict: ok # or: too_big
|
|
83
|
-
reason: <one short line — which condition triggered, with numbers>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
When `verdict: ok` → continue to Step A2 normally.
|
|
87
|
-
When `verdict: too_big` → **self-downgrade** rather than burn the cycle on a guaranteed miss:
|
|
88
|
-
|
|
89
|
-
1. Invoke `roll-design` to re-split the story into ≥2 smaller sub-stories. Each
|
|
90
|
-
sub-story inherits the parent's ORIGINAL inbound dependencies — **never** the
|
|
91
|
-
parent itself (depending on the about-to-be-parked parent would deadlock the
|
|
92
|
-
child forever).
|
|
93
|
-
2. Hand the split to the loop with the v3 command:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
roll loop self-downgrade <story-id> "<one-line reason>" <subA,subB,...>
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
It parks the parent at 🚫 Hold (a grouping row the picker skips), appends the
|
|
100
|
-
sub-stories as 📋 Todo rows (correct `depends-on`, `chain_depth = parent + 1`,
|
|
101
|
-
never pointing at the parent), closes any open PR for the parent and deletes
|
|
102
|
-
its branch (invariant I3), and records a `story:split` event for reconciliation.
|
|
103
|
-
3. Exit cleanly — **no TCR commits this cycle**. The next loop cycle picks up the
|
|
104
|
-
first sub-story (smaller, should pass pre-flight).
|
|
105
|
-
|
|
106
|
-
The command enforces the **chain-depth cap** (US-AGENT-009): a story whose chain
|
|
107
|
-
has already auto-split twice (`chain_depth ≥ 2`), or one that yields fewer than 2
|
|
108
|
-
sub-stories (irreducible), is **not** split again — `roll loop self-downgrade`
|
|
109
|
-
parks the parent at 🚫 Hold and raises an ALERT for human triage (a `story:split`
|
|
110
|
-
with `capped: true`) instead of recursing. Pass the sub-ids you have (or none);
|
|
111
|
-
the command decides. The cap exists purely to stop infinite split chains.
|
|
112
|
-
|
|
113
|
-
> Pre-flight is honest, not paranoid: a small story (est_min ≤ 8 — the `easy` tier — with chain_depth=0) should almost always go `ok`. The check pays off on the long tail — stories with a large `est_min` that, on inspection, plainly compose far more files and behaviours than one cycle can land green.
|
|
114
|
-
|
|
115
|
-
### Step A2: Read the Story
|
|
116
|
-
|
|
117
|
-
1. Open `.roll/backlog.md`, find the US row, follow the link to `.roll/features/<epic>/<story>/spec.md`
|
|
118
|
-
2. Read the full AC / Files / Dependencies section
|
|
119
|
-
3. If a plan doc (`<feature>-plan.md`) exists, read it for context
|
|
120
|
-
|
|
121
|
-
### Step A3: Split into Actions
|
|
122
|
-
|
|
123
|
-
- Write 2–6 candidate Actions
|
|
124
|
-
- Pick the smallest shippable Action first
|
|
125
|
-
- **Granularity constraint**: Each Action completable in 2–5 minutes; split if larger
|
|
126
|
-
- **No placeholders**: Action descriptions must be specific and directly executable
|
|
127
|
-
- **Test-quality self-check (US-QA-011)** — for every Action that adds tests:
|
|
128
|
-
1. Tests call project functions / public command entry points; do NOT inline
|
|
129
|
-
external-tool behaviour (`sed`/`awk`/`grep`/`find`/`cut` pipelines that
|
|
130
|
-
duplicate logic already in `lib/` or `bin/`) — rubric ❼.
|
|
131
|
-
2. Tests sandbox filesystem state via `BATS_TMPDIR` (or equivalent); do NOT
|
|
132
|
-
touch or assert on paths outside this repo (`~/.codex`, `~/.kimi`,
|
|
133
|
-
`~/.roll/`, `/etc/...`) — rubric ❽.
|
|
134
|
-
3. If you can't satisfy (1) or (2), reshape the Action: extract a project
|
|
135
|
-
helper, redirect the env var to a tmp dir, or move the test to an
|
|
136
|
-
integration tier where the boundary is intentional and documented.
|
|
137
|
-
|
|
138
|
-
#### A3.1 Parallel Dispatch (auto-determined)
|
|
139
|
-
|
|
140
|
-
After splitting Actions, check if they can run in parallel:
|
|
141
|
-
|
|
142
|
-
```
|
|
143
|
-
Conflict detection:
|
|
144
|
-
├── List files involved in each Action
|
|
145
|
-
├── Same file → cannot parallelize, must run sequentially
|
|
146
|
-
├── Same directory, different files → can parallelize
|
|
147
|
-
└── Different directories → safe to parallelize
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
**If 2+ Actions can run in parallel, automatically enable Worktree isolation:**
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
git worktree add .worktrees/{action-id} -b dispatch/{action-id}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
- Each sub-agent executes TCR in its own worktree
|
|
157
|
-
- Sub-agent briefs must be **self-contained** (include: what to do, where, how to verify, what not to do)
|
|
158
|
-
- After all complete: review each → merge to main → run integration tests → clean up worktrees
|
|
159
|
-
|
|
160
|
-
**Status notifications (required):**
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
🔀 $(msg build.parallel_dispatch N)
|
|
164
|
-
|
|
165
|
-
$(msg build.agent_running 1 "...")
|
|
166
|
-
$(msg build.agent_running 2 "...")
|
|
167
|
-
|
|
168
|
-
$(msg build.agent_done 1 "..." N)
|
|
169
|
-
$(msg build.agent_done 2 "..." N)
|
|
170
|
-
|
|
171
|
-
🔀 $(msg build.merge_summary N N)
|
|
172
|
-
🧪 $(msg build.integration_tests)
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
When parallel conditions are not met, execute Actions sequentially.
|
|
176
|
-
|
|
177
|
-
### Step A4: Define Verification
|
|
178
|
-
|
|
179
|
-
- Test matrix: happy path + edge/failure/regression cases
|
|
180
|
-
- What "online verification" means for this repo (URL, endpoint, UI flow, log signal)
|
|
181
|
-
- Reference `$roll-.qa` for test pyramid (unit → E2E → visual → smoke)
|
|
182
|
-
|
|
183
|
-
Proceed to the **Shared TCR Workflow** (Phase 1 onward).
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
## Mode B: Fly Mode (free-text or no-input)
|
|
188
|
-
|
|
189
|
-
Activate when input does not match any `US-XXX` / `FIX-XXX` pattern, or when no input is given.
|
|
190
|
-
|
|
191
|
-
### Step B1: Clarify & Assess
|
|
192
|
-
|
|
193
|
-
Before any code, assess clarity:
|
|
194
|
-
|
|
195
|
-
```
|
|
196
|
-
🎯 $(msg build.clarified_goal): {1-2 sentences capturing user intent}
|
|
197
|
-
📏 $(msg build.complexity_assessment): {small|medium|large}
|
|
198
|
-
🔍 $(msg build.uncertainty_areas): {list what needs investigation/decision}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
**If uncertainty areas are non-empty or the request is vague, auto-trigger `$roll-.clarify`:**
|
|
202
|
-
- Output the clarification block above
|
|
203
|
-
- Follow with 3–5 targeted questions
|
|
204
|
-
- Stop and wait for user answers before proceeding
|
|
205
|
-
|
|
206
|
-
**Approach Confirmation (required for UX / format / automation decisions):**
|
|
207
|
-
|
|
208
|
-
If the request involves any of: output format, layout, automation level (manual vs automatic), or architecture structure — output a confirmation block **before writing any code**:
|
|
209
|
-
|
|
210
|
-
```
|
|
211
|
-
📐 $(msg build.approach_confirmation)
|
|
212
|
-
|
|
213
|
-
1. $(msg build.what_changes): {what will be built or modified}
|
|
214
|
-
2. $(msg build.the_approach): {specific format / automation level / structure chosen}
|
|
215
|
-
3. $(msg build.files_touched): {list of files}
|
|
216
|
-
|
|
217
|
-
Proceeding unless you say otherwise.
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
Wait for the user's response before editing files. If the user does not object within one exchange, proceed.
|
|
221
|
-
|
|
222
|
-
**Complexity Rules (AI coding time):**
|
|
223
|
-
|
|
224
|
-
| Level | Scope | Action |
|
|
225
|
-
|-------|-------|--------|
|
|
226
|
-
| Small | ≤3 files, 5–15 min, single concern | Skip detailed planning, implement directly |
|
|
227
|
-
| Medium | Crosses modules, needs trade-offs, 15–30 min | Mini-plan then implement |
|
|
228
|
-
| Large | Multi-step, architectural, 30–60 min+ | Full plan + split into Actions via `$roll-design` |
|
|
229
|
-
|
|
230
|
-
### Step B2: Create US / Actions
|
|
231
|
-
|
|
232
|
-
- Use `$roll-design` to split vague request into INVEST-compliant User Stories
|
|
233
|
-
- Insert US into `.roll/backlog.md` under the relevant Epic > Feature group
|
|
234
|
-
- If a new story folder is needed, mint it via `roll story new <ID> --title <t> --epic <e>` (the single channel, US-META-009), then edit the spec
|
|
235
|
-
|
|
236
|
-
After creation, switch to **Story mode** and execute the first US immediately.
|
|
237
|
-
|
|
238
|
-
Proceed to the **Shared TCR Workflow** (Phase 1 onward).
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## Shared TCR Workflow
|
|
243
|
-
|
|
244
|
-
The following phases apply to both Story mode and Fly mode after planning is complete.
|
|
245
|
-
|
|
246
|
-
### Phase 1: Peer Review Gate
|
|
247
|
-
|
|
248
|
-
After planning is complete, before entering Test Design Review, assess whether the plan warrants peer review:
|
|
249
|
-
|
|
250
|
-
**Auto-trigger `$roll-peer` when any of the following is true:**
|
|
251
|
-
- Plan affects **>3 files** or **crosses modules**
|
|
252
|
-
- **Architecture decisions** or non-obvious trade-offs are involved
|
|
253
|
-
- **Destructive / irreversible operations** (deletions, migrations, production deploys)
|
|
254
|
-
- **High-risk signal words** detected in user request ("critical / important / don't break / 关键 / 别搞砸")
|
|
255
|
-
- User explicitly requests peer review ("/peer", "叫上 peer")
|
|
256
|
-
|
|
257
|
-
**With 10s opt-out:**
|
|
258
|
-
```
|
|
259
|
-
Plan affects N files across M modules. Estimated peer review: 2–3 rounds, ~X tokens.
|
|
260
|
-
Press Enter to launch peer review, or type 'n' to skip. Auto-executing in 10s...
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
**After peer review result:**
|
|
264
|
-
- **AGREE** → proceed to Phase 2 (Test Design Review)
|
|
265
|
-
- **REFINE** → incorporate feedback, regenerate plan, re-run Phase 1
|
|
266
|
-
- **OBJECT** → consider alternative plan, re-run Phase 1 with revised proposal
|
|
267
|
-
- **ESCALATE** → present both proposals to user for final decision before proceeding
|
|
268
|
-
|
|
269
|
-
**Never trigger:**
|
|
270
|
-
- Single-file changes or well-defined fixes
|
|
271
|
-
- Plans with no cross-module impact and no architecture decisions
|
|
272
|
-
|
|
273
|
-
### Phase 2: Test Design Review
|
|
274
|
-
|
|
275
|
-
Before writing implementation code:
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
🧪 $(msg build.test_design): {Action name}
|
|
279
|
-
|
|
280
|
-
$(msg build.scenarios):
|
|
281
|
-
├── {Happy path scenario}
|
|
282
|
-
├── {Edge case scenario}
|
|
283
|
-
└── {Failure/regression scenario}
|
|
284
|
-
|
|
285
|
-
$(msg build.test_types):
|
|
286
|
-
├── Unit tests for: {logic components}
|
|
287
|
-
├── Integration tests for: {API/data flows}
|
|
288
|
-
└── Manual verification for: {UI/visual elements}
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
**Self-review on test design:**
|
|
292
|
-
- Are we testing the right behavior?
|
|
293
|
-
- Are edge cases covered?
|
|
294
|
-
- Are tests independent and deterministic?
|
|
295
|
-
|
|
296
|
-
Reference `$roll-.qa` for coverage requirements and test pyramid strategy.
|
|
297
|
-
|
|
298
|
-
**Why this phase**: TCR only guarantees code passes tests — verify tests are correct first.
|
|
299
|
-
|
|
300
|
-
### Phase 3: TCR Implementation Loop
|
|
301
|
-
|
|
302
|
-
```
|
|
303
|
-
┌────────────────────────────────────────────────────────────┐
|
|
304
|
-
│ $(msg build.tcr_cycle) │
|
|
305
|
-
└────────────────────────────────────────────────────────────┘
|
|
306
|
-
|
|
307
|
-
$(msg build.micro_step {N} "{description of smallest testable change}")
|
|
308
|
-
|
|
309
|
-
Step 1: Write/Update Test
|
|
310
|
-
└── Run test → Confirm RED (expected failure)
|
|
311
|
-
|
|
312
|
-
Step 2: Implement Minimal Code
|
|
313
|
-
└── Write just enough to make test pass
|
|
314
|
-
|
|
315
|
-
Step 3: TCR Decision
|
|
316
|
-
└── roll test (per-commit gate — AFFECTED scope only)
|
|
317
|
-
├── ✅ GREEN → git commit -m "tcr: {micro-step description}"
|
|
318
|
-
└── ❌ RED → git checkout -- . → Retry with new approach
|
|
319
|
-
|
|
320
|
-
Step 4: Refactor (optional, while green)
|
|
321
|
-
└── roll test → ✅ GREEN → Amend or new TCR cycle
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
**The commit gate runs AFFECTED tests, not the full suite (FIX-325):**
|
|
325
|
-
|
|
326
|
-
- `roll test` (the per-commit gate) runs `vitest --changed` — only the
|
|
327
|
-
dependency closure of the working-tree change — and **excludes** the
|
|
328
|
-
env-divergent heavy suites (`*.integration.test.ts`, `*.e2e.test.ts`,
|
|
329
|
-
`npm-pack.test.ts`) that are red locally / in a cycle worktree but green in
|
|
330
|
-
CI. The FULL suite (`npm test`, no `--affected`) is the CI / pre-push gate
|
|
331
|
-
(Phase 5), never the per-commit gate.
|
|
332
|
-
- On green, `roll test` writes the proof record `.roll/last-test-pass`
|
|
333
|
-
(`{ts, tree, mode, scope}`). The `pre-commit` hook refuses the commit unless
|
|
334
|
-
that proof is **fresh (≤ 60s)** AND its `tree` matches the current
|
|
335
|
-
`git write-tree` — i.e. the exact code being committed was just tested. So:
|
|
336
|
-
stage → `roll test` → commit, in that order; editing after the test
|
|
337
|
-
invalidates the proof (commit blocked: "code changed since last test run").
|
|
338
|
-
Doc-only changes are exempt.
|
|
339
|
-
|
|
340
|
-
**Micro-step guidelines:**
|
|
341
|
-
|
|
342
|
-
| Change Type | Typical Micro-Steps |
|
|
343
|
-
|-------------|---------------------|
|
|
344
|
-
| Logic / algorithm | 1 function = 1–2 micro-steps |
|
|
345
|
-
| API endpoint | Route → Handler → Validation → Response |
|
|
346
|
-
| UI component | Skeleton → Props → Interaction → Styling |
|
|
347
|
-
| Bug fix | Regression test → Fix → Verify |
|
|
348
|
-
| Refactor | Extract method → Update calls → Remove old |
|
|
349
|
-
|
|
350
|
-
Accumulate 3–5 micro-commits per Action. Each commit is a guaranteed working state.
|
|
351
|
-
|
|
352
|
-
#### Architectural Friction Signal (non-blocking)
|
|
353
|
-
|
|
354
|
-
While implementing, watch for these signals:
|
|
355
|
-
|
|
356
|
-
- This Action requires touching code in 3+ unrelated modules
|
|
357
|
-
- The existing module boundary has to be bent or bypassed to make this work
|
|
358
|
-
- A data structure or interface needs to change in a way that ripples across contexts
|
|
359
|
-
- The implementation feels "wrong" even when the test passes
|
|
360
|
-
|
|
361
|
-
When any signal appears, **do not stop — flag it**:
|
|
362
|
-
|
|
363
|
-
```bash
|
|
364
|
-
# 1. Append to .roll/backlog.md under ## ♻️ Refactor
|
|
365
|
-
# REFACTOR-XXX | <one-line description> | 📋 Todo
|
|
366
|
-
|
|
367
|
-
# 2. Append a brief entry to .roll/features/autonomous-evolution/refactor-log.md
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
**REFACTOR entry format in .roll/backlog.md:**
|
|
371
|
-
|
|
372
|
-
```markdown
|
|
373
|
-
| REFACTOR-001 | {one-line plain-language description} | 📋 Todo |
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
描述写法:参见 AGENTS.md "Backlog descriptions" 规则。说清楚"什么需要改"以及"不改会怎样",技术细节写在 `.roll/features/<epic>/refactor-log.md`。
|
|
377
|
-
|
|
378
|
-
**refactor-log.md entry format:**
|
|
379
|
-
|
|
380
|
-
```markdown
|
|
381
|
-
## REFACTOR-001 Extract payment boundary
|
|
382
|
-
|
|
383
|
-
**Flagged**: {YYYY-MM-DD} during US-XXX
|
|
384
|
-
**Signal**: {which friction signal triggered this}
|
|
385
|
-
**Observation**: {1–3 sentences describing what felt wrong}
|
|
386
|
-
**Suggested scope**: {rough sense of what a fix would touch}
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
Then continue implementing the current Story normally.
|
|
390
|
-
|
|
391
|
-
**Event emission** — after all TCR micro-steps for a Story complete, emit a `build` event so the cycle event stream reflects the work done. The v3 runner writes events natively; do not call the retired bash helper `_loop_event`.
|
|
392
|
-
|
|
393
|
-
### Phase 4: E2E Deposit
|
|
394
|
-
|
|
395
|
-
After TCR micro-steps pass, deposit an E2E test for this Story's core user flow.
|
|
396
|
-
|
|
397
|
-
```
|
|
398
|
-
E2E DEPOSIT
|
|
399
|
-
|
|
400
|
-
Step 1: Detect
|
|
401
|
-
└── Read project's existing E2E infrastructure
|
|
402
|
-
(test directories, config files, framework, naming conventions)
|
|
403
|
-
|
|
404
|
-
Step 2: Write
|
|
405
|
-
└── One E2E test covering the Story's golden path
|
|
406
|
-
(the critical user journey this Story delivers)
|
|
407
|
-
|
|
408
|
-
Step 3: Run
|
|
409
|
-
└── Execute the new E2E test
|
|
410
|
-
|
|
411
|
-
Step 4: TCR
|
|
412
|
-
├── ✅ GREEN → git commit -m "tcr: e2e deposit for {story}"
|
|
413
|
-
└── ❌ RED → Fix via TCR cycle until green
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
**Rules:**
|
|
417
|
-
- Follow whatever E2E patterns the project already uses — framework, directory, naming
|
|
418
|
-
- If no E2E infrastructure exists, reference `$roll-.qa` "Missing Test Infrastructure" section to bootstrap minimally, then deposit
|
|
419
|
-
- One test per Story — covers the golden path, not exhaustive edge cases (those are unit/integration from Phase 3)
|
|
420
|
-
- Each deposited E2E becomes a replayable case: CI runs it on every push, Sentinel can sample it against production
|
|
421
|
-
|
|
422
|
-
### Phase 5: Pre-Push CI Gate
|
|
423
|
-
|
|
424
|
-
After all micro-steps, run the **FULL** suite locally before pushing — this is
|
|
425
|
-
where the heavy env-divergent suites (integration / e2e / npm-pack) excluded
|
|
426
|
-
from the per-commit affected gate (Phase 3) finally run. This is the same scope
|
|
427
|
-
CI runs (`npm test` with no `--affected`), so a green here predicts a green CI.
|
|
428
|
-
|
|
429
|
-
```bash
|
|
430
|
-
npm run ci:local 2>/dev/null || (npm run lint && npm run build && npm test -- --run)
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
**If CI fails:**
|
|
434
|
-
```
|
|
435
|
-
❌ Local CI check failed
|
|
436
|
-
├── Run 'npm run ci:fix' or 'npm run format' for auto-fixable issues
|
|
437
|
-
├── Fix remaining lint/build/test errors via new TCR cycle
|
|
438
|
-
└── Re-run until all pass
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
**Setup `ci:local` script (if not in `package.json`):**
|
|
442
|
-
```json
|
|
443
|
-
{
|
|
444
|
-
"scripts": {
|
|
445
|
-
"ci:local": "npm run format:check && npm run lint && npm run build && npm run test -- --run",
|
|
446
|
-
"ci:fix": "npm run format && npm run lint -- --fix"
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
**Setup pre-push hook (recommended, one-time):**
|
|
452
|
-
```bash
|
|
453
|
-
cat > .git/hooks/pre-push << 'EOF'
|
|
454
|
-
#!/bin/bash
|
|
455
|
-
echo "🔍 Running local CI checks..."
|
|
456
|
-
if ! npm run ci:local 2>/dev/null && ! (npm run lint && npm run build); then
|
|
457
|
-
echo "❌ CI check failed, push blocked"
|
|
458
|
-
exit 1
|
|
459
|
-
fi
|
|
460
|
-
echo "✅ CI check passed"
|
|
461
|
-
EOF
|
|
462
|
-
chmod +x .git/hooks/pre-push
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
### Phase 6: Pre-Push Code Review (Three-Axis Deep Review)
|
|
466
|
-
|
|
467
|
-
This phase runs **once per Story** (not per micro-step) on the full accumulated diff.
|
|
468
|
-
Per-micro-step review uses `$roll-.review staged` inline checklist (zero extra cost).
|
|
469
|
-
|
|
470
|
-
**Phase 1 vs Phase 6 split**: Phase 1 (Peer Review) focuses on architectural direction
|
|
471
|
-
and approach before coding begins. Phase 6 focuses on implementation quality after all
|
|
472
|
-
micro-steps are done — catching issues that only appear at diff scale (parameter sprawl
|
|
473
|
-
across files, copy-paste patterns, cross-file N+1, etc.).
|
|
474
|
-
|
|
475
|
-
```bash
|
|
476
|
-
# Capture full Story diff
|
|
477
|
-
git diff main...HEAD
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
**Launch three review agents in parallel** (each receives the full diff):
|
|
481
|
-
|
|
482
|
-
```
|
|
483
|
-
Agent 1: Reuse Review
|
|
484
|
-
→ Search for existing utilities / helpers the new code could use instead
|
|
485
|
-
→ Flag any new function that duplicates existing functionality
|
|
486
|
-
→ Flag inline logic replaceable by existing tools
|
|
487
|
-
|
|
488
|
-
Agent 2: Quality Review
|
|
489
|
-
→ Redundant state, Parameter sprawl, Copy-paste near-duplicate,
|
|
490
|
-
Leaky abstraction, Stringly-typed, JSX nesting,
|
|
491
|
-
Nested conditionals ≥3 deep, Unnecessary comments
|
|
492
|
-
|
|
493
|
-
Agent 3: Efficiency Review
|
|
494
|
-
→ Redundant computation / N+1, Missed concurrency,
|
|
495
|
-
Hot-path bloat, Loop no-op updates, TOCTOU existence pre-check,
|
|
496
|
-
Memory leaks, Overly broad operations
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
Wait for all three agents to complete. Aggregate findings → fix each issue
|
|
500
|
-
(false positives: note and skip, no debate) → summarize what was fixed.
|
|
501
|
-
|
|
502
|
-
**Fallback**: If parallel agent invocation fails, run `$roll-.review staged` on
|
|
503
|
-
the full diff as a single-pass fallback — do not skip review entirely.
|
|
504
|
-
|
|
505
|
-
**Decision:**
|
|
506
|
-
```
|
|
507
|
-
🔴 Critical > 0 → Fix via new TCR cycle → Re-review
|
|
508
|
-
🟡 Warnings > 0 → Fix if quick (< 5 min) or document
|
|
509
|
-
🟢 Suggestions / ✅ All clear → Proceed to Phase 7
|
|
510
|
-
```
|
|
511
|
-
|
|
512
|
-
### Phase 7: Commit & Push (branch + PR — NEVER direct to main)
|
|
513
|
-
|
|
514
|
-
`main` is PR-protected. Push the worktree's branch and open a PR — never
|
|
515
|
-
`git push origin main`. (When invoked by `roll-loop`, the runner already
|
|
516
|
-
created the worktree + branch and opens the PR; this is the manual-path
|
|
517
|
-
equivalent.)
|
|
518
|
-
|
|
519
|
-
```bash
|
|
520
|
-
# All TCR micro-commits are already made on the worktree's branch (step A3.1).
|
|
521
|
-
git log --oneline -{n} # Review TCR commits
|
|
522
|
-
git push -u origin <branch> # the dispatch/<id> branch from step A3.1
|
|
523
|
-
gh pr create --title "{story-id}: …" --body "…"
|
|
524
|
-
# After CI is green: gh pr merge --rebase
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
Commit message (if squashing):
|
|
528
|
-
```
|
|
529
|
-
{story-id}: {action description}
|
|
530
|
-
|
|
531
|
-
- {what changed}
|
|
532
|
-
- {why}
|
|
533
|
-
- {test coverage}
|
|
534
|
-
- TCR: {n} micro-commits
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
### Phase 8: Watch CI & Deploy
|
|
538
|
-
|
|
539
|
-
```
|
|
540
|
-
⏳ CI Running...
|
|
541
|
-
├── ✅ PASS → Proceed to deploy
|
|
542
|
-
└── ❌ FAIL →
|
|
543
|
-
├── Diagnose failure
|
|
544
|
-
├── Create new TCR micro-step to fix
|
|
545
|
-
└── Push and retry
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
Follow the repo's deployment path (Vercel / Railway / etc.) and record the deployed target.
|
|
549
|
-
|
|
550
|
-
**CI failure recovery:**
|
|
551
|
-
```
|
|
552
|
-
1. Diagnose: environment-specific or real failure?
|
|
553
|
-
|
|
554
|
-
2. If real failure:
|
|
555
|
-
├── git reset --soft HEAD~{n}
|
|
556
|
-
├── TCR micro-step to fix
|
|
557
|
-
└── Push again
|
|
558
|
-
|
|
559
|
-
3. If environment-specific:
|
|
560
|
-
├── Document exception
|
|
561
|
-
└── Get user approval to proceed
|
|
562
|
-
```
|
|
563
|
-
|
|
564
|
-
### Phase 9: Runtime Verification
|
|
565
|
-
|
|
566
|
-
- **Web apps**: verify on deployed URL (happy path, edge cases, no regression)
|
|
567
|
-
- **CLI tools**: verify via command execution
|
|
568
|
-
- **Libraries**: verify via test usage or example scripts
|
|
569
|
-
|
|
570
|
-
### Phase 10: Verification Gate (MANDATORY)
|
|
571
|
-
|
|
572
|
-
**Before marking as DONE, fresh evidence must be provided.**
|
|
573
|
-
|
|
574
|
-
```
|
|
575
|
-
🚦 $(msg build.verification_gate)
|
|
576
|
-
|
|
577
|
-
$(msg build.evidence_checklist):
|
|
578
|
-
├── [ ] $(msg build.tests_passed)
|
|
579
|
-
├── [ ] $(msg build.build_succeeded)
|
|
580
|
-
├── [ ] $(msg build.online_verification)
|
|
581
|
-
└── [ ] $(msg build.no_regression)
|
|
582
|
-
|
|
583
|
-
$(msg build.gate_decision):
|
|
584
|
-
├── ✅ $(msg build.gate_pass)
|
|
585
|
-
└── ❌ $(msg build.gate_fail)
|
|
586
|
-
```
|
|
587
|
-
|
|
588
|
-
**Hard Rule**: "I confirmed the tests passed" does not count as evidence. Must be **freshly run** command output from this session.
|
|
589
|
-
|
|
590
|
-
### Phase 11: Acceptance Evidence (after Gate PASS)
|
|
591
|
-
|
|
592
|
-
Runs ONLY on a ✅ Gate PASS (a FAIL retry must not mint a misleading report). Non-blocking: any failure here → WARN, continue to Phase 12.
|
|
593
|
-
|
|
594
|
-
**Attest is EARNED during delivery — never backfilled (FIX-329).** Acceptance
|
|
595
|
-
evidence is produced inside the delivery: under `roll-loop` the HARD
|
|
596
|
-
`attest:gate` renders the report in-cycle; on the manual path you run
|
|
597
|
-
`roll attest` here, in Phase 10.6 of this delivery. There is no after-the-fact
|
|
598
|
-
reconstruction — `roll attest backfill` was a loophole and has been **removed**
|
|
599
|
-
(it now hard-errors). A Done card with no in-delivery evidence cannot acquire a
|
|
600
|
-
report; the only way past the release consistency gate is to **re-deliver** the
|
|
601
|
-
story (loop or manual Phase 10.6) and earn the report at delivery time.
|
|
602
|
-
|
|
603
|
-
0. **Before/after pairing (owner ruling 2026-06-06)**: when the story CHANGES
|
|
604
|
-
existing behavior, capture the prior state (`screenshots/before-*.png`)
|
|
605
|
-
before building and the new state (`screenshots/after-*.png`) at acceptance —
|
|
606
|
-
contrast is the clearest evidence. Brand-new capability with no prior state:
|
|
607
|
-
skip the pair; capture the new surface only.
|
|
608
|
-
|
|
609
|
-
1. **Dump raw evidence** produced in this session to story-level dirs:
|
|
610
|
-
`.roll/features/<epic>/{ID}/screenshots/*.png` — the DEFAULT evidence class for
|
|
611
|
-
every surface, **CLI included** (US-ATTEST-010): text evidence is the agent's
|
|
612
|
-
own report (nothing stops a fabricated `echo "✓ passed" > evidence.txt`); a
|
|
613
|
-
screenshot is an OS-level capture of really-rendered pixels — an independent
|
|
614
|
-
channel with a categorically higher forgery cost. Combined with the
|
|
615
|
-
never-overwritten run dirs (D4) and the render-layer red line, it is the
|
|
616
|
-
strongest link in the evidence chain.
|
|
617
|
-
`.roll/features/<epic>/{ID}/evidence/*.txt` (resolve `<epic>` via `.roll/index.json`; `roll attest` writes the report there as `{ID}-report.html`) — supplementary (searchable,
|
|
618
|
-
copyable); keep raw command outputs here, but do not let a text file be the
|
|
619
|
-
ONLY evidence for an AC that has a visible surface.
|
|
620
|
-
|
|
621
|
-
**CLI capture recipe**: run the verifying command in a REAL terminal (the
|
|
622
|
-
tmux observation window `roll-loop-<slug>` is a natural target — display the
|
|
623
|
-
proof there), then `screencapture -x -R <window-rect>` (macOS) into
|
|
624
|
-
`screenshots/`. Capture ONLY the relevant work area — a focused window, not
|
|
625
|
-
the whole desktop. Unattended cycles: drive the capture from the dispatcher
|
|
626
|
-
(deterministic), never hand-craft an image; if the capture channel is
|
|
627
|
-
unavailable (no GUI session / no permission), fall back to text evidence and
|
|
628
|
-
mark the AC `partial` with a note — never fake a screenshot.
|
|
629
|
-
|
|
630
|
-
**Web capture — shoot the DELIVERABLE, not the dossier (FIX-321/314)**: a web
|
|
631
|
-
screenshot captures the card's **declared** deliverable, taken from the
|
|
632
|
-
story's frontmatter key `deliverable_url` (alias `screenshot_url`). It may be
|
|
633
|
-
a URL, a local file, or carry a `#fragment` to deep-link a specific tab/view
|
|
634
|
-
(e.g. `.roll/features/index.html#casting`). The loop captures it with
|
|
635
|
-
**headless Playwright** — no GUI browser window pops up, and a missing
|
|
636
|
-
Chromium self-heals via an auto-install on first use. The red line: **never**
|
|
637
|
-
screenshot roll's own attest report / dossier page and pass it off as the
|
|
638
|
-
deliverable — that is a hollow shot. If the card declares **no**
|
|
639
|
-
`deliverable_url`, the capture **honestly skips** (recorded as a real skip,
|
|
640
|
-
not a fabricated image) — that is the correct behavior, not a failure. Declare
|
|
641
|
-
`deliverable_url` in the spec frontmatter when the story ships a visible web
|
|
642
|
-
surface so the real view gets captured.
|
|
643
|
-
2. **Write the intent map** `.roll/features/<epic>/{ID}/ac-map.json` — for EVERY AC (ids `{ID}:AC1..n`) pick `pass|readonly|partial|claimed|missing` and reference only evidence that exists (paths relative to the run dir; story-level dirs are reachable as `../evidence/...` / `../screenshots/...`):
|
|
644
|
-
|
|
645
|
-
```json
|
|
646
|
-
[{ "ac": "{ID}:AC1", "status": "pass",
|
|
647
|
-
"evidence": [
|
|
648
|
-
{ "kind": "screenshot", "label": "terminal run (real pixels)", "href": "../screenshots/ac1-terminal.png" },
|
|
649
|
-
{ "kind": "text", "label": "vitest (supplementary)", "textFile": "../evidence/vitest.txt" }
|
|
650
|
-
] }]
|
|
651
|
-
```
|
|
652
|
-
|
|
653
|
-
No evidence for an AC → say `claimed` yourself; the renderer enforces that downgrade anyway (red line) and lists it under Discrepancies.
|
|
654
|
-
3. **Run** `roll attest {ID}` (add `--deploy-url <url>` when one exists). The report lands at `.roll/features/<epic>/{ID}/latest/{ID}-report.html` (archive-per-card layout, US-META-001). The report is now layered (US-ATTEST-013): card context + conclusion/business badges + key screenshots up front, technical ANSI/command output folded into collapsed `<details>`, and a closing block (quality gate + evidence index + Review Score).
|
|
655
|
-
4. **Design QA checklist (US-ATTEST-013) — READABILITY ONLY**. After the report
|
|
656
|
-
renders, open it and run the checklist below. This is a presentation review of
|
|
657
|
-
the rendered HTML, NOT an evidence review.
|
|
658
|
-
**HARD RULE: this checklist NEVER changes any AC's status, evidence, or
|
|
659
|
-
`pass|readonly|partial|fail|blocked|claimed|missing` verdict.** Those are
|
|
660
|
-
fixed at step 2 (the ac-map) and enforced by the render-layer red line. If a
|
|
661
|
-
readability item fails, fix the *presentation* (a missing context field, an
|
|
662
|
-
uncropped screenshot, a layout overflow) — never edit a verdict to make the
|
|
663
|
-
report look cleaner.
|
|
664
|
-
- [ ] **首屏 10s 可懂** — a product/business reviewer grasps what shipped and
|
|
665
|
-
whether it passed within ten seconds, without scrolling into the technical fold.
|
|
666
|
-
- [ ] **390 / 320px 无横滚** — no horizontal scroll at mobile widths; before/after
|
|
667
|
-
pairs stack rather than overflow.
|
|
668
|
-
- [ ] **打印可读** — print preview (or print-to-PDF) is legible; AC cards don't
|
|
669
|
-
split awkwardly across pages.
|
|
670
|
-
- [ ] **状态不只靠颜色** — every status reads from its icon + bilingual word, not
|
|
671
|
-
color alone (colorblind-safe).
|
|
672
|
-
- [ ] **截图裁切与清晰度** — screenshots are cropped to the relevant work area and
|
|
673
|
-
legible; no full-desktop captures, no blurry/half-rendered frames.
|
|
674
|
-
If you cannot open the report (headless cycle), note that the design QA was
|
|
675
|
-
deferred and say so in the cycle report — do NOT silently skip it, and do NOT
|
|
676
|
-
substitute it for an evidence judgement.
|
|
677
|
-
|
|
678
|
-
### Phase 12: Write Back Status (REQUIRED)
|
|
679
|
-
|
|
680
|
-
**Done ≡ merged (FIX-322/323).** A card is `✅ Done` only once its delivery is
|
|
681
|
-
**merged to `main`** — not when the branch is pushed and not while the PR is
|
|
682
|
-
merely open. `published_pending_merge` (pushed / PR open, awaiting merge) is
|
|
683
|
-
**not** delivered. Consequences you can rely on:
|
|
684
|
-
|
|
685
|
-
- The picker **skips** any card that already has a merged delivery, so a card
|
|
686
|
-
reset to 📋 Todo after merge is not re-picked and re-built.
|
|
687
|
-
- Preflight reconciles truth from the PR: a 🔨 In Progress card whose PR has
|
|
688
|
-
**MERGED** is flipped to ✅ Done automatically (an OPEN PR is left alone).
|
|
689
|
-
|
|
690
|
-
So on the manual path, flip the row to Done **after** the PR merges; under
|
|
691
|
-
`roll-loop` the runner waits for green CI, auto-merges, and the flip follows the
|
|
692
|
-
merge — do not pre-flip on a still-open PR.
|
|
693
|
-
|
|
694
|
-
Both locations must be updated — neither can be skipped:
|
|
695
|
-
|
|
696
|
-
**① Update .roll/backlog.md index row (Status column):**
|
|
697
|
-
|
|
698
|
-
**Location rule (FIX-198)**: edit the MAIN project's backlog by ABSOLUTE path — `${ROLL_MAIN_PROJECT:-$PWD}/.roll/backlog.md`. In ordinary projects the cycle worktree has NO `.roll/` (gitignored, never checked out): a relative `.roll/backlog.md` edit writes into the void and the flip silently vanishes.
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
```markdown
|
|
702
|
-
| [US-{ID}](.roll/features/<epic>/US-{ID}/spec.md) | {Title} | ✅ Done · [evidence](.roll/features/<epic>/US-{ID}/latest/US-{ID}-report.html) |
|
|
703
|
-
```
|
|
704
|
-
|
|
705
|
-
Change the Status from `📋 Todo` or `🔨 In Progress` (whichever the row currently shows) to `✅ Done`. When invoked by `roll-loop`, the row will already be `🔨 In Progress` — that is the expected starting state, and the transition is the same Edit operation.
|
|
706
|
-
For Fly mode: first append an index row under the appropriate Epic > Feature group, then mark it done.
|
|
707
|
-
|
|
708
|
-
**② Update `.roll/features/<epic>/<story>/spec.md`:**
|
|
709
|
-
|
|
710
|
-
```markdown
|
|
711
|
-
## US-{ID} {Story Title} ✅
|
|
712
|
-
|
|
713
|
-
**Completed**: {YYYY-MM-DD}
|
|
714
|
-
|
|
715
|
-
**AC:**
|
|
716
|
-
- [x] {Completed acceptance criterion 1}
|
|
717
|
-
- [x] {Completed acceptance criterion 2}
|
|
718
|
-
|
|
719
|
-
**Files:**
|
|
720
|
-
- `{added/modified file 1}`
|
|
721
|
-
- `{added/modified file 2}`
|
|
722
|
-
```
|
|
723
|
-
|
|
724
|
-
- Add ✅ to the heading
|
|
725
|
-
- Add `**Completed**` date
|
|
726
|
-
- Change AC items from `[ ]` to `[x]`
|
|
727
|
-
- Update Files to reflect actual changed files
|
|
728
|
-
|
|
729
|
-
If the US section does not yet exist, create the full section (AC / Files / Dependencies).
|
|
730
|
-
|
|
731
|
-
**Before committing, run `$roll-.changelog`** to stage CHANGELOG.md — then include
|
|
732
|
-
it in the completion commit so no separate changelog commit is created.
|
|
733
|
-
|
|
734
|
-
```bash
|
|
735
|
-
# 1. Stage changelog (roll-.changelog stages CHANGELOG.md only, does not commit)
|
|
736
|
-
$roll-.changelog
|
|
737
|
-
|
|
738
|
-
# 2. Commit BACKLOG + feature doc + CHANGELOG.md together
|
|
739
|
-
git add .roll/backlog.md .roll/features/ CHANGELOG.md
|
|
740
|
-
git commit -m "docs: mark {US-ID} as completed"
|
|
741
|
-
git push
|
|
742
|
-
```
|
|
743
|
-
|
|
744
|
-
### Phase 13: Report & Celebrate
|
|
745
|
-
|
|
746
|
-
```
|
|
747
|
-
✅ $(msg build.pushed_to)
|
|
748
|
-
🚀 $(msg build.deployed): <url>
|
|
749
|
-
✅ $(msg build.verified): <what was checked>
|
|
750
|
-
📦 $(msg build.changes_summary): <summary>
|
|
751
|
-
🔢 $(msg build.commits_count): <count> micro-commits via TCR
|
|
752
|
-
🧪 $(msg build.tests_added): <what tests were added/modified>
|
|
753
|
-
📊 $(msg build.tcr_stats): <success rate, revert count if any>
|
|
754
|
-
📋 $(msg build.review_gate): <self-review findings summary>
|
|
755
|
-
📝 $(msg build.backlog_updated "<US-ID>")
|
|
756
|
-
📄 $(msg build.changelog_bundled)
|
|
757
|
-
|
|
758
|
-
🎉 $(msg build.shipped)
|
|
759
|
-
|
|
760
|
-
🔄 $(msg build.next_options):
|
|
761
|
-
1. Continue to next Action (if Story has more)
|
|
762
|
-
2. Start next US (if Fly mode created multiple)
|
|
763
|
-
3. Done (if all completed)
|
|
764
|
-
```
|
|
765
|
-
|
|
766
|
-
---
|
|
767
|
-
|
|
768
|
-
## Project Context Rule
|
|
769
|
-
|
|
770
|
-
Before creating any file or directory:
|
|
771
|
-
|
|
772
|
-
1. **Read existing project structure** — check for `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, existing `src/`, `api/`, `cmd/` directories
|
|
773
|
-
2. **Infer conventions from evidence** — don't assume a project type; observe what already exists
|
|
774
|
-
3. **Follow what already exists** — introduce new patterns only when the current structure has no precedent
|
|
775
|
-
|
|
776
|
-
> `roll init` no longer asks for project type. Skills are responsible for reading context and acting accordingly.
|
|
777
|
-
|
|
778
|
-
---
|
|
779
|
-
|
|
780
|
-
## Hard Rules
|
|
781
|
-
|
|
782
|
-
0. **Worktree-first, PR-at-end (ALWAYS)**
|
|
783
|
-
Before writing any code, work in a dedicated git worktree on its own
|
|
784
|
-
branch (`git worktree add ../wt-<id> -b <branch>`), never in the shared
|
|
785
|
-
checkout — so concurrent cycles / sessions never collide. Finish by
|
|
786
|
-
pushing the branch and opening a PR; `main` is PR-protected — NEVER
|
|
787
|
-
`git push origin main`. (Under `roll-loop` the runner creates the
|
|
788
|
-
worktree + branch and opens the PR; this rule is the manual-path
|
|
789
|
-
equivalent and must hold either way.)
|
|
790
|
-
|
|
791
|
-
1. **No local-only "done" — Done ≡ merged (FIX-322/323)**
|
|
792
|
-
Work is not complete until it reaches:
|
|
793
|
-
commit → push → CI signal → **PR merged to main** → deploy → online
|
|
794
|
-
verification → backlog update.
|
|
795
|
-
A pushed branch or an open PR is `published_pending_merge`, NOT delivered;
|
|
796
|
-
the row flips to `✅ Done` only after the merge. Truth reconciles from the
|
|
797
|
-
PR: the picker skips already-merged cards and preflight flips a MERGED PR's
|
|
798
|
-
card to Done.
|
|
799
|
-
|
|
800
|
-
2. **TCR for every micro-step**
|
|
801
|
-
- Each behavior change: Test → Green=Commit / Red=Revert
|
|
802
|
-
- No "I'll fix it in the next step" — revert and retry
|
|
803
|
-
- Each commit is a guaranteed working state
|
|
804
|
-
|
|
805
|
-
3. **Test Design Review before implementation**
|
|
806
|
-
- Design test scenarios and edge cases first
|
|
807
|
-
- TCR only works if tests are correct — validate early
|
|
808
|
-
|
|
809
|
-
4. **Micro-steps only**
|
|
810
|
-
- If a step feels "a bit complex", split it
|
|
811
|
-
- Each micro-step completable in 1–3 minutes
|
|
812
|
-
- **No placeholders**: Action/AC descriptions must be specific — no "TBD"
|
|
813
|
-
|
|
814
|
-
5. **Pre-push self-review required**
|
|
815
|
-
- Run `$roll-.review staged` on final diff
|
|
816
|
-
- Fix blocking (Critical) issues via new TCR cycle
|
|
817
|
-
|
|
818
|
-
6. **No hidden work**
|
|
819
|
-
- Every file changed must relate to the current Action
|
|
820
|
-
- No "while I'm here" refactors unless in a separate TCR cycle
|
|
821
|
-
|
|
822
|
-
7. **Always update BACKLOG status**
|
|
823
|
-
- .roll/backlog.md index row and `.roll/features/<feature>.md` US section are both required
|
|
824
|
-
- Neither can be skipped
|
|
825
|
-
|
|
826
|
-
8. **Docs/code/product stay aligned**
|
|
827
|
-
- User-visible behavior, command, output-copy, site, or delivery-view changes update the touched README/docs/guide/site/help in the same delivery
|
|
828
|
-
- Registry drift from FIX-242 remains a hard red line; `roll attest` doc-gap is a shadow warning and should be resolved before Done
|
|
829
|
-
|
|
830
|
-
---
|
|
831
|
-
|
|
832
|
-
## Definition of Done (per Action)
|
|
833
|
-
|
|
834
|
-
- [ ] Story and Action clearly defined
|
|
835
|
-
- [ ] Test design reviewed and approved
|
|
836
|
-
- [ ] **TCR cycles completed** (all micro-steps via Test && Commit)
|
|
837
|
-
- [ ] **E2E deposited** (golden path test for this Story, committed via TCR)
|
|
838
|
-
- [ ] All commits are green states (no broken commits)
|
|
839
|
-
- [ ] Local CI checks passed (format + lint + build + test)
|
|
840
|
-
- [ ] **Docs/code/product aligned** (user-visible changes updated touched README/docs/guide/site/help, or the delivery records why no doc surface changed)
|
|
841
|
-
- [ ] Self-code-review passed, blocking issues fixed via TCR
|
|
842
|
-
- [ ] Changes pushed to remote
|
|
843
|
-
- [ ] CI is green (or explicit, recorded exception)
|
|
844
|
-
- [ ] Deployed to production
|
|
845
|
-
- [ ] Online verification performed
|
|
846
|
-
- [ ] **Verification Gate passed** (fresh evidence for tests, build, deploy, no regression)
|
|
847
|
-
- [ ] **.roll/backlog.md index status updated** (📋 → ✅, REQUIRED)
|
|
848
|
-
- [ ] **`.roll/features/<feature>.md` US section updated** (Completed date + [x] ACs, REQUIRED)
|
|
849
|
-
- [ ] **CHANGELOG.md staged and bundled** into completion commit via `$roll-.changelog` in Phase 12 (REQUIRED)
|
|
850
|
-
- [ ] Summary reported to user
|
|
851
|
-
|
|
852
|
-
### Review Score (FIX-343)
|
|
853
|
-
|
|
854
|
-
The story's Review Score is **not** produced by this skill. The building agent
|
|
855
|
-
**does NOT self-score**. The quality score is produced SOLELY by the runner's
|
|
856
|
-
peer score stage — a Reviewer running in a FRESH, separate session (never a
|
|
857
|
-
sub-agent of the builder's session). The agent's job is to deliver clean
|
|
858
|
-
evidence (report + ac-map + attest); the runner then casts a fresh-session
|
|
859
|
-
Reviewer that mints the Review Score (1..10 + verdict + rationale), recorded
|
|
860
|
-
with `scoredBy` and the fresh-session id so independence is verifiable.
|
|
861
|
-
|
|
862
|
-
Independence is about session/context, not vendor: a fresh same-vendor session
|
|
863
|
-
is the minimum acceptable; a different agent+model+session (non-sub-agent) is
|
|
864
|
-
encouraged (absolute heterogeneity). A score sharing the builder's session
|
|
865
|
-
(including any sub-agent of it) is rejected as a self-score.
|
|
866
|
-
|
|
867
|
-
Score guidance the Reviewer applies (integer 1..10):
|
|
868
|
-
- **9..10** — story shipped cleanly: AC fully met, TCR rhythm tight, no
|
|
869
|
-
re-tries from `verdict: too_big`, peer review concerns addressed inline.
|
|
870
|
-
- **6..8** — shipped with caveats: re-tries on red, edge case left to a
|
|
871
|
-
follow-up FIX, documentation lagged behind code by one cycle, etc.
|
|
872
|
-
- **1..5** — shipped but at low confidence: AC partially met (note which),
|
|
873
|
-
TCR rhythm broken (multiple revert iterations), or `regression` verdict.
|
|
874
|
-
|
|
875
|
-
Verdict values:
|
|
876
|
-
- `good` — story fully delivered; AC met; no concerning signal.
|
|
877
|
-
- `ok` — shipped but with at least one documented trade-off (use rationale).
|
|
878
|
-
- `regression` — story landed but another behaviour broke (rare; open a FIX).
|
|
879
|
-
|
|
880
|
-
#### Reviewer-triggered resize (US-AGENT-041)
|
|
881
|
-
|
|
882
|
-
A low score (≤ 5) can mean two different things, and the Reviewer distinguishes
|
|
883
|
-
them. When the delivery fell short because of a **quality** problem (a bug, a
|
|
884
|
-
weak test), the Reviewer just scores low — the loop retries. But when it fell
|
|
885
|
-
short because the **scope was simply too large for one cycle** (whole ACs or
|
|
886
|
-
surfaces left uncovered, not defects), the Reviewer ALSO emits, alongside the
|
|
887
|
-
SCORE/VERDICT/RATIONALE lines:
|
|
888
|
-
|
|
889
|
-
```
|
|
890
|
-
RESIZE: <one line — why the scope exceeds one cycle>
|
|
891
|
-
GAPS: <gap one; gap two; gap three>
|
|
892
|
-
```
|
|
893
|
-
|
|
894
|
-
On a RESIZE signal (low score), the loop runs `roll loop review-resize <story>`:
|
|
895
|
-
`$roll-design` mints sub-stories from the gaps, ≥2 **heterogeneous** reviewers
|
|
896
|
-
gate the split by consensus (all agree → auto-land via `roll loop self-downgrade`,
|
|
897
|
-
which parks the parent at 🚫 Hold + appends the sub-stories; any objection →
|
|
898
|
-
pause + ALERT, backlog unchanged), and the chain-depth cap (US-AGENT-009) stops
|
|
899
|
-
runaway splits. The human is **on** the loop (alerted only on consensus failure
|
|
900
|
-
or the cap), not in it. A RESIZE is never emitted for a pure quality problem.
|
|
901
|
-
|
|
902
|
-
---
|
|
903
|
-
|
|
904
|
-
## TCR Recovery Patterns
|
|
905
|
-
|
|
906
|
-
### Pattern 1: Red After Multiple Attempts
|
|
907
|
-
|
|
908
|
-
```
|
|
909
|
-
If same micro-step fails 3 times:
|
|
910
|
-
1. Revert to clean state
|
|
911
|
-
2. Escalate: "This micro-step is actually medium complexity"
|
|
912
|
-
3. Split into smaller micro-steps
|
|
913
|
-
4. Retry TCR
|
|
914
|
-
```
|
|
915
|
-
|
|
916
|
-
### Pattern 2: Refactoring While Green
|
|
917
|
-
|
|
918
|
-
```
|
|
919
|
-
If refactoring during green state:
|
|
920
|
-
Option A: Amend last commit (if refactor is tiny)
|
|
921
|
-
Option B: New TCR cycle (treat as new micro-step)
|
|
922
|
-
```
|
|
923
|
-
|
|
924
|
-
### Pattern 3: Test Design Was Wrong
|
|
925
|
-
|
|
926
|
-
```
|
|
927
|
-
If implementation reveals test design flaw:
|
|
928
|
-
1. Revert current micro-step
|
|
929
|
-
2. Return to Phase 2 (Test Design Review)
|
|
930
|
-
3. Update test design
|
|
931
|
-
4. Resume TCR cycles
|
|
932
|
-
```
|
|
933
|
-
|
|
934
|
-
### Pattern 4: Complex State vs Simple Reset
|
|
935
|
-
|
|
936
|
-
```
|
|
937
|
-
When complex state management is error-prone → consider full reset + re-initialization.
|
|
938
|
-
60% less code, zero bugs is better than an elegant but fragile transition.
|
|
939
|
-
```
|
|
940
|
-
|
|
941
|
-
---
|
|
942
|
-
|
|
943
|
-
## When to Use What
|
|
944
|
-
|
|
945
|
-
```
|
|
946
|
-
roll-build → ship anything (new idea, US-ID, free-text request)
|
|
947
|
-
roll-fix → fix a specific known bug (FIX-XXX / BUG-XXX)
|
|
948
|
-
roll-design → plan and design before building (no code output)
|
|
949
|
-
roll-idea → fast capture a bug or idea into .roll/backlog.md
|
|
950
|
-
roll-.clarify → passive scope clarification for vague build requests
|
|
951
|
-
```
|
|
952
|
-
|
|
953
|
-
---
|
|
954
|
-
|
|
955
|
-
## Required Artifacts (per Action)
|
|
956
|
-
|
|
957
|
-
The agent must explicitly produce (in text) before or during execution:
|
|
958
|
-
|
|
959
|
-
- **Current User Story**: 1–3 sentences, INVEST-lean
|
|
960
|
-
- **Current Action**: smallest shippable increment
|
|
961
|
-
- **Acceptance criteria**: measurable outcomes for this Action
|
|
962
|
-
- **Write scope**: files/areas expected to change
|
|
963
|
-
- **Test Design**: scenarios, edge cases, test types
|
|
964
|
-
- **Test Design Review**: coverage validation result
|
|
965
|
-
- **TCR Log**: micro-step descriptions and commit count
|
|
966
|
-
- **E2E Deposit**: golden path E2E test file for this Story
|
|
967
|
-
- **Quality Review**: post-TCR code review result
|
|
968
|
-
- **Deployment target**: where it will be verified
|