specrails-core 5.6.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/README.md +27 -145
  2. package/bin/specrails-core.mjs +12 -554
  3. package/dist/agent-runtime/capabilities.js +0 -1
  4. package/dist/agent-runtime/cli-executor.d.ts +1 -1
  5. package/dist/agent-runtime/cli-executor.js +1 -2
  6. package/dist/agent-runtime/cli-process.js +0 -1
  7. package/dist/agent-runtime/cli.js +3 -4
  8. package/dist/agent-runtime/codex-schema.js +0 -1
  9. package/dist/agent-runtime/compact/architect.d.ts +3 -272
  10. package/dist/agent-runtime/compact/architect.js +8 -9
  11. package/dist/agent-runtime/compact/chat-client.d.ts +3 -3
  12. package/dist/agent-runtime/compact/chat-client.js +1 -2
  13. package/dist/agent-runtime/compact/developer.d.ts +3 -70
  14. package/dist/agent-runtime/compact/developer.js +13 -14
  15. package/dist/agent-runtime/compact/environment.d.ts +4 -5
  16. package/dist/agent-runtime/compact/environment.js +1 -2
  17. package/dist/agent-runtime/compact/exit-code-honesty.d.ts +2 -1
  18. package/dist/agent-runtime/compact/exit-code-honesty.js +0 -1
  19. package/dist/agent-runtime/compact/guarded-loop.d.ts +2 -18
  20. package/dist/agent-runtime/compact/guarded-loop.js +7 -8
  21. package/dist/agent-runtime/compact/prompt-inputs.d.ts +0 -2
  22. package/dist/agent-runtime/compact/prompt-inputs.js +1 -2
  23. package/dist/agent-runtime/compact/reviewer.d.ts +0 -13
  24. package/dist/agent-runtime/compact/reviewer.js +5 -6
  25. package/dist/agent-runtime/compact/step.d.ts +0 -1
  26. package/dist/agent-runtime/compact/step.js +1 -2
  27. package/dist/agent-runtime/compact/test-reachability.js +0 -1
  28. package/dist/agent-runtime/config.js +0 -1
  29. package/dist/agent-runtime/core-host.d.ts +1 -1
  30. package/dist/agent-runtime/core-host.js +1 -2
  31. package/dist/agent-runtime/durable-store.d.ts +0 -1
  32. package/dist/agent-runtime/durable-store.js +1 -2
  33. package/dist/agent-runtime/efficiency-summary.d.ts +2 -2
  34. package/dist/agent-runtime/efficiency-summary.js +1 -2
  35. package/dist/agent-runtime/efficiency-types.js +0 -1
  36. package/dist/agent-runtime/efficiency.js +0 -1
  37. package/dist/agent-runtime/evaluation-corpus.js +0 -1
  38. package/dist/agent-runtime/evaluation.d.ts +2 -1
  39. package/dist/agent-runtime/evaluation.js +1 -2
  40. package/dist/agent-runtime/executor-types.d.ts +1 -1
  41. package/dist/agent-runtime/executor-types.js +0 -1
  42. package/dist/agent-runtime/executors.js +0 -1
  43. package/dist/agent-runtime/gemini-policy.js +0 -1
  44. package/dist/agent-runtime/graph/artifacts.d.ts +1 -1
  45. package/dist/agent-runtime/graph/artifacts.js +1 -2
  46. package/dist/agent-runtime/graph/nodes.d.ts +1 -1
  47. package/dist/agent-runtime/graph/nodes.js +1 -2
  48. package/dist/agent-runtime/graph/review-policy.js +0 -1
  49. package/dist/agent-runtime/graph/roles.d.ts +2 -5
  50. package/dist/agent-runtime/graph/roles.js +2 -8
  51. package/dist/agent-runtime/graph/state.d.ts +1 -1
  52. package/dist/agent-runtime/graph/state.js +0 -1
  53. package/dist/agent-runtime/graph-checkpointer.d.ts +2 -1
  54. package/dist/agent-runtime/graph-checkpointer.js +0 -1
  55. package/dist/agent-runtime/guardrails.d.ts +3 -3
  56. package/dist/agent-runtime/guardrails.js +1 -2
  57. package/dist/agent-runtime/index.d.ts +1 -1
  58. package/dist/agent-runtime/index.js +1 -2
  59. package/dist/agent-runtime/kimi-acp.js +1 -2
  60. package/dist/agent-runtime/kimi-model.d.ts +6 -0
  61. package/dist/agent-runtime/kimi-model.js +12 -0
  62. package/dist/agent-runtime/openai-executor.d.ts +0 -9
  63. package/dist/agent-runtime/openai-executor.js +6 -7
  64. package/dist/agent-runtime/openspec-tool-server.js +1 -2
  65. package/dist/agent-runtime/openspec.d.ts +0 -2
  66. package/dist/agent-runtime/openspec.js +1 -6
  67. package/dist/agent-runtime/prompts.d.ts +4 -3
  68. package/dist/agent-runtime/prompts.js +0 -1
  69. package/dist/agent-runtime/provider-diagnostic.js +1 -2
  70. package/dist/agent-runtime/recovery.js +1 -2
  71. package/dist/agent-runtime/repository-context.d.ts +1 -1
  72. package/dist/agent-runtime/repository-context.js +0 -1
  73. package/dist/agent-runtime/review-context.d.ts +1 -1
  74. package/dist/agent-runtime/review-context.js +0 -1
  75. package/dist/agent-runtime/role-routing.js +0 -1
  76. package/dist/agent-runtime/role-state.js +0 -1
  77. package/dist/agent-runtime/runtime-identity.js +1 -2
  78. package/dist/agent-runtime/tool-event.js +0 -1
  79. package/dist/agent-runtime/verification-plan.d.ts +5 -4
  80. package/dist/agent-runtime/verification-plan.js +1 -2
  81. package/dist/agent-runtime/workflow-types.js +0 -1
  82. package/dist/agent-runtime/workflow.js +0 -1
  83. package/dist/agent-runtime/workspace-tools.d.ts +2 -2
  84. package/dist/agent-runtime/workspace-tools.js +1 -2
  85. package/dist/installer/cli.d.ts +3 -32
  86. package/dist/installer/cli.js +26 -101
  87. package/dist/installer/commands/framework.d.ts +4 -3
  88. package/dist/installer/commands/framework.js +0 -1
  89. package/dist/installer/commands/init.d.ts +4 -25
  90. package/dist/installer/commands/init.js +5 -8
  91. package/dist/installer/phases/framework-lifecycle.d.ts +3 -17
  92. package/dist/installer/phases/framework-lifecycle.js +2 -3
  93. package/dist/installer/phases/install-config.d.ts +7 -8
  94. package/dist/installer/phases/install-config.js +2 -7
  95. package/dist/installer/phases/manifest.d.ts +6 -7
  96. package/dist/installer/phases/manifest.js +2 -7
  97. package/dist/installer/phases/prereqs.d.ts +6 -7
  98. package/dist/installer/phases/prereqs.js +4 -6
  99. package/dist/installer/phases/provider-detect.d.ts +6 -7
  100. package/dist/installer/phases/provider-detect.js +2 -4
  101. package/dist/installer/phases/scaffold.d.ts +9 -10
  102. package/dist/installer/phases/scaffold.js +82 -805
  103. package/dist/installer/util/errors.js +0 -1
  104. package/dist/installer/util/exec.d.ts +3 -2
  105. package/dist/installer/util/exec.js +0 -1
  106. package/dist/installer/util/fs.d.ts +0 -10
  107. package/dist/installer/util/fs.js +1 -2
  108. package/dist/installer/util/git.js +0 -1
  109. package/dist/installer/util/install-transaction.d.ts +2 -2
  110. package/dist/installer/util/install-transaction.js +1 -2
  111. package/dist/installer/util/logger.d.ts +1 -3
  112. package/dist/installer/util/logger.js +0 -1
  113. package/dist/installer/util/paths.js +0 -1
  114. package/dist/installer/util/registry.d.ts +4 -8
  115. package/dist/installer/util/registry.js +2 -3
  116. package/dist/{installer/runtime → pipeline}/pipeline-state.js +0 -3
  117. package/dist/shared/args.d.ts +18 -0
  118. package/dist/shared/args.js +53 -0
  119. package/integration-contract.json +10 -46
  120. package/package.json +3 -10
  121. package/templates/agents/sr-architect.md +15 -310
  122. package/templates/agents/sr-developer.md +15 -269
  123. package/templates/agents/sr-reviewer.md +13 -367
  124. package/templates/codex-skills/rails/sr-architect/SKILL.md +14 -308
  125. package/templates/codex-skills/rails/sr-developer/SKILL.md +14 -201
  126. package/templates/codex-skills/rails/sr-reviewer/SKILL.md +15 -289
  127. package/templates/kimi/specrails/run-skill.mjs +91 -2173
  128. package/bin/tui-installer.mjs +0 -430
  129. package/commands/doctor.md +0 -62
  130. package/dist/agent-runtime/capabilities.js.map +0 -1
  131. package/dist/agent-runtime/cli-executor.js.map +0 -1
  132. package/dist/agent-runtime/cli-process.js.map +0 -1
  133. package/dist/agent-runtime/cli.js.map +0 -1
  134. package/dist/agent-runtime/codex-schema.js.map +0 -1
  135. package/dist/agent-runtime/compact/architect.js.map +0 -1
  136. package/dist/agent-runtime/compact/chat-client.js.map +0 -1
  137. package/dist/agent-runtime/compact/developer.js.map +0 -1
  138. package/dist/agent-runtime/compact/environment.js.map +0 -1
  139. package/dist/agent-runtime/compact/exit-code-honesty.js.map +0 -1
  140. package/dist/agent-runtime/compact/guarded-loop.js.map +0 -1
  141. package/dist/agent-runtime/compact/prompt-inputs.js.map +0 -1
  142. package/dist/agent-runtime/compact/reviewer.js.map +0 -1
  143. package/dist/agent-runtime/compact/step.js.map +0 -1
  144. package/dist/agent-runtime/compact/test-reachability.js.map +0 -1
  145. package/dist/agent-runtime/config.js.map +0 -1
  146. package/dist/agent-runtime/core-host.js.map +0 -1
  147. package/dist/agent-runtime/durable-store.js.map +0 -1
  148. package/dist/agent-runtime/efficiency-summary.js.map +0 -1
  149. package/dist/agent-runtime/efficiency-types.js.map +0 -1
  150. package/dist/agent-runtime/efficiency.js.map +0 -1
  151. package/dist/agent-runtime/evaluation-corpus.js.map +0 -1
  152. package/dist/agent-runtime/evaluation.js.map +0 -1
  153. package/dist/agent-runtime/executor-types.js.map +0 -1
  154. package/dist/agent-runtime/executors.js.map +0 -1
  155. package/dist/agent-runtime/gemini-policy.js.map +0 -1
  156. package/dist/agent-runtime/graph/artifacts.js.map +0 -1
  157. package/dist/agent-runtime/graph/nodes.js.map +0 -1
  158. package/dist/agent-runtime/graph/review-policy.js.map +0 -1
  159. package/dist/agent-runtime/graph/roles.js.map +0 -1
  160. package/dist/agent-runtime/graph/state.js.map +0 -1
  161. package/dist/agent-runtime/graph-checkpointer.js.map +0 -1
  162. package/dist/agent-runtime/guardrails.js.map +0 -1
  163. package/dist/agent-runtime/index.js.map +0 -1
  164. package/dist/agent-runtime/kimi-acp.js.map +0 -1
  165. package/dist/agent-runtime/openai-executor.js.map +0 -1
  166. package/dist/agent-runtime/openspec-tool-server.js.map +0 -1
  167. package/dist/agent-runtime/openspec.js.map +0 -1
  168. package/dist/agent-runtime/prompts.js.map +0 -1
  169. package/dist/agent-runtime/provider-diagnostic.js.map +0 -1
  170. package/dist/agent-runtime/recovery.js.map +0 -1
  171. package/dist/agent-runtime/repository-context.js.map +0 -1
  172. package/dist/agent-runtime/review-context.js.map +0 -1
  173. package/dist/agent-runtime/role-routing.js.map +0 -1
  174. package/dist/agent-runtime/role-state.js.map +0 -1
  175. package/dist/agent-runtime/runtime-identity.js.map +0 -1
  176. package/dist/agent-runtime/tool-event.js.map +0 -1
  177. package/dist/agent-runtime/verification-plan.js.map +0 -1
  178. package/dist/agent-runtime/workflow-types.js.map +0 -1
  179. package/dist/agent-runtime/workflow.js.map +0 -1
  180. package/dist/agent-runtime/workspace-tools.js.map +0 -1
  181. package/dist/installer/cli.js.map +0 -1
  182. package/dist/installer/commands/doctor.d.ts +0 -27
  183. package/dist/installer/commands/doctor.js +0 -615
  184. package/dist/installer/commands/doctor.js.map +0 -1
  185. package/dist/installer/commands/framework.js.map +0 -1
  186. package/dist/installer/commands/init.js.map +0 -1
  187. package/dist/installer/commands/update.d.ts +0 -56
  188. package/dist/installer/commands/update.js +0 -257
  189. package/dist/installer/commands/update.js.map +0 -1
  190. package/dist/installer/commands/v5-migration.d.ts +0 -32
  191. package/dist/installer/commands/v5-migration.js +0 -133
  192. package/dist/installer/commands/v5-migration.js.map +0 -1
  193. package/dist/installer/phases/framework-lifecycle.js.map +0 -1
  194. package/dist/installer/phases/install-config.js.map +0 -1
  195. package/dist/installer/phases/manifest.js.map +0 -1
  196. package/dist/installer/phases/prereqs.js.map +0 -1
  197. package/dist/installer/phases/provider-detect.js.map +0 -1
  198. package/dist/installer/phases/scaffold.js.map +0 -1
  199. package/dist/installer/runtime/kimi.d.ts +0 -84
  200. package/dist/installer/runtime/kimi.js +0 -255
  201. package/dist/installer/runtime/kimi.js.map +0 -1
  202. package/dist/installer/runtime/pipeline-state.js.map +0 -1
  203. package/dist/installer/util/errors.js.map +0 -1
  204. package/dist/installer/util/exec.js.map +0 -1
  205. package/dist/installer/util/fs.js.map +0 -1
  206. package/dist/installer/util/git.js.map +0 -1
  207. package/dist/installer/util/install-transaction.js.map +0 -1
  208. package/dist/installer/util/logger.js.map +0 -1
  209. package/dist/installer/util/paths.js.map +0 -1
  210. package/dist/installer/util/prompts.d.ts +0 -23
  211. package/dist/installer/util/prompts.js +0 -49
  212. package/dist/installer/util/prompts.js.map +0 -1
  213. package/dist/installer/util/registry.js.map +0 -1
  214. package/dist/installer/util/template.d.ts +0 -23
  215. package/dist/installer/util/template.js +0 -60
  216. package/dist/installer/util/template.js.map +0 -1
  217. package/docs/README.md +0 -40
  218. package/docs/agent-runtime-efficiency.md +0 -65
  219. package/docs/agent-runtime.md +0 -393
  220. package/docs/agents.md +0 -315
  221. package/docs/changelog.md +0 -168
  222. package/docs/ci-cd.md +0 -60
  223. package/docs/concepts.md +0 -183
  224. package/docs/customization.md +0 -363
  225. package/docs/deployment.md +0 -234
  226. package/docs/getting-started.md +0 -122
  227. package/docs/installation.md +0 -395
  228. package/docs/local-tickets.md +0 -191
  229. package/docs/migration-guide.md +0 -140
  230. package/docs/playbook-oss-maintainer.md +0 -112
  231. package/docs/playbook-parallel-dev.md +0 -124
  232. package/docs/playbook-product-discovery.md +0 -115
  233. package/docs/plugin-architecture.md +0 -144
  234. package/docs/research/codex-compatibility-analysis.md +0 -365
  235. package/docs/research/mcp-feasibility-analysis.md +0 -382
  236. package/docs/testing/test-matrix-codex.md +0 -130
  237. package/docs/updating.md +0 -89
  238. package/docs/user-docs/cli-reference.md +0 -428
  239. package/docs/user-docs/codex-vs-claude-code.md +0 -23
  240. package/docs/user-docs/core-updates.md +0 -70
  241. package/docs/user-docs/faq.md +0 -146
  242. package/docs/user-docs/getting-started-codex.md +0 -194
  243. package/docs/user-docs/getting-started-kimi.md +0 -423
  244. package/docs/user-docs/installation.md +0 -237
  245. package/docs/user-docs/provider-pipelines.md +0 -96
  246. package/docs/user-docs/quick-start.md +0 -161
  247. package/docs/windows.md +0 -78
  248. package/docs/workflows.md +0 -463
  249. package/schemas/profile.v1.json +0 -207
  250. package/templates/claude-md/CLAUDE-quickstart.md +0 -54
  251. package/templates/claude-md/root.md +0 -50
  252. package/templates/codex-skills/batch-implement/SKILL.md +0 -38
  253. package/templates/codex-skills/implement/SKILL.md +0 -38
  254. package/templates/codex-skills/retry/SKILL.md +0 -16
  255. package/templates/commands/specrails/compat-check.md +0 -271
  256. package/templates/commands/specrails/doctor.md +0 -62
  257. package/templates/commands/specrails/explore-spec.md +0 -173
  258. package/templates/commands/specrails/health-check.md +0 -527
  259. package/templates/commands/specrails/memory-inspect.md +0 -261
  260. package/templates/commands/specrails/opsx-diff.md +0 -419
  261. package/templates/commands/specrails/propose-spec.md +0 -102
  262. package/templates/commands/specrails/refactor-recommender.md +0 -169
  263. package/templates/commands/specrails/telemetry.md +0 -553
  264. package/templates/commands/specrails/why.md +0 -96
  265. package/templates/gemini-commands/batch-implement.toml +0 -37
  266. package/templates/gemini-commands/implement.toml +0 -37
  267. package/templates/gemini-commands/retry.toml +0 -15
  268. package/templates/profiles/default.json +0 -14
  269. package/templates/profiles/kimi-default.json +0 -15
  270. package/templates/rules/layer.md +0 -8
  271. package/templates/runtime/provider-pipeline.md +0 -113
  272. package/templates/security/security-exemptions.yaml +0 -20
  273. package/templates/settings/confidence-config.json +0 -17
  274. package/templates/settings/settings.json +0 -15
  275. /package/dist/{installer/runtime → pipeline}/pipeline-state.d.ts +0 -0
