planflow-ai 1.0.2 → 1.0.3

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.
@@ -58,12 +58,19 @@ RELATED COMMANDS:
58
58
 
59
59
  ---
60
60
 
61
+ > ⚠️ **AUTOPILOT MODE CHECK**
62
+ >
63
+ > Before proceeding, check if `flow/.autopilot` exists.
64
+ > - **If YES**: Autopilot is ON. After creating the plan and getting user approval, **auto-proceed** to `/execute-plan` with the plan output. Do NOT wait for manual invocation.
65
+ > - **If NO**: Follow the standard rules below (stop and wait for user).
66
+
61
67
  ## Critical Rules
62
68
 
63
69
  | Rule | Description |
64
70
  | ------------------------ | -------------------------------------------------------- |
65
- | **No Auto-Chaining** | NEVER auto-invoke /execute-plan - user must invoke it |
66
- | **Complete and Stop** | After presenting results, STOP and wait for user |
71
+ | **Discovery Required** | NEVER create a plan without a discovery document. If none exists, run `/discovery-plan` first. No exceptions. |
72
+ | **No Auto-Chaining** | NEVER auto-invoke /execute-plan - user must invoke it (unless autopilot ON) |
73
+ | **Complete and Stop** | After presenting results, STOP and wait for user (unless autopilot ON) |
67
74
 
68
75
  ---
69
76
 
@@ -80,18 +87,27 @@ RELATED COMMANDS:
80
87
 
81
88
  ---
82
89
 
83
- ### Step 2: Validate Discovery Phase Completion
90
+ ### Step 2: Validate Discovery Phase Completion (HARD BLOCK)
91
+
92
+ **A discovery document is REQUIRED before creating any plan. No exceptions.**
84
93
 
85
- **Before creating a plan, verify that proper discovery was performed.**
94
+ 1. Check user input for a discovery document reference (`@flow/discovery/...`)
95
+ 2. If no reference provided, search `flow/discovery/` for a matching discovery document
96
+ 3. **If NO discovery document exists**: **STOP immediately.** Do NOT create a plan. Instead:
97
+ - Inform the user that discovery is required before planning
98
+ - Invoke `/discovery-plan` to start the discovery process
99
+ - Example response:
100
+ ```
101
+ A discovery document is required before creating a plan. Discovery refines your idea,
102
+ gathers requirements, and identifies risks — skipping it leads to incomplete plans.
86
103
 
87
- 1. Check user input for discovery indicators:
88
- - Discovery document reference (`@flow/discovery/...`)
89
- - FR/NFR prefixes in requirements
90
- 2. Check the discovery folder for a matching document in `flow/discovery/`
91
- 3. If NO discovery indicators found: Recommend `/discovery-plan` command first
92
- 4. If discovery indicators ARE found: Proceed with plan creation
104
+ Starting discovery now...
105
+ ```
106
+ - Then run the discovery process for the user's feature
107
+ 4. If a discovery document IS found: Proceed with plan creation using that document
93
108
 
94
109
  **Important**: NEVER read or reference files in `flow/archive/` - these are outdated.
110
+ **Important**: NEVER create a plan without a discovery document. This rule has NO exceptions.
95
111
 
96
112
  ---
97
113
 
@@ -138,7 +154,9 @@ Plan Created!
138
154
  3. When ready, invoke `/execute-plan @flow/plans/plan_<feature>_v<version>.md`
139
155
  ```
140
156
 
141
- **CRITICAL**: This command is now complete. Do NOT auto-invoke `/execute-plan`. Wait for the user to explicitly invoke it.
157
+ **CRITICAL**: If autopilot mode is OFF (`flow/.autopilot` does not exist), this command is now complete. Do NOT auto-invoke `/execute-plan`. Wait for the user to explicitly invoke it.
158
+
159
+ **If autopilot mode is ON** (`flow/.autopilot` exists): Auto-proceed to `/execute-plan` with the plan file after the user approves the plan.
142
160
 
143
161
  ---
144
162
 
@@ -12,15 +12,21 @@ This command creates a discovery document for gathering and clarifying requireme
12
12
 
13
13
  ---
14
14
 
15
+ > ⚠️ **AUTOPILOT MODE CHECK**
16
+ >
17
+ > Before proceeding, check if `flow/.autopilot` exists.
18
+ > - **If YES**: Autopilot is ON. After completing discovery and user Q&A, **auto-proceed** to `/create-plan` with the discovery output. Do NOT ask "Would you like to proceed?" - just continue.
19
+ > - **If NO**: Follow the standard rules below (stop and wait for user).
20
+
15
21
  > ⚠️ **IMPORTANT - DISCOVERY ONLY**
16
22
  >
17
23
  > This command ONLY creates a discovery document. It does NOT:
18
24
  > - Create implementation plans (use `/create-plan` for that)
19
25
  > - Execute code or implementation steps (use `/execute-plan` for that)
20
26
  > - Write any source code files
21
- > - Auto-chain to the next command
27
+ > - Auto-chain to the next command (unless autopilot mode is ON)
22
28
  >
23
- > After creating the discovery document, the command STOPS and waits for user review.
29
+ > After creating the discovery document, the command STOPS and waits for user review (unless autopilot mode is ON).
24
30
 
25
31
  ---
26
32
 
@@ -85,8 +91,8 @@ These rules are mandatory. For detailed patterns and guidelines, see `.claude/ru
85
91
  | **Read First** | Read all referenced documents before asking questions |
86
92
  | **High-Level Only** | Technical considerations are conceptual, not code |
87
93
  | **Allow Refinement** | User reviews and refines discovery before plan creation |
88
- | **Ask Before Proceeding**| ASK user if they want to proceed to /create-plan |
89
- | **No Auto-Execution** | Do NOT auto-invoke commands without user confirmation |
94
+ | **Ask Before Proceeding**| ASK user if they want to proceed to /create-plan (unless autopilot ON) |
95
+ | **No Auto-Execution** | Do NOT auto-invoke commands without user confirmation (unless autopilot ON) |
90
96
  | **NO PLANNING** | Do NOT create implementation plans during discovery |
