flow-cc 0.4.2 → 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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.5.0] - 2026-02-13
9
+
10
+ ### Added
11
+ - Multi-PRD support — PRDs now live at `.planning/prds/{version-slug}.md` instead of a single root `PRD.md`
12
+ - 5-step PRD resolution logic across all skills: user argument → STATE.md Active PRD → slug derivation → legacy fallback → not found
13
+ - `**Milestone:**` header field in PRDs for ROADMAP correlation
14
+ - `Active PRD` field in STATE.md tracking the current milestone's PRD path
15
+ - Milestone Targeting in `/flow:spec` — pass a milestone name to pre-spec future milestones in parallel
16
+ - PRD inventory display in `/flow:status` showing active/ready tags per PRD file
17
+ - `/flow:setup` now creates `.planning/prds/` directory during project scaffolding
18
+
19
+ ### Changed
20
+ - `/flow:spec` writes PRDs to `.planning/prds/{version-slug}.md` (was root `PRD.md`)
21
+ - `/flow:go` resolves PRDs via 5-step resolution instead of hardcoded `PRD.md`
22
+ - `/flow:done` archives PRDs from `.planning/prds/` to `.planning/archive/PRD-{slug}.md`
23
+ - `/flow:status` lists all PRDs in `.planning/prds/` with active/ready status
24
+ - `/flow:task` reads active PRD from `.planning/prds/` via STATE.md
25
+ - All templates and docs updated to reflect new PRD paths
26
+ - Legacy root `PRD.md` still consumed transparently — migration happens organically
27
+
28
+ ## [0.4.3] - 2026-02-12
29
+
30
+ ### Changed
31
+ - Lessons system refactored to 2-stage with hard caps — `tasks/lessons.md` max 10 active one-liners, `CLAUDE.md ## Learned Rules` max 15 permanent one-liners
32
+ - Replaced verbose PATTERN/CAUSE/FIX/RULE format with compact one-liner format: `- **[topic]** The rule`
33
+ - Removed 4-stage lifecycle (Capture → Refine → Promote Global → Promote CLAUDE.md), replaced with 2-stage (Capture → Promote to CLAUDE.md when full)
34
+ - Removed all references to `~/.claude/lessons.md` global lessons file
35
+ - `/flow:done` now enforces cap: promotes most battle-tested lesson to CLAUDE.md when lessons.md hits 10
36
+ - `/flow:status` shows `[N]/10 active` instead of `[N] rules`
37
+ - Agent prompts section renamed from "Anti-Patterns to Avoid" to "Lessons (Rules to Follow)"
38
+ - CLAUDE.md template now includes `## Learned Rules` placeholder section
39
+ - Updated DESIGN.md, README.md, and all skill files to reflect 2-stage system
40
+
8
41
  ## [0.4.2] - 2026-02-11
9
42
 
10
43
  ### Fixed
package/README.md CHANGED
@@ -26,7 +26,7 @@ Claude Code is powerful but unstructured. Without a system, you lose context bet
26
26
  Flow fixes this by giving Claude Code a **memory system and execution framework**:
27
27
 
28
28
  - **Spec interviews** extract decisions upfront so agents execute instead of guessing
29
- - **PRDs become execution contracts** that agent teams follow phase-by-phase
29
+ - **PRDs become per-milestone execution contracts** in `.planning/prds/` spec future milestones in parallel
30
30
  - **Session handoffs** preserve context across fresh sessions — no more "where was I?"
31
31
  - **Lessons compound** — mistakes get captured, refined, and promoted into permanent rules
32
32
 
@@ -42,7 +42,7 @@ Flow fixes this by giving Claude Code a **memory system and execution framework*
42
42
  ```
43
43
 
44
44
  1. **`/flow:setup`** — Scaffolds your project with planning docs and execution rules
45
- 2. **`/flow:spec`** — Interviews you, then writes an executable PRD with phases, acceptance criteria, and agent-team structure
45
+ 2. **`/flow:spec`** — Interviews you, then writes an executable PRD to `.planning/prds/` with phases, acceptance criteria, and agent-team structure. Can pre-spec future milestones.
46
46
  3. **`/flow:go`** — Spawns parallel agent teams to build the next phase, verifies, commits
47
47
  4. **`/flow:done`** — Updates docs, captures lessons, generates a handoff prompt so the next session starts instantly
48
48
 
@@ -55,7 +55,7 @@ Run `/flow:go` repeatedly until all phases are done, then `/flow:done` to wrap u
55
55
  | Command | When to use |
56
56
  |---|---|
57
57
  | `/flow:setup` | Once per project — creates `.planning/`, CLAUDE.md, templates |
58
- | `/flow:spec` | Once per milestone — interview that produces the PRD |
58
+ | `/flow:spec` | Once per milestone — interview that produces the PRD. Can pre-spec future milestones |
59
59
  | `/flow:go` | Once per phase — executes the next phase with agent teams |
60
60
  | `/flow:done` | End of session — updates docs, generates handoff prompt |
61
61
 
@@ -107,25 +107,23 @@ Every Flow project gets this structure via `/flow:setup`:
107
107
  ```
