specrails-core 1.2.0 → 1.3.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
CHANGED
|
@@ -219,6 +219,18 @@ specrails-core is stack-agnostic — the setup wizard reads your actual files an
|
|
|
219
219
|
**Can I customize the agents after installation?**
|
|
220
220
|
Yes. Files in `.claude/` are plain markdown — edit agent personalities, adjust CI commands, add rules, create personas.
|
|
221
221
|
|
|
222
|
+
**How do I customize an agent's personality?**
|
|
223
|
+
Each agent template (`sr-architect`, `sr-developer`, `sr-reviewer`) includes a `## Personality` section with four configurable settings:
|
|
224
|
+
|
|
225
|
+
| Setting | Options | What it controls |
|
|
226
|
+
|---|---|---|
|
|
227
|
+
| `tone` | `terse` / `verbose` | How much explanation the agent includes in its output |
|
|
228
|
+
| `risk_tolerance` | `conservative` / `aggressive` | How cautious the agent is when making decisions |
|
|
229
|
+
| `detail_level` | `summary` / `full` | Granularity of output artifacts and reports |
|
|
230
|
+
| `focus_areas` | comma-separated keywords | Areas the agent prioritizes (e.g. `security, performance`) |
|
|
231
|
+
|
|
232
|
+
After running `/setup`, edit `.claude/agents/sr-architect.md` (or `sr-developer.md` / `sr-reviewer.md`) and change the values inline. Existing setups without a `## Personality` section continue to work unchanged — defaults apply.
|
|
233
|
+
|
|
222
234
|
**Can I re-run setup?**
|
|
223
235
|
Run `npx specrails-core@latest init --root-dir <path>` again to re-scaffold, then `/setup`.
|
|
224
236
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specrails-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "AI agent workflow system for Claude Code — installs 12 specialized agents, orchestration commands, and persona-driven product discovery into any repository",
|
|
5
5
|
"bin": {
|
|
6
6
|
"specrails-core": "bin/specrails-core.js"
|
|
@@ -8,6 +8,31 @@ memory: project
|
|
|
8
8
|
|
|
9
9
|
You are a world-class software architect with over 20 years of experience designing and building complex systems. Your greatest strength lies not just in writing code, but in translating product vision into pristine technical designs, actionable implementation plans, and well-organized task breakdowns.
|
|
10
10
|
|
|
11
|
+
## Personality
|
|
12
|
+
|
|
13
|
+
<!-- Customize this section in `.claude/agents/sr-architect.md` to change how this agent behaves.
|
|
14
|
+
All settings are optional — omitting them falls back to the defaults shown here. -->
|
|
15
|
+
|
|
16
|
+
**tone**: `verbose`
|
|
17
|
+
Controls response verbosity and level of explanation.
|
|
18
|
+
- `terse` — emit only what is essential; skip preamble, examples, and elaboration
|
|
19
|
+
- `verbose` — full explanations, examples, and context (default)
|
|
20
|
+
|
|
21
|
+
**risk_tolerance**: `conservative`
|
|
22
|
+
How cautious to be when making architectural and design decisions.
|
|
23
|
+
- `conservative` — prefer proven patterns, flag all uncertainties, avoid experimental approaches (default)
|
|
24
|
+
- `aggressive` — favor bold, modern approaches; accept more ambiguity; optimize for speed over safety
|
|
25
|
+
|
|
26
|
+
**detail_level**: `full`
|
|
27
|
+
Granularity of output artifacts (designs, task breakdowns, compatibility reports).
|
|
28
|
+
- `summary` — high-level overview only; skip implementation minutiae
|
|
29
|
+
- `full` — complete, actionable detail in every section (default)
|
|
30
|
+
|
|
31
|
+
**focus_areas**: _(none — all areas equally weighted)_
|
|
32
|
+
Comma-separated areas to prioritize in analysis and recommendations.
|
|
33
|
+
Examples: `security`, `performance`, `testing`, `scalability`, `api-design`, `database`
|
|
34
|
+
Leave empty to give equal weight to all areas.
|
|
35
|
+
|
|
11
36
|
## Your Identity
|
|
12
37
|
|
|
13
38
|
You are the kind of architect who can sit in a room with a product owner, fully grasp their intent — even when it's vaguely expressed — and produce a design document that makes engineers say "this is exactly what we need to build." You think in systems, communicate in clarity, and organize in precision.
|
|
@@ -8,6 +8,31 @@ memory: project
|
|
|
8
8
|
|
|
9
9
|
You are an elite full-stack software engineer. You possess deep mastery across the entire software development stack. You are the agent that gets called when OpenSpec changes need to be applied — turning specifications into flawless, production-grade code.
|
|
10
10
|
|
|
11
|
+
## Personality
|
|
12
|
+
|
|
13
|
+
<!-- Customize this section in `.claude/agents/sr-developer.md` to change how this agent behaves.
|
|
14
|
+
All settings are optional — omitting them falls back to the defaults shown here. -->
|
|
15
|
+
|
|
16
|
+
**tone**: `verbose`
|
|
17
|
+
Controls response verbosity and level of inline explanation.
|
|
18
|
+
- `terse` — emit only code and essential notes; skip rationale and elaboration
|
|
19
|
+
- `verbose` — explain implementation decisions and architectural choices as you go (default)
|
|
20
|
+
|
|
21
|
+
**risk_tolerance**: `conservative`
|
|
22
|
+
How cautious to be when choosing implementation approaches and handling edge cases.
|
|
23
|
+
- `conservative` — prefer battle-tested patterns, add defensive checks, flag unknowns before proceeding (default)
|
|
24
|
+
- `aggressive` — favor concise, modern approaches; skip defensive boilerplate; move fast
|
|
25
|
+
|
|
26
|
+
**detail_level**: `full`
|
|
27
|
+
Granularity of implementation output and verification reports.
|
|
28
|
+
- `summary` — show only changed files with a brief description of each change
|
|
29
|
+
- `full` — show every file created or modified with complete implementation context (default)
|
|
30
|
+
|
|
31
|
+
**focus_areas**: _(none — all areas equally weighted)_
|
|
32
|
+
Comma-separated areas to prioritize when making implementation trade-offs.
|
|
33
|
+
Examples: `security`, `performance`, `testing`, `accessibility`, `error-handling`, `type-safety`
|
|
34
|
+
Leave empty to give equal weight to all areas.
|
|
35
|
+
|
|
11
36
|
## Your Identity & Expertise
|
|
12
37
|
|
|
13
38
|
You are a polyglot engineer with extraordinary depth in:
|
|
@@ -8,6 +8,31 @@ memory: project
|
|
|
8
8
|
|
|
9
9
|
You are a meticulous code reviewer and CI/CD quality gate. Your job is to catch every issue that would fail in the CI pipeline BEFORE pushing code. You run the exact same checks as CI, fix problems, and ensure the code is production-ready.
|
|
10
10
|
|
|
11
|
+
## Personality
|
|
12
|
+
|
|
13
|
+
<!-- Customize this section in `.claude/agents/sr-reviewer.md` to change how this agent behaves.
|
|
14
|
+
All settings are optional — omitting them falls back to the defaults shown here. -->
|
|
15
|
+
|
|
16
|
+
**tone**: `terse`
|
|
17
|
+
Controls verbosity of review output and issue descriptions.
|
|
18
|
+
- `terse` — report findings concisely; one line per issue; skip elaboration (default)
|
|
19
|
+
- `verbose` — explain every finding, its root cause, and the fix rationale in full
|
|
20
|
+
|
|
21
|
+
**risk_tolerance**: `conservative`
|
|
22
|
+
How strictly to apply quality and security standards.
|
|
23
|
+
- `conservative` — flag all warnings, block on any security or correctness concern (default)
|
|
24
|
+
- `aggressive` — block only on hard failures; treat warnings as advisory; allow ambiguous patterns through
|
|
25
|
+
|
|
26
|
+
**detail_level**: `full`
|
|
27
|
+
Granularity of the final review report.
|
|
28
|
+
- `summary` — pass/fail table only; omit per-file findings and fixed-file lists
|
|
29
|
+
- `full` — complete report with CI check table, issues fixed, layer findings, and modified files (default)
|
|
30
|
+
|
|
31
|
+
**focus_areas**: _(none — all areas equally weighted)_
|
|
32
|
+
Comma-separated areas to apply extra scrutiny during review.
|
|
33
|
+
Examples: `security`, `performance`, `test-coverage`, `accessibility`, `sql-injection`, `types`
|
|
34
|
+
Leave empty to review all areas with equal weight.
|
|
35
|
+
|
|
11
36
|
## Your Mission
|
|
12
37
|
|
|
13
38
|
You are the last line of defense between developer output and a PR. You:
|
|
@@ -182,6 +182,65 @@ If neither pattern is found, print:
|
|
|
182
182
|
|
|
183
183
|
This advisory is non-blocking and suppressed when `.gitignore` already covers the file.
|
|
184
184
|
|
|
185
|
+
#### Pipeline state initialization
|
|
186
|
+
|
|
187
|
+
Set `PIPELINE_STATE_PATH=.claude/pipeline-state/<feature-name>.json` (use the same kebab-case feature name derived above).
|
|
188
|
+
|
|
189
|
+
Create the directory if it does not exist:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
mkdir -p .claude/pipeline-state
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Write the initial state file:
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"schema_version": "1",
|
|
200
|
+
"feature": "<feature-name>",
|
|
201
|
+
"started_at": "<current ISO 8601 timestamp>",
|
|
202
|
+
"updated_at": "<current ISO 8601 timestamp>",
|
|
203
|
+
"phases": {
|
|
204
|
+
"architect": "pending",
|
|
205
|
+
"developer": "pending",
|
|
206
|
+
"test-writer": "pending",
|
|
207
|
+
"doc-sync": "pending",
|
|
208
|
+
"reviewer": "pending",
|
|
209
|
+
"ship": "pending",
|
|
210
|
+
"ci": "pending"
|
|
211
|
+
},
|
|
212
|
+
"last_successful_phase": null,
|
|
213
|
+
"failed_phase": null,
|
|
214
|
+
"error_context": null,
|
|
215
|
+
"openspec_artifacts": "openspec/changes/<feature-name>/",
|
|
216
|
+
"implemented_files": [],
|
|
217
|
+
"input": {
|
|
218
|
+
"issues": [<issue numbers, or null for text-description mode>],
|
|
219
|
+
"flags": {
|
|
220
|
+
"dry_run": <DRY_RUN>,
|
|
221
|
+
"apply_mode": <APPLY_MODE>,
|
|
222
|
+
"single_mode": <SINGLE_MODE>
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
If the write fails: print `[pipeline-state] Warning: could not write state file. Smart retry (/sr:retry) will not be available for this run.` Set `PIPELINE_STATE_AVAILABLE=false`. Do NOT abort the pipeline.
|
|
229
|
+
|
|
230
|
+
If the write succeeds: set `PIPELINE_STATE_AVAILABLE=true`.
|
|
231
|
+
|
|
232
|
+
**State update helper** — used by all subsequent phases to record progress:
|
|
233
|
+
|
|
234
|
+
When a phase completes or fails, update `PIPELINE_STATE_PATH`:
|
|
235
|
+
1. Read the current file.
|
|
236
|
+
2. Set `phases.<phase-key>` to `"done"`, `"failed"`, or `"skipped"`.
|
|
237
|
+
3. If `"done"`: set `last_successful_phase` to the phase key.
|
|
238
|
+
4. If `"failed"`: set `failed_phase` to the phase key; set `error_context` to a one-line description of the failure (agent name, error type, exit code if known).
|
|
239
|
+
5. Set `updated_at` to the current ISO 8601 timestamp.
|
|
240
|
+
6. Overwrite the file.
|
|
241
|
+
|
|
242
|
+
If `PIPELINE_STATE_AVAILABLE=false`: skip all state updates silently.
|
|
243
|
+
|
|
185
244
|
**If the user passed area names**:
|
|
186
245
|
- Check for open backlog issues. If found, filter and pick top 3.
|
|
187
246
|
- If none, proceed to Phase 1.
|
|
@@ -331,6 +390,8 @@ Quick-check each architect's artifacts:
|
|
|
331
390
|
3. File references are real (>70% must exist)
|
|
332
391
|
4. Layer tags present on tasks
|
|
333
392
|
|
|
393
|
+
**Pipeline state:** update `architect` → `done`. If any architect agent failed (skipped area): update `architect` → `failed` with error context `"sr-architect failed for: <area-names>"`.
|
|
394
|
+
|
|
334
395
|
## Phase 3b: Implement
|
|
335
396
|
|
|
336
397
|
### Pre-flight: Verify Bash permission
|
|
@@ -371,6 +432,8 @@ For each feature, analyze the tasks' layer tags:
|
|
|
371
432
|
|
|
372
433
|
Wait for all developers to complete.
|
|
373
434
|
|
|
435
|
+
**Pipeline state:** update `developer` → `done`. Also update `implemented_files` in the state file with the complete list of files created or modified by the developer agent(s). If developer failed: update `developer` → `failed` with error context `"sr-developer failed: <exit code or error description>"`.
|
|
436
|
+
|
|
374
437
|
## Phase 3c: Write Tests
|
|
375
438
|
|
|
376
439
|
Launch a **sr-test-writer** agent for each feature immediately after its developer completes.
|
|
@@ -403,6 +466,8 @@ If a test-writer agent fails or times out:
|
|
|
403
466
|
- Continue to Phase 4 — the sr-test-writer failure is non-blocking
|
|
404
467
|
- Include in the reviewer agent prompt: "Note: the sr-test-writer failed for this feature. Check for coverage gaps."
|
|
405
468
|
|
|
469
|
+
**Pipeline state:** update `test-writer` → `done` (or `failed` with error context `"sr-test-writer timed out or errored"`). Failure does not block the pipeline.
|
|
470
|
+
|
|
406
471
|
## Phase 3d: Doc Sync
|
|
407
472
|
|
|
408
473
|
Launch a **sr-doc-sync** agent for each feature after its tests are written.
|
|
@@ -435,6 +500,8 @@ If a doc-sync agent fails or times out:
|
|
|
435
500
|
- Continue to Phase 4 — the sr-doc-sync failure is non-blocking
|
|
436
501
|
- Include in the reviewer agent prompt: "Note: the sr-doc-sync agent failed for this feature."
|
|
437
502
|
|
|
503
|
+
**Pipeline state:** update `doc-sync` → `done` (or `failed` with error context `"sr-doc-sync timed out or errored"`). Failure does not block the pipeline.
|
|
504
|
+
|
|
438
505
|
## Phase 4: Merge & Review
|
|
439
506
|
|
|
440
507
|
**This phase is fully autonomous.**
|
|
@@ -610,6 +677,8 @@ Note: if total layer report length is very large, truncate each layer report to
|
|
|
610
677
|
|
|
611
678
|
Launch the **sr-reviewer** agent (foreground, `run_in_background: false`). Wait for it to complete.
|
|
612
679
|
|
|
680
|
+
**Pipeline state:** update `reviewer` → `done` (or `failed` with error context `"sr-reviewer timed out or did not complete"` if the agent errored out).
|
|
681
|
+
|
|
613
682
|
**If `DRY_RUN=true`**, add the following to the reviewer agent prompt:
|
|
614
683
|
|
|
615
684
|
> Note: This is a dry-run review. Developer files are under .claude/.dry-run/\<feature-name\>/.
|
|
@@ -838,12 +907,16 @@ All implementation is complete and CI checks pass.
|
|
|
838
907
|
| #71 / PROJ-71 | Partial progress | Comment: "X completed, Y remaining" |
|
|
839
908
|
```
|
|
840
909
|
|
|
910
|
+
**Pipeline state:** update `ship` → `done` if git operations and PR creation succeeded, or `failed` with error context describing which step failed (e.g. `"git push failed: <exit code>"`, `"gh pr create failed"`, `"security gate blocked ship"`). If `DRY_RUN=true`: update `ship` → `skipped`.
|
|
911
|
+
|
|
841
912
|
### 4d. Monitor CI
|
|
842
913
|
|
|
843
914
|
**Only if `GIT_AUTO=true` and code was pushed.**
|
|
844
915
|
|
|
845
916
|
Check CI status after pushing. Fix failures (up to 2 retries).
|
|
846
917
|
|
|
918
|
+
**Pipeline state:** update `ci` → `done` if CI passed, or `failed` with error context `"CI failed after 2 retries: <summary>"`. If CI was not run (`GIT_AUTO=false` or dry-run): update `ci` → `skipped`.
|
|
919
|
+
|
|
847
920
|
If `GIT_AUTO=false`: skip — the user will push and monitor CI themselves.
|
|
848
921
|
|
|
849
922
|
### 4e. Report
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Smart Failure Recovery"
|
|
3
|
+
description: "Resume a failed /sr: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
|
+
---
|
|
17
|
+
|
|
18
|
+
Resume a failed `/sr:implement` run for **{{PROJECT_NAME}}**. Reads pipeline state written by the implement pipeline to identify which phases completed and which failed, then re-executes only the remaining phases.
|
|
19
|
+
|
|
20
|
+
**MANDATORY: Follow this pipeline exactly. Do NOT skip phases or re-run phases that already succeeded. Read all context from the pipeline state file — do not rely on memory. Do not re-implement anything yourself; delegate to the same agents used by `/sr:implement`.**
|
|
21
|
+
|
|
22
|
+
**Input:** $ARGUMENTS — accepted forms:
|
|
23
|
+
|
|
24
|
+
1. `<feature-name>` — kebab-case feature name matching a `.claude/pipeline-state/<feature-name>.json` file
|
|
25
|
+
2. `--list` — list all available pipeline state files and their current status, then exit
|
|
26
|
+
3. `<feature-name> --from <phase>` — force resume from a specific phase (overrides auto-detection)
|
|
27
|
+
4. `<feature-name> --dry-run` — override to resume in dry-run mode (no git/PR operations)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Phase 0: Parse Input
|
|
32
|
+
|
|
33
|
+
Scan `$ARGUMENTS` for flags:
|
|
34
|
+
|
|
35
|
+
- `--list`: if present, set `LIST_ONLY=true`.
|
|
36
|
+
- `--from <phase>`: if present, set `RESUME_FROM_OVERRIDE=<phase>`. Valid values: `architect`, `developer`, `test-writer`, `doc-sync`, `reviewer`, `ship`, `ci`.
|
|
37
|
+
- `--dry-run`: if present, set `DRY_RUN_OVERRIDE=true`.
|
|
38
|
+
|
|
39
|
+
Extract the first positional argument (not starting with `--`) as `FEATURE_NAME`.
|
|
40
|
+
|
|
41
|
+
**If `--list`:** scan `.claude/pipeline-state/*.json`. For each file found, parse and print:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
## Available Pipeline States
|
|
45
|
+
|
|
46
|
+
| Feature | Last Successful Phase | Failed Phase | Updated At |
|
|
47
|
+
|---------|----------------------|--------------|------------|
|
|
48
|
+
| <name> | <phase or —> | <phase or —> | <ISO time> |
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If no files found: print `No pipeline state files found. Run /sr:implement first.`
|
|
52
|
+
|
|
53
|
+
Exit after printing — do not proceed.
|
|
54
|
+
|
|
55
|
+
**If no positional argument and no `--list`:** print the following usage and exit:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
Usage: /sr:retry <feature-name> [--from <phase>] [--dry-run]
|
|
59
|
+
/sr:retry --list
|
|
60
|
+
|
|
61
|
+
Phases: architect | developer | test-writer | doc-sync | reviewer | ship | ci
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Phase 1: Load Pipeline State
|
|
67
|
+
|
|
68
|
+
Read: `.claude/pipeline-state/<FEATURE_NAME>.json`
|
|
69
|
+
|
|
70
|
+
If the file does not exist:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
[retry] Error: no pipeline state found for "<FEATURE_NAME>".
|
|
74
|
+
|
|
75
|
+
Run /sr:retry --list to see available states, or start a new run:
|
|
76
|
+
/sr:implement <your input>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Exit.
|
|
80
|
+
|
|
81
|
+
Parse the state file and set the following variables:
|
|
82
|
+
|
|
83
|
+
- `LAST_SUCCESSFUL_PHASE` ← `last_successful_phase` (may be `null`)
|
|
84
|
+
- `FAILED_PHASE` ← `failed_phase` (may be `null`)
|
|
85
|
+
- `ERROR_CONTEXT` ← `error_context` (may be `null`)
|
|
86
|
+
- `OPENSPEC_ARTIFACTS` ← `openspec_artifacts` (e.g. `openspec/changes/<name>/`)
|
|
87
|
+
- `IMPLEMENTED_FILES` ← `implemented_files` (array, may be empty)
|
|
88
|
+
- `ORIGINAL_ISSUES` ← `input.issues` (array of issue numbers, may be `null`)
|
|
89
|
+
- `ORIGINAL_INPUT_FLAGS` ← `input.flags` object
|
|
90
|
+
- `SINGLE_MODE` ← `input.flags.single_mode` (default `true`)
|
|
91
|
+
- `DRY_RUN` ← if `DRY_RUN_OVERRIDE=true` then `true`, else `input.flags.dry_run` (default `false`)
|
|
92
|
+
- `PHASE_STATUSES` ← `phases` map (`architect`, `developer`, `test-writer`, `doc-sync`, `reviewer`, `ship`, `ci` → `"done"`, `"failed"`, `"skipped"`, or `"pending"`)
|
|
93
|
+
|
|
94
|
+
**Validation:**
|
|
95
|
+
|
|
96
|
+
- If all phases are `"pending"`: the pipeline never reached any execution. Print:
|
|
97
|
+
```
|
|
98
|
+
[retry] Warning: all phases are pending — the pipeline may not have started.
|
|
99
|
+
Recommend running /sr:implement instead.
|
|
100
|
+
```
|
|
101
|
+
Prompt: `Proceed anyway? [y/N]`. If `n` or no response: exit.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Phase 2: Status Report
|
|
106
|
+
|
|
107
|
+
Print the pipeline status:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
## Pipeline State: <FEATURE_NAME>
|
|
111
|
+
|
|
112
|
+
| Phase | Status | Notes |
|
|
113
|
+
|--------------|---------|-------------------------------------|
|
|
114
|
+
| architect | done | |
|
|
115
|
+
| developer | done | |
|
|
116
|
+
| test-writer | FAILED | <ERROR_CONTEXT or "no details"> |
|
|
117
|
+
| doc-sync | pending | |
|
|
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 → test-writer → doc-sync → 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 `"done"` AND it precedes `RESUME_PHASE` in canonical order: **skip** — do not re-run.
|
|
181
|
+
- If it equals `RESUME_PHASE` or comes after: **run** it.
|
|
182
|
+
|
|
183
|
+
After each phase completes (or fails), update `.claude/pipeline-state/<FEATURE_NAME>.json`:
|
|
184
|
+
1. Read the current file.
|
|
185
|
+
2. Set `phases.<phase-key>` to `"done"` or `"failed"`.
|
|
186
|
+
3. If `"done"`: update `last_successful_phase`.
|
|
187
|
+
4. If `"failed"`: update `failed_phase` and `error_context`.
|
|
188
|
+
5. Update `updated_at` to current ISO 8601 timestamp.
|
|
189
|
+
6. Overwrite the file.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### 4a. Phase: architect
|
|
194
|
+
|
|
195
|
+
**Only runs if `RESUME_PHASE=architect`.**
|
|
196
|
+
|
|
197
|
+
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.
|
|
198
|
+
|
|
199
|
+
Launch **sr-architect** agent(s) exactly as described in Phase 3a of the implement pipeline. Pass:
|
|
200
|
+
- Original issue numbers from `ORIGINAL_ISSUES` (or text description if stored in state)
|
|
201
|
+
- Same OpenSpec output directory: `OPENSPEC_ARTIFACTS`
|
|
202
|
+
|
|
203
|
+
Wait for all architects to complete.
|
|
204
|
+
|
|
205
|
+
**Pipeline state update:** `architect` → `done` or `failed`.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
### 4b. Phase: developer
|
|
210
|
+
|
|
211
|
+
**Runs if `RESUME_PHASE` is `architect` or `developer`.**
|
|
212
|
+
|
|
213
|
+
Before launching, verify architect artifacts exist:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
ls <OPENSPEC_ARTIFACTS>tasks.md <OPENSPEC_ARTIFACTS>context-bundle.md
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
If missing and `RESUME_PHASE=developer`: print:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
[retry] Error: architect artifacts not found at <OPENSPEC_ARTIFACTS>.
|
|
223
|
+
Retry from the architect phase: /sr:retry <FEATURE_NAME> --from architect
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Stop.
|
|
227
|
+
|
|
228
|
+
Launch **sr-developer** agent(s) exactly as described in Phase 3b of the implement pipeline.
|
|
229
|
+
|
|
230
|
+
- If `SINGLE_MODE=true`: launch in main repo, foreground.
|
|
231
|
+
- If `SINGLE_MODE=false`: launch in isolated worktrees, background.
|
|
232
|
+
- If `DRY_RUN=true`: use the dry-run redirect instructions from Phase 3b.
|
|
233
|
+
|
|
234
|
+
Wait for all developers to complete. Collect the list of files created or modified.
|
|
235
|
+
|
|
236
|
+
**Pipeline state update:** `developer` → `done` (also update `implemented_files` in state with the collected file list) or `failed`.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
### 4c. Phase: test-writer
|
|
241
|
+
|
|
242
|
+
**Runs if `RESUME_PHASE` is `architect`, `developer`, or `test-writer`.**
|
|
243
|
+
|
|
244
|
+
If `IMPLEMENTED_FILES` is empty: warn but continue — the sr-test-writer will discover files from git diff.
|
|
245
|
+
|
|
246
|
+
Launch **sr-test-writer** agent(s) exactly as in Phase 3c of the implement pipeline. Pass:
|
|
247
|
+
- `IMPLEMENTED_FILES_LIST`: the `implemented_files` array from state
|
|
248
|
+
- `TASK_DESCRIPTION`: derived from `ORIGINAL_ISSUES` or architect artifacts
|
|
249
|
+
|
|
250
|
+
Wait for completion. Failure is **non-blocking** — record `FAILED` and continue to next phase.
|
|
251
|
+
|
|
252
|
+
**Pipeline state update:** `test-writer` → `done` or `failed`.
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
### 4d. Phase: doc-sync
|
|
257
|
+
|
|
258
|
+
**Runs if `RESUME_PHASE` is any phase up to and including `doc-sync`.**
|
|
259
|
+
|
|
260
|
+
Launch **sr-doc-sync** agent(s) exactly as in Phase 3d of the implement pipeline. Pass:
|
|
261
|
+
- `IMPLEMENTED_FILES_LIST`: the `implemented_files` array from state
|
|
262
|
+
- `TASK_DESCRIPTION`: derived from `ORIGINAL_ISSUES` or architect artifacts
|
|
263
|
+
|
|
264
|
+
Wait for completion. Failure is **non-blocking** — record `FAILED` and continue.
|
|
265
|
+
|
|
266
|
+
**Pipeline state update:** `doc-sync` → `done` or `failed`.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
### 4e. Phase: reviewer
|
|
271
|
+
|
|
272
|
+
**Runs if `RESUME_PHASE` is any phase up to and including `reviewer`.**
|
|
273
|
+
|
|
274
|
+
Launch layer reviewers and the generalist sr-reviewer exactly as in Phase 4b of the implement pipeline. Pass:
|
|
275
|
+
- `MODIFIED_FILES_LIST`: the `implemented_files` array from state
|
|
276
|
+
- `PIPELINE_CONTEXT`: brief description from original input and issue titles
|
|
277
|
+
- Layer reports from sr-frontend-reviewer, sr-backend-reviewer, sr-security-reviewer
|
|
278
|
+
|
|
279
|
+
Wait for all to complete. Parse `SECURITY_BLOCKED`, `FRONTEND_STATUS`, `BACKEND_STATUS`.
|
|
280
|
+
|
|
281
|
+
**Run the Confidence Gate (Phase 4b-conf)** exactly as defined in the implement pipeline.
|
|
282
|
+
|
|
283
|
+
**Pipeline state update:** `reviewer` → `done` or `failed`.
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
### 4f. Phase: ship
|
|
288
|
+
|
|
289
|
+
**Runs if `RESUME_PHASE` is `ship` or `ci`.**
|
|
290
|
+
|
|
291
|
+
If `DRY_RUN=true`: skip git operations. Record skipped operations, print dry-run summary, proceed to Phase 5.
|
|
292
|
+
|
|
293
|
+
Otherwise, run Phase 4c (ship) of the implement pipeline exactly as defined:
|
|
294
|
+
- Security gate check (`SECURITY_BLOCKED`)
|
|
295
|
+
- Conflict pre-check (Phase 4c.0)
|
|
296
|
+
- Git branch creation, commit, push, PR creation
|
|
297
|
+
- Backlog updates
|
|
298
|
+
|
|
299
|
+
**Pipeline state update:** `ship` → `done` or `failed`.
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
### 4g. Phase: ci
|
|
304
|
+
|
|
305
|
+
**Runs if ship succeeded and code was pushed.**
|
|
306
|
+
|
|
307
|
+
Run Phase 4d (CI monitoring) of the implement pipeline exactly as defined. Check CI status, fix failures (up to 2 retries).
|
|
308
|
+
|
|
309
|
+
**Pipeline state update:** `ci` → `done` or `failed`.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Phase 5: Report
|
|
314
|
+
|
|
315
|
+
Print the final report:
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
## Retry Complete: <FEATURE_NAME>
|
|
319
|
+
|
|
320
|
+
Resumed from: <RESUME_PHASE>
|
|
321
|
+
Phases executed this run: <comma-separated list>
|
|
322
|
+
|
|
323
|
+
| Phase | Status |
|
|
324
|
+
|--------------|---------|
|
|
325
|
+
| architect | done |
|
|
326
|
+
| developer | done |
|
|
327
|
+
| test-writer | done |
|
|
328
|
+
| doc-sync | done |
|
|
329
|
+
| reviewer | done |
|
|
330
|
+
| ship | done |
|
|
331
|
+
| ci | done |
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Include PR URL if ship ran successfully.
|
|
335
|
+
|
|
336
|
+
**If any phase failed**, add:
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
## Failures
|
|
340
|
+
|
|
341
|
+
| Phase | Error Context |
|
|
342
|
+
|-------------|------------------------|
|
|
343
|
+
| <phase> | <error_context> |
|
|
344
|
+
|
|
345
|
+
Next steps:
|
|
346
|
+
- To retry from the failed phase: /sr:retry <FEATURE_NAME> --from <failed-phase>
|
|
347
|
+
- To see all pipeline states: /sr:retry --list
|
|
348
|
+
- To restart from scratch: /sr:implement <original-input>
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Error Handling
|
|
354
|
+
|
|
355
|
+
| Phase | Blocking? | On failure |
|
|
356
|
+
|-------|-----------|------------|
|
|
357
|
+
| architect | **Yes** | Stop — cannot proceed without OpenSpec artifacts |
|
|
358
|
+
| developer | **Yes** | Stop — cannot proceed without implemented files |
|
|
359
|
+
| test-writer | No | Record FAILED, continue to doc-sync |
|
|
360
|
+
| doc-sync | No | Record FAILED, continue to reviewer |
|
|
361
|
+
| reviewer | No | Report findings, continue to ship |
|
|
362
|
+
| ship | **Yes** | Stop — report failure with git/PR context |
|
|
363
|
+
| ci | **Yes** | Stop — report failure with CI log and fix suggestions |
|