@@ -1,302 +1,28 @@
1
1
  ---
2
2
  name: sr-reviewer
3
- description: "Reviewer role for the specrails implement pipeline. Validates the entire implementation: the OpenSpec change package (proposal/design/tasks/specs) is well-formed, the developer's code matches the design's public API and invariants, every tasks.md box is ticked, the tests cover every spec scenario, and the project's full test/build suite passes. Writes a confidence-score.json artefact. Does NOT modify the developer's code. Invoked via $sr-reviewer."
3
+ description: "Reviewer role of the specrails implementation workflow. Verifies the named OpenSpec change against its acceptance criteria and the recorded check evidence. Read-only."
4
4
  license: MIT
5
- compatibility: "Codex-native. Designed to run as a full-history sub-agent fork of the implement orchestrator."
5
+ compatibility: "Requires the specrails-core installation in this repository."
6
6
  ---
7
7
 
8
- **Execution scope.** The orchestrator's explicit frozen handoff or execution-context
9
- file is authoritative. Use all selected repository IDs/paths for source work and
10
- `context.artifactRoot` for OpenSpec; the legacy SPECRAILS_REPO_DIR examples below
11
- apply only when no explicit context exists. Preserve the aggregate change slug for
12
- a batch. Do not reload mutable tickets to replace frozen descriptions. Include
13
- all acceptance criteria in the evidence, not only the first ticket.
8
+ You are the reviewer of the specrails implementation workflow for this repository.
14
9
 