91
97
  | **NO EXECUTION** | Do NOT execute any implementation steps |
92
98
 
@@ -177,14 +183,21 @@ Discovery Complete!
177
183
  3. Proceed to planning when ready
178
184
  ```
179
185
 
180
- **Now ask the user**:
181
-
182
- ```markdown
183
- Would you like me to proceed with creating the implementation plan?
184
-
185
- - **Yes**: I'll invoke `/create-plan @flow/discovery/discovery_<feature>_v1.md`
186
- - **No**: You can review the discovery and invoke `/create-plan` when ready
187
- - **Refine first**: Let me know what needs to be adjusted in the discovery
186
+ **Now ask the user using the `AskUserQuestion` tool**:
187
+
188
+ ```typescript
189
+ AskUserQuestion({
190
+ questions: [{
191
+ question: "Would you like me to proceed with creating the implementation plan?",
192
+ header: "Next step",
193
+ options: [
194
+ { label: "Yes, create plan", description: "I'll invoke /create-plan with the discovery document" },
195
+ { label: "No, review first", description: "You can review the discovery and invoke /create-plan when ready" },
196
+ { label: "Refine discovery", description: "Let me know what needs to be adjusted in the discovery" }
197
+ ],
198
+ multiSelect: false
199
+ }]
200
+ })
188
201
  ```
189
202
 
190
203
  ⚠️ **WAIT for user response before proceeding**
@@ -73,13 +73,19 @@ RELATED COMMANDS:
73
73
 
74
74
  ---
75
75
 
76
+ > ⚠️ **AUTOPILOT MODE CHECK**
77
+ >
78
+ > Before proceeding, check if `flow/.autopilot` exists.
79
+ > - **If YES**: Autopilot is ON. After completing execution (build + test pass), **auto-proceed** to `/review-code`. Do NOT stop and wait.
80
+ > - **If NO**: Follow the standard rules below (stop and wait for user).
81
+
76
82
  ## Critical Rules
77
83
 
78
84
  | Rule | Description |
79
85
  | ------------------------ | -------------------------------------------------------- |
80
86
  | **Build ONLY at End** | Do NOT run build after each phase - only at the very end |
81
87
  | **No Direct DB/ORM** | NEVER run ORM or database commands directly |
82
- | **Complete and Stop** | After execution, STOP and wait for user |
88
+ | **Complete and Stop** | After execution, STOP and wait for user (unless autopilot ON) |
83
89
 
84
90
  ---
85
91
 
@@ -182,7 +188,7 @@ After the skill completes:
182
188
 
183
189
  1. Present summary of all changes made
184
190
  2. Confirm all tests pass
185
- 3. Ask if the plan should be archived:
191
+ 3. Ask if the plan should be archived using the `AskUserQuestion` tool:
186
192
 
187
193
  ```markdown
188
194
  Execution Complete!
@@ -191,14 +197,20 @@ Execution Complete!
191
197
  - X phases completed
192
198
  - All tests passing
193
199
  - Build successful
194
-
195
- **Archive the plan?**
196
- This will move the plan to `flow/archive/`:
197
- ```bash
198
- mv flow/plans/plan_<feature>_v1.md flow/archive/
199
200
  ```
200
201
 
201
- Would you like to archive this plan?
202
+ ```typescript
203
+ AskUserQuestion({
204
+ questions: [{
205
+ question: "Would you like to archive this completed plan?",
206
+ header: "Archive",
207
+ options: [
208
+ { label: "Yes, archive it", description: "Move the plan to flow/archive/ - recommended for completed plans" },
209
+ { label: "No, keep it", description: "Keep the plan in flow/plans/ for reference" }
210
+ ],
211
+ multiSelect: false
212
+ }]
213
+ })
202
214
  ```
203
215
 
204
216
  ---
@@ -566,10 +578,20 @@ npm run build && npm run test
566
578
 
567
579
  4. **List all key changes** made
568
580
 
569
- 5. **Ask if the plan should be archived**:
570
-
571
- ```bash
572
- mv flow/plans/plan_feature_name_v1.md flow/archive/
581
+ 5. **Ask if the plan should be archived** using the `AskUserQuestion` tool:
582
+
583
+ ```typescript
584
+ AskUserQuestion({
585
+ questions: [{
586
+ question: "Would you like to archive this completed plan?",
587
+ header: "Archive",
588
+ options: [
589
+ { label: "Yes, archive it", description: "Move the plan to flow/archive/" },
590
+ { label: "No, keep it", description: "Keep the plan in flow/plans/" }
591
+ ],
592
+ multiSelect: false
593
+ }]
594
+ })
573
595
  ```
574
596
 
575
597
  ---