108
108
  your-project/
109
109
  ├── CLAUDE.md # Project-specific execution rules
110
- ├── PRD.md # Current milestone spec (created by /flow:spec)
111
110
  ├── .planning/
112
111
  │ ├── STATE.md # Session GPS — current status, next actions
113
112
  │ ├── ROADMAP.md # Milestone phases and progress
113
+ │ ├── prds/ # Per-milestone PRD specs (one file per milestone)
114
114
  │ └── archive/ # Completed milestones and old PRDs
115
115
  └── tasks/
116
- └── lessons.md # Mistake catalogrefined into permanent rules
116
+ └── lessons.md # Active lessons (max 10 one-liners) promoted to CLAUDE.md
117
117
  ```
118
118
 
119
119
  ## The Lessons System
120
120
 
121
121
  Flow's knowledge compounding is what makes it get better over time:
122
122
 
123
- 1. **Capture** — Mistake happens, lesson written to `tasks/lessons.md`
124
- 2. **Refine** — Each `/flow:done` merges duplicates, sharpens rules, removes obvious ones
125
- 3. **Promote** — Universal lessons move to `~/.claude/lessons.md` (all projects)
126
- 4. **Permanence** — Recurring patterns become rules in `CLAUDE.md`
123
+ 1. **Capture** — Mistake happens, one-liner written to `tasks/lessons.md` (max 10 active)
124
+ 2. **Promote** — When full, most battle-tested lesson moves to `CLAUDE.md ## Learned Rules` (max 15 permanent)
127
125
 
128
- The goal: fewer, sharper lessons over time not an ever-growing list.
126
+ Hard caps prevent context bloat. Total worst-case: ~30 lines of lessons context per session.
129
127
 
130
128
  ## Compatible With GSD
131
129
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.5.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flow-cc",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Structured workflow system for Claude Code — spec interviews, agent-team execution, session handoffs, compounding knowledge",
5
5
  "author": "Troy Hoffman",
6
6
  "license": "MIT",
@@ -17,9 +17,9 @@ You are executing the `/flow:done` skill. This finalizes the current session by
17
17
  Read these files (in parallel where possible):
18
18
  - `.planning/STATE.md` — current state
19
19
  - `.planning/ROADMAP.md` — milestone/phase progress
20
- - `tasks/lessons.md` — existing lessons
20
+ - `tasks/lessons.md` — active lessons (max 10)
21
21
  - `CLAUDE.md` — project rules
22
- - `PRD.md` current spec (if exists)
22
+ - Active PRD from `.planning/prds/` (resolve via STATE.md "Active PRD" field, or fall back to legacy `PRD.md` at root)
23
23
 
24
24
  Also gather:
25
25
  - Run `git log --oneline -20` to see commits this session
@@ -38,6 +38,7 @@ Structure:
38
38
  - **Milestone:** [name] (vX)
39
39
  - **Phase:** [current phase status]
40
40
  - **Branch:** [current branch]
