planflow-ai 1.1.2 → 1.1.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.
@@ -25,18 +25,25 @@ DESCRIPTION:
25
25
  and tasks based on a discovery document or user input.
26
26
 
27
27
  USAGE:
28
- /create-plan <discovery_document>
29
- /create-plan <feature_description>
28
+ /create-plan [flags] <discovery_document>
29
+ /create-plan [flags] <feature_description>
30
30
  /create-plan -help
31
31
 
32
32
  ARGUMENTS:
33
33
  discovery_document Path to discovery document (recommended)
34
34
  feature_description Direct description of feature to plan (if no discovery)
35
35
 
36
+ WORKFLOW FLAGS (optional):
37
+ -bugfix Skip the discovery gate requirement. The bug report and user
38
+ description serve as plan input instead of a discovery document.
39
+ Use when fixing a bug where formal discovery is unnecessary.
40
+
41
+ Without a flag, a discovery document is required (standard behavior).
42
+
36
43
  EXAMPLES:
37
44
  /create-plan @flow/discovery/discovery_user_auth_v1.md
38
45
  /create-plan "Add dark mode toggle to settings page"
39
- /create-plan @flow/contracts/api_contract.md
46
+ /create-plan -bugfix "Fix login timeout after 30 seconds of inactivity"
40
47
 
41
48
  OUTPUT:
42
49
  Creates: flow/plans/plan_<feature_name>_v<version>.md
@@ -75,7 +82,7 @@ RELATED COMMANDS:
75
82
 
76
83
  | Rule | Description |
77
84
  | ------------------------ | -------------------------------------------------------- |
78
- | **Discovery Required** | NEVER create a plan without a discovery document. If none exists, run `/discovery-plan` first. No exceptions. |
85
+ | **Discovery Required** | NEVER create a plan without a discovery document. If none exists, run `/discovery-plan` first. **Exception**: The `-bugfix` flag bypasses this requirement — the bug report serves as input. |
79
86
  | **No Auto-Chaining** | NEVER auto-invoke /execute-plan - user must invoke it (unless autopilot ON) |
80
87
  | **Complete and Stop** | After presenting results, STOP and wait for user (unless autopilot ON) |
81
88
 
@@ -83,6 +90,24 @@ RELATED COMMANDS:
83
90
 
84
91
  ## Instructions
85
92
 
