ai-factory 2.3.0 → 2.4.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.
@@ -2,18 +2,26 @@
2
2
  name: aif-explore
3
3
  description: Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.
4
4
  argument-hint: "[topic or plan name]"
5
- allowed-tools: Read Glob Grep Bash AskUserQuestion Questions
5
+ allowed-tools: Read Glob Grep Write Edit Bash AskUserQuestion Questions
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
9
9
  Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
10
10
 
11
- **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks to implement something, remind them to exit explore mode first (e.g., start with `/aif-plan`). You MAY update AI Factory context files (DESCRIPTION.md, ARCHITECTURE.md, RULES.md) if the user asks—that's capturing thinking, not implementing.
11
+ **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER implement features or modify project code. If the user asks to implement something, remind them to exit explore mode first (e.g., start with `/aif-plan`). If the user asks to persist exploration context, write/edit **only** `.ai-factory/RESEARCH.md` (this is capturing thinking, not implementing).
12
12
 
13
13
  **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
14
14
 
15
15
  ---
16
16
 
17
+ ## Artifact Ownership
18
+
19
+ - Primary ownership in explore mode: `.ai-factory/RESEARCH.md` only.
20
+ - All other context artifacts (`DESCRIPTION.md`, `ARCHITECTURE.md`, `ROADMAP.md`, `RULES.md`, plan files) are read-only in this mode.
21
+ - If a discovery should affect another artifact, capture it in RESEARCH now and route follow-up to the owner command later.
22
+
23
+ ---
24
+
17
25
  ## The Stance
18
26
 
19
27
  - **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
@@ -76,6 +84,26 @@ Depending on what the user brings, you might:
76
84
 
77
85
  You have access to AI Factory's project context. Use it naturally, don't force it.
78
86
 
87
+ **Read `.ai-factory/skill-context/aif-explore/SKILL.md`** — MANDATORY if the file exists.
88
+
89
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
90
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
91
+
92
+ **How to apply skill-context rules:**
93
+ - Treat them as **project-level overrides** for this skill's general instructions
94
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
95
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
96
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
97
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
98
+ they exist because the project's experience proved the default insufficient
99
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including exploration
100
+ summaries, diagrams, and any file updates (DESCRIPTION.md, ARCHITECTURE.md). If a skill-context
101
+ rule says "exploration MUST cover X" or "summary MUST include Y" — you MUST comply. Producing
102
+ output that ignores skill-context rules is a bug.
103
+
104
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
105
+ If any rule is violated — fix the output before presenting it to the user.
106
+
79
107
  ### Check for context
80
108
 
81
109
  At the start, read these files if present:
@@ -83,6 +111,7 @@ At the start, read these files if present:
83
111
  - `.ai-factory/DESCRIPTION.md` — project description, tech stack, constraints
84
112
  - `.ai-factory/ARCHITECTURE.md` — architecture decisions, folder structure
85
113
  - `.ai-factory/RULES.md` — project conventions and rules
114
+ - `.ai-factory/RESEARCH.md` — persisted exploration notes (so you can `/clear` and still keep context)
86
115
  - `.ai-factory/PLAN.md` — active fast plan (if any)
87
116
  - `.ai-factory/plans/<branch>.md` — active full plans (if any)
88
117
  - `.ai-factory/ROADMAP.md` — strategic milestones (if any)
@@ -91,6 +120,7 @@ This tells you:
91
120
  - What the project is about
92
121
  - What conventions to follow
93
122
  - If there's active work in progress
123
+ - Any prior exploration context worth carrying into planning
94
124
 
95
125
  ### Input handling
96
126
 
@@ -122,22 +152,81 @@ If the user mentions a plan or you detect one is relevant:
122
152
 
123
153
  3. **Offer to capture when decisions are made**
124
154
 
