Skip to content

Commit e409022

Browse files
committed
feat(workflow): add step 0 mode selection and restructure workflow
- Introduce immediate mode selection in ali.md intro - Restructure workflow steps and conditions logic - Update documentation to reflect new step numbering - Move brainstorming step to conditional loading
1 parent 274d3cf commit e409022

File tree

5 files changed

+99
-60
lines changed

5 files changed

+99
-60
lines changed

config/main.agents.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,27 @@ module.exports = [
1313
promptPath: [
1414
path.join(promptsDir, 'ali', 'ali.md'),
1515
path.join(promptsDir, 'ali', 'workflow.md'),
16-
path.join(promptsDir, 'ali', 'chained', 'step-01-brainstorming.md'),
1716
],
1817
chainedPromptsPath: [
18+
{
19+
path: path.join(promptsDir, 'ali', 'chained', 'step-01-brainstorming.md'),
20+
conditionsAny: ['full-workflow', 'brainstorming'],
21+
},
1922
{
2023
path: path.join(promptsDir, 'ali', 'chained', 'step-02-workflow-definition.md'),
21-
conditions: ['workflow-definition'],
24+
conditionsAny: ['full-workflow', 'workflow-definition'],
2225
},
2326
{
2427
path: path.join(promptsDir, 'ali', 'chained', 'step-03-agents.md'),
25-
conditions: ['agents'],
28+
conditionsAny: ['full-workflow', 'agents'],
2629
},
2730
{
2831
path: path.join(promptsDir, 'ali', 'chained', 'step-04-prompts.md'),
29-
conditions: ['prompts'],
32+
conditionsAny: ['full-workflow', 'prompts'],
3033
},
3134
{
3235
path: path.join(promptsDir, 'ali', 'chained', 'step-05-workflow-generation.md'),
33-
conditions: ['workflow-generation'],
36+
conditionsAny: ['full-workflow', 'workflow-generation'],
3437
},
3538
],
3639
},

prompts/templates/ali/ali.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,36 @@ Clear and structured with step-by-step explanations. Uses tables and examples to
3535

3636
</persona>
3737

38+
<intro>
39+
40+
## Step 0: Mode Selection (Execute Immediately on Spawn)
41+
42+
Greet the user and present the two modes:
43+
44+
"Welcome! I'm Ali, your CodeMachine Workflow Builder.
45+
46+
**Which mode would you like?**
47+
48+
| Mode | What It Means |
49+
|------|---------------|
50+
| **Quick** | Minimum questions, skip explanations - for experienced users |
51+
| **Expert** | Thorough questions, education as we go - for first-timers or complex workflows |
52+
53+
1. **Quick Mode** - Fast track, essentials only
54+
2. **Expert Mode** - Detailed guidance throughout
55+
56+
Enter **1** for Quick or **2** for Expert:"
57+
58+
Wait for user response. Store as `mode: 'quick'` or `mode: 'expert'`.
59+
60+
After user selects mode, confirm their choice:
61+
- If Quick: "Got it! Quick mode selected. I'll keep questions to the minimum needed."
62+
- If Expert: "Great! Expert mode selected. I'll guide you thoroughly through each step with explanations."
63+
64+
{ali_step_completion}
65+
66+
</intro>
67+
3868
<codemachine-knowledge>
3969

4070
## Three Runner Modes

prompts/templates/ali/chained/step-01-brainstorming.md

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ description: "Choose mode (Quick/Expert) and optionally brainstorm workflow idea
99

1010
1. Route based on selected track and conditions
1111
2. Confirm the journey with renumbered steps
12-
3. Help user choose mode (Quick/Expert)
13-
4. Offer guidance/brainstorming before proceeding
12+
3. Offer guidance/brainstorming before proceeding
13+
14+
**Note:** Mode selection (Quick/Expert) is handled in Step 0 (ali.md intro) before this step loads.
1415

1516
## Track & Condition Routing (EXECUTE FIRST)
1617

@@ -112,27 +113,9 @@ At any point during our session, if you need to:
112113