93
+ ### Step 0: Parse Workflow Flag
94
+
95
+ Check if the user input starts with a workflow flag:
96
+
97
+ | Flag | Behavior Change |
98
+ |------|----------------|
99
+ | `-bugfix` | **Skip the discovery gate** (Step 2). The user's bug description + any diagnostic review serve as plan input. No discovery document required. The plan should focus on: root cause fix, regression prevention, and verification steps. |
100
+ | (none) | Standard behavior — discovery document required |
101
+
102
+ If a flag is found:
103
+ 1. Set the **workflow context** for this execution
104
+ 2. Remove the flag from the input (the rest is the user's prompt/reference)
105
+ 3. The `-bugfix` flag bypasses the discovery gate in Step 2
106
+
107
+ If no flag is found: proceed with standard behavior (backward compatible).
108
+
109
+ ---
110
+
86
111
  ### Step 1: Validate Inputs
87
112
 
88
113
  | Input | Required | Description |
@@ -94,9 +119,13 @@ RELATED COMMANDS:
94
119
 
95
120
  ---
96
121
 
97
- ### Step 2: Validate Discovery Phase Completion (HARD BLOCK)
122
+ ### Step 2: Validate Discovery Phase Completion (CONDITIONAL BLOCK)
123
+
124
+ **A discovery document is REQUIRED before creating any plan — unless the `-bugfix` flag is set.**
125
+
126
+ **If `-bugfix` flag is present**: Skip this step entirely. The user's bug description and any diagnostic review findings serve as plan input. Proceed directly to Step 3.
98
127
 
99
- **A discovery document is REQUIRED before creating any plan. No exceptions.**
128
+ **If no `-bugfix` flag**:
100
129
 
101
130
  1. Check user input for a discovery document reference (`@flow/discovery/...`)
102
131
  2. If no reference provided, search `flow/discovery/` for a matching discovery document
@@ -114,7 +143,6 @@ RELATED COMMANDS:
114
143
  4. If a discovery document IS found: Proceed with plan creation using that document
115
144
 
116
145
  **Important**: NEVER read or reference files in `flow/archive/` - these are outdated.
117
- **Important**: NEVER create a plan without a discovery document. This rule has NO exceptions.
118
146
 
119
147
  ---
120
148
 
@@ -50,18 +50,28 @@ DESCRIPTION:
50
50
  before creating an implementation plan. This is the recommended first step.
51
51
 
52
52
  USAGE:
53
- /discovery-plan <reference_document>
54
- /discovery-plan <feature_description>
53
+ /discovery-plan [flags] <reference_document>
54
+ /discovery-plan [flags] <feature_description>
55
55
  /discovery-plan -help
56
56
 
57
57
  ARGUMENTS:
58
58
  reference_document Contract, spec, or any document to analyze
59
59
  feature_description Description of what you want to build
60
60
 
61
+ WORKFLOW FLAGS (optional):
62
+ -security Focus on threat model, attack surface, compliance needs,
63
+ and security requirements gathering.
64
+ -refactor Focus on refactoring scope, target patterns, success criteria,
65
+ and what to preserve during restructuring.
66
+
67
+ Without a flag, performs standard feature requirements gathering.
68
+
61
69
  EXAMPLES:
62
70
  /discovery-plan @flow/contracts/api_contract.md
63
71
  /discovery-plan "User authentication with OAuth2"
64
72
  /discovery-plan @docs/feature-spec.md "Focus on the payment flow"
73
+ /discovery-plan -security "Review payment system security"
74
+ /discovery-plan -refactor "Restructure the API layer"
65
75
 
66
76
  OUTPUT:
67
77
  Creates: flow/discovery/discovery_<feature_name>_v<version>.md
@@ -108,6 +118,25 @@ These rules are mandatory. For detailed patterns and guidelines, see `.claude/re
108
118
 
109
119
  ## Instructions
110
120
 
121
+ ### Step 0: Parse Workflow Flag
122
+
123
+ Check if the user input starts with a workflow flag:
124
+
125
+ | Flag | Discovery Focus |
126
+ |------|----------------|
127
+ | `-security` | **Threat model and security requirements**. Questions focus on: auth flows, data sensitivity, encryption needs, access control, vulnerability surface, compliance requirements (SOC2, GDPR, PCI), and trust boundaries. Discovery document includes a "Threat Model" section and "Security Requirements" subsection. |
128
+ | `-refactor` | **Refactoring scope and target patterns**. Questions focus on: current pain points, desired patterns, migration strategy, backward compatibility, what to preserve, success criteria, and acceptable breakage. Discovery document includes a "Baseline Assessment" section and "Target Architecture" subsection. |
129
+ | (none) | Standard feature requirements gathering |
130
+
131
+ If a flag is found:
132
+ 1. Set the **discovery focus** for this execution
133
+ 2. Remove the flag from the input (the rest is the user's prompt/reference)
134
+ 3. The focus affects the questions asked in Step 4 and the structure of the output document
135
+
136
+ If no flag is found: proceed with standard discovery (backward compatible).
137
+
138
+ ---
139
+
111
140
  ### Step 1: Validate Inputs
112
141
 
113
142
  | Input | Required | Description |
@@ -24,17 +24,22 @@ The LLM pauses only at mandatory checkpoints (discovery Q&A, plan approval).
24
24
  DESCRIPTION:
25
25
  Enables or disables autopilot flow mode. When enabled, actionable requests
26
26
  automatically run the full plan-flow workflow without manual command invocation.
27
- Supports 4 workflow types: feature (default), bugfix, refactor, security.
27
+ Supports auto-detect mode (default) and 4 locked workflow types.
28
28
 
29
29
  USAGE:
30
- /flow -enable [type] Enable autopilot mode with workflow type (default: feature)
30
+ /flow -enable Enable autopilot with auto-detect (default)
31
+ /flow -enable [type] Enable autopilot locked to a specific workflow type
31
32
  /flow -disable Disable autopilot mode
32
33
  /flow -status Show current autopilot state and workflow type
33
34
  /flow Same as -status
34
35
  /flow -help Show this help
35
36
 
36
- WORKFLOW TYPES:
37
- feature New functionality, behavior changes (default)
37
+ MODES:
38
+ auto Auto-detect workflow type per input using signal analysis (default)
39
+ Each request is independently classified as feature/bugfix/refactor/security
40
+
41
+ WORKFLOW TYPES (for locked mode):
42
+ feature New functionality, behavior changes
38
43
  Steps: contracts → discovery → plan → execute → review → archive
39
44
  bugfix Bug reports, error fixes, regression fixes
40
45
  Steps: review (diagnostic) → plan → execute → review (verification) → archive
@@ -44,7 +49,7 @@ WORKFLOW TYPES:
44
49
  Steps: review (audit) → discovery → plan → execute → review (verification) → archive
45
50
 
46
51
  BEHAVIOR WHEN ENABLED:
47
- - Actionable requests → full flow using the active workflow type
52
+ - Actionable requests → full flow using auto-detected or locked workflow type
48
53
  - Trivial tasks (below workflow threshold) → executed directly, no flow
49
54
  - Questions/exploration → answered normally
50
55
  - Slash commands → run as normal
@@ -60,7 +65,13 @@ CONTEXT MANAGEMENT:
60
65
 
61
66
  STATE:
62
67
  Persisted in flow/.autopilot (survives session restarts)
63
- File content determines workflow type (empty = feature)
68
+ File content: "auto" for auto-detect, or a specific type for locked mode
69
+
70
+ EXAMPLES:
71
+ /flow -enable # Auto-detect mode (recommended)
72
+ /flow -enable bugfix # Lock to bugfix workflow only
73
+ /flow -enable security # Lock to security workflow only
74
+ /flow -disable # Turn off autopilot
64
75
  ```
65
76
 
66
77
  ---
@@ -72,23 +83,42 @@ STATE:
72
83
 
73
84
  ### When invoked with `-enable` or `-enable <type>`
74
85
 
75
- 1. Parse the workflow type from the argument (default: `feature`)
76
- - Valid types: `feature`, `bugfix`, `refactor`, `security`
86
+ 1. Parse the argument:
87
+ - No argument **auto-detect mode** (default)
88
+ - Valid types: `feature`, `bugfix`, `refactor`, `security` → **locked mode**
77
89
  - If an invalid type is provided, show an error and list valid types
78
- 2. Create the file `flow/.autopilot` with the workflow type as content
79
- - For `feature` (default), write `feature` to the file
80
- - For other types, write the type name (e.g., `bugfix`, `refactor`, `security`)
90
+ 2. Create the file `flow/.autopilot` with the mode as content:
91
+ - No argument: write `auto` to the file
92
+ - Specific type: write the type name (e.g., `bugfix`, `refactor`, `security`, `feature`)
81
93
  3. Confirm to the user:
82
94
 
95
+ **For auto-detect mode:**
96
+
97
+ ```markdown
98
+ Autopilot flow mode **enabled** (mode: **auto-detect**).
99
+
100
+ From now on, each actionable request will be automatically classified:
101
+ - Security signals → security workflow
102
+ - Bug/error signals → bugfix workflow
103
+ - Refactor signals → refactor workflow
104
+ - Everything else → feature workflow
105
+
106
+ Trivial tasks and questions are handled normally without the flow.
107
+
108
+ Use `/flow -enable <type>` to lock to a specific workflow, `/flow -disable` to turn off, or `/flow -status` to check state.
109
+ ```
110
+
111
+ **For locked mode:**
112
+
83
113
  ```markdown
84
- Autopilot flow mode **enabled** (workflow: **[type]**).
114
+ Autopilot flow mode **enabled** (workflow: **[type]** — locked).
85
115
 
86
- From now on, actionable requests will automatically run the [type] workflow:
116
+ From now on, ALL actionable requests will run the [type] workflow:
87
117
  [Show step sequence for the active workflow type]
88
118
 
89
119
  Trivial tasks and questions are handled normally without the flow.
90
120
 
91
- Use `/flow -enable <type>` to switch workflow, `/flow -disable` to turn off, or `/flow -status` to check state.
121
+ Use `/flow -enable` to switch to auto-detect, `/flow -enable <type>` to switch workflow, or `/flow -disable` to turn off.
92
122
  ```
93
123
 
94
124
  ### When invoked with `-disable`
@@ -107,20 +137,28 @@ Commands will no longer auto-chain. Use individual slash commands as before:
107
137
  ### When invoked with `-status` or no arguments
108
138
 
109
139
  1. Check if `flow/.autopilot` exists
110
- 2. If exists, read its content to determine active workflow type
140
+ 2. If exists, read its content to determine mode:
141
+ - Content is `auto` → auto-detect mode
142
+ - Content is `feature`, `bugfix`, `refactor`, or `security` → locked to that type
143
+ - Empty or unrecognized → treat as `auto`
111
144
  3. Check if `flow/state/autopilot-progress.md` exists — if so, read it to show workflow progress
112
145
  4. Report:
113
146
 
114
147
  ```markdown
115
148
  Autopilot flow mode: **[ENABLED/DISABLED]**
116
149
 
117
- [If enabled]:
118
- - **Workflow type**: [feature/bugfix/refactor/security]
119
- - **Steps**: [step sequence for active workflow]
120
- - Actionable requests will automatically run the [type] workflow.
150
+ [If enabled — auto-detect]:
151
+ - **Mode**: auto-detect
152
+ - Each actionable request is classified independently (security > bugfix > refactor > feature)
153
+
154
+ [If enabled — locked]:
155
+ - **Mode**: locked — **[type]**
156
+ - **Steps**: [step sequence for the locked workflow type]
157
+ - ALL actionable requests will run the [type] workflow.
121
158
 
122
159
  [If enabled AND autopilot-progress.md exists]:
123
160
  - **Active workflow**: [feature name]
161
+ - **Detected type**: [workflow type for current input]
124
162
  - **Progress**: Step [N] of [total] ([step name])
125
163
  - **Completed**: [list of done steps]
126
164
  - **Next**: [description of current/next step]
@@ -135,6 +173,6 @@ Autopilot flow mode: **[ENABLED/DISABLED]**
135
173
  | Rule | Description |
136
174
  | --- | --- |
137
175
  | **File-based state** | State is stored in `flow/.autopilot` - create to enable, delete to disable |
138
- | **Workflow type in file content** | The workflow type is written as file content (e.g., `feature`, `bugfix`, `refactor`, `security`) |
176
+ | **Mode in file content** | File content is `auto` (auto-detect) or a specific type (`feature`, `bugfix`, `refactor`, `security`) for locked mode |
139
177
  | **No other side effects** | This command ONLY manages the marker file. It does not run any workflow steps. |
140
178
  | **Complete and stop** | After toggling state, STOP and wait for user input |
@@ -23,18 +23,30 @@ DESCRIPTION:
23
23
  practices. Generates a detailed review document.
24
24
 
25
25
  USAGE:
26
- /review-code [file_path] [--scope <staged|unstaged>]
26
+ /review-code [flags] [file_path] [--scope <staged|unstaged>]
27
27
  /review-code -help
28
28
 
29
29
  ARGUMENTS:
30
30
  file_path Optional. Specific file to review (reviews all if not provided)
31
31
  --scope Optional. "staged" or "unstaged" (reviews both if not provided)
32
32
 
33
+ WORKFLOW FLAGS (optional):
34
+ -bugfix Diagnostic review: focus on root cause analysis, broken behavior,
35
+ affected files. Use when investigating a bug.
36
+ -security Security audit: focus on vulnerabilities, auth flows, data handling,
37
+ input validation. Use for security assessments.
38
+ -refactor Baseline review: focus on current patterns, code smells, quality
39
+ metrics. Use before refactoring to document the current state.
40
+
41
+ Without a flag, performs a standard review (general quality, pattern compliance).
42
+
33
43
  EXAMPLES:
34
- /review-code # Review all changes
44
+ /review-code # Standard review of all changes
35
45
  /review-code --scope staged # Review only staged changes
36
46
  /review-code src/services/userService.ts # Review specific file
37
- /review-code src/api --scope unstaged # Review unstaged in directory
47
+ /review-code -bugfix login timeout issue # Diagnostic review for a bug
48
+ /review-code -security auth module # Security audit of auth code
49
+ /review-code -refactor src/utils # Baseline review before refactoring
38
50
 
39
51
  OUTPUT:
40
52
  Creates: flow/reviewed-code/<filename>.md
@@ -86,6 +98,26 @@ RELATED COMMANDS:
86
98
 
87
99
  ## Instructions
88
100
 
101
+ ### Step 0: Parse Workflow Flag
102
+
103
+ Check if the user input starts with a workflow flag:
104
+
105
+ | Flag | Review Variant | Focus |
106
+ |------|---------------|-------|
107
+ | `-bugfix` | Diagnostic | Diagnose root cause, identify broken behavior, affected files, reproduction steps |
108
+ | `-security` | Security audit | Vulnerabilities, auth flows, data handling, input validation, secret exposure |
109
+ | `-refactor` | Baseline | Current patterns, code smells, quality metrics, complexity hotspots |
110
+ | (none) | Standard | General quality, pattern compliance |
111
+
112
+ If a flag is found:
113
+ 1. Set the **review variant** for this execution
114
+ 2. Remove the flag from the input (the rest is the user's prompt/file path)
115
+ 3. The review variant affects the focus areas in Step 3
116
+
117
+ If no flag is found: proceed with standard review (backward compatible).
118
+
119
+ ---
120
+
89
121
  ### Step 1: Validate Inputs
90
122
 
91
123
  | Input | Required | Description |
@@ -107,6 +139,12 @@ The skill will:
107
139
  4. Compare patterns against existing code
108
140
  5. Generate review document
109
141
 
142
+ **Review Variant Focus** (from Step 0):
143
+ - **Diagnostic** (`-bugfix`): Prioritize identifying what's broken, root cause analysis, affected code paths, and potential regression points. The review output should include a "Root Cause Analysis" section.
144
+ - **Security audit** (`-security`): Prioritize OWASP top 10 checks, auth flow analysis, data handling, input validation, secret exposure, and dependency vulnerabilities. The review output should include a "Security Findings" section with severity ratings.
145
+ - **Baseline** (`-refactor`): Prioritize documenting current patterns, code smells, complexity metrics, duplication, and coupling. The review output should include a "Baseline Metrics" section for before/after comparison.
146
+ - **Standard** (no flag): General quality, pattern compliance, potential bugs, performance concerns.
147
+
110
148
  **Confidence-Based Filtering Rules**:
111
149
  - Each finding must include a **Confidence** percentage (e.g., 85%)
112
150
  - **Only include findings with >80% confidence** in the main Findings section
@@ -14,14 +14,21 @@ When `flow/.autopilot` exists, this rule is active. It automatically orchestrate
14
14
 
15
15
  ---
16
16
 
17
- ## Workflow Type Detection
17
+ ## Workflow Mode Detection
18
18
 
19
- After confirming autopilot is ON, read the **content** of `flow/.autopilot` to determine the active workflow type:
19
+ After confirming autopilot is ON, read the **content** of `flow/.autopilot` to determine the mode:
20
20
 
21
- - File contains `bugfix` → **bugfix** workflow
22
- - File contains `refactor` → **refactor** workflow
23
- - File contains `security` **security** workflow
24
- - File is empty, contains `feature`, or any unrecognized value **feature** workflow (default)
21
+ ### Auto-Detect Mode
22
+ - File contains `auto`, is empty, or contains any unrecognized value → **auto-detect mode**
23
+ - In auto-detect mode, each actionable input is independently classified using the signal table below
24
+ - The detected workflow type is used for that specific input only
25
+
26
+ ### Locked Mode
27
+ - File contains `feature` → **locked to feature** workflow
28
+ - File contains `bugfix` → **locked to bugfix** workflow
29
+ - File contains `refactor` → **locked to refactor** workflow
30
+ - File contains `security` → **locked to security** workflow
31
+ - In locked mode, ALL actionable inputs use the locked workflow type regardless of input signals
25
32
 
26
33
  See `.claude/resources/core/orchestration-workflows.md` [COR-OW-1] for full workflow definitions.
27
34
 
@@ -46,7 +53,7 @@ When autopilot is ON, classify every new user input before acting:
46
53
  **Action**: Execute directly. Do NOT trigger the flow.
47
54
 
48
55
  ### Category 4: Actionable Request
49
- **Signals**: Complexity meets or exceeds the active workflow's threshold. Classify by input signals:
56
+ **Signals**: Complexity meets or exceeds the workflow's threshold. Classify by input signals:
50
57
 
51
58
  | Priority | Workflow | Input Signals | Threshold |
52
59
  |----------|----------|---------------|-----------|
@@ -55,7 +62,11 @@ When autopilot is ON, classify every new user input before acting:
55
62
  | 3 | **refactor** | "refactor", "restructure", "clean up", "tech debt", "migrate", "reorganize" | 3+ |
56
63
  | 4 | **feature** | "add", "create", "implement", "build", "integrate" (default) | 3+ |
57
64
 
58
- **Action**: Trigger the flow using the **active workflow type** (from `.autopilot` file). If the input signals suggest a different workflow type than what's active, use the active type the user chose it deliberately.
65
+ **Action — depends on mode:**
66
+
67
+ **Auto-detect mode** (`auto`): Classify the input using the signal table above (priority order: security > bugfix > refactor > feature). Use the **detected workflow type** for this specific input. Each input is classified independently.
68
+
69
+ **Locked mode** (specific type): Trigger the flow using the **locked workflow type** (from `.autopilot` file). Ignore input signals — the user chose this type deliberately.
59
70
 
60
71
  ### When Uncertain
61
72
  If the input doesn't clearly fit a category, use the `AskUserQuestion` tool:
@@ -131,9 +131,9 @@ The active workflow type is stored in `flow/.autopilot`. If the file is empty or
131
131
 
132
132
  ## COR-OW-2: Workflow Selection Guide
133
133
 
134
- ### Automatic Selection (Autopilot Mode)
134
+ ### Auto-Detect Mode (Default)
135
135
 
136
- When autopilot is ON, the active workflow type determines how the flow runs. The LLM classifies user input using the **input signals** listed above.
136
+ When autopilot is ON with auto-detect mode (`flow/.autopilot` contains `auto`), each actionable input is independently classified using input signals:
137
137
 
138
138
  **Priority order** (when signals overlap):
139
139
  1. **security** — if input mentions security/vulnerability/auth concepts
@@ -141,13 +141,20 @@ When autopilot is ON, the active workflow type determines how the flow runs. The
141
141
  3. **refactor** — if input focuses on restructuring without new features
142
142
  4. **feature** — default for everything else
143
143
 
144
- ### Manual Selection
144
+ ### Locked Mode
145
145
 
146
- Users set the workflow type via:
147
- - `/flow -enable feature` (default)
148
- - `/flow -enable bugfix`
149
- - `/flow -enable refactor`
150
- - `/flow -enable security`
146
+ Users can lock to a specific workflow type:
147
+ - `/flow -enable feature` — lock to feature workflow
148
+ - `/flow -enable bugfix` — lock to bugfix workflow
149
+ - `/flow -enable refactor` — lock to refactor workflow
150
+ - `/flow -enable security` — lock to security workflow
151
+
152
+ When locked, ALL actionable inputs use the locked type regardless of signals.
153
+
154
+ ### Default Behavior
155
+
156
+ - `/flow -enable` (no type) → auto-detect mode (recommended)
157
+ - `/flow -enable <type>` → locked mode
151
158
 
152
159
  ### Complexity Thresholds
153
160
 
@@ -175,4 +182,6 @@ Some workflows use `/review-code` with different focus areas:
175
182
  | Security verification | Check for new vulnerabilities, verify fixes | security (step 5) |
176
183
  | Standard | General quality, pattern compliance | feature (step 5) |
177
184
 
178
- The variant is communicated via the review scope/context, not a separate command. The LLM adjusts its review focus based on the active workflow step.
185
+ The variant can be set via:
186
+ 1. **Autopilot context**: The LLM adjusts focus based on the active workflow step
187
+ 2. **Command flag**: `/review-code -bugfix`, `/review-code -security`, `/review-code -refactor` (see command help for details)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "planflow-ai",
3
- "version": "1.1.2",
3
+ "version": "1.1.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",
@@ -19,14 +19,21 @@ When `flow/.autopilot` exists, this rule is active. It automatically orchestrate
19
19
 
20
20
  ---
21
21
 
22
- ## Workflow Type Detection
22
+ ## Workflow Mode Detection
23
23
 
24
- After confirming autopilot is ON, read the **content** of `flow/.autopilot` to determine the active workflow type:
24
+ After confirming autopilot is ON, read the **content** of `flow/.autopilot` to determine the mode:
25
25
 
26
- - File contains `bugfix` → **bugfix** workflow
27
- - File contains `refactor` → **refactor** workflow
28
- - File contains `security` **security** workflow
29
- - File is empty, contains `feature`, or any unrecognized value **feature** workflow (default)
26
+ ### Auto-Detect Mode
27
+ - File contains `auto`, is empty, or contains any unrecognized value → **auto-detect mode**
28
+ - In auto-detect mode, each actionable input is independently classified using the signal table below
29
+ - The detected workflow type is used for that specific input only
30
+
31
+ ### Locked Mode
32
+ - File contains `feature` → **locked to feature** workflow
33
+ - File contains `bugfix` → **locked to bugfix** workflow
34
+ - File contains `refactor` → **locked to refactor** workflow
35
+ - File contains `security` → **locked to security** workflow
36
+ - In locked mode, ALL actionable inputs use the locked workflow type regardless of input signals
30
37
 
31
38
  See `rules/core/orchestration-workflows.mdc` [COR-OW-1] for full workflow definitions.
32
39
 
@@ -58,7 +65,11 @@ When autopilot is ON, classify every new user input before acting:
58
65
  | 3 | **refactor** | "refactor", "restructure", "clean up", "tech debt", "migrate", "reorganize" | 3+ |
59
66
  | 4 | **feature** | "add", "create", "implement", "build", "integrate" (default) | 3+ |
60
67
 
61
- **Action**: Trigger the flow using the **active workflow type** (from `.autopilot` file). If the input signals suggest a different workflow type than what's active, use the active type the user chose it deliberately.
68
+ **Action — depends on mode:**
69
+
70
+ **Auto-detect mode** (`auto`): Classify the input using the signal table above (priority order: security > bugfix > refactor > feature). Use the **detected workflow type** for this specific input. Each input is classified independently.
71
+
72
+ **Locked mode** (specific type): Trigger the flow using the **locked workflow type** (from `.autopilot` file). Ignore input signals — the user chose this type deliberately.
62
73
 
63
74
  ### When Uncertain
64
75
 
@@ -114,7 +114,9 @@ The active workflow type is stored in `flow/.autopilot`. If the file is empty or
114
114
 
115
115
  ## COR-OW-2: Workflow Selection Guide
116
116
 
117
- ### Automatic Selection
117
+ ### Auto-Detect Mode (Default)
118
+
119
+ When autopilot is ON with auto-detect mode (`flow/.autopilot` contains `auto`), each actionable input is independently classified using input signals:
118
120
 
119
121
  **Priority order** (when signals overlap):
120
122
  1. **security** — security/vulnerability/auth concepts
@@ -122,12 +124,20 @@ The active workflow type is stored in `flow/.autopilot`. If the file is empty or
122
124
  3. **refactor** — restructuring without new features
123
125
  4. **feature** — default
124
126
 
125
- ### Manual Selection
127
+ ### Locked Mode
128
+
129
+ Users can lock to a specific workflow type:
130
+ - `/flow -enable feature` — lock to feature workflow
131
+ - `/flow -enable bugfix` — lock to bugfix workflow
132
+ - `/flow -enable refactor` — lock to refactor workflow
133
+ - `/flow -enable security` — lock to security workflow
134
+
135
+ When locked, ALL actionable inputs use the locked type regardless of signals.
136
+
137
+ ### Default Behavior
126
138
 
127
- - `/flow -enable feature` (default)
128
- - `/flow -enable bugfix`
129
- - `/flow -enable refactor`
130
- - `/flow -enable security`
139
+ - `/flow -enable` (no type) → auto-detect mode (recommended)
140
+ - `/flow -enable <type>` → locked mode
131
141
 
132
142
  ### Complexity Thresholds
133
143
 
@@ -1,27 +1,56 @@
1
1
  ---
2
2
  name: flow
3
- description: Toggle autopilot flow mode - automatically orchestrates discovery, planning, execution, and review for feature requests
3
+ description: Toggle autopilot flow mode - automatically orchestrates discovery, planning, execution, and review with auto-detect or locked workflow types
4
4
  metadata: {"openclaw":{"requires":{"bins":["git"]}}}
5
5
  user-invocable: true
6
6
  ---
7
7
 
8
8
  # Flow: Autopilot Mode Toggle
9
9
 
10
- Enables or disables autopilot flow mode. When enabled, feature requests automatically run the full plan-flow workflow without manual command invocation.
10
+ Enables or disables autopilot flow mode. When enabled, actionable requests automatically run the full plan-flow workflow without manual command invocation.
11
11
 
12
12
  ## Usage
13
13
 
14
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
15
+ /flow -enable Enable autopilot with auto-detect (default)
16
+ /flow -enable [type] Enable autopilot locked to a specific workflow type
17
+ /flow -disable Disable autopilot mode
18
+ /flow -status Show current state and mode
19
+ /flow Same as -status
20
+ /flow -help Show help
20
21
  ```
21
22
 
23
+ ## Modes
24
+
25
+ ### Auto-Detect (Default)
26
+
27
+ `/flow -enable` activates autopilot with auto-detect mode. Each actionable request is independently classified using signal analysis:
28
+
29
+ | Priority | Workflow | Input Signals |
30
+ |----------|----------|---------------|
31
+ | 1 | **security** | "security", "vulnerability", "auth", "XSS", "injection", "encrypt", "permissions" |
32
+ | 2 | **bugfix** | "fix", "bug", "broken", "error", "regression", "crash", "not working" |
33
+ | 3 | **refactor** | "refactor", "restructure", "clean up", "tech debt", "migrate", "reorganize" |
34
+ | 4 | **feature** | everything else (default) |
35
+
36
+ ### Locked Mode
37
+
38
+ `/flow -enable <type>` locks autopilot to a specific workflow type. ALL actionable inputs use the locked type regardless of signals.
39
+
40
+ Valid types: `feature`, `bugfix`, `refactor`, `security`
41
+
42
+ ## Workflow Types
43
+
44
+ | Type | When to Use | Steps |
45
+ |------|-------------|-------|
46
+ | feature | New functionality, behavior changes | contracts → discovery → plan → execute → review → archive |
47
+ | bugfix | Bug reports, error fixes | review (diagnostic) → plan → execute → review (verification) → archive |
48
+ | refactor | Code restructuring, tech debt | review (baseline) → discovery → plan → execute → review (comparison) → archive |
49
+ | security | Vulnerability fixes, auth changes | review (audit) → discovery → plan → execute → review (verification) → archive |
50
+
22
51
  ## How It Works
23
52
 
24
- **State**: Stored in `flow/.autopilot` (empty marker file). Create to enable, delete to disable.
53
+ **State**: Stored in `flow/.autopilot`. File content: `auto` for auto-detect, or a specific type for locked mode.
25
54
 
26
55
  ### When Enabled
27
56
 
@@ -31,51 +60,47 @@ Every user input is classified:
31
60
  |----------|---------|--------|
32
61
  | Slash Command | Starts with `/` | Run normally, no flow |
33
62
  | 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
63
+ | Trivial Task | Single-file, obvious fix, below threshold | Execute directly, no flow |
64
+ | Actionable Request | Meets complexity threshold | **Trigger flow** (auto-detected or locked type) |
45
65
 
46
66
  ### Mandatory Checkpoints
47
67
 
48
68
  Even in autopilot, these always pause for user input:
49
69
 
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 |
70
+ | Checkpoint | Workflows | Why |
71
+ |------------|-----------|-----|
72
+ | Discovery Q&A | feature, refactor, security | User must answer requirements questions |
73
+ | Plan Approval | all workflows | User must approve plan before execution |
74
+ | Security Review | security only | User must approve post-execution security review |
55
75
 
56
76
  ### When Disabled
57
77
 
58
78
  Commands run individually as normal:
59
- `/discovery` → `/create-plan` → `/execute-plan` → `/review-code`
79
+ `/discovery-plan` → `/create-plan` → `/execute-plan` → `/review-code`
60
80
 
61
81
  ## Toggle Commands
62
82
 
63
83
  ### Enable
64
- 1. Create `flow/.autopilot` (empty file)
65
- 2. Confirm to user that autopilot is enabled
84
+ 1. Parse argument: no type → write `auto`, specific type → write the type name
85
+ 2. Create `flow/.autopilot` with the mode as content
86
+ 3. Confirm to user with mode and workflow details
66
87
 
67
88
  ### Disable
68
89
  1. Delete `flow/.autopilot`
69
- 2. Confirm to user that autopilot is disabled
90
+ 2. Delete `flow/state/autopilot-progress.md` (if exists)
91
+ 3. Confirm to user that autopilot is disabled
70
92
 
71
93
  ### Status
72
94
  1. Check if `flow/.autopilot` exists
73
- 2. Report current state (ENABLED/DISABLED)
95
+ 2. Read content to determine mode (`auto` vs locked type)
96
+ 3. Check `flow/state/autopilot-progress.md` for active workflow progress
97
+ 4. Report current state
74
98
 
75
99
  ## Critical Rules
76
100
 
77
101
  | Rule | Description |
78
102
  |------|-------------|
79
103
  | **File-based state** | State is stored in `flow/.autopilot` - create to enable, delete to disable |
104
+ | **Mode in file content** | File content is `auto` (auto-detect) or a specific type for locked mode |
80
105
  | **No other side effects** | This command ONLY manages the marker file. It does not run any workflow steps. |
81
106
  | **Complete and stop** | After toggling state, STOP and wait for user input |