raise-cli 2.2.1__py3-none-any.whl

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 (264) hide show
  1. raise_cli/__init__.py +38 -0
  2. raise_cli/__main__.py +30 -0
  3. raise_cli/adapters/__init__.py +91 -0
  4. raise_cli/adapters/declarative/__init__.py +26 -0
  5. raise_cli/adapters/declarative/adapter.py +267 -0
  6. raise_cli/adapters/declarative/discovery.py +94 -0
  7. raise_cli/adapters/declarative/expressions.py +150 -0
  8. raise_cli/adapters/declarative/reference/__init__.py +1 -0
  9. raise_cli/adapters/declarative/reference/github.yaml +143 -0
  10. raise_cli/adapters/declarative/schema.py +98 -0
  11. raise_cli/adapters/filesystem.py +299 -0
  12. raise_cli/adapters/mcp_bridge.py +10 -0
  13. raise_cli/adapters/mcp_confluence.py +246 -0
  14. raise_cli/adapters/mcp_jira.py +405 -0
  15. raise_cli/adapters/models.py +205 -0
  16. raise_cli/adapters/protocols.py +180 -0
  17. raise_cli/adapters/registry.py +90 -0
  18. raise_cli/adapters/sync.py +149 -0
  19. raise_cli/agents/__init__.py +14 -0
  20. raise_cli/agents/antigravity.yaml +8 -0
  21. raise_cli/agents/claude.yaml +8 -0
  22. raise_cli/agents/copilot.yaml +8 -0
  23. raise_cli/agents/copilot_plugin.py +124 -0
  24. raise_cli/agents/cursor.yaml +7 -0
  25. raise_cli/agents/roo.yaml +8 -0
  26. raise_cli/agents/windsurf.yaml +8 -0
  27. raise_cli/artifacts/__init__.py +30 -0
  28. raise_cli/artifacts/models.py +43 -0
  29. raise_cli/artifacts/reader.py +55 -0
  30. raise_cli/artifacts/renderer.py +104 -0
  31. raise_cli/artifacts/story_design.py +69 -0
  32. raise_cli/artifacts/writer.py +45 -0
  33. raise_cli/backlog/__init__.py +1 -0
  34. raise_cli/backlog/sync.py +115 -0
  35. raise_cli/cli/__init__.py +3 -0
  36. raise_cli/cli/commands/__init__.py +3 -0
  37. raise_cli/cli/commands/_resolve.py +153 -0
  38. raise_cli/cli/commands/adapters.py +362 -0
  39. raise_cli/cli/commands/artifact.py +137 -0
  40. raise_cli/cli/commands/backlog.py +333 -0
  41. raise_cli/cli/commands/base.py +31 -0
  42. raise_cli/cli/commands/discover.py +551 -0
  43. raise_cli/cli/commands/docs.py +130 -0
  44. raise_cli/cli/commands/doctor.py +177 -0
  45. raise_cli/cli/commands/gate.py +223 -0
  46. raise_cli/cli/commands/graph.py +1086 -0
  47. raise_cli/cli/commands/info.py +81 -0
  48. raise_cli/cli/commands/init.py +746 -0
  49. raise_cli/cli/commands/journal.py +167 -0
  50. raise_cli/cli/commands/mcp.py +524 -0
  51. raise_cli/cli/commands/memory.py +467 -0
  52. raise_cli/cli/commands/pattern.py +348 -0
  53. raise_cli/cli/commands/profile.py +59 -0
  54. raise_cli/cli/commands/publish.py +80 -0
  55. raise_cli/cli/commands/release.py +338 -0
  56. raise_cli/cli/commands/session.py +528 -0
  57. raise_cli/cli/commands/signal.py +410 -0
  58. raise_cli/cli/commands/skill.py +350 -0
  59. raise_cli/cli/commands/skill_set.py +145 -0
  60. raise_cli/cli/error_handler.py +158 -0
  61. raise_cli/cli/main.py +163 -0
  62. raise_cli/compat.py +66 -0
  63. raise_cli/config/__init__.py +41 -0
  64. raise_cli/config/agent_plugin.py +105 -0
  65. raise_cli/config/agent_registry.py +233 -0
  66. raise_cli/config/agents.py +120 -0
  67. raise_cli/config/ide.py +32 -0
  68. raise_cli/config/paths.py +379 -0
  69. raise_cli/config/settings.py +180 -0
  70. raise_cli/context/__init__.py +42 -0
  71. raise_cli/context/analyzers/__init__.py +16 -0
  72. raise_cli/context/analyzers/models.py +36 -0
  73. raise_cli/context/analyzers/protocol.py +43 -0
  74. raise_cli/context/analyzers/python.py +292 -0
  75. raise_cli/context/builder.py +1569 -0
  76. raise_cli/context/diff.py +213 -0
  77. raise_cli/context/extractors/__init__.py +13 -0
  78. raise_cli/context/extractors/skills.py +121 -0
  79. raise_cli/core/__init__.py +37 -0
  80. raise_cli/core/files.py +66 -0
  81. raise_cli/core/text.py +174 -0
  82. raise_cli/core/tools.py +441 -0
  83. raise_cli/discovery/__init__.py +50 -0
  84. raise_cli/discovery/analyzer.py +691 -0
  85. raise_cli/discovery/drift.py +355 -0
  86. raise_cli/discovery/scanner.py +1687 -0
  87. raise_cli/doctor/__init__.py +4 -0
  88. raise_cli/doctor/checks/__init__.py +1 -0
  89. raise_cli/doctor/checks/environment.py +110 -0
  90. raise_cli/doctor/checks/project.py +238 -0
  91. raise_cli/doctor/fix.py +80 -0
  92. raise_cli/doctor/models.py +56 -0
  93. raise_cli/doctor/protocol.py +43 -0
  94. raise_cli/doctor/registry.py +100 -0
  95. raise_cli/doctor/report.py +141 -0
  96. raise_cli/doctor/runner.py +95 -0
  97. raise_cli/engines/__init__.py +3 -0
  98. raise_cli/exceptions.py +215 -0
  99. raise_cli/gates/__init__.py +19 -0
  100. raise_cli/gates/builtin/__init__.py +1 -0
  101. raise_cli/gates/builtin/coverage.py +52 -0
  102. raise_cli/gates/builtin/lint.py +48 -0
  103. raise_cli/gates/builtin/tests.py +48 -0
  104. raise_cli/gates/builtin/types.py +48 -0
  105. raise_cli/gates/models.py +40 -0
  106. raise_cli/gates/protocol.py +41 -0
  107. raise_cli/gates/registry.py +141 -0
  108. raise_cli/governance/__init__.py +11 -0
  109. raise_cli/governance/extractor.py +412 -0
  110. raise_cli/governance/models.py +134 -0
  111. raise_cli/governance/parsers/__init__.py +35 -0
  112. raise_cli/governance/parsers/_convert.py +38 -0
  113. raise_cli/governance/parsers/adr.py +274 -0
  114. raise_cli/governance/parsers/backlog.py +356 -0
  115. raise_cli/governance/parsers/constitution.py +119 -0
  116. raise_cli/governance/parsers/epic.py +323 -0
  117. raise_cli/governance/parsers/glossary.py +316 -0
  118. raise_cli/governance/parsers/guardrails.py +345 -0
  119. raise_cli/governance/parsers/prd.py +112 -0
  120. raise_cli/governance/parsers/roadmap.py +118 -0
  121. raise_cli/governance/parsers/vision.py +116 -0
  122. raise_cli/graph/__init__.py +1 -0
  123. raise_cli/graph/backends/__init__.py +57 -0
  124. raise_cli/graph/backends/api.py +137 -0
  125. raise_cli/graph/backends/dual.py +139 -0
  126. raise_cli/graph/backends/pending.py +84 -0
  127. raise_cli/handlers/__init__.py +3 -0
  128. raise_cli/hooks/__init__.py +54 -0
  129. raise_cli/hooks/builtin/__init__.py +1 -0
  130. raise_cli/hooks/builtin/backlog.py +216 -0
  131. raise_cli/hooks/builtin/gate_bridge.py +83 -0
  132. raise_cli/hooks/builtin/jira_sync.py +127 -0
  133. raise_cli/hooks/builtin/memory.py +117 -0
  134. raise_cli/hooks/builtin/telemetry.py +72 -0
  135. raise_cli/hooks/emitter.py +184 -0
  136. raise_cli/hooks/events.py +262 -0
  137. raise_cli/hooks/protocol.py +38 -0
  138. raise_cli/hooks/registry.py +117 -0
  139. raise_cli/mcp/__init__.py +33 -0
  140. raise_cli/mcp/bridge.py +218 -0
  141. raise_cli/mcp/models.py +43 -0
  142. raise_cli/mcp/registry.py +77 -0
  143. raise_cli/mcp/schema.py +41 -0
  144. raise_cli/memory/__init__.py +58 -0
  145. raise_cli/memory/loader.py +247 -0
  146. raise_cli/memory/migration.py +241 -0
  147. raise_cli/memory/models.py +169 -0
  148. raise_cli/memory/writer.py +598 -0
  149. raise_cli/onboarding/__init__.py +103 -0
  150. raise_cli/onboarding/bootstrap.py +324 -0
  151. raise_cli/onboarding/claudemd.py +17 -0
  152. raise_cli/onboarding/conventions.py +742 -0
  153. raise_cli/onboarding/detection.py +374 -0
  154. raise_cli/onboarding/governance.py +443 -0
  155. raise_cli/onboarding/instructions.py +672 -0
  156. raise_cli/onboarding/manifest.py +201 -0
  157. raise_cli/onboarding/memory_md.py +399 -0
  158. raise_cli/onboarding/migration.py +207 -0
  159. raise_cli/onboarding/profile.py +624 -0
  160. raise_cli/onboarding/skill_conflict.py +100 -0
  161. raise_cli/onboarding/skill_manifest.py +176 -0
  162. raise_cli/onboarding/skills.py +437 -0
  163. raise_cli/onboarding/workflows.py +101 -0
  164. raise_cli/output/__init__.py +28 -0
  165. raise_cli/output/console.py +394 -0
  166. raise_cli/output/formatters/__init__.py +9 -0
  167. raise_cli/output/formatters/adapters.py +135 -0
  168. raise_cli/output/formatters/discover.py +439 -0
  169. raise_cli/output/formatters/skill.py +298 -0
  170. raise_cli/publish/__init__.py +3 -0
  171. raise_cli/publish/changelog.py +80 -0
  172. raise_cli/publish/check.py +179 -0
  173. raise_cli/publish/version.py +172 -0
  174. raise_cli/rai_base/__init__.py +22 -0
  175. raise_cli/rai_base/framework/__init__.py +7 -0
  176. raise_cli/rai_base/framework/methodology.yaml +233 -0
  177. raise_cli/rai_base/governance/__init__.py +1 -0
  178. raise_cli/rai_base/governance/architecture/__init__.py +1 -0
  179. raise_cli/rai_base/governance/architecture/domain-model.md +20 -0
  180. raise_cli/rai_base/governance/architecture/system-context.md +34 -0
  181. raise_cli/rai_base/governance/architecture/system-design.md +24 -0
  182. raise_cli/rai_base/governance/backlog.md +8 -0
  183. raise_cli/rai_base/governance/guardrails.md +17 -0
  184. raise_cli/rai_base/governance/prd.md +25 -0
  185. raise_cli/rai_base/governance/vision.md +16 -0
  186. raise_cli/rai_base/identity/__init__.py +8 -0
  187. raise_cli/rai_base/identity/core.md +119 -0
  188. raise_cli/rai_base/identity/perspective.md +119 -0
  189. raise_cli/rai_base/memory/__init__.py +7 -0
  190. raise_cli/rai_base/memory/patterns-base.jsonl +55 -0
  191. raise_cli/schemas/__init__.py +3 -0
  192. raise_cli/schemas/journal.py +49 -0
  193. raise_cli/schemas/session_state.py +117 -0
  194. raise_cli/session/__init__.py +5 -0
  195. raise_cli/session/bundle.py +820 -0
  196. raise_cli/session/close.py +268 -0
  197. raise_cli/session/journal.py +119 -0
  198. raise_cli/session/resolver.py +126 -0
  199. raise_cli/session/state.py +187 -0
  200. raise_cli/skills/__init__.py +44 -0
  201. raise_cli/skills/locator.py +141 -0
  202. raise_cli/skills/name_checker.py +199 -0
  203. raise_cli/skills/parser.py +145 -0
  204. raise_cli/skills/scaffold.py +212 -0
  205. raise_cli/skills/schema.py +132 -0
  206. raise_cli/skills/skillsets.py +195 -0
  207. raise_cli/skills/validator.py +197 -0
  208. raise_cli/skills_base/__init__.py +80 -0
  209. raise_cli/skills_base/contract-template.md +60 -0
  210. raise_cli/skills_base/preamble.md +37 -0
  211. raise_cli/skills_base/rai-architecture-review/SKILL.md +137 -0
  212. raise_cli/skills_base/rai-debug/SKILL.md +171 -0
  213. raise_cli/skills_base/rai-discover/SKILL.md +167 -0
  214. raise_cli/skills_base/rai-discover-document/SKILL.md +128 -0
  215. raise_cli/skills_base/rai-discover-scan/SKILL.md +147 -0
  216. raise_cli/skills_base/rai-discover-start/SKILL.md +145 -0
  217. raise_cli/skills_base/rai-discover-validate/SKILL.md +142 -0
  218. raise_cli/skills_base/rai-docs-update/SKILL.md +142 -0
  219. raise_cli/skills_base/rai-doctor/SKILL.md +120 -0
  220. raise_cli/skills_base/rai-epic-close/SKILL.md +165 -0
  221. raise_cli/skills_base/rai-epic-close/templates/retrospective.md +68 -0
  222. raise_cli/skills_base/rai-epic-design/SKILL.md +146 -0
  223. raise_cli/skills_base/rai-epic-design/templates/design.md +24 -0
  224. raise_cli/skills_base/rai-epic-design/templates/scope.md +76 -0
  225. raise_cli/skills_base/rai-epic-plan/SKILL.md +153 -0
  226. raise_cli/skills_base/rai-epic-plan/_references/sequencing-strategies.md +67 -0
  227. raise_cli/skills_base/rai-epic-plan/templates/plan-section.md +49 -0
  228. raise_cli/skills_base/rai-epic-run/SKILL.md +208 -0
  229. raise_cli/skills_base/rai-epic-start/SKILL.md +136 -0
  230. raise_cli/skills_base/rai-epic-start/templates/brief.md +34 -0
  231. raise_cli/skills_base/rai-mcp-add/SKILL.md +176 -0
  232. raise_cli/skills_base/rai-mcp-remove/SKILL.md +120 -0
  233. raise_cli/skills_base/rai-mcp-status/SKILL.md +147 -0
  234. raise_cli/skills_base/rai-problem-shape/SKILL.md +138 -0
  235. raise_cli/skills_base/rai-project-create/SKILL.md +144 -0
  236. raise_cli/skills_base/rai-project-onboard/SKILL.md +162 -0
  237. raise_cli/skills_base/rai-quality-review/SKILL.md +189 -0
  238. raise_cli/skills_base/rai-research/SKILL.md +143 -0
  239. raise_cli/skills_base/rai-research/references/research-prompt-template.md +317 -0
  240. raise_cli/skills_base/rai-session-close/SKILL.md +176 -0
  241. raise_cli/skills_base/rai-session-start/SKILL.md +110 -0
  242. raise_cli/skills_base/rai-story-close/SKILL.md +198 -0
  243. raise_cli/skills_base/rai-story-design/SKILL.md +203 -0
  244. raise_cli/skills_base/rai-story-design/references/tech-design-story-v2.md +293 -0
  245. raise_cli/skills_base/rai-story-implement/SKILL.md +115 -0
  246. raise_cli/skills_base/rai-story-plan/SKILL.md +135 -0
  247. raise_cli/skills_base/rai-story-review/SKILL.md +178 -0
  248. raise_cli/skills_base/rai-story-run/SKILL.md +282 -0
  249. raise_cli/skills_base/rai-story-start/SKILL.md +166 -0
  250. raise_cli/skills_base/rai-story-start/templates/story.md +38 -0
  251. raise_cli/skills_base/rai-welcome/SKILL.md +134 -0
  252. raise_cli/telemetry/__init__.py +42 -0
  253. raise_cli/telemetry/schemas.py +285 -0
  254. raise_cli/telemetry/writer.py +217 -0
  255. raise_cli/tier/__init__.py +0 -0
  256. raise_cli/tier/context.py +134 -0
  257. raise_cli/viz/__init__.py +7 -0
  258. raise_cli/viz/generator.py +406 -0
  259. raise_cli-2.2.1.dist-info/METADATA +433 -0
  260. raise_cli-2.2.1.dist-info/RECORD +264 -0
  261. raise_cli-2.2.1.dist-info/WHEEL +4 -0
  262. raise_cli-2.2.1.dist-info/entry_points.txt +40 -0
  263. raise_cli-2.2.1.dist-info/licenses/LICENSE +190 -0
  264. raise_cli-2.2.1.dist-info/licenses/NOTICE +4 -0
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: rai-story-review
3
+ description: >
4
+ Reflect on completed stories to extract learnings, identify process
5
+ improvements, and update the framework with insights gained. Use after
6
+ implementation is complete to close the development cycle.
7
+
8
+ license: MIT
9
+
10
+ metadata:
11
+ raise.work_cycle: story
12
+ raise.frequency: per-story
13
+ raise.fase: "7"
14
+ raise.prerequisites: story-implement
15
+ raise.next: story-close
16
+ raise.gate: ""
17
+ raise.adaptable: "true"
18
+ raise.version: "2.2.0"
19
+ raise.visibility: public
20
+ raise.inputs: |
21
+ - tests_passing: boolean, required, cli
22
+ raise.outputs: |
23
+ - retrospective_md: file_path, next_skill
24
+ - patterns: list, cli
25
+ ---
26
+
27
+ # Story Review
28
+
29
+ ## Purpose
30
+
31
+ Reflect on the completed story to extract learnings, persist patterns, reinforce behavioral signals, and emit calibration telemetry.
32
+
33
+ ## Mastery Levels (ShuHaRi)
34
+
35
+ - **Shu**: Follow all steps, answer all checkpoint questions with specific examples
36
+ - **Ha**: Adapt depth to story complexity, batch small story reviews
37
+ - **Ri**: Custom review patterns, integrate with team retrospectives
38
+
39
+ ## Context
40
+
41
+ **When to use:** After implementation is complete and tests pass. Before `/rai-story-close`.
42
+
43
+ **Inputs:** Completed story, progress log, passing test suite.
44
+
45
+ ## Steps
46
+
47
+ ### Step 1: Verify Tests Pass
48
+
49
+ Determine which test command to run using this priority chain:
50
+
51
+ 1. **Check `.raise/manifest.yaml`** for `project.test_command` — if set, use it directly (configuration over convention)
52
+ 2. **Detect language** from `project.project_type` in manifest, or scan file extensions of changed files (`git diff --name-only`)
53
+ 3. **Map language to default** using the table below
54
+
55
+ ```yaml
56
+ # .raise/manifest.yaml — example
57
+ project:
58
+ test_command: "cargo test --quiet" # explicit override, highest priority
59
+ project_type: rust
60
+ ```
61
+
62
+ | Language | Extensions | Default Test Command |
63
+ |----------|-----------|----------------------|
64
+ | Python | `.py`, `.pyi` | `uv run pytest --tb=short` |
65
+ | TypeScript | `.ts`, `.tsx` | `npx vitest run` or `npm test` |
66
+ | JavaScript | `.js`, `.jsx` | `npx vitest run` or `npm test` |
67
+ | C# | `.cs` | `dotnet test --verbosity quiet` |
68
+ | Go | `.go` | `go test ./...` |
69
+ | PHP | `.php` | `vendor/bin/phpunit` |
70
+ | Dart | `.dart` | `flutter test` |
71
+ | Unknown | — | Ask developer |
72
+
73
+ The table is a **fallback** — `project.test_command` always wins when present.
74
+
75
+ | Condition | Action |
76
+ |-----------|--------|
77
+ | Tests green | Continue |
78
+ | Tests failing | Fix first — review requires green tests |
79
+
80
+ <verification>
81
+ Project language detected. Tests passing with appropriate runner.
82
+ </verification>
83
+
84
+ ### Step 2: Gather Data & Reflect
85
+
86
+ Review the story development: actual vs estimated time, blockers, plan deviations.
87
+
88
+ **Heutagogical checkpoint** — answer with specific examples:
89
+ 1. What did you learn?
90
+ 2. What would you change about the process?
91
+ 3. Are there improvements for the framework?
92
+ 4. What are you more capable of now?
93
+
94
+ Identify concrete improvements to skills, guardrails, or templates. Apply small improvements immediately; create issues for complex ones.
95
+
96
+ <verification>
97
+ All four questions answered. Improvements identified (or celebrated that none needed).
98
+ </verification>
99
+
100
+ ### Step 3: Persist Patterns & Reinforce
101
+
102
+ **Add new patterns** worth preserving across sessions:
103
+
104
+ ```bash
105
+ rai pattern add "Pattern description" -c "context,keywords" -t process --from S{N}.{M}
106
+ ```
107
+
108
+ Types: `process`, `technical`, `architecture`, `codebase`.
109
+
110
+ **Reinforce existing patterns** — evaluate behavioral patterns loaded at session start:
111
+
112
+ ```bash
113
+ rai pattern reinforce {pattern_id} --vote {1|0|-1} --from S{N}.{M}
114
+ ```
115
+
116
+ | Vote | Meaning |
117
+ |:----:|---------|
118
+ | `1` | Implementation followed the pattern |
119
+ | `0` | Pattern not relevant to this story (does NOT count toward evaluations) |
120
+ | `-1` | Implementation contradicted the pattern |
121
+
122
+ Only evaluate patterns you consciously considered. `0` is correct for most patterns in any story.
123
+
124
+ <verification>
125
+ New patterns persisted. Behavioral patterns evaluated (or explicitly skipped).
126
+ </verification>
127
+
128
+ ### Step 4: Document Retrospective
129
+
130
+ Create `work/epics/e{N}-{name}/stories/s{N}.{M}-retrospective.md` with:
131
+ - Summary (story ID, dates, estimated vs actual time)
132
+ - What went well / what to improve
133
+ - Heutagogical checkpoint answers
134
+ - Improvements applied
135
+ - Patterns added/reinforced
136
+
137
+ <verification>
138
+ Retrospective document created.
139
+ </verification>
140
+
141
+ ### Step 5: Emit Calibration Telemetry
142
+
143
+ ```bash
144
+ rai signal emit-calibration S{N}.{M} --size {XS|S|M|L} --estimated {minutes} --actual {minutes}
145
+ ```
146
+
147
+ This feeds the velocity tracking system for future estimation accuracy.
148
+
149
+ <verification>
150
+ Calibration event recorded (or skipped if CLI unavailable).
151
+ </verification>
152
+
153
+ ## Output
154
+
155
+ | Item | Destination |
156
+ |------|-------------|
157
+ | Retrospective | `work/epics/e{N}-{name}/stories/s{N}.{M}-retrospective.md` |
158
+ | Patterns | `.raise/rai/memory/patterns.jsonl` |
159
+ | Calibration | Via `rai signal emit-calibration` |
160
+ | Next | `/rai-story-close` |
161
+
162
+ ## Quality Checklist
163
+
164
+ - [ ] Project language detected before running tests
165
+ - [ ] Tests pass with language-appropriate runner (gate)
166
+ - [ ] Heutagogical checkpoint answered with specific examples
167
+ - [ ] New patterns persisted via `rai pattern add`
168
+ - [ ] Behavioral patterns reinforced via `rai pattern reinforce`
169
+ - [ ] Calibration telemetry emitted
170
+ - [ ] Retrospective document created
171
+ - [ ] NEVER skip pattern reinforce — scoring system depends on it (RAISE-170)
172
+ - [ ] NEVER give vague checkpoint answers — be specific with concrete examples
173
+
174
+ ## References
175
+
176
+ - Previous: `/rai-story-implement`
177
+ - Next: `/rai-story-close`
178
+ - Pattern scoring: RAISE-170 (temporal decay + Wilson scorer)
@@ -0,0 +1,282 @@
1
+ ---
2
+ name: rai-story-run
3
+ description: >
4
+ Chain the full story lifecycle (start → design → plan → implement →
5
+ architecture review → quality review → review → close) in one
6
+ invocation. Resumes from last completed phase using git-derived
7
+ artifact detection. Delegation profile controls pause behavior.
8
+
9
+ license: MIT
10
+
11
+ metadata:
12
+ raise.work_cycle: story
13
+ raise.frequency: per-story
14
+ raise.fase: ""
15
+ raise.prerequisites: ""
16
+ raise.next: ""
17
+ raise.gate: ""
18
+ raise.adaptable: "true"
19
+ raise.version: "2.0.0"
20
+ raise.visibility: public
21
+ raise.inputs: |
22
+ - story_id: string, required, argument (e.g. "S325.6")
23
+ - epic_id: string, optional, argument (inferred from story_id prefix)
24
+ raise.outputs: |
25
+ - merge_commit: string, git
26
+ - retrospective_md: file_path (work/epics/.../stories/s{N}.{M}-retrospective.md)
27
+ - patterns: list, cli (via rai pattern add)
28
+ ---
29
+
30
+ # Story Run
31
+
32
+ ## Purpose
33
+
34
+ Execute the full story lifecycle in one invocation, pausing only at delegation gates and resuming automatically from the last completed phase.
35
+
36
+ ## Mastery Levels (ShuHaRi)
37
+
38
+ - **Shu**: Show phase progress, explain each skill's output, pause at both gates
39
+ - **Ha**: Brief progress between phases, pause only when delegation says REVIEW
40
+ - **Ri**: Minimal output, AUTO delegation, gates stop only on failure
41
+
42
+ ## Context
43
+
44
+ **When to use:** Starting or resuming any story. Replaces manual sequential skill invocation.
45
+
46
+ **When to skip:** Single-phase work (e.g., only running review on an already-implemented story). Individual skills remain independently invocable.
47
+
48
+ ## Steps
49
+
50
+ ### Step 0: Detect Phase
51
+
52
+ Resolve the epic and story paths from `story_id`. Check artifacts in **reverse order** — take the most advanced phase:
53
+
54
+ | Check | Artifact | If exists → resume at |
55
+ |:-----:|----------|----------------------|
56
+ | 5 | `stories/s{N}.{M}-retrospective.md` | **close** |
57
+ | 4 | `stories/s{N}.{M}-plan.md` | **implement** |
58
+ | 3 | `stories/s{N}.{M}-design.md` | **plan** |
59
+ | 2 | `stories/s{N}.{M}-story.md` | **design** |
60
+ | 1 | story branch exists (`story/s{N}.{M}/*`) | **start** (branch only, no artifacts) |
61
+ | 0 | (nothing) | **start** (from scratch) |
62
+
63
+ Present: "Phase detection: resuming at **{phase}** (found: {artifact})" or "Starting fresh — no artifacts found."
64
+
65
+ <verification>
66
+ Phase identified. Epic path resolved.
67
+ </verification>
68
+
69
+ ### Step 1: Resolve Delegation
70
+
71
+ Load developer profile from `~/.rai/developer.yaml`. Resolve delegation level:
72
+
73
+ | Source | Resolution |
74
+ |--------|-----------|
75
+ | `delegation.overrides.rai-story-run` | Per-skill override (highest priority) |
76
+ | `delegation.default_level` | Explicit default |
77
+ | `experience_level` ShuHaRi | Shu→REVIEW, Ha→NOTIFY, Ri→AUTO |
78
+ | No profile | Default to REVIEW |
79
+
80
+ Present: "Delegation: **{level}**"
81
+
82
+ <verification>
83
+ Delegation level resolved.
84
+ </verification>
85
+
86
+ ### Step 2: Execute Skill Chain
87
+
88
+ Run each skill from the detected phase forward.
89
+
90
+ **Phase banner (before starting):**
91
+
92
+ ```
93
+ ── Phase {N}/8: {skill_name} ──
94
+ ```
95
+
96
+ **Completion banner (after finishing each phase):**
97
+
98
+ Use a markdown heading + table so that file paths are clickable in the terminal:
99
+
100
+ ```markdown
101
+ ### ✔ Phase {N}/8 — {skill_name}
102
+
103
+ | | File | Status |
104
+ |---|---|---|
105
+ | + | `path/to/new-file.md` | created |
106
+ | ~ | `path/to/modified-file.py` | modified |
107
+
108
+ **Commits:** 1 (`abc1234`) · **Tests:** 3463 passed
109
+ ```
110
+
111
+ Rules for the completion banner:
112
+ - Use markdown table (NOT ASCII box-drawing) so file paths are clickable
113
+ - File paths in backticks, relative to project root
114
+ - `+` for created, `~` for modified, `-` for deleted
115
+ - Only list files the skill actually touched (not inherited from prior phases)
116
+ - Commits and tests on a single summary line below the table
117
+ - For gate phases (design, implement, AR, QR), add verdict/summary on a separate line
118
+ - If phase produced no file changes (e.g., close is just merge), show merge commit hash instead of file table
119
+
120
+ **Chain order:**
121
+
122
+ | Phase | Skill | Execution | Gate after? |
123
+ |:-----:|-------|:---------:|:-----------:|
124
+ | 1 | `/rai-story-start {story_id}` | **fork** | — |
125
+ | 2 | `/rai-story-design {story_id}` | **fork** | POST-DESIGN |
126
+ | 3 | `/rai-story-plan {story_id}` | **fork** | — |
127
+ | 4 | `/rai-story-implement {story_id}` | **fork** | POST-IMPLEMENT |
128
+ | 5 | `/rai-architecture-review {story_id} story` | **fork** | POST-AR |
129
+ | 6 | `/rai-quality-review {story_id}` | **fork** | POST-QR |
130
+ | 7 | `/rai-story-review {story_id}` | **fork** | — |
131
+ | 8 | `/rai-story-close {story_id}` | **fork** | — |
132
+
133
+ **All phases fork.** The orchestrator is a pure coordinator — it never executes skill logic directly. This keeps the terminal output clean (subagent output is contained) and the orchestrator context minimal.
134
+
135
+ #### Fork phases (all 8)
136
+
137
+ Each fork phase runs in a **fresh-context subagent** via the Agent tool. This eliminates context saturation that degrades quality in later phases.
138
+
139
+ **For each fork phase:**
140
+
141
+ 1. **Read** the skill's SKILL.md from `src/raise_cli/skills_base/rai-{skill-name}/SKILL.md`
142
+ 2. **Spawn** an Agent tool subagent with:
143
+ - `subagent_type: "general-purpose"`
144
+ - `prompt`: the agent prompt template below, filled with skill content and story context
145
+ 3. **Wait** for agent completion
146
+ 4. **Verify** output:
147
+ - Artifact-producing phases (start, design, plan, implement, review): confirm file exists on disk
148
+ - Verdict phases (AR, QR): read verdict from agent return value
149
+ - Close: confirm merge commit from agent return value
150
+ 5. **Show** completion banner in main thread
151
+ 6. **Apply** delegation gate if applicable (in main thread)
152
+
153
+ **Agent prompt template:**
154
+
155
+ ```
156
+ Execute the following skill for story {story_id}.
157
+
158
+ ## Skill Instructions
159
+
160
+ {paste the full SKILL.md content here}
161
+
162
+ ## Story Context
163
+
164
+ - Story ID: {story_id}
165
+ - Epic: {epic_id}
166
+ - Epic path: work/epics/{epic_slug}/
167
+ - Stories path: work/epics/{epic_slug}/stories/
168
+ - Prior artifacts on disk: {list each file that exists for this story, e.g. s353.2-story.md, s353.2-design.md}
169
+
170
+ ## Your Task
171
+
172
+ 1. Read CLAUDE.md for project-level context and rules
173
+ 2. Read the prior artifacts listed above from disk
174
+ 3. Execute every step in the Skill Instructions — no compression, no skipping
175
+ 4. Write all output artifacts to the correct paths
176
+ 5. When done, return a brief summary: what you did, artifacts created, and any verdicts or decisions
177
+
178
+ ARGUMENTS: {story_id}
179
+ ```
180
+
181
+ **Critical rules for fork execution:**
182
+ - The subagent gets the SKILL.md as its prompt — it executes the full skill naturally in fresh context
183
+ - Do NOT pass conversation history or prior phase results to the subagent — only disk artifacts and SKILL.md
184
+ - The orchestrator stays thin — it only reads summaries and checks for artifacts between forks
185
+ - A skill invoked through fork must produce the same output as when invoked standalone
186
+
187
+ <verification>
188
+ Each skill's SKILL.md was loaded and all its steps executed before proceeding.
189
+ </verification>
190
+
191
+ <if-blocked>
192
+ Skill fails → STOP immediately. Report which phase failed and why. The developer re-invokes `/rai-story-run` after fixing the issue — phase detection resumes from the last completed artifact.
193
+ </if-blocked>
194
+
195
+ ### Step 3: Apply Delegation Gates
196
+
197
+ After **phase 2 (design)**, **phase 4 (implement)**, **phase 5 (AR)**, and **phase 6 (QR)**, apply the delegation gate:
198
+
199
+ | Level | Behavior |
200
+ |-------|----------|
201
+ | REVIEW | Present summary of completed phase. Wait for explicit approval before continuing. |
202
+ | NOTIFY | Present summary. Continue after 3 seconds unless user intervenes. |
203
+ | AUTO | Continue immediately. Gates still stop on test/lint/type failure or AR/QR SIMPLIFY/FAIL verdict. |
204
+
205
+ **Post-design summary:** Approach, components affected, key decisions.
206
+ **Post-implement summary:** Tasks completed, tests passing, files changed.
207
+ **Post-AR summary:** Verdict (PASS/PASS WITH QUESTIONS/SIMPLIFY), findings count, key heuristics triggered.
208
+ **Post-QR summary:** Verdict (PASS/PASS WITH RECOMMENDATIONS/FAIL), findings count, fixes applied.
209
+
210
+ If AR verdict is SIMPLIFY or QR verdict is FAIL, STOP regardless of delegation level. Fixes must be applied before proceeding.
211
+
212
+ <verification>
213
+ Gate applied. Approval received (REVIEW) or notification shown (NOTIFY/AUTO).
214
+ </verification>
215
+
216
+ ### Step 4: Complete & Report
217
+
218
+ After all phases complete, present:
219
+
220
+ ```markdown
221
+ ## Story Run Complete: {story_id}
222
+
223
+ **Phases:** {start_phase} → close ({N} phases executed)
224
+ **Delegation:** {level}
225
+ **Result:** Merged to `{parent_branch}` (`{merge_commit_hash}`)
226
+
227
+ ### Artifacts
228
+ | Phase | File | Op |
229
+ |-------|------|:--:|
230
+ | start | `work/epics/.../stories/s{N}.{M}-story.md` | + |
231
+ | start | `work/epics/.../stories/s{N}.{M}-scope.md` | + |
232
+ | design | `work/epics/.../stories/s{N}.{M}-design.md` | + |
233
+ | plan | `work/epics/.../stories/s{N}.{M}-plan.md` | + |
234
+ | implement | `src/path/to/file.py` | ~ |
235
+ | implement | `tests/path/to/test.py` | ~ |
236
+ | review | `work/epics/.../stories/s{N}.{M}-retrospective.md` | + |
237
+
238
+ ### Metrics
239
+ | Metric | Value |
240
+ |--------|-------|
241
+ | Tests | {count} passed |
242
+ | Commits | {total_count} across {phases_count} phases |
243
+ | Patterns | {PAT-IDs or "none"} |
244
+ | Jira | {ticket} → {status} |
245
+ ```
246
+
247
+ File paths MUST use backticks so they are clickable in the terminal. Use actual paths, not placeholders — the table above is a template.
248
+
249
+ <verification>
250
+ All phases complete. Story merged and branch cleaned up.
251
+ </verification>
252
+
253
+ ## Output
254
+
255
+ | Item | Destination |
256
+ |------|-------------|
257
+ | All story artifacts | `work/epics/e{N}-{name}/stories/` |
258
+ | Merge commit | Parent branch (epic or dev) |
259
+ | Patterns | `.raise/rai/memory/patterns.jsonl` |
260
+ | Calibration | Via `rai signal emit-calibration` |
261
+ | Next | Next story or `/rai-epic-close` |
262
+
263
+ ## Quality Checklist
264
+
265
+ - [ ] Phase detection checked in reverse order (most advanced first)
266
+ - [ ] Delegation resolved from profile before starting chain
267
+ - [ ] All 8 phases spawn Agent tool subagent with full SKILL.md as prompt
268
+ - [ ] Each subagent gets fresh context — no conversation history passed
269
+ - [ ] Artifact-producing forks verified by checking file on disk
270
+ - [ ] AR/QR verdicts read from agent return value
271
+ - [ ] Gates applied at post-design, post-implement, post-AR, and post-QR (in main thread)
272
+ - [ ] Failure stops immediately — no cascading to next phase
273
+ - [ ] NEVER create a state file — phase detection is git-derived only
274
+ - [ ] NEVER skip a skill in the chain (even if developer says "just close it")
275
+ - [ ] NEVER pass conversation context to forked subagent — only disk artifacts + SKILL.md
276
+
277
+ ## References
278
+
279
+ - Skills: `/rai-story-start`, `/rai-story-design`, `/rai-story-plan`, `/rai-story-implement`, `/rai-architecture-review`, `/rai-quality-review`, `/rai-story-review`, `/rai-story-close`
280
+ - Delegation: `~/.rai/developer.yaml`, S325.2
281
+ - BacklogHook: S325.4 (fires on `rai signal emit-work` in start/close)
282
+ - Design: `s325.6-design.md` (decisions D1-D2-D3)
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: rai-story-start
3
+ description: >
4
+ Initialize a story with verified context, branch, and scope commit.
5
+ Use at the beginning of story work to ensure proper setup and
6
+ traceability from the start.
7
+
8
+ license: MIT
9
+
10
+ metadata:
11
+ raise.work_cycle: story
12
+ raise.frequency: per-story
13
+ raise.fase: "3"
14
+ raise.prerequisites: ""
15
+ raise.next: story-design
16
+ raise.gate: ""
17
+ raise.adaptable: "true"
18
+ raise.version: "3.0.0"
19
+ raise.visibility: public
20
+ raise.inputs: |
21
+ - story_id: string, required, argument
22
+ - dev_branch: string, required, config
23
+ raise.outputs: |
24
+ - story_branch: string, next_skill
25
+ - story_md: file_path, next_skill
26
+ - scope_md: file_path, next_skill
27
+ ---
28
+
29
+ # Story Start
30
+
31
+ ## Purpose
32
+
33
+ Initialize a story with a dedicated branch from the development branch and a scope commit that documents boundaries and done criteria.
34
+
35
+ ## Mastery Levels (ShuHaRi)
36
+
37
+ - **Shu**: Follow all steps, verify epic context, create branch with scope commit
38
+ - **Ha**: Skip epic verification for standalone stories or experiments
39
+ - **Ri**: Custom initialization patterns for specific workflows
40
+
41
+ ## Context
42
+
43
+ **When to use:** Starting a new story from the backlog or epic scope.
44
+
45
+ **When to skip:** Quick bug fixes (direct branch). Continuation of already-started story.
46
+
47
+ **Inputs:** Story ID (S{N}.{M}), epic scope document (if part of an epic), clear understanding of story scope.
48
+
49
+ **Branch config:** Read `branches.development` from `.raise/manifest.yaml` for `{dev_branch}`. Default: `main`.
50
+
51
+ ## Steps
52
+
53
+ ### Step 1: Verify Epic Context (if applicable)
54
+
55
+ If this story belongs to an epic, verify the epic directory and scope exist:
56
+
57
+ ```bash
58
+ ls work/epics/e{N}-{name}/scope.md
59
+ ```
60
+
61
+ | Condition | Action |
62
+ |-----------|--------|
63
+ | Epic scope exists | Continue — verify story is listed in scope |
64
+ | Epic scope missing | Run `/rai-epic-start` first |
65
+ | Standalone story | No epic verification needed |
66
+
67
+ <verification>
68
+ Epic context verified (or documented as standalone).
69
+ </verification>
70
+
71
+ ### Step 2: Create Story Branch from Dev
72
+
73
+ Always branch from `{dev_branch}`:
74
+
75
+ ```bash
76
+ git checkout {dev_branch} && git pull origin {dev_branch}
77
+ git checkout -b story/s{N}.{M}/{story-slug}
78
+ ```
79
+
80
+ | Condition | Action |
81
+ |-----------|--------|
82
+ | M/L story | Create dedicated `story/` branch |
83
+ | S/XS story | Create branch anyway — all stories branch from `{dev_branch}` |
84
+ | Standalone | Same — `story/s{N}.{M}/{slug}` from `{dev_branch}` |
85
+
86
+ <verification>
87
+ On story branch created from `{dev_branch}`.
88
+ </verification>
89
+
90
+ ### Step 3: Define Scope & Commit
91
+
92
+ Create TWO artifacts:
93
+
94
+ 1. `work/epics/e{N}-{name}/stories/s{N}.{M}-story.md` using `templates/story.md` — user story (Connextra), Gherkin AC, SbE examples. For XS stories, informal AC is acceptable.
95
+ 2. `work/epics/e{N}-{name}/stories/s{N}.{M}-scope.md` — in scope/out of scope, done criteria (observable outcomes).
96
+
97
+ Commit:
98
+
99
+ ```bash
100
+ git add -A
101
+ git commit -m "feat(s{N}.{M}): initialize story scope
102
+
103
+ In scope:
104
+ - {item 1}
105
+ - {item 2}
106
+
107
+ Done when:
108
+ - {criteria 1}
109
+ - {criteria 2}
110
+
111
+ Co-Authored-By: Rai <rai@humansys.ai>"
112
+ ```
113
+
114
+ <verification>
115
+ Scope commit on story branch with boundaries documented.
116
+ </verification>
117
+
118
+ ### Step 3b: Update Backlog Status
119
+
120
+ If the story has a backlog ticket (Jira key or local key):
121
+
122
+ ```bash
123
+ rai backlog transition {story_key} in_progress
124
+ ```
125
+
126
+ | Condition | Action |
127
+ |-----------|--------|
128
+ | Story has ticket | Transition to `in_progress` |
129
+ | No ticket found | Skip (not all stories are tracked externally) |
130
+ | Transition fails | Log warning and continue — backlog errors are **non-blocking** for lifecycle |
131
+
132
+ <if-blocked>
133
+ Adapter not configured or transition fails → log and continue. Backlog sync is best-effort; it must never block story work.
134
+ </if-blocked>
135
+
136
+ ### Step 4: Present Next Steps
137
+
138
+ Show the developer:
139
+ - Branch name and commit hash
140
+ - Quick scope summary
141
+ - **Next:** `/rai-story-design` — design is not optional (PAT-186)
142
+
143
+ ## Output
144
+
145
+ | Item | Destination |
146
+ |------|-------------|
147
+ | Story branch | `story/s{N}.{M}/{slug}` from `{dev_branch}` |
148
+ | User Story | `stories/s{N}.{M}-story.md` (Connextra + Gherkin AC) |
149
+ | Scope commit | On story branch |
150
+ | Backlog update | via `rai backlog transition` (best-effort) |
151
+ | Next | `/rai-story-design` |
152
+
153
+ ## Quality Checklist
154
+
155
+ - [ ] Story branch created from `{dev_branch}` (never from an epic branch)
156
+ - [ ] User Story created from `templates/story.md` (Connextra + Gherkin AC)
157
+ - [ ] Scope commit documents in/out boundaries and done criteria
158
+ - [ ] Story listed in epic scope document (if part of an epic)
159
+ - [ ] NEVER create story branch from anything other than `{dev_branch}`
160
+
161
+ ## References
162
+
163
+ - Next: `/rai-story-design` (always — PAT-186)
164
+ - Complement: `/rai-story-close`
165
+ - Epic scope: `work/epics/e{N}-{name}/scope.md`
166
+ - Branch model: `CLAUDE.md` § Branch Model
@@ -0,0 +1,38 @@
1
+ ---
2
+ story_id: "{STORY_ID}"
3
+ epic_ref: "{EPIC_ID}"
4
+ size: "{XS|S|M|L}"
5
+ status: "draft"
6
+ ---
7
+
8
+ # Story: {title}
9
+
10
+ ## User Story
11
+ As a [role],
12
+ I want [capability],
13
+ so that [benefit].
14
+
15
+ ## Acceptance Criteria
16
+
17
+ ### Scenario: {happy path}
18
+ ```gherkin
19
+ Given [initial context]
20
+ When [action]
21
+ Then [expected outcome]
22
+ ```
23
+
24
+ ### Scenario: {edge case}
25
+ ```gherkin
26
+ Given [context]
27
+ When [action]
28
+ Then [outcome]
29
+ ```
30
+
31
+ ## Examples (Specification by Example)
32
+
33
+ | Input | Action | Expected Output |
34
+ |-------|--------|-----------------|
35
+ | [concrete value] | [concrete action] | [concrete result] |
36
+
37
+ ## Notes
38
+ [Context, constraints, references to epic design.md]