specrails-core 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -310
- package/bin/specrails-core.mjs +3 -1
- package/dist/installer/cli.js +4 -0
- package/dist/installer/cli.js.map +1 -1
- package/dist/installer/commands/framework.js +64 -49
- package/dist/installer/commands/framework.js.map +1 -1
- package/dist/installer/commands/init.js +102 -66
- package/dist/installer/commands/init.js.map +1 -1
- package/dist/installer/commands/update.js +80 -74
- package/dist/installer/commands/update.js.map +1 -1
- package/dist/installer/commands/v5-migration.js +14 -0
- package/dist/installer/commands/v5-migration.js.map +1 -1
- package/dist/installer/phases/framework-lifecycle.js +2 -0
- package/dist/installer/phases/framework-lifecycle.js.map +1 -1
- package/dist/installer/phases/scaffold.js +191 -258
- package/dist/installer/phases/scaffold.js.map +1 -1
- package/dist/installer/runtime/pipeline-state.js +801 -0
- package/dist/installer/runtime/pipeline-state.js.map +1 -0
- package/dist/installer/util/exec.js +6 -1
- package/dist/installer/util/exec.js.map +1 -1
- package/dist/installer/util/fs.js +11 -2
- package/dist/installer/util/fs.js.map +1 -1
- package/dist/installer/util/install-transaction.js +246 -0
- package/dist/installer/util/install-transaction.js.map +1 -0
- package/dist/installer/util/registry.js +20 -0
- package/dist/installer/util/registry.js.map +1 -1
- package/docs/ci-cd.md +57 -0
- package/docs/user-docs/codex-vs-claude-code.md +23 -151
- package/docs/user-docs/core-updates.md +70 -0
- package/docs/user-docs/provider-pipelines.md +53 -0
- package/integration-contract.json +179 -66
- package/package.json +5 -2
- package/templates/agents/sr-developer.md +9 -11
- package/templates/agents/sr-reviewer.md +26 -33
- package/templates/codex-skills/batch-implement/SKILL.md +58 -244
- package/templates/codex-skills/implement/SKILL.md +136 -338
- package/templates/codex-skills/rails/sr-architect/SKILL.md +7 -0
- package/templates/codex-skills/rails/sr-developer/SKILL.md +13 -0
- package/templates/codex-skills/rails/sr-reviewer/SKILL.md +39 -5
- package/templates/codex-skills/retry/SKILL.md +37 -117
- package/templates/commands/specrails/batch-implement.md +16 -288
- package/templates/commands/specrails/implement.md +62 -1057
- package/templates/commands/specrails/retry.md +22 -314
- package/templates/gemini-commands/batch-implement.toml +28 -40
- package/templates/gemini-commands/implement.toml +55 -114
- package/templates/gemini-commands/retry.toml +21 -0
- package/templates/kimi/specrails/run-skill.mjs +51 -2
- package/templates/runtime/provider-pipeline.md +55 -0
|
@@ -1,330 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
name: "Smart Failure Recovery"
|
|
3
|
-
description: "Resume a failed /specrails:implement pipeline from the last successful phase without restarting from scratch."
|
|
4
|
-
category: Workflow
|
|
5
|
-
tags: [workflow, recovery, retry, resilience]
|
|
6
|
-
phases:
|
|
7
|
-
- key: load
|
|
8
|
-
label: Load State
|
|
9
|
-
description: "Read pipeline state from disk and identify the resume point"
|
|
10
|
-
- key: resume
|
|
11
|
-
label: Resume
|
|
12
|
-
description: "Execute remaining phases starting from the failed phase"
|
|
13
|
-
- key: report
|
|
14
|
-
label: Report
|
|
15
|
-
description: "Print a final status report with outcomes and next steps"
|
|
16
|
-
---
|
|
1
|
+
# Retry an Implementation Pipeline
|
|
17
2
|
|
|
18
|
-
|
|
3
|
+
**Input:** $ARGUMENTS — existing change and optional --from <phase>.
|
|
19
4
|
|
|
20
|
-
|
|
5
|
+
## Resolve the exact run
|
|
21
6
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
**Input:** $ARGUMENTS — accepted forms:
|
|
25
|
-
|
|
26
|
-
1. `<feature-name>` — kebab-case feature name matching a `.claude/pipeline-state/<feature-name>.json` file
|
|
27
|
-
2. `--list` — list all available pipeline state files and their current status, then exit
|
|
28
|
-
3. `<feature-name> --from <phase>` — force resume from a specific phase (overrides auto-detection)
|
|
29
|
-
4. `<feature-name> --dry-run` — override to resume in dry-run mode (no git/PR operations)
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Phase 0: Parse Input
|
|
34
|
-
|
|
35
|
-
Scan `$ARGUMENTS` for flags:
|
|
36
|
-
|
|
37
|
-
- `--list`: if present, set `LIST_ONLY=true`.
|
|
38
|
-
- `--from <phase>`: if present, set `RESUME_FROM_OVERRIDE=<phase>`. Valid values: `architect`, `developer`, `reviewer`, `ship`, `ci`.
|
|
39
|
-
- `--dry-run`: if present, set `DRY_RUN_OVERRIDE=true`.
|
|
40
|
-
|
|
41
|
-
Extract the first positional argument (not starting with `--`) as `FEATURE_NAME`.
|
|
42
|
-
|
|
43
|
-
**If `--list`:** scan `.claude/pipeline-state/*.json`. For each file found, parse and print:
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
## Available Pipeline States
|
|
47
|
-
|
|
48
|
-
| Feature | Last Successful Phase | Failed Phase | Updated At |
|
|
49
|
-
|---------|----------------------|--------------|------------|
|
|
50
|
-
| <name> | <phase or —> | <phase or —> | <ISO time> |
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
If no files found: print `No pipeline state files found. Run /specrails:implement first.`
|
|
54
|
-
|
|
55
|
-
Exit after printing — do not proceed.
|
|
56
|
-
|
|
57
|
-
**If no positional argument and no `--list`:** print the following usage and exit:
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
Usage: /specrails:retry <feature-name> [--from <phase>] [--dry-run]
|
|
61
|
-
/specrails:retry --list
|
|
62
|
-
|
|
63
|
-
Phases: architect | developer | reviewer | ship | ci
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## Phase 1: Load Pipeline State
|
|
69
|
-
|
|
70
|
-
Read: `.claude/pipeline-state/<FEATURE_NAME>.json`
|
|
71
|
-
|
|
72
|
-
If the file does not exist:
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
[retry] Error: no pipeline state found for "<FEATURE_NAME>".
|
|
76
|
-
|
|
77
|
-
Run /specrails:retry --list to see available states, or start a new run:
|
|
78
|
-
/specrails:implement <your input>
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Exit.
|
|
82
|
-
|
|
83
|
-
Parse the state file and set the following variables:
|
|
84
|
-
|
|
85
|
-
- `LAST_SUCCESSFUL_PHASE` ← `last_successful_phase` (may be `null`)
|
|
86
|
-
- `FAILED_PHASE` ← `failed_phase` (may be `null`)
|
|
87
|
-
- `ERROR_CONTEXT` ← `error_context` (may be `null`)
|
|
88
|
-
- `OPENSPEC_ARTIFACTS` ← `openspec_artifacts` (e.g. `openspec/changes/<name>/`)
|
|
89
|
-
- `IMPLEMENTED_FILES` ← `implemented_files` (array, may be empty)
|
|
90
|
-
- `ORIGINAL_ISSUES` ← `input.issues` (array of issue numbers, may be `null`)
|
|
91
|
-
- `ORIGINAL_INPUT_FLAGS` ← `input.flags` object
|
|
92
|
-
- `SINGLE_MODE` ← `input.flags.single_mode` (default `true`)
|
|
93
|
-
- `DRY_RUN` ← if `DRY_RUN_OVERRIDE=true` then `true`, else `input.flags.dry_run` (default `false`)
|
|
94
|
-
- `PHASE_STATUSES` ← `phases` map (`architect`, `developer`, `reviewer`, `ship`, `ci` → `"done"`, `"failed"`, `"skipped"`, or `"pending"`)
|
|
95
|
-
|
|
96
|
-
**Validation:**
|
|
97
|
-
|
|
98
|
-
- If all phases are `"pending"`: the pipeline never reached any execution. Print:
|
|
99
|
-
```
|
|
100
|
-
[retry] Warning: all phases are pending — the pipeline may not have started.
|
|
101
|
-
Recommend running /specrails:implement instead.
|
|
102
|
-
```
|
|
103
|
-
Prompt: `Proceed anyway? [y/N]`. If `n` or no response: exit.
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Phase 2: Status Report
|
|
108
|
-
|
|
109
|
-
Print the pipeline status:
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
## Pipeline State: <FEATURE_NAME>
|
|
113
|
-
|
|
114
|
-
| Phase | Status | Notes |
|
|
115
|
-
|--------------|---------|-------------------------------------|
|
|
116
|
-
| architect | done | |
|
|
117
|
-
| developer | FAILED | <ERROR_CONTEXT or "no details"> |
|
|
118
|
-
| reviewer | pending | |
|
|
119
|
-
| ship | pending | |
|
|
120
|
-
| ci | pending | |
|
|
121
|
-
|
|
122
|
-
Last successful phase : <LAST_SUCCESSFUL_PHASE or "none">
|
|
123
|
-
Failed phase : <FAILED_PHASE or "—">
|
|
124
|
-
Error context : <ERROR_CONTEXT or "no details recorded">
|
|
125
|
-
OpenSpec artifacts : <OPENSPEC_ARTIFACTS>
|
|
126
|
-
Implemented files : <count> file(s) tracked
|
|
127
|
-
Original input : <issues list or "text description">
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## Phase 3: Determine Resume Point
|
|
133
|
-
|
|
134
|
-
**Phase execution order (canonical):**
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
architect → developer → reviewer → ship → ci
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
**If `RESUME_FROM_OVERRIDE` is set:** use it as `RESUME_PHASE`. Validate it is one of the canonical values; if not, print an error and exit.
|
|
141
|
-
|
|
142
|
-
**Otherwise, auto-detect:**
|
|
143
|
-
|
|
144
|
-
1. If `FAILED_PHASE` is set: `RESUME_PHASE = FAILED_PHASE`.
|
|
145
|
-
2. Else if `LAST_SUCCESSFUL_PHASE` is set: `RESUME_PHASE` = the next phase after `LAST_SUCCESSFUL_PHASE` in canonical order.
|
|
146
|
-
3. Else: `RESUME_PHASE = architect` (no phases completed).
|
|
147
|
-
|
|
148
|
-
Print the resume plan:
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
## Resume Plan
|
|
152
|
-
|
|
153
|
-
Resuming from phase: <RESUME_PHASE>
|
|
154
|
-
|
|
155
|
-
Phases to skip (already done):
|
|
156
|
-
✓ <phase> (done)
|
|
157
|
-
✓ <phase> (done)
|
|
158
|
-
|
|
159
|
-
Phases to execute:
|
|
160
|
-
► <RESUME_PHASE> (resuming here)
|
|
161
|
-
· <next-phase>
|
|
162
|
-
· <next-phase>
|
|
163
|
-
...
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Prompt the user:
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
Proceed? [Y/n]
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
If `n` or no response: exit without changes.
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
## Phase 4: Execute Remaining Phases
|
|
177
|
-
|
|
178
|
-
Execute phases in canonical order starting from `RESUME_PHASE`. For each phase:
|
|
179
|
-
|
|
180
|
-
- If its status in `PHASE_STATUSES` is `"skipped"`: **skip** — it was not run at the original invocation. Never launch a phase that was skipped, regardless of its position relative to `RESUME_PHASE`.
|
|
181
|
-
- If its status in `PHASE_STATUSES` is `"done"` AND it precedes `RESUME_PHASE` in canonical order: **skip** — do not re-run.
|
|
182
|
-
- If it equals `RESUME_PHASE` or comes after (and is not `"skipped"`): **run** it.
|
|
183
|
-
|
|
184
|
-
After each phase completes (or fails), update `.claude/pipeline-state/<FEATURE_NAME>.json`:
|
|
185
|
-
1. Read the current file.
|
|
186
|
-
2. Set `phases.<phase-key>` to `"done"` or `"failed"`.
|
|
187
|
-
3. If `"done"`: update `last_successful_phase`.
|
|
188
|
-
4. If `"failed"`: update `failed_phase` and `error_context`.
|
|
189
|
-
5. Update `updated_at` to current ISO 8601 timestamp.
|
|
190
|
-
6. Overwrite the file.
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
### 4a. Phase: architect
|
|
195
|
-
|
|
196
|
-
**Only runs if `RESUME_PHASE=architect`.**
|
|
197
|
-
|
|
198
|
-
Verify that `ORIGINAL_ISSUES` is non-empty or a text description is recoverable. If neither is available: print an error and stop — the original input is required to re-run the architect.
|
|
199
|
-
|
|
200
|
-
Launch **sr-architect** agent(s) exactly as described in Phase 3a of the implement pipeline. Pass:
|
|
201
|
-
- Original issue numbers from `ORIGINAL_ISSUES` (or text description if stored in state)
|
|
202
|
-
- Same OpenSpec output directory: `OPENSPEC_ARTIFACTS`
|
|
203
|
-
|
|
204
|
-
Wait for all architects to complete.
|
|
205
|
-
|
|
206
|
-
**Pipeline state update:** `architect` → `done` or `failed`.
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
### 4b. Phase: developer
|
|
211
|
-
|
|
212
|
-
**Runs if `RESUME_PHASE` is `architect` or `developer`.**
|
|
213
|
-
|
|
214
|
-
Before launching, verify architect artifacts exist:
|
|
7
|
+
Use the same absolute SPECRAILS_PIPELINE_RUNTIME and SPECRAILS_EXECUTION_CONTEXT. The managed fallback is .specrails/runtime/pipeline.mjs; the standalone workspace pointer is only discovery. Do not initialize another run, choose the newest change, replace frozen tickets from mutable backlog, or trust old ad-hoc pipeline state.
|
|
215
8
|
|
|
216
9
|
```bash
|
|
217
|
-
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
If missing and `RESUME_PHASE=developer`: print:
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
[retry] Error: architect artifacts not found at <OPENSPEC_ARTIFACTS>.
|
|
224
|
-
Retry from the architect phase: /specrails:retry <FEATURE_NAME> --from architect
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
Stop.
|
|
228
|
-
|
|
229
|
-
Launch **sr-developer** agent(s) exactly as described in Phase 3b of the implement pipeline.
|
|
230
|
-
|
|
231
|
-
- If `SINGLE_MODE=true`: launch in main repo, foreground.
|
|
232
|
-
- If `SINGLE_MODE=false`: launch in isolated worktrees, background.
|
|
233
|
-
- If `DRY_RUN=true`: use the dry-run redirect instructions from Phase 3b.
|
|
234
|
-
|
|
235
|
-
Wait for all developers to complete. Collect the list of files created or modified.
|
|
236
|
-
|
|
237
|
-
**Pipeline state update:** `developer` → `done` (also update `implemented_files` in state with the collected file list) or `failed`.
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
### 4c. Phase: reviewer
|
|
242
|
-
|
|
243
|
-
**Runs if `RESUME_PHASE` is any phase up to and including `reviewer`.**
|
|
244
|
-
|
|
245
|
-
Launch the single **sr-reviewer** exactly as in Phase 4b of the implement pipeline. Pass:
|
|
246
|
-
- `MODIFIED_FILES_LIST`: the `implemented_files` array from state
|
|
247
|
-
- `PIPELINE_CONTEXT`: brief description from original input and issue titles
|
|
248
|
-
- The security-exemptions config path (`.claude/security-exemptions.yaml`) if present
|
|
249
|
-
|
|
250
|
-
Wait for it to complete. Parse `SECURITY_BLOCKED` from the reviewer's `SECURITY_STATUS` line.
|
|
251
|
-
|
|
252
|
-
**Run the Confidence Gate (Phase 4b-conf)** exactly as defined in the implement pipeline.
|
|
253
|
-
|
|
254
|
-
**Pipeline state update:** `reviewer` → `done` or `failed`.
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
### 4d. Phase: ship
|
|
259
|
-
|
|
260
|
-
**Runs if `RESUME_PHASE` is `ship` or `ci`.**
|
|
261
|
-
|
|
262
|
-
If `DRY_RUN=true`: skip git operations. Record skipped operations, print dry-run summary, proceed to Phase 5.
|
|
263
|
-
|
|
264
|
-
Otherwise, run Phase 4c (ship) of the implement pipeline exactly as defined:
|
|
265
|
-
- Security gate check (`SECURITY_BLOCKED`)
|
|
266
|
-
- Conflict pre-check (Phase 4c.0)
|
|
267
|
-
- Git branch creation, commit, push, PR creation
|
|
268
|
-
- Backlog updates
|
|
269
|
-
|
|
270
|
-
**Pipeline state update:** `ship` → `done` or `failed`.
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
### 4e. Phase: ci
|
|
275
|
-
|
|
276
|
-
**Runs if ship succeeded and code was pushed.**
|
|
277
|
-
|
|
278
|
-
Run Phase 4d (CI monitoring) of the implement pipeline exactly as defined. Check CI status, fix failures (up to 2 retries).
|
|
279
|
-
|
|
280
|
-
**Pipeline state update:** `ci` → `done` or `failed`.
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
## Phase 5: Report
|
|
285
|
-
|
|
286
|
-
Print the final report:
|
|
287
|
-
|
|
10
|
+
node "${SPECRAILS_PIPELINE_RUNTIME:-.specrails/runtime/pipeline.mjs}" status --json
|
|
288
11
|
```
|
|
289
|
-
## Retry Complete: <FEATURE_NAME>
|
|
290
12
|
|
|
291
|
-
|
|
292
|
-
Phases executed this run: <comma-separated list>
|
|
13
|
+
Verify runId/change match. Preserve context.specs, selected roots, backlog identity and ownership. The artifact compatibility root is `${SPECRAILS_REPO_DIR:-.}`, not necessarily the framework workspace.
|
|
293
14
|
|
|
294
|
-
|
|
295
|
-
|--------------|---------|
|
|
296
|
-
| architect | done |
|
|
297
|
-
| developer | done |
|
|
298
|
-
| reviewer | done |
|
|
299
|
-
| ship | done |
|
|
300
|
-
| ci | done |
|
|
301
|
-
```
|
|
15
|
+
## Resume earliest invalid evidence
|
|
302
16
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
**If any phase failed**, add:
|
|
17
|
+
Follow resumePhase and receipt reasons. Completed valid phases require no model call. Blocked/failed is resumable; never convert dependent implementation into skipped. Explicit --from can reopen an earlier phase, but runtime prerequisite checks still apply.
|
|
306
18
|
|
|
19
|
+
```bash
|
|
20
|
+
node "${SPECRAILS_PIPELINE_RUNTIME:-.specrails/runtime/pipeline.mjs}" phase --phase <phase> --status running
|
|
307
21
|
```
|
|
308
|
-
## Failures
|
|
309
22
|
|
|
310
|
-
| Phase
|
|
311
|
-
|
|
312
|
-
|
|
|
23
|
+
| Phase | Resume action |
|
|
24
|
+
|-------|---------------|
|
|
25
|
+
| architect | Repair official design artifacts/confidence; unblock development only after actual gate passes. |
|
|
26
|
+
| developer | Continue unchecked tasks, retain completed code; scoped repairs followed by one full receipt. |
|
|
27
|
+
| reviewer | Review acceptance/confidence; reuse current full evidence, refresh after edits. Do not redo valid architecture because review was blocked. |
|
|
28
|
+
| archive | Fresh archive-check, then authorized official archive/sync only; preserve approved confidence bytes. |
|
|
29
|
+
| ship | Only Core-owned and authorized; resume missing repository delivery without duplicating successful commits/PRs. |
|
|
30
|
+
| ci | Check existing delivery; never reship merely because CI needs retry. |
|
|
313
31
|
|
|
314
|
-
|
|
315
|
-
- To retry from the failed phase: /specrails:retry <FEATURE_NAME> --from <failed-phase>
|
|
316
|
-
- To see all pipeline states: /specrails:retry --list
|
|
317
|
-
- To restart from scratch: /specrails:implement <original-input>
|
|
318
|
-
```
|
|
32
|
+
Only host-owned ship/ci may skip. Actual done clears old reason; failed/blocked records concrete remaining work. Reopening invalidates dependent completion.
|
|
319
33
|
|
|
320
|
-
|
|
34
|
+
## Evidence and report
|
|
321
35
|
|
|
322
|
-
|
|
36
|
+
Use the implement contracts for command receipts, foreground worker completion and exact repository routing. Receipt validity plus required command coverage permits reuse; baseline-only or stale evidence does not. Preview apply must check base/cache and execute checks on actual applied source.
|
|
323
37
|
|
|
324
|
-
|
|
325
|
-
|-------|-----------|------------|
|
|
326
|
-
| architect | **Yes** | Stop — cannot proceed without OpenSpec artifacts |
|
|
327
|
-
| developer | **Yes** | Stop — cannot proceed without implemented files |
|
|
328
|
-
| reviewer | No | Report findings, continue to ship |
|
|
329
|
-
| ship | **Yes** | Stop — report failure with git/PR context |
|
|
330
|
-
| ci | **Yes** | Stop — report failure with CI log and fix suggestions |
|
|
38
|
+
Confidence, acceptance and archive approval precede delivery. Preserve host-owned Git/worktrees/backlog. Return current state, reused/new evidence and per-repository outcomes. If all phases remain valid, report completion without rerunning.
|
|
@@ -1,43 +1,31 @@
|
|
|
1
|
-
description = "
|
|
1
|
+
description = "Aggregate batch implementation with one durable journal and final candidate gates."
|
|
2
2
|
|
|
3
3
|
prompt = '''
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
0. **Bootstrap.** Confirm `pwd` is the git repo root. Resolve the ticket list
|
|
32
|
-
(explicit ids, or `--status`/`--priority` filters over `.specrails/local-tickets.json`).
|
|
33
|
-
|
|
34
|
-
1. **Per ticket, in order, run the three-phase pipeline at depth 1:**
|
|
35
|
-
a. `invoke_agent` `sr-architect` → creates + validates the OpenSpec change.
|
|
36
|
-
If `BLOCKED`, record the failure and move to the next ticket.
|
|
37
|
-
b. `invoke_agent` `sr-developer` → applies the change (implements + checks off tasks).
|
|
38
|
-
c. `invoke_agent` `sr-reviewer` → validates; on pass, `openspec archive <id> -y`.
|
|
39
|
-
d. Update the ticket to `done` (or record the failure verdict).
|
|
40
|
-
|
|
41
|
-
2. **Aggregate.** After all tickets, report a single table: ticket, change id,
|
|
42
|
-
verdict (done / blocked / failed), with a one-line reason for non-done ones.
|
|
4
|
+
Resolve all target IDs or filters and freeze their complete descriptions,
|
|
5
|
+
acceptance criteria and repository IDs. With a host context preserve context.specs
|
|
6
|
+
unchanged. Resolve source/artifact/backlog roots explicitly; cwd can be external.
|
|
7
|
+
|
|
8
|
+
Initialize ONE aggregate OpenSpec change and journal for this runId. Never create
|
|
9
|
+
per-ticket child changes/journals with the same context. Read
|
|
10
|
+
`.gemini/commands/specrails/implement.toml` and apply its capability preflight,
|
|
11
|
+
explicit invoke_agent(agent_name,prompt) handoff, progress-bound continuation and
|
|
12
|
+
gates to the whole batch:
|
|
13
|
+
|
|
14
|
+
1. One architect designs all tickets, groups tasks by ticket/repository and
|
|
15
|
+
dependency order, validates OpenSpec and high/medium design confidence.
|
|
16
|
+
2. One developer implements groups sequentially, persisting progress in tasks.md.
|
|
17
|
+
Use scoped checks per group and one full helper verification for the aggregate
|
|
18
|
+
candidate before developer done. Incomplete groups remain retriable.
|
|
19
|
+
3. One reviewer checks every acceptance criterion and cross-ticket interaction;
|
|
20
|
+
pass all frozen specs, changed paths and the full receipt. Ordinary review
|
|
21
|
+
never archives. At most one exact-findings developer repair plus re-review.
|
|
22
|
+
4. After clean semantic reviewer done, run archive-check; only success authorizes
|
|
23
|
+
reviewer archive-only mode. Verify the archive and record archive done. Only
|
|
24
|
+
then close ALL Core-owned tickets, or report results to the owning host.
|
|
25
|
+
|
|
26
|
+
Run these roles directly at root, no nested implement coordinator. Retry resumes
|
|
27
|
+
this aggregate journal without repeating valid phases. A --parallel preference
|
|
28
|
+
never overrides host ownership, unknown capacity or overlapping mutation paths;
|
|
29
|
+
use sequential execution and report it honestly. Final output lists each ticket,
|
|
30
|
+
aggregate verification/archive status and unresolved task groups; no partial done.
|
|
43
31
|
'''
|
|
@@ -1,117 +1,58 @@
|
|
|
1
|
-
description = "Implementation
|
|
1
|
+
description = "Implementation with durable phase checkpoints and explicit Gemini role handoffs."
|
|
2
2
|
|
|
3
3
|
prompt = '''
|
|
4
|
-
You are the
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## Pipeline
|
|
60
|
-
|
|
61
|
-
0. **Bootstrap.** The source repo (with `openspec/**` and `.git`) lives at
|
|
62
|
-
`${SPECRAILS_REPO_DIR:-.}` — when `SPECRAILS_REPO_DIR` is unset it defaults to
|
|
63
|
-
`.`, i.e. your current directory is the repo (classic behaviour). Confirm the
|
|
64
|
-
repo root with `git -C "${SPECRAILS_REPO_DIR:-.}" rev-parse --show-toplevel`,
|
|
65
|
-
then load the ticket from `.specrails/local-tickets.json` (run-state — relative
|
|
66
|
-
to the working directory, NOT the repo). Then go STRAIGHT to phase 1 — do not
|
|
67
|
-
analyse, design, scaffold, or write anything yourself; the architect does that.
|
|
68
|
-
|
|
69
|
-
1. **DESIGN — `invoke_agent` `sr-architect`.** Pass it the ticket/description.
|
|
70
|
-
It creates an OpenSpec change (proposal + spec deltas + tasks) under
|
|
71
|
-
`${SPECRAILS_REPO_DIR:-.}/openspec/changes/<id>/` and validates it
|
|
72
|
-
(`openspec validate <id> --strict`).
|
|
73
|
-
Apply the outcome rules above.
|
|
74
|
-
|
|
75
|
-
**Design confidence gate.** Read
|
|
76
|
-
`${SPECRAILS_REPO_DIR:-.}/openspec/changes/<id>/design-confidence.json`
|
|
77
|
-
(written by the architect). Missing → warn and proceed (backward
|
|
78
|
-
compatible). `high`/`medium` → proceed. `low` → STOP before phase 2 and
|
|
79
|
-
report `BLOCKED: design confidence low — <blocking_question>`; tell the
|
|
80
|
-
user to answer the question in the ticket and re-run. Do NOT update the
|
|
81
|
-
ticket, do NOT invoke the developer — implementation must never run on a
|
|
82
|
-
design the architect does not trust.
|
|
83
|
-
|
|
84
|
-
2. **APPLY — `invoke_agent` `sr-developer`.** Only after the architect reports
|
|
85
|
-
back. It implements the tasks in TDD order and checks them off in `tasks.md`.
|
|
86
|
-
Apply the outcome rules — on `MAX_TURNS`, re-invoke to RESUME until every task
|
|
87
|
-
is checked off. Do NOT write, fix, rename, or run code or tests yourself, even
|
|
88
|
-
when doing it inline would be faster — that is the developer's job.
|
|
89
|
-
|
|
90
|
-
3. **REVIEW — `invoke_agent` `sr-reviewer`.** Only after the developer reports
|
|
91
|
-
back. It validates the change, runs the project checks, confirms the spec is
|
|
92
|
-
met, and — on a pass — archives the change. Read its verdict:
|
|
93
|
-
- **PASS / approved** → it archives as part of its phase; go to step 4.
|
|
94
|
-
- **CHANGES REQUESTED / fail / rejected** → do NOT archive. Re-`invoke_agent`
|
|
95
|
-
`sr-developer`, handing it the reviewer's EXACT findings, to fix them; then
|
|
96
|
-
re-`invoke_agent` `sr-reviewer`. Repeat this fix↔review loop up to **3×**.
|
|
97
|
-
- Otherwise apply the outcome rules (`BLOCKED` → stop; `MAX_TURNS` → resume
|
|
98
|
-
the reviewer).
|
|
99
|
-
If the reviewer has still not passed after 3 fix rounds, STOP and report
|
|
100
|
-
`BLOCKED: review not passing — <outstanding findings>`. You are FORBIDDEN from
|
|
101
|
-
running `openspec archive` (or moving files) to get past a failing, missing,
|
|
102
|
-
or ambiguous review: the reviewer's PASS is the ONLY gate to archive.
|
|
103
|
-
|
|
104
|
-
4. **ARCHIVE (verify only).** Confirm the change moved under
|
|
105
|
-
`${SPECRAILS_REPO_DIR:-.}/openspec/changes/archive/`. If the reviewer PASSED but the change was somehow
|
|
106
|
-
not archived, re-`invoke_agent` `sr-reviewer` to complete it. Never archive by
|
|
107
|
-
hand to substitute for the reviewer.
|
|
108
|
-
|
|
109
|
-
5. **Verify delegation, then close.** Before declaring success, check your OWN
|
|
110
|
-
transcript: it MUST contain a real `invoke_agent sr-architect`, `invoke_agent
|
|
111
|
-
sr-developer`, AND `invoke_agent sr-reviewer` call (plus any resume/fix
|
|
112
|
-
re-invokes). If ANY of the three is missing, you bypassed the pipeline — STOP
|
|
113
|
-
and report `BLOCKED: pipeline bypassed — <agent> was never invoked`, NOT
|
|
114
|
-
success. Otherwise update `.specrails/local-tickets.json` (status `done`)
|
|
115
|
-
unless this was a free-form run, and report concisely: ticket, change id,
|
|
116
|
-
final verdict, and how many resume/fix loops ran.
|
|
4
|
+
You are the implement orchestrator. Delegate role work to `invoke_agent` using
|
|
5
|
+
only its supported fields: `agent_name` and `prompt`. Do not claim session-based
|
|
6
|
+
resume: each invocation may start a fresh executor and conversation.
|
|
7
|
+
|
|
8
|
+
For multiple ticket IDs, read `.gemini/commands/specrails/batch-implement.toml`
|
|
9
|
+
and execute it at this root with the same context; do not ask the user to resend.
|
|
10
|
+
For one ticket or free-form input, use the stages below.
|
|
11
|
+
|
|
12
|
+
0. Preflight: require the named sr-architect, sr-developer and sr-reviewer tools,
|
|
13
|
+
and readable `.gemini/skills/openspec-{ff,apply,archive}-change/SKILL.md` in
|
|
14
|
+
the execution workspace. Roles must expose `activate_skill`. If a capability
|
|
15
|
+
is absent, record blocked with the exact missing role/skill and request Core
|
|
16
|
+
refresh; do not silently switch to a generic agent or implement inline.
|
|
17
|
+
Resolve `${SPECRAILS_REPO_DIR:-.}` only as a legacy fallback. The shared helper
|
|
18
|
+
returns the actual repositories, artifactRoot and frozen ticket descriptions.
|
|
19
|
+
|
|
20
|
+
1. DESIGN: record architect running, invoke sr-architect with an explicit prompt
|
|
21
|
+
containing runId, phase, current ticket/full frozen acceptance criteria,
|
|
22
|
+
repository IDs and absolute roots, artifactRoot, change slug and prior artifact
|
|
23
|
+
paths. Require validated OpenSpec proposal/design/specs/tasks and a non-low
|
|
24
|
+
design-confidence.json. Missing confidence is blocked, never implicit success.
|
|
25
|
+
Record architect done only after those checks.
|
|
26
|
+
|
|
27
|
+
2. APPLY: record developer running; invoke sr-developer with the SAME scope plus
|
|
28
|
+
change slug, plan/tasks paths, unfinished tasks, prior findings and next action.
|
|
29
|
+
Developer runs verification through the managed helper to produce a candidate-
|
|
30
|
+
bound full receipt. Unchecked tasks or missing implementation block handoff,
|
|
31
|
+
even when unrelated baseline tests pass. Record developer done after evidence.
|
|
32
|
+
|
|
33
|
+
3. REVIEW: invoke sr-reviewer with the complete explicit handoff, changed files,
|
|
34
|
+
verification receipt and acceptance criteria. Ordinary review must NOT archive.
|
|
35
|
+
Require its semantic verdict and confidence artifact; PASS alone without these
|
|
36
|
+
artifacts is insufficient. On changes requested, give the exact findings to
|
|
37
|
+
developer and re-review, with at most one fix round. Record reviewer done only
|
|
38
|
+
for a clean semantic result. Preserve blockers and incomplete work for retry.
|
|
39
|
+
|
|
40
|
+
4. ARCHIVE: run `archive-check`; only success permits a new sr-reviewer invocation
|
|
41
|
+
with ARCHIVE_ONLY=true and ARCHIVE_AUTHORIZED=true plus the same handoff. Verify
|
|
42
|
+
that the active change is gone and its archive exists, then record archive done.
|
|
43
|
+
If the combined gate or archive fails, leave the ticket open and record failure.
|
|
44
|
+
Only Core-owned backlog may be updated to done; hosted runs report to Desktop.
|
|
45
|
+
|
|
46
|
+
For EVERY invocation: `MAX_TURNS`, timeout, missing verdict, or early return is
|
|
47
|
+
incomplete work. Read the on-disk checkpoint and compare task/file/evidence
|
|
48
|
+
progress, then re-invoke the SAME role with an updated explicit prompt. At most
|
|
49
|
+
two continuations per phase, and stop earlier when no progress was recorded.
|
|
50
|
+
Never substitute orchestration memory for the handoff. Native turn limits are
|
|
51
|
+
optional capabilities: use only fields accepted by the installed loader; if
|
|
52
|
+
unknown, retain its defaults and use these bounded continuations.
|
|
53
|
+
|
|
54
|
+
Record all stage outcomes with the shared helper, including blocked/failed.
|
|
55
|
+
Retry reads that journal, not legacy .gemini/pipeline-state prose snapshots.
|
|
56
|
+
Report actual phase outcomes and evidence; never equate tool completion with
|
|
57
|
+
implemented behavior or close after an ambiguous review.
|
|
117
58
|
'''
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
description = "Resume incomplete Gemini phases from the shared executable journal."
|
|
2
|
+
|
|
3
|
+
prompt = '''
|
|
4
|
+
Call the installed pipeline helper `status` for the requested change and run.
|
|
5
|
+
Use its `context`, `resumePhase`, phases and verification to select the earliest
|
|
6
|
+
invalid phase. If legacy artifacts have no journal, initialize without deleting
|
|
7
|
+
work and validate each claimed completed phase before recording it.
|
|
8
|
+
|
|
9
|
+
Read `.gemini/commands/specrails/implement.toml` and drive its remaining role
|
|
10
|
+
stages directly through invoke_agent(agent_name, prompt). Do not spawn another
|
|
11
|
+
implement orchestrator. Every call starts with the full bounded handoff including
|
|
12
|
+
frozen acceptance criteria, all repository paths, artifactRoot, change/plan/tasks,
|
|
13
|
+
last result and next action. Do not assume native session continuity or `.gemini`
|
|
14
|
+
legacy pipeline-state files. A blocked phase is retriable, not intentionally skipped.
|
|
15
|
+
|
|
16
|
+
Do not repeat completed valid design/development after a reviewer failure. If
|
|
17
|
+
review actually requires code changes, record developer running and pass the exact
|
|
18
|
+
findings. Follow the same progress-bound continuation and one-round repair limits.
|
|
19
|
+
Archive-check must succeed before reviewer archive-only authorization. Preserve
|
|
20
|
+
host ownership and report unresolved work honestly with its durable resume point.
|
|
21
|
+
'''
|