specrails-core 4.6.4 → 4.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/commands/enrich.md +109 -214
  2. package/dist/installer/phases/scaffold.js +152 -153
  3. package/dist/installer/phases/scaffold.js.map +1 -1
  4. package/docs/deployment.md +1 -1
  5. package/package.json +1 -2
  6. package/schemas/profile.v1.json +1 -9
  7. package/templates/agents/sr-architect.md +9 -6
  8. package/templates/codex-skills/enrich/SKILL.md +3 -3
  9. package/templates/codex-skills/implement/SKILL.md +75 -8
  10. package/templates/codex-skills/rails/sr-architect/SKILL.md +33 -7
  11. package/templates/codex-skills/rails/sr-developer/SKILL.md +6 -3
  12. package/templates/codex-skills/rails/sr-reviewer/SKILL.md +57 -5
  13. package/templates/commands/specrails/enrich.md +36 -213
  14. package/templates/commands/specrails/implement.md +22 -10
  15. package/templates/commands/specrails/reconfig.md +1 -10
  16. package/templates/commands/specrails/retry.md +2 -1
  17. package/templates/skills/rails/sr-architect/SKILL.md +0 -234
  18. package/templates/skills/rails/sr-developer/SKILL.md +0 -210
  19. package/templates/skills/rails/sr-merge-resolver/SKILL.md +0 -197
  20. package/templates/skills/rails/sr-reviewer/SKILL.md +0 -320
  21. package/templates/skills/sr-auto-propose-backlog-specs/SKILL.md +0 -275
  22. package/templates/skills/sr-batch-implement/SKILL.md +0 -292
  23. package/templates/skills/sr-compat-check/SKILL.md +0 -275
  24. package/templates/skills/sr-get-backlog-specs/SKILL.md +0 -199
  25. package/templates/skills/sr-implement/SKILL.md +0 -1205
  26. package/templates/skills/sr-refactor-recommender/SKILL.md +0 -216
  27. package/templates/skills/sr-why/SKILL.md +0 -106
@@ -45,7 +45,7 @@ Then stop.
45
45
 
46
46
  Parse the YAML and extract:
47
47
  - `config.version` — must be `1`; if not, warn and proceed
48
- - `config.provider` — `claude` or `codex`; default `claude`
48
+ - `config.provider` — `claude` (this is the Claude enrichment flow); default `claude`
49
49
  - `config.tier` — `full` or `quick`; default `full`
50
50
  - `config.agents.selected` — list of agent names to install
51
51
  - `config.agents.excluded` — list of agent names to skip (for reference only)
@@ -69,9 +69,7 @@ To resolve the model for any given agent:
69
69
 
70
70
  ### FC2: Provider Setup
71
71
 
72
- Use `FC_provider` from the config as the source of truth. Set `CLI_PROVIDER = FC_provider`, and set `SPECRAILS_DIR` to `.codex` when `CLI_PROVIDER == "codex"`, otherwise `.claude`.
73
-
74
- Set `SPECRAILS_DIR` and `CLI_PROVIDER` from resolved provider.
72
+ This is the Claude enrichment flow. Set `SPECRAILS_DIR = ".claude"`.
75
73
 
76
74
  ### FC3: If tier is `quick` — run Quick Mode with config context
77
75
 
@@ -144,7 +142,7 @@ Read the following files to understand the current installation state:
144
142
 
145
143
  2. Read `.specrails/specrails-version` — contains the current version string (e.g., `0.2.0`). If it does not exist, treat version as `0.1.0 (legacy)`.
146
144
 
147
- 3. Determine `$SPECRAILS_DIR` from the existing install layout. If `.codex/` exists, use `cli_provider = "codex"` and `specrails_dir = ".codex"`. Otherwise use `cli_provider = "claude"` and `specrails_dir = ".claude"`.
145
+ 3. This is the **Claude** enrichment flow: it operates on `.claude/` (`specrails_dir = ".claude"`). Codex projects use their own codex-native `$enrich` skill, not this command.
148
146
 
149
147
  4. List all template files in `.specrails/setup-templates/agents/` — these are the NEW agent templates from the update:
150
148
  ```bash
@@ -265,26 +263,20 @@ For each agent in the "changed" list:
265
263
  - If not present, check `AGENTS_CONFIG.defaults.model` (global default)
266
264
  - If `AGENTS_CONFIG` is null, use the model from the template frontmatter
267
265
  - Replace the `model:` field in the YAML frontmatter with the resolved value before writing
268
- 4. Write the adapted agent using the format for the active provider (same dual-format rules as Phase 4.1):
269
- - `cli_provider == "claude"`: write to `$SPECRAILS_DIR/agents/sr-<name>.md` (Markdown with YAML frontmatter)
270
- - `cli_provider == "codex"`: write to `$SPECRAILS_DIR/agents/sr-<name>.toml` (TOML format with `name`, `description`, `model`, `prompt` fields)
266
+ 4. Write the adapted agent (same rules as Phase 4.1):
267
+ - Write to `.claude/agents/sr-<name>.md` (Markdown with YAML frontmatter)
271
268
  5. Show: `✓ Regenerated sr-<name>`
272
269
 
273
270
  After regenerating all changed agents, verify no unresolved placeholders remain:
274
271
  ```bash
275
- # Claude Code
276
272
  grep -r '{{[A-Z_]*}}' .claude/agents/sr-*.md 2>/dev/null || echo "OK: no broken placeholders"