125
- | Insight Type | Where to Capture |
126
- |--------------|------------------|
127
- | New requirement | `.ai-factory/DESCRIPTION.md` (stack section) |
128
- | Architecture decision | `.ai-factory/ARCHITECTURE.md` |
129
- | Project convention | `.ai-factory/RULES.md` |
130
- | New task/feature | Run `/aif-plan` to create plan |
131
- | Strategic direction | `.ai-factory/ROADMAP.md` |
132
- | Assumption invalidated | Relevant file |
155
+ Default in explore mode: capture everything in `.ai-factory/RESEARCH.md` so it survives `/clear`.
156
+ Later (during planning), you can migrate stabilized decisions into the appropriate context file.
157
+
158
+ | Insight Type | Capture Now (Explore) | Later (Optional) |
159
+ |--------------|------------------------|------------------|
160
+ | New requirement | `.ai-factory/RESEARCH.md` | `.ai-factory/DESCRIPTION.md` |
161
+ | Architecture decision | `.ai-factory/RESEARCH.md` | `.ai-factory/ARCHITECTURE.md` |
162
+ | Project convention | `.ai-factory/RESEARCH.md` | `.ai-factory/RULES.md` |
163
+ | Strategic direction | `.ai-factory/RESEARCH.md` | `.ai-factory/ROADMAP.md` |
164
+ | Assumption invalidated | `.ai-factory/RESEARCH.md` | Relevant file |
165
+ | Exploration context (persisted) | `.ai-factory/RESEARCH.md` | (keep in RESEARCH) |
166
+ | New task/feature | Run `/aif-plan` | `.ai-factory/PLAN.md` or `.ai-factory/plans/<branch>.md` |
133
167
 
134
168
  Example offers:
135
- - "That's an architecture decision. Add it to ARCHITECTURE.md?"
136
- - "This is a new convention. Add it to RULES.md?"
137
- - "This changes the plan. Update the plan file?"
169
+ - "Want me to save this to `.ai-factory/RESEARCH.md` so you can `/clear` and come back later?"
170
+ - "That's an architecture decision save it to RESEARCH now and we can migrate it to ARCHITECTURE during planning."
138
171
 
139
172
  4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
140
173
 
