arreio 1.0.0-dev.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 (81) hide show
  1. package/README.md +81 -0
  2. package/package.json +42 -0
  3. package/scripts/postinstall.js +50 -0
  4. package/skills/arreio-init/SKILL.md +214 -0
  5. package/skills/arreio-init/references/architecture-template.md +85 -0
  6. package/skills/arreio-init/references/learn-index-template.md +15 -0
  7. package/skills/arreio-init/references/plan-index-template.md +29 -0
  8. package/skills/arreio-init/references/tasks-index-template.md +15 -0
  9. package/skills/learn/SKILL.md +151 -0
  10. package/skills/learn/modules/capture.md +108 -0
  11. package/skills/learn/modules/index.md +94 -0
  12. package/skills/learn/modules/maintain.md +116 -0
  13. package/skills/learn/modules/refine.md +104 -0
  14. package/skills/learn/references/dedup-rules.md +129 -0
  15. package/skills/learn/references/entry-schema.md +152 -0
  16. package/skills/learn/references/error-handling.md +178 -0
  17. package/skills/learn/references/id-generation.md +114 -0
  18. package/skills/learn/references/index-format.md +140 -0
  19. package/skills/learn/references/interaction-mode-propagation.md +89 -0
  20. package/skills/learn/references/migration-bootstrap.md +142 -0
  21. package/skills/learn/references/templates/artifacts/captured-entry.md +172 -0
  22. package/skills/learn/references/templates/artifacts/index-update.md +135 -0
  23. package/skills/learn/references/templates/artifacts/learn-input.md +100 -0
  24. package/skills/learn/references/templates/artifacts/maintain-log.md +142 -0
  25. package/skills/learn/references/templates/artifacts/refined-entry.md +168 -0
  26. package/skills/plan/SKILL.md +129 -0
  27. package/skills/plan/modules/design.md +140 -0
  28. package/skills/plan/modules/generate.md +156 -0
  29. package/skills/plan/modules/research.md +122 -0
  30. package/skills/plan/modules/scope.md +121 -0
  31. package/skills/plan/modules/tasks.md +190 -0
  32. package/skills/plan/references/design-complexity-assessment.md +118 -0
  33. package/skills/plan/references/error-handling.md +155 -0
  34. package/skills/plan/references/external-research-guidance.md +61 -0
  35. package/skills/plan/references/high-risk-detection.md +111 -0
  36. package/skills/plan/references/id-generation.md +55 -0
  37. package/skills/plan/references/interaction-mode-propagation.md +75 -0
  38. package/skills/plan/references/learnings-gate-logic.md +93 -0
  39. package/skills/plan/references/plan-tier-selection.md +174 -0
  40. package/skills/plan/references/task-slicing-rules.md +220 -0
  41. package/skills/plan/references/templates/artifacts/design.md +134 -0
  42. package/skills/plan/references/templates/artifacts/final-plan.md +265 -0
  43. package/skills/plan/references/templates/artifacts/research-findings.md +50 -0
  44. package/skills/plan/references/templates/artifacts/scoped-context.md +53 -0
  45. package/skills/plan/references/templates/artifacts/task.md +192 -0
  46. package/skills/plan/references/templates/artifacts/user-input.md +112 -0
  47. package/skills/review/SKILL.md +163 -0
  48. package/skills/review/modules/analyze.md +104 -0
  49. package/skills/review/modules/prepare.md +103 -0
  50. package/skills/review/modules/report.md +109 -0
  51. package/skills/review/modules/scope.md +126 -0
  52. package/skills/review/references/approval-criteria.md +101 -0
  53. package/skills/review/references/change-set-resolution.md +126 -0
  54. package/skills/review/references/error-handling.md +172 -0
  55. package/skills/review/references/id-generation.md +80 -0
  56. package/skills/review/references/interaction-mode-propagation.md +80 -0
  57. package/skills/review/references/review-categories.md +124 -0
  58. package/skills/review/references/scope-creep-detection.md +120 -0
  59. package/skills/review/references/severity-rubric.md +107 -0
  60. package/skills/review/references/templates/artifacts/findings.md +161 -0
  61. package/skills/review/references/templates/artifacts/review-input.md +116 -0
  62. package/skills/review/references/templates/artifacts/review-kit.md +135 -0
  63. package/skills/review/references/templates/artifacts/review-report.md +175 -0
  64. package/skills/review/references/templates/artifacts/review-scope.md +146 -0
  65. package/skills/work/SKILL.md +163 -0
  66. package/skills/work/modules/execute.md +109 -0
  67. package/skills/work/modules/prepare.md +140 -0
  68. package/skills/work/modules/review.md +164 -0
  69. package/skills/work/modules/triage.md +181 -0
  70. package/skills/work/references/ad-hoc-input-resolution.md +122 -0
  71. package/skills/work/references/error-handling.md +183 -0
  72. package/skills/work/references/execution-mode-selection.md +95 -0
  73. package/skills/work/references/id-generation.md +85 -0
  74. package/skills/work/references/interaction-mode-propagation.md +80 -0
  75. package/skills/work/references/review-checklist.md +94 -0
  76. package/skills/work/references/task-execution-rules.md +116 -0
  77. package/skills/work/references/templates/artifacts/execution-log.md +123 -0
  78. package/skills/work/references/templates/artifacts/execution-plan.md +111 -0
  79. package/skills/work/references/templates/artifacts/work-input.md +78 -0
  80. package/skills/work/references/templates/artifacts/work-manifest.md +119 -0
  81. package/skills/work/references/templates/artifacts/work-report.md +143 -0