277
- # Codex
278
- grep -r '{{[A-Z_]*}}' .codex/agents/sr-*.toml 2>/dev/null || echo "OK: no broken placeholders"
279
273
  ```
280
274
 
281
275
  ### Phase U4b: Update Changed Commands
282
276
 
283
277
  For each command in the "changed commands" list from Phase U3:
284
278
 
285
- 1. Read the NEW template:
286
- - If `cli_provider == "claude"`: from `.specrails/setup-templates/commands/specrails/<name>.md`
287
- - If `cli_provider == "codex"`: from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`
279
+ 1. Read the NEW template from `.specrails/setup-templates/commands/specrails/<name>.md`
288
280
  2. Read stored backlog configuration from `.specrails/backlog-config.json` (if it exists) to resolve provider-specific placeholders:
289
281
  - `BACKLOG_PROVIDER` → `provider` field (`github`, `jira`, or `none`)
290
282
  - `BACKLOG_WRITE` → `write_access` field
@@ -300,19 +292,12 @@ For each command in the "changed commands" list from Phase U3:
300
292
  - `{{BACKLOG_VIEW_CMD}}` → provider-specific view command from backlog config
301
293
  - `{{BACKLOG_PREFLIGHT}}` → provider-specific preflight check from backlog config
302
294
  - Any other `{{PLACEHOLDER}}` values → use Phase U2 analysis data
303
- 4. Write the updated file:
304
- - If `cli_provider == "claude"`: to `.claude/commands/specrails/<name>.md`
305
- - If `cli_provider == "codex"`: to `.agents/skills/sr-<name>/SKILL.md`
306
- 5. Show:
307
- - If `cli_provider == "claude"`: `✓ Updated /specrails:<name>`
308
- - If `cli_provider == "codex"`: `✓ Updated $sr-<name>`
309
-
310
- After updating all changed commands/skills, verify no unresolved placeholders remain:
295
+ 4. Write the updated file to `.claude/commands/specrails/<name>.md`
296
+ 5. Show: `✓ Updated /specrails:<name>`
297
+
298
+ After updating all changed commands, verify no unresolved placeholders remain:
311
299
  ```bash
312
- # If cli_provider == "claude":
313
300
  grep -l '{{[A-Z_]*}}' .claude/commands/specrails/*.md 2>/dev/null || echo "OK: no broken placeholders"
314
- # If cli_provider == "codex":
315
- grep -rl '{{[A-Z_]*}}' .agents/skills/sr-*/SKILL.md 2>/dev/null || echo "OK: no broken placeholders"
316
301
  ```
317
302
  If any placeholders remain unresolved, warn the user:
318
303
  > "⚠ Some placeholders in `<filename>` could not be resolved automatically. Please review the file and fill them in manually."
@@ -336,32 +321,22 @@ For each agent in the "new" list:
336
321
 
337
322
  For each command in the "new commands" list from Phase U3:
338
323
 
