olympus-ai 4.5.13 → 4.5.14

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 (49) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/cli/index.js +63 -27
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/hooks/olympus-hooks.cjs +257 -257
  5. package/dist/installer/hooks.d.ts +47 -14
  6. package/dist/installer/hooks.d.ts.map +1 -1
  7. package/dist/installer/hooks.js +45 -77
  8. package/dist/installer/hooks.js.map +1 -1
  9. package/dist/installer/index.d.ts +8 -7
  10. package/dist/installer/index.d.ts.map +1 -1
  11. package/dist/installer/index.js +49 -46
  12. package/dist/installer/index.js.map +1 -1
  13. package/package.json +1 -1
  14. package/resources/config/risk-keywords.json +5 -5
  15. package/resources/rules/common/ascii-diagram-standards.md +115 -115
  16. package/resources/rules/common/content-validation.md +131 -131
  17. package/resources/rules/common/error-handling.md +430 -430
  18. package/resources/rules/common/markdown-formatting.md +170 -170
  19. package/resources/rules/common/overconfidence-prevention.md +100 -100
  20. package/resources/rules/common/pathway-behaviors.json +60 -60
  21. package/resources/rules/common/pathway-behaviors.md +100 -100
  22. package/resources/rules/common/process-overview.md +157 -157
  23. package/resources/rules/common/terminal-formatting.md +161 -161
  24. package/resources/rules/common/terminology.md +189 -189
  25. package/resources/rules/common/welcome-message.md +118 -118
  26. package/resources/rules/common/workflow-changes.md +285 -285
  27. package/resources/rules/construction/bolt-planning.md +153 -153
  28. package/resources/rules/construction/bolt-review.md +143 -143
  29. package/resources/rules/construction/build-and-test.md +527 -527
  30. package/resources/rules/construction/code-generation.md +414 -414
  31. package/resources/rules/construction/documentation.md +201 -201
  32. package/resources/rules/construction/functional-design.md +135 -135
  33. package/resources/rules/construction/infrastructure-design.md +110 -110
  34. package/resources/rules/construction/nfr-design.md +106 -106
  35. package/resources/rules/construction/nfr-requirements.md +118 -118
  36. package/resources/rules/construction/test-generation.md +112 -112
  37. package/resources/rules/core-workflow.md +196 -196
  38. package/resources/rules/inception/application-design.md +195 -195
  39. package/resources/rules/inception/bolt-planning.md +588 -588
  40. package/resources/rules/inception/reverse-engineering.md +354 -354
  41. package/resources/rules/inception/units-generation.md +505 -505
  42. package/resources/rules/inception/user-stories.md +527 -527
  43. package/resources/rules/inception/workspace-detection.md +82 -82
  44. package/resources/rules/operations/operations.md +19 -19
  45. package/resources/skills/brief/templates/ai-dlc-intent-brief-template.md +149 -149
  46. package/resources/skills/getting-started/SKILL.md +79 -79
  47. package/resources/templates/construction/bolt-spec-template.md +270 -270
  48. package/resources/templates/inception/unit-brief-template.md +188 -188
  49. package/resources/templates/inception/units-template.md +99 -99