@@ -0,0 +1,220 @@
1
+ ---
2
+ title: Task Slicing Rules
3
+ description: Reference for the Tasks phase. Defines how to decompose a plan's implementation units into Acceptance-Criterion-sized task files — one task per AC, one test per task, TDD-ordered, dependency-ordered, and registered in the index.
4
+ type: reference
5
+ version: 2.0
6
+ timestamp: "2026-08-07"
7
+ ---
8
+
9
+ # Task Slicing Rules
10
+
11
+ This file documents the rules for decomposing a finalized plan into individual task files during the **Tasks** phase (Phase 5). The model is **one task per Acceptance Criterion**, with **one test per task** (test written first, Red→Green→Refactor), ordered by dependency, saved to `docs/tasks/<plan-id>/`, and registered in `docs/tasks/<plan-id>/index.md`.
12
+
13
+ ## When to Apply
14
+
15
+ Task slicing runs after the Generate phase has produced a validated Final Plan. The Tasks phase reads the plan's Implementation Units — each of which carries one or more **Acceptance Criteria** — and produces one task file per criterion.
16
+
17
+ ## Core Slicing Heuristics
18
+
19
+ ### Rule 1: One Task Per Acceptance Criterion (Default)
20
+
21
+ Each **Acceptance Criterion** on an Implementation Unit becomes **exactly one task**. The task inherits the unit's goal, dependencies, and file paths, and gets its **own dedicated test file** in `files.test`. A task never spans more than one Acceptance Criterion.
22
+
23
+ ### Rule 2: Never Split Within an Acceptance Criterion
24
+
25
+ If a single Acceptance Criterion would need > 5 files or > 1 day of effort, do **not** slice the task partway through the criterion. Instead, **split the criterion into two or more finer sub-criteria** in the originating unit, then create one task per sub-criterion. This keeps the one-task-one-test-one-AC invariant intact.
26
+
27
+ Split criteria use sub-identifiers: `U2` → `U2a`, `U2b` (letters, not extra digits). Never renumber the original units or criteria.
28
+
29
+ ### Rule 3: No Merging Across Criteria
30
+
31
+ Do not merge tasks. A task always carries exactly one Acceptance Criterion. (Adjacent trivial units that genuinely share a single criterion are, by definition, already one criterion — they yield one task.)
32
+
33
+ ### Rule 4: Preserve Dependency Order
34
+
35
+ Tasks must be ordered so a task's dependencies are fully satisfied by earlier tasks. Never produce a task that depends on a later task.
36
+
37
+ ```
38
+ valid ordering:
39
+ T1 (no deps) → T2 (deps: T1) → T3 (deps: T1, T2)
40
+
41
+ invalid ordering:
42
+ T2 (deps: T3) → T1 (no deps) → T3 (deps: T1)
43
+ ```
44
+
45
+ ### Rule 5: Never Renumber Units or Criteria
46
+
47
+ When slicing, preserve the original `U#` identifiers from the plan. If a unit's criteria are split (Rule 2), use sub-identifiers (e.g., `U2a`, `U2b`). Never renumber — units and criteria are referenced by the plan and downstream execution.
48
+
49
+ ## Sizing Guidance by Plan Tier
50
+
51
+ | Tier | Target Tasks | Max Files Per Task | Suggested Max Effort Per Task |
52
+ | -------- | ------------ | ------------------ | ----------------------------- |
53
+ | Fast | 1–3 | 3 | Half day |
54
+ | Standard | 4–8 | 5 | 1 day |
55
+ | Deep | 8–15 | 5 | 1 day |
56
+
57
+ These are **guidance**, not hard limits. If a tier's task count would exceed the target, split criteria finer (Rule 2). If it would fall short, that is acceptable — never manufacture criteria to hit a target, and never merge criteria to reduce the count.
58
+
59
+ ## Task File Schema
60
+
61
+ Each task file is markdown with this schema (see [task.md template](templates/artifacts/task.md)):
62
+
63
+ ```yaml
64
+ ---
65
+ id: <plan-id>-T<NN>
66
+ title: "[Task title]"
67
+ plan-id: <plan-id>
68
+ unit: U<NN> | U<NN><letter>
69
+ tier: fast | standard | deep
70
+ status: not-started
71
+ priority: P0 | P1 | P2
72
+ dependencies: [<task-id>, ...]
73
+ files:
74
+ create: [path/to/file, ...]
75
+ modify: [path/to/file, ...]
76
+ test: [path/to/test] # exactly one — the test for this task's AC
77
+ estimated-effort: "<hours or days>"
78
+ timestamp: ISO-8601 timestamp
79
+ ---
80
+
81
+ # [Task Title]
82
+
83
+ ## Goal
84
+ [Inherited from the unit, scoped to this one criterion. 1-2 sentences.]
85
+
86
+ ## Acceptance Criterion
87
+ [Exactly one, single, verifiable criterion this task delivers.]
88
+
89
+ ## Steps
90
+ 1. **Red — Write the failing test:** add the test at `files.test[0]` asserting this Acceptance Criterion. Run it and confirm it fails for the right reason.
91
+ 2. **Green — Implement:** add the minimum code in `files.create`/`files.modify` to make the test pass.
92
+ 3. **Refactor:** clean up naming, duplication, and structure while keeping the test green.
93
+
94
+ ## Test Scenarios
95
+ - [Scenario]: [Input -> Expected Outcome] # the assertion(s) for this criterion (may be one)
96
+
97
+ ## Acceptance Criteria
98
+ - [ ] [This task's single Acceptance Criterion, restated as a checkable box]
99
+
100
+ ## Dependencies
101
+ - [task-id]: [why this task must complete first, or "None"]
102
+
103
+ ## Notes
104
+ [Any context, gotchas, references to learnings, or links to related tasks. Optional.]
105
+ ```
106
+
107
+ ## File-Naming Convention
108
+
109
+ Task files are named:
110
+
111
+ ```
112
+ docs/tasks/<plan-id>/T<NN>-<kebab-case-name>.md
113
+ ```
114
+
115
+ Where:
116
+
117
+ - `<plan-id>` — The plan's ID (e.g., `2026-07-03-001`)
118
+ - `<NN>` — Zero-padded 2-digit task number, matching dependency order (01, 02, ..., 10)
119
+ - `<kebab-case-name>` — Short descriptive name (e.g., `redis-client-setup`)
120
+
121
+ **Example:**
122
+
123
+ ```
124
+ docs/tasks/2026-07-03-001/
125
+ T01-redis-client-setup.md
126
+ T02-session-store-interface.md
127
+ T03-session-middleware-refactor.md
128
+ ```
129
+
130
+ ## Task ID Generation
131
+
132
+ ```
133
+ 1. Read the plan-id from the Final Plan artifact.
134
+ 2. Tasks are numbered NN in dependency order (01, 02, ...).
135
+ 3. If a criterion is split (Rule 2): use letters, not extra digits: U2a -> T02a, T02b.
136
+ 4. The `unit` field records the originating unit (or sub-ID).
137
+ ```
138
+
139
+ ## Dependency Ordering Algorithm
140
+
141
+ ```
142
+ function order_tasks(tasks):
143
+ # tasks is a list of {id, unit, dependencies, ...}
144
+ ordered = []
145
+ remaining = copy(tasks)
146
+ while remaining:
147
+ ready = [t for t in remaining if all(d in ordered for d in t.dependencies)]
148
+ if not ready:
149
+ raise CycleError("Dependency cycle detected among: " + remaining)
150
+ # Sort ready tasks by original unit number for stable ordering
151
+ ready.sort(by: unit_number)
152
+ ordered.extend(ready)
153
+ remaining.remove(ready)
154
+ return ordered
155
+ ```
156
+
157
+ **Cycle handling:** If no task is ready (all have unsatisfied dependencies), a cycle exists. Log the error, surface the involved tasks to the user, and ask whether to break the cycle manually (by removing a dependency) or abort.
158
+
159
+ ## Priority Assignment
160
+
161
+ | Priority | Criteria |
162
+ | -------- | -------------------------------------------------- |
163
+ | P0 | Blocks all other tasks (foundation, infra, schema) |
164
+ | P1 | On the critical path but not blocking |
165
+ | P2 | Can be deferred or parallelized |
166
+
167
+ Default: Phase 1 (Foundation) tasks → `P0`; Phase 2 (Integration) → `P1`; Phase 3 (Rollout)/optional → `P2`. Adjust based on risk analysis (a rollout task mitigating a HIGH risk may be `P1`).
168
+
169
+ ## Index Registration
170
+
171
+ After saving all task files, update `docs/tasks/<plan-id>/index.md`:
172
+
173
+ ```markdown
174
+ ## <plan-id> — [Plan Title]
175
+
176
+ - [ ] T01 — [Task title] (`U1`, AC: [criterion]) — `docs/tasks/<plan-id>/T01-<name>.md`
177
+ - [ ] T02 — [Task title] (`U2a`, AC: [criterion]) — `docs/tasks/<plan-id>/T02-<name>.md`
178
+ ```
179
+
180
+ Mark each task with `- [ ]` (unchecked). The Work skill will check them off as tasks complete.
181
+
182
+ ## Error Handling
183
+
184
+ | Scenario | Recovery |
185
+ | --------------------------------------- | ----------------------------------------------- |
186
+ | `docs/tasks/` directory missing | Create it; create `<plan-id>/` subdirectory |
187
+ | `docs/tasks/<plan-id>/index.md` missing | Create empty index; append the plan's section |
188
+ | Dependency cycle detected among tasks | Surface cycle to user; ask to break or abort |
189
+ | Criterion would need > 5 files / > 1 day | Split the criterion into finer sub-criteria (Rule 2) |
190
+ | Plan has no Implementation Units | Abort; ask user to re-run Generate phase |
191
+ | Task count exceeds tier target | Log warning; split criteria finer, or proceed (targets are guidance) |
192
+
193
+ ## Interaction Mode Behavior
194
+
195
+ Per [interaction-mode-propagation.md](interaction-mode-propagation.md), the Tasks phase **always asks the user**, even in Autopilot mode:
196
+
197
+ | Mode | Behavior |
198
+ | --------- | ------------------------------------------------ |
199
+ | Detailed | Show full task list + full file content; ask to save |
200
+ | Smart | Show task list summary; ask to save |
201
+ | Autopilot | Show task count; ask to save (always asks) |
202
+
203
+ The question asked:
204
+
205
+ ```
206
+ The plan has been sliced into <N> tasks (T01–T<NN>); one per Acceptance Criterion,
207
+ each with its own failing-first test.
208
+ Would you like me to create the task files in docs/tasks/<plan-id>/?
209
+ - Yes: Create all task files and update the index
210
+ - Review: Show the task list first, then ask again
211
+ - No: Skip task creation (plan is still saved for manual slicing)
212
+ ```
213
+
214
+ ## Notes
215
+
216
+ - Tasks are the handoff point to the Work skill (`work/SKILL.md`); each must be self-contained around a single Acceptance Criterion and its test — executable without re-reading the full plan.
217
+ - Every task is Test-Driven: write the failing test first, confirm Red, implement to Green, refactor while green.
218
+ - One test per task (one test per AC). Never one test asserting multiple criteria.
219
+ - Preserve the plan's `Related Learnings` in task files touching the relevant domain, so the Work phase has context.
220
+ - If the user declines task creation, the plan remains the unit of work — the user can slice manually later.
@@ -0,0 +1,134 @@
1
+ ---
2
+ title: Design Artifact
3
+ description: Template for the Design Artifact produced by the Design phase. Captures the chosen approach, implementation units, complexity assessment, and alternatives considered for downstream generation.
4
+ type: template
5
+ version: 1.1
6
+ timestamp: "2026-08-07"
7
+ ---
8
+
9
+ # Design Artifact
10
+
11
+ The product of the **Design** phase (Phase 3) is a structured design object that the **Generate** phase consumes to render the final plan. It captures the chosen approach, the implementation unit decomposition, the complexity assessment, and the alternatives considered (and why they were rejected).
12
+
13
+ When the **Design** phase completes, it produces a design block (as markdown) with this schema:
14
+
15
+ ## Schema
16
+
17
+ ```yaml
18
+ type: design
19
+ design-id: YYYY-MM-DD-NNN-design
20
+ scope-id: YYYY-MM-DD-NNN-scope # Inherited from Scope phase; traceability link
21
+ research-id: YYYY-MM-DD-NNN-research # Inherited from Research phase
22
+ status: complete
23
+ interactionMode: detailed | smart | autopilot
24
+ timestamp: ISO-8601 timestamp (e.g., 2026-07-04T14:30:00Z)
25
+ complexity: TRIVIAL | LOW | MEDIUM | HIGH | VERY_HIGH
26
+ tier_recommended: fast | standard | deep
27
+
28
+ # Design
29
+
30
+ ## Approach
31
+ [1-3 sentence summary of the chosen approach and why it fits the scoped context and research findings]
32
+
33
+ ## High-Level Technical Design
34
+ [ONE of: Mermaid diagram, pseudo-code sketch, or data-flow map — directional guidance, not implementation specification]
35
+
36
+ ## Implementation Units (Phased)
37
+
38
+ ### Phase 1: Foundation
39
+ - U1. **[Unit Name]**
40
+ - Goal: [What this unit accomplishes]
41
+ - Dependencies: None
42
+ - Files:
43
+ - Create: `path/to/file`
44
+ - Test: `path/to/test`
45
+ - Acceptance Criteria:
46
+ - [Single, verifiable criterion — each criterion later becomes exactly one task and one test]
47
+ - Test Scenarios:
48
+ - [Scenario]: [Input -> Expected Outcome]
49
+
50
+ - U2. **[Unit Name]**
51
+ - Goal: [What this unit accomplishes]
52
+ - Dependencies: U1
53
+ - Files:
54
+ - Create: `path/to/file`
55
+ - Acceptance Criteria:
56
+ - [Single, verifiable criterion]
57
+ - Test Scenarios:
58
+ - [Scenario]: [Input -> Expected Outcome]
59
+
60
+ ### Phase 2: Integration
61
+ - U3. **[Unit Name]**
62
+ - Goal: [What this unit accomplishes]
63
+ - Dependencies: U1, U2
64
+ - Files:
65
+ - Modify: `path/to/file`
66
+ - Acceptance Criteria:
67
+ - [Single, verifiable criterion]
68
+ - Test Scenarios:
69
+ - [Scenario]: [Input -> Expected Outcome]
70
+
71
+ ### Phase 3: Rollout (if applicable)
72
+ - U4. **[Unit Name]**
73
+ - Goal: [What this unit accomplishes]
74
+ - Dependencies: U3
75
+ - Files:
76
+ - Modify: `path/to/file`
77
+ - Acceptance Criteria:
78
+ - [Single, verifiable criterion]
79
+
80
+ ## Complexity Assessment
81
+ - scope_breadth: 0-3
82
+ - integration_surface: 0-3
83
+ - risk_level: LOW | MEDIUM | HIGH | CRITICAL # Inherited from Research phase
84
+ - novelty: 0-3
85
+ - data_migration: 0-3
86
+ - total: [sum]
87
+ - complexity: TRIVIAL | LOW | MEDIUM | HIGH | VERY_HIGH
88
+
89
+ ## Alternative Approaches Considered
90
+ - **[Approach Name]**: [Description] → **Rejected because:** [Rationale]
91
+ - **[Approach Name]**: [Description] → **Rejected because:** [Rationale]
92
+
93
+ ## Related Learnings
94
+ - docs/learn/XXX.md — [1-line applicability note]
95
+ - (List from docs/learn/index.md; empty list if none)
96
+
97
+ ## Learning Gaps
98
+ - [Gap name] — [Follow-up action via /learn]
99
+ ```
100
+
101
+ Also save the design artifact to `docs/plans/.design/<design-id>.md` for future reference or reuse. The `interactionMode` and `complexity` values flow into the Generate artifact for tier selection.
102
+
103
+ ## Validation Rules
104
+
105
+ - **Approach:** Required. Must reference the scoped context and research findings (not invented in isolation).
106
+ - **High-Level Technical Design:** Required. Must be ONE of: Mermaid diagram, pseudo-code sketch, or data-flow map. Directional only — not an implementation specification.
107
+ - **Implementation Units:** Required. At least one unit (U1). Each unit must have a Goal, Dependencies, Files, and **Acceptance Criteria** (at least one; each criterion becomes exactly one task and one test in the Tasks phase). Test Scenarios required for units in phases 1–2; optional for rollout-only units.
108
+ - **Complexity Assessment:** Required. All five dimensions scored 0–3; `total` must equal the sum; `complexity` must match the threshold mapping.
109
+ - **Alternative Approaches:** Required for MEDIUM+ complexity; at least 1 alternative. For HIGH/VERY_HIGH, at least 2 alternatives. For TRIVIAL/LOW, may be empty.
110
+ - **Related Learnings:** Required (may be empty list). Must reference `docs/learn/index.md`.
111
+ - **Learning Gaps:** Required (may be empty list). Inherited from Scope phase; updated if design reveals new gaps.
112
+ - **scope-id / research-id:** Required. Must match the upstream artifacts for cross-phase consistency (see [error-handling.md](../../error-handling.md)).
113
+
114
+ ## Usage in Workflow
115
+
116
+ 1. **Design Phase** produces this artifact from the Scoped Context and Research Findings
117
+ 2. **Design Phase Step 0** validates the incoming Scoped Context and Research Findings (see [error-handling.md](../../error-handling.md))
118
+ 3. **Generate Phase** reads the `complexity` and `tier_recommended` fields to select the plan tier (see [plan-tier-selection.md](../../plan-tier-selection.md))
119
+ 4. **Generate Phase** renders the final plan from the units and alternatives captured here
120
+
121
+ ## Missing Field Recovery
122
+
123
+ If the Design Artifact is incomplete at validation, use this recovery workflow:
124
+
125
+ | Field | Validation | Recovery |
126
+ | --------------------------- | -------------------------------- | -------------------------------------------------------------------------------------------------- |
127
+ | Approach | Non-empty, references context | Re-run Design phase; ask user to clarify approach |
128
+ | High-Level Technical Design | One of three formats present | Ask user to choose diagram, pseudo-code, or data-flow map |
129
+ | Implementation Units | At least U1 with Goal/Files | Re-run Design decomposition step |
130
+ | Complexity Assessment | All 5 dimensions + total + level | Recompute from units; see [design-complexity-assessment.md](../../design-complexity-assessment.md) |
131
+ | Alternative Approaches | Count matches complexity tier | Ask user for additional alternatives if below threshold |
132
+ | scope-id / research-id | Matches upstream artifacts | Reject; ask Orchestrator to re-run from the mismatched phase |
133
+
134
+ **Note:** If the Approach or Implementation Units cannot be produced, abort planning and ask the user to revisit the research phase — the scoped context may be insufficient for design.
@@ -0,0 +1,265 @@
1
+ ---
2
+ title: Final Plan Artifact
3
+ type: template
4
+ version: 1.1
5
+ timestamp: "2026-08-07"
6
+ ---
7
+
8
+ # Plan Templates
9
+
10
+ This document contains the planning template supported by the Plan skill.
11
+
12
+ ### Template
13
+
14
+ ````markdown
15
+ ---
16
+ plan-id: YYYY-MM-DD-NNN
17
+ type: plan
18
+ title: "[Plan title]"
19
+ status: complete
20
+ tier: fast | standard | deep
21
+ tier_recommended: fast | standard | deep
22
+ complexity: TRIVIAL | LOW | MEDIUM | HIGH | VERY_HIGH
23
+ risk: Low | Medium | High | Critical
24
+ scope-id: YYYY-MM-DD-NNN-scope
25
+ research-id: YYYY-MM-DD-NNN-research
26
+ design-id: YYYY-MM-DD-NNN-design
27
+ interactionMode: detailed | smart | autopilot
28
+ created: YYYY-MM-DD
29
+ updated: YYYY-MM-DD
30
+ version: 1.0
31
+ ---
32
+
33
+ ## Overview
34
+
35
+ [1-2 sentence summary: what the plan delivers and why it matters]
36
+
37
+ # [Title]
38
+
39
+ ## High-Level Technical Design
40
+
41
+ > **Note:** This is directional guidance for review, not an implementation specification to copy. The implementation phase will determine specific naming, abstractions, and code structure.
42
+
43
+ [Provide ONE of these:]
44
+
45
+ **Mermaid Diagram:**
46
+
47
+ ```mermaid
48
+ sequenceDiagram
49
+ participant A as Component A
50
+ participant B as Service B
51
+ A->>B: request
52
+ B-->>A: response
53
+ ```
54
+
55
+ **OR Pseudo-Code Sketch:**
56
+
57
+ ```
58
+ on user_action:
59
+ validate input
60
+ if valid:
61
+ process and store
62
+ trigger event
63
+ else:
64
+ return error
65
+ ```
66
+
67
+ **OR Data-Flow Map:**
68
+
69
+ ```
70
+ User Input → Validation → Processing → Storage → Event Bus → Notification
71
+ ```
72
+
73
+ ## Implementation Units (Phased)
74
+
75
+ ### Phase 1: Foundation
76
+
77
+ - U1. **[Unit Name]**
78
+ - **Goal:** [What this unit accomplishes]
79
+ - **Dependencies:** None
80
+ - **Files:**
81
+ - Create: `path/to/file`
82
+ - Test: `path/to/test`
83
+ - **Acceptance Criteria:**
84
+ - [Single, verifiable criterion — each criterion later becomes exactly one task and one test]
85
+ - **Test Scenarios:**
86
+ - [Scenario]: [Input -> Expected Outcome]
87
+
88
+ - U2. **[Unit Name]**
89
+ - **Goal:** [What this unit accomplishes]
90
+ - **Dependencies:** U1
91
+ - **Files:**
92
+ - Create: `path/to/file`
93
+ - **Acceptance Criteria:**
94
+ - [Single, verifiable criterion]
95
+ - **Test Scenarios:**
96
+ - [Scenario]: [Input -> Expected Outcome]
97
+
98
+ ### Phase 2: Integration
99
+
100
+ - U3. **[Unit Name]**
101
+ - **Goal:** [What this unit accomplishes]
102
+ - **Dependencies:** U1, U2
103
+ - **Files:**
104
+ - Modify: `path/to/file`
105
+ - **Acceptance Criteria:**
106
+ - [Single, verifiable criterion]
107
+ - **Test Scenarios:**
108
+ - [Scenario]: [Input -> Expected Outcome]
109
+
110
+ ### Phase 3: Rollout (if applicable)
111
+
112
+ - U4. **[Unit Name]**
113
+ - **Goal:** [What this unit accomplishes]
114
+ - **Dependencies:** U3
115
+ - **Files:**
116
+ - Modify: `path/to/file`
117
+ - **Acceptance Criteria:**
118
+ - [Single, verifiable criterion]
119
+
120
+ ## Alternative Approaches Considered
121
+
122
+ - **[Approach Name]**: [Description] → **Rejected because:** [Rationale for not choosing this approach]
123
+ - **[Approach Name]**: [Description] → **Rejected because:** [Rationale]
124
+
125
+ ## Risk Analysis & Mitigation
126
+
127
+ | Risk | Impact | Mitigation |
128
+ | --------------------------- | ------ | --------------------------------------------- |
129
+ | [Specific risk description] | High | [Concrete step to prevent or recover from it] |
130
+ | [Another risk] | Medium | [Mitigation strategy] |
131
+
132
+ ## Operational / Rollout Notes
133
+
134
+ [Include if applicable:]
135
+
136
+ - Feature flags: `feature.new_system` controls activation
137
+ - Monitoring: Add metrics for [key operations]
138
+ - Data migration: [Steps to migrate existing data]
139
+ - Rollback plan: [How to safely revert if issues arise]
140
+ - Performance baseline: [Expected throughput, latency targets]
141
+
142
+ ## Related Learnings
143
+
144
+ - **[Learning Title]** — `docs/learn/XXX.md` — [1-line applicability note]
145
+ - (List relevant entries from `docs/learn/index.md`; if none apply, state "No relevant learnings found")
146
+
147
+ ## Learning Gaps
148
+
149
+ - [Any gap identified during planning that should be documented after implementation via `/learn`]
150
+ ````
151
+
152
+ ### Example
153
+
154
+ ```markdown
155
+ ---
156
+ plan-id: 2026-05-01-001
157
+ type: plan
158
+ title: "Migrate Session Storage from In-Memory to Redis"
159
+ status: complete
160
+ tier: standard
161
+ tier_recommended: standard
162
+ complexity: HIGH
163
+ risk: High
164
+ scope-id: 2026-05-01-001-scope
165
+ research-id: 2026-05-01-001-research
166
+ design-id: 2026-05-01-001-design
167
+ interactionMode: smart
168
+ created: 2026-05-01
169
+ updated: 2026-05-01
170
+ version: 1.0
171
+ ---
172
+
173
+ # Migrate Session Storage from In-Memory to Redis
174
+
175
+ ## High-Level Technical Design
176
+
177
+ **Session Lifecycle:**
178
+
179
+ 1. Request arrives with session cookie (JWT)
180
+ 2. Middleware validates JWT signature and expiration
181
+ 3. Extract session ID, fetch from Redis
182
+ 4. Attach session object to request context
183
+
184
+ ## Implementation Units (Phased)
185
+
186
+ ### Phase 1: Foundation
187
+
188
+ - U1. **Redis Client and Session Store Interface**
189
+ - **Goal:** Create Redis client wrapper and session storage interface
190
+ - **Files:** `src/lib/redis-client.ts` · test: `src/lib/redis-client.test.ts`
191
+ - **Acceptance Criteria:**
192
+ - `SessionStore` interface with `get`/`save`/`delete` backs a Redis client that connects from `REDIS_URL` and retries on failure
193
+ - **Test Scenarios:** Store/retrieve session, TTL expiration, connection errors
194
+
195
+ ### Phase 2: Integration
196
+
197
+ - U2. **Session Middleware Refactor**
198
+ - **Goal:** Integrate Redis session store into middleware
199
+ - **Files:** `src/middleware/session.ts` · test: `src/middleware/session.test.ts`
200
+ - **Acceptance Criteria:**
201
+ - Middleware loads a valid JWT-backed session from Redis and rejects invalid/expired sessions
202
+ - **Test Scenarios:** Valid JWT loading, invalid JWT rejection, store errors
203
+
204
+ ## Alternative Approaches Considered
205
+
206
+ - **PostgreSQL**: Rejected — slower latency for session reads on critical path
207
+ - **Stateless JWT-Only**: Rejected — cannot revoke sessions, increases cookie size
208
+ - **Sticky Sessions**: Rejected — limits horizontal scaling, poor failover
209
+
210
+ ## Risk Analysis & Mitigation
211
+
212
+ | Risk | Mitigation |
213
+ | ----------------------- | ---------------------------------------------- |
214
+ | Redis outage | HA mode (sentinel/cluster), monitoring, alerts |
215
+ | Performance degradation | Benchmark latency <2ms p99, connection pooling |
216
+
217
+ ## Operational / Rollout Notes
218
+
219
+ - Feature flags: `feature.redis_sessions_dual_write`, `feature.redis_sessions_only`
220
+ - Gradual cutover with dual-write phase for validation
221
+ - Sessions expire naturally; no explicit data migration needed
222
+
223
+ ## Related Learnings
224
+
225
+ (List relevant entries from `docs/learn/index.md`)
226
+
227
+ ## Learning Gaps
228
+
229
+ - Document session architecture decisions and Redis failover patterns
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Overview
235
+
236
+ Plans guide complex projects through structured phases. Include technical design, phased units, alternatives analysis, risk mitigation, and operational notes.
237
+
238
+ ---
239
+
240
+ ## Template Usage Rules
241
+
242
+ ### Required Sections
243
+
244
+ Which sections a plan includes is **tier-driven**, not fixed. See [plan-tier-selection.md](../../plan-tier-selection.md) and the Generate phase ([generate.md](../../../modules/generate.md)) for the Fast/Standard/Deep section matrix (Fast omits Alternative Approaches, Operational Notes, and Learning Gaps; Standard and Deep add them). Do not render a section the tier marks optional and empty.
245
+
246
+ ### File Path Requirements
247
+
248
+ - All file paths in plans must be **repository-relative** (e.g., `src/main.js`, `docs/plans/YYYY-MM-DD-NNN-name.md`)
249
+ - Never use absolute paths (e.g., `/home/user/project/src/main.js`)
250
+ - Use backtick inline code formatting for file paths: `` `path/to/file` ``
251
+
252
+ ### Learnings Embedding Rules
253
+
254
+ - Every plan **must** include a `## Related Learnings` section
255
+ - Scan `docs/learn/index.md` for relevant entries
256
+ - Include file path and a 1-line applicability rationale per learning
257
+ - If no relevant learnings exist, state: "No relevant learnings found"
258
+ - Add a `## Learning Gaps` section for areas where knowledge is missing but needed
259
+ - Learning gaps should include a follow-up action to document via `/learn`
260
+
261
+ ### Naming Convention
262
+
263
+ - Plan files: `docs/plans/YYYY-MM-DD-NNN-<kebab-case-name>.md`
264
+ - U-ID format: `U1`, `U2`, ... `UX` (never renumber)
265
+ - Frontmatter required fields: see the Final Plan frontmatter in the template above and [error-handling.md](../../error-handling.md) — `plan-id`, `type`, `title`, `status`, `tier`, `tier_recommended`, `complexity`, `risk`, `scope-id`, `research-id`, `design-id`, `interactionMode`, `created`, `updated`, `version`
@@ -0,0 +1,50 @@
1
+ ---
2
+ title: Research Findings Artifact
3
+ description: Template for the Research Findings Artifact produced by the Research phase. Captures research findings, insights, and relevant information for downstream phases.
4
+ type: template
5
+ version: 1.1
6
+ timestamp: "2026-08-07"
7
+ ---
8
+
9
+ # Output: Research Findings
10
+
11
+ After completing the workflow, produce a research findings block (in memory or as markdown):
12
+
13
+ ```yaml
14
+ type: research
15
+ research-id: YYYY-MM-DD-NNN-research
16
+ scope-id: YYYY-MM-DD-NNN-scope # Inherited from Scope phase; traceability link
17
+ status: complete
18
+ interactionMode: detailed | smart | autopilot
19
+ timestamp: ISO-8601 timestamp (e.g., 2026-07-04T14:30:00Z)
20
+
21
+ # Research Findings
22
+
23
+ ## Patterns Found
24
+ - `path/to/pattern/file` — [pattern description]
25
+
26
+ ## High-Risk Detection
27
+ - Detected areas: [list]
28
+ - Risk Level: CRITICAL | HIGH | MEDIUM | LOW
29
+ - External Research Recommended: YES | NO
30
+
31
+ ## Tech Stack
32
+ - [Framework]: [version]
33
+ - [Language]: [version]
34
+ - [Database]: [version]
35
+ - [Key libraries]: [versions]
36
+
37
+ ## External Research
38
+ - Needed: YES | NO
39
+ - Guidance: [librarian query or web search suggestion]
40
+ - Status: completed | skipped | declined
41
+
42
+ ## Technical Constraints
43
+ - [Constraint 1]
44
+ - [Constraint 2]
45
+
46
+ ## Findings Summary
47
+ [2-3 sentence overview of all findings]
48
+ ```
49
+
50
+ This findings object is passed to `design` (Phase 3) for the design phase.