ai-runtime-kit 0.5.0 → 0.9.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.
@@ -6,6 +6,15 @@ DRAFT
6
6
  <!-- Allowed: DRAFT | APPROVED | REJECTED | SUPERSEDED.
7
7
  See .ai/runtime/workflows/bug-fix.md for lifecycle rules. -->
8
8
 
9
+ ## Parent Feature
10
+
11
+ (none — bug-fix workflow)
12
+ <!-- Bug-fix workflow skips Step 0.5 (no feature slicing) — the
13
+ fix is corrective, not a sliced PRD feature. Override with
14
+ a real path only if the bug fix happens to be part of a
15
+ larger PRD-driven effort. See .ai/runtime/INDEX.md
16
+ § Traceability for the full chain. -->
17
+
9
18
  ## 1. Goal
10
19
 
11
20
  Describe the corrective outcome in one paragraph. Focus on what
@@ -6,9 +6,20 @@ Describe the specific engineering goal.
6
6
 
7
7
  ---
8
8
 
9
- ## Related Spec
9
+ ## Parent Spec
10
10
 
11
- -
11
+ `.ai/project/specs/YYYY-MM-DD-<slug>/spec.md`
12
+ <!-- Required. Single path. -->
13
+
14
+ ---
15
+
16
+ ## Parent Plan
17
+
18
+ `.ai/project/plans/YYYY-MM-DD-<slug>/plan.md`
19
+ <!-- Required. Single path. For hot-fix tasks created outside
20
+ the normal plan-first workflow, render
21
+ `(none — direct task)`. See .ai/runtime/INDEX.md
22
+ § Traceability for the full chain. -->
12
23
 
13
24
  ---
14
25
 
@@ -64,6 +75,18 @@ TODO
64
75
 
65
76
  executor
66
77
 
78
+ ## TDD-Applies
79
+
80
+ false
81
+ <!-- Allowed: true | false.
82
+ Rule: true if the task introduces or modifies runtime
83
+ behavior (code that runs); false for documentation, refactor
84
+ with no behavior change, or config / packaging / metadata
85
+ only. When true, follow workflow Step 1.5 — a failing-test
86
+ commit must precede the implementation commit. When false,
87
+ state a one-line reason here so the skip is explicit
88
+ rather than implicit. -->
89
+
67
90
  ## Blocked By
68
91
 
69
92
  None.
@@ -50,6 +50,12 @@ Metrics, User Stories, Out of Scope, Open Questions,
50
50
  Stakeholders. Engineering details (architecture, data flow, code
51
51
  contracts) belong in the downstream spec, not the PRD.
52
52
 
53
+ Read `.ai/runtime/agents/prd-writer.md` to anchor the role — it
54
+ scopes the agent's responsibilities, inputs, outputs, and
55
+ constraints. The procedural depth (the 11-step elicit-then-write
56
+ flow) lives in a project-side skill referenced from the agent
57
+ file; concept lattice is **agent = WHO, skill = HOW.**
58
+
53
59
  Skip this step when:
54
60
 
