You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// File not readable — fall through to 4b (pure intent mode)
86
+
referenceDocContent =null;
87
+
}
88
+
}
89
+
70
90
// Steps will be populated in Step 1.1b
71
91
steps = [];
72
92
}
@@ -102,10 +122,108 @@ if (!workflowContext) {
102
122
103
123
> Skip this step if `inputFormat !== 'natural-language'`.
104
124
105
-
Decompose natural language input into a structured step chain by identifying intent verbs and mapping them to available tools/skills.
125
+
Two sub-modes based on whether a reference document was detected in Step 1.1:
126
+
127
+
#### Mode 4a: Reference Document → LLM Extraction
128
+
129
+
When `referenceDocContent` is available, use Gemini to extract executable workflow steps from the document, guided by the user's intent text.
106
130
107
131
```javascript
108
-
if (inputFormat ==='natural-language') {
132
+
if (inputFormat ==='natural-language'&& referenceDocContent) {
133
+
// ★ 4a: Extract workflow steps from reference document via LLM
134
+
constextractPrompt=`PURPOSE: Extract an executable workflow step chain from the reference document below, guided by the user's intent.
135
+
136
+
USER INTENT: ${naturalLanguageInput}
137
+
REFERENCE DOCUMENT PATH: ${referenceDocPath}
138
+
139
+
REFERENCE DOCUMENT CONTENT:
140
+
${referenceDocContent}
141
+
142
+
TASK:
143
+
1. Read the document and identify the workflow/process it describes (commands, steps, phases, procedures)
144
+
2. Filter by user intent — only extract the steps the user wants to test/tune
145
+
3. For each step, determine:
146
+
- The actual command to execute (shell command, CLI invocation, or skill name)
147
+
- The execution order and dependencies
148
+
- What tool to use (gemini/claude/codex/qwen) and mode (default: write)
149
+
4. Generate a step chain that can be directly executed
150
+
151
+
IMPORTANT:
152
+
- Extract REAL executable commands from the document, not analysis tasks about the document
153
+
- The user wants to RUN these workflow steps, not analyze the document itself
154
+
- If the document describes CLI commands like "maestro init", "maestro plan", etc., those are the steps to extract
155
+
- Preserve the original command syntax from the document
156
+
- Map each command to appropriate tool/mode for ccw cli execution, OR mark as 'command' type for direct shell execution
157
+
- Default mode to "write" — almost all steps produce output artifacts (files, reports, configs), even analysis steps need write permission to save results
158
+
159
+
EXPECTED OUTPUT (strict JSON, no markdown):
160
+
{
161
+
"workflow_name": "<descriptive name>",
162
+
"workflow_context": "<what this workflow achieves>",
163
+
"steps": [
164
+
{
165
+
"name": "<step name>",
166
+
"type": "command|ccw-cli|skill",
167
+
"command": "<the actual command to execute>",
168
+
"tool": "<gemini|claude|codex|qwen or null for shell commands>",
0 commit comments