specrails-core 5.6.0 → 6.0.1

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 (279) 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/change-scope.d.ts +63 -0
  5. package/dist/agent-runtime/change-scope.js +297 -0
  6. package/dist/agent-runtime/cli-executor.d.ts +1 -1
  7. package/dist/agent-runtime/cli-executor.js +1 -2
  8. package/dist/agent-runtime/cli-process.js +0 -1
  9. package/dist/agent-runtime/cli.js +4 -5
  10. package/dist/agent-runtime/codex-schema.js +0 -1
  11. package/dist/agent-runtime/compact/architect.d.ts +3 -272
  12. package/dist/agent-runtime/compact/architect.js +8 -9
  13. package/dist/agent-runtime/compact/chat-client.d.ts +3 -3
  14. package/dist/agent-runtime/compact/chat-client.js +1 -2
  15. package/dist/agent-runtime/compact/developer.d.ts +3 -70
  16. package/dist/agent-runtime/compact/developer.js +13 -14
  17. package/dist/agent-runtime/compact/environment.d.ts +16 -5
  18. package/dist/agent-runtime/compact/environment.js +32 -3
  19. package/dist/agent-runtime/compact/exit-code-honesty.d.ts +2 -1
  20. package/dist/agent-runtime/compact/exit-code-honesty.js +0 -1
  21. package/dist/agent-runtime/compact/guarded-loop.d.ts +2 -18
  22. package/dist/agent-runtime/compact/guarded-loop.js +7 -8
  23. package/dist/agent-runtime/compact/prompt-inputs.d.ts +0 -2
  24. package/dist/agent-runtime/compact/prompt-inputs.js +1 -2
  25. package/dist/agent-runtime/compact/reviewer.d.ts +0 -13
  26. package/dist/agent-runtime/compact/reviewer.js +5 -6
  27. package/dist/agent-runtime/compact/step.d.ts +0 -1
  28. package/dist/agent-runtime/compact/step.js +1 -2
  29. package/dist/agent-runtime/compact/test-reachability.js +6 -3
  30. package/dist/agent-runtime/config.js +0 -1
  31. package/dist/agent-runtime/core-host.d.ts +2 -2
  32. package/dist/agent-runtime/core-host.js +2 -3
  33. package/dist/agent-runtime/durable-store.d.ts +0 -1
  34. package/dist/agent-runtime/durable-store.js +1 -2
  35. package/dist/agent-runtime/efficiency-summary.d.ts +2 -2
  36. package/dist/agent-runtime/efficiency-summary.js +1 -2
  37. package/dist/agent-runtime/efficiency-types.js +0 -1
  38. package/dist/agent-runtime/efficiency.js +0 -1
  39. package/dist/agent-runtime/evaluation-corpus.js +0 -1
  40. package/dist/agent-runtime/evaluation.d.ts +2 -1
  41. package/dist/agent-runtime/evaluation.js +1 -2
  42. package/dist/agent-runtime/executor-types.d.ts +1 -1
  43. package/dist/agent-runtime/executor-types.js +0 -1
  44. package/dist/agent-runtime/executors.js +0 -1
  45. package/dist/agent-runtime/gemini-policy.js +0 -1
  46. package/dist/agent-runtime/graph/artifacts.d.ts +1 -1
  47. package/dist/agent-runtime/graph/artifacts.js +5 -3
  48. package/dist/agent-runtime/graph/convergence.d.ts +26 -0
  49. package/dist/agent-runtime/graph/convergence.js +62 -0
  50. package/dist/agent-runtime/graph/nodes.d.ts +1 -1
  51. package/dist/agent-runtime/graph/nodes.js +170 -24
  52. package/dist/agent-runtime/graph/review-policy.js +0 -1
  53. package/dist/agent-runtime/graph/roles.d.ts +2 -5
  54. package/dist/agent-runtime/graph/roles.js +2 -8
  55. package/dist/agent-runtime/graph/state.d.ts +6 -1
  56. package/dist/agent-runtime/graph/state.js +2 -1
  57. package/dist/agent-runtime/graph-checkpointer.d.ts +2 -1
  58. package/dist/agent-runtime/graph-checkpointer.js +0 -1
  59. package/dist/agent-runtime/guardrails.d.ts +3 -3
  60. package/dist/agent-runtime/guardrails.js +1 -2
  61. package/dist/agent-runtime/index.d.ts +1 -1
  62. package/dist/agent-runtime/index.js +1 -2
  63. package/dist/agent-runtime/kimi-acp.js +1 -2
  64. package/dist/agent-runtime/kimi-model.d.ts +6 -0
  65. package/dist/agent-runtime/kimi-model.js +12 -0
  66. package/dist/agent-runtime/openai-executor.d.ts +0 -9
  67. package/dist/agent-runtime/openai-executor.js +6 -7
  68. package/dist/agent-runtime/openspec-tool-server.js +1 -2
  69. package/dist/agent-runtime/openspec.d.ts +0 -2
  70. package/dist/agent-runtime/openspec.js +1 -6
  71. package/dist/agent-runtime/prompts.d.ts +11 -5
  72. package/dist/agent-runtime/prompts.js +46 -17
  73. package/dist/agent-runtime/provider-diagnostic.js +1 -2
  74. package/dist/agent-runtime/recovery.js +1 -2
  75. package/dist/agent-runtime/repository-context.d.ts +1 -1
  76. package/dist/agent-runtime/repository-context.js +19 -1
  77. package/dist/agent-runtime/review-context.d.ts +1 -1
  78. package/dist/agent-runtime/review-context.js +0 -1
  79. package/dist/agent-runtime/role-routing.js +0 -1
  80. package/dist/agent-runtime/role-state.js +0 -1
  81. package/dist/agent-runtime/runtime-identity.js +1 -2
  82. package/dist/agent-runtime/tool-event.js +0 -1
  83. package/dist/agent-runtime/verification-plan.d.ts +5 -4
  84. package/dist/agent-runtime/verification-plan.js +9 -5
  85. package/dist/agent-runtime/workflow-types.js +0 -1
  86. package/dist/agent-runtime/workflow.js +0 -1
  87. package/dist/agent-runtime/workspace-tools.d.ts +2 -2
  88. package/dist/agent-runtime/workspace-tools.js +1 -2
  89. package/dist/installer/cli.d.ts +3 -32
  90. package/dist/installer/cli.js +26 -101
  91. package/dist/installer/commands/framework.d.ts +4 -3
  92. package/dist/installer/commands/framework.js +0 -1
  93. package/dist/installer/commands/init.d.ts +4 -25
  94. package/dist/installer/commands/init.js +5 -8
  95. package/dist/installer/phases/framework-lifecycle.d.ts +3 -17
  96. package/dist/installer/phases/framework-lifecycle.js +2 -3
  97. package/dist/installer/phases/install-config.d.ts +7 -8
  98. package/dist/installer/phases/install-config.js +2 -7
  99. package/dist/installer/phases/manifest.d.ts +6 -7
  100. package/dist/installer/phases/manifest.js +2 -7
  101. package/dist/installer/phases/prereqs.d.ts +6 -7
  102. package/dist/installer/phases/prereqs.js +4 -6
  103. package/dist/installer/phases/provider-detect.d.ts +6 -7
  104. package/dist/installer/phases/provider-detect.js +2 -4
  105. package/dist/installer/phases/scaffold.d.ts +9 -10
  106. package/dist/installer/phases/scaffold.js +82 -805
  107. package/dist/installer/util/errors.js +0 -1
  108. package/dist/installer/util/exec.d.ts +3 -2
  109. package/dist/installer/util/exec.js +0 -1
  110. package/dist/installer/util/fs.d.ts +0 -10
  111. package/dist/installer/util/fs.js +1 -2
  112. package/dist/installer/util/git.js +0 -1
  113. package/dist/installer/util/install-transaction.d.ts +2 -2
  114. package/dist/installer/util/install-transaction.js +1 -2
  115. package/dist/installer/util/logger.d.ts +1 -3
  116. package/dist/installer/util/logger.js +0 -1
  117. package/dist/installer/util/paths.js +0 -1
  118. package/dist/installer/util/registry.d.ts +4 -8
  119. package/dist/installer/util/registry.js +2 -3
  120. package/dist/{installer/runtime → pipeline}/pipeline-state.d.ts +11 -0
  121. package/dist/{installer/runtime → pipeline}/pipeline-state.js +56 -5
  122. package/dist/shared/args.d.ts +18 -0
  123. package/dist/shared/args.js +53 -0
  124. package/integration-contract.json +11 -47
  125. package/package.json +3 -10
  126. package/templates/agents/sr-architect.md +15 -310
  127. package/templates/agents/sr-developer.md +15 -269
  128. package/templates/agents/sr-reviewer.md +13 -367
  129. package/templates/codex-skills/rails/sr-architect/SKILL.md +14 -308
  130. package/templates/codex-skills/rails/sr-developer/SKILL.md +14 -201
  131. package/templates/codex-skills/rails/sr-reviewer/SKILL.md +15 -289
  132. package/templates/kimi/specrails/run-skill.mjs +91 -2173
  133. package/bin/tui-installer.mjs +0 -430
  134. package/commands/doctor.md +0 -62
  135. package/dist/agent-runtime/capabilities.js.map +0 -1
  136. package/dist/agent-runtime/cli-executor.js.map +0 -1
  137. package/dist/agent-runtime/cli-process.js.map +0 -1
  138. package/dist/agent-runtime/cli.js.map +0 -1
  139. package/dist/agent-runtime/codex-schema.js.map +0 -1
  140. package/dist/agent-runtime/compact/architect.js.map +0 -1
  141. package/dist/agent-runtime/compact/chat-client.js.map +0 -1
  142. package/dist/agent-runtime/compact/developer.js.map +0 -1
  143. package/dist/agent-runtime/compact/environment.js.map +0 -1
  144. package/dist/agent-runtime/compact/exit-code-honesty.js.map +0 -1
  145. package/dist/agent-runtime/compact/guarded-loop.js.map +0 -1
  146. package/dist/agent-runtime/compact/prompt-inputs.js.map +0 -1
  147. package/dist/agent-runtime/compact/reviewer.js.map +0 -1
  148. package/dist/agent-runtime/compact/step.js.map +0 -1
  149. package/dist/agent-runtime/compact/test-reachability.js.map +0 -1
  150. package/dist/agent-runtime/config.js.map +0 -1
  151. package/dist/agent-runtime/core-host.js.map +0 -1
  152. package/dist/agent-runtime/durable-store.js.map +0 -1
  153. package/dist/agent-runtime/efficiency-summary.js.map +0 -1
  154. package/dist/agent-runtime/efficiency-types.js.map +0 -1
  155. package/dist/agent-runtime/efficiency.js.map +0 -1
  156. package/dist/agent-runtime/evaluation-corpus.js.map +0 -1
  157. package/dist/agent-runtime/evaluation.js.map +0 -1
  158. package/dist/agent-runtime/executor-types.js.map +0 -1
  159. package/dist/agent-runtime/executors.js.map +0 -1
  160. package/dist/agent-runtime/gemini-policy.js.map +0 -1
  161. package/dist/agent-runtime/graph/artifacts.js.map +0 -1
  162. package/dist/agent-runtime/graph/nodes.js.map +0 -1
  163. package/dist/agent-runtime/graph/review-policy.js.map +0 -1
  164. package/dist/agent-runtime/graph/roles.js.map +0 -1
  165. package/dist/agent-runtime/graph/state.js.map +0 -1
  166. package/dist/agent-runtime/graph-checkpointer.js.map +0 -1
  167. package/dist/agent-runtime/guardrails.js.map +0 -1
  168. package/dist/agent-runtime/index.js.map +0 -1
  169. package/dist/agent-runtime/kimi-acp.js.map +0 -1
  170. package/dist/agent-runtime/openai-executor.js.map +0 -1
  171. package/dist/agent-runtime/openspec-tool-server.js.map +0 -1
  172. package/dist/agent-runtime/openspec.js.map +0 -1
  173. package/dist/agent-runtime/prompts.js.map +0 -1
  174. package/dist/agent-runtime/provider-diagnostic.js.map +0 -1
  175. package/dist/agent-runtime/recovery.js.map +0 -1
  176. package/dist/agent-runtime/repository-context.js.map +0 -1
  177. package/dist/agent-runtime/review-context.js.map +0 -1
  178. package/dist/agent-runtime/role-routing.js.map +0 -1
  179. package/dist/agent-runtime/role-state.js.map +0 -1
  180. package/dist/agent-runtime/runtime-identity.js.map +0 -1
  181. package/dist/agent-runtime/tool-event.js.map +0 -1
  182. package/dist/agent-runtime/verification-plan.js.map +0 -1
  183. package/dist/agent-runtime/workflow-types.js.map +0 -1
  184. package/dist/agent-runtime/workflow.js.map +0 -1
  185. package/dist/agent-runtime/workspace-tools.js.map +0 -1
  186. package/dist/installer/cli.js.map +0 -1
  187. package/dist/installer/commands/doctor.d.ts +0 -27
  188. package/dist/installer/commands/doctor.js +0 -615
  189. package/dist/installer/commands/doctor.js.map +0 -1
  190. package/dist/installer/commands/framework.js.map +0 -1
  191. package/dist/installer/commands/init.js.map +0 -1
  192. package/dist/installer/commands/update.d.ts +0 -56
  193. package/dist/installer/commands/update.js +0 -257
  194. package/dist/installer/commands/update.js.map +0 -1
  195. package/dist/installer/commands/v5-migration.d.ts +0 -32
  196. package/dist/installer/commands/v5-migration.js +0 -133
  197. package/dist/installer/commands/v5-migration.js.map +0 -1
  198. package/dist/installer/phases/framework-lifecycle.js.map +0 -1
  199. package/dist/installer/phases/install-config.js.map +0 -1
  200. package/dist/installer/phases/manifest.js.map +0 -1
  201. package/dist/installer/phases/prereqs.js.map +0 -1
  202. package/dist/installer/phases/provider-detect.js.map +0 -1
  203. package/dist/installer/phases/scaffold.js.map +0 -1
  204. package/dist/installer/runtime/kimi.d.ts +0 -84
  205. package/dist/installer/runtime/kimi.js +0 -255
  206. package/dist/installer/runtime/kimi.js.map +0 -1
  207. package/dist/installer/runtime/pipeline-state.js.map +0 -1
  208. package/dist/installer/util/errors.js.map +0 -1
  209. package/dist/installer/util/exec.js.map +0 -1
  210. package/dist/installer/util/fs.js.map +0 -1
  211. package/dist/installer/util/git.js.map +0 -1
  212. package/dist/installer/util/install-transaction.js.map +0 -1
  213. package/dist/installer/util/logger.js.map +0 -1
  214. package/dist/installer/util/paths.js.map +0 -1
  215. package/dist/installer/util/prompts.d.ts +0 -23
  216. package/dist/installer/util/prompts.js +0 -49
  217. package/dist/installer/util/prompts.js.map +0 -1
  218. package/dist/installer/util/registry.js.map +0 -1
  219. package/dist/installer/util/template.d.ts +0 -23
  220. package/dist/installer/util/template.js +0 -60
  221. package/dist/installer/util/template.js.map +0 -1
  222. package/docs/README.md +0 -40
  223. package/docs/agent-runtime-efficiency.md +0 -65
  224. package/docs/agent-runtime.md +0 -393
  225. package/docs/agents.md +0 -315
  226. package/docs/changelog.md +0 -168
  227. package/docs/ci-cd.md +0 -60
  228. package/docs/concepts.md +0 -183
  229. package/docs/customization.md +0 -363
  230. package/docs/deployment.md +0 -234
  231. package/docs/getting-started.md +0 -122
  232. package/docs/installation.md +0 -395
  233. package/docs/local-tickets.md +0 -191
  234. package/docs/migration-guide.md +0 -140
  235. package/docs/playbook-oss-maintainer.md +0 -112
  236. package/docs/playbook-parallel-dev.md +0 -124
  237. package/docs/playbook-product-discovery.md +0 -115
  238. package/docs/plugin-architecture.md +0 -144
  239. package/docs/research/codex-compatibility-analysis.md +0 -365
  240. package/docs/research/mcp-feasibility-analysis.md +0 -382
  241. package/docs/testing/test-matrix-codex.md +0 -130
  242. package/docs/updating.md +0 -89
  243. package/docs/user-docs/cli-reference.md +0 -428
  244. package/docs/user-docs/codex-vs-claude-code.md +0 -23
  245. package/docs/user-docs/core-updates.md +0 -70
  246. package/docs/user-docs/faq.md +0 -146
  247. package/docs/user-docs/getting-started-codex.md +0 -194
  248. package/docs/user-docs/getting-started-kimi.md +0 -423
  249. package/docs/user-docs/installation.md +0 -237
  250. package/docs/user-docs/provider-pipelines.md +0 -96
  251. package/docs/user-docs/quick-start.md +0 -161
  252. package/docs/windows.md +0 -78
  253. package/docs/workflows.md +0 -463
  254. package/schemas/profile.v1.json +0 -207
  255. package/templates/claude-md/CLAUDE-quickstart.md +0 -54
  256. package/templates/claude-md/root.md +0 -50
  257. package/templates/codex-skills/batch-implement/SKILL.md +0 -38
  258. package/templates/codex-skills/implement/SKILL.md +0 -38
  259. package/templates/codex-skills/retry/SKILL.md +0 -16
  260. package/templates/commands/specrails/compat-check.md +0 -271
  261. package/templates/commands/specrails/doctor.md +0 -62
  262. package/templates/commands/specrails/explore-spec.md +0 -173
  263. package/templates/commands/specrails/health-check.md +0 -527
  264. package/templates/commands/specrails/memory-inspect.md +0 -261
  265. package/templates/commands/specrails/opsx-diff.md +0 -419
  266. package/templates/commands/specrails/propose-spec.md +0 -102
  267. package/templates/commands/specrails/refactor-recommender.md +0 -169
  268. package/templates/commands/specrails/telemetry.md +0 -553
  269. package/templates/commands/specrails/why.md +0 -96
  270. package/templates/gemini-commands/batch-implement.toml +0 -37
  271. package/templates/gemini-commands/implement.toml +0 -37
  272. package/templates/gemini-commands/retry.toml +0 -15
  273. package/templates/profiles/default.json +0 -14
  274. package/templates/profiles/kimi-default.json +0 -15
  275. package/templates/rules/layer.md +0 -8
  276. package/templates/runtime/provider-pipeline.md +0 -113
  277. package/templates/security/security-exemptions.yaml +0 -20
  278. package/templates/settings/confidence-config.json +0 -17
  279. package/templates/settings/settings.json +0 -15