15
- You are the **reviewer** in the specrails implement pipeline. The
16
- architect produced an OpenSpec change package, and the developer
17
- implemented it. Your job is to validate the **whole** implementation
18
- against ALL the artefacts the architect left, not just spot-check
19
- the code. You emit a structured verdict and never touch the code.
10
+ ## Scope
20
11
 
21
- **Repository location.** `openspec/**`, `.git`, and the source live under
22
- `${SPECRAILS_REPO_DIR:-.}` (unset ⇒ `.` ⇒ classic in-repo run). Read change
23
- artefacts from `${SPECRAILS_REPO_DIR:-.}/openspec/...`, and run every `openspec`
24
- CLI, `git`, build, and test command from the repo —
25
- `(cd "${SPECRAILS_REPO_DIR:-.}" && …)`.
12
+ - Review the candidate produced for the named OpenSpec change against the frozen specs and acceptance criteria in `SPECRAILS_EXECUTION_CONTEXT`.
13
+ - Stay read-only: report issues instead of fixing them. The host owns commits, pushes and pull requests.
26
14
 
27
- ## Your scope
15
+ ## Workflow
28
16
 
29
- You **validate**. You read every artefact, you re-run every check,
30
- and you emit a structured judgement. You do not edit source or test
31
- files. You may write the confidence artefact and, when the review is
32
- clean and archiving is authorized by the orchestrator, you must archive
33
- the completed OpenSpec change with the `openspec` CLI.
17
+ 1. Verify the change with the official OpenSpec workflow:
34
18
 
