@davidorex/pi-workflows 0.2.0 → 0.3.0
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/CHANGELOG.md +7 -4
- package/README.md +12 -2
- package/agents/architecture-designer.agent.yaml +58 -0
- package/agents/architecture-inferrer.agent.yaml +60 -0
- package/agents/gap-identifier.agent.yaml +66 -0
- package/agents/handoff-writer.agent.yaml +64 -0
- package/agents/plan-creator.agent.yaml +63 -0
- package/agents/project-definer.agent.yaml +53 -0
- package/agents/project-inferrer.agent.yaml +63 -0
- package/agents/requirements-gatherer.agent.yaml +58 -0
- package/dist/agent-spec.d.ts +27 -0
- package/dist/agent-spec.d.ts.map +1 -0
- package/dist/agent-spec.js +112 -0
- package/dist/agent-spec.js.map +1 -0
- package/dist/checkpoint.d.ts +50 -0
- package/dist/checkpoint.d.ts.map +1 -0
- package/dist/checkpoint.js +109 -0
- package/dist/checkpoint.js.map +1 -0
- package/dist/completion.d.ts +18 -0
- package/dist/completion.d.ts.map +1 -0
- package/dist/completion.js +58 -0
- package/dist/completion.js.map +1 -0
- package/dist/dag.d.ts +56 -0
- package/dist/dag.d.ts.map +1 -0
- package/dist/dag.js +172 -0
- package/dist/dag.js.map +1 -0
- package/dist/dispatch.d.ts +35 -0
- package/dist/dispatch.d.ts.map +1 -0
- package/dist/dispatch.js +311 -0
- package/dist/dispatch.js.map +1 -0
- package/dist/expression.d.ts +64 -0
- package/dist/expression.d.ts.map +1 -0
- package/dist/expression.js +294 -0
- package/dist/expression.js.map +1 -0
- package/dist/format.d.ts +19 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +42 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +675 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +12 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +59 -0
- package/dist/output.js.map +1 -0
- package/dist/state.d.ts +66 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +227 -0
- package/dist/state.js.map +1 -0
- package/dist/step-agent.d.ts +35 -0
- package/dist/step-agent.d.ts.map +1 -0
- package/dist/step-agent.js +156 -0
- package/dist/step-agent.js.map +1 -0
- package/dist/step-command.d.ts +21 -0
- package/dist/step-command.d.ts.map +1 -0
- package/dist/step-command.js +150 -0
- package/dist/step-command.js.map +1 -0
- package/dist/step-foreach.d.ts +33 -0
- package/dist/step-foreach.d.ts.map +1 -0
- package/dist/step-foreach.js +112 -0
- package/dist/step-foreach.js.map +1 -0
- package/dist/step-gate.d.ts +18 -0
- package/dist/step-gate.d.ts.map +1 -0
- package/dist/step-gate.js +137 -0
- package/dist/step-gate.js.map +1 -0
- package/dist/step-loop.d.ts +32 -0
- package/dist/step-loop.d.ts.map +1 -0
- package/dist/step-loop.js +278 -0
- package/dist/step-loop.js.map +1 -0
- package/dist/step-monitor.d.ts +56 -0
- package/dist/step-monitor.d.ts.map +1 -0
- package/dist/step-monitor.js +317 -0
- package/dist/step-monitor.js.map +1 -0
- package/dist/step-parallel.d.ts +43 -0
- package/dist/step-parallel.d.ts.map +1 -0
- package/dist/step-parallel.js +122 -0
- package/dist/step-parallel.js.map +1 -0
- package/{src/step-pause.ts → dist/step-pause.d.ts} +3 -13
- package/dist/step-pause.d.ts.map +1 -0
- package/dist/step-pause.js +22 -0
- package/dist/step-pause.js.map +1 -0
- package/dist/step-shared.d.ts +57 -0
- package/dist/step-shared.d.ts.map +1 -0
- package/dist/step-shared.js +125 -0
- package/dist/step-shared.js.map +1 -0
- package/dist/step-transform.d.ts +11 -0
- package/dist/step-transform.d.ts.map +1 -0
- package/dist/step-transform.js +41 -0
- package/dist/step-transform.js.map +1 -0
- package/dist/template.d.ts +51 -0
- package/dist/template.d.ts.map +1 -0
- package/{src/template.ts → dist/template.js} +32 -38
- package/dist/template.js.map +1 -0
- package/dist/test-helpers.d.ts +17 -0
- package/dist/test-helpers.d.ts.map +1 -0
- package/dist/test-helpers.js +46 -0
- package/dist/test-helpers.js.map +1 -0
- package/dist/tui.d.ts +47 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +143 -0
- package/dist/tui.js.map +1 -0
- package/dist/types.d.ts +164 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/workflow-discovery.d.ts +23 -0
- package/dist/workflow-discovery.d.ts.map +1 -0
- package/dist/workflow-discovery.js +103 -0
- package/dist/workflow-discovery.js.map +1 -0
- package/dist/workflow-executor.d.ts +50 -0
- package/dist/workflow-executor.d.ts.map +1 -0
- package/dist/workflow-executor.js +726 -0
- package/dist/workflow-executor.js.map +1 -0
- package/dist/workflow-sdk.d.ts +44 -0
- package/dist/workflow-sdk.d.ts.map +1 -0
- package/dist/workflow-sdk.js +438 -0
- package/dist/workflow-sdk.js.map +1 -0
- package/dist/workflow-spec.d.ts +33 -0
- package/dist/workflow-spec.d.ts.map +1 -0
- package/dist/workflow-spec.js +464 -0
- package/dist/workflow-spec.js.map +1 -0
- package/dist/workflows-dir.d.ts +3 -0
- package/dist/workflows-dir.d.ts.map +1 -0
- package/{src/workflows-dir.ts → dist/workflows-dir.js} +1 -0
- package/dist/workflows-dir.js.map +1 -0
- package/package.json +53 -38
- package/schemas/decomposition-specs.schema.json +48 -48
- package/schemas/execution-results.schema.json +48 -48
- package/schemas/investigation-findings.schema.json +43 -43
- package/schemas/pattern-analysis.schema.json +41 -41
- package/schemas/phase.schema.json +48 -0
- package/schemas/plan-breakdown.schema.json +20 -20
- package/schemas/quality-analysis.schema.json +33 -33
- package/schemas/research-findings.schema.json +42 -42
- package/schemas/structure-analysis.schema.json +40 -40
- package/schemas/synthesis.schema.json +31 -31
- package/schemas/verifier-output.schema.json +94 -94
- package/skill-narrative.md +84 -0
- package/skills/pi-workflows/SKILL.md +247 -0
- package/templates/architecture-designer/task.md +117 -0
- package/templates/architecture-inferrer/task.md +61 -0
- package/templates/gap-identifier/task.md +103 -0
- package/templates/handoff-writer/task.md +91 -0
- package/templates/plan-creator/task.md +143 -0
- package/templates/project-definer/task.md +67 -0
- package/templates/project-inferrer/task.md +56 -0
- package/templates/requirements-gatherer/task.md +90 -0
- package/workflows/analyze-existing-project.workflow.yaml +74 -0
- package/workflows/create-handoff.workflow.yaml +58 -0
- package/workflows/create-phase.workflow.yaml +1 -1
- package/workflows/do-gap.workflow.yaml +4 -4
- package/workflows/fix-audit.workflow.yaml +1 -1
- package/workflows/gap-to-phase.workflow.yaml +1 -1
- package/workflows/init-new-project.workflow.yaml +55 -0
- package/workflows/plan-from-requirements.workflow.yaml +51 -0
- package/workflows/self-implement.workflow.yaml +3 -3
- package/workflows/typed-analysis.workflow.yaml +4 -4
- package/src/agent-spec.test.ts +0 -289
- package/src/agent-spec.ts +0 -122
- package/src/block-validation.test.ts +0 -350
- package/src/checkpoint.test.ts +0 -237
- package/src/checkpoint.ts +0 -140
- package/src/completion.test.ts +0 -143
- package/src/completion.ts +0 -68
- package/src/dag.test.ts +0 -350
- package/src/dag.ts +0 -219
- package/src/dispatch.test.ts +0 -475
- package/src/dispatch.ts +0 -353
- package/src/expression.test.ts +0 -353
- package/src/expression.ts +0 -332
- package/src/format.test.ts +0 -80
- package/src/format.ts +0 -41
- package/src/graduated-failure.test.ts +0 -556
- package/src/index.test.ts +0 -114
- package/src/index.ts +0 -516
- package/src/loop.test.ts +0 -551
- package/src/output.test.ts +0 -213
- package/src/output.ts +0 -70
- package/src/parallel-integration.test.ts +0 -175
- package/src/resume.test.ts +0 -192
- package/src/state.test.ts +0 -192
- package/src/state.ts +0 -254
- package/src/step-agent.test.ts +0 -327
- package/src/step-agent.ts +0 -178
- package/src/step-command.test.ts +0 -330
- package/src/step-command.ts +0 -132
- package/src/step-foreach.test.ts +0 -647
- package/src/step-foreach.ts +0 -148
- package/src/step-gate.test.ts +0 -185
- package/src/step-gate.ts +0 -116
- package/src/step-loop.test.ts +0 -626
- package/src/step-loop.ts +0 -323
- package/src/step-parallel.test.ts +0 -475
- package/src/step-parallel.ts +0 -168
- package/src/step-pause.test.ts +0 -30
- package/src/step-shared.test.ts +0 -355
- package/src/step-shared.ts +0 -157
- package/src/step-transform.test.ts +0 -155
- package/src/step-transform.ts +0 -47
- package/src/template-integration.test.ts +0 -72
- package/src/template.test.ts +0 -162
- package/src/test-helpers.ts +0 -51
- package/src/tui.test.ts +0 -355
- package/src/tui.ts +0 -182
- package/src/types.ts +0 -195
- package/src/verifier-schema.test.ts +0 -226
- package/src/workflow-discovery.test.ts +0 -105
- package/src/workflow-discovery.ts +0 -114
- package/src/workflow-executor.test.ts +0 -1532
- package/src/workflow-executor.ts +0 -810
- package/src/workflow-sdk.test.ts +0 -238
- package/src/workflow-sdk.ts +0 -262
- package/src/workflow-spec.test.ts +0 -576
- package/src/workflow-spec.ts +0 -471
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
2
|
+
"type": "object",
|
|
3
|
+
"required": ["architecture", "modules", "dependencies"],
|
|
4
|
+
"properties": {
|
|
5
|
+
"architecture": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["patterns", "organization"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"patterns": { "type": "array", "items": { "type": "string" } },
|
|
10
|
+
"organization": { "type": "string" }
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"modules": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"required": ["name", "responsibility", "files"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"name": { "type": "string" },
|
|
20
|
+
"responsibility": { "type": "string" },
|
|
21
|
+
"files": { "type": "array", "items": { "type": "string" } }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"required": ["from", "to", "type"],
|
|
30
|
+
"properties": {
|
|
31
|
+
"from": { "type": "string" },
|
|
32
|
+
"to": { "type": "string" },
|
|
33
|
+
"type": { "type": "string", "enum": ["import", "runtime", "config"] }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"entryPoints": {
|
|
38
|
+
"type": "array",
|
|
39
|
+
"items": { "type": "string" }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
42
|
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
"type": "object",
|
|
3
|
+
"required": ["summary", "findings", "recommendations"],
|
|
4
|
+
"properties": {
|
|
5
|
+
"summary": { "type": "string" },
|
|
6
|
+
"findings": {
|
|
7
|
+
"type": "array",
|
|
8
|
+
"items": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"required": ["category", "description", "severity"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"category": { "type": "string", "enum": ["structure", "quality", "patterns"] },
|
|
13
|
+
"description": { "type": "string" },
|
|
14
|
+
"severity": { "type": "string", "enum": ["info", "warning", "critical"] },
|
|
15
|
+
"files": { "type": "array", "items": { "type": "string" } }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"recommendations": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"required": ["action", "rationale", "priority"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"action": { "type": "string" },
|
|
26
|
+
"rationale": { "type": "string" },
|
|
27
|
+
"priority": { "type": "string", "enum": ["high", "medium", "low"] },
|
|
28
|
+
"affectedFiles": { "type": "array", "items": { "type": "string" } }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
33
|
}
|
|
@@ -1,96 +1,96 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
2
|
+
"type": "object",
|
|
3
|
+
"required": ["status", "score", "truths", "criteria_results"],
|
|
4
|
+
"properties": {
|
|
5
|
+
"status": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"enum": ["passed", "gaps_found", "human_needed"]
|
|
8
|
+
},
|
|
9
|
+
"score": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Score in N/M format (e.g. '5/7')"
|
|
12
|
+
},
|
|
13
|
+
"truths": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"required": ["truth", "status", "evidence"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"truth": { "type": "string" },
|
|
20
|
+
"status": { "type": "string", "enum": ["verified", "failed", "uncertain"] },
|
|
21
|
+
"evidence": { "type": "string" }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"artifacts": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"required": ["path", "status"],
|
|
30
|
+
"properties": {
|
|
31
|
+
"path": { "type": "string" },
|
|
32
|
+
"status": { "type": "string", "enum": ["verified", "stub", "missing"] },
|
|
33
|
+
"exists": { "type": "boolean" },
|
|
34
|
+
"substantive": { "type": "boolean" },
|
|
35
|
+
"wired": { "type": "boolean" },
|
|
36
|
+
"details": { "type": "string" }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"requirements_coverage": {
|
|
41
|
+
"type": "array",
|
|
42
|
+
"items": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"required": ["requirement_id", "status"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"requirement_id": { "type": "string" },
|
|
47
|
+
"status": { "type": "string", "enum": ["satisfied", "blocked", "needs_human"] },
|
|
48
|
+
"supporting_truths": {
|
|
49
|
+
"type": "array",
|
|
50
|
+
"items": { "type": "string" }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"criteria_results": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"items": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"required": ["criterion", "verify_method", "status"],
|
|
60
|
+
"properties": {
|
|
61
|
+
"criterion": { "type": "string" },
|
|
62
|
+
"verify_method": { "type": "string", "enum": ["command", "grep", "inspect"] },
|
|
63
|
+
"status": { "type": "string", "enum": ["passed", "failed", "uncertain", "skipped"] },
|
|
64
|
+
"expected_outcome": { "type": "string" },
|
|
65
|
+
"actual_outcome": { "type": "string" },
|
|
66
|
+
"evidence": { "type": "string" }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"human_verification": {
|
|
71
|
+
"type": "array",
|
|
72
|
+
"items": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"required": ["name", "test", "expected", "why_human"],
|
|
75
|
+
"properties": {
|
|
76
|
+
"name": { "type": "string" },
|
|
77
|
+
"test": { "type": "string" },
|
|
78
|
+
"expected": { "type": "string" },
|
|
79
|
+
"why_human": { "type": "string" }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"gaps": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"required": ["truth", "status", "reason"],
|
|
88
|
+
"properties": {
|
|
89
|
+
"truth": { "type": "string" },
|
|
90
|
+
"status": { "type": "string" },
|
|
91
|
+
"reason": { "type": "string" }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
96
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
## How It Works
|
|
2
|
+
|
|
3
|
+
pi-workflows orchestrates multi-step agent workflows defined in YAML. Workflows are DAGs of typed steps with data flow via `${{ }}` expressions.
|
|
4
|
+
|
|
5
|
+
### Workflow Discovery
|
|
6
|
+
|
|
7
|
+
Workflows are discovered from three locations (first match wins):
|
|
8
|
+
1. `.workflows/*.workflow.yaml` — project-level
|
|
9
|
+
2. `~/.pi/agent/workflows/*.workflow.yaml` — user-level
|
|
10
|
+
3. Package bundled `workflows/` — built-in
|
|
11
|
+
|
|
12
|
+
### Step Types
|
|
13
|
+
|
|
14
|
+
| Type | Field | Description |
|
|
15
|
+
|------|-------|-------------|
|
|
16
|
+
| agent | `agent: name` | Dispatch an LLM subprocess via `pi --mode json` |
|
|
17
|
+
| command | `command: "..."` | Run a shell command, capture stdout as output |
|
|
18
|
+
| transform | `transform: { mapping: {...} }` | Pure data transformation via expressions, no LLM |
|
|
19
|
+
| gate | `gate: { check: "..." }` | Shell command exit code as pass/fail boolean |
|
|
20
|
+
| loop | `loop: { maxAttempts, steps }` | Repeat sub-steps until gate breaks or max reached |
|
|
21
|
+
| parallel | `parallel: { a: ..., b: ... }` | Run named sub-steps concurrently |
|
|
22
|
+
| pause | `pause: true` or `pause: "message"` | Pause execution, resumable later |
|
|
23
|
+
| forEach | `forEach: "${{ expr }}"` | Iterate over an array, executing the step per element |
|
|
24
|
+
|
|
25
|
+
### Expression Syntax
|
|
26
|
+
|
|
27
|
+
`${{ expression }}` resolves against scope: `input`, `steps`, `loop`, `forEach`.
|
|
28
|
+
|
|
29
|
+
Access step outputs: `${{ steps.investigate.output.findings }}`
|
|
30
|
+
Filters: `${{ steps.analyze.output | json }}`, `${{ items | length }}`, `${{ name | upper }}`
|
|
31
|
+
|
|
32
|
+
Available filters: length, keys, filter, json, upper, lower, trim, default, first, last, join, split, replace, includes, map, sum, min, max, sort, unique, flatten, zip, group_by, count_by, chunk, pick, omit, entries, from_entries, merge, values, not, and, or.
|
|
33
|
+
|
|
34
|
+
### Agent Resolution
|
|
35
|
+
|
|
36
|
+
Agent specs (`.agent.yaml`) are resolved from three locations (first match wins):
|
|
37
|
+
1. `.pi/agents/<name>.agent.yaml` — project-level
|
|
38
|
+
2. `~/.pi/agent/agents/<name>.agent.yaml` — user-level
|
|
39
|
+
3. Package bundled `agents/<name>.agent.yaml` — built-in
|
|
40
|
+
|
|
41
|
+
Agent specs define: model, thinking level, tools, system prompt (or template), task template, output format/schema.
|
|
42
|
+
|
|
43
|
+
### Execution Model
|
|
44
|
+
|
|
45
|
+
1. Steps are ordered by YAML declaration order
|
|
46
|
+
2. DAG planner infers parallelism from `${{ steps.X }}` references
|
|
47
|
+
3. Steps without explicit dependencies run after their predecessor (conservative sequential)
|
|
48
|
+
4. Each step's result is persisted atomically to `<runDir>/state.json`
|
|
49
|
+
5. TUI progress widget shows real-time step status, cost, and timing
|
|
50
|
+
|
|
51
|
+
### Checkpoint and Resume
|
|
52
|
+
|
|
53
|
+
Incomplete runs (failed or paused) are detected on next invocation. If the workflow spec hasn't changed incompatibly, execution resumes from the last completed step. Failed steps are re-executed. Use `fresh: "true"` to force a new run.
|
|
54
|
+
|
|
55
|
+
### Output Validation
|
|
56
|
+
|
|
57
|
+
Steps with `output.schema` validate the agent's JSON output against a JSON Schema file. Validation failure marks the step as failed.
|
|
58
|
+
|
|
59
|
+
### Per-Step Retry
|
|
60
|
+
|
|
61
|
+
Steps with `retry: { maxAttempts: N }` are re-executed on failure. Between retries:
|
|
62
|
+
- Project block files are rolled back to pre-attempt state
|
|
63
|
+
- Prior error messages are injected into the prompt
|
|
64
|
+
- Optional `steeringMessage` provides custom retry guidance
|
|
65
|
+
|
|
66
|
+
### Completion Messages
|
|
67
|
+
|
|
68
|
+
After execution, the workflow result is injected into the main LLM conversation. The `completion` field controls this: either a `template` (full `${{ }}` template) or `message` + `include` (message text plus resolved data paths).
|
|
69
|
+
|
|
70
|
+
### Artifacts
|
|
71
|
+
|
|
72
|
+
Workflows can write post-completion files via the `artifacts` field. Paths may contain `${{ }}` expressions. Artifacts targeting `.project/*.json` are validated against block schemas.
|
|
73
|
+
|
|
74
|
+
### Validation
|
|
75
|
+
|
|
76
|
+
`validateWorkflow(spec, cwd)` runs authoring-time checks without executing the workflow:
|
|
77
|
+
|
|
78
|
+
1. **Agent resolution** — all referenced agents exist in the three-tier search
|
|
79
|
+
2. **Schema resolution** — all output schema file paths resolve to existing files
|
|
80
|
+
3. **Step reference validity** — `${{ steps.X }}` expressions reference declared steps
|
|
81
|
+
4. **Step ordering** — referenced steps are declared before the referencing step
|
|
82
|
+
5. **Filter name validity** — `${{ value | filter }}` uses known filter names
|
|
83
|
+
|
|
84
|
+
Returns `{ valid: boolean, issues: ValidationIssue[] }` where each issue has severity, message, and field path. Use `/workflow validate` or `/workflow validate <name>` to run from the command line.
|