ai-runtime-kit 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +307 -0
  3. package/bin/cli.js +52 -0
  4. package/package.json +40 -0
  5. package/runtime/BOOTSTRAP.md +230 -0
  6. package/runtime/CAPABILITIES.md +166 -0
  7. package/runtime/INDEX.md +397 -0
  8. package/runtime/PRIORITIES.md +84 -0
  9. package/runtime/RUNTIME_HEALTH.md +87 -0
  10. package/runtime/RUNTIME_MODE.md +109 -0
  11. package/runtime/RUNTIME_TRANSITIONS.md +141 -0
  12. package/runtime/RUNTIME_VERSION.md +17 -0
  13. package/runtime/SAFETY.md +156 -0
  14. package/runtime/adr/0000-template.md +55 -0
  15. package/runtime/agents/executor.md +19 -0
  16. package/runtime/agents/verifier.md +83 -0
  17. package/runtime/hooks/README.md +163 -0
  18. package/runtime/hooks/_template/HOOK.md +87 -0
  19. package/runtime/hooks/pre-executor/runtime-scoped-preflight/HOOK.md +189 -0
  20. package/runtime/memory/architecture/principles.md +107 -0
  21. package/runtime/memory/engineering/principles.md +102 -0
  22. package/runtime/memory/runtime/context-loading.md +107 -0
  23. package/runtime/plans/_template.md +81 -0
  24. package/runtime/prds/_template.md +73 -0
  25. package/runtime/reviews/_template.md +37 -0
  26. package/runtime/rules/README.md +101 -0
  27. package/runtime/rules/_template/RULE.md +75 -0
  28. package/runtime/skills/README.md +96 -0
  29. package/runtime/skills/_template/SKILL.md +61 -0
  30. package/runtime/specs/_template/spec.md +50 -0
  31. package/runtime/specs/_template-bug-fix/spec.md +120 -0
  32. package/runtime/tasks/TASK_STATUS.md +58 -0
  33. package/runtime/tasks/_template.md +73 -0
  34. package/runtime/workflows/branching.md +128 -0
  35. package/runtime/workflows/bug-fix.md +169 -0
  36. package/runtime/workflows/feature-development.md +238 -0
  37. package/src/diff.js +81 -0
  38. package/src/git.js +38 -0
  39. package/src/init.js +166 -0
  40. package/src/prompt.js +17 -0
  41. package/src/snapshot.js +84 -0
  42. package/src/templates.js +96 -0
  43. package/src/upgrade.js +179 -0
  44. package/src/version.js +42 -0