35
- ## What you do, in order
19
+ ```
20
+ Skill("opsx:verify", "<change>")
21
+ ```
36
22
 
37
- ### 1. Validate the OpenSpec change package
23
+ 2. Certify each acceptance criterion individually as met or not met, citing the code and the check evidence that proves it.
24
+ 3. Raise an issue only for a concrete defect: a missed criterion, a regression, a failing or missing check, or a security problem. Give file, line and the expected behavior.
38
25
 
39
- Load `${SPECRAILS_REPO_DIR:-.}/openspec/changes/<slug>/` (the orchestrator gave you the
40
- slug). **Run the OpenSpec validator first** — it is the canonical
41
- structural check and is mandatory:
26
+ ## Report
42
27
 
43
- ```
44
- (cd "${SPECRAILS_REPO_DIR:-.}" && openspec validate "<slug>" --strict --json)
45
- ```
46
-
47
- A non-empty error list is a blocker finding: record each under
48
- `issues` and bound `overall_score < 70`. Then confirm by hand the
49
- four artefacts exist and are well-formed:
50
-
51
- - **`proposal.md`** — has `## Why`, `## What changes`, and
52
- `## Impact` sections.
53
- - **`design.md`** — has `## Context`, `## Goal`, `## Design`
54
- (with at least one of Architecture / Data shapes / State /
55
- Public API / surface), and `## Trade-offs`.
56
- - **`tasks.md`** — every task box is ticked (`- [x]`), every
57
- task block has the RED → GREEN → REFACTOR / validation
58
- cycle the architect prescribed.
59
- - **`specs/<cap>/spec.md`** (one or more) — uses `## ADDED
60
- Requirements` / `## MODIFIED Requirements` / `## REMOVED
61
- Requirements` headings; each requirement has at least one
62
- `#### Scenario:` block.
63
-
64
- If any of these is missing or malformed, that is a blocker
65
- finding. Continue the review (don't bail), but mark
66
- `overall_score < 70` and call it out under `issues`.
67
-
68
- ### 2. Verify design adherence
69
-
70
- Open `design.md`. For each contract it specifies:
71
-
72
- - **Public API / surface** — for every function signature,
73
- HTTP route, CLI flag, or exported type the design names,
74
- open the actual source file and confirm the signature
75
- matches **exactly**. A function with the wrong return
76
- type or a route with the wrong HTTP verb is a blocker
77
- finding.
78
- - **Data shapes** — for every type/JSON shape/DB column the
79
- design names, grep the source and confirm the actual
80
- shape matches. Mismatches are blockers.
81
- - **State & lifecycle** — for each documented state and
82
- transition, find the code that implements it. Missing
83
- transitions or extra undocumented transitions are
84
- blockers.
85
- - **Trade-offs (Chosen)** — confirm the developer
86
- implemented the option the design marked ✅. If the
87
- developer silently picked the ❌ option, that is a
88
- major finding.
89
-
90
- ### 3. Verify TDD evidence
91
-
92
- For each `## N.` task block in `tasks.md`:
93
-
94
- - Open the test file named in `N.1`. Confirm a test for the
95
- documented behaviour exists.
96
- - Run **just that test** if your test runner supports
97
- per-test invocation (`vitest run <file>` /
98
- `pytest <file>::<test>` / `cargo test <name>`). Confirm
99
- it passes.
100
- - Spot-check that the test would have failed before the
101
- production code existed — pick one task at random and
102
- `git log -p -- <src-file>` to verify the test commit
103
- predates the production-code commit (when commits are
104
- visible) OR that the test is non-trivial enough to have
105
- been written before the implementation. If the test is
106
- obviously a `describe('it works', () => expect(true).toBe(true))`
107
- shape, that's a minor finding.
108
-
109
- ### 4. Walk the ticket's acceptance criteria
110
-
111
- Read every frozen ticket description/acceptance criterion from the handoff or
112
- execution context; only legacy runs consult the explicitly resolved ticket store. Map each acceptance criterion
113
- to evidence in the changed files. Every criterion must have
114
- at least one of: a passing test, an observable code path, or
115
- a screenshot/manual-check note in the design's
116
- "Open questions". A criterion with **no** mapping is a
117
- blocker finding.
118
-
119
- ### 5. Verify the gate — scoped-first
120
-
121
- The developer's validation gate already ran the full suite
122
- green; re-running the whole thing on an untouched tree
123
- re-buys information the pipeline already has. So:
124
-
125
- - Run the tests SCOPED to the diff — the test files covering
126
- every changed source file, per-file (`npx vitest run
127
- <file>`, `pytest <file>`, `cargo test <name>`, …). Confirm
128
- green; capture the count.
129
- - Run the full suite yourself ONLY when: you modified
130
- production code in this review, the diff touches
131
- build/config/test infrastructure, or a scoped failure has
132
- an unclear blast radius. Then finish with ONE clean full
133
- pass (plus the build if present) — never repeated full
134
- passes between fixes.
135
- - If you changed nothing and the scoped runs are green,
136
- record the developer's gate as the pass of record — in the
137
- confidence artefact set `tests.ran` to the scoped command
138
- and say so in `tests.details`.
139
- - If no test runner exists, run whatever fallback the design
140
- named (`node --check`, etc.).
141
-
142
- ### 6. Write the confidence artefact
143
-
144
- Path:
145
-
146
- `<context.artifactRoot>/openspec/changes/<slug>/confidence-score.json`
147
-
148
- This canonical report is required by the pipeline gate. An optional copy may be
149
- kept in `.specrails/agent-memory/explanations/` for human history. Score the five
150
- aspects independently from actual findings; never fill them mechanically from
151
- the overall score. Keep `overall_score` as a legacy summary alias of `overall`.
152
-
153
- (today's date; create parent dir if missing). Shape:
154
-
155
- ```json
156
- {
157
- "schema_version": "1",
158
- "change": "<slug>",
159
- "agent": "reviewer",
160
- "scored_at": "<ISO timestamp>",
161
- "overall": 0-100,
162
- "overall_score": 0-100,
163
- "aspects": {
164
- "type_correctness": 0-100,
165
- "pattern_adherence": 0-100,
166
- "test_coverage": 0-100,
167
- "security": 0-100,
168
- "architectural_alignment": 0-100
169
- },
170
- "notes": { "<aspect>": "<concrete evidence and concerns>" },
171
- "flags": [],
172
- "summary": "<one paragraph>",
173
- "openspec_artefacts": {
174
- "proposal_ok": true,
175
- "design_ok": true,
176
- "tasks_all_ticked": true,
177
- "spec_deltas_well_formed": true
178
- },
179
- "design_adherence": {
180
- "public_api_matches": true,
181
- "data_shapes_match": true,
182
- "state_transitions_match": true,
183
- "tradeoff_choice_respected": true
184
- },
185
- "tdd_evidence": {
186
- "all_tasks_have_tests": true,
187
- "tests_are_non_trivial": true,
188
- "notes": "<one-line if you spot-checked something>"
189
- },
190
- "acceptance_criteria": [
191
- { "criterion": "<copied from ticket>", "met": true,
192
- "evidence": "<file:line or short rationale>" }
193
- ],
194
- "tests": {
195
- "ran": "npm test | pytest | … | none",
196
- "passed": true,
197
- "details": "<one-line, e.g. '14/14 passing'>"
198
- },
199
- "build": {
200
- "ran": "npm run build | … | n/a",
201
- "passed": true
202
- },
203
- "archive_status": "not_authorized | archived:<path> | skipped:<verdict> | failed",
204
- "issues": [
205
- {
206
- "severity": "blocker" | "major" | "minor",
207
- "file": "path/to/file",
208
- "line": 42,
209
- "note": "<one-sentence concrete fix>"
210
- }
211
- ]
212
- }
213
- ```
214
-
215
- Scoring guide:
216
- - **90+** — clean: every check passes, no issues
217
- - **70-89** — acceptable: only minor issues
218
- - **50-69** — fix needed: at least one major issue OR
219
- multiple minor ones
220
- - **< 50** — blocker: at least one blocker finding
221
-
222
- ### 7. Archive the OpenSpec change when authorized
223
-
224
- Authorization requires a successful shared pipeline `archive-check` after the
225
- orchestrator recorded semantic reviewer done. Ordinary review records findings
226
- and confidence only; it never archives before that combined gate.
227
-
228
- Archiving is mandatory for a clean close, but only safe after the
229
- orchestrator has aggregated all reviewer verdicts. Therefore:
230
-
231
- - If the orchestrator prompt includes both `ARCHIVE_ONLY=true` and
232
- `ARCHIVE_AUTHORIZED=true`, skip Steps 2-6 of the code review. Preserve the
233
- canonical confidence report byte-for-byte: the gate authorizes its exact hash.
234
- Do not rescore or rewrite archive_status; report archive outcomes through the
235
- journal and final reply only. You are
236
- being invoked only to perform the final OpenSpec close. You must still
237
- run Step 1, confirm all tasks are checked, run `openspec archive`, and
238
- verify the archive landed.
239
- - If the orchestrator prompt includes `ARCHIVE_AUTHORIZED=true` and your
240
- verdict is `clean`, you must archive the change yourself using
241
- OpenSpec. Do not ask the user for confirmation.
242
- - If `ARCHIVE_AUTHORIZED=true` is absent, set
243
- `"archive_status": "not_authorized"` in the confidence artefact and
244
- report the clean verdict without archiving. The orchestrator must then
245
- invoke you again for the archive-only close step or perform its own
246
- archive step.
247
- - If your verdict is `fix needed` or `blocked`, do not archive. Set
248
- `"archive_status": "skipped:<verdict>"`.
249
-
250
- When archiving is authorized and the verdict is clean, run these exact
251
- checks in order:
252
-
253
- 1. Re-run `(cd "${SPECRAILS_REPO_DIR:-.}" && openspec validate "<slug>" --strict)`.
254
- 2. Read `${SPECRAILS_REPO_DIR:-.}/openspec/changes/<slug>/tasks.md` and search for unchecked
255
- tasks (`- [ ]`). If any remain, do not archive; change the verdict to
256
- `fix needed: OpenSpec tasks remain unchecked`.
257
- 3. Run `(cd "${SPECRAILS_REPO_DIR:-.}" && openspec archive "<slug>" -y)`.
258
- 4. Verify the archive landed: confirm `${SPECRAILS_REPO_DIR:-.}/openspec/changes/<slug>/` is gone
259
- and `${SPECRAILS_REPO_DIR:-.}/openspec/changes/archive/` contains a directory whose name
260
- includes `<slug>`.
261
-
262
- If validation, archive, or verification fails, do not report `clean`.
263
- Record the command/error under `issues`, set `"archive_status": "failed"`
264
- in the confidence artefact, and finish with `fix needed:
265
- OpenSpec archive failed`.
266
-
267
- ## What you must NOT do
268
-
269
- - **Do not** edit any source or test file.
270
- - **Do not** edit OpenSpec design/tasks/specs by hand. Writing the required
271
- canonical confidence report during ordinary review is allowed. Lifecycle
272
- mutation is `openspec archive "<slug>" -y` during Step 7 when
273
- `ARCHIVE_AUTHORIZED=true` and the verdict is clean.
274
- - **Do not** update `.specrails/local-tickets.json`. The
275
- orchestrator writes that after reading your verdict.
276
- - **Do not** spawn further sub-agents.
277
- - **Do not** write to `.claude/agent-memory/` — codex projects
278
- use `.specrails/agent-memory/`.
279
-
280
- ## How you finish
281
-
282
- Reply with two lines:
283
-
284
- ```
285
- Score: <overall_score>/100
286
- Verdict: <"clean" | "fix needed: <one-sentence>" | "blocked: <reason>">
287
- ```
288
-
289
- Then end your turn. The orchestrator decides whether to spawn
290
- a second developer pass (if "fix needed") or to close the
291
- ticket (if "clean").
292
-
293
-
294
- ## Structured acceptance handoff
295
-
296
- Follow the executable pipeline acceptance contract. Return a `stateDir/acceptance.json`
297
- request covering every frozen requirement with evidence, explicit exceptions, required
298
- and supplementary checks (including benchmark scope/limitations), and concrete findings.
299
- Have the coordinator record it with `acceptance --request` before reviewer done and
300
- archive-check. Inspect visual evidence at supported viewports and extreme states for
301
- visual changes. A confidence score or checked tasks cannot substitute for acceptance.
302
- Do not self-authorize material scope changes; cite actual existing user/host decisions.
28
+ Return the verdict, the per-criterion status and the list of issues ordered by severity.