@@ -1,194 +0,0 @@
1
- # Getting Started with SpecRails + Codex
2
-
3
- This guide gets you running SpecRails using OpenAI Codex as your AI agent.
4
- Claude Code, Gemini CLI, and Kimi Code are also supported; see the
5
- [standard installation guide](installation.md) or the
6
- [Kimi-specific guide](getting-started-kimi.md).
7
-
8
- ---
9
-
10
- ## Requirements
11
-
12
- | Tool | Version | Notes |
13
- |------|---------|-------|
14
- | **Node.js** | 20.19.0+ | Required for the installer and pinned OpenSpec 1.4.1 CLI |
15
- | **Codex CLI** | Latest | `npm i -g @openai/codex` |
16
- | **Git** | Any | Your project must be a git repository |
17
-
18
- Optional but recommended:
19
-
20
- | Tool | Why |
21
- |------|-----|
22
- | **GitHub CLI** (`gh`) | Automatic PR creation and Issue integration |
23
-
24
- ### Install Codex CLI
25
-
26
- ```bash
27
- npm i -g @openai/codex
28
- ```
29
-
30
- Verify the install:
31
-
32
- ```bash
33
- codex --version
34
- ```
35
-
36
- You need an OpenAI account with Codex access. Sign in with:
37
-
38
- ```bash
39
- codex auth login
40
- ```
41
-
42
- ---
43
-
44
- ## Install SpecRails
45
-
46
- Run the installer from inside your project directory:
47
-
48
- ```bash
49
- cd your-project
50
- npx specrails-core@latest init --root-dir .
51
- ```
52
-
53
- The installer detects Codex CLI automatically and generates configuration in `.codex/` instead of `.claude/`.
54
-
55
- ### Flags
56
-
57
- | Flag | Effect |
58
- |------|--------|
59
- | `--root-dir <path>` | Target directory (default: current directory) |
60
- | `--yes` / `-y` | Skip confirmation prompts |
61
-
62
- ### What gets installed
63
-
64
- ```
65
- your-project/
66
- ├── AGENTS.md # SpecRails agent instructions for Codex
67
- └── .codex/
68
- ├── skills/ # Workflow skills (/specrails:*, /opsx:*)
69
- ├── agents/ # Agent definitions (TOML)
70
- ├── rules/ # Per-layer coding conventions
71
- ├── agent-memory/ # Persistent agent memory
72
- └── config.toml # Permissions and configuration
73
- ```
74
-
75
- ---
76
-
77
- ## Configure with enrich
78
-
79
- After installation, open Codex and run the enrich skill:
80
-
81
- ```bash
82
- codex
83
- ```
84
-
85
- Then invoke the enrich skill:
86
-
87
- ```
88
- /specrails:enrich
89
- ```
90
-
91
- Or run it non-interactively:
92
-
93
- ```bash
94
- codex exec "run /specrails:enrich --yes"
95
- ```
96
-
97
- The wizard runs 5 phases:
98
-
99
- | Phase | What happens |
100
- |-------|-------------|
101
- | **1. Analyze** | Detects your tech stack, architecture layers, and CI commands |
102
- | **2. Personas** | Researches your domain and generates VPC user profiles |
103
- | **3. Configure** | Asks about your backlog provider, git workflow, and agent selection |
104
- | **4. Generate** | Fills all templates with your project-specific context |
105
- | **5. Cleanup** | Removes setup files, leaving only your tailored workflow |
106
-
107
- ---
108
-
109
- ## Use your first skill
110
-
111
- Once setup is complete, try generating a feature:
112
-
113
- ```bash
114
- codex
115
- ```
116
-
117
- ```
118
- /specrails:implement "add a health check endpoint"
119
- ```
120
-
121
- Or with a GitHub issue number:
122
-
123
- ```
124
- /specrails:implement #42
125
- ```
126
-
127
- This runs the full SpecRails pipeline: Architect → Developer → Reviewer → PR.
128
-
129
- ---
130
-
131
- ## Codex Cloud (alternative)
132
-
133
- If you prefer the web interface, SpecRails Skills also work in **Codex Cloud** at [chatgpt.com/codex](https://chatgpt.com/codex). Connect your repository and use Skills from the UI.
134
-
135
- Note that Codex Cloud runs asynchronously — long-running skills like `/specrails:implement` are well-suited to this environment.
136
-
137
- ---
138
-
139
- ## Verify
140
-
141
- Check that everything installed correctly:
142
-
143
- ```bash
144
- # List generated agent configs
145
- ls .codex/agents/
146
-
147
- # List installed skills
148
- ls .codex/skills/
149
-
150
- # Check for unresolved placeholders (should return nothing)
151
- grep -r '{{[A-Z_]*}}' .codex/agents/ .codex/skills/ 2>/dev/null
152
-
153
- # Check the installed version
154
- cat .specrails/specrails-version
155
- ```
156
-
157
- ---
158
-
159
- ## Troubleshooting
160
-
161
- ### "No AI CLI found"
162
-
163
- Neither `claude` nor `codex` was found in your `PATH`. Install Codex CLI:
164
-
165
- ```bash
166
- npm i -g @openai/codex
167
- ```
168
-
169
- ### Codex CLI not detected
170
-
171
- The installer looks for `codex` in your `PATH`. If it is installed but not found, verify:
172
-
173
- ```bash
174
- which codex
175
- codex --version
176
- ```
177
-
178
- If Codex is installed via a custom path, pass the provider explicitly:
179
-
180
- ```bash
181
- npx specrails-core@latest init --root-dir . --provider codex
182
- ```
183
-
184
- ### Existing `.codex/` directory detected
185
-
186
- The installer warns if SpecRails artifacts already exist. You can merge or abort to review manually.
187
-
188
- ### Placeholders not resolved
189
-
190
- If you see `{{PLACEHOLDER}}` in generated files, `/specrails:enrich` did not complete. Re-run `/specrails:enrich` or fill the values manually.
191
-
192
- ---
193
-
194
- [← Installation](installation.md) · [Codex vs Claude Code →](codex-vs-claude-code.md) · [CLI Reference →](cli-reference.md)
@@ -1,423 +0,0 @@
1
- # Getting Started with SpecRails + Kimi Code
2
-
3
- SpecRails supports Kimi Code as an independent AI provider. The integration
4
- uses the installed `kimi` CLI in non-interactive prompt mode; it does not embed
5
- Kimi Code, start `kimi web`, or require a SpecRails-owned server.
6
-
7
- ## Requirements
8
-
9
- | Tool | Version | Purpose |
10
- |------|---------|---------|
11
- | Kimi Code | 0.27.0 or newer | Agentic runtime |
12
- | Node.js | 20.19.0 or newer | Runs the SpecRails installer and pinned OpenSpec 1.4.1 CLI |
13
- | Git | 2.25 or newer | Repository and worktree operations |
14
-
15
- Install Kimi Code using an official method:
16
-
17
- ```bash
18
- # macOS / Linux
19
- curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash
20
- ```
21
-
22
- ```powershell
23
- # Windows PowerShell
24
- irm https://code.kimi.com/kimi-code/install.ps1 | iex
25
- ```
26
-
27
- The optional npm distribution is `@moonshot-ai/kimi-code` and requires the
28
- Node.js version documented by Kimi Code (22.19 or newer at the time this
29
- integration was implemented). The standalone installer is preferable when the
30
- project itself may remain on Node 20.19.0 or newer.
31
-
32
- Verify the executable and authenticate once:
33
-
34
- ```bash
35
- kimi --version
36
- kimi login
37
- ```
38
-
39
- SpecRails checks installation and version without sending a model prompt. Kimi
40
- does not expose a non-billing command that conclusively proves every OAuth
41
- session is usable, so an inconclusive auth probe is allowed and the first real
42
- invocation will surface any login error.
43
-
44
- ## Install SpecRails
45
-
46
- From the repository that should receive SpecRails:
47
-
48
- ```bash
49
- npx specrails-core@latest init --root-dir . --provider kimi
50
- ```
51
-
52
- For a quick, template-only install:
53
-
54
- ```bash
55
- npx specrails-core@latest init --root-dir . --provider kimi --quick
56
- ```
57
-
58
- Without `--provider`, automatic selection preserves the established priority:
59
- Claude, Codex, Gemini, then Kimi. Pass `--provider kimi` when several CLIs are
60
- installed and Kimi is the intended runtime.
61
-
62
- ## Generated Kimi layout
63
-
64
- ```text
65
- .kimi-code/
66
- ├── AGENTS.md
67
- ├── mcp.json
68
- ├── personas/
69
- ├── rules/
70
- ├── specrails/
71
- │ ├── run-skill.mjs
72
- │ └── vendor/js-yaml/
73
- │ ├── js-yaml.mjs
74
- │ ├── LICENSE
75
- │ └── NOTICE.md
76
- └── skills/
77
- ├── specrails-enrich/SKILL.md
78
- ├── specrails-implement/SKILL.md
79
- ├── specrails-…/SKILL.md
80
- ├── openspec-…/SKILL.md
81
- ├── sr-architect/SKILL.md
82
- ├── sr-developer/SKILL.md
83
- └── …
84
- ```
85
-
86
- Kimi's skill loader inspects each immediate child of `.kimi-code/skills`; it
87
- does not recursively discover grouping directories. SpecRails therefore gives
88
- every workflow (`specrails-*`), OpenSpec workflow (`openspec-*`), managed role
89
- (`sr-*`), and custom role (`custom-*`) its own direct-child directory.
90
- Non-invocable persona data lives separately under `.kimi-code/personas/`, so
91
- the skill scanner never mistakes it for a skill. The managed headless runner
92
- also lives outside the scanner.
93
-
94
- Interactive workflow invocations in Kimi's TUI differ from Claude/Gemini
95
- syntax:
96
-
97
- ```text
98
- /skill:specrails-enrich
99
- /skill:specrails-implement add passkey authentication
100
- /skill:specrails-batch-implement #41 #42
101
- ```
102
-
103
- OpenSpec workflows use their complete published skill names, for example:
104
-
105
- ```text
106
- /skill:openspec-ff-change add-passkeys
107
- /skill:openspec-apply-change add-passkeys
108
- /skill:openspec-verify-change add-passkeys
109
- ```
110
-
111
- OpenSpec versions that initially generate `.kimi/skills/openspec-*` are
112
- normalized into `.kimi-code/skills/` by SpecRails. Existing `.kimi-code`
113
- content and user-owned skills are preserved. Normalization rejects symlinked
114
- or special-file sources/destinations, copies only a verified contained tree,
115
- and uses unpredictable same-filesystem temporary/backup directories for each
116
- atomic replacement.
117
-
118
- ## Models and reasoning effort
119
-
120
- SpecRails persists Kimi's public model ids:
121
-
122
- - `k3` (default)
123
- - `kimi-for-coding`
124
- - `kimi-for-coding-highspeed`
125
-
126
- Managed Kimi login config exposes these as CLI aliases under `kimi-code/`.
127
- At process launch, SpecRails maps only those known ids:
128
-
129
- ```text
130
- k3 -> kimi-code/k3
131
- kimi-for-coding -> kimi-code/kimi-for-coding
132
- kimi-for-coding-highspeed -> kimi-code/kimi-for-coding-highspeed
133
- ```
134
-
135
- Already-prefixed aliases and custom aliases pass through unchanged. This keeps
136
- profiles portable without silently rewriting custom Kimi configuration.
137
- At the process boundary, every model id must be 1–128 characters and match
138
- `^[A-Za-z0-9][A-Za-z0-9._/:-]*$`. This preserves common configured aliases such
139
- as `company/Kimi-Custom:v2` while rejecting leading flags, whitespace, control
140
- characters, and shell syntax before spawn.
141
-
142
- When profile scaffolding is requested, Kimi's provider-bound fallback is stored
143
- at `.specrails/profiles/kimi-default.json`. It can coexist with Claude's
144
- historical `project-default.json` in a multi-provider project.
145
-
146
- K3 supports `low`, `high`, and `max` reasoning effort. Desktop launches apply
147
- the selected value only to that child process through
148
- `KIMI_MODEL_THINKING_EFFORT`; SpecRails never mutates the user's global shell
149
- environment. The Core invocation overlay removes inherited effort unless the
150
- caller explicitly selects a valid value for K3. The managed helper preserves
151
- an inherited `low`, `high`, or `max` only for `k3`/`kimi-code/k3`; it removes
152
- the variable for every other model and drops invalid values. Kimi's documented
153
- K3 default is `high`; leaving the variable unset deliberately retains that
154
- upstream default. SpecRails does not substitute `low`.
155
-
156
- ## Headless and session behavior
157
-
158
- Kimi 0.27 handles `/skill:...` in its TUI and ACP clients. Prompt mode does not:
159
- `kimi -p "/skill:specrails-implement ..."` forwards that string directly to
160
- the model and silently fails to call Kimi's skill activation path.
161
-
162
- The canonical headless invocation therefore uses Core's managed Node helper:
163
-
164
- ```bash
165
- node .kimi-code/specrails/run-skill.mjs \
166
- --skill specrails-implement \
167
- --model k3 \
168
- --args "add passkey authentication"
169
- ```
170
-
171
- The helper validates a direct-child skill id, reads and expands its `SKILL.md`
172
- using Kimi 0.27's argument and XML rules, and launches the separately installed
173
- `kimi` executable with `-p` and `--output-format stream-json`. It passes each
174
- value as an argv element with `shell: false`; it never evaluates skill names,
175
- model aliases, or multiline arguments as shell source.
176
-
177
- Provider hosts can submit a plain user turn to the helper with
178
- `--plain-prompt-stdin`; Core bounds that UTF-8 input to 1 MiB and keeps it out
179
- of the host-to-helper argv. Kimi 0.27 exposes no native stdin/file equivalent
180
- to `-p`, so the helper passes the exact turn—not a file-reading envelope—to
181
- the external CLI. Consequently, an official native Kimi binary still exposes
182
- the exact prompt in its own process argv. The Windows npm shim is the one
183
- verified exception described below. Do not place secrets in agent prompts.
184
-
185
- Generated Kimi skills resolve project-specific stack, CI, layer, persona,
186
- backlog, and PR context at activation time from `.kimi-code/project-context.md`,
187
- `.kimi-code/personas/*.md`, and `.specrails/backlog-config.json`. Their
188
- `KIMI_RUNTIME_*`/`KIMI_BACKLOG_*` markers are semantic operations, never shell
189
- command names. Missing or read-only backlog configuration fails closed for
190
- writes instead of fabricating a provider command.
191
-
192
- Generated workflows use an even stricter boundary for role launches. For each
193
- single role or parallel group, the orchestrator writes one exact object through
194
- Kimi's structured WriteFile tool to `.specrails/kimi-role-wave.json`:
195
-
196
- ```json
197
- {
198
- "run": "implement-20260719",
199
- "roles": [
200
- {
201
- "key": "developer-feature-a",
202
- "skill": "sr-developer",
203
- "model": "k3",
204
- "profile": "inherit",
205
- "args": "Complete context for feature A",
206
- "workspace": "worktree:feature-a"
207
- }
208
- ]
209
- }
210
- ```
211
-
212
- `run`, `key`, the optional profile stem, and the worktree suffix are lowercase
213
- letters/digits/hyphens, 1–64 characters. `profile` is `inherit` or the stem of
214
- a validated `.specrails/profiles/<name>.json`; the helper passes its absolute
215
- path only to that child. A wave contains 1–32 roles and no extra fields. The
216
- orchestrator then runs one static foreground command with `--role-wave-file`;
217
- model names and arbitrary multiline context never enter shell source. The
218
- runner accepts no alternate path, symlink, duplicate role/worktree, unsafe
219
- identifier, or file above 1 MiB, and deletes the one-shot file before setup.
220
-
221
- ```bash
222
- node .kimi-code/specrails/run-skill.mjs \
223
- --role-wave-file .specrails/kimi-role-wave.json \
224
- --add-dir "${SPECRAILS_REPO_DIR:-.}"
225
- ```
226
-
227
- `workspace: "current"` still gives each parallel role a unique execution
228
- directory, while `SPECRAILS_REPO_DIR` points at the repository it must edit.
229
- This prevents nested workflow state/request collisions. A
230
- `worktree:<feature-id>` entry creates or reuses a detached git worktree from a
231
- private synthetic commit that snapshots the initial dirty tracked and
232
- non-ignored untracked files without changing the user's index or branch. Reuse the
233
- same worktree id for that feature's developer, test, and documentation waves.
234
- The helper excludes managed `.kimi-code`/run-state from the role's git index
235
- and records source HEAD, immutable synthetic base commit, and every path under
236
- `.specrails/kimi-role-worktrees/<run>.json`; merge instructions use that commit
237
- instead of assuming `main`.
238
-
239
- Before status, merge, reuse, or cleanup, Core recomputes the only valid temp
240
- worktree/execution/exclude paths from the canonical repository hash and run/id,
241
- requires every isolated path to be that exact registered worktree, and verifies
242
- the private baseline ref still equals the manifest commit. Editing the manifest
243
- cannot redirect `git worktree remove`, status, or merge to another registered
244
- worktree. A Windows copied `.kimi-code` overlay is likewise accepted only with
245
- a managed marker and a full deterministic content hash; stale bytes are rebuilt.
246
-
247
- Child streams are emitted as attributed `specrails.role.*` JSONL frames. The
248
- helper waits for the whole wave and exits nonzero if any role fails. Termination
249
- signals reach every live child. A role failure keeps valid worktrees for retry;
250
- a setup failure removes only worktrees partially created by that setup, and
251
- retry reuses the manifest's exact run/worktree mapping.
252
-
253
- Merge begins with `--role-wave-status <run>`, which emits complete A/M/D
254
- inventories across committed, staged, unstaged, and non-ignored untracked
255
- changes. Exclusive paths are applied through the fixed
256
- `.specrails/kimi-role-merge.json` request and `--role-merge-file`; filenames are
257
- never interpolated into shell source. After a successful merge,
258
- `--role-wave-cleanup <run>` removes registered worktrees, execution state, the
259
- manifest, and the private synthetic-baseline ref. Failed or unmerged runs are
260
- never cleaned automatically.
261
-
262
- The supported contract is qualified against Kimi 0.27's stable v1 engine.
263
- SpecRails removes `KIMI_CODE_EXPERIMENTAL_FLAG` from the child environment and
264
- rejects experimental runner flags instead of silently opting into a different,
265
- unverified runtime. Every Core-managed child also receives
266
- `KIMI_DISABLE_CRON=1` and `KIMI_CODE_NO_AUTO_UPDATE=1`: a bounded SpecRails
267
- invocation must not leave persistent scheduled work behind or self-update the
268
- external CLI during startup. These controls do not disable Kimi print mode's
269
- normal foreground task drain or steering lifecycle.
270
-
271
- On Windows npm installs, large materialized workflows never travel in the
272
- `CreateProcess` command line. The helper launches the official Kimi JavaScript
273
- entry through a fixed Node bootstrap, sends the full UTF-8 prompt over stdin,
274
- and restores that one `-p` argv value before importing Kimi. This preserves the
275
- complete workflow even when it exceeds Windows' command-line limit. A native
276
- executable remains direct-spawned only while its command line is at most 30,000
277
- UTF-16 code units; larger native launches fail with guidance to use the
278
- standard npm shim.
279
-
280
- Once that initial skill is running, nested SpecRails and OpenSpec workflows use
281
- Kimi's built-in `Skill` tool with explicit `skill` and `args` fields. This is
282
- the native in-session path and retains Kimi's nested activation behavior and
283
- `skill.activated` telemetry. The external helper reproduces the exact visible
284
- initial prompt, but cannot emit Kimi-private activation-origin telemetry; no
285
- such events are synthesized.
286
-
287
- Kimi emits a `session.resume_hint` record at the end of a successful prompt.
288
- A host trusts and persists it only when it is the terminal non-empty JSONL
289
- record, its id passes the grammar below, and the Kimi child exits with code 0.
290
- When that session id is known, a later skill invocation can resume it explicitly:
291
-
292
- ```bash
293
- node .kimi-code/specrails/run-skill.mjs \
294
- --skill sr-reviewer \
295
- --model k3 \
296
- --args "continue with the review feedback" \
297
- --session=<session-id>
298
- ```
299
-
300
- `${KIMI_SESSION_ID}` cannot be populated before a fresh prompt emits that hint.
301
- The helper rejects a fresh invocation of a skill that uses this placeholder
302
- instead of silently substituting an incorrect empty id. Resume ids are bounded
303
- to 1–128 characters in `[A-Za-z0-9._-]`, with `.` and `..` rejected, and the
304
- external Kimi process receives the id as one `--session=<id>` argument.
305
-
306
- The helper forwards `SIGINT`, `SIGTERM`, and `SIGHUP` to its direct Kimi child
307
- and removes those handlers when the child exits. Desktop or another embedding
308
- host remains responsible for its normal platform-specific process-tree
309
- teardown. There is no background Kimi service for SpecRails to install,
310
- monitor, or uninstall.
311
-
312
- One JSONL assistant record may contain text and several tool calls. Consumers
313
- must retain every event from that record. The telemetry skill reads Kimi's
314
- persisted `~/.kimi-code/session_index.jsonl`, validated session `state.json`,
315
- and `agents/*/wire.jsonl` `usage.record` events. Those records expose
316
- input-other, output, cache-read, and cache-creation tokens per model. They do
317
- not expose an authoritative USD charge or reliable role outcome, so cost and
318
- success rate remain unavailable rather than being synthesized.
319
-
320
- ## Permissions and attachments
321
-
322
- Kimi prompt mode is autonomous: it temporarily uses Kimi's `auto` permission
323
- policy and still honors static deny rules from the user's Kimi configuration.
324
- Run agentic workflows only in repositories and worktrees you trust. SpecRails
325
- does not add `--auto`, `--yolo`, or `--plan`; Kimi rejects those flags when
326
- combined with `-p`.
327
-
328
- Kimi has no dedicated image CLI flag. SpecRails accepts only absolute,
329
- readable, regular, non-symlink attachment files, canonicalizes each path, and
330
- adds every unique parent as `--add-dir`. It then places those canonical media
331
- references in the prompt so Kimi can use `ReadMediaFile` or `ReadFile`. Core's
332
- helper does not read or inline attachment contents. Missing files, directories,
333
- symlinks, and unreadable inputs fail before spawn.
334
-
335
- ## MCP
336
-
337
- Kimi reads project MCP declarations from `.kimi-code/mcp.json`. SpecRails
338
- creates an empty file when none exists and merges its own entries additively.
339
- It never replaces an existing valid user configuration or copies OAuth/API
340
- credentials into the repository.
341
-
342
- ## Updating
343
-
344
- Update a Kimi installation explicitly:
345
-
346
- ```bash
347
- npx specrails-core@latest update --root-dir . --provider kimi
348
- ```
349
-
350
- Framework-owned `specrails-*` and `sr-*` skills are refreshed. These remain
351
- outside the cleanup boundary:
352
-
353
- - OpenSpec `openspec-*` skills
354
- - direct-child `custom-*` role skills
355
- - unknown user skill directories
356
- - existing MCP servers
357
- - agent memory and runtime state
358
-
359
- The managed `.kimi-code/specrails/run-skill.mjs` file is refreshed from the
360
- trusted Core package and recorded in the manifest. It is executable framework
361
- code, not a user-authored skill; keep custom helpers outside
362
- `.kimi-code/specrails/`. Its complete managed bundle includes the unmodified
363
- `js-yaml` ESM distribution, MIT `LICENSE`, and provenance `NOTICE.md` under
364
- `.kimi-code/specrails/vendor/js-yaml/`; this gives the helper complete YAML
365
- frontmatter parsing without using the project's `node_modules`.
366
-
367
- Pre-release SpecRails builds placed role skills below `skills/rails`, where
368
- Kimi cannot discover them. Update moves a legacy `custom-*` role to the direct
369
- level only when no same-named direct role exists, and recreates managed `sr-*`
370
- roles from the framework. A collision preserves both copies and is reported by
371
- `doctor` instead of guessing which user-authored role should win.
372
-
373
- ## Troubleshooting
374
-
375
- ### `kimi` is not found
376
-
377
- Open a new terminal after installation and check:
378
-
379
- ```bash
380
- kimi --version
381
- ```
382
-
383
- On Windows, also verify that the directory containing `kimi.cmd` is present in
384
- `PATH`.
385
-
386
- ### Login or model configuration error
387
-
388
- Run:
389
-
390
- ```bash
391
- kimi login
392
- kimi -p "Reply with OK" --output-format stream-json
393
- ```
394
-
395
- The second command is a real model request and can consume quota; SpecRails
396
- does not run it automatically as a setup probe.
397
-
398
- ### Model alias is not configured
399
-
400
- Complete managed login again, choose an alias configured in
401
- `~/.kimi-code/config.toml`, or pass one of the managed aliases such as
402
- `kimi-code/k3`.
403
-
404
- ### Legacy `.kimi/skills` remains
405
-
406
- Run the Kimi-specific update command. SpecRails moves only recognized
407
- `openspec-*` output and removes the legacy directory only when it is empty.
408
- Unknown files are left for manual review.
409
-
410
- ### Doctor reports a nested `skills/rails` layout
411
-
412
- Run the Kimi-specific update command first. If the diagnostic remains, compare
413
- the reported legacy `skills/rails/custom-*` role with its direct
414
- `skills/custom-*` counterpart, keep the intended version at the direct path,
415
- and remove the nested duplicate. Unknown nested directories are never deleted
416
- automatically.
417
-
418
- ## Official Kimi references
419
-
420
- - [Kimi Code documentation](https://www.kimi.com/code/docs/en/)
421
- - [Getting started](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/getting-started.html)
422
- - [Environment variables](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/env-vars.html)
423
- - [What is new](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html)