@@ -0,0 +1,105 @@
1
+ ---
2
+ description: Toggle autopilot flow mode - automatically orchestrates discovery, planning, execution, and review for feature requests
3
+ ---
4
+
5
+ # Flow: Autopilot Mode Toggle
6
+
7
+ ## Command Description
8
+
9
+ This command enables or disables **autopilot flow mode**. When enabled, every new user input is automatically classified and, if it's a feature request, the full plan-flow workflow runs automatically:
10
+
11
+ **contracts check → discovery → plan → execute → review-code → archive**
12
+
13
+ The LLM pauses only at mandatory checkpoints (discovery Q&A, plan approval).
14
+
15
+ ---
16
+
17
+ ## Help
18
+
19
+ **If the user invokes this command with `-help`, display only this section and stop:**
20
+
21
+ ```
22
+ /flow - Autopilot Flow Mode Toggle
23
+
24
+ DESCRIPTION:
25
+ Enables or disables autopilot flow mode. When enabled, feature requests
26
+ automatically run the full plan-flow workflow without manual command invocation.
27
+
28
+ USAGE:
29
+ /flow -enable Enable autopilot mode (persists across sessions)
30
+ /flow -disable Disable autopilot mode
31
+ /flow -status Show current autopilot state
32
+ /flow Same as -status
33
+ /flow -help Show this help
34
+
35
+ BEHAVIOR WHEN ENABLED:
36
+ - Feature requests → full flow (discovery → plan → execute → review → archive)
37
+ - Trivial tasks (complexity 0-2) → executed directly, no flow
38
+ - Questions/exploration → answered normally
39
+ - Slash commands → run as normal
40
+
41
+ MANDATORY CHECKPOINTS (even in autopilot):
42
+ - Discovery phase: pauses for user Q&A
43
+ - Plan review: pauses for user approval before execution
44
+
45
+ CONTEXT MANAGEMENT:
46
+ - Only loads the relevant command context at each step
47
+ - Suggests context cleanup (/clear) after each completed flow cycle
48
+
49
+ STATE:
50
+ Persisted in flow/.autopilot (survives session restarts)
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Instructions
56
+
57
+ ### When invoked with `-enable`
58
+
59
+ 1. Create the file `flow/.autopilot` (empty file)
60
+ 2. Confirm to the user:
61
+
62
+ ```markdown
63
+ Autopilot flow mode **enabled**.
64
+
65
+ From now on, feature requests will automatically run the full workflow:
66
+ 1. Check contracts → 2. Discovery (pause for Q&A) → 3. Create plan (pause for approval) → 4. Execute plan → 5. Review code → 6. Archive
67
+
68
+ Trivial tasks and questions are handled normally without the flow.
69
+
70
+ Use `/flow -disable` to turn off, or `/flow -status` to check state.
71
+ ```
72
+
73
+ ### When invoked with `-disable`
74
+
75
+ 1. Delete the file `flow/.autopilot` (if it exists)
76
+ 2. Confirm to the user:
77
+
78
+ ```markdown
79
+ Autopilot flow mode **disabled**.
80
+
81
+ Commands will no longer auto-chain. Use individual slash commands as before:
82
+ `/discovery-plan` → `/create-plan` → `/execute-plan` → `/review-code`
83
+ ```
84
+
85
+ ### When invoked with `-status` or no arguments
86
+
87
+ 1. Check if `flow/.autopilot` exists
88
+ 2. Report:
89
+
90
+ ```markdown
91
+ Autopilot flow mode: **[ENABLED/DISABLED]**
92
+
93
+ [If enabled]: Feature requests will automatically run the full workflow.
94
+ [If disabled]: Use individual slash commands to run each step manually.
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Critical Rules
100
+
101
+ | Rule | Description |
102
+ | --- | --- |
103
+ | **File-based state** | State is stored in `flow/.autopilot` - create to enable, delete to disable |
104
+ | **No other side effects** | This command ONLY manages the marker file. It does not run any workflow steps. |
105
+ | **Complete and stop** | After toggling state, STOP and wait for user input |
@@ -62,12 +62,18 @@ RELATED COMMANDS:
62
62
 
63
63
  ---
64
64
 
65
+ > ⚠️ **AUTOPILOT MODE CHECK**
66
+ >
67
+ > Before proceeding, check if `flow/.autopilot` exists.
68
+ > - **If YES**: Autopilot is ON. After completing the review, **auto-archive** the discovery and plan documents to `flow/archive/`, present the completion summary, and prompt for context cleanup (`/clear`).
69
+ > - **If NO**: Follow the standard rules below (stop and wait for user).
70
+
65
71
  ## Critical Rules
66
72
 
67
73
  | Rule | Description |
68
74
  | ------------------------ | -------------------------------------------------------- |
69
75
  | **Read-Only Analysis** | This command ONLY produces a review document |
70
- | **Complete and Stop** | After presenting results, STOP and wait for user |
76
+ | **Complete and Stop** | After presenting results, STOP and wait for user (unless autopilot ON) |
71
77
 
72
78
  ---
73
79
 