@@ -0,0 +1,166 @@
1
+ # Runtime Capabilities
2
+
3
+ ## Purpose
4
+
5
+ Describe the capabilities currently supported by the AI engineering runtime.
6
+
7
+ AI agents should use this file to:
8
+
9
+ - discover runtime features
10
+ - understand supported workflows
11
+ - avoid unsupported operations
12
+
13
+ ---
14
+
15
+ ## Supported Capabilities
16
+
17
+ ### Feature Development
18
+
19
+ Supported:
20
+
21
+ - spec-driven development
22
+ - plan-driven execution
23
+ - task-based implementation
24
+ - verification workflow
25
+ - review workflow
26
+
27
+ Status:
28
+
29
+ - stable
30
+
31
+ ---
32
+
33
+ ### Governance
34
+
35
+ Supported:
36
+
37
+ - contract verification
38
+ - review coverage
39
+ - task lifecycle management
40
+ - spec lifecycle management
41
+ - runtime health audit
42
+
43
+ Status:
44
+
45
+ - stable
46
+
47
+ ---
48
+
49
+ ### Refactor Work
50
+
51
+ Supported:
52
+
53
+ - behavior-preserving refactors
54
+ - incremental migrations
55
+ - module extraction
56
+ - runtime-safe restructuring
57
+
58
+ Status:
59
+
60
+ - stable
61
+
62
+ ---
63
+
64
+ ### Runtime Orchestration
65
+
66
+ Supported:
67
+
68
+ - task discovery
69
+ - dependency analysis
70
+ - runtime prioritization
71
+ - runtime mode behavior
72
+ - runtime bootstrap
73
+
74
+ Status:
75
+
76
+ - experimental
77
+
78
+ Note: bootstrap loading and runtime-mode behavior are
79
+ deterministic; task discovery, dependency analysis, and
80
+ prioritization remain agent-judgement.
81
+
82
+ ---
83
+
84
+ ### Verification
85
+
86
+ Supported:
87
+
88
+ - build verification
89
+ - test verification
90
+ - contract verification
91
+ - runtime audit
92
+
93
+ Status:
94
+
95
+ - stable
96
+
97
+ ---
98
+
99
+ ### Memory System
100
+
101
+ Supported:
102
+
103
+ - hierarchical runtime memory
104
+ - context-aware loading
105
+ - runtime context strategy
106
+
107
+ Status:
108
+
109
+ - stable
110
+
111
+ ---
112
+
113
+ ## Unsupported Capabilities
114
+
115
+ Currently unsupported:
116
+
117
+ - parallel task execution
118
+ - automatic task scheduling
119
+ - automatic PR generation
120
+ - automatic ADR approval
121
+ - automatic dependency graph visualization
122
+ - runtime persistence outside repository
123
+
124
+ ---
125
+
126
+ ## Runtime Constraints
127
+
128
+ - Runtime is repository-local.
129
+ - Governance requires explicit artifacts.
130
+ - Verification is mandatory.
131
+ - Contracts override implementation convenience.
132
+ - Runtime health should remain GREEN whenever possible.
133
+
134
+ ---
135
+
136
+ ## Recommended Execution Model
137
+
138
+ ```txt
139
+ Spec
140
+
141
+ Plan
142
+
143
+ Task Graph
144
+
145
+ Execution
146
+
147
+ Verification
148
+
149
+ Review
150
+
151
+ Commit
152
+ ```
153
+
154
+ ### Safety Model
155
+
156
+ Supported:
157
+
158
+ - governance-aware execution
159
+
160
+ - protected operation detection
161
+
162
+ - runtime safety boundaries
163
+
164
+ Status:
165
+
166
+ - stable
@@ -0,0 +1,397 @@
1
+ # AI Runtime Index
2
+
3
+ ## Purpose
4
+
5
+ This file is the entry point for the local AI engineering workflow system.
6
+
7
+ AI agents should use this file to understand:
8
+
9
+ - project structure
10
+ - workflow structure
11
+ - governance rules
12
+ - artifact locations
13
+
14
+ ---
15
+
16
+ ## Agents
17
+
18
+ Location:
19
+
20
+ ```txt
21
+ .ai/runtime/agents/
22
+ ```
23
+
24
+ Role files in this location:
25
+
26
+ - executor
27
+ - verifier
28
+
29
+ The runtime framework defines five role concepts in its
30
+ agent-pipeline transitions (Architect → Planner → Executor →
31
+ Verifier → Reviewer; see Recommended Agent Flow below and
32
+ `.ai/runtime/hooks/README.md` for the full phase taxonomy).
33
+ The `architect`, `planner`, and `reviewer` phases exist as
34
+ transition concepts referenced by workflow and hook docs but
35
+ have no dedicated role-definition file in `.ai/runtime/agents/`
36
+ today.
37
+
38
+ ---
39
+
40
+ ## Skills
41
+
42
+ Location:
43
+
44
+ ```txt
45
+ .ai/runtime/skills/
46
+ ```
47
+
48
+ Defines reusable implementation patterns. See
49
+ `.ai/runtime/skills/README.md` for the directory layout, when to
50
+ create a skill, and how skills get loaded.
51
+
52
+ Current skills:
53
+
54
+ None ship with the kit. Add project-specific skills under
55
+ `.ai/project/skills/<stack-or-domain>/<skill-name>/SKILL.md` and
56
+ register them in your project's INDEX.md.
57
+
58
+ Authoring a new skill follows the workflow in
59
+ `.ai/runtime/skills/README.md`.
60
+
61
+ ---
62
+
63
+ ## Rules
64
+
65
+ Location:
66
+
67
+ ```txt
68
+ .ai/runtime/rules/
69
+ ```
70
+
71
+ Defines language- and scope-scoped conventions that apply whenever
72
+ a task touches files in scope. Unlike skills (task-triggered), rules
73
+ are always-on for their scope. See `.ai/runtime/rules/README.md`
74
+ for the rule lifecycle, severity convention, and how rules get
75
+ loaded.
76
+
77
+ Current rules:
78
+
79
+ None ship with the kit. Add project-specific rules under
80
+ `.ai/project/rules/<language>/<topic>.md` (or
81
+ `.ai/project/rules/<topic>.md` for cross-language rules) and
82
+ register them in your project's INDEX.md.
83
+
84
+ Authoring a new rule follows the workflow in
85
+ `.ai/runtime/rules/README.md`.
86
+
87
+ ---
88
+
89
+ ## Workflows
90
+
91
+ Location:
92
+
93
+ ```txt
94
+ .ai/runtime/workflows/
95
+ ```
96
+
97
+ Current workflows:
98
+
99
+ - `feature-development.md` — owns the spec / plan / task / review
100
+ lifecycle, including the spec lifecycle (`DRAFT → APPROVED → REJECTED
101
+ → SUPERSEDED`).
102
+ - `bug-fix.md` — owns the corrective-change lifecycle. Strict
103
+ superset of feature-development.md with three required spec
104
+ sections (Root Cause, Reproduction, Regression Test) and a
105
+ regression-test-first executor order.
106
+ - `branching.md` — owns git ref naming, branch tiering, and merge gates.
107
+
108
+ BOOTSTRAP Step 9 loads the workflow file matching the current runtime
109
+ mode.
110
+
111
+ ---
112
+
113
+ ## Hooks
114
+
115
+ Location:
116
+
117
+ ```txt
118
+ .ai/runtime/hooks/
119
+ ```
120
+
121
+ Defines agent-pipeline transition hooks — declarative boundary
122
+ contracts between two agents in the recommended flow
123
+ (Architect → Planner → Executor → Verifier → Reviewer). Unlike
124
+ skills (task-triggered) and rules (file-scope-triggered), hooks
125
+ trigger on **agent transitions**. Unrelated to the Husky git hooks
126
+ documented in `ADR-0006`. See `.ai/runtime/hooks/README.md` for the
127
+ hook lifecycle, trigger taxonomy, gate behavior, and loading paths.
128
+
129
+ Current hooks:
130
+
131
+ - `pre-executor/runtime-scoped-preflight` (GATE) — when a spec
132
+ touches `.ai/runtime/**`, verify §2 Scope enumerates each
133
+ runtime path, the branch is `chore/runtime-<topic>`, and a
134
+ spec file exists, before any edit is written. Pre-Executor
135
+ complement to `SAFETY.md` § Runtime Tree Protection. This is
136
+ the only hook that ships with the kit, since the rule it
137
+ enforces is intrinsic to kit governance.
138
+
139
+ Project-specific hooks live under
140
+ `.ai/project/hooks/<phase>/<name>/HOOK.md`. Authoring a new hook
141
+ follows the workflow in `.ai/runtime/hooks/README.md`.
142
+
143
+ ---
144
+
145
+ ## PRDs
146
+
147
+ Location:
148
+
149
+ ```txt
150
+ .ai/project/prds/ (instance)
151
+ .ai/runtime/prds/_template.md (template)
152
+ ```
153
+
154
+ Defines product requirements ("what & why") for product-driven
155
+ features. PRDs are upstream of specs: a PRD answers the problem,
156
+ target users, and success metrics; the downstream spec answers
157
+ how to build it. Optional — bug fixes and small engineering-only
158
+ changes do not require a PRD. See
159
+ `.ai/runtime/workflows/feature-development.md` § Step 0.
160
+
161
+ PRD lifecycle:
162
+
163
+ ```txt
164
+ DRAFT
165
+ → APPROVED
166
+ → REJECTED
167
+ → SUPERSEDED
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Specs
173
+
174
+ Location:
175
+
176
+ ```txt
177
+ .ai/project/specs/ (instance)
178
+ .ai/runtime/specs/_template/ (template)
179
+ ```
180
+
181
+ Defines feature requirements.
182
+
183
+ ---
184
+
185
+ ## Plans
186
+
187
+ Location:
188
+
189
+ ```txt
190
+ .ai/project/plans/ (instance)
191
+ .ai/runtime/plans/_template.md (template)
192
+ ```
193
+
194
+ Defines implementation strategy and task graph.
195
+
196
+ ---
197
+
198
+ ## Tasks
199
+
200
+ Location:
201
+
202
+ ```txt
203
+ .ai/project/tasks/ (instance)
204
+ .ai/runtime/tasks/ (schema + template)
205
+ ```
206
+
207
+ Defines executable engineering work units.
208
+
209
+ Task lifecycle:
210
+
211
+ ```txt
212
+ TODO
213
+ → IN_PROGRESS
214
+ → IN_REVIEW
215
+ → DONE
216
+ ```
217
+
218
+ ---
219
+
220
+ ## Contracts
221
+
222
+ Location:
223
+
224
+ ```txt
225
+ .ai/project/contracts/
226
+ ```
227
+
228
+ Defines public API boundaries and compatibility rules.
229
+
230
+ ---
231
+
232
+ ## Reviews
233
+
234
+ Location:
235
+
236
+ ```txt
237
+ .ai/project/reviews/ (instance)
238
+ .ai/runtime/reviews/_template.md (template)
239
+ ```
240
+
241
+ Stores feature and refactor reviews.
242
+
243
+ ---
244
+
245
+ ## Verifications
246
+
247
+ Location:
248
+
249
+ ```txt
250
+ .ai/project/verifications/
251
+ ```
252
+
253
+ Verification files are required for:
254
+
255
+ - failed verification
256
+ - blocked or rejected specs
257
+ - contract violations
258
+ - breaking changes
259
+ - complex refactors
260
+
261
+ Simple successful feature verification may be recorded in the related review file.
262
+
263
+ ---
264
+
265
+ ## ADRs
266
+
267
+ Location:
268
+
269
+ ```txt
270
+ .ai/project/adr/ (instance)
271
+ .ai/runtime/adr/0000-template.md (template)
272
+ ```
273
+
274
+ Stores architecture decision records.
275
+
276
+ ---
277
+
278
+ ## Memory
279
+
280
+ Location:
281
+
282
+ ```txt
283
+ .ai/runtime/memory/ (generic)
284
+ .ai/project/memory/ (instance)
285
+ ```
286
+
287
+ Hierarchy:
288
+
289
+ - core/
290
+ - architecture/
291
+ - engineering/
292
+ - governance/
293
+ - product/
294
+ - runtime/
295
+
296
+ Use context-loading strategy to determine which memory layers to load.
297
+
298
+ ---
299
+
300
+ ## Verification Rules
301
+
302
+ Minimum required verification:
303
+
304
+ ```bash
305
+ npm run verify
306
+ ```
307
+
308
+ ---
309
+
310
+ ## Governance Rules
311
+
312
+ - Public API changes require contract updates.
313
+ - Breaking changes require ADR approval.
314
+ - Features are not DONE until:
315
+ - implementation complete
316
+ - verification complete
317
+ - review exists
318
+ - task status updated
319
+
320
+ ---
321
+
322
+ <!-- Current architecture tree and tech stack live in
323
+ .ai/project/STATE.md under ## Architecture and ## Tech Stack. -->
324
+
325
+ ## Recommended Agent Flow
326
+
327
+ ```txt
328
+ Architect
329
+
330
+ Planner
331
+
332
+ Executor
333
+
334
+ Verifier
335
+
336
+ Reviewer
337
+ ```
338
+
339
+ ## Priorities
340
+
341
+ Location:
342
+
343
+ ```txt
344
+ .ai/runtime/PRIORITIES.md
345
+ ```
346
+
347
+ Defines runtime prioritization and execution ordering rules.
348
+
349
+
350
+ ## Runtime Mode
351
+
352
+ Location:
353
+
354
+ ```txt
355
+ .ai/runtime/RUNTIME_MODE.md
356
+ ```
357
+
358
+ Defines current engineering operating mode and AI behavior expectations.
359
+
360
+ ## Bootstrap
361
+
362
+ Location:
363
+
364
+ ```txt
365
+ .ai/runtime/BOOTSTRAP.md
366
+ ```
367
+
368
+ Defines runtime initialization protocol for AI agents.
369
+
370
+ ## Capabilities
371
+
372
+ Location:
373
+
374
+ ```txt
375
+ .ai/runtime/CAPABILITIES.md
376
+ ```
377
+
378
+ Describes supported runtime behaviors and engineering capabilities.
379
+
380
+ ## Safety
381
+
382
+ Location:
383
+
384
+ ```txt
385
+ .ai/runtime/SAFETY.md
386
+ ```
387
+
388
+ Defines runtime safety boundaries and protected operations.
389
+
390
+ ## Runtime Transitions
391
+
392
+ Location:
393
+
394
+ ```txt
395
+ .ai/runtime/RUNTIME_TRANSITIONS.md
396
+ ```
397
+ Defines runtime state transition rules and adaptive behavior changes.
@@ -0,0 +1,84 @@
1
+ # Runtime Priorities
2
+
3
+ ## Purpose
4
+
5
+ Define engineering priorities for AI workflow orchestration.
6
+
7
+ ---
8
+
9
+ ## Priority Levels
10
+
11
+ ### P0
12
+
13
+ Critical:
14
+
15
+ - production breakage
16
+ - verification failure
17
+ - contract violation
18
+ - broken build
19
+ - security issue
20
+
21
+ Must be handled immediately.
22
+
23
+ ---
24
+
25
+ ### P1
26
+
27
+ High priority:
28
+
29
+ - blocked execution path
30
+ - broken workflow governance
31
+ - missing critical reviews
32
+ - architecture inconsistency
33
+ - major refactor coordination
34
+
35
+ Should be handled before new feature work.
36
+
37
+ ---
38
+
39
+ ### P2
40
+
41
+ Normal feature work:
42
+
43
+ - additive features
44
+ - refactors
45
+ - improvements
46
+ - non-critical maintenance
47
+
48
+ Default priority.
49
+
50
+ ---
51
+
52
+ ### P3
53
+
54
+ Low priority:
55
+
56
+ - cleanup
57
+ - optional improvements
58
+ - cosmetic refactors
59
+ - documentation polish
60
+
61
+ ---
62
+
63
+ ## Prioritization Rules
64
+
65
+ - P0 overrides all other work.
66
+ - BLOCKED tasks causing dependency chain failures become P1.
67
+ - Governance inconsistencies may become P1 if they affect execution safety.
68
+ - Refactors should not interrupt P0/P1 work.
69
+ - Prefer tasks that unblock future execution paths.
70
+
71
+ ---
72
+
73
+ ## Runtime Health Rules
74
+
75
+ If runtime health is:
76
+
77
+ - RED → prioritize governance/verification recovery
78
+ - YELLOW → prioritize workflow maintenance before large features
79
+ - GREEN → feature work may continue
80
+
81
+ ---
82
+
83
+ <!-- Current runtime state and priority focus live in
84
+ .ai/project/STATE.md under ## Priorities. -->
@@ -0,0 +1,87 @@
1
+ # Runtime Health
2
+
3
+ ## Purpose
4
+
5
+ Define current runtime health state and required operational behavior.
6
+
7
+ ---
8
+
9
+ ## Health Levels
10
+
11
+ ### GREEN
12
+
13
+ Meaning:
14
+
15
+ - runtime stable
16
+ - governance consistent
17
+ - verification passing
18
+ - safe to continue feature work
19
+
20
+ Allowed:
21
+
22
+ - feature work
23
+ - refactors
24
+ - task expansion
25
+ - runtime evolution
26
+
27
+ ---
28
+
29
+ ### YELLOW
30
+
31
+ Meaning:
32
+
33
+ - governance drift exists
34
+ - runtime inconsistencies detected
35
+ - maintenance required
36
+
37
+ Behavior:
38
+
39
+ - prioritize runtime maintenance
40
+ - prioritize governance repair
41
+ - reduce risky changes
42
+
43
+ Allowed:
44
+
45
+ - small features
46
+ - low-risk refactors
47
+ - workflow repair
48
+
49
+ Avoid:
50
+
51
+ - large migrations
52
+ - high-risk architectural changes
53
+
54
+ ---
55
+
56
+ ### RED
57
+
58
+ Meaning:
59
+
60
+ - verification failing
61
+ - runtime integrity compromised
62
+ - contract violations active
63
+ - runtime instability
64
+
65
+ Behavior:
66
+
67
+ - stop feature work
68
+ - prioritize recovery
69
+ - prioritize verification
70
+ - prioritize rollback safety
71
+
72
+ Allowed:
73
+
74
+ - fixes only
75
+ - recovery operations
76
+ - governance repair
77
+
78
+ Forbidden:
79
+
80
+ - major feature work
81
+ - large refactors
82
+ - runtime expansion
83
+
84
+ ---
85
+
86
+ <!-- Current health values, drivers, and recovery goals live in
87
+ .ai/project/STATE.md under ## Health. -->