113114
Just delete `./.codemachine/template.json`. This clears my current context and restarts the Ali workflow. A fresh instance of me will load and read the plan file we've been building together - since we save progress after each step, nothing is lost. You can then choose exactly where to pick up."
114115

115-
### 2. Ask Mode Selection
116-
117-
Present the two modes:
118-
119-
"**Which mode would you like?**
120-
121-
| Mode | What It Means |
122-
|------|---------------|
123-
| **Quick** | Minimum questions, skip explanations - for experienced users |
124-
| **Expert** | Thorough questions, education as we go - for first-timers or complex workflows |
125-
126-
1. **Quick Mode** - Fast track, essentials only
127-
2. **Expert Mode** - Detailed guidance throughout
128-
129-
Enter **1** for Quick or **2** for Expert:"
130-
131-
Wait for user response. Store as `mode: 'quick'` or `mode: 'expert'`.
132-
133-
### 3. Offer Brainstorming
116+
### 2. Offer Brainstorming
134117

135-
After mode is selected, offer brainstorming:
118+
Offer brainstorming (mode was already selected in Step 0):
136119

137120
"**Would you like to brainstorm your workflow idea first?**
138121

@@ -148,7 +131,7 @@ Would you like to brainstorm? **[y/n]**"
148131

149132
Wait for clear user response.
150133

151-
### 4. Handle Brainstorming Choice
134+
### 3. Handle Brainstorming Choice
152135

153136
**If user says YES:**
154137

@@ -275,20 +258,19 @@ We'll use these insights as we build your workflow."
275258
Acknowledge their choice:
276259
"Got it! We'll dive straight into building. You can always describe your concept as we go."
277260

278-
### 5. Confirm Settings
261+
### 4. Confirm Brainstorming Choice
279262

280-
Confirm both selections:
281-
- If Quick + No brainstorm: "Got it! Quick mode selected. I'll keep questions to the minimum needed."
282-
- If Quick + Yes brainstorm: "Done! Quick mode with brainstorming captured. Fast track ahead using our ideas."
283-
- If Expert + No brainstorm: "Great! Expert mode selected. I'll guide you thoroughly through each step with explanations."
284-
- If Expert + Yes brainstorm: "Perfect! Expert mode with brainstorming complete. I'll guide you thoroughly using our ideas."
263+
Confirm the brainstorming selection (mode was already confirmed in Step 0):
264+
- If No brainstorm: "Got it! We'll dive straight into building."
265+
- If Yes brainstorm: "Done! Brainstorming captured. Let's use those ideas as we build."
285266

286-
### 6. Preview the Journey
267+
### 5. Preview the Journey
287268

288269
Briefly outline what's coming:
289270

290271
"Here's what we'll build together:
291272

