@looplia/looplia-cli 0.6.6
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.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +33216 -0
- package/package.json +55 -0
- package/plugins/looplia-core/.claude-plugin/plugin.json +10 -0
- package/plugins/looplia-core/commands/build-workflow.md +92 -0
- package/plugins/looplia-core/commands/build.md +71 -0
- package/plugins/looplia-core/commands/list-workflows.md +55 -0
- package/plugins/looplia-core/commands/run.md +50 -0
- package/plugins/looplia-core/hooks/hooks.json +27 -0
- package/plugins/looplia-core/scripts/hooks/compact-inject-state.sh +36 -0
- package/plugins/looplia-core/scripts/hooks/post-write-validate.sh +81 -0
- package/plugins/looplia-core/scripts/hooks/stop-guard.sh +56 -0
- package/plugins/looplia-core/skills/plugin-registry-scanner/SKILL.md +108 -0
- package/plugins/looplia-core/skills/plugin-registry-scanner/scripts/scan-plugins.ts +221 -0
- package/plugins/looplia-core/skills/plugin-registry-scanner/test/scan-plugins.test.ts +256 -0
- package/plugins/looplia-core/skills/search/SKILL.md +174 -0
- package/plugins/looplia-core/skills/skill-capability-matcher/SKILL.md +378 -0
- package/plugins/looplia-core/skills/workflow-executor/SKILL.md +469 -0
- package/plugins/looplia-core/skills/workflow-executor-inline/SKILL.md +217 -0
- package/plugins/looplia-core/skills/workflow-schema-composer/SCHEMA.md +214 -0
- package/plugins/looplia-core/skills/workflow-schema-composer/SKILL.md +373 -0
- package/plugins/looplia-core/skills/workflow-schema-composer/templates/workflow.md.template +44 -0
- package/plugins/looplia-core/skills/workflow-validator/SKILL.md +171 -0
- package/plugins/looplia-core/skills/workflow-validator/scripts/validate.ts +244 -0
- package/plugins/looplia-writer/.claude-plugin/plugin.json +10 -0
- package/plugins/looplia-writer/README.md +107 -0
- package/plugins/looplia-writer/skills/content-documenter/SKILL.md +189 -0
- package/plugins/looplia-writer/skills/id-generator/SKILL.md +120 -0
- package/plugins/looplia-writer/skills/idea-synthesis/SKILL.md +162 -0
- package/plugins/looplia-writer/skills/media-reviewer/SKILL.md +105 -0
- package/plugins/looplia-writer/skills/user-profile-reader/SKILL.md +94 -0
- package/plugins/looplia-writer/skills/writing-enhancer/SKILL.md +34 -0
- package/plugins/looplia-writer/skills/writing-kit-assembler/SKILL.md +206 -0
- package/plugins/looplia-writer/workflows/writing-kit.md +134 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workflow-executor
|
|
3
|
+
description: |
|
|
4
|
+
This skill should be used when the user wants to execute a looplia workflow, run workflow
|
|
5
|
+
steps, or process a workflow.md file. Use when someone says "run the looplia workflow",
|
|
6
|
+
"execute this looplia pipeline", "/run writing-kit", "start the looplia automation", or
|
|
7
|
+
"process these workflow steps".
|
|
8
|
+
|
|
9
|
+
Architecture: One workflow step triggers one skill-executor subagent call, which then
|
|
10
|
+
invokes multiple skills to accomplish the step's mission. Handles sandbox management,
|
|
11
|
+
per-step skill-executor orchestration, and validation state tracking per v0.6.3.
|
|
12
|
+
|
|
13
|
+
v0.6.3: Named inputs (${{ inputs.name }}), input-less workflow support.
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Workflow Executor Skill (v0.6.3)
|
|
17
|
+
|
|
18
|
+
Execute looplia workflows defined in `workflows/*.md` files using the skills-first architecture.
|
|
19
|
+
|
|
20
|
+
## When to Use
|
|
21
|
+
|
|
22
|
+
Use this skill when:
|
|
23
|
+
- Handling `/run` commands
|
|
24
|
+
- Executing workflow-as-markdown definitions
|
|
25
|
+
- Orchestrating multi-step skill workflows
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## CRITICAL: Universal Skill-Executor Invocation
|
|
30
|
+
|
|
31
|
+
**v0.6.1 BREAKING CHANGE:** ALL workflow steps use `skill-executor` subagent.
|
|
32
|
+
|
|
33
|
+
When executing a step with `skill: {name}` and `mission:`:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"subagent_type": "skill-executor",
|
|
38
|
+
"description": "Execute step: {step.id}",
|
|
39
|
+
"prompt": "Execute skill '{step.skill}' for step '{step.id}'.\n\nMission: {step.mission}\n\nInput: {resolved input}\nOutput: {step.output}\nValidation: {step.validate}"
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Example:**
|
|
44
|
+
```yaml
|
|
45
|
+
- id: analyze-content
|
|
46
|
+
skill: media-reviewer
|
|
47
|
+
mission: |
|
|
48
|
+
Deep analysis of video transcript. Extract key themes,
|
|
49
|
+
important quotes, and narrative structure.
|
|
50
|
+
input: ${{ sandbox }}/inputs/content.md
|
|
51
|
+
output: ${{ sandbox }}/outputs/analysis.json
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Task tool call:**
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"subagent_type": "skill-executor",
|
|
58
|
+
"description": "Execute step: analyze-content",
|
|
59
|
+
"prompt": "Execute skill 'media-reviewer' for step 'analyze-content'.\n\nMission: Deep analysis of video transcript. Extract key themes, important quotes, and narrative structure.\n\nInput: sandbox/video-2025-01-15-abc123/inputs/content.md\nOutput: sandbox/video-2025-01-15-abc123/outputs/analysis.json\nValidation: {\"required_fields\":[\"contentId\",\"headline\",\"keyThemes\"]}"
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Rules
|
|
64
|
+
|
|
65
|
+
- **ALWAYS** use `subagent_type: "skill-executor"` for ALL workflow steps
|
|
66
|
+
- **NEVER** use custom subagent_type per step (removed in v0.6.1)
|
|
67
|
+
- **NEVER** use `subagent_type: "general-purpose"` for workflow steps
|
|
68
|
+
- **VALIDATE** that step has both `skill:` and `mission:` fields
|
|
69
|
+
- **REJECT** steps using deprecated `run:` syntax
|
|
70
|
+
|
|
71
|
+
### Why Per-Step Task Calls (Context Isolation)
|
|
72
|
+
|
|
73
|
+
Each `Task(skill-executor)` creates a **separate context window**:
|
|
74
|
+
- Isolates step processing from main agent context
|
|
75
|
+
- Prevents context pollution across steps
|
|
76
|
+
- Enables focused execution with only relevant inputs
|
|
77
|
+
|
|
78
|
+
**NEVER batch multiple steps** - this defeats context isolation.
|
|
79
|
+
|
|
80
|
+
### Anti-Patterns
|
|
81
|
+
|
|
82
|
+
❌ **WRONG - Delegating entire workflow:**
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"description": "Execute workflow: writing-kit",
|
|
86
|
+
"prompt": "Run all workflow steps..."
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
This pollutes the subagent context with ALL steps.
|
|
90
|
+
|
|
91
|
+
✅ **CORRECT - One step per Task:**
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"description": "Execute step: summary",
|
|
95
|
+
"prompt": "Execute skill 'media-reviewer' for step 'summary'..."
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
Each step gets a fresh, focused context window.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Step Field Validation (v0.6.3)
|
|
103
|
+
|
|
104
|
+
Before executing a step, validate:
|
|
105
|
+
|
|
106
|
+
| Field | Required | Error if Missing |
|
|
107
|
+
|-------|----------|------------------|
|
|
108
|
+
| `skill` | **Yes** | "Step '{id}' missing required 'skill' field" |
|
|
109
|
+
| `mission` | **Yes** | "Step '{id}' missing required 'mission' field" |
|
|
110
|
+
| `input` | **Conditional** | Required unless skill is input-less capable (e.g., `search`) |
|
|
111
|
+
| `output` | **Yes** | "Step '{id}' missing required 'output' field" |
|
|
112
|
+
| `run` | **FORBIDDEN** | "Step '{id}' uses deprecated 'run:' syntax. Migrate to 'skill:' + 'mission:'" |
|
|
113
|
+
|
|
114
|
+
### Input-less Capable Skills
|
|
115
|
+
|
|
116
|
+
These skills can operate without an `input` field:
|
|
117
|
+
- `search` - Executes search missions autonomously
|
|
118
|
+
|
|
119
|
+
Example input-less step:
|
|
120
|
+
```yaml
|
|
121
|
+
- id: find-news
|
|
122
|
+
skill: search
|
|
123
|
+
mission: |
|
|
124
|
+
Search Hacker News for today's top 3 AI stories.
|
|
125
|
+
Extract title, URL, points, and brief summary.
|
|
126
|
+
output: ${{ sandbox }}/outputs/news.json
|
|
127
|
+
# No input field - search operates autonomously
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Execution Protocol
|
|
133
|
+
|
|
134
|
+
### Phase 1: Sandbox Setup
|
|
135
|
+
|
|
136
|
+
**New Sandbox with Named Inputs** (v0.6.3 - when `--input` provided):
|
|
137
|
+
|
|
138
|
+
1. Generate sandbox ID:
|
|
139
|
+
```
|
|
140
|
+
{first-input-name}-{YYYY-MM-DD}-{random4chars}
|
|
141
|
+
Example: video-transcript-2025-12-18-xk7m
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
2. Create folder structure:
|
|
145
|
+
```
|
|
146
|
+
sandbox/{sandbox-id}/
|
|
147
|
+
├── inputs/
|
|
148
|
+
│ ├── video-transcript.md # Named input files
|
|
149
|
+
│ └── user-notes.md
|
|
150
|
+
├── outputs/ # Step outputs go here
|
|
151
|
+
├── logs/ # Session logs
|
|
152
|
+
└── validation.json # Validation state
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
3. Copy each input file to `inputs/{name}.md`
|
|
156
|
+
|
|
157
|
+
**New Sandbox with Single File** (legacy - when `--file` provided):
|
|
158
|
+
|
|
159
|
+
1. Generate sandbox ID:
|
|
160
|
+
```
|
|
161
|
+
{content-slug}-{YYYY-MM-DD}-{random4chars}
|
|
162
|
+
Example: my-article-2025-12-18-xk7m
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
2. Create folder structure and copy to `inputs/content.md`
|
|
166
|
+
|
|
167
|
+
**Input-less Sandbox** (v0.6.3 - no inputs required):
|
|
168
|
+
|
|
169
|
+
For workflows using only input-less capable skills (e.g., `search`):
|
|
170
|
+
|
|
171
|
+
1. Generate sandbox ID from workflow name:
|
|
172
|
+
```
|
|
173
|
+
{workflow-slug}-{YYYY-MM-DD}-{random4chars}
|
|
174
|
+
Example: hn-reporter-2025-12-18-xk7m
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
2. Create folder structure with empty `inputs/` directory
|
|
178
|
+
|
|
179
|
+
**Resume Sandbox** (when `--sandbox-id` provided):
|
|
180
|
+
|
|
181
|
+
1. Verify sandbox exists
|
|
182
|
+
2. Load `validation.json` to see completed steps
|
|
183
|
+
3. Continue from first incomplete step
|
|
184
|
+
|
|
185
|
+
### Phase 2: Workflow Parsing
|
|
186
|
+
|
|
187
|
+
1. Read workflow file: `workflows/{workflow-id}.md`
|
|
188
|
+
|
|
189
|
+
2. Parse YAML frontmatter:
|
|
190
|
+
```yaml
|
|
191
|
+
name: workflow-name
|
|
192
|
+
version: 1.0.0
|
|
193
|
+
description: ...
|
|
194
|
+
steps:
|
|
195
|
+
- id: step-one
|
|
196
|
+
skill: skill-name
|
|
197
|
+
mission: |
|
|
198
|
+
Task description...
|
|
199
|
+
input: ...
|
|
200
|
+
output: ...
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
3. **Validate each step** has `skill:` and `mission:` (reject `run:`)
|
|
204
|
+
|
|
205
|
+
4. Build dependency graph from `needs:` fields
|
|
206
|
+
|
|
207
|
+
### Phase 3: Validation State
|
|
208
|
+
|
|
209
|
+
**Generate validation.json** (new sandbox):
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"workflow": "writing-kit",
|
|
214
|
+
"version": "2.0.0",
|
|
215
|
+
"sandboxId": "article-2025-12-18-xk7m",
|
|
216
|
+
"createdAt": "2025-12-18T10:30:00Z",
|
|
217
|
+
"steps": {
|
|
218
|
+
"analyze-content": {
|
|
219
|
+
"output": "outputs/analysis.json",
|
|
220
|
+
"validated": false
|
|
221
|
+
},
|
|
222
|
+
"generate-ideas": {
|
|
223
|
+
"output": "outputs/ideas.json",
|
|
224
|
+
"validated": false
|
|
225
|
+
},
|
|
226
|
+
"build-writing-kit": {
|
|
227
|
+
"output": "outputs/writing-kit.json",
|
|
228
|
+
"validated": false
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Phase 4: Dependency Resolution
|
|
235
|
+
|
|
236
|
+
Compute execution order using topological sort:
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
Input:
|
|
240
|
+
analyze-content: { needs: [] }
|
|
241
|
+
generate-ideas: { needs: [analyze-content] }
|
|
242
|
+
build-writing-kit: { needs: [analyze-content, generate-ideas] }
|
|
243
|
+
|
|
244
|
+
Computed order: [analyze-content, generate-ideas, build-writing-kit]
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Phase 5: Step Execution Loop
|
|
248
|
+
|
|
249
|
+
**Execute steps ONE AT A TIME (context isolation):**
|
|
250
|
+
|
|
251
|
+
1. Get first unvalidated step from dependency order
|
|
252
|
+
2. Make ONE `Task(skill-executor)` call for THIS step only
|
|
253
|
+
3. WAIT for Task completion before proceeding
|
|
254
|
+
4. Validate output, update validation.json
|
|
255
|
+
5. REPEAT for next unvalidated step
|
|
256
|
+
6. STOP when ALL steps are validated
|
|
257
|
+
|
|
258
|
+
**MANDATORY:** Each step = separate context window = separate Task call.
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
FOR EACH step in dependency order:
|
|
262
|
+
│
|
|
263
|
+
▼
|
|
264
|
+
┌─────────────────────────────────────────┐
|
|
265
|
+
│ Check: output exists AND validated? │
|
|
266
|
+
└────────────────┬────────────────────────┘
|
|
267
|
+
│
|
|
268
|
+
┌───────┴───────┐
|
|
269
|
+
│ │
|
|
270
|
+
▼ YES ▼ NO
|
|
271
|
+
┌─────────┐ ┌─────────────────────────────┐
|
|
272
|
+
│ SKIP │ │ 1. INVOKE Task tool: │
|
|
273
|
+
│ (done) │ │ subagent_type: │
|
|
274
|
+
└─────────┘ │ "skill-executor" │
|
|
275
|
+
│ │
|
|
276
|
+
│ 2. skill-executor invokes │
|
|
277
|
+
│ the specified skill │
|
|
278
|
+
│ │
|
|
279
|
+
│ 3. VALIDATE output │
|
|
280
|
+
│ │
|
|
281
|
+
│ 4. UPDATE validation.json │
|
|
282
|
+
│ │
|
|
283
|
+
│ 5. IF FAILED: retry (max 2x) │
|
|
284
|
+
└─────────────────────────────┘
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Phase 6: Task Tool Invocation
|
|
288
|
+
|
|
289
|
+
For step:
|
|
290
|
+
```yaml
|
|
291
|
+
- id: analyze-content
|
|
292
|
+
skill: media-reviewer
|
|
293
|
+
mission: |
|
|
294
|
+
Deep analysis of video transcript. Extract key themes,
|
|
295
|
+
important quotes with timestamps, and narrative structure.
|
|
296
|
+
input: ${{ sandbox }}/inputs/content.md
|
|
297
|
+
output: ${{ sandbox }}/outputs/analysis.json
|
|
298
|
+
validate:
|
|
299
|
+
required_fields: [contentId, headline, keyThemes]
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Invoke Task tool:
|
|
303
|
+
```json
|
|
304
|
+
{
|
|
305
|
+
"subagent_type": "skill-executor",
|
|
306
|
+
"description": "Execute step: analyze-content",
|
|
307
|
+
"prompt": "Execute skill 'media-reviewer' for step 'analyze-content'.\n\nMission: Deep analysis of video transcript. Extract key themes, important quotes with timestamps, and narrative structure.\n\nInput: sandbox/article-2025-12-18-xk7m/inputs/content.md\nOutput: sandbox/article-2025-12-18-xk7m/outputs/analysis.json\nValidation: {\"required_fields\":[\"contentId\",\"headline\",\"keyThemes\"]}"
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Phase 7: Validation
|
|
312
|
+
|
|
313
|
+
After step output is written:
|
|
314
|
+
|
|
315
|
+
1. Use **workflow-validator** skill
|
|
316
|
+
2. Run validation script:
|
|
317
|
+
```bash
|
|
318
|
+
bun .claude/skills/workflow-validator/scripts/validate.ts \
|
|
319
|
+
sandbox/{id}/outputs/analysis.json \
|
|
320
|
+
'{"required_fields":["contentId","headline","keyThemes"]}'
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
3. Parse result:
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"passed": true,
|
|
327
|
+
"checks": [
|
|
328
|
+
{ "name": "has_contentId", "passed": true }
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
4. If passed: Update `validation.json` with `validated: true`
|
|
334
|
+
5. If failed: Retry step with feedback (max 2 retries)
|
|
335
|
+
|
|
336
|
+
### Phase 8: Return Final Output
|
|
337
|
+
|
|
338
|
+
When step with `final: true` passes validation:
|
|
339
|
+
|
|
340
|
+
1. Read final artifact from `sandbox/{id}/outputs/{artifact}`
|
|
341
|
+
2. Return structured result:
|
|
342
|
+
```json
|
|
343
|
+
{
|
|
344
|
+
"status": "success",
|
|
345
|
+
"sandboxId": "article-2025-12-18-xk7m",
|
|
346
|
+
"workflow": "writing-kit",
|
|
347
|
+
"artifact": { ... }
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Variable Substitution (v0.6.3)
|
|
354
|
+
|
|
355
|
+
Resolve variables before passing to skill-executor:
|
|
356
|
+
|
|
357
|
+
| Variable | Resolution | Example |
|
|
358
|
+
|----------|------------|---------|
|
|
359
|
+
| `${{ sandbox }}` | `sandbox/{sandbox-id}` | `sandbox/article-2025-12-18-xk7m` |
|
|
360
|
+
| `${{ inputs.{name} }}` | `sandbox/{id}/inputs/{name}.md` | `sandbox/.../inputs/video1.md` |
|
|
361
|
+
| `${{ steps.{id}.output }}` | Output path of step `{id}` | `sandbox/.../outputs/analysis.json` |
|
|
362
|
+
|
|
363
|
+
### Named Inputs (v0.6.3)
|
|
364
|
+
|
|
365
|
+
Workflows can declare named inputs in their frontmatter:
|
|
366
|
+
|
|
367
|
+
```yaml
|
|
368
|
+
inputs:
|
|
369
|
+
- name: video-transcript
|
|
370
|
+
required: true
|
|
371
|
+
description: The video transcript to analyze
|
|
372
|
+
- name: user-notes
|
|
373
|
+
required: false
|
|
374
|
+
description: Optional user notes
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Steps reference inputs via `${{ inputs.name }}`:
|
|
378
|
+
|
|
379
|
+
```yaml
|
|
380
|
+
steps:
|
|
381
|
+
- id: analyze
|
|
382
|
+
skill: media-reviewer
|
|
383
|
+
mission: Analyze the video content
|
|
384
|
+
input: ${{ inputs.video-transcript }}
|
|
385
|
+
output: ${{ sandbox }}/outputs/analysis.json
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
CLI provides inputs via `--input`:
|
|
389
|
+
```bash
|
|
390
|
+
looplia run writing-kit --input video-transcript=video.md --input user-notes=notes.md
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### Step Output References
|
|
394
|
+
|
|
395
|
+
```yaml
|
|
396
|
+
input: ${{ steps.analyze-content.output }}
|
|
397
|
+
# Resolves to: sandbox/article-2025-12-18-xk7m/outputs/analysis.json
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Error Handling
|
|
403
|
+
|
|
404
|
+
| Scenario | Action |
|
|
405
|
+
|----------|--------|
|
|
406
|
+
| Workflow not found | Error with available workflows |
|
|
407
|
+
| Step uses `run:` syntax | Error: "Migrate to skill: + mission: syntax" |
|
|
408
|
+
| Step missing `skill:` | Error: "Step missing required 'skill' field" |
|
|
409
|
+
| Step missing `mission:` | Error: "Step missing required 'mission' field" |
|
|
410
|
+
| Sandbox not found | Error with suggestion to use --file |
|
|
411
|
+
| Step fails | Retry up to 2 times with feedback |
|
|
412
|
+
| Validation fails | Provide specific failed checks to skill-executor |
|
|
413
|
+
| Max retries exceeded | Report failure with details |
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## Example Execution Trace
|
|
418
|
+
|
|
419
|
+
```
|
|
420
|
+
/run writing-kit --file article.md
|
|
421
|
+
|
|
422
|
+
1. [SANDBOX] Created: sandbox/article-2025-12-18-xk7m/
|
|
423
|
+
- inputs/content.md (copied)
|
|
424
|
+
- validation.json (generated)
|
|
425
|
+
|
|
426
|
+
2. [WORKFLOW] Loaded: workflows/writing-kit.md
|
|
427
|
+
- version: 2.0.0
|
|
428
|
+
- steps: [analyze-content, generate-ideas, build-writing-kit]
|
|
429
|
+
|
|
430
|
+
3. [VALIDATE] Schema check passed
|
|
431
|
+
- All steps have skill: field ✓
|
|
432
|
+
- All steps have mission: field ✓
|
|
433
|
+
- No deprecated run: syntax ✓
|
|
434
|
+
|
|
435
|
+
4. [ORDER] Computed: [analyze-content, generate-ideas, build-writing-kit]
|
|
436
|
+
|
|
437
|
+
5. [STEP] analyze-content
|
|
438
|
+
- Task tool: subagent_type="skill-executor"
|
|
439
|
+
- Skill: media-reviewer
|
|
440
|
+
- Output: outputs/analysis.json
|
|
441
|
+
- Validate: PASSED
|
|
442
|
+
- Update: validation.json (analyze-content.validated = true)
|
|
443
|
+
|
|
444
|
+
6. [STEP] generate-ideas
|
|
445
|
+
- Task tool: subagent_type="skill-executor"
|
|
446
|
+
- Skill: idea-synthesis
|
|
447
|
+
- Output: outputs/ideas.json
|
|
448
|
+
- Validate: PASSED
|
|
449
|
+
- Update: validation.json (generate-ideas.validated = true)
|
|
450
|
+
|
|
451
|
+
7. [STEP] build-writing-kit
|
|
452
|
+
- Task tool: subagent_type="skill-executor"
|
|
453
|
+
- Skill: writing-kit-assembler
|
|
454
|
+
- Output: outputs/writing-kit.json
|
|
455
|
+
- Validate: PASSED
|
|
456
|
+
- Update: validation.json (build-writing-kit.validated = true)
|
|
457
|
+
|
|
458
|
+
8. [COMPLETE] Final output: writing-kit.json
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## File References
|
|
464
|
+
|
|
465
|
+
- Workflow definitions: `workflows/*.md`
|
|
466
|
+
- Skill-executor: Inline subagent defined in CLI (see query-executor.ts)
|
|
467
|
+
- Skill definitions: `plugins/*/skills/*/SKILL.md`
|
|
468
|
+
- Sandbox storage: `sandbox/{sandbox-id}/`
|
|
469
|
+
- Validator script: `.claude/skills/workflow-validator/scripts/validate.ts`
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workflow-executor-inline
|
|
3
|
+
description: |
|
|
4
|
+
Inline workflow executor for proxy providers (ZenMux, custom API providers).
|
|
5
|
+
Executes workflow steps directly in the main context WITHOUT spawning Task subagents.
|
|
6
|
+
|
|
7
|
+
Use this skill when:
|
|
8
|
+
- Running looplia workflows via ZenMux or other proxy providers
|
|
9
|
+
- Task subagents fail with "invalid_model" errors
|
|
10
|
+
- You need inline execution without context isolation
|
|
11
|
+
|
|
12
|
+
Architecture: Each workflow step is executed INLINE (no Task tool) - read skill, execute
|
|
13
|
+
mission, write output, then proceed to next step. All steps share the main context.
|
|
14
|
+
|
|
15
|
+
v0.6.6: Created for cross-provider compatibility with ZenMux.
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Workflow Executor Inline (v0.6.6)
|
|
19
|
+
|
|
20
|
+
Execute looplia workflows **without Task subagents**. This skill is specifically designed for proxy providers (ZenMux, custom) where the Claude Agent SDK's subagent spawning doesn't work due to model name incompatibility.
|
|
21
|
+
|
|
22
|
+
## When to Use
|
|
23
|
+
|
|
24
|
+
Use this skill when:
|
|
25
|
+
- The system has injected a hint to use inline execution
|
|
26
|
+
- Running workflows via ZenMux or other proxy providers
|
|
27
|
+
- Task subagents fail with "invalid_model" errors
|
|
28
|
+
|
|
29
|
+
## CRITICAL: Inline Execution (No Subagents)
|
|
30
|
+
|
|
31
|
+
**DO NOT spawn Task subagents.** Execute all workflow steps directly in the main context.
|
|
32
|
+
|
|
33
|
+
For each workflow step:
|
|
34
|
+
|
|
35
|
+
1. **Read the skill definition** using Skill tool: `Skill("{step.skill}")`
|
|
36
|
+
2. **Read input file(s)** if specified using Read tool
|
|
37
|
+
3. **Execute the mission** following skill instructions
|
|
38
|
+
4. **Write JSON output** to specified path using Write tool
|
|
39
|
+
5. **Validate output** (if validation rules defined)
|
|
40
|
+
6. **Proceed to next step**
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Execution Protocol
|
|
45
|
+
|
|
46
|
+
### Phase 1: Sandbox Setup
|
|
47
|
+
|
|
48
|
+
Same as standard workflow-executor:
|
|
49
|
+
|
|
50
|
+
1. Generate sandbox ID:
|
|
51
|
+
```
|
|
52
|
+
{first-input-name}-{YYYY-MM-DD}-{random4chars}
|
|
53
|
+
Example: video-transcript-2025-12-18-xk7m
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
2. Create folder structure:
|
|
57
|
+
```
|
|
58
|
+
sandbox/{sandbox-id}/
|
|
59
|
+
├── inputs/
|
|
60
|
+
│ └── {input-files}.md
|
|
61
|
+
├── outputs/
|
|
62
|
+
├── logs/
|
|
63
|
+
└── validation.json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
3. Copy input files to `inputs/`
|
|
67
|
+
|
|
68
|
+
### Phase 2: Workflow Parsing
|
|
69
|
+
|
|
70
|
+
1. Read workflow file: `workflows/{workflow-id}.md`
|
|
71
|
+
2. Parse YAML frontmatter for steps
|
|
72
|
+
3. Validate each step has `skill:` and `mission:` fields
|
|
73
|
+
4. Build dependency graph from `needs:` fields
|
|
74
|
+
|
|
75
|
+
### Phase 3: Inline Step Execution
|
|
76
|
+
|
|
77
|
+
**Execute steps ONE AT A TIME, INLINE (no Task tool):**
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
FOR EACH step in dependency order:
|
|
81
|
+
│
|
|
82
|
+
▼
|
|
83
|
+
┌─────────────────────────────────────────┐
|
|
84
|
+
│ 1. INVOKE skill: Skill("{step.skill}") │
|
|
85
|
+
│ → This loads skill context │
|
|
86
|
+
│ │
|
|
87
|
+
│ 2. READ input file (if provided) │
|
|
88
|
+
│ → Use Read tool │
|
|
89
|
+
│ │
|
|
90
|
+
│ 3. EXECUTE mission │
|
|
91
|
+
│ → Follow skill instructions │
|
|
92
|
+
│ → Generate JSON output │
|
|
93
|
+
│ │
|
|
94
|
+
│ 4. WRITE output file │
|
|
95
|
+
│ → Use Write tool │
|
|
96
|
+
│ → Output to step.output path │
|
|
97
|
+
│ │
|
|
98
|
+
│ 5. VALIDATE output │
|
|
99
|
+
│ → Check required_fields │
|
|
100
|
+
│ → Retry if failed (max 2x) │
|
|
101
|
+
│ │
|
|
102
|
+
│ 6. UPDATE validation.json │
|
|
103
|
+
│ → Mark step as validated: true │
|
|
104
|
+
└─────────────────────────────────────────┘
|
|
105
|
+
│
|
|
106
|
+
▼
|
|
107
|
+
NEXT STEP
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Example: Inline Execution
|
|
111
|
+
|
|
112
|
+
For step:
|
|
113
|
+
```yaml
|
|
114
|
+
- id: analyze-content
|
|
115
|
+
skill: media-reviewer
|
|
116
|
+
mission: |
|
|
117
|
+
Deep analysis of video transcript. Extract key themes,
|
|
118
|
+
important quotes, and narrative structure.
|
|
119
|
+
input: ${{ sandbox }}/inputs/content.md
|
|
120
|
+
output: ${{ sandbox }}/outputs/analysis.json
|
|
121
|
+
validate:
|
|
122
|
+
required_fields: [contentId, headline, keyThemes]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Inline execution sequence:**
|
|
126
|
+
|
|
127
|
+
1. **Invoke skill:**
|
|
128
|
+
```
|
|
129
|
+
Skill("media-reviewer")
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
2. **Read input:**
|
|
133
|
+
```
|
|
134
|
+
Read("sandbox/video-2025-12-18-xk7m/inputs/content.md")
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
3. **Execute mission:**
|
|
138
|
+
- Follow media-reviewer skill instructions
|
|
139
|
+
- Analyze the content
|
|
140
|
+
- Generate structured JSON output
|
|
141
|
+
|
|
142
|
+
4. **Write output:**
|
|
143
|
+
```
|
|
144
|
+
Write("sandbox/video-2025-12-18-xk7m/outputs/analysis.json", jsonContent)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
5. **Validate:**
|
|
148
|
+
- Check contentId, headline, keyThemes exist
|
|
149
|
+
- Update validation.json
|
|
150
|
+
|
|
151
|
+
6. **Proceed to next step**
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Anti-Patterns
|
|
156
|
+
|
|
157
|
+
❌ **WRONG - Spawning Task subagents:**
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"subagent_type": "workflow-step",
|
|
161
|
+
"description": "Execute step...",
|
|
162
|
+
"prompt": "..."
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
Task subagents don't work with proxy providers.
|
|
166
|
+
|
|
167
|
+
❌ **WRONG - Batching all steps:**
|
|
168
|
+
Execute all steps at once without validation between them.
|
|
169
|
+
|
|
170
|
+
✅ **CORRECT - Inline step-by-step:**
|
|
171
|
+
1. Skill("media-reviewer")
|
|
172
|
+
2. Read input
|
|
173
|
+
3. Execute mission
|
|
174
|
+
4. Write output
|
|
175
|
+
5. Validate
|
|
176
|
+
6. Proceed to next
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Variable Substitution
|
|
181
|
+
|
|
182
|
+
Same as standard workflow-executor:
|
|
183
|
+
|
|
184
|
+
| Variable | Resolution |
|
|
185
|
+
|----------|------------|
|
|
186
|
+
| `${{ sandbox }}` | `sandbox/{sandbox-id}` |
|
|
187
|
+
| `${{ inputs.{name} }}` | `sandbox/{id}/inputs/{name}.md` |
|
|
188
|
+
| `${{ steps.{id}.output }}` | Output path of step `{id}` |
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Error Handling
|
|
193
|
+
|
|
194
|
+
| Scenario | Action |
|
|
195
|
+
|----------|--------|
|
|
196
|
+
| Workflow not found | Error with available workflows |
|
|
197
|
+
| Step missing `skill:` | Error: "Step missing required 'skill' field" |
|
|
198
|
+
| Step missing `mission:` | Error: "Step missing required 'mission' field" |
|
|
199
|
+
| Validation fails | Retry inline with feedback (max 2 retries) |
|
|
200
|
+
| Max retries exceeded | Report failure with details |
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Key Differences from Standard workflow-executor
|
|
205
|
+
|
|
206
|
+
| Aspect | workflow-executor | workflow-executor-inline |
|
|
207
|
+
|--------|------------------|--------------------------|
|
|
208
|
+
| Execution | Task subagent per step | Inline in main context |
|
|
209
|
+
| Context | Isolated per step | Shared main context |
|
|
210
|
+
| Provider Support | Anthropic Direct only | All providers |
|
|
211
|
+
| Use Case | Production (Anthropic) | Proxy providers (ZenMux) |
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Version History
|
|
216
|
+
|
|
217
|
+
- **v0.6.6**: Created for ZenMux cross-provider compatibility
|