41
+ - **Active PRD:** [path to active PRD, or "None" if milestone complete]
41
42
  - **Last Session:** [today's date]
42
43
 
43
44
  ## Milestone Progress
@@ -69,7 +70,8 @@ Structure:
69
70
  - Create `.planning/archive/` if it doesn't already exist (use `mkdir -p` or equivalent)
70
71
  - Move milestone phase details to `.planning/archive/milestones-vX.md`
71
72
  - Keep only the summary row in the ROADMAP milestone table
72
- - Move `PRD.md` to `.planning/archive/PRD-vX.md`
73
+ - Archive the milestone's PRD: move `.planning/prds/{slug}.md` to `.planning/archive/PRD-{slug}.md`. If using legacy root `PRD.md`, move it to `.planning/archive/PRD-vX.md` instead.
74
+ - Clear STATE.md "Active PRD" field (set to "None")
73
75
  - Mark the milestone as "Complete" in the ROADMAP table
74
76
  - **Milestone transition:** Check ROADMAP.md for the NEXT milestone with status "Planned":
75
77
  - **If a next milestone exists:** Update its status from "Planned" to "Pending — needs `/flow:spec`". Update STATE.md current milestone to point to the new milestone.
@@ -83,9 +85,14 @@ Structure:
83
85
  - "No new lessons"
84
86
  - "Yes, let me add some" (user types them)
85
87
  - "Use your suggestions" (if you auto-suggested any)
86
- - Add new lessons in PATTERN/CAUSE/FIX/RULE format
87
- - **Refine existing lessons:** merge duplicates, sharpen vague rules, delete obvious ones
88
- - **Promote check:** For lessons that seem universal (not project-specific), ask: "This lesson seems universal. Promote to global lessons (~/.claude/lessons.md)?"
88
+ - Add new lessons as one-liners: `- **[topic]** The rule`
89
+ - **Hard cap enforcement (max 10 active):**
90
+ - If lessons.md already has 10 items and a new one needs to be added:
91
+ 1. Identify the most battle-tested/internalized lesson
92
+ 2. Promote it to `CLAUDE.md ## Learned Rules` section
93
+ 3. Delete it from lessons.md
94
+ 4. Add the new lesson
95
+ - If `CLAUDE.md ## Learned Rules` hits 15 items, delete the most obvious/internalized rule to make room
89
96
 
90
97
  ### 5. Commit Doc Updates
91
98
 
@@ -99,7 +106,7 @@ Determine the next action and generate a copyable handoff prompt:
99
106
 
100
107
  - If next phase exists in PRD:
101
108
  ```
102
- Phase [N]: [Name] — [short description]. Read STATE.md, ROADMAP.md, and PRD.md (US-X).
109
+ Phase [N]: [Name] — [short description]. Read STATE.md, ROADMAP.md, and .planning/prds/{slug}.md (US-X).
103
110
  [One sentence of context]. [One sentence of what NOT to do if relevant].
104
111
  ```
105
112
  - If milestone is complete AND a next milestone was transitioned to (from Step 3):
@@ -119,7 +126,7 @@ Print the handoff prompt in a fenced code block so the user can copy it.
119
126
  Session complete.
120
127
  - STATE.md: updated
121
128
  - ROADMAP.md: [N] phases marked complete
122
- - lessons.md: [N] lessons added, [N] refined
129
+ - lessons.md: [N]/10 active, [N] promoted to CLAUDE.md
123
130
  - Committed: [SHA]
124
131
 
125
132
  Handoff prompt:
package/skills/flow-go.md CHANGED
@@ -10,24 +10,36 @@ You are executing the `/flow:go` skill. This reads the PRD, identifies the next
10
10
 
11
11
  **Core principle:** The PRD is the execution contract. You execute what it specifies. Do not freelance.
12
12
 
13
- **Plan mode warning:** Do NOT use this skill with plan mode enabled. `/flow:go` is execution — plan mode's read-only constraint prevents it from creating files, running agents, and committing work. The PRD IS your plan; run `/flow:go` in normal mode.
13
+ **Plan mode warning:** Do NOT use this skill with plan mode enabled. `/flow:go` is execution — plan mode's read-only constraint prevents it from creating files, running agents, and committing work. The PRD is your plan; run `/flow:go` in normal mode.
14
14
 
15
15
  ## Step 1 — Orient
16
16
 
17
17
  Read these files (in parallel):
18
18
  - `.planning/STATE.md` — current position
19
19
  - `.planning/ROADMAP.md` — phase progress
20
- - `PRD.md` the execution spec
21
- - `tasks/lessons.md` — anti-patterns to avoid
20
+ - The active PRD (see PRD Resolution below)
21
+ - `tasks/lessons.md` — active lessons (max 10 one-liners)
22
22
  - `CLAUDE.md` — execution rules and verification commands
23
23
 
24
+ ### PRD Resolution
25
+
26
+ Resolve the PRD file to use, in this order:
27
+
28
+ 1. **User argument:** If the user passed an argument to `/flow:go` (e.g., `/flow:go v3-payments`), match it against files in `.planning/prds/` (by slug or milestone name from the `**Milestone:**` header field).
29
+ 2. **STATE.md Active PRD:** Read the "Active PRD" field from STATE.md's Current Position section. If it points to a valid file, use it.
30
+ 3. **Slug derivation:** Derive a slug from STATE.md's current milestone name — version-prefix + lowercase name, spaces/special chars → hyphens, collapse consecutive hyphens (e.g., "v2: Dashboard Analytics" → `v2-dashboard-analytics`). Check `.planning/prds/{slug}.md`.
31
+ 4. **Legacy fallback:** If `.planning/prds/` is empty or missing but `PRD.md` exists at the project root, use it. Print: "Using legacy PRD.md at project root. Future specs will use `.planning/prds/`."
32
+ 5. **Not found:** "No PRD found for [current milestone name]. Available PRDs: [list files in `.planning/prds/`]. Run `/flow:spec` first."
33
+
34
+ **Milestone match check:** After resolving the PRD, read its `**Milestone:**` header field. If it doesn't match STATE.md's current milestone, warn: "PRD milestone ([PRD milestone]) doesn't match current milestone ([STATE milestone]). Continuing, but verify you're executing the right spec."
35
+
24
36
  **Identify the next phase:** Find the first phase in ROADMAP.md with status "Pending" or the first unstarted phase in the PRD.
25
37
 
26
38
  ## Step 2 — Pre-flight Checks
27
39
 
28
40
  Run these checks before executing. If any fail, stop and tell the user what to do:
29
41
 
30
- 1. **PRD exists?** If `PRD.md` is missing: "No PRD found. Run `/flow:spec` first."
42
+ 1. **PRD resolved?** If PRD Resolution (above) reached step 5 (not found): stop with the "No PRD found" message and available PRD list.
31
43
  2. **Phase detailed enough?** The phase section in the PRD must have:
32
44
  - Wave structure with agent assignments
33
45
  - Explicit file lists per agent
@@ -76,7 +88,7 @@ so agents have it in their context without needing to search.]
76
88
  - Stage only your files when committing (never `git add .` or `git add -A`)