339
- 1. Read the template:
340
- - If `cli_provider == "claude"`: from `.specrails/setup-templates/commands/specrails/<name>.md`
341
- - If `cli_provider == "codex"`: from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`
342
- 2. Prompt the user:
343
- - If `cli_provider == "claude"`: `"New command available: /specrails:<name> — [one-line description]. Install it? [Y/n]"`
344
- - If `cli_provider == "codex"`: `"New skill available: $sr-<name> — [one-line description]. Install it? [Y/n]"`
324
+ 1. Read the template from `.specrails/setup-templates/commands/specrails/<name>.md`
325
+ 2. Prompt the user: `"New command available: /specrails:<name> — [one-line description]. Install it? [Y/n]"`
345
326
  3. If the user accepts (or presses Enter):
346
327
  - Apply placeholder substitution using the same rules as Phase U4b (backlog config + codebase analysis)
347
- - If `cli_provider == "claude"`: write to `.claude/commands/specrails/<name>.md` — show `✓ Added /specrails:<name>`
348
- - If `cli_provider == "codex"`: write to `.agents/skills/sr-<name>/SKILL.md` — show `✓ Added $sr-<name>`
328
+ - Write to `.claude/commands/specrails/<name>.md` — show `✓ Added /specrails:<name>`
349
329
  4. If the user declines:
350
- - If `cli_provider == "claude"`: show `→ Skipped /specrails:<name>`
351
- - If `cli_provider == "codex"`: show `→ Skipped $sr-<name>`
330
+ - Show `→ Skipped /specrails:<name>`
352
331
 
353
332
  ### Phase U6: Update Workflow Commands
354
333
 
355
334
  If any new agents were added in Phase U5:
356
335
 
357
- 1. Read the implement command/skill:
358
- - If `cli_provider == "claude"`: `.claude/commands/specrails/implement.md`
359
- - If `cli_provider == "codex"`: `.agents/skills/sr-implement/SKILL.md`
336
+ 1. Read the implement command at `.claude/commands/specrails/implement.md`
360
337
  2. Check if the file references agent names in its orchestration steps (look for `sr-architect`, `sr-developer`, `sr-reviewer` etc.)
361
338
  3. If newly added agents belong in the implementation pipeline (i.e., they are layer-specific developers such as `sr-frontend-developer` or `sr-backend-developer`), add them to the appropriate step in the implement command — specifically where parallel developer agents are launched
362
- 4. Write the updated file if any changes were made:
363
- - If `cli_provider == "claude"`: `.claude/commands/specrails/implement.md`
364
- - If `cli_provider == "codex"`: `.agents/skills/sr-implement/SKILL.md`
339
+ 4. Write the updated file to `.claude/commands/specrails/implement.md` if any changes were made
365
340
  5. Show which commands were updated, or "No command updates needed" if nothing changed
366
341
 
367
342
  This is a lightweight check — only update commands where the sr- agent clearly belongs. Do not restructure the entire command.
@@ -463,28 +438,17 @@ Store as `QS_IS_EXISTING_CODEBASE=true/false`.
463
438
 
464
439
  Before generating files, check if this is a re-run:
465
440
 
466
- 1. Check if commands/skills already exist:
467
- - If `cli_provider == "claude"`: check if `.claude/commands/specrails/` directory exists with any `.md` files:
468
- ```bash
469
- ls .claude/commands/specrails/*.md 2>/dev/null
470
- ```
471
- - If `cli_provider == "codex"`: check if `.agents/skills/sr-*/SKILL.md` files exist:
472
- ```bash
473
- ls .agents/skills/sr-*/SKILL.md 2>/dev/null
474
- ```
441
+ 1. Check if commands already exist — check if `.claude/commands/specrails/` directory exists with any `.md` files:
442
+ ```bash
443
+ ls .claude/commands/specrails/*.md 2>/dev/null
444
+ ```
475
445
  2. If files are found → this is a **re-run**. Store `QS_IS_RERUN=true`.
476
446
  3. If the directory does not exist or is empty → this is a **fresh install**. Store `QS_IS_RERUN=false`.
477
447
 
478
- In re-run mode, QS3 executes in **gap-fill mode** for command/skill files:
479
- - For each command in the list, check if it already exists:
480
- - If `cli_provider == "claude"`: at `.claude/commands/specrails/<name>.md`
481
- - If `cli_provider == "codex"`: at `.agents/skills/sr-<name>/SKILL.md`
482
- - If it exists: skip it and show:
483
- - Claude: `✓ Already installed: /specrails:<name>`
484
- - Codex: `✓ Already installed: $sr-<name>`
485
- - If it does NOT exist: install it and show:
486
- - Claude: `✓ Added /specrails:<name> (was missing)`
487
- - Codex: `✓ Added $sr-<name> (was missing)`
448
+ In re-run mode, QS3 executes in **gap-fill mode** for command files:
449
+ - For each command in the list, check if it already exists at `.claude/commands/specrails/<name>.md`
450
+ - If it exists: skip it and show `✓ Already installed: /specrails:<name>`
451
+ - If it does NOT exist: install it and show `✓ Added /specrails:<name> (was missing)`
488
452
  - Do NOT prompt the user for confirmation on missing files — install them automatically
489
453
 
490
454
  For CLAUDE.md/AGENTS.md and agent files, the existing per-file prompts already handle re-runs (user is asked before overwriting). No change needed there.
@@ -507,9 +471,8 @@ Skip if user says no.
507
471
 
508
472
  **2. Agent files**
509
473
 
510
- For each default agent (sr-architect, sr-developer, sr-reviewer, sr-product-manager), read the template from `.specrails/setup-templates/agents/<name>.md` and generate the adapted agent file using the dual-format rules from Phase 4.1:
511
- - `cli_provider == "claude"`: write to `.claude/agents/<name>.md` (Markdown with frontmatter)
512
- - `cli_provider == "codex"`: write to `.codex/agents/<name>.toml` (TOML format)
474
+ For each default agent (sr-architect, sr-developer, sr-reviewer, sr-product-manager), read the template from `.specrails/setup-templates/agents/<name>.md` and generate the adapted agent file using the rules from Phase 4.1:
475
+ - Write to `.claude/agents/<name>.md` (Markdown with frontmatter)
513
476
 
514
477
  If `.specrails/agents.yaml` exists, read it and apply model resolution (per-agent override → defaults → template value) before writing each agent file.
515
478
 
@@ -545,22 +508,12 @@ Core commands (always install if missing):
545
508
  }
546
509
  ```
547
510
 
548
- **If `cli_provider == "claude"`:**
549
-
550
511
  If `QS_IS_RERUN=false` (fresh install): for each core command, read the template from `.specrails/setup-templates/commands/specrails/<name>.md`, substitute the backlog placeholders with local values (using the same table as Phase 4.3 "Local Tickets"), stub all persona placeholders with `(Quick Mode — run /specrails:enrich to configure personas)`, then write to `.claude/commands/specrails/<name>.md`.
551
512
 
552
513
  If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check if `.claude/commands/specrails/<name>.md` already exists:
553
514
  - If it exists: skip it — show `✓ Already installed: /specrails:<name>`
554
515
  - If it does NOT exist: read template, substitute placeholders as above, write to `.claude/commands/specrails/<name>.md` — show `✓ Added /specrails:<name> (was missing)`
555
516
 
556
- **If `cli_provider == "codex"`:**
557
-
558
- If `QS_IS_RERUN=false` (fresh install): for each core command, read the corresponding skill template from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`, substitute the backlog placeholders with local values and stub persona placeholders with `(Quick Mode — run /specrails:enrich to configure personas)`, then write to `.agents/skills/sr-<name>/SKILL.md` (create the directory first).
559
-
560
- If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check if `.agents/skills/sr-<name>/SKILL.md` already exists:
561
- - If it exists: skip it — show `✓ Already installed: $sr-<name>`
562
- - If it does NOT exist: read template, substitute placeholders as above, write to `.agents/skills/sr-<name>/SKILL.md` — show `✓ Added $sr-<name> (was missing)`
563
-
564
517
  **4. Cleanup**
565
518
 
566
519
  Remove `.specrails/setup-templates/` (same as full wizard cleanup in Phase 5).
@@ -1155,7 +1108,7 @@ Wait for final confirmation.
1155
1108
 
1156
1109
  Read each template from `.specrails/setup-templates/` and generate the final files adapted to this project. Use the codebase analysis from Phase 1, personas from Phase 2, and configuration from Phase 3.
1157
1110
 
1158
- **Provider detection (required before any file generation):** Determine `cli_provider` from the existing install layout: use `"codex"` when `.codex/` exists, otherwise `"claude"`. Set `specrails_dir` to `.codex` or `.claude` accordingly. All output paths in Phase 4 use `$SPECRAILS_DIR` as the base directory.
1111
+ **Output base directory:** All output paths in Phase 4 use `.claude` as the base directory (`specrails_dir = ".claude"`).
1159
1112
 
1160
1113
  ### 4.1 Generate agents
1161
1114
 
@@ -1163,7 +1116,6 @@ For each selected agent, read the template and generate the adapted version.
1163
1116
 
1164
1117
  **Template → Output mapping:**
1165
1118
 
1166
- **If `cli_provider == "claude"` (default):**
1167
1119
  - `.specrails/setup-templates/agents/sr-architect.md` → `.claude/agents/sr-architect.md`
1168
1120
  - `.specrails/setup-templates/agents/sr-developer.md` → `.claude/agents/sr-developer.md`
1169
1121
  - `.specrails/setup-templates/agents/sr-reviewer.md` → `.claude/agents/sr-reviewer.md`
@@ -1174,17 +1126,6 @@ For each selected agent, read the template and generate the adapted version.
1174
1126
  - `.specrails/setup-templates/agents/sr-backend-developer.md` → `.claude/agents/sr-backend-developer.md` (if backend layer)
1175
1127
  - `.specrails/setup-templates/agents/sr-frontend-developer.md` → `.claude/agents/sr-frontend-developer.md` (if frontend layer)
1176
1128
 
1177
- **If `cli_provider == "codex"`:**
1178
- - `.specrails/setup-templates/agents/sr-architect.md` → `.codex/agents/sr-architect.toml`
1179
- - `.specrails/setup-templates/agents/sr-developer.md` → `.codex/agents/sr-developer.toml`
1180
- - `.specrails/setup-templates/agents/sr-reviewer.md` → `.codex/agents/sr-reviewer.toml`
1181
- - `.specrails/setup-templates/agents/sr-test-writer.md` → `.codex/agents/sr-test-writer.toml`
1182
- - `.specrails/setup-templates/agents/sr-security-reviewer.md` → `.codex/agents/sr-security-reviewer.toml`
1183
- - `.specrails/setup-templates/agents/sr-product-manager.md` → `.codex/agents/sr-product-manager.toml`
1184
- - `.specrails/setup-templates/agents/sr-product-analyst.md` → `.codex/agents/sr-product-analyst.toml`
1185
- - `.specrails/setup-templates/agents/sr-backend-developer.md` → `.codex/agents/sr-backend-developer.toml` (if backend layer)
1186
- - `.specrails/setup-templates/agents/sr-frontend-developer.md` → `.codex/agents/sr-frontend-developer.toml` (if frontend layer)
1187
-
1188
1129
  When generating each agent:
1189
1130
  1. Read the template
1190
1131
  2. Replace all `{{PLACEHOLDER}}` values with project-specific content:
@@ -1209,23 +1150,7 @@ When generating each agent:
1209
1150
  - If not present, check `AGENTS_CONFIG.defaults.model` (global default)
1210
1151
  - If `AGENTS_CONFIG` was not loaded (e.g., re-run without config), use the model from the template frontmatter (current behavior)
1211
1152
  - Replace the `model:` field in the YAML frontmatter with the resolved value before writing
1212
- 4. Write the final file in the format for the active provider:
1213
-
1214
- **If `cli_provider == "claude"`:** Write as Markdown with YAML frontmatter — the template file as-is (frontmatter preserved).
1215
-
1216
- **If `cli_provider == "codex"`:** Convert to TOML format:
1217
- - Extract YAML frontmatter fields: `name`, `description`, `model`
1218
- - Extract the body content (everything after the closing `---` of the frontmatter)
1219
- - Map the `model` field: `sonnet` → `codex-mini-latest`, `opus` → `o3`, `haiku` → `codex-mini-latest`
1220
- - Write a `.toml` file with this structure:
1221
- ```toml
1222
- name = "<name from frontmatter>"
1223
- description = "<description from frontmatter, escaped for TOML>"
1224
- model = "codex-mini-latest"
1225
- prompt = """
1226
- <body content after placeholder substitution>
1227
- """
1228
- ```
1153
+ 4. Write the final file as Markdown with YAML frontmatter — the template file as-is (frontmatter preserved).
1229
1154
 
1230
1155
  ### 4.2 Generate personas
1231
1156
 
@@ -1245,11 +1170,10 @@ Write each persona to `$SPECRAILS_DIR/agents/personas/`:
1245
1170
  - Use the VPC personas generated in Phase 2
1246
1171
  - File naming: kebab-case of persona nickname (e.g., `the-developer.md`, `the-admin.md`)
1247
1172
 
1248
- ### 4.3 Generate commands / skills
1173
+ ### 4.3 Generate commands
1249
1174
 
1250
1175
  For each selected command, read the template and adapt.
1251
1176
 
1252
- **If `cli_provider == "claude"` (default):**
1253
1177
  - `.specrails/setup-templates/commands/specrails/implement.md` → `.claude/commands/specrails/implement.md`
1254
1178
  - `.specrails/setup-templates/commands/specrails/batch-implement.md` → `.claude/commands/specrails/batch-implement.md`
1255
1179
  - `.specrails/setup-templates/commands/specrails/propose-spec.md` → `.claude/commands/specrails/propose-spec.md`
@@ -1260,31 +1184,7 @@ For each selected command, read the template and adapt.
1260
1184
  - `.specrails/setup-templates/commands/specrails/why.md` → `.claude/commands/specrails/why.md`
1261
1185
  - `.specrails/setup-templates/commands/specrails/reconfig.md` → `.claude/commands/specrails/reconfig.md`
1262
1186
 
1263
- **If `cli_provider == "codex"`:**
1264
- - `.specrails/setup-templates/skills/sr-implement/SKILL.md` → `.agents/skills/sr-implement/SKILL.md`
1265
- - `.specrails/setup-templates/skills/sr-batch-implement/SKILL.md` → `.agents/skills/sr-batch-implement/SKILL.md`
1266
- - `.specrails/setup-templates/commands/specrails/propose-spec.md` → `.agents/skills/sr-propose-spec/SKILL.md` (wrap with YAML frontmatter if no skill template exists)
1267
- - `.specrails/setup-templates/commands/specrails/get-backlog-specs.md` → `.agents/skills/sr-get-backlog-specs/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
1268
- - `.specrails/setup-templates/commands/specrails/auto-propose-backlog-specs.md` → `.agents/skills/sr-auto-propose-backlog-specs/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
1269
- - `.specrails/setup-templates/skills/sr-compat-check/SKILL.md` → `.agents/skills/sr-compat-check/SKILL.md`
1270
- - `.specrails/setup-templates/skills/sr-refactor-recommender/SKILL.md` → `.agents/skills/sr-refactor-recommender/SKILL.md`
1271
- - `.specrails/setup-templates/skills/sr-why/SKILL.md` → `.agents/skills/sr-why/SKILL.md`
1272
- - `.specrails/setup-templates/commands/specrails/reconfig.md` → `.agents/skills/sr-reconfig/SKILL.md` (wrap with YAML frontmatter)
1273
-
1274
- **Codex skill frontmatter wrapping:** When a dedicated skill template does not exist in `.specrails/setup-templates/skills/` for a command, generate the `SKILL.md` by prepending YAML frontmatter to the command content:
1275
- ```yaml
1276
- ---
1277
- name: sr-<name>
1278
- description: "<one-line description from the command's first heading>"
1279
- license: MIT
1280
- compatibility: "Requires git."
1281
- metadata:
1282
- author: specrails
1283
- version: "1.0"
1284
- ---
1285
- ```
1286
-
1287
- For both providers, create the output directory before writing (`mkdir -p` for `.claude/commands/specrails/` or `.agents/skills/sr-<name>/`).
1187
+ Create the output directory before writing (`mkdir -p .claude/commands/specrails/`).
1288
1188
 
1289
1189
  Adapt:
1290
1190
  - CI commands to match detected stack
@@ -1382,16 +1282,10 @@ Each rule file must:
1382
1282
 
1383
1283
  ### 4.5 Generate root instructions file
1384
1284
 
1385
- **If `cli_provider == "claude"`:** If no `CLAUDE.md` exists, generate one from the template. If one already exists, **merge** — add the agent workflow sections without removing existing content.
1386
-
1387
- **If `cli_provider == "codex"`:** If no `AGENTS.md` exists, generate one from the template. If one already exists, **merge** — add the agent workflow sections without removing existing content.
1285
+ If no `CLAUDE.md` exists, generate one from the template. If one already exists, **merge** — add the agent workflow sections without removing existing content.
1388
1286
 
1389
1287
  ### 4.6 Generate settings
1390
1288
 
1391
- Resolve `cli_provider` from the existing install layout (`.codex/` => `codex`, otherwise `claude`).
1392
-
1393
- **If `cli_provider == "claude"` (default):**
1394
-
1395
1289
  Create or merge `.claude/settings.json` with permissions for:
1396
1290
  - All detected CI commands
1397
1291
  - Git operations
@@ -1399,29 +1293,6 @@ Create or merge `.claude/settings.json` with permissions for:
1399
1293
  - GitHub CLI (if available)
1400
1294
  - Language-specific tools (python, npm, cargo, go, etc.)
1401
1295
 
1402
- **If `cli_provider == "codex"`:**
1403
-
1404
- 1. Read `.specrails/setup-templates/settings/codex-config.toml`. Write it to `.codex/config.toml` as-is (no substitutions needed — the TOML is static).
1405
-
1406
- 2. Read `.specrails/setup-templates/settings/codex-rules.star`. Replace `{{CODEX_SHELL_RULES}}` with Starlark `prefix_rule(...)` lines for each detected tool allowance:
1407
-
1408
- | Detected tool/command | Starlark rule |
1409
- |----------------------|---------------|
1410
- | OpenSpec CLI (`openspec`) | `prefix_rule(pattern=["openspec"], decision="allow")` |
1411
- | Python (`python`, `pip`) | `prefix_rule(pattern=["python"], decision="allow")`<br>`prefix_rule(pattern=["pip"], decision="allow")` |
1412
- | npm (`npm`) | `prefix_rule(pattern=["npm"], decision="allow")` |
1413
- | Cargo (`cargo`) | `prefix_rule(pattern=["cargo"], decision="allow")` |
1414
- | Go (`go`) | `prefix_rule(pattern=["go"], decision="allow")` |
1415
- | Any detected CI command | `prefix_rule(pattern=["<cmd>"], decision="allow")` |
1416
-
1417
- Write the rendered file to `.codex/rules/default.rules`.
1418
-
1419
- ```bash
1420
- mkdir -p .codex/rules
1421
- ```
1422
-
1423
- If `cli_provider` cannot be determined (file missing), fall back to `"claude"` behavior.
1424
-
1425
1296
  ### 4.7 Initialize agent memory
1426
1297
 
1427
1298
  Create memory directories for each installed agent using the provider-aware base directory:
@@ -1485,25 +1356,16 @@ Apply the user's choice.
1485
1356
  After cleanup, verify that only the intended files remain:
1486
1357
 
1487
1358
  ```bash
1488
- # These should exist (the actual system) — use the resolved $SPECRAILS_DIR:
1489
- # If cli_provider == "claude":
1359
+ # These should exist (the actual system):
1490
1360
  ls .claude/agents/sr-*.md
1491
1361
  ls .claude/agents/personas/*.md
1492
1362
  ls .claude/commands/specrails/*.md
1493
1363
  ls .claude/rules/*.md
1494
1364
  ls .claude/agent-memory/
1495
1365
 
1496
- # If cli_provider == "codex":
1497
- ls .codex/agents/sr-*.toml
1498
- ls .codex/agents/personas/*.md
1499
- ls .agents/skills/sr-*/SKILL.md
1500
- ls .codex/rules/*.md
1501
- ls .codex/agent-memory/
1502
-
1503
1366
  # These should NOT exist (scaffolding):
1504
1367
  # .specrails/setup-templates/ — GONE
1505
- # If cli_provider == "claude": $SPECRAILS_DIR/commands/enrich.md — GONE
1506
- # If cli_provider == "codex": .agents/skills/setup/ — GONE (installer scaffold, not a generated sr-skill)
1368
+ # .claude/commands/enrich.md — GONE
1507
1369
  ```
1508
1370
 
1509
1371
  If any scaffolding artifact remains, remove it.
@@ -1518,20 +1380,12 @@ Display the complete installation summary:
1518
1380
  ### Agents Installed
1519
1381
  | Agent | File | Model |
1520
1382
  |-------|------|-------|
1521
- [If cli_provider == "claude":]
1522
1383
  | sr-architect | .claude/agents/sr-architect.md | Sonnet |
1523
1384
  | sr-developer | .claude/agents/sr-developer.md | Sonnet |
1524
1385
  | sr-reviewer | .claude/agents/sr-reviewer.md | Sonnet |
1525
1386
  | sr-test-writer | .claude/agents/sr-test-writer.md | Sonnet |
1526
1387
  | sr-security-reviewer | .claude/agents/sr-security-reviewer.md | Sonnet |
1527
1388
  | sr-product-manager | .claude/agents/sr-product-manager.md | Opus |
1528
- [If cli_provider == "codex":]
1529
- | sr-architect | .codex/agents/sr-architect.toml | codex-mini-latest |
1530
- | sr-developer | .codex/agents/sr-developer.toml | codex-mini-latest |
1531
- | sr-reviewer | .codex/agents/sr-reviewer.toml | codex-mini-latest |
1532
- | sr-test-writer | .codex/agents/sr-test-writer.toml | codex-mini-latest |
1533
- | sr-security-reviewer | .codex/agents/sr-security-reviewer.toml | codex-mini-latest |
1534
- | sr-product-manager | .codex/agents/sr-product-manager.toml | o3 |
1535
1389
 
1536
1390
  ### Personas Created
1537
1391
  | Persona | File | Source |
@@ -1541,8 +1395,7 @@ Display the complete installation summary:
1541
1395
  [For each user-generated persona:]
1542
1396
  | "[Name]" — The [Role] | $SPECRAILS_DIR/agents/personas/[name].md | Generated |
1543
1397
 
1544
- ### Commands / Skills Installed
1545
- [If cli_provider == "claude":]
1398
+ ### Commands Installed
1546
1399
  | Command | File |
1547
1400
  |---------|------|
1548
1401
  | /specrails:implement | .claude/commands/specrails/implement.md |
@@ -1553,19 +1406,8 @@ Display the complete installation summary:
1553
1406
  | /specrails:compat-check | .claude/commands/specrails/compat-check.md |
1554
1407
  | /specrails:refactor-recommender | .claude/commands/specrails/refactor-recommender.md |
1555
1408
  | /specrails:why | .claude/commands/specrails/why.md |
1556
- [If cli_provider == "codex":]
1557
- | Skill | File |
1558
- |-------|------|
1559
- | $sr-implement | .agents/skills/sr-implement/SKILL.md |
1560
- | $sr-batch-implement | .agents/skills/sr-batch-implement/SKILL.md |
1561
- | $sr-propose-spec | .agents/skills/sr-propose-spec/SKILL.md |
1562
- | $sr-get-backlog-specs | .agents/skills/sr-get-backlog-specs/SKILL.md |
1563
- | $sr-auto-propose-backlog-specs | .agents/skills/sr-auto-propose-backlog-specs/SKILL.md |
1564
- | $sr-compat-check | .agents/skills/sr-compat-check/SKILL.md |
1565
- | $sr-refactor-recommender | .agents/skills/sr-refactor-recommender/SKILL.md |
1566
- | $sr-why | .agents/skills/sr-why/SKILL.md |
1567
1409
 
1568
- Note: Only commands/skills selected during setup are shown. Backlog commands are excluded if no backlog provider was configured.
1410
+ Note: Only commands selected during setup are shown. Backlog commands are excluded if no backlog provider was configured.
1569
1411
 
1570
1412
  ### Rules Created
1571
1413
  | Layer | File |
@@ -1577,33 +1419,20 @@ Note: Only commands/skills selected during setup are shown. Backlog commands are
1577
1419
  | Artifact | Status |
1578
1420
  |----------|--------|
1579
1421
  | .specrails/setup-templates/ | Deleted |
1580
- [If cli_provider == "claude":] | .claude/commands/enrich.md | Deleted |
1581
- [If cli_provider == "codex":] | .agents/skills/setup/ | Deleted |
1422
+ | .claude/commands/enrich.md | Deleted |
1582
1423
  | specrails/ | [User's choice] |
1583
1424
 
1584
1425
  ### Next Steps
1585
- [If cli_provider == "claude":]
1586
1426
  1. Review the generated files in .claude/
1587
1427
  2. Run `/specrails:get-backlog-specs` to see your backlog (if GitHub Issues exist)
1588
1428
  3. Run `/specrails:auto-propose-backlog-specs` to generate feature ideas
1589
1429
  4. Run `/specrails:implement #issue-number` to implement a feature
1590
1430
  5. Commit the .claude/ directory to version control
1591
- [If cli_provider == "codex":]
1592
- 1. Review the generated files in .codex/ and .agents/skills/
1593
- 2. Run `$sr-get-backlog-specs` to see your backlog (if GitHub Issues exist)
1594
- 3. Run `$sr-auto-propose-backlog-specs` to generate feature ideas
1595
- 4. Run `$sr-implement #issue-number` to implement a feature
1596
- 5. Commit the .codex/ and .agents/ directories to version control
1597
1431
 
1598
1432
  ### Quick Start
1599
- [If cli_provider == "claude":]
1600
1433
  - `/specrails:implement "describe a feature"` — implement something right now
1601
1434
  - `/specrails:get-backlog-specs` — see prioritized feature ideas
1602
1435
  - `/specrails:auto-propose-backlog-specs` — discover new features using VPC
1603
- [If cli_provider == "codex":]
1604
- - `$sr-implement "describe a feature"` — implement something right now
1605
- - `$sr-get-backlog-specs` — see prioritized feature ideas
1606
- - `$sr-auto-propose-backlog-specs` — discover new features using VPC
1607
1436
  ```
1608
1437
 
1609
1438
  ## First Task Prompt (Full Wizard)
@@ -1615,10 +1444,7 @@ After displaying the setup complete summary above, detect the project type and o
1615
1444
  ✅ Setup complete.
1616
1445
 
1617
1446
  Try your first spec:
1618
- [If cli_provider == "claude":]
1619
1447
  > /specrails:get-backlog-specs
1620
- [If cli_provider == "codex":]
1621
- > $sr-get-backlog-specs
1622
1448
  ```
1623
1449
 
1624
1450
  **Existing codebase** (one or more of the above files found in root):
@@ -1626,10 +1452,7 @@ Try your first spec:
1626
1452
  ✅ Setup complete.
1627
1453
 
1628
1454
  Try your first spec:
1629
- [If cli_provider == "claude":]
1630
1455
  > /specrails:refactor-recommender
1631
- [If cli_provider == "codex":]
1632
- > $sr-refactor-recommender
1633
1456
  ```
1634
1457
 
1635
1458
  Then stop.
@@ -82,7 +82,19 @@ command -v jq >/dev/null 2>&1 || { echo "[error] 'jq' is required for profile-aw
82
82
 
83
83
  ##### Profile mode — load, validate, populate
84
84
 
85
- Read the profile:
85
+ Resolve the profile path into `PROFILE_PATH` (highest precedence wins), then read it:
86
+
87
+ ```bash
88
+ if [[ -n "${SPECRAILS_PROFILE_PATH:-}" && -r "${SPECRAILS_PROFILE_PATH:-}" ]]; then
89
+ PROFILE_PATH="$SPECRAILS_PROFILE_PATH"
90
+ elif [[ -r ".specrails/profiles/project-default.json" ]]; then
91
+ PROFILE_PATH=".specrails/profiles/project-default.json"
92
+ else
93
+ PROFILE_MODE="legacy"
94
+ fi
95
+ ```
96
+
97
+ When `PROFILE_PATH` is set (profile mode), read the profile:
86
98
 
87
99
  ```bash
88
100
  PROFILE="$(cat "$PROFILE_PATH")"
@@ -733,7 +745,7 @@ Also store `DEVELOPER_AGENTS_USED` (the set of developer agent IDs actually laun
733
745
 
734
746
  #### Launch modes
735
747
 
736
- For each entry in `DEVELOPER_ROUTING`, launch the assigned developer agent using its `subagent_type` (`sr:developer`, `sr:frontend-developer`, or `sr:backend-developer`) with its task subset.
748
+ For each entry in `DEVELOPER_ROUTING`, launch the assigned developer agent using its `subagent_type` (`sr-developer`, `sr-frontend-developer`, or `sr-backend-developer`) with its task subset.
737
749
 
738
750
  **If `SINGLE_MODE` and only one agent in routing**: Launch in the main repo, foreground.
739
751
  **If `SINGLE_MODE` but multiple agents in routing**: Launch agents sequentially in the main repo (one at a time, foreground), passing only their assigned tasks.
@@ -765,7 +777,7 @@ This prevents stale "still waiting" text from appearing as the terminal result w
765
777
 
766
778
  **Guard:** If `sr-test-writer` ∉ `AVAILABLE_AGENTS`, skip this phase. Print: `[phase-3c] sr-test-writer not installed — skipping test generation.` Update pipeline state: `test-writer` → `skipped`. Proceed to Phase 3d.
767
779
 
768
- Launch a **sr-test-writer** agent (`subagent_type: sr:test-writer`) for each feature immediately after its developer completes.
780
+ Launch a **sr-test-writer** agent (`subagent_type: sr-test-writer`) for each feature immediately after its developer completes.
769
781
 
770
782
  Construct the agent invocation prompt to include:
771
783
  - **IMPLEMENTED_FILES_LIST**: the complete list of files the developer created or modified for this feature
@@ -801,7 +813,7 @@ If a test-writer agent fails or times out:
801
813
 
802
814
  **Guard:** If `sr-doc-sync` ∉ `AVAILABLE_AGENTS`, skip this phase. Print: `[phase-3d] sr-doc-sync not installed — skipping doc sync.` Update pipeline state: `doc-sync` → `skipped`. Proceed to Phase 4.
803
815
 
804
- Launch a **sr-doc-sync** agent (`subagent_type: sr:doc-sync`) for each feature after its tests are written.
816
+ Launch a **sr-doc-sync** agent (`subagent_type: sr-doc-sync`) for each feature after its tests are written.
805
817
 
806
818
  Construct the agent invocation prompt to include:
807
819
  - **IMPLEMENTED_FILES_LIST**: the complete list of files the developer created or modified for this feature
@@ -1029,22 +1041,22 @@ If a reviewer is skipped, set its report variable to `"SKIPPED"` and note the re
1029
1041
 
1030
1042
  #### Step 3: Launch Layer Reviewers in Parallel
1031
1043
 
1032
- Launch all applicable layer reviewers in parallel (`run_in_background: true`), using the corresponding `subagent_type` for each (`sr:frontend-reviewer`, `sr:backend-reviewer`, `sr:security-reviewer`, `sr:performance-reviewer`):
1044
+ Launch all applicable layer reviewers in parallel (`run_in_background: true`), using the corresponding `subagent_type` for each (`sr-frontend-reviewer`, `sr-backend-reviewer`, `sr-security-reviewer`, `sr-performance-reviewer`):
1033
1045
 
1034
- **sr-frontend-reviewer** (`subagent_type: sr:frontend-reviewer`, if applicable per Step 2):
1046
+ **sr-frontend-reviewer** (`subagent_type: sr-frontend-reviewer`, if applicable per Step 2):
1035
1047
  - Pass `FRONTEND_FILES_LIST`: the list of files in `FRONTEND_FILES`
1036
1048
  - Pass `PIPELINE_CONTEXT`: brief description of what was implemented
1037
1049
 
1038
- **sr-backend-reviewer** (`subagent_type: sr:backend-reviewer`, if applicable per Step 2):
1050
+ **sr-backend-reviewer** (`subagent_type: sr-backend-reviewer`, if applicable per Step 2):
1039
1051
  - Pass `BACKEND_FILES_LIST`: the list of files in `BACKEND_FILES`
1040
1052
  - Pass `PIPELINE_CONTEXT`: brief description of what was implemented
1041
1053
 
1042
- **sr-security-reviewer** (`subagent_type: sr:security-reviewer`, if applicable per Step 2):
1054
+ **sr-security-reviewer** (`subagent_type: sr-security-reviewer`, if applicable per Step 2):
1043
1055
  - Pass `MODIFIED_FILES_LIST`: the complete list of all files created or modified during this run
1044
1056
  - Pass `PIPELINE_CONTEXT`: brief description of what was implemented
1045
1057
  - Pass the exemptions config path: `.claude/security-exemptions.yaml`
1046
1058
 
1047
- **sr-performance-reviewer** (`subagent_type: sr:performance-reviewer`, if applicable per Step 2):
1059
+ **sr-performance-reviewer** (`subagent_type: sr-performance-reviewer`, if applicable per Step 2):
1048
1060
  - Pass `MODIFIED_FILES_LIST`: the complete list of all files created or modified during this run
1049
1061
  - Pass `PIPELINE_CONTEXT`: brief description of what was implemented
1050
1062
 
@@ -1076,7 +1088,7 @@ Note: if total layer report length is very large, truncate each layer report to
1076
1088
 
1077
1089
  **The security gate (blocking ship on `SECURITY_STATUS: BLOCKED`) is enforced in Phase 4c.** Do not apply it here.
1078
1090
 
1079
- Launch the **sr-reviewer** agent (`subagent_type: sr:reviewer`, foreground, `run_in_background: false`). Wait for it to complete.
1091
+ Launch the **sr-reviewer** agent (`subagent_type: sr-reviewer`, foreground, `run_in_background: false`). Wait for it to complete.
1080
1092
 
1081
1093
  **Pipeline state:** update `reviewer` → `done` (or `failed` with error context `"sr-reviewer timed out or did not complete"` if the agent errored out).
1082
1094
 
@@ -6,11 +6,7 @@ Reads `.specrails/agents.yaml` and updates the `model:` frontmatter field in all
6
6
 
7
7
  ## Step 1: Locate generated agents directory
8
8
 
9
- Determine `$SPECRAILS_DIR`:
10
-
11
- 1. If `.codex/agents/` exists, set `cli_provider = "codex"` and `specrails_dir = ".codex"`.
12
- 2. Otherwise set `cli_provider = "claude"` and `specrails_dir = ".claude"`.
13
- 3. Set `$AGENTS_DIR = $SPECRAILS_DIR/agents`
9
+ This command targets the Claude install: set `$AGENTS_DIR = .claude/agents`. (Codex agents are codex-native rails under `.codex/skills/rails/` and carry no per-agent `model:` config — codex `spawn_agent` forks don't accept a model — so reconfig does not apply to codex projects.)
14
10
 
15
11
  ## Step 2: Read agent config
16
12
 
@@ -53,11 +49,6 @@ For each agent with a recorded change:
53
49
 
54
50
  The `model:` line is always in the frontmatter block (between the first `---` and second `---`). Replace only that specific line — do not modify any other content.
55
51
 
56
- **Codex format:** If `cli_provider == "codex"`, apply the same logic to `.codex/agents/sr-*.toml` files. Replace the `model = "..."` line with the mapped Codex model:
57
- - `sonnet` → `codex-mini-latest`
58
- - `opus` → `o3`
59
- - `haiku` → `codex-mini-latest`
60
-
61
52
  ## Step 5: Report results
62
53
 
63
54
  Display a summary of what changed:
@@ -177,8 +177,9 @@ If `n` or no response: exit without changes.
177
177
 
178
178
  Execute phases in canonical order starting from `RESUME_PHASE`. For each phase:
179
179
 
180
+ - If its status in `PHASE_STATUSES` is `"skipped"`: **skip** — the agent was not installed at the original run (e.g. an optional sr-test-writer / sr-doc-sync). Never launch a phase that was skipped, regardless of its position relative to `RESUME_PHASE`.
180
181
  - 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
+ - If it equals `RESUME_PHASE` or comes after (and is not `"skipped"`): **run** it.
182
183
 
183
184
  After each phase completes (or fails), update `.claude/pipeline-state/<FEATURE_NAME>.json`:
184
185
  1. Read the current file.