@@ -0,0 +1,188 @@
1
+ # Autopilot Flow Mode
2
+
3
+ ## Purpose
4
+
5
+ When `flow/.autopilot` exists, this rule is active. It automatically orchestrates the full plan-flow workflow for feature requests, loading only the relevant command context at each step.
6
+
7
+ ---
8
+
9
+ ## On Session Start
10
+
11
+ 1. Check if `flow/.autopilot` exists
12
+ 2. If it exists: autopilot mode is **ON** - follow the rules below for every user input
13
+ 3. If it does not exist: autopilot mode is **OFF** - ignore this rule entirely, normal behavior applies
14
+
15
+ ---
16
+
17
+ ## Input Classification
18
+
19
+ When autopilot is ON, classify every new user input before acting:
20
+
21
+ ### Category 1: Slash Command
22
+ **Signals**: Input starts with `/` (e.g., `/review-pr`, `/write-tests`, `/flow -disable`)
23
+ **Action**: Run that command normally. Do NOT trigger the flow.
24
+
25
+ ### Category 2: Question or Exploration
26
+ **Signals**: User is asking about code, requesting explanations, exploring the codebase, or asking for help.
27
+ **Examples**: "What does this function do?", "How does auth work here?", "Show me the API routes"
28
+ **Action**: Answer normally. Do NOT trigger the flow.
29
+
30
+ ### Category 3: Trivial Task
31
+ **Signals**: Single-file change, obvious fix, user specifies exact change, no architectural decisions needed. Estimated complexity 0-2.
32
+ **Examples**: "Fix the typo in README", "Rename this variable to camelCase", "Add a missing import"
33
+ **Action**: Execute directly. Do NOT trigger the flow.
34
+
35
+ ### Category 4: Feature Request
36
+ **Signals**: Adding new functionality, behavior changes, multi-file scope, mentions creating/building/implementing, references APIs/integrations/components. Estimated complexity 3+.
37
+ **Examples**: "Add dark mode support", "Implement user authentication", "Create a new API endpoint for payments"
38
+ **Action**: **Trigger the full flow** (see below).
39
+
40
+ ### When Uncertain
41
+ If the input doesn't clearly fit a category, use the `AskUserQuestion` tool:
42
+
43
+ ```typescript
44
+ AskUserQuestion({
45
+ questions: [{
46
+ question: "I'm in autopilot mode. How should I handle this request?",
47
+ header: "Flow mode",
48
+ options: [
49
+ { label: "Run full flow", description: "Run the full workflow: discovery → plan → execute → review" },
50
+ { label: "Handle directly", description: "Just handle this task directly without the full flow" }
51
+ ],
52
+ multiSelect: false
53
+ }]
54
+ })
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Flow Execution Steps
60
+
61
+ When a **feature request** is detected, execute these steps in order. At each step, **Read the relevant command file** to load its context, then follow its instructions.
62
+
63
+ ### Step 1: Check Contracts
64
+
65
+ Check `flow/contracts/` for any relevant integration contracts. If found, note them for the discovery step.
66
+
67
+ ### Step 2: Discovery
68
+
69
+ 1. **Read** the file `.claude/commands/discovery-plan.md` to load discovery context
70
+ 2. Execute the discovery skill following that command's instructions
71
+ 3. **PAUSE**: Ask user discovery questions as needed (mandatory checkpoint)
72
+ 4. Produce the discovery document in `flow/discovery/`
73
+ 5. Write transition summary (see format below)
74
+ 6. **Auto-proceed** to Step 3 (override the "ask before proceeding" rule)
75
+
76
+ ### Step 3: Create Plan
77
+
78
+ **GATE CHECK**: Before proceeding, verify that Step 2 produced a discovery document in `flow/discovery/`. If no discovery document exists, **DO NOT proceed** — go back to Step 2. A plan cannot be created without a discovery document. This is a hard requirement with no exceptions.
79
+
80
+ 1. **Verify** discovery document exists in `flow/discovery/` (created in Step 2)
81
+ 2. **Read** the file `.claude/commands/create-plan.md` to load planning context
82
+ 3. Execute the create-plan skill with the discovery document as input
83
+ 4. **PAUSE**: Present the plan for user approval (mandatory checkpoint)
84
+ 5. Wait for user to approve the plan before proceeding
85
+ 6. Produce the plan document in `flow/plans/`
86
+ 7. Write transition summary
87
+ 8. **Auto-proceed** to Step 4 (override the "no auto-chaining" rule)
88
+
89
+ ### Step 4: Execute Plan
90
+
91
+ 1. **Read** the file `.claude/commands/execute-plan.md` to load execution context
92
+ 2. Execute the plan following complexity-based grouping strategy
93
+ 3. Update the plan file with progress
94
+ 4. Run build + test verification at the end
95
+ 5. Write transition summary
96
+ 6. **Auto-proceed** to Step 5
97
+
98
+ ### Step 5: Review Code
99
+
100
+ 1. **Read** the file `.claude/commands/review-code.md` to load review context
101
+ 2. Review all uncommitted changes
102
+ 3. Present the review summary
103
+
104
+ ### Step 6: Archive and Complete
105
+
106
+ 1. Move the discovery document to `flow/archive/`
107
+ 2. Move the plan document to `flow/archive/`
108
+ 3. Present completion summary
109
+ 4. **Prompt for context cleanup** (see below)
110
+
111
+ ---
112
+
113
+ ## Transition Summary Format
114
+
115
+ At each step boundary, write this brief summary to bridge context:
116
+
117
+ ```
118
+ ## Flow Progress
119
+
120
+ **Feature**: [feature name from user input]
121
+ **Current Step**: [N] of 6
122
+ **Completed**:
123
+ - Step 1: Contracts check → [found/none]
124
+ - Step 2: Discovery → `flow/discovery/discovery_<feature>_v1.md`
125
+ - Step 3: Plan → `flow/plans/plan_<feature>_v1.md`
126
+ **Next**: [description of next step]
127
+ **Key context**: [1-2 sentences of what matters for the next step]
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Context Cleanup Prompt
133
+
134
+ After Step 6 completes, always prompt:
135
+
136
+ ```
137
+ Flow complete! All artifacts archived.
138
+
139
+ **Summary**:
140
+ - Discovery: archived
141
+ - Plan: archived
142
+ - Code: reviewed
143
+ - Build: passing
144
+ - Tests: passing
145
+
146
+ For best results on your next feature, consider starting a fresh context with `/clear`.
147
+ Ready for the next task?
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Mandatory Checkpoints
153
+
154
+ Even in autopilot, these checkpoints **always** pause for user input:
155
+
156
+ | Checkpoint | When | Why |
157
+ | --- | --- | --- |
158
+ | Discovery Q&A | Step 2 | User must answer requirements questions |
159
+ | Discovery Gate | Step 2→3 | Discovery document must exist before plan creation. No exceptions. |
160
+ | Plan Approval | Step 3 | User must review and approve the plan before execution |
161
+
162
+ All other transitions happen automatically.
163
+
164
+ **Hard Rule**: Step 3 (Create Plan) CANNOT start unless Step 2 (Discovery) produced a document in `flow/discovery/`. If the discovery document does not exist, the flow must loop back to Step 2. A plan without discovery is incomplete and will lead to poor implementations.
165
+
166
+ ---
167
+
168
+ ## Overriding No Auto-Chaining Rules
169
+
170
+ When autopilot is ON, the following rules in individual commands are **suspended**:
171
+
172
+ - `discovery-plan.md`: "Ask Before Proceeding" and "No Auto-Execution" rules
173
+ - `create-plan.md`: "No Auto-Chaining" and "Complete and Stop" rules
174
+ - `execute-plan.md`: "Complete and Stop" rule
175
+ - `review-code.md`: completion stop behavior
176
+
177
+ These rules remain fully active when autopilot is OFF.
178
+
179
+ ---
180
+
181
+ ## Error Handling
182
+
183
+ If any step fails:
184
+
185
+ 1. Present the error to the user
186
+ 2. Ask how to proceed: retry, skip, or abort the flow
187
+ 3. If aborted: note which steps completed and which artifacts exist
188
+ 4. The flow can be resumed manually using individual slash commands
@@ -34,9 +34,9 @@ All implementation plans must be created inside `flow/plans/` using snake_case n
34
34
 
35
35
  ---
36
36
 
37
- ### 2. Use Discovery Folder for Research
37
+ ### 2. Discovery is Required Before Planning
38
38
 
39
- Before creating a plan for complex features, create discovery documents in `flow/discovery/`. See `.claude/rules/patterns/discovery-patterns.md` for details.
39
+ A discovery document in `flow/discovery/` is **required** before creating any plan. Plans cannot be created without a completed discovery document. If no discovery exists, run `/discovery-plan` first. No exceptions. See `.claude/rules/patterns/discovery-patterns.md` for details.
40
40
 
41
41
  ---
42
42
 
package/README.md CHANGED
@@ -99,9 +99,12 @@ Copy `skills/plan-flow/` to your project's `skills/plan-flow/`
99
99
  | `/review-code` | Review local uncommitted changes |
100
100
  | `/review-pr` | Review a Pull Request |
101
101
  | `/write-tests` | Generate tests for coverage target |
102
+ | `/flow` | Toggle autopilot mode on/off |
102
103
 
103
104
  ## Workflow
104
105
 
106
+ ### Manual (default)
107
+
105
108
  ```