@@ -1,153 +1,153 @@
1
- # Bolt Planning - Decomposing Units into Bolts
2
-
3
- ## Overview
4
-
5
- The Bolt Planning stage runs after unit design is complete. The BoltPlanner decomposes each construction unit into one or more bolts — scoped execution packages that a code-generation agent can implement in a focused session.
6
-
7
- Bolts are the smallest execution loop in the AIDLC construction pipeline. Each bolt has a clear scope, acceptance criteria, and target files. Together, all bolts for a unit must provide >=95% story coverage.
8
-
9
- ---
10
-
11
- ## Bolt Spec Artifact
12
-
13
- Each bolt is described by a spec file written during this stage.
14
-
15
- **Path**: `{workflowId}/construction/{parent_unit_id}/bolts/BOLT-NNN-slug/spec.md`
16
-
17
- Example: `{workflowId}/construction/UNIT-001-foundation/bolts/BOLT-001-data-model/spec.md`
18
-
19
- ### Spec Template
20
-
21
- The canonical bolt spec template is defined at:
22
-
23
- **Template file**: `resources/templates/construction/bolt-spec-template.md`
24
-
25
- When creating bolt specs, agents MUST read this template file and follow its structure exactly. The template defines all required frontmatter fields (including runtime state fields), all required body sections, status values, and stage status symbols.
26
-
27
- > **CRITICAL**: Do NOT invent your own spec format. Read and follow the template.
28
-
29
- ### Required Body Sections
30
-
31
- Every bolt spec must contain ALL of the following sections (10 total):
32
-
33
- 1. **Scope** — What this bolt implements
34
- 2. **Stories Included** — Checkbox list of stories with priorities (`- [ ] **S-001**: title -- Priority: Must`)
35
- 3. **Acceptance Criteria** — Checkbox list of verifiable criteria (`- [ ] criterion`)
36
- 4. **Expected Outputs** — Concrete deliverables this bolt produces
37
- 5. **Target Files** — Files to create or modify (backtick-wrapped paths)
38
- 6. **Stages** — 4-stage execution checklist (elaboration, code_generation, build_and_test, review)
39
- 7. **Dependencies** — Three subsections: Bolt Dependencies (within unit), Unit Dependencies (cross-unit), Enables (bolts waiting on this)
40
- 8. **Success Criteria** — Completion checklist (all stories implemented, tests passing, code reviewed)
41
- 9. **Traceability** — Requirement and story ID references
42
-
43
- ---
44
-
45
- ## Naming Convention
46
-
47
- Bolt IDs use global sequential numbering across ALL units — not per-unit numbering.
48
-
49
- Format: `BOLT-NNN-slug`
50
-
51
- - `NNN` is zero-padded to three digits: `001`, `002`, `003`, ...
52
- - `slug` is a short kebab-case description of the bolt's scope
53
- - Numbers do NOT reset when moving to a new unit
54
-
55
- Examples:
56
- - `BOLT-001-data-model`
57
- - `BOLT-002-repository-layer`
58
- - `BOLT-015-admin-dashboard`
59
-
60
- ---
61
-
62
- ## Bolt Count Guardrails
63
-
64
- | Scope | Limit |
65
- |-------|-------|
66
- | Max bolts per unit | 8 |
67
- | Max bolts total (all units) | 50 |
68
-
69
- If a unit's scope exceeds 8 bolts, it must be re-scoped or split into multiple units before bolt planning can proceed.
70
-
71
- ---
72
-
73
- ## Traceability Rules
74
-
75
- Every bolt MUST satisfy the following traceability requirements:
76
-
77
- - **Requirement reference is mandatory**: Every bolt must reference at least one requirement ID in its `requirements` frontmatter field and its `## Traceability` section. Requirement IDs come from `requirements.md` (e.g., `FR-1`, `FR-3`). A bolt with no requirement reference is invalid and must be revised before execution.
78
- - **Story reference is recommended but optional**: Not all bolts map directly to user stories (infrastructure, scaffolding, and cross-cutting bolts often do not). Include story IDs when they exist; leave the `stories` field as an empty array `[]` when none apply.
79
- - **Planner responsibility**: The planner agent is responsible for reading the inception `requirements.md` and `stories.md` artifacts and populating these fields for every bolt it generates. Do not leave them as placeholder values.
80
- - **Coverage check at plan completion**: After all bolts for a unit are planned, a coverage check verifies that every requirement with `must` priority in `requirements.md` is addressed by at least one bolt. Unaddressed `must` requirements must be resolved before bolt execution begins (either by revising an existing bolt's scope or adding a new bolt).
81
-
82
- ---
83
-
84
- ## Documentation Impact Assessment
85
-
86
- The planner MUST assess `docs_impact` for every bolt based on what the bolt changes. Apply these rules:
87
-
88
- - **User-facing features** (new UI, new CLI commands, new API endpoints): include `user-guide`
89
- - **Configuration changes** (new env vars, new settings, new options): include `config-reference`
90
- - **CLI changes** (new commands, new flags, changed usage): include `cli-reference`
91
- - **Breaking changes** (removed features, changed APIs, migration needed): include `migration-guide`
92
- - **README-worthy changes** (new capabilities, changed project setup): include `readme`
93
- - **Architectural changes** (new services, new data flows, new components): include `architecture`
94
- - **Complex internal logic** (non-obvious algorithms, intricate state machines): include `code-comments`
95
- - **Internal-only changes** (refactoring, test fixes, minor tweaks with no user impact): use `none`
96
-
97
- A bolt may have multiple `docs_impact` values (e.g., `["user-guide", "config-reference"]`). Only use `none` when the bolt has zero documentation impact.
98
-
99
- ---
100
-
101
- ## Coverage Validation
102
-
103
- After bolt decomposition, the BoltPlanner validates that the bolt set covers all unit stories and requirements.
104
-
105
- | Coverage | Result |
106
- |----------|--------|
107
- | >= 95% | Pass — proceed to execution |
108
- | 80-94% | Warning — user must explicitly acknowledge the gap before proceeding |
109
- | < 80% | Hard block — bolt planning rejected, must revise decomposition |
110
-
111
- Story coverage is measured as: (stories with at least one covering bolt) / (total unit stories).
112
-
113
- Requirement coverage (must-priority only): all `must`-priority requirements in `requirements.md` must be referenced by at least one bolt. Any uncovered `must` requirement is treated as a hard block regardless of story coverage score.
114
-
115
- ---
116
-
117
- ## Bolt Lifecycle States
118
-
119
- Each bolt progresses through the following states:
120
-
121
- | State | Meaning |
122
- |-------|---------|
123
- | `planned` | Spec written, not yet started |
124
- | `in_progress` | Code generation agent is actively working |
125
- | `built` | Code generation complete, pending review |
126
- | `in_review` | BoltReviewer is evaluating the bolt |
127
- | `done` | Reviewed and accepted |
128
- | `failed` | Review rejected; requires re-scope or split |
129
-
130
- ---
131
-
132
- ## Express Bolt Eligibility
133
-
134
- A bolt is eligible for express mode (skips the elaboration stage) if either condition is met:
135
-
136
- - `depth_target` <= 4 (low-complexity bolt)
137
- - Parent unit's pathway is `bugfix`
138
-
139
- Express bolts go directly from `planned` to code generation. The `express_mode: true` flag must be set in the bolt spec frontmatter.
140
-
141
- ---
142
-
143
- ## Checkpoint Fields
144
-
145
- The workflow checkpoint tracks bolt state under the unit entry:
146
-
147
- | Field | Description |
148
- |-------|-------------|
149
- | `construction_bolts` | Map of bolt IDs to `ConstructionBoltProgress` objects |
150
- | `active_bolt_id` | ID of the bolt currently in execution (or `null`) |
151
- | `active_bolt_stage` | Current execution stage of the active bolt |
152
-
153
- The `active_bolt_stage` values correspond to execution stages: `elaboration`, `code_generation`, `build_and_test`, `review`.
1
+ # Bolt Planning - Decomposing Units into Bolts
2
+
3
+ ## Overview
4
+
5
+ The Bolt Planning stage runs after unit design is complete. The BoltPlanner decomposes each construction unit into one or more bolts — scoped execution packages that a code-generation agent can implement in a focused session.
6
+
7
+ Bolts are the smallest execution loop in the AIDLC construction pipeline. Each bolt has a clear scope, acceptance criteria, and target files. Together, all bolts for a unit must provide >=95% story coverage.
8
+
9
+ ---
10
+
11
+ ## Bolt Spec Artifact
12
+
13
+ Each bolt is described by a spec file written during this stage.
14
+
15
+ **Path**: `{workflowId}/construction/{parent_unit_id}/bolts/BOLT-NNN-slug/spec.md`
16
+
17
+ Example: `{workflowId}/construction/UNIT-001-foundation/bolts/BOLT-001-data-model/spec.md`
18
+
19
+ ### Spec Template
20
+
21
+ The canonical bolt spec template is defined at:
22
+
23
+ **Template file**: `resources/templates/construction/bolt-spec-template.md`
24
+
25
+ When creating bolt specs, agents MUST read this template file and follow its structure exactly. The template defines all required frontmatter fields (including runtime state fields), all required body sections, status values, and stage status symbols.
26
+
27
+ > **CRITICAL**: Do NOT invent your own spec format. Read and follow the template.
28
+
29
+ ### Required Body Sections
30
+
31
+ Every bolt spec must contain ALL of the following sections (10 total):
32
+
33
+ 1. **Scope** — What this bolt implements
34
+ 2. **Stories Included** — Checkbox list of stories with priorities (`- [ ] **S-001**: title -- Priority: Must`)
35
+ 3. **Acceptance Criteria** — Checkbox list of verifiable criteria (`- [ ] criterion`)
36
+ 4. **Expected Outputs** — Concrete deliverables this bolt produces
37
+ 5. **Target Files** — Files to create or modify (backtick-wrapped paths)
38
+ 6. **Stages** — 4-stage execution checklist (elaboration, code_generation, build_and_test, review)
39
+ 7. **Dependencies** — Three subsections: Bolt Dependencies (within unit), Unit Dependencies (cross-unit), Enables (bolts waiting on this)
40
+ 8. **Success Criteria** — Completion checklist (all stories implemented, tests passing, code reviewed)
41
+ 9. **Traceability** — Requirement and story ID references
42
+
43
+ ---
44
+
45
+ ## Naming Convention
46
+
47
+ Bolt IDs use global sequential numbering across ALL units — not per-unit numbering.
48
+
49
+ Format: `BOLT-NNN-slug`
50
+
51
+ - `NNN` is zero-padded to three digits: `001`, `002`, `003`, ...
52
+ - `slug` is a short kebab-case description of the bolt's scope
53
+ - Numbers do NOT reset when moving to a new unit
54
+
55
+ Examples:
56
+ - `BOLT-001-data-model`
57
+ - `BOLT-002-repository-layer`
58
+ - `BOLT-015-admin-dashboard`
59
+
60
+ ---
61
+
62
+ ## Bolt Count Guardrails
63
+
64
+ | Scope | Limit |
65
+ |-------|-------|
66
+ | Max bolts per unit | 8 |
67
+ | Max bolts total (all units) | 50 |
68
+
69
+ If a unit's scope exceeds 8 bolts, it must be re-scoped or split into multiple units before bolt planning can proceed.
70
+
71
+ ---
72
+
73
+ ## Traceability Rules
74
+
75
+ Every bolt MUST satisfy the following traceability requirements:
76
+
77
+ - **Requirement reference is mandatory**: Every bolt must reference at least one requirement ID in its `requirements` frontmatter field and its `## Traceability` section. Requirement IDs come from `requirements.md` (e.g., `FR-1`, `FR-3`). A bolt with no requirement reference is invalid and must be revised before execution.
78
+ - **Story reference is recommended but optional**: Not all bolts map directly to user stories (infrastructure, scaffolding, and cross-cutting bolts often do not). Include story IDs when they exist; leave the `stories` field as an empty array `[]` when none apply.
79
+ - **Planner responsibility**: The planner agent is responsible for reading the inception `requirements.md` and `stories.md` artifacts and populating these fields for every bolt it generates. Do not leave them as placeholder values.
80
+ - **Coverage check at plan completion**: After all bolts for a unit are planned, a coverage check verifies that every requirement with `must` priority in `requirements.md` is addressed by at least one bolt. Unaddressed `must` requirements must be resolved before bolt execution begins (either by revising an existing bolt's scope or adding a new bolt).
81
+
82
+ ---
83
+
84
+ ## Documentation Impact Assessment
85
+
86
+ The planner MUST assess `docs_impact` for every bolt based on what the bolt changes. Apply these rules:
87
+
88
+ - **User-facing features** (new UI, new CLI commands, new API endpoints): include `user-guide`
89
+ - **Configuration changes** (new env vars, new settings, new options): include `config-reference`
90
+ - **CLI changes** (new commands, new flags, changed usage): include `cli-reference`
91
+ - **Breaking changes** (removed features, changed APIs, migration needed): include `migration-guide`
92
+ - **README-worthy changes** (new capabilities, changed project setup): include `readme`
93
+ - **Architectural changes** (new services, new data flows, new components): include `architecture`
94
+ - **Complex internal logic** (non-obvious algorithms, intricate state machines): include `code-comments`
95
+ - **Internal-only changes** (refactoring, test fixes, minor tweaks with no user impact): use `none`
96
+
97
+ A bolt may have multiple `docs_impact` values (e.g., `["user-guide", "config-reference"]`). Only use `none` when the bolt has zero documentation impact.
98
+
99
+ ---
100
+
101
+ ## Coverage Validation
102
+
103
+ After bolt decomposition, the BoltPlanner validates that the bolt set covers all unit stories and requirements.
104
+
105
+ | Coverage | Result |
106
+ |----------|--------|
107
+ | >= 95% | Pass — proceed to execution |
108
+ | 80-94% | Warning — user must explicitly acknowledge the gap before proceeding |
109
+ | < 80% | Hard block — bolt planning rejected, must revise decomposition |
110
+
111
+ Story coverage is measured as: (stories with at least one covering bolt) / (total unit stories).
112
+
113
+ Requirement coverage (must-priority only): all `must`-priority requirements in `requirements.md` must be referenced by at least one bolt. Any uncovered `must` requirement is treated as a hard block regardless of story coverage score.
114
+
115
+ ---
116
+
117
+ ## Bolt Lifecycle States
118
+
119
+ Each bolt progresses through the following states:
120
+
121
+ | State | Meaning |
122
+ |-------|---------|
123
+ | `planned` | Spec written, not yet started |
124
+ | `in_progress` | Code generation agent is actively working |
125
+ | `built` | Code generation complete, pending review |
126
+ | `in_review` | BoltReviewer is evaluating the bolt |
127
+ | `done` | Reviewed and accepted |
128
+ | `failed` | Review rejected; requires re-scope or split |
129
+
130
+ ---
131
+
132
+ ## Express Bolt Eligibility
133
+
134
+ A bolt is eligible for express mode (skips the elaboration stage) if either condition is met:
135
+
136
+ - `depth_target` <= 4 (low-complexity bolt)
137
+ - Parent unit's pathway is `bugfix`
138
+
139
+ Express bolts go directly from `planned` to code generation. The `express_mode: true` flag must be set in the bolt spec frontmatter.
140
+
141
+ ---
142
+
143
+ ## Checkpoint Fields
144
+
145
+ The workflow checkpoint tracks bolt state under the unit entry:
146
+
147
+ | Field | Description |
148
+ |-------|-------------|
149
+ | `construction_bolts` | Map of bolt IDs to `ConstructionBoltProgress` objects |
150
+ | `active_bolt_id` | ID of the bolt currently in execution (or `null`) |
151
+ | `active_bolt_stage` | Current execution stage of the active bolt |
152
+
153
+ The `active_bolt_stage` values correspond to execution stages: `elaboration`, `code_generation`, `build_and_test`, `review`.
@@ -1,143 +1,143 @@
1
- # Bolt Review - Mandatory Quality Gate
2
-
3
- ## Overview
4
-
5
- The Bolt Review stage is a mandatory quality gate that runs after every bolt's code generation is complete. The BoltReviewer evaluates whether the generated code meets the bolt's acceptance criteria and aligns with the approved spec.
6
-
7
- Review is performed by the `momus` agent via a review callback. BoltReviewer returns structured decision objects — it does not interact with users directly. User interaction (acknowledgment prompts, escalation notices) is handled by the orchestrator based on the decision returned.
8
-
9
- ---
10
-
11
- ## Two-Tier Alignment Model
12
-
13
- The BoltReviewer scores each bolt on a 0-100% alignment scale and maps the score to one of three tiers:
14
-
15
- | Score | Tier | Action |
16
- |-------|------|--------|
17
- | >= 70% | Auto-approve | Bolt accepted automatically; no user interaction required |
18
- | 50-69% | Advisory | Bolt proceeds with mandatory user acknowledgment |
19
- | < 50% | Hard block | Bolt rejected; must be re-scoped or split before retrying |
20
-
21
- ### Auto-Approve (>= 70%)
22
-
23
- The bolt is accepted. The orchestrator transitions the bolt state from `in_review` to `done` without prompting the user.
24
-
25
- ### Advisory (50-69%)
26
-
27
- The orchestrator presents the review findings to the user and requires explicit acknowledgment before the bolt proceeds. The user must confirm they understand the concerns and accept the bolt as-is.
28
-
29
- Acknowledgment is recorded in the bolt's `ConstructionBoltProgress` entry:
30
- - `acknowledged_by`: identifier of the user who acknowledged
31
- - `acknowledged_at`: ISO 8601 timestamp of acknowledgment
32
-
33
- ### Hard Block (< 50%)
34
-
35
- The bolt is rejected. The orchestrator transitions the bolt state to `failed`. The user must re-scope the bolt (narrow scope, reduce complexity) or split it into smaller bolts before code generation can be retried.
36
-
37
- Hard blocks are never overridden, regardless of trust level.
38
-
39
- ---
40
-
41
- ## Trust-Based Auto-Approval
42
-
43
- When the trust level for the workflow is >= 2, the advisory tier (50-69%) is upgraded to auto-approve. This means:
44
-
45
- - Trust level 0-1: advisory tier requires user acknowledgment
46
- - Trust level >= 2: advisory tier auto-approves (treated as >= 70%)
47
- - Hard block (< 50%): **never overridden** by trust level
48
-
49
- The trust level is stored in the workflow checkpoint and reflects the user's established confidence in the AI agent for this workflow.
50
-
51
- ---
52
-
53
- ## Escalation
54
-
55
- If a bolt accumulates 2 consecutive review failures (2 reviews both scoring < 50%), an escalation event is triggered.
56
-
57
- The escalation event includes:
58
- - Bolt ID and title
59
- - Failure count
60
- - Recommended actions:
61
- - **Re-scope**: Narrow the bolt's scope to reduce complexity
62
- - **Split**: Divide the bolt into two or more smaller bolts with tighter acceptance criteria
63
-
64
- The orchestrator surfaces the escalation to the user and halts further attempts on that bolt until the user chooses an action.
65
-
66
- ---
67
-
68
- ## Review Artifact
69
-
70
- After each review, BoltReviewer writes a structured artifact:
71
-
72
- **Path**: `{workflowId}/construction/{parent_unit_id}/bolts/{boltId}/review.md`
73
-
74
- Example: `{workflowId}/construction/UNIT-001-foundation/bolts/BOLT-001-data-model/review.md`
75
-
76
- ### Required Sections
77
-
78
- **Score** — Numeric alignment score (0-100%) with a brief rationale.
79
-
80
- **Decision** — One of: `approved`, `advisory`, `rejected`.
81
-
82
- **Feedback** — Specific, actionable observations about the generated code relative to the bolt's acceptance criteria. Each item should reference a specific criterion or target file.
83
-
84
- **Concerns** — List of issues that contributed to score reduction. May be empty for approved bolts.
85
-
86
- **Recommended Actions** _(escalation only)_ — Present only when 2 consecutive failures have occurred. Lists concrete steps the user should take (re-scope or split).
87
-
88
- ---
89
-
90
- ## Acknowledgment Fields
91
-
92
- When a bolt is accepted at the advisory tier, the orchestrator records acknowledgment on the bolt's progress entry in the checkpoint:
93
-
94
- ```json
95
- {
96
- "acknowledged_by": "user",
97
- "acknowledged_at": "2026-01-15T10:30:00Z"
98
- }
99
- ```
100
-
101
- These fields are stored on the `ConstructionBoltProgress` object alongside the bolt's lifecycle state.
102
-
103
- ---
104
-
105
- ## Traceability Check
106
-
107
- As part of evaluating each bolt, BoltReviewer performs a lightweight traceability check:
108
-
109
- - Read the `requirements` and `stories` fields from the bolt's `spec.md` frontmatter and the `## Traceability` section.
110
- - Verify that the generated code actually touches functionality relevant to the cited requirement IDs. If a bolt claims to satisfy `FR-3` (e.g., "user authentication") but the code contains no authentication logic, flag this as a concern.
111
- - Add a **Traceability** line to `review.md` under the **Feedback** section:
112
- `Traceability: Requirements {ID list} addressed — Yes / Partial / No`
113
- - A "Partial" or "No" finding should reduce the alignment score and appear as a **Concerns** item. It does not automatically trigger a hard block, but it does lower the score and may push a bolt into the advisory or rejected tier.
114
-
115
- ---
116
-
117
- ## Documentation Quality Check
118
-
119
- The reviewer MUST evaluate documentation aspects of the bolt:
120
-
121
- - If `docs_impact` includes `code-comments`: verify complex logic has adequate inline comments in the generated code. Flag missing comments on non-obvious algorithms, public API entry points, or intricate state management as a concern.
122
- - If `docs_impact` includes any user-facing type (`readme`, `user-guide`, `config-reference`, `cli-reference`, `migration-guide`): verify the code behavior is clear enough to document -- acceptance criteria are testable and descriptive, public interfaces are well-named, and usage patterns are evident from the code structure.
123
- - If the bolt introduces new public APIs, new CLI commands, or new configuration options but `docs_impact` is set to `none`: flag this as a likely missed assessment. Include a concern noting that documentation impact may need to be updated before the Documentation Generation stage.
124
-
125
- Include a documentation quality note in the review.md Feedback section:
126
- `Documentation: docs_impact [{values}] -- {assessment: adequate / concerns noted / impact likely missed}`
127
-
128
- ---
129
-
130
- ## BoltReviewer Behavior
131
-
132
- BoltReviewer is a decision engine, not an interactive agent. It:
133
-
134
- - Reads the bolt spec (`spec.md`) and the generated code in `Target Files`
135
- - Evaluates alignment against each acceptance criterion
136
- - Performs a traceability check against the cited requirement and story IDs
137
- - Computes a score and selects a tier
138
- - Writes the `review.md` artifact
139
- - Returns a structured decision object to the orchestrator
140
-
141
- All user-facing communication (presenting advisory findings, requesting acknowledgment, surfacing escalations) is the orchestrator's responsibility, not BoltReviewer's.
142
-
143
- The `momus` agent is dispatched via the review callback (`reviewCallback`) to perform the evaluation.
1
+ # Bolt Review - Mandatory Quality Gate
2
+
3
+ ## Overview
4
+
5
+ The Bolt Review stage is a mandatory quality gate that runs after every bolt's code generation is complete. The BoltReviewer evaluates whether the generated code meets the bolt's acceptance criteria and aligns with the approved spec.
6
+
7
+ Review is performed by the `momus` agent via a review callback. BoltReviewer returns structured decision objects — it does not interact with users directly. User interaction (acknowledgment prompts, escalation notices) is handled by the orchestrator based on the decision returned.
8
+
9
+ ---
10
+
11
+ ## Two-Tier Alignment Model
12
+
13
+ The BoltReviewer scores each bolt on a 0-100% alignment scale and maps the score to one of three tiers:
14
+
15
+ | Score | Tier | Action |
16
+ |-------|------|--------|
17
+ | >= 70% | Auto-approve | Bolt accepted automatically; no user interaction required |
18
+ | 50-69% | Advisory | Bolt proceeds with mandatory user acknowledgment |
19
+ | < 50% | Hard block | Bolt rejected; must be re-scoped or split before retrying |
20
+
21
+ ### Auto-Approve (>= 70%)
22
+
23
+ The bolt is accepted. The orchestrator transitions the bolt state from `in_review` to `done` without prompting the user.
24
+
25
+ ### Advisory (50-69%)
26
+
27
+ The orchestrator presents the review findings to the user and requires explicit acknowledgment before the bolt proceeds. The user must confirm they understand the concerns and accept the bolt as-is.
28
+
29
+ Acknowledgment is recorded in the bolt's `ConstructionBoltProgress` entry:
30
+ - `acknowledged_by`: identifier of the user who acknowledged
31
+ - `acknowledged_at`: ISO 8601 timestamp of acknowledgment
32
+
33
+ ### Hard Block (< 50%)
34
+
35
+ The bolt is rejected. The orchestrator transitions the bolt state to `failed`. The user must re-scope the bolt (narrow scope, reduce complexity) or split it into smaller bolts before code generation can be retried.
36
+
37
+ Hard blocks are never overridden, regardless of trust level.
38
+
39
+ ---
40
+
41
+ ## Trust-Based Auto-Approval
42
+
43
+ When the trust level for the workflow is >= 2, the advisory tier (50-69%) is upgraded to auto-approve. This means:
44
+
45
+ - Trust level 0-1: advisory tier requires user acknowledgment
46
+ - Trust level >= 2: advisory tier auto-approves (treated as >= 70%)
47
+ - Hard block (< 50%): **never overridden** by trust level
48
+
49
+ The trust level is stored in the workflow checkpoint and reflects the user's established confidence in the AI agent for this workflow.
50
+
51
+ ---
52
+
53
+ ## Escalation
54
+
55
+ If a bolt accumulates 2 consecutive review failures (2 reviews both scoring < 50%), an escalation event is triggered.
56
+
57
+ The escalation event includes:
58
+ - Bolt ID and title
59
+ - Failure count
60
+ - Recommended actions:
61
+ - **Re-scope**: Narrow the bolt's scope to reduce complexity
62
+ - **Split**: Divide the bolt into two or more smaller bolts with tighter acceptance criteria
63
+
64
+ The orchestrator surfaces the escalation to the user and halts further attempts on that bolt until the user chooses an action.
65
+
66
+ ---
67
+
68
+ ## Review Artifact
69
+
70
+ After each review, BoltReviewer writes a structured artifact:
71
+
72
+ **Path**: `{workflowId}/construction/{parent_unit_id}/bolts/{boltId}/review.md`
73
+
74
+ Example: `{workflowId}/construction/UNIT-001-foundation/bolts/BOLT-001-data-model/review.md`
75
+
76
+ ### Required Sections
77
+
78
+ **Score** — Numeric alignment score (0-100%) with a brief rationale.
79
+
80
+ **Decision** — One of: `approved`, `advisory`, `rejected`.
81
+
82
+ **Feedback** — Specific, actionable observations about the generated code relative to the bolt's acceptance criteria. Each item should reference a specific criterion or target file.
83
+
84
+ **Concerns** — List of issues that contributed to score reduction. May be empty for approved bolts.
85
+
86
+ **Recommended Actions** _(escalation only)_ — Present only when 2 consecutive failures have occurred. Lists concrete steps the user should take (re-scope or split).
87
+
88
+ ---
89
+
90
+ ## Acknowledgment Fields
91
+
92
+ When a bolt is accepted at the advisory tier, the orchestrator records acknowledgment on the bolt's progress entry in the checkpoint:
93
+
94
+ ```json
95
+ {
96
+ "acknowledged_by": "user",
97
+ "acknowledged_at": "2026-01-15T10:30:00Z"
98
+ }
99
+ ```
100
+
101
+ These fields are stored on the `ConstructionBoltProgress` object alongside the bolt's lifecycle state.
102
+
103
+ ---
104
+
105
+ ## Traceability Check
106
+
107
+ As part of evaluating each bolt, BoltReviewer performs a lightweight traceability check:
108
+
109
+ - Read the `requirements` and `stories` fields from the bolt's `spec.md` frontmatter and the `## Traceability` section.
110
+ - Verify that the generated code actually touches functionality relevant to the cited requirement IDs. If a bolt claims to satisfy `FR-3` (e.g., "user authentication") but the code contains no authentication logic, flag this as a concern.
111
+ - Add a **Traceability** line to `review.md` under the **Feedback** section:
112
+ `Traceability: Requirements {ID list} addressed — Yes / Partial / No`
113
+ - A "Partial" or "No" finding should reduce the alignment score and appear as a **Concerns** item. It does not automatically trigger a hard block, but it does lower the score and may push a bolt into the advisory or rejected tier.
114
+
115
+ ---
116
+
117
+ ## Documentation Quality Check
118
+
119
+ The reviewer MUST evaluate documentation aspects of the bolt:
120
+
121
+ - If `docs_impact` includes `code-comments`: verify complex logic has adequate inline comments in the generated code. Flag missing comments on non-obvious algorithms, public API entry points, or intricate state management as a concern.
122
+ - If `docs_impact` includes any user-facing type (`readme`, `user-guide`, `config-reference`, `cli-reference`, `migration-guide`): verify the code behavior is clear enough to document -- acceptance criteria are testable and descriptive, public interfaces are well-named, and usage patterns are evident from the code structure.
123
+ - If the bolt introduces new public APIs, new CLI commands, or new configuration options but `docs_impact` is set to `none`: flag this as a likely missed assessment. Include a concern noting that documentation impact may need to be updated before the Documentation Generation stage.
124
+
125
+ Include a documentation quality note in the review.md Feedback section:
126
+ `Documentation: docs_impact [{values}] -- {assessment: adequate / concerns noted / impact likely missed}`
127
+
128
+ ---
129
+
130
+ ## BoltReviewer Behavior
131
+
132
+ BoltReviewer is a decision engine, not an interactive agent. It:
133
+
134
+ - Reads the bolt spec (`spec.md`) and the generated code in `Target Files`
135
+ - Evaluates alignment against each acceptance criterion
136
+ - Performs a traceability check against the cited requirement and story IDs
137
+ - Computes a score and selects a tier
138
+ - Writes the `review.md` artifact
139
+ - Returns a structured decision object to the orchestrator
140
+
141
+ All user-facing communication (presenting advisory findings, requesting acknowledgment, surfacing escalations) is the orchestrator's responsibility, not BoltReviewer's.
142
+
143
+ The `momus` agent is dispatched via the review callback (`reviewCallback`) to perform the evaluation.