174
+ ### Optional: Persist exploration context (`.ai-factory/RESEARCH.md`)
175
+
176
+ If the conversation is crystallizing (you're about to plan, you want to `/clear`, or you want to continue later), offer to save a compact, durable research snapshot.
177
+
178
+ **Hard rule in explore mode:** If the user chooses to save, you may write/edit **only** `.ai-factory/RESEARCH.md` (and create the `.ai-factory/` directory if missing). Do not write or modify any other project files.
179
+
180
+ Ask:
181
+
182
+ ```
183
+ Save these exploration results to .ai-factory/RESEARCH.md so we can /clear and /aif-plan can reuse them?
184
+
185
+ Options:
186
+ 1. Yes — update Active Summary + append a new Session (recommended)
187
+ 2. Yes — update Active Summary only
188
+ 3. No
189
+ ```
190
+
191
+ If user selects (1) or (2):
192
+ - Ensure `.ai-factory/` exists (`mkdir -p .ai-factory`)
193
+ - If `.ai-factory/RESEARCH.md` does not exist, create it with this skeleton:
194
+
195
+ ```markdown
196
+ # Research
197
+
198
+ Updated: YYYY-MM-DD HH:MM
199
+ Status: active
200
+
201
+ ## Active Summary (input for /aif-plan)
202
+ <!-- aif:active-summary:start -->
203
+ Topic:
204
+ Goal:
205
+ Constraints:
206
+ Decisions:
207
+ Open questions:
208
+ Success signals:
209
+ Next step:
210
+ <!-- aif:active-summary:end -->
211
+
212
+ ## Sessions
213
+ <!-- aif:sessions:start -->
214
+ <!-- aif:sessions:end -->
215
+ ```
216
+
217
+ - Update the `Updated:` timestamp
218
+ - Replace only the content inside `aif:active-summary:start/end`
219
+ - If user selected option (1), append a new session entry just before `<!-- aif:sessions:end -->`:
220
+
221
+ ```markdown
222
+ ### YYYY-MM-DD HH:MM — <short title>
223
+ What changed:
224
+ Key notes:
225
+ Links (paths):
226
+ ```
227
+
228
+ Keep prior sessions verbatim (do not rewrite history).
229
+
141
230
  ---
142
231
 
143
232
  ## What You Don't Have To Do
@@ -48,6 +48,26 @@ Fix a specific bug or problem in the codebase. Supports two modes: immediate fix
48
48
  - If the current problem resembles a past patch — apply the same approach or avoid the same mistakes
49
49
  - This is your accumulated experience. Use it.
50
50
 
51
+ **Read `.ai-factory/skill-context/aif-fix/SKILL.md`** — MANDATORY if the file exists.
52
+
53
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
54
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
55
+
56
+ **How to apply skill-context rules:**
57
+ - Treat them as **project-level overrides** for this skill's general instructions
58
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
59
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
60
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
61
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
62
+ they exist because the project's experience proved the default insufficient
63
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the FIX_PLAN.md
64
+ template and patch files. The FIX_PLAN.md template in Step 1.1 is a **base structure**. If a
65
+ skill-context rule says "steps MUST include X" or "plan MUST have section Y" — you MUST augment
66
+ the template accordingly. Generating a FIX_PLAN.md or patch that violates skill-context rules is a bug.
67
+
68
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
69
+ If any rule is violated — fix the output before presenting it to the user.
70
+
51
71
  ### Step 1: Understand the Problem & Choose Mode
52
72
 
53
73
  From `$ARGUMENTS`, identify:
@@ -324,6 +344,8 @@ function fixedFunction(input) {
324
344
  8. **Minimal changes** - Don't refactor unrelated code
325
345
  9. **One fix at a time** - Don't scope creep
326
346
  10. **Clean up** - Delete FIX_PLAN.md after successful fix execution
347
+ 11. **Ownership boundary** - `/aif-fix` owns `.ai-factory/FIX_PLAN.md` and `.ai-factory/patches/*.md`; treat `.ai-factory/DESCRIPTION.md`, roadmap/rules/architecture context artifacts as read-only unless the user explicitly requests otherwise
348
+ 12. **Logging scope** - Keep `[FIX]` logging requirements for fixes; context-gate outputs in this command should use `WARN`/`ERROR` and must not change global logging policy in other skills
327
349
 
328
350
  ## After Fixing
329
351
 
@@ -24,6 +24,28 @@ Use when:
24
24
 
25
25
  ## Workflow
26
26
 
27
+ ### Step 0: Load Skill Context
28
+
29
+ **Read `.ai-factory/skill-context/aif-grounded/SKILL.md`** — MANDATORY if the file exists.
30
+
31
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
32
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
33
+
34
+ **How to apply skill-context rules:**
35
+ - Treat them as **project-level overrides** for this skill's general instructions
36
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
37
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
38
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
39
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
40
+ they exist because the project's experience proved the default insufficient
41
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the response
42
+ format, evidence requirements, and confidence assessment. If a skill-context rule says "analysis
43
+ MUST include X" or "confidence MUST account for Y" — you MUST comply. Producing an analysis
44
+ that ignores skill-context rules is a bug.
45
+
46
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
47
+ If any rule is violated — fix the output before presenting it to the user.
48
+
27
49
  ### Step 1: Classify the request
28
50
 
29
51
  Classify into one of:
@@ -115,6 +115,26 @@ Based on choice:
115
115
  - Apply proper error handling and logging as specified
116
116
  - **Avoid pitfalls documented in patches** — don't repeat past mistakes
117
117
 
118
+ **Read `.ai-factory/skill-context/aif-implement/SKILL.md`** — MANDATORY if the file exists.
119
+
120
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
121
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
122
+
123
+ **How to apply skill-context rules:**
124
+ - Treat them as **project-level overrides** for this skill's general instructions
125
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
126
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
127
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
128
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
129
+ they exist because the project's experience proved the default insufficient
130
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the code
131
+ you write and how you update plan checkboxes. If a skill-context rule says "code MUST follow X"
132
+ or "implementation MUST include Y" — you MUST comply. Writing code that violates skill-context
133
+ rules is a bug.
134
+
135
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
136
+ If any rule is violated — fix the output before presenting it to the user.
137
+
118
138
  ### Step 0.1: Find Plan File
119
139
 
120
140
  **Check for plan files in this order:**
@@ -302,10 +322,44 @@ What's next?
302
322
 
303
323
  If `.ai-factory/ROADMAP.md` exists:
304
324
  1. Read it
325
+ 1.1. If the plan file includes `## Roadmap Linkage` with a non-`none` milestone, prefer that milestone for completion marking
305
326
  2. Check if the completed work corresponds to any unchecked milestone
306
327
  3. If yes — mark it `[x]` and add entry to the Completed table with today's date
307
328
  4. Tell the user which milestone was marked done
308
329
 
330
+ ### Context Maintenance (Artifacts)
331
+
332
+ Only do this step when there is something concrete to capture.
333
+
334
+ **DESCRIPTION.md (allowed in this command):**
335
+ - If this plan introduced new dependencies/integrations or changed the stack, update `.ai-factory/DESCRIPTION.md` with factual deltas only.
336
+ - Do not rewrite unrelated sections.
337
+
338
+ **ARCHITECTURE.md + AGENTS.md (allowed in this command):**
339
+ - If new modules/layers/folders were added (or dependency rules changed), update `.ai-factory/ARCHITECTURE.md` to reflect the new structure and constraints.
340
+ - If you maintain `AGENTS.md` structure maps or entry points, refresh them only when they are now incorrect.
341
+
342
+ **ROADMAP.md (allowed, limited):**
343
+ - This command may mark milestone completion when evidence is clear.
344
+ - If milestone mapping is ambiguous, emit `WARN [roadmap] ...` and suggest the owner command:
345
+ - `/aif-roadmap check`
346
+ - or `/aif-roadmap <short update request>`
347
+
348
+ **RULES.md (NOT allowed in this command):**
349
+ - Never edit `.ai-factory/RULES.md` from `/aif-implement`.
350
+ - If you discovered repeatable conventions/pitfalls during implementation, propose up to 3 candidate rules and ask the user to add them via `/aif-rules`.
351
+ - Do not invoke `/aif-rules` automatically (it is user-invoked).
352
+
353
+ If candidate rules exist:
354
+
355
+ ```
356
+ AskUserQuestion: Capture new project rules in `.ai-factory/RULES.md`?
357
+
358
+ Options:
359
+ 1. Yes — output `/aif-rules ...` commands (recommended)
360
+ 2. No — skip
361
+ ```
362
+
309
363
  ### Context Cleanup
310
364
 
311
365
  Context is heavy after implementation. All code changes are saved — suggest freeing space:
@@ -477,6 +531,13 @@ Shows progress without executing.
477
531
  - ❌ Mark incomplete tasks as done
478
532
  - ❌ Violate `.ai-factory/ARCHITECTURE.md` conventions for file placement and module boundaries
479
533
 
534
+ ## Artifact Ownership Boundaries
535
+
536
+ - Primary ownership in this command: task execution state and plan progress checkboxes.
537
+ - Allowed context artifact updates: `.ai-factory/DESCRIPTION.md`, `.ai-factory/ARCHITECTURE.md`, and roadmap milestone completion in `.ai-factory/ROADMAP.md` when implementation evidence justifies it.
538
+ - Read-only context in this command by default: `.ai-factory/RULES.md`, `.ai-factory/RESEARCH.md`.
539
+ - Context-gate findings should be communicated as `WARN`/`ERROR` outputs only; this does not replace the required verbose implementation logging rules below.
540
+
480
541
  For progress display format, blocker handling, session continuity examples, and full flow examples → see `references/IMPLEMENTATION-GUIDE.md`
481
542
 
482
543
  ## Critical Rules
@@ -79,6 +79,26 @@ If patches exist, read them to understand:
79
79
  - What patterns to avoid
80
80
  - What the plan should account for
81
81
 
82
+ **Read `.ai-factory/skill-context/aif-improve/SKILL.md`** — MANDATORY if the file exists.
83
+
84
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
85
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
86
+
87
+ **How to apply skill-context rules:**
88
+ - Treat them as **project-level overrides** for this skill's general instructions
89
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
90
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
91
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
92
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
93
+ they exist because the project's experience proved the default insufficient
94
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the Plan
95
+ Refinement Report and any plan modifications. If a skill-context rule says "tasks MUST include X"
96
+ or "plan structure MUST have Y" — you MUST apply these when refining. Generating a refinement
97
+ report that ignores skill-context rules is a bug.
98
+
99
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
100
+ If any rule is violated — fix the output before presenting it to the user.
101
+
82
102
  **1.4: Load current task list**
83
103
 
84
104
  ```
@@ -93,6 +93,26 @@ Read these files if present:
93
93
 
94
94
  Use them to keep outputs aligned with project conventions.
95
95
 
96
+ **Read `.ai-factory/skill-context/aif-loop/SKILL.md`** — MANDATORY if the file exists.
97
+
98
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
99
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
100
+
101
+ **How to apply skill-context rules:**
102
+ - Treat them as **project-level overrides** for this skill's general instructions
103
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
104
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
105
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
106
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
107
+ they exist because the project's experience proved the default insufficient
108
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the generated
109
+ artifact, run state, and evaluation criteria. If a skill-context rule says "artifact MUST include X"
110
+ or "evaluation MUST check Y" — you MUST comply. Producing loop outputs that violate skill-context
111
+ rules is a bug.
112
+
113
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
114
+ If any rule is violated — fix the output before presenting it to the user.
115
+
96
116
  ## Step 0.1: Handle Non-Iteration Commands
97
117
 
98
118
  If command is `status`, `stop`, `list`, `history`, or `clean`, execute and stop:
@@ -34,6 +34,36 @@ Use this context when:
34
34
  - Planning file structure (follow project conventions)
35
35
  - **Follow architecture guidelines from `.ai-factory/ARCHITECTURE.md` when planning file structure and task organization**
36
36
 
37
+ **Read `.ai-factory/skill-context/aif-plan/SKILL.md`** — MANDATORY if the file exists.
38
+
39
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
40
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
41
+
42
+ **How to apply skill-context rules:**
43
+ - Treat them as **project-level overrides** for this skill's general instructions
44
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
45
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
46
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
47
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
48
+ they exist because the project's experience proved the default insufficient
49
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the PLAN.md
50
+ template and task format. The plan template from TASK-FORMAT.md is a **base structure**. If a
51
+ skill-context rule says "tasks MUST include X" or "plan MUST have section Y" — you MUST augment
52
+ the template accordingly. Generating a plan that violates skill-context rules is a bug.
53
+
54
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
55
+ If any rule is violated — fix the output before presenting it to the user.
56
+
57
+ **OPTIONAL (recommended):** Read `.ai-factory/ROADMAP.md` if it exists:
58
+ - Use it to link this plan to a specific milestone (when applicable)
59
+ - This reduces ambiguity in `/aif-implement` milestone completion and `/aif-verify` roadmap gates
60
+
61
+ **OPTIONAL (recommended):** Read `.ai-factory/RESEARCH.md` if it exists:
62
+ - Treat `## Active Summary (input for /aif-plan)` as an additional requirements source
63
+ - Carry over constraints/decisions into tasks and plan settings
64
+ - Prefer the summary over raw notes; use `## Sessions` only when you need deeper rationale
65
+ - If the user omitted the feature description, use `Active Summary -> Topic:` as the default description
66
+
37
67
  ### Step 0.1: Ensure Git Repository
38
68
 
39
69
  ```bash
@@ -57,6 +87,10 @@ full → Full mode (first word)
57
87
  - Remaining text becomes the description
58
88
  - `--list` and `--cleanup` execute immediately and **STOP** (do NOT continue to Step 1+)
59
89
 
90
+ **If the description is empty:**
91
+ - If `.ai-factory/RESEARCH.md` exists and its `Active Summary` has a non-empty `Topic:`, default the description to that topic (no extra user input required)
92
+ - Otherwise, ask the user for a short feature description
93
+
60
94
  **If `--list` is present**, jump to [--list Subcommand](#--list-subcommand).
61
95
  **If `--cleanup` is present**, jump to [--cleanup Subcommand](#--cleanup-subcommand).
62
96
 
@@ -73,6 +107,10 @@ Options:
73
107
  2. Fast — quick plan, no branch, saves to PLAN.md
74
108
  ```
75
109
 
110
+ If the user did not provide a description and `.ai-factory/RESEARCH.md` exists:
111
+ - Mention that you will default the description to the `Active Summary` topic
112
+ - Only ask for `full` vs `fast` (no description prompt needed)
113
+
76
114
  For concrete parsing examples and expected behavior per command shape, read `references/EXAMPLES.md` (Argument Parsing).
77
115
 
78
116
  ---
@@ -140,7 +178,11 @@ AskUserQuestion: Before we start, a few questions:
140
178
  - [ ] Yes, update docs (/aif-docs)
141
179
  - [ ] No, skip docs
142
180
 
143
- 4. Any specific requirements or constraints?
181
+ 4. Roadmap milestone linkage (only if `.ai-factory/ROADMAP.md` exists):
182
+ - [ ] Link this plan to a milestone
183
+ - [ ] Skip — no linkage (allowed; `/aif-verify --strict` should report WARN, not fail, for missing linkage alone)
184
+
185
+ 5. Any specific requirements or constraints?
144
186
  ```
145
187
 
146
188
  **Default to verbose logging.** AI-generated code benefits greatly from extensive logging because:
@@ -150,6 +192,11 @@ AskUserQuestion: Before we start, a few questions:
150
192
 
151
193
  Store all preferences — they will be used in the plan file and passed to `/aif-implement`.
152
194
 
195
+ **If `.ai-factory/ROADMAP.md` exists and the user chose milestone linkage:**
196
+ - Read `.ai-factory/ROADMAP.md` and list candidate milestones (prefer unchecked items)
197
+ - Ask the user to pick one milestone (or type a custom one)
198
+ - Store the selected milestone name and a 1-sentence rationale for inclusion in the plan file
199
+
153
200
  ### Step 1.4: Create Branch or Worktree
154
201
 
155
202
  **If `--parallel` flag is set → create worktree:**
@@ -179,6 +226,7 @@ WORKTREE="../${DIRNAME}-<branch-name-with-hyphens>"
179
226
  # Project context
180
227
  cp .ai-factory/DESCRIPTION.md "${WORKTREE}/.ai-factory/DESCRIPTION.md" 2>/dev/null
181
228
  cp .ai-factory/ARCHITECTURE.md "${WORKTREE}/.ai-factory/ARCHITECTURE.md" 2>/dev/null
229
+ cp .ai-factory/RESEARCH.md "${WORKTREE}/.ai-factory/RESEARCH.md" 2>/dev/null
182
230
 
183
231
  # Past lessons / patches
184
232
  cp -r .ai-factory/patches/ "${WORKTREE}/.ai-factory/patches/" 2>/dev/null
@@ -242,6 +290,10 @@ AskUserQuestion: Before we start:
242
290
  - [ ] No, skip tests
243
291
 
244
292
  2. Any specific requirements or constraints?
293
+
294
+ 3. Roadmap milestone linkage (only if `.ai-factory/ROADMAP.md` exists):
295
+ - [ ] Link this plan to a milestone
296
+ - [ ] Skip — no linkage (allowed; `/aif-verify --strict` should report WARN, not fail, for missing linkage alone)
245
297
  ```
246
298
 
247
299
  **Plan file:** Always `.ai-factory/PLAN.md` (no branch, no branch-named file).
@@ -330,9 +382,19 @@ mkdir -p .ai-factory/plans # only when saving to branch-named plan files
330
382
  - Title with feature name
331
383
  - Branch and creation date
332
384
  - `Settings` section (Testing, Logging, Docs)
385
+ - `Roadmap Linkage` section (optional, only if `.ai-factory/ROADMAP.md` exists)
386
+ - `Research Context` section (optional, if `.ai-factory/RESEARCH.md` exists)
333
387
  - `Tasks` section grouped by phases
334
388
  - `Commit Plan` section when there are 5+ tasks
335
389
 
390
+ If `.ai-factory/ROADMAP.md` exists:
391
+ - If the user linked a milestone, write `## Roadmap Linkage` with `Milestone: "..."` and `Rationale: ...`
392
+ - If the user skipped linkage, write `## Roadmap Linkage` with `Milestone: "none"` and `Rationale: "Skipped by user"`
393
+
394
+ If `.ai-factory/RESEARCH.md` exists:
395
+ - Include `## Research Context` by copying only the `Active Summary` (do not paste full `Sessions`)
396
+ - Keep it compact; it should be readable as a one-screen requirements snapshot
397
+
336
398
  Use the canonical template in `references/TASK-FORMAT.md` (Plan File Template).
337
399
 
338
400
  **Commit Plan Rules:**
@@ -466,6 +528,8 @@ Use canonical examples in `references/TASK-FORMAT.md`:
466
528
  6. **Include file paths** — Help implementer know where to work
467
529
  7. **Commit checkpoints for large plans** — 5+ tasks need commit plan with checkpoints every 3-5 tasks
468
530
  8. **Plan file location** — Fast mode: `.ai-factory/PLAN.md`. Full mode: `.ai-factory/plans/<branch-name>.md`
531
+ 9. **Ownership boundary** — This command owns plan files only (`.ai-factory/PLAN.md`, `.ai-factory/plans/<branch>.md`). Use owner commands (`/aif-roadmap`, `/aif-rules`, `/aif-explore`) for their artifacts.
532
+ 10. **Roadmap linkage (when available)** — If `.ai-factory/ROADMAP.md` exists, include a `## Roadmap Linkage` section in the plan (or explicitly state it was skipped).
469
533
 
470
534
  ## Plan File Handling
471
535
 
@@ -16,6 +16,14 @@
16
16
  -> mode=full, description="Add user authentication with OAuth"
17
17
  ```
18
18
 
19
+ ### Full mode with description omitted (defaults from RESEARCH.md)
20
+
21
+ ```text
22
+ /aif-plan full
23
+ -> mode=full
24
+ -> description defaults to .ai-factory/RESEARCH.md Active Summary Topic (if present)
25
+ ```
26
+
19
27
  ### Full mode with parallel worktree
20
28
 
21
29
  ```text
@@ -44,6 +52,14 @@
44
52
  -> ask mode interactively, description="Add user authentication"
45
53
  ```
46
54
 
55
+ ### No mode + no description (defaults from RESEARCH.md)
56
+
57
+ ```text
58
+ /aif-plan
59
+ -> ask mode interactively
60
+ -> description defaults to .ai-factory/RESEARCH.md Active Summary Topic (if present)
61
+ ```
62
+
47
63
  ## Flow Scenarios
48
64
 
49
65
  ### Scenario 1: Fast mode
@@ -67,6 +83,7 @@
67
83
  -> mode=full
68
84
  -> Quick reconnaissance
69
85
  -> Branch: feature/user-authentication
86
+ -> If ROADMAP.md exists: asks about milestone linkage, user picks one (or skips)
70
87
  -> Asks about tests (Yes), logging (Verbose), docs (Yes)
71
88
  -> Creates branch
72
89
  -> Explores codebase deeply
@@ -83,6 +100,7 @@
83
100
  -> mode=full, parallel=true
84
101
  -> Quick reconnaissance
85
102
  -> Branch: feature/stripe-checkout
103
+ -> If ROADMAP.md exists: asks about milestone linkage, user picks one (or skips)
86
104
  -> Asks about tests (No), logging (Verbose), docs (No)
87
105
  -> Creates worktree ../my-project-feature-stripe-checkout
88
106
  -> Copies context files, cd into worktree
@@ -13,6 +13,20 @@ Created: [date]
13
13
  - Logging: verbose/standard/minimal
14
14
  - Docs: yes/no
15
15
 
16
+ ## Roadmap Linkage (optional)
17
+ <!-- Only when .ai-factory/ROADMAP.md exists -->
18
+ Milestone: "[milestone name from ROADMAP.md]" # or "none"
19
+ Rationale: [1 short sentence]
20
+
21
+ ## Research Context (optional)
22
+ <!-- If .ai-factory/RESEARCH.md exists, copy/paste the Active Summary here -->
23
+ Source: .ai-factory/RESEARCH.md (Active Summary)
24
+
25
+ Goal:
26
+ Constraints:
27
+ Decisions:
28
+ Open questions:
29
+
16
30
  ## Commit Plan
17
31
  <!-- For plans with 5+ tasks, define commit checkpoints -->
18
32
  - **Commit 1** (after tasks 1-3): "feat: add base models and types"
@@ -24,6 +24,42 @@ Perform thorough code reviews focusing on correctness, security, performance, an
24
24
  2. Use `gh pr diff <number>` to get the diff
25
25
  3. Review all changes in the PR
26
26
 
27
+ ## Context Gates (Read-Only)
28
+
29
+ Before finalizing review findings, run read-only context gates:
30
+
31
+ - Check `.ai-factory/ARCHITECTURE.md` (if present) for boundary/dependency alignment issues.
32
+ - Check `.ai-factory/RULES.md` (if present) for explicit convention violations.
33
+ - Check `.ai-factory/ROADMAP.md` (if present) for milestone alignment and mention missing linkage for likely `feat`/`fix`/`perf` work.
34
+
35
+ Gate result severity:
36
+ - `WARN` for non-blocking inconsistencies or missing optional files.
37
+ - `ERROR` only for explicit blocking criteria requested by the user/review policy.
38
+
39
+ `/aif-review` is read-only for context artifacts by default. Do not modify context files unless user explicitly asks.
40
+
41
+ ### Project Context
42
+
43
+ **Read `.ai-factory/skill-context/aif-review/SKILL.md`** — MANDATORY if the file exists.
44
+
45
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
46
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
47
+
48
+ **How to apply skill-context rules:**
49
+ - Treat them as **project-level overrides** for this skill's general instructions
50
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
51
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
52
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
53
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
54
+ they exist because the project's experience proved the default insufficient
55
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the review
56
+ summary format and the checklist criteria. If a skill-context rule says "review MUST check X"
57
+ or "summary MUST include section Y" — you MUST augment the output accordingly. Producing a
58
+ review that ignores skill-context rules is a bug.
59
+
60
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
61
+ If any rule is violated — fix the output before presenting it to the user.
62
+
27
63
  ## Review Checklist
28
64
 
29
65
  ### Correctness
@@ -71,6 +107,9 @@ Perform thorough code reviews focusing on correctness, security, performance, an
71
107
  **Files Reviewed:** [count]
72
108
  **Risk Level:** 🟢 Low / 🟡 Medium / 🔴 High
73
109
 
110
+ ### Context Gates
111
+ [Architecture / Rules / Roadmap gate results with WARN/ERROR labels]
112
+
74
113
  ### Critical Issues
75
114
  [Must be fixed before merge]
76
115
 
@@ -23,6 +23,26 @@ Create and maintain a high-level project roadmap with major milestones.
23
23
  - Chosen architecture pattern and folder structure
24
24
  - Module boundaries and communication patterns
25
25
 
26
+ **Read `.ai-factory/skill-context/aif-roadmap/SKILL.md`** — MANDATORY if the file exists.
27
+
28
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
29
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
30
+
31
+ **How to apply skill-context rules:**
32
+ - Treat them as **project-level overrides** for this skill's general instructions
33
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
34
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
35
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
36
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
37
+ they exist because the project's experience proved the default insufficient
38
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the ROADMAP.md
39
+ template. The template in this SKILL.md is a **base structure**. If a skill-context rule says
40
+ "roadmap MUST include X" or "milestones MUST have Y" — you MUST augment the template accordingly.
41
+ Generating a roadmap that violates skill-context rules is a bug.
42
+
43
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
44
+ If any rule is violated — fix the output before presenting it to the user.
45
+
26
46
  ### Step 1: Determine Mode
27
47
 
28
48
  If argument is `check` → Mode 3: Check Progress (requires ROADMAP.md)
@@ -271,3 +291,4 @@ Next up: **Milestone Name**
271
291
  3. **Never remove milestones silently** — always confirm with user before removing
272
292
  4. **Completed table tracks history** — every checked milestone gets a date entry
273
293
  5. **NO implementation** — this skill only plans, use `/aif-plan` to start a feature and `/aif-implement` to execute
294
+ 6. **Ownership boundary** — this command owns roadmap structure/content; `/aif-implement` may only mark milestones completed when implementation evidence is clear