55
61
  - the change is corrective (use `bug-fix.md` instead — bug fixes
@@ -60,9 +66,43 @@ Skip this step when:
60
66
  intent.
61
67
 
62
68
  PRD lifecycle mirrors specs: `DRAFT → APPROVED → REJECTED →
63
- SUPERSEDED`. An APPROVED PRD authorizes spec drafting. The
64
- downstream spec MUST reference its PRD by path in §1 Goal so
65
- review can verify the spec satisfies the PRD.
69
+ SUPERSEDED`. An APPROVED PRD authorizes feature slicing (Step
70
+ 0.5).
71
+
72
+ ### 0.5. Slice into Features
73
+
74
+ When Step 0 ran (a PRD exists), slice it into **≥1 feature
75
+ docs** under:
76
+
77
+ ```txt
78
+ .ai/project/features/YYYY-MM-DD-<slug>/feature.md
79
+ ```
80
+
81
+ One feature per discrete capability that can be specced and
82
+ implemented independently. The feature doc answers "what slice
83
+ of the PRD does this satisfy, and what does done look like" —
84
+ mid-level between PRD ("what & why") and spec ("how").
85
+ Engineering details (architecture, contracts, test plan) belong
86
+ in the spec, not the feature.
87
+
88
+ Use `.ai/runtime/features/_template.md` as the starting point.
89
+ Each feature must cite its parent PRD in `## Parent PRD`; the
90
+ PRD's `## Downstream Spec` section lists the features that
91
+ derived from it.
92
+
93
+ **Mandatory whenever Step 0 ran.** Same skip criteria as Step 0:
94
+ bug-fix workflow and engineering-only changes skip Step 0
95
+ entirely, so they skip Step 0.5 too.
96
+
97
+ Single-feature PRDs still produce **one feature doc with the
98
+ full template structure** — sections may contain "see parent
99
+ PRD" pointers when the content is fully captured upstream, but
100
+ no 5-line stub allowance (consistent shape protects
101
+ traceability tooling and audit clarity).
102
+
103
+ Feature lifecycle mirrors specs: `DRAFT → APPROVED → REJECTED →
104
+ SUPERSEDED`. An APPROVED feature authorizes spec drafting for
105
+ that feature.
66
106
 
67
107
  ### 1. Define Spec
68
108
 
@@ -72,9 +112,12 @@ Create a feature spec under:
72
112
  .ai/project/specs/YYYY-MM-DD-feature-name/spec.md
73
113
  ```
74
114
 
75
- If the spec is downstream of a PRD (Step 0), §1 Goal must cite
76
- the PRD path so reviewers can check that the spec covers the
77
- PRD's requirements without quietly expanding scope.
115
+ If the spec is downstream of a feature (Step 0.5), §1 Goal must
116
+ cite the feature path (the feature in turn cites its parent
117
+ PRD, so the chain assembles upward). Reviewers walk the chain to
118
+ check that the spec covers the feature's requirements without
119
+ quietly expanding scope and that the feature covers its share of
120
+ the PRD's metrics.
78
121
 
79
122
  Spec must include:
80
123
 
@@ -86,8 +129,45 @@ Spec must include:
86
129
  - Verification Commands
87
130
  - Rollback Plan
88
131
 
132
+ ### 1.5. TDD Phase (per task, when applicable)
133
+
134
+ For each task produced under the spec's plan: if the task
135
+ carries `TDD-Applies: true` (see
136
+ `.ai/runtime/tasks/_template.md` § TDD-Applies), a **failing-
137
+ test commit must land before** that task's implementation
138
+ commit. The role file for this step is
139
+ `.ai/runtime/agents/tdd-writer.md`.
140
+
141
+ **Trigger.** Task's `TDD-Applies` value is `true`. The
142
+ boundary follows parent-PRD-style rules: behavior-changing
143
+ tasks → `true`; doc / refactor-with-no-behavior-change /
144
+ config-only → `false`.
145
+
146
+ **Required artifact.** A separate commit whose diff contains
147
+ only the failing test(s) for the task. Verify red (test
148
+ actually fails) before declaring the step done. The
149
+ implementation commit lands on a distinct commit hash with a
150
+ later timestamp, satisfying the test that was just authored.
151
+
152
+ **Skip rule.** Tasks with `TDD-Applies: false` skip this step
153
+ entirely. The skip is explicit on the task itself (the
154
+ `## TDD-Applies` section in the task file states the boolean
155
+ plus a one-line reason); never implicit.
156
+
157
+ **Per-task semantics.** This is not a single workflow-wide
158
+ pause. Step 1.5 runs once *per applicable task*, interleaved
159
+ with that task's implementation. A feature with N
160
+ TDD-applicable tasks fires Step 1.5 N times.
161
+
89
162
  ### 2. Execute with Claude Code
90
163
 
164
+ > Step 1.5 is a per-task prerequisite for any task with
165
+ > `TDD-Applies: true`. The execute step below covers plan
166
+ > authoring, task production, implementation, and verification
167
+ > as one umbrella; the TDD discipline runs *inside* that
168
+ > umbrella, per applicable task, before each task's
169
+ > implementation commit.
170
+
91
171
  Claude Code must read:
92
172
 
93
173
  - `.ai/runtime/agents/executor.md`
package/src/init.js CHANGED
@@ -11,6 +11,7 @@ const { isPathGitignored } = require('./git');
11
11
 
12
12
  const PROJECT_SKELETON_DIRS = [
13
13
  'prds',
14
+ 'features',
14
15
  'specs',
15
16
  'plans',
16
17
  'tasks',