77
89
  - If you need output from another agent that isn't available yet, create a temporary stub and continue. Delete the stub before your final commit.
78
90
 
79
- ## Anti-Patterns to Avoid
91
+ ## Lessons (Rules to Follow)
80
92
  [Relevant lessons from tasks/lessons.md — filter to lessons that apply to this agent's work]
81
93
  ```
82
94
 
@@ -146,6 +158,7 @@ Create an atomic commit for this phase:
146
158
  - Files created/modified (count + key names)
147
159
  - Commit SHA
148
160
  - Phase completion note
161
+ - Keep "Active PRD" field pointing to the resolved PRD path
149
162
 
150
163
  **ROADMAP.md:** Mark this phase as "Complete ([today's date])"
151
164
 
@@ -24,6 +24,8 @@ Flow is 6 commands that turn your specs into shipped code through agent teams. E
24
24
  full roadmap) | auto-transitions to |
25
25
  +---- next planned milestone ------+
26
26
 
27
+ /flow:spec ← can pre-spec future milestones (each gets its own PRD in .planning/prds/)
28
+
27
29
  /flow:milestone ← add milestones to roadmap anytime
28
30
  /flow:task ← standalone path for bug fixes, cleanup, small features (no PRD needed)
29
31
  ```
@@ -50,8 +52,9 @@ Flow is 6 commands that turn your specs into shipped code through agent teams. E
50
52
  **`/flow:spec`** — Run once per milestone
51
53
  - Interviews you about scope, user stories, technical design, trade-offs, and phasing
52
54
  - You can say "done" or "that's enough" anytime to cut the interview short
53
- - Produces `PRD.md` — the execution contract with wave-based phases, file lists, and acceptance criteria
54
- - Updates ROADMAP and STATE to reflect the plan
55
+ - Produces `.planning/prds/{milestone}.md` — the execution contract with wave-based phases, file lists, and acceptance criteria
56
+ - Can pre-spec future milestones in parallel terminal windows (each milestone gets its own PRD file)
57
+ - Updates ROADMAP and STATE to reflect the plan (for the current milestone; future milestone specs skip STATE updates)
55
58
 
56
59
  **`/flow:go`** — Run once per phase (this is where the work happens)
57
60
  - Reads the PRD, finds the next pending phase
@@ -64,7 +67,7 @@ Flow is 6 commands that turn your specs into shipped code through agent teams. E
64
67
  - Replaces STATE.md with current status
65
68
  - Updates ROADMAP.md with phase completions
66
69
  - Auto-transitions to the next planned milestone when the current one completes
67
- - Asks about lessons, refines existing ones
70
+ - Captures lessons as one-liners, enforces 10-item cap (promotes to CLAUDE.md when full)
68
71
  - Commits doc updates
69
72
  - Generates a handoff prompt you copy-paste to start the next session
70
73
 
@@ -81,6 +81,7 @@ Create these 5 files (create directories as needed):
81
81
  - **Milestone:** [first milestone name] (v1)
82
82
  - **Phase:** Not started — run `/flow:spec` to build PRD
83
83
  - **Branch:** main
84
+ - **Active PRD:** None — run `/flow:spec` to create
84
85
  - **Last Session:** [today's date]
85
86
 
86
87
  ## Milestone Progress
@@ -145,10 +146,10 @@ Note: The first milestone gets status "Pending — needs `/flow:spec`". All subs
145
146
  1. Read this file (CLAUDE.md)
146
147
  2. Read `.planning/STATE.md` for current status
147
148
  3. Read `.planning/ROADMAP.md` for milestone progress
148
- 4. Read `PRD.md` for current execution spec (if one exists)
149
+ 4. Read active PRD from `.planning/prds/` for current milestone (if one exists)
149
150
 
150
151
  ## Execution Rules
151
- - **Plan before building.** For non-trivial work, read the PRD phase section before touching anything.
152
+ - **Plan before building.** For non-trivial work, read the milestone's PRD in `.planning/prds/` before touching anything.
152
153
  - **Delegate immediately.** If a task touches 3+ files, spawn an agent team within your first 2 tool calls.
153
154
  - **Verify everything.** Run [verification commands from user] after agent work lands. Nothing is done until proven.
154
155
 
@@ -169,20 +170,15 @@ Note: The first milestone gets status "Pending — needs `/flow:spec`". All subs
169
170
 
170
171
  **`tasks/lessons.md`:**
171
172
  ```
172
- # [Project Name] — Lessons Learned
173
+ # [Project Name] — Lessons (max 10 active)
173
174
 
174
- Format: PATTERN CAUSE → FIX → RULE
175
+ One-liner format: `- **[topic]** The rule`
175
176
 
176
- ## Execution Patterns
177
- <!-- Lessons about workflow, delegation, verification -->
178
-
179
- ## Domain Knowledge
180
- <!-- Lessons about business logic, data models, user behavior -->
181
-
182
- ## Technical Patterns
183
- <!-- Lessons about the tech stack, libraries, deployment -->
177
+ <!-- EXAMPLE: - **[agent context]** Always tell agents exactly which functions/lines to read — never "read file.ts", say "read file.ts lines 50-120" -->
184
178
  ```
185
179
 
180
+ **`.planning/prds/`** — Create this empty directory (use `mkdir -p` via Bash). PRDs are stored here per-milestone.
181
+
186
182
  **`.planning/archive/`** — Create this empty directory (use `mkdir -p` via Bash).
187
183
 
188
184
  ## Step 4: Print Completion Message
@@ -192,7 +188,8 @@ Project initialized:
192
188
  - CLAUDE.md — project execution rules
193
189
  - .planning/STATE.md — session GPS
194
190
  - .planning/ROADMAP.md — milestone tracker
195
- - tasks/lessons.md — anti-pattern catalog
191
+ - tasks/lessons.md — active lessons (max 10)
192
+ - .planning/prds/ — per-milestone PRD specs
196
193
  - .planning/archive/ — for completed milestones
197
194
 
198
195
  Run `/flow:spec` to plan your first milestone.
@@ -10,13 +10,16 @@ You are executing the `/flow:spec` skill. This is the KEYSTONE skill of the flow
10
10
 
11
11
  **Interview mode:** Always thorough by default. The user can say "done", "finalize", "that's enough", or "move on" at ANY time to wrap up early. Respect their signal and finalize with whatever depth has been achieved.
12
12
 
13
- **Plan mode warning:** Do NOT use this skill with plan mode enabled. Plan mode's read-only constraint prevents PRD.md from being written during the interview. `/flow:spec` IS the planning phase — plan mode on top of it is redundant and breaks the workflow.
13
+ **Plan mode warning:** Do NOT use this skill with plan mode enabled. Plan mode's read-only constraint prevents the PRD from being written during the interview. `/flow:spec` IS the planning phase — plan mode on top of it is redundant and breaks the workflow.
14
14
 
15
15
  ## Phase 1 — Context Gathering (automatic, no user input needed)
16
16
 
17
17
  1. Read `.planning/STATE.md` and `.planning/ROADMAP.md` — understand current milestone and what's done
18
18
  2. Read `CLAUDE.md` — understand project rules and tech stack
19
- 3. Read `PRD.md` if it exists — check for existing spec to build on
19
+ 3. Check for existing PRD:
20
+ - List `.planning/prds/` directory (if it exists) for existing PRD files
21
+ - Also check for legacy `PRD.md` at project root (backward compat)
22
+ - If a PRD exists for the target milestone, note it for resume/extend flow
20
23
  4. **Codebase scan** (brownfield projects) — spawn **3 parallel Explore subagents** via the Task tool to scan the codebase without consuming main context:
21
24
 
22
25
  | Agent | Focus | Looks For |
@@ -34,6 +37,25 @@ You are executing the `/flow:spec` skill. This is the KEYSTONE skill of the flow
34
37
 
35
38
  5. **Assemble summaries:** Collect the 3 agent summaries into a brief context block (~45 lines total). Print to user: "Here's what I found in the codebase: [key components, patterns, data layer]. Starting the spec interview."
36
39
 
40
+ ## Milestone Targeting
41
+
42
+ Before starting the interview, determine which milestone this PRD targets:
43
+
44
+ 1. **If the user passed an argument** (e.g., `/flow:spec v3: Payments`) — match against ROADMAP.md milestones. If no match, print available milestones and ask which one.
45
+
46
+ 2. **If no argument** — default to the current milestone from STATE.md "Milestone" field.
47
+
48
+ 3. **Derive the PRD slug:** Take the milestone's version prefix and name (e.g., "v3: Dashboard Analytics"), lowercase it, replace spaces and special characters with hyphens, collapse consecutive hyphens. Result: `v3-dashboard-analytics`. The PRD path is `.planning/prds/{slug}.md`.
49
+
50
+ 4. **Check for existing PRD at that path:**
51
+ - **If PRD exists** → Use AskUserQuestion: "A PRD already exists for this milestone at `.planning/prds/{slug}.md`. What would you like to do?"
52
+ - "Resume editing" — load the existing PRD and continue the interview from where it left off
53
+ - "Start fresh" — delete the existing PRD and start a new interview
54
+ - "Pick a different milestone" — show available milestones
55
+ - **If no PRD exists** → Proceed with a fresh interview
56
+
57
+ 5. **Future milestone detection:** If the target milestone is NOT the current milestone in STATE.md, note this — the PRD will be written but STATE.md's "Active PRD" field will NOT be updated (it stays pointing at the current milestone's PRD). Print: "Speccing future milestone [name]. STATE.md will not be updated — this PRD will be available when you reach this milestone."
58
+
37
59
  ## Phase 2 — Adaptive Interview
38
60
 
39
61
  ### CRITICAL RULES (follow these exactly)
@@ -50,7 +72,7 @@ You are executing the `/flow:spec` skill. This is the KEYSTONE skill of the flow
50
72
 
51
73
  3. **CONTINUE UNTIL THE USER SAYS STOP.** Do NOT stop after covering all 7 areas once. After each answer, immediately ask the next question. Keep going deeper until the user says "done", "finalize", "that's enough", "ship it", or similar. A thorough interview is 15-30 questions, not 5.
52
74
 
53
- 4. **MAINTAIN A RUNNING DRAFT.** Every 2-3 questions, update PRD.md with what you've learned so far. Print: "Updated PRD draft — added [brief summary]." The user should see the spec taking shape in real-time, not all at the end.
75
+ 4. **MAINTAIN A RUNNING DRAFT.** Every 2-3 questions, update `.planning/prds/{slug}.md` with what you've learned so far (create `.planning/prds/` directory if it doesn't exist). Print: "Updated PRD draft — added [brief summary]." The user should see the spec taking shape in real-time, not all at the end.
54
76
 