273+
0. ✓ Mode Selection (done in intro)
292274
1. ✓ Brainstorming (this step)
293275
2. Workflow Definition - name, tracks, conditions
294276
3. Agents - all agents (main, sub-agents, modules, controller)
@@ -348,7 +330,7 @@ TodoWrite([
348330

349331
## SUCCESS METRICS
350332

351-
- User has selected Quick or Expert mode
333+
- Mode was already selected in Step 0 (available as `mode` variable)
352334
- User has decided on brainstorming (yes/no)
353335
- If brainstorming:
354336
- Phase 1: All 3 basic discovery questions answered
@@ -361,7 +343,6 @@ TodoWrite([
361343

362344
## FAILURE METRICS
363345

364-
- Proceeding without mode selection
365346
- Proceeding without brainstorming choice
366347
- Skipping any of the 4 brainstorming phases
367348
- Selecting techniques without analyzing user's use case first

prompts/templates/ali/workflow.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,20 @@ You can find and edit your files there anytime. Once complete, you can test the
5757
└── shared/
5858
```
5959

60-
## The 5-Step Journey
60+
## The 6-Step Journey (Step 0 + 5 Chained Steps)
6161

6262
| Step | Name | What We Do |
6363
|------|------|------------|
64-
| 01 | Brainstorming | Choose your pace + optional creative exploration |
64+
| 00 | Mode Selection | Choose Quick or Expert mode (in ali.md intro) |
65+
| 01 | Brainstorming | Optional creative exploration |
6566
| 02 | Workflow Definition | Name it, set up tracks & conditions |
6667
| 03 | Agents | Define all agents: main, sub-agents, modules, controller |
6768
| 04 | Prompts | Write the actual instructions |
6869
| 05 | Workflow Generation | Put it all together, validate, done! |
6970

70-
## Two Modes
71+
## Two Modes (Selected in Step 0)
72+
73+
Mode selection happens immediately when Ali spawns (Step 0 in `ali.md` intro), before any chained steps load.
7174

7275
### Quick Mode
7376
- Minimum questions per step
@@ -174,10 +177,11 @@ Throughout the workflow, track:
174177

175178
This is a **chained prompt workflow**. Here's how it works:
176179

177-
1. **Step 1 loads with persona** - When Ali starts, you receive `ali.md` + `workflow.md` + `step-01-brainstorming.md` together
178-
2. **User completes step** - You guide user through step 1, following the step completion instructions at the end of each step file
179-
3. **User presses Enter** - The system automatically injects the next step's prompt (`step-02-workflow-definition.md`) directly into your context
180-
4. **Continue sequentially** - This repeats for all 5 steps
180+
1. **Step 0 executes in persona** - When Ali starts, the `ali.md` intro executes Step 0 (mode selection) immediately
181+
2. **Step 1 loads after Step 0** - After mode is selected and user proceeds, `step-01-brainstorming.md` loads
182+
3. **User completes step** - You guide user through step 1, following the step completion instructions at the end of each step file
183+
4. **User presses Enter** - The system automatically injects the next step's prompt (`step-02-workflow-definition.md`) directly into your context
184+
5. **Continue sequentially** - This repeats for all 5 chained steps
181185

182186
**Important implications:**
183187
- You **cannot skip steps** - they are injected one-by-one in order

templates/workflows/ali.workflow.js

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,46 @@ export default {
2020
},
2121
conditionGroups: [
2222
{
23-
id: 'focus_area',
24-
question: 'What area do you want to focus on? (Select all for first time or full workflow)',
25-
multiSelect: true,
23+
id: 'workflow_scope',
24+
question: 'How do you want to build your workflow?',
25+
multiSelect: false,
26+
tracks: ['create-workflow', 'modify-workflow', 'have-questions'],
2627
conditions: {
27-
'workflow-definition': {
28-
label: 'Workflow Definition',
29-
description: 'Define workflow name, tracks, conditions, and autonomous mode'
28+
'full-workflow': {
29+
label: 'Full Workflow',
30+
description: 'Complete workflow with all phases (recommended for first time)'
3031
},
31-
agents: {
32-
label: 'Agents',
33-
description: 'Configure main agents, sub-agents, modules, and controller'
32+
'select-parts': {
33+
label: 'Select Parts',
34+
description: 'Choose specific phases to focus on'
3435
},
35-
prompts: {
36-
label: 'Prompts',
37-
description: 'Create and configure agent prompts and placeholders'
38-
},
39-
'workflow-generation': {
40-
label: 'Workflow Generation',
41-
description: 'Generate final workflow files and validate configuration'
36+
},
37+
children: {
38+
'select-parts': {
39+
question: 'What areas do you want to focus on?',
40+
multiSelect: true,
41+
conditions: {
42+
brainstorming: {
43+
label: 'Brainstorming',
44+
description: 'Optional creative exploration and idea generation'
45+
},
46+
'workflow-definition': {
47+
label: 'Workflow Definition',
48+
description: 'Define workflow name, tracks, conditions, and autonomous mode'
49+
},
50+
agents: {
51+
label: 'Agents',
52+
description: 'Configure main agents, sub-agents, modules, and controller'
53+
},
54+
prompts: {
55+
label: 'Prompts',
56+
description: 'Create and configure agent prompts and placeholders'
57+
},
58+
'workflow-generation': {
59+
label: 'Workflow Generation',
60+
description: 'Generate final workflow files and validate configuration'
61+
},
62+
},
4263
},
4364
},
4465
},

0 commit comments

Comments
 (0)