106
109
  1. /setup -> Index project patterns (run once)
107
110
  2. /discovery-plan -> Gather requirements for a feature
@@ -110,6 +113,35 @@ Copy `skills/plan-flow/` to your project's `skills/plan-flow/`
110
113
  5. /review-code -> Review changes before committing
111
114
  ```
112
115
 
116
+ ### Autopilot Mode
117
+
118
+ Enable autopilot with `/flow -enable` and the full workflow runs automatically for feature requests:
119
+
120
+ ```
121
+ You: "Add dark mode support"
122
+
123
+ -> Contracts check (automatic)
124
+ -> Discovery (pauses for your Q&A)
125
+ -> Create plan (pauses for your approval)
126
+ -> Execute plan (automatic)
127
+ -> Review code (automatic)
128
+ -> Archive (automatic)
129
+ ```
130
+
131
+ Autopilot classifies every input and only triggers the full flow for feature requests (complexity 3+). Questions, trivial tasks, and slash commands are handled normally.
132
+
133
+ | Usage | Description |
134
+ |-------|-------------|
135
+ | `/flow -enable` | Enable autopilot mode |
136
+ | `/flow -disable` | Disable autopilot mode |
137
+ | `/flow -status` | Check current state |
138
+
139
+ **Mandatory checkpoints** — even in autopilot, the flow always pauses for:
140
+ - **Discovery Q&A**: You answer requirements questions
141
+ - **Plan approval**: You review and approve the plan before execution
142
+
143
+ State is persisted in `flow/.autopilot` (survives session restarts).
144
+
113
145
  ## Complexity Scoring
114
146
 
115
147
  Every plan phase has a complexity score (0-10):
@@ -134,7 +166,8 @@ flow/
134
166
  ├── plans/ # Active implementation plans
135
167
  ├── references/ # Reference materials
136
168
  ├── reviewed-code/ # Code review documents
137
- └── reviewed-pr/ # PR review documents
169
+ ├── reviewed-pr/ # PR review documents
170
+ └── ledger.md # Persistent project learning journal
138
171
  ```
139
172
 
140
173
  ## Requirements
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "planflow-ai",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Structured AI-assisted development workflows for discovery, planning, execution, code reviews, and testing",
5
5
  "type": "module",
6
6
  "main": "dist/cli/index.js",
@@ -9,8 +9,8 @@ alwaysApply: false
9
9
 
10
10
  Core rules define the foundational coding standards that apply across the entire project. These include best practices to follow (allowed patterns), anti-patterns to avoid (forbidden patterns), and complexity scoring for implementation planning.
11
11
 
12
- **Total Files**: 4 files, ~833 lines
13
- **Reference Codes**: COR-AP-1 through COR-LDG-2
12
+ **Total Files**: 5 files, ~1011 lines
13
+ **Reference Codes**: COR-AP-1 through COR-AM-3
14
14
 
15
15
  ---
16
16
 
@@ -40,6 +40,14 @@ Core rules define the foundational coding standards that apply across the entire
40
40
  | COR-CS-4 | Common complexity patterns table | complexity-scoring.mdc | 168-185 |
41
41
  | COR-CS-5 | Real-world scoring examples | complexity-scoring.mdc | 187-236 |
42
42
 
43
+ ### Autopilot Mode (`autopilot-mode.mdc`)
44
+
45
+ | Code | Description | Source | Lines |
46
+ |------|-------------|--------|-------|
47
+ | COR-AM-1 | Input classification (slash commands, questions, trivial, feature requests) | autopilot-mode.mdc | 18-50 |
48
+ | COR-AM-2 | Flow execution steps (contracts, discovery, plan, execute, review, archive) | autopilot-mode.mdc | 52-110 |
49
+ | COR-AM-3 | Mandatory checkpoints and overriding rules | autopilot-mode.mdc | 140-178 |
50
+
43
51
  ### Project Ledger (`project-ledger.mdc`)
44
52
 
45
53
  | Code | Description | Source | Lines |
@@ -64,6 +72,9 @@ Core rules define the foundational coding standards that apply across the entire
64
72
  | COR-CS-5 | Need detailed scoring examples |
65
73
  | COR-LDG-1 | Need ledger behavior and entry guidelines |
66
74
  | COR-LDG-2 | Need ledger maintenance and integration rules |
75
+ | COR-AM-1 | Need to understand input classification for autopilot |
76
+ | COR-AM-2 | Need autopilot flow execution steps |
77
+ | COR-AM-3 | Need mandatory checkpoint and override rules |
67
78
 
68
79
  ---
69
80
 
@@ -97,3 +108,4 @@ Core rules define the foundational coding standards that apply across the entire
97
108
  - `allowed-patterns.mdc` and `forbidden-patterns.mdc` have `alwaysApply: true` - they are loaded automatically by Cursor
98
109
  - `project-ledger.mdc` has `alwaysApply: true` - maintains persistent project memory
99
110
  - `complexity-scoring.mdc` is loaded on-demand when needed for planning