55
77
  5. **BE ADAPTIVE.** Base your next question on the previous answer. If the user reveals something surprising, probe deeper on THAT — don't robotically move to the next category. The best specs come from following interesting threads.
56
78
 
@@ -140,11 +162,12 @@ If any check fails, print what's missing and use AskUserQuestion:
140
162
 
141
163
  ### Write PRD
142
164
 
143
- Write `PRD.md` to the project root with this EXACT structure:
165
+ Write the PRD to `.planning/prds/{slug}.md` (create `.planning/prds/` directory first if it doesn't exist) with this EXACT structure:
144
166
 
145
167
  ```markdown
146
168
  # [Milestone Name] — Specification
147
169
 
170
+ **Milestone:** [full milestone name, e.g., "v3: Dashboard Analytics"]
148
171
  **Status:** Ready for execution
149
172
  **Branch:** feat/[milestone-slug]
150
173
  **Created:** [today's date]
@@ -222,7 +245,7 @@ Write `PRD.md` to the project root with this EXACT structure:
222
245
  2. Verify after every phase: [verification commands from CLAUDE.md]
223
246
  3. Atomic commits after each agent's work lands
224
247
  4. Never `git add .` — stage specific files only
225
- 5. Read `tasks/lessons.md` before spawning agents — inject relevant anti-patterns
248
+ 5. Read `tasks/lessons.md` before spawning agents — inject relevant lessons into agent prompts
226
249
 
227
250
  ## Definition of Done
228
251
  - [ ] All user story acceptance criteria pass
@@ -233,21 +256,25 @@ Write `PRD.md` to the project root with this EXACT structure:
233
256
 
234
257
  ## Phase 4 — Post-PRD Updates
235
258
 
236
- After writing PRD.md:
259
+ After writing the PRD to `.planning/prds/{slug}.md`:
237
260
 
238
261
  1. **Update ROADMAP.md:** Add phase breakdown under the current milestone section. Each phase gets a row in the progress table with status "Pending".
239
262
 
240
- 2. **Update STATE.md:** Set current phase to "Phase 1 — ready for `/flow:go`". Update "Next Actions" to reference the first phase.
263
+ 2. **Update STATE.md** (current milestone only):
264
+ - Set current phase to "Phase 1 — ready for `/flow:go`"
265
+ - Set "Active PRD" to `.planning/prds/{slug}.md`
266
+ - Update "Next Actions" to reference the first phase
267
+ - **Skip this step if speccing a future milestone** — STATE.md stays pointing at the current milestone. Print: "PRD written to `.planning/prds/{slug}.md`. STATE.md not updated (future milestone)."
241
268
 
242
269
  3. **Generate Phase 1 handoff prompt:**
243
270
  ```
244
- Phase 1: [Name] — [short description]. Read STATE.md, ROADMAP.md, and PRD.md.
271
+ Phase 1: [Name] — [short description]. Read STATE.md, ROADMAP.md, and .planning/prds/{slug}.md.
245
272
  [One sentence of context about what Phase 1 builds].
246
273
  ```
247
274
 
248
275
  4. Print the handoff prompt in a fenced code block.
249
276
 
250
- 5. Print: "PRD ready. Run `/flow:go` to execute Phase 1, or review PRD.md first."
277
+ 5. Print: "PRD ready at `.planning/prds/{slug}.md`. Run `/flow:go` to execute Phase 1, or review the PRD first."
251
278
 
252
279
  ## Quality Gates
253
280
 
@@ -256,6 +283,7 @@ Before finalizing, self-check the PRD:
256
283
  - [ ] Every user story has checkbox acceptance criteria that are testable
257
284
  - [ ] Every phase has verification commands
258
285
  - [ ] "Key Existing Code" section references actual files/functions found in the codebase scan
286
+ - [ ] PRD is written to `.planning/prds/{slug}.md`, NOT to root `PRD.md`
259
287
  - [ ] No phase has more than 5 agents in a single wave (too many = coordination overhead)
260
288
  - [ ] Sacred code section is populated (even if empty with "None identified")
261
289
 
@@ -13,7 +13,9 @@ You are executing the `/flow:status` skill. This is a READ-ONLY operation. Do NO
13
13
  Read ALL of the following in parallel:
14
14
  - `.planning/STATE.md`
15
15
  - `.planning/ROADMAP.md`
16
- - `PRD.md` (if exists)
16
+ - List `.planning/prds/` directory for all PRD files (if directory exists)
17
+ - Also check for legacy `PRD.md` at project root (backward compat)
18
+ - Read the active PRD (from STATE.md "Active PRD" field) to get phase details
17
19
  - Count lessons in `tasks/lessons.md` (if exists)
18
20
 
19
21
  IF both STATE.md AND ROADMAP.md are missing:
@@ -36,12 +38,12 @@ RULE: Determine the next action from ROADMAP.md phase statuses, NOT from STATE.m
36
38
 
37
39
  Use this explicit decision tree:
38
40
 
39
- **IF pending phases exist in ROADMAP AND PRD.md exists:**
41
+ **IF pending phases exist in ROADMAP AND a PRD exists for the current milestone (in `.planning/prds/` or legacy root):**
40
42
  → Primary: `/flow:go` to execute Phase [N]: [name]
41
43
  → Alt: `/flow:done` if wrapping up the session
42
44
  → Alt: `/flow:task` for quick fixes or cleanup (no PRD needed)
43
45
 
44
- **IF pending phases exist in ROADMAP BUT PRD.md is missing:**
46
+ **IF pending phases exist in ROADMAP BUT no PRD exists for the current milestone:**
45
47
  → Primary: `/flow:spec` to create the execution plan
46
48
  → Alt: `/flow:task` for quick fixes or cleanup (no PRD needed)
47
49
 
@@ -64,11 +66,20 @@ Use this explicit decision tree:
64
66
  Milestone: [name] ([X/Y] phases complete)
65
67
  Last session: [date] — [what was built]
66
68
  Next: Phase [N] — [name] ([short description])
67
- Lessons: [N] rules
69
+ Lessons: [N]/10 active
70
+
71
+ PRDs:
72
+ * {slug}.md (active — current milestone)
73
+ [For each additional PRD in .planning/prds/:]
74
+ * {slug}.md (ready — future milestone)
75
+ [If legacy PRD.md at root:]
76
+ * PRD.md (legacy — at project root)
68
77
 
69
78
  [routing recommendations from Step 3]
70
79
  ```
71
80
 
81
+ The PRDs section shows all PRD files found. Mark the one matching STATE.md's "Active PRD" as "(active — current milestone)". Mark others as "(ready — future milestone)". If a legacy root `PRD.md` exists, show it as "(legacy — at project root)". Omit the PRDs section entirely if no PRD files exist anywhere.
82
+
72
83
  Adapt the block based on available information. If STATE.md is missing, omit "Last session". If ROADMAP.md is missing, omit phase counts and say "Run /flow:setup to set up tracking."
73
84
 
74
85
  ## Step 5 — No File Writes
@@ -20,7 +20,7 @@ Read ALL of the following in parallel. If any file is missing, skip it gracefull
20
20
  - `.planning/ROADMAP.md`
21
21
  - `CLAUDE.md`
22
22
  - `tasks/lessons.md`
23
- - `PRD.md`
23
+ - Active PRD from `.planning/prds/` (if STATE.md "Active PRD" field exists, use that path; else check for legacy `PRD.md` at root)
24
24
 
25
25
  If no `.planning/` directory exists, print:
26
26
  > No `.planning/` directory found — running standalone. Task will still be executed, verified, and committed.
@@ -98,15 +98,16 @@ IF `.planning/STATE.md` exists:
98
98
 
99
99
  RULES:
100
100
  - DO NOT update ROADMAP.md — tasks are not milestone phases.
101
- - DO NOT update PRD.md — tasks are not part of the spec.
101
+ - DO NOT update any PRD files in `.planning/prds/` — tasks are not part of the spec.
102
102
  - DO NOT create `.planning/` if it doesn't exist.
103
103
 
104
104
  Quick lessons prompt via AskUserQuestion:
105
105
  - "Any lessons from this task worth capturing?"
106
106
  - Option 1: "No, nothing new" — Skip lessons.
107
- - Option 2: "Yes, let me describe it" — Capture to `tasks/lessons.md` in PATTERN/CAUSE/FIX/RULE format.
107
+ - Option 2: "Yes, let me describe it" — Capture to `tasks/lessons.md` as a one-liner: `- **[topic]** The rule`
108
108
 
109
109
  If `tasks/lessons.md` doesn't exist, skip the lessons prompt.
110
+ If lessons.md already has 10 items, promote the most battle-tested to `CLAUDE.md ## Learned Rules` before adding the new one.
110
111
 
111
112
  ## Step 9 — Summary
112
113
 
@@ -9,10 +9,10 @@
9
9
  1. Read this file (CLAUDE.md)
10
10
  2. Read `.planning/STATE.md` for current status
11
11
  3. Read `.planning/ROADMAP.md` for milestone progress
12
- 4. Read `PRD.md` for current execution spec (if one exists)
12
+ 4. Read active PRD from `.planning/prds/` for current milestone (if one exists)
13
13
 
14
14
  ## Execution Rules
15
- - **Plan before building.** For non-trivial work, read the PRD phase section before touching anything.
15
+ - **Plan before building.** For non-trivial work, read the milestone's PRD in `.planning/prds/` before touching anything.
16
16
  - **Delegate immediately.** If a task touches 3+ files, spawn an agent team within your first 2 tool calls.
17
17
  - **Verify everything.** Run {{VERIFY_COMMANDS}} after agent work lands. Nothing is done until proven.
18
18
 
@@ -23,9 +23,12 @@
23
23
  ## Session-End Docs (MANDATORY)
24
24
  1. `.planning/STATE.md` — replace session notes (don't append), keep <80 lines
25
25
  2. `.planning/ROADMAP.md` — update phase progress
26
- 3. `tasks/lessons.md` — add new lessons, refine existing ones
26
+ 3. `tasks/lessons.md` — add new one-liner lessons, enforce max 10 cap (promote to Learned Rules when full)
27
27
  4. Commit doc updates to feature branch
28
28
 
29
+ ## Learned Rules
30
+ <!-- Max 15 permanent one-liners promoted from tasks/lessons.md -->
31
+
29
32
  ## Critical Rules
30
33
  - No assumptions — ask if requirements unclear
31
34
  - Fight entropy — leave code better than you found it
@@ -4,6 +4,7 @@
4
4
  - **Milestone:** {{FIRST_MILESTONE}} (v1)
5
5
  - **Phase:** Not started — run `/flow:spec` to build PRD
6
6
  - **Branch:** main
7
+ - **Active PRD:** None — run `/flow:spec` to create
7
8
  - **Last Session:** {{DATE}}
8
9
 
9
10
  ## Milestone Progress
@@ -1,22 +1,5 @@
1
- # {{PROJECT_NAME}} — Lessons Learned
1
+ # {{PROJECT_NAME}} — Lessons (max 10 active)
2
2
 
3
- Format: PATTERN CAUSE → FIX → RULE
3
+ One-liner format: `- **[topic]** The rule`
4
4
 
5
- ## Execution Patterns
6
- <!-- Lessons about workflow, delegation, verification -->
7
-
8
- <!-- EXAMPLE (replace with real lessons as you work):
9
-
10
- ### Agent context overflow on large files
11
- - **PATTERN:** Spawned agent tried to read a 2000-line file and ran out of context before finishing its task
12
- - **CAUSE:** Agent prompt didn't specify which lines/functions to read — it read the whole file
13
- - **FIX:** Added explicit line ranges and function names to the agent prompt
14
- - **RULE:** Always tell agents exactly which functions/sections to read. Never say "read file.ts" — say "read file.ts lines 50-120 (the handleSubmit function)"
15
-
16
- END EXAMPLE -->
17
-
18
- ## Domain Knowledge
19
- <!-- Lessons about business logic, data models, user behavior -->
20
-
21
- ## Technical Patterns
22
- <!-- Lessons about the tech stack, libraries, deployment -->
5
+ <!-- EXAMPLE: - **[agent context]** Always tell agents exactly which functions/lines to read — never "read file.ts", say "read file.ts lines 50-120" -->