111
+ - `autopilot-mode.mdc` has `alwaysApply: true` - detects and orchestrates autopilot flow mode
@@ -0,0 +1,193 @@
1
+ ---
2
+ description: "Autopilot flow mode - when flow/.autopilot exists, automatically orchestrates discovery → plan → execute → review for feature requests"
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Autopilot Flow Mode
7
+
8
+ ## Purpose
9
+
10
+ When `flow/.autopilot` exists, this rule is active. It automatically orchestrates the full plan-flow workflow for feature requests, loading only the relevant command context at each step.
11
+
12
+ ---
13
+
14
+ ## On Session Start
15
+
16
+ 1. Check if `flow/.autopilot` exists
17
+ 2. If it exists: autopilot mode is **ON** - follow the rules below for every user input
18
+ 3. If it does not exist: autopilot mode is **OFF** - ignore this rule entirely, normal behavior applies
19
+
20
+ ---
21
+
22
+ ## Input Classification
23
+
24
+ When autopilot is ON, classify every new user input before acting:
25
+
26
+ ### Category 1: Slash Command
27
+ **Signals**: Input starts with `/` (e.g., `/review-pr`, `/write-tests`, `/flow -disable`)
28
+ **Action**: Run that command normally. Do NOT trigger the flow.
29
+
30
+ ### Category 2: Question or Exploration
31
+ **Signals**: User is asking about code, requesting explanations, exploring the codebase, or asking for help.
32
+ **Examples**: "What does this function do?", "How does auth work here?", "Show me the API routes"
33
+ **Action**: Answer normally. Do NOT trigger the flow.
34
+
35
+ ### Category 3: Trivial Task
36
+ **Signals**: Single-file change, obvious fix, user specifies exact change, no architectural decisions needed. Estimated complexity 0-2.
37
+ **Examples**: "Fix the typo in README", "Rename this variable to camelCase", "Add a missing import"
38
+ **Action**: Execute directly. Do NOT trigger the flow.
39
+
40
+ ### Category 4: Feature Request
41
+ **Signals**: Adding new functionality, behavior changes, multi-file scope, mentions creating/building/implementing, references APIs/integrations/components. Estimated complexity 3+.
42
+ **Examples**: "Add dark mode support", "Implement user authentication", "Create a new API endpoint for payments"
43
+ **Action**: **Trigger the full flow** (see below).
44
+
45
+ ### When Uncertain
46
+ If the input doesn't clearly fit a category, use the `AskUserQuestion` tool:
47
+
48
+ ```typescript
49
+ AskUserQuestion({
50
+ questions: [{
51
+ question: "I'm in autopilot mode. How should I handle this request?",
52
+ header: "Flow mode",
53
+ options: [
54
+ { label: "Run full flow", description: "Run the full workflow: discovery → plan → execute → review" },
55
+ { label: "Handle directly", description: "Just handle this task directly without the full flow" }
56
+ ],
57
+ multiSelect: false
58
+ }]
59
+ })
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Flow Execution Steps
65
+
66
+ When a **feature request** is detected, execute these steps in order. At each step, **Read the relevant command file** to load its context, then follow its instructions.
67
+
68
+ ### Step 1: Check Contracts
69
+
70
+ Check `flow/contracts/` for any relevant integration contracts. If found, note them for the discovery step.
71
+
72
+ ### Step 2: Discovery
73
+
74
+ 1. **Read** the discovery command to load discovery context
75
+ 2. Execute the discovery skill following that command's instructions
76
+ 3. **PAUSE**: Ask user discovery questions as needed (mandatory checkpoint)
77
+ 4. Produce the discovery document in `flow/discovery/`
78
+ 5. Write transition summary (see format below)
79
+ 6. **Auto-proceed** to Step 3 (override the "ask before proceeding" rule)
80
+
81
+ ### Step 3: Create Plan
82
+
83
+ **GATE CHECK**: Before proceeding, verify that Step 2 produced a discovery document in `flow/discovery/`. If no discovery document exists, **DO NOT proceed** — go back to Step 2. A plan cannot be created without a discovery document. This is a hard requirement with no exceptions.
84
+
85
+ 1. **Verify** discovery document exists in `flow/discovery/` (created in Step 2)
86
+ 2. **Read** the create-plan command to load planning context
87
+ 3. Execute the create-plan skill with the discovery document as input
88
+ 4. **PAUSE**: Present the plan for user approval (mandatory checkpoint)
89
+ 5. Wait for user to approve the plan before proceeding
90
+ 6. Produce the plan document in `flow/plans/`
91
+ 7. Write transition summary
92
+ 8. **Auto-proceed** to Step 4 (override the "no auto-chaining" rule)
93
+
94
+ ### Step 4: Execute Plan
95
+
96
+ 1. **Read** the execute-plan command to load execution context
97
+ 2. Execute the plan following complexity-based grouping strategy
98
+ 3. Update the plan file with progress
99
+ 4. Run build + test verification at the end
100
+ 5. Write transition summary
101
+ 6. **Auto-proceed** to Step 5
102
+
103
+ ### Step 5: Review Code
104
+
105
+ 1. **Read** the review-code command to load review context
106
+ 2. Review all uncommitted changes
107
+ 3. Present the review summary
108
+
109
+ ### Step 6: Archive and Complete
110
+
111
+ 1. Move the discovery document to `flow/archive/`
112
+ 2. Move the plan document to `flow/archive/`
113
+ 3. Present completion summary
114
+ 4. **Prompt for context cleanup** (see below)
115
+
116
+ ---
117
+
118
+ ## Transition Summary Format
119
+
120
+ At each step boundary, write this brief summary to bridge context:
121
+
122
+ ```
123
+ ## Flow Progress
124
+
125
+ **Feature**: [feature name from user input]
126
+ **Current Step**: [N] of 6
127
+ **Completed**:
128
+ - Step 1: Contracts check → [found/none]
129
+ - Step 2: Discovery → `flow/discovery/discovery_<feature>_v1.md`
130
+ - Step 3: Plan → `flow/plans/plan_<feature>_v1.md`
131
+ **Next**: [description of next step]
132
+ **Key context**: [1-2 sentences of what matters for the next step]
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Context Cleanup Prompt
138
+
139
+ After Step 6 completes, always prompt:
140
+
141
+ ```
142
+ Flow complete! All artifacts archived.
143
+
144
+ **Summary**:
145
+ - Discovery: archived
146
+ - Plan: archived
147
+ - Code: reviewed
148
+ - Build: passing
149
+ - Tests: passing
150
+
151
+ For best results on your next feature, consider starting a fresh context with `/clear`.
152
+ Ready for the next task?
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Mandatory Checkpoints
158
+
159
+ Even in autopilot, these checkpoints **always** pause for user input:
160
+
161
+ | Checkpoint | When | Why |
162
+ | --- | --- | --- |
163
+ | Discovery Q&A | Step 2 | User must answer requirements questions |
164
+ | Discovery Gate | Step 2→3 | Discovery document must exist before plan creation. No exceptions. |
165
+ | Plan Approval | Step 3 | User must review and approve the plan before execution |
166
+
167
+ All other transitions happen automatically.
168
+
169
+ **Hard Rule**: Step 3 (Create Plan) CANNOT start unless Step 2 (Discovery) produced a document in `flow/discovery/`. If the discovery document does not exist, the flow must loop back to Step 2. A plan without discovery is incomplete and will lead to poor implementations.
170
+
171
+ ---
172
+
173
+ ## Overriding No Auto-Chaining Rules
174
+
175
+ When autopilot is ON, the following rules in individual commands are **suspended**:
176
+
177
+ - Discovery command: "Ask Before Proceeding" and "No Auto-Execution" rules
178
+ - Create-plan command: "No Auto-Chaining" and "Complete and Stop" rules
179
+ - Execute-plan command: "Complete and Stop" rule
180
+ - Review-code command: completion stop behavior
181
+
182
+ These rules remain fully active when autopilot is OFF.
183
+
184
+ ---
185
+
186
+ ## Error Handling
187
+
188
+ If any step fails:
189
+
190
+ 1. Present the error to the user
191
+ 2. Ask how to proceed: retry, skip, or abort the flow
192
+ 3. If aborted: note which steps completed and which artifacts exist
193
+ 4. The flow can be resumed manually using individual slash commands
@@ -46,9 +46,9 @@ All implementation plans must be created inside `flow/plans/` using snake_case n
46
46
 
47
47
  ---
48
48
 
49
- ### 2. Use Discovery Folder for Research
49
+ ### 2. Discovery is Required Before Planning
50
50
 
51
- Before creating a plan for complex features, create discovery documents in `flow/discovery/`. See `.cursor/rules/patterns/discovery-patterns.mdc` for details.
51
+ A discovery document in `flow/discovery/` is **required** before creating any plan. Plans cannot be created without a completed discovery document. If no discovery exists, run `/discovery-plan` first. No exceptions. See `.cursor/rules/patterns/discovery-patterns.mdc` for details.
52
52
 
53
53
  ---
54
54
 
@@ -57,7 +57,7 @@ This skill is **strictly for creating plan documents**. The process:
57
57
 
58
58
  | Input | Required | Description |
59
59
  | -------------------- | -------- | -------------------------------------------------- |
60
- | `discovery_document` | Optional | Path to discovery document (recommended) |
60
+ | `discovery_document` | **Required** | Path to discovery document. Plans cannot be created without one. |
61
61
  | `feature_name` | Yes | Name of the feature to plan |
62
62
  | `requirements` | Optional | Direct requirements if no discovery document |
63
63
  | `version` | Optional | Version number (auto-incremented if not provided) |
@@ -66,19 +66,16 @@ This skill is **strictly for creating plan documents**. The process:
66
66
 
67
67
  ## Workflow
68
68
 
69
- ### Step 1: Extract Requirements
69
+ ### Step 1: Validate Discovery Document (HARD BLOCK)
70
70
 
71
- **If discovery document was provided**:
71
+ **A discovery document is REQUIRED. No exceptions.**
72
72
 
73
- 1. Read the discovery document
74
- 2. Extract feature name, description, goals from the document
75
- 3. Extract FR, NFR, Constraints
76
- 4. Note any risks identified
77
-
78
- **If no discovery document**:
79
-
80
- 1. Use requirements provided directly
81
- 2. Note that discovery was skipped
73
+ 1. Check if a discovery document was provided or exists in `flow/discovery/`
74
+ 2. **If NO discovery document exists**: **STOP immediately.** Do NOT create a plan. Inform the user that discovery is required and run `/discovery-plan` first.
75
+ 3. **If discovery document exists**: Read it and extract:
76
+ - Feature name, description, goals
77
+ - FR, NFR, Constraints
78
+ - Risks identified
82
79
 
83
80
  ---
84
81
 
@@ -254,7 +251,7 @@ Before completing the plan, verify:
254
251
  - [ ] All phases have complexity scores (X/10)
255
252
  - [ ] Tests are the LAST phase
256
253
  - [ ] Key Changes section is populated
257
- - [ ] Discovery document is referenced (or noted as skipped)
254
+ - [ ] Discovery document is referenced (discovery is required, never skipped)
258
255
  - [ ] **NO implementation code is included**
259
256
  - [ ] **NO source files were created or modified**
260
257
 
@@ -22,6 +22,7 @@ A comprehensive skill set for AI-assisted software development with structured w
22
22
  | `/review-code` | Review local uncommitted changes |
23
23
  | `/review-pr` | Review a Pull Request |
24
24
  | `/write-tests` | Write tests to achieve coverage target |
25
+ | `/flow` | Toggle autopilot mode (auto-chains the full workflow) |
25
26
 
26
27
  ## Always-Active Features
27
28
 
@@ -83,7 +84,7 @@ flow/
83
84
  ## Critical Rules
84
85
 
85
86
  1. **Automated Workflow**: Run discovery → plan → execute automatically. Only stop to ask when you need information from the user.
86
- 2. **Discovery First**: Always run `/discovery` before `/create-plan` for new features or bugs.
87
+ 2. **Discovery First (Hard Block)**: `/discovery` is **required** before `/create-plan`. Plans cannot be created without a discovery document. No exceptions. If no discovery exists, run discovery first.
87
88
  3. **Tests Last**: Tests are always the last phase of any implementation plan.
88
89
  4. **Build at End Only**: Run build verification only after ALL phases complete.
89
90
  5. **Archive When Done**: Move completed discovery and plans to `flow/archive/`.
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: flow
3
+ description: Toggle autopilot flow mode - automatically orchestrates discovery, planning, execution, and review for feature requests
4
+ metadata: {"openclaw":{"requires":{"bins":["git"]}}}
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Flow: Autopilot Mode Toggle
9
+
10
+ Enables or disables autopilot flow mode. When enabled, feature requests automatically run the full plan-flow workflow without manual command invocation.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /flow -enable Enable autopilot mode
16
+ /flow -disable Disable autopilot mode
17
+ /flow -status Show current state
18
+ /flow Same as -status
19
+ /flow -help Show help
20
+ ```
21
+
22
+ ## How It Works
23
+
24
+ **State**: Stored in `flow/.autopilot` (empty marker file). Create to enable, delete to disable.
25
+
26
+ ### When Enabled
27
+
28
+ Every user input is classified:
29
+
30
+ | Category | Signals | Action |
31
+ |----------|---------|--------|
32
+ | Slash Command | Starts with `/` | Run normally, no flow |
33
+ | Question/Exploration | Asking about code, explanations | Answer normally, no flow |
34
+ | Trivial Task | Single-file, obvious fix, complexity 0-2 | Execute directly, no flow |
35
+ | Feature Request | New functionality, multi-file, complexity 3+ | **Trigger full flow** |
36
+
37
+ ### Full Flow (6 Steps)
38
+
39
+ 1. **Check Contracts** → Look for relevant integration contracts
40
+ 2. **Discovery** (PAUSE) → Gather requirements, ask user questions
41
+ 3. **Create Plan** (PAUSE) → Create implementation plan, get user approval
42
+ 4. **Execute Plan** → Implement phases with complexity-based grouping
43
+ 5. **Review Code** → Review all uncommitted changes
44
+ 6. **Archive** → Move artifacts to `flow/archive/`, prompt for cleanup
45
+
46
+ ### Mandatory Checkpoints
47
+
48
+ Even in autopilot, these always pause for user input:
49
+
50
+ | Checkpoint | When | Why |
51
+ |------------|------|-----|
52
+ | Discovery Q&A | Step 2 | User must answer requirements questions |
53
+ | Discovery Gate | Step 2→3 | Discovery document must exist before plan. No exceptions. |
54
+ | Plan Approval | Step 3 | User must approve plan before execution |
55
+
56
+ ### When Disabled
57
+
58
+ Commands run individually as normal:
59
+ `/discovery` → `/create-plan` → `/execute-plan` → `/review-code`
60
+
61
+ ## Toggle Commands
62
+
63
+ ### Enable
64
+ 1. Create `flow/.autopilot` (empty file)
65
+ 2. Confirm to user that autopilot is enabled
66
+
67
+ ### Disable
68
+ 1. Delete `flow/.autopilot`
69
+ 2. Confirm to user that autopilot is disabled
70
+
71
+ ### Status
72
+ 1. Check if `flow/.autopilot` exists
73
+ 2. Report current state (ENABLED/DISABLED)
74
+
75
+ ## Critical Rules
76
+
77
+ | Rule | Description |
78
+ |------|-------------|
79
+ | **File-based state** | State is stored in `flow/.autopilot` - create to enable, delete to disable |
80
+ | **No other side effects** | This command ONLY manages the marker file. It does not run any workflow steps. |
81
+ | **Complete and stop** | After toggling state, STOP and wait for user input |
@@ -12,6 +12,7 @@
12
12
  | `/review-code` | Review local uncommitted changes |
13
13
  | `/review-pr` | Review a Pull Request |
14
14
  | `/write-tests` | Write tests to achieve coverage target |
15
+ | `/flow` | Toggle autopilot mode (auto-chains discovery → plan → execute → review) |
15
16
 
16
17
  ## Recommended Workflow
17
18
 
@@ -27,7 +28,7 @@ The Project Ledger (`flow/ledger.md`) is always active. It silently captures pro
27
28
 
28
29
  ## Critical Rules
29
30
 
30
- 1. **No Auto-Chaining**: Never auto-invoke the next command. Wait for user.
31
+ 1. **No Auto-Chaining**: Never auto-invoke the next command. Wait for user. **Exception**: When autopilot mode is ON (`flow/.autopilot` exists), commands auto-chain per the autopilot flow skill.
31
32
  2. **Discovery First**: Recommend `/discovery-plan` before `/create-plan` for new features.
32
33
  3. **Tests Last**: Tests are always the last phase of any implementation plan.
33
34
  4. **Build at End Only**: Run `npm run build` only after ALL phases complete.
@@ -12,6 +12,7 @@
12
12
  | `/review-code` | Review local uncommitted changes |
13
13
  | `/review-pr` | Review a Pull Request |
14
14
  | `/write-tests` | Write tests to achieve coverage target |
15
+ | `/flow` | Toggle autopilot mode (auto-chains discovery → plan → execute → review) |
15
16
 
16
17
  ## Recommended Workflow
17
18
 
@@ -27,8 +28,8 @@ The Project Ledger (`flow/ledger.md`) is always active. It silently captures pro
27
28
 
28
29
  ## Critical Rules
29
30
 
30
- 1. **No Auto-Chaining**: Never auto-invoke the next command. Wait for user.
31
- 2. **Discovery First**: Recommend `/discovery-plan` before `/create-plan` for new features.
31
+ 1. **No Auto-Chaining**: Never auto-invoke the next command. Wait for user. **Exception**: When autopilot mode is ON (`flow/.autopilot` exists), commands auto-chain per `.claude/rules/core/autopilot-mode.md`.
32
+ 2. **Discovery First**: `/discovery-plan` is **required** before `/create-plan`. Plans cannot be created without a discovery document. No exceptions.
32
33
  3. **Tests Last**: Tests are always the last phase of any implementation plan.
33
34
  4. **Build at End Only**: Run `npm run build` only after ALL phases complete.
34
35