moflo 4.9.20 → 4.9.22
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/.claude/agents/analysis/analyze-code-quality.md +0 -121
- package/.claude/agents/analysis/code-analyzer.md +5 -26
- package/.claude/agents/architecture/system-design/arch-system-design.md +0 -119
- package/.claude/agents/base-template-generator.md +0 -1
- package/.claude/agents/core/coder.md +0 -22
- package/.claude/agents/core/planner.md +0 -16
- package/.claude/agents/core/researcher.md +0 -16
- package/.claude/agents/core/reviewer.md +0 -17
- package/.claude/agents/core/tester.md +0 -19
- package/.claude/agents/custom/test-long-runner.md +0 -2
- package/.claude/agents/development/dev-backend-api.md +0 -167
- package/.claude/agents/development/dev-database.md +43 -0
- package/.claude/agents/development/dev-frontend.md +42 -0
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +0 -112
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +0 -111
- package/.claude/agents/security/security-auditor.md +45 -0
- package/.claude/guidance/shipped/moflo-agent-rules.md +172 -0
- package/.claude/guidance/shipped/moflo-claude-swarm-cohesion.md +73 -265
- package/.claude/guidance/shipped/moflo-cli-reference.md +6 -6
- package/.claude/guidance/shipped/moflo-core-guidance.md +66 -184
- package/.claude/guidance/shipped/moflo-cross-platform.md +1 -1
- package/.claude/guidance/shipped/moflo-error-handling.md +3 -3
- package/.claude/guidance/shipped/moflo-guidance-rules.md +17 -7
- package/.claude/guidance/shipped/moflo-memory-strategy.md +76 -182
- package/.claude/guidance/shipped/moflo-memorydb-maintenance.md +6 -8
- package/.claude/guidance/shipped/moflo-settings-injection.md +7 -9
- package/.claude/guidance/shipped/moflo-source-hygiene.md +5 -5
- package/.claude/guidance/shipped/moflo-spell-connectors.md +3 -4
- package/.claude/guidance/shipped/moflo-spell-custom-steps.md +3 -4
- package/.claude/guidance/shipped/moflo-spell-engine.md +40 -162
- package/.claude/guidance/shipped/moflo-spell-runner.md +134 -0
- package/.claude/guidance/shipped/moflo-spell-sandboxing.md +10 -57
- package/.claude/guidance/shipped/moflo-spell-troubleshooting.md +149 -0
- package/.claude/guidance/shipped/moflo-subagents.md +43 -114
- package/.claude/guidance/shipped/moflo-task-icons.md +4 -4
- package/.claude/guidance/shipped/moflo-user-facing-language.md +3 -3
- package/.claude/guidance/shipped/moflo-verbose-command-filtering.md +3 -3
- package/.claude/guidance/shipped/moflo-yaml-reference.md +4 -5
- package/.claude/helpers/gate.cjs +192 -15
- package/.claude/helpers/prompt-hook.mjs +4 -38
- package/.claude/helpers/simplify-classify.cjs +32 -11
- package/.claude/helpers/subagent-bootstrap.json +1 -1
- package/.claude/helpers/subagent-start.cjs +1 -1
- package/.claude/skills/connector-builder/SKILL.md +42 -429
- package/.claude/skills/connector-builder/templates/connector.md +189 -0
- package/.claude/skills/connector-builder/templates/step-command.md +176 -0
- package/.claude/skills/eldar/SKILL.md +7 -7
- package/.claude/skills/fl/SKILL.md +3 -3
- package/.claude/skills/fl/execution-modes.md +39 -16
- package/.claude/skills/fl/phases.md +3 -3
- package/.claude/skills/{simplify → flo-simplify}/SKILL.md +11 -11
- package/.claude/skills/guidance/SKILL.md +17 -9
- package/.claude/skills/memory-patterns/SKILL.md +1 -1
- package/.claude/skills/publish/SKILL.md +121 -36
- package/.claude/skills/reset-epic/SKILL.md +2 -2
- package/.claude/skills/spell-builder/SKILL.md +39 -226
- package/.claude/skills/spell-builder/architecture.md +1 -1
- package/.claude/skills/spell-builder/permissions.md +107 -0
- package/.claude/skills/spell-builder/preflight.md +101 -0
- package/.claude/skills/spell-schedule/SKILL.md +2 -3
- package/bin/gate.cjs +192 -15
- package/bin/lib/retired-files.mjs +146 -0
- package/bin/prompt-hook.mjs +4 -38
- package/bin/session-start-launcher.mjs +120 -1
- package/bin/setup-project.mjs +63 -69
- package/bin/simplify-classify.cjs +32 -11
- package/dist/src/cli/appliance/rvfa-builder.js +1 -1
- package/dist/src/cli/commands/agent.js +3 -9
- package/dist/src/cli/commands/doctor-checks-deep.js +4 -0
- package/dist/src/cli/commands/hooks.js +1 -3
- package/dist/src/cli/commands/index.js +2 -0
- package/dist/src/cli/commands/retire.js +111 -0
- package/dist/src/cli/hooks/reasoningbank/index.js +7 -7
- package/dist/src/cli/init/claudemd-generator.js +30 -33
- package/dist/src/cli/init/executor.js +53 -69
- package/dist/src/cli/init/helpers-generator.js +165 -52
- package/dist/src/cli/init/moflo-init.js +41 -114
- package/dist/src/cli/init/settings-generator.js +44 -14
- package/dist/src/cli/mcp-tools/agent-tools.js +9 -27
- package/dist/src/cli/mcp-tools/hooks-tools.js +23 -21
- package/dist/src/cli/memory/controllers/semantic-router.js +18 -12
- package/dist/src/cli/memory/sona-optimizer.js +6 -6
- package/dist/src/cli/neural/domain/services/learning-service.js +3 -3
- package/dist/src/cli/services/agent-router.js +2 -5
- package/dist/src/cli/services/hook-block-hash.js +11 -2
- package/dist/src/cli/services/hook-wiring.js +86 -3
- package/dist/src/cli/services/subagent-bootstrap.js +1 -1
- package/dist/src/cli/shared/events/example-usage.js +6 -6
- package/dist/src/cli/shared/hooks/task-hooks.js +8 -8
- package/dist/src/cli/version.js +1 -1
- package/package.json +3 -2
- package/retired-files.json +1989 -0
- package/scripts/post-install-bootstrap.mjs +19 -0
- package/src/cli/data/model-registry.json +2 -2
- package/.claude/agents/consensus/byzantine-coordinator.md +0 -63
- package/.claude/agents/consensus/crdt-synchronizer.md +0 -997
- package/.claude/agents/consensus/gossip-coordinator.md +0 -63
- package/.claude/agents/consensus/performance-benchmarker.md +0 -851
- package/.claude/agents/consensus/quorum-manager.md +0 -823
- package/.claude/agents/consensus/raft-manager.md +0 -63
- package/.claude/agents/consensus/security-manager.md +0 -622
- package/.claude/agents/data/ml/data-ml-model.md +0 -193
- package/.claude/agents/github/code-review-swarm.md +0 -538
- package/.claude/agents/github/github-modes.md +0 -172
- package/.claude/agents/github/issue-tracker.md +0 -311
- package/.claude/agents/github/multi-repo-swarm.md +0 -551
- package/.claude/agents/github/pr-manager.md +0 -183
- package/.claude/agents/github/project-board-sync.md +0 -508
- package/.claude/agents/github/release-manager.md +0 -360
- package/.claude/agents/github/release-swarm.md +0 -580
- package/.claude/agents/github/repo-architect.md +0 -391
- package/.claude/agents/github/swarm-issue.md +0 -566
- package/.claude/agents/github/swarm-pr.md +0 -414
- package/.claude/agents/github/sync-coordinator.md +0 -426
- package/.claude/agents/github/workflow-automation.md +0 -606
- package/.claude/agents/goal/code-goal-planner.md +0 -440
- package/.claude/agents/goal/goal-planner.md +0 -168
- package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -127
- package/.claude/agents/hive-mind/queen-coordinator.md +0 -198
- package/.claude/agents/hive-mind/scout-explorer.md +0 -233
- package/.claude/agents/hive-mind/swarm-memory-manager.md +0 -184
- package/.claude/agents/hive-mind/worker-specialist.md +0 -208
- package/.claude/agents/neural/safla-neural.md +0 -73
- package/.claude/agents/optimization/benchmark-suite.md +0 -665
- package/.claude/agents/optimization/load-balancer.md +0 -431
- package/.claude/agents/optimization/performance-monitor.md +0 -672
- package/.claude/agents/optimization/resource-allocator.md +0 -674
- package/.claude/agents/optimization/topology-optimizer.md +0 -808
- package/.claude/agents/reasoning/goal-planner.md +0 -67
- package/.claude/agents/sona/sona-learning-optimizer.md +0 -74
- package/.claude/agents/sparc/architecture.md +0 -472
- package/.claude/agents/sparc/pseudocode.md +0 -318
- package/.claude/agents/sparc/refinement.md +0 -525
- package/.claude/agents/sparc/specification.md +0 -276
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +0 -225
- package/.claude/agents/swarm/adaptive-coordinator.md +0 -391
- package/.claude/agents/swarm/hierarchical-coordinator.md +0 -321
- package/.claude/agents/swarm/mesh-coordinator.md +0 -383
- package/.claude/agents/testing/production-validator.md +0 -395
- package/.claude/agents/testing/tdd-london-swarm.md +0 -244
- package/.claude/agents/v3/adr-architect.md +0 -184
- package/.claude/agents/v3/aidefence-guardian.md +0 -277
- package/.claude/agents/v3/claims-authorizer.md +0 -208
- package/.claude/agents/v3/collective-intelligence-coordinator.md +0 -988
- package/.claude/agents/v3/ddd-domain-expert.md +0 -220
- package/.claude/agents/v3/injection-analyst.md +0 -232
- package/.claude/agents/v3/memory-specialist.md +0 -987
- package/.claude/agents/v3/performance-engineer.md +0 -1225
- package/.claude/agents/v3/pii-detector.md +0 -146
- package/.claude/agents/v3/reasoningbank-learner.md +0 -213
- package/.claude/agents/v3/security-architect-aidefence.md +0 -405
- package/.claude/agents/v3/security-architect.md +0 -865
- package/.claude/agents/v3/security-auditor.md +0 -771
- package/.claude/agents/v3/sparc-orchestrator.md +0 -182
- package/.claude/agents/v3/swarm-memory-manager.md +0 -142
- package/.claude/agents/v3/v3-integration-architect.md +0 -205
- package/.claude/commands/claude-flow-help.md +0 -103
- package/.claude/commands/claude-flow-memory.md +0 -107
- package/.claude/commands/claude-flow-swarm.md +0 -205
- package/.claude/commands/github/README.md +0 -11
- package/.claude/commands/github/code-review-swarm.md +0 -514
- package/.claude/commands/github/code-review.md +0 -25
- package/.claude/commands/github/github-modes.md +0 -146
- package/.claude/commands/github/github-swarm.md +0 -113
- package/.claude/commands/github/issue-tracker.md +0 -284
- package/.claude/commands/github/issue-triage.md +0 -25
- package/.claude/commands/github/multi-repo-swarm.md +0 -519
- package/.claude/commands/github/pr-enhance.md +0 -26
- package/.claude/commands/github/pr-manager.md +0 -164
- package/.claude/commands/github/project-board-sync.md +0 -471
- package/.claude/commands/github/release-manager.md +0 -332
- package/.claude/commands/github/release-swarm.md +0 -544
- package/.claude/commands/github/repo-analyze.md +0 -25
- package/.claude/commands/github/repo-architect.md +0 -361
- package/.claude/commands/github/swarm-issue.md +0 -482
- package/.claude/commands/github/swarm-pr.md +0 -285
- package/.claude/commands/github/sync-coordinator.md +0 -294
- package/.claude/commands/github/workflow-automation.md +0 -442
- package/.claude/commands/hooks/README.md +0 -11
- package/.claude/commands/hooks/overview.md +0 -58
- package/.claude/commands/hooks/post-edit.md +0 -117
- package/.claude/commands/hooks/post-task.md +0 -112
- package/.claude/commands/hooks/pre-edit.md +0 -113
- package/.claude/commands/hooks/pre-task.md +0 -111
- package/.claude/commands/hooks/session-end.md +0 -118
- package/.claude/commands/hooks/setup.md +0 -103
- package/.claude/commands/simplify.md +0 -101
- package/.claude/commands/sparc/analyzer.md +0 -42
- package/.claude/commands/sparc/architect.md +0 -43
- package/.claude/commands/sparc/ask.md +0 -86
- package/.claude/commands/sparc/batch-executor.md +0 -44
- package/.claude/commands/sparc/code.md +0 -78
- package/.claude/commands/sparc/coder.md +0 -44
- package/.claude/commands/sparc/debug.md +0 -72
- package/.claude/commands/sparc/debugger.md +0 -44
- package/.claude/commands/sparc/designer.md +0 -43
- package/.claude/commands/sparc/devops.md +0 -98
- package/.claude/commands/sparc/docs-writer.md +0 -69
- package/.claude/commands/sparc/documenter.md +0 -44
- package/.claude/commands/sparc/innovator.md +0 -44
- package/.claude/commands/sparc/integration.md +0 -72
- package/.claude/commands/sparc/mcp.md +0 -106
- package/.claude/commands/sparc/memory-manager.md +0 -44
- package/.claude/commands/sparc/optimizer.md +0 -44
- package/.claude/commands/sparc/orchestrator.md +0 -116
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +0 -72
- package/.claude/commands/sparc/refinement-optimization-mode.md +0 -72
- package/.claude/commands/sparc/researcher.md +0 -44
- package/.claude/commands/sparc/reviewer.md +0 -44
- package/.claude/commands/sparc/security-review.md +0 -69
- package/.claude/commands/sparc/sparc-modes.md +0 -139
- package/.claude/commands/sparc/sparc.md +0 -99
- package/.claude/commands/sparc/spec-pseudocode.md +0 -69
- package/.claude/commands/sparc/spell-manager.md +0 -44
- package/.claude/commands/sparc/supabase-admin.md +0 -337
- package/.claude/commands/sparc/swarm-coordinator.md +0 -44
- package/.claude/commands/sparc/tdd.md +0 -44
- package/.claude/commands/sparc/tester.md +0 -44
- package/.claude/commands/sparc/tutorial.md +0 -68
- package/.claude/commands/sparc.md +0 -151
- package/.claude/guidance/shipped/moflo-session-start.md +0 -154
- package/.claude/guidance/shipped/moflo-spell-engine-architecture.md +0 -145
- package/.claude/skills/browser/SKILL.md +0 -204
- package/.claude/skills/github-code-review/SKILL.md +0 -1140
- package/.claude/skills/github-multi-repo/SKILL.md +0 -866
- package/.claude/skills/github-project-management/SKILL.md +0 -1272
- package/.claude/skills/github-release-management/SKILL.md +0 -1074
- package/.claude/skills/github-workflow-automation/SKILL.md +0 -1060
- package/.claude/skills/hive-mind-advanced/SKILL.md +0 -712
- package/.claude/skills/hooks-automation/SKILL.md +0 -1193
- package/.claude/skills/pair-programming/SKILL.md +0 -1202
- package/.claude/skills/performance-analysis/SKILL.md +0 -563
- package/.claude/skills/skill-builder/SKILL.md +0 -910
- package/.claude/skills/sparc-methodology/SKILL.md +0 -904
- package/.claude/skills/stream-chain/SKILL.md +0 -563
- package/.claude/skills/swarm-advanced/SKILL.md +0 -811
- package/.claude/skills/swarm-orchestration/SKILL.md +0 -179
- package/.claude/skills/verification-quality/SKILL.md +0 -649
- package/.claude/skills/worker-benchmarks/skill.md +0 -135
- package/.claude/skills/worker-integration/skill.md +0 -154
|
@@ -1,38 +1,21 @@
|
|
|
1
|
-
# Spell Engine —
|
|
1
|
+
# Spell Engine — Definition Format & Step Types
|
|
2
2
|
|
|
3
|
-
**Purpose:** How to
|
|
3
|
+
**Purpose:** How to define a spell (YAML/JSON schema, arguments, steps, variable interpolation) and a reference for the nine built-in step command types. For execution mechanics (running, dry-run, error codes, pause/resume, layering, credentials), see `.claude/guidance/moflo-spell-runner.md`.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Claude's Role During Spell Execution
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**Treat the spell definition as a strict contract — execute only what it specifies, using only the capabilities it declares.** This applies whether the spell runs manually, via MCP, or on a schedule.
|
|
10
10
|
|
|
11
11
|
| Constraint | Detail |
|
|
12
12
|
|-----------|--------|
|
|
13
13
|
| Step config is the complete instruction | Do not add commands, flags, arguments, or actions beyond what `config` contains |
|
|
14
14
|
| Capability restrictions are absolute | If a step restricts `fs:read` to `["./src/"]`, do not read files outside `./src/` even if helpful |
|
|
15
15
|
| `CAPABILITY_DENIED` means stop | Do not attempt workarounds — report the denial and halt the step |
|
|
16
|
-
| No improvisation between steps | Do not perform actions outside
|
|
16
|
+
| No improvisation between steps | Do not perform actions outside step boundaries, even if "obvious" |
|
|
17
17
|
|
|
18
|
-
See `.claude/guidance/
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Running a Spell via MCP Tools
|
|
23
|
-
|
|
24
|
-
**Use `mcp__moflo__spell_cast` to execute a spell from a YAML/JSON file.** The bridge layer handles parsing, validation, and runner lifecycle automatically.
|
|
25
|
-
|
|
26
|
-
| MCP Tool | Purpose |
|
|
27
|
-
|----------|---------|
|
|
28
|
-
| `mcp__moflo__spell_cast` | Run spell from file content (YAML/JSON) |
|
|
29
|
-
| `mcp__moflo__spell_execute` | Execute a spell definition object directly |
|
|
30
|
-
| `mcp__moflo__spell_cancel` | Cancel a running spell by ID |
|
|
31
|
-
| `mcp__moflo__spell_status` | Check if a spell is currently running |
|
|
32
|
-
| `mcp__moflo__spell_suspend` | Pause a running spell for later resumption |
|
|
33
|
-
| `mcp__moflo__spell_resume` | Resume a previously paused spell |
|
|
34
|
-
|
|
35
|
-
**Dry-run mode validates without executing.** Pass `dryRun: true` to check definition validity, argument resolution, and step config schemas before committing to execution.
|
|
18
|
+
See `.claude/guidance/moflo-spell-sandboxing.md` for the full Execution Constraint Principle and capability type reference.
|
|
36
19
|
|
|
37
20
|
---
|
|
38
21
|
|
|
@@ -102,7 +85,7 @@ steps:
|
|
|
102
85
|
|---------|-------------|
|
|
103
86
|
| `{args.environment}` | Spell argument value |
|
|
104
87
|
| `{check-branch.stdout}` | Output field from step `check-branch` |
|
|
105
|
-
| `{credentials.API_KEY}` | Credential value (redacted in logs) |
|
|
88
|
+
| `{credentials.API_KEY}` | Credential value (redacted in logs — see `moflo-spell-runner.md`) |
|
|
106
89
|
|
|
107
90
|
Interpolation works in all string values within step `config`. Nested object values and arrays are interpolated recursively.
|
|
108
91
|
|
|
@@ -122,7 +105,7 @@ steps:
|
|
|
122
105
|
|
|
123
106
|
## Step Command Types
|
|
124
107
|
|
|
125
|
-
**Nine built-in step types are registered automatically.** Each implements `execute()`, `validate()`, `describeOutputs()`, and optional `rollback()`.
|
|
108
|
+
**Nine built-in step types are registered automatically.** Each implements `execute()`, `validate()`, `describeOutputs()`, and optional `rollback()`. To add new step types via JS/TS files, YAML composite steps, or `moflo-step-*` npm packages, see `.claude/guidance/moflo-spell-custom-steps.md`.
|
|
126
109
|
|
|
127
110
|
### bash — Run a Shell Command
|
|
128
111
|
|
|
@@ -130,8 +113,8 @@ steps:
|
|
|
130
113
|
- id: build
|
|
131
114
|
type: bash
|
|
132
115
|
config:
|
|
133
|
-
command: "npm run build" # Required.
|
|
134
|
-
timeout: 30000 # Optional.
|
|
116
|
+
command: "npm run build" # Required.
|
|
117
|
+
timeout: 30000 # Optional. Default 30000.
|
|
135
118
|
failOnError: true # Optional. Fail step on non-zero exit (default: true).
|
|
136
119
|
```
|
|
137
120
|
|
|
@@ -145,9 +128,9 @@ steps:
|
|
|
145
128
|
- id: research
|
|
146
129
|
type: agent
|
|
147
130
|
config:
|
|
148
|
-
agentType: "researcher" # Required.
|
|
149
|
-
prompt: "Find all API endpoints in {args.directory}" # Required.
|
|
150
|
-
background: false # Optional.
|
|
131
|
+
agentType: "researcher" # Required. researcher, coder, tester, etc.
|
|
132
|
+
prompt: "Find all API endpoints in {args.directory}" # Required.
|
|
133
|
+
background: false # Optional. Default false.
|
|
151
134
|
```
|
|
152
135
|
|
|
153
136
|
**Outputs:** `result` (string), `agentType` (string), `prompt` (string).
|
|
@@ -160,14 +143,14 @@ steps:
|
|
|
160
143
|
- id: check-env
|
|
161
144
|
type: condition
|
|
162
145
|
config:
|
|
163
|
-
if: "{args.environment} === 'production'" # Required.
|
|
146
|
+
if: "{args.environment} === 'production'" # Required.
|
|
164
147
|
then: "deploy-prod" # Optional. Step ID to jump to if true.
|
|
165
148
|
else: "deploy-staging" # Optional. Step ID to jump to if false.
|
|
166
149
|
```
|
|
167
150
|
|
|
168
151
|
**Outputs:** `result` (boolean), `branch` (string: "then" or "else"), `nextStep` (string).
|
|
169
152
|
|
|
170
|
-
The runner uses `nextStep` to jump to the target step ID. Jumps
|
|
153
|
+
The runner uses `nextStep` to jump to the target step ID. Jumps may go forward or backward. A max-iteration guard (`steps.length * 10`) prevents infinite loops.
|
|
171
154
|
|
|
172
155
|
---
|
|
173
156
|
|
|
@@ -177,10 +160,10 @@ The runner uses `nextStep` to jump to the target step ID. Jumps can go forward o
|
|
|
177
160
|
- id: process-files
|
|
178
161
|
type: loop
|
|
179
162
|
config:
|
|
180
|
-
over: ["{args.files}"] # Required. Array
|
|
181
|
-
maxIterations: 100 # Optional.
|
|
182
|
-
itemVar: "file" # Optional.
|
|
183
|
-
indexVar: "idx" # Optional.
|
|
163
|
+
over: ["{args.files}"] # Required. Array or variable reference.
|
|
164
|
+
maxIterations: 100 # Optional. Default 100.
|
|
165
|
+
itemVar: "file" # Optional. Default "item".
|
|
166
|
+
indexVar: "idx" # Optional. Default "index".
|
|
184
167
|
steps: # Nested steps run for each item.
|
|
185
168
|
- id: process-one
|
|
186
169
|
type: bash
|
|
@@ -190,7 +173,7 @@ The runner uses `nextStep` to jump to the target step ID. Jumps can go forward o
|
|
|
190
173
|
|
|
191
174
|
**Outputs:** `totalItems` (number), `iterations` (number), `truncated` (boolean), `items` (array).
|
|
192
175
|
|
|
193
|
-
Nested `steps`
|
|
176
|
+
Nested `steps` go on the step definition (not inside `config`). The runner injects `itemVar` and `indexVar` per iteration; previous values are saved and restored after the loop.
|
|
194
177
|
|
|
195
178
|
---
|
|
196
179
|
|
|
@@ -200,11 +183,11 @@ Nested `steps` are defined on the step definition (not inside `config`). The run
|
|
|
200
183
|
- id: load-config
|
|
201
184
|
type: memory
|
|
202
185
|
config:
|
|
203
|
-
action: "read" # Required.
|
|
204
|
-
namespace: "workflow-state" # Required.
|
|
205
|
-
key: "last-deploy" # Required for read/write.
|
|
206
|
-
value: "{deploy.stdout}" # Required for write.
|
|
207
|
-
query: "deploy status" # Required for search.
|
|
186
|
+
action: "read" # Required. read | write | search.
|
|
187
|
+
namespace: "workflow-state" # Required.
|
|
188
|
+
key: "last-deploy" # Required for read/write.
|
|
189
|
+
value: "{deploy.stdout}" # Required for write.
|
|
190
|
+
query: "deploy status" # Required for search.
|
|
208
191
|
```
|
|
209
192
|
|
|
210
193
|
**Outputs:** `value` (object), `found` (boolean), `written` (boolean), `results` (array), `count` (number).
|
|
@@ -217,10 +200,10 @@ Nested `steps` are defined on the step definition (not inside `config`). The run
|
|
|
217
200
|
- id: confirm
|
|
218
201
|
type: prompt
|
|
219
202
|
config:
|
|
220
|
-
message: "Deploy to {args.environment}?" # Required.
|
|
221
|
-
options: ["yes", "no"] # Optional. Multiple choice
|
|
222
|
-
default: "no" # Optional.
|
|
223
|
-
outputVar: "user_choice" # Optional.
|
|
203
|
+
message: "Deploy to {args.environment}?" # Required.
|
|
204
|
+
options: ["yes", "no"] # Optional. Multiple choice.
|
|
205
|
+
default: "no" # Optional.
|
|
206
|
+
outputVar: "user_choice" # Optional.
|
|
224
207
|
```
|
|
225
208
|
|
|
226
209
|
**Outputs:** `response` (string), `message` (string), `outputVar` (string).
|
|
@@ -233,7 +216,7 @@ Nested `steps` are defined on the step definition (not inside `config`). The run
|
|
|
233
216
|
- id: cooldown
|
|
234
217
|
type: wait
|
|
235
218
|
config:
|
|
236
|
-
duration: 5000 # Required.
|
|
219
|
+
duration: 5000 # Required. Milliseconds.
|
|
237
220
|
```
|
|
238
221
|
|
|
239
222
|
**Outputs:** `waited` (number — actual wait time in ms).
|
|
@@ -264,103 +247,21 @@ Requires `playwright` as a peer dependency. The command checks for Playwright av
|
|
|
264
247
|
- id: create-issue
|
|
265
248
|
type: github
|
|
266
249
|
config:
|
|
267
|
-
action: "create-issue" # Required.
|
|
250
|
+
action: "create-issue" # Required.
|
|
268
251
|
title: "Bug: {args.title}" # Required for create-issue/create-pr.
|
|
269
|
-
body: "Details here" # Optional.
|
|
252
|
+
body: "Details here" # Optional.
|
|
270
253
|
repo: "owner/repo" # Optional. Defaults to current repo.
|
|
271
254
|
```
|
|
272
255
|
|
|
273
256
|
**Outputs:** `url` (string), `number` (number), `action` (string).
|
|
274
257
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
---
|
|
278
|
-
|
|
279
|
-
## Custom Step Commands
|
|
280
|
-
|
|
281
|
-
**To register custom step types, see `moflo-spell-custom-steps.md`.** That doc covers the three extension paths (JS/TS step files, YAML composite steps, `moflo-step-*` npm packages), priority ordering, and how to configure `createRunner()` for discovery.
|
|
282
|
-
|
|
283
|
-
---
|
|
284
|
-
|
|
285
|
-
## Shipped vs User Definition Layering
|
|
286
|
-
|
|
287
|
-
**Shipped definitions are bundled defaults. User definitions override shipped ones by name match.**
|
|
288
|
-
|
|
289
|
-
| Tier | Source | Priority |
|
|
290
|
-
|------|--------|----------|
|
|
291
|
-
| Shipped | Bundled in moflo package source (`workflows/shipped/`) | Lower |
|
|
292
|
-
| User | Project-local path (configurable via `moflo.yaml`) | Higher — overrides shipped by name |
|
|
293
|
-
|
|
294
|
-
### How Layering Works
|
|
295
|
-
|
|
296
|
-
1. `loadSpellDefinitions()` loads shipped definitions first
|
|
297
|
-
2. Then loads user definitions from configured directories
|
|
298
|
-
3. If a user definition has the same `name` as a shipped one, the user version wins
|
|
299
|
-
4. New names in user directories are additive (they extend, not replace, the set)
|
|
300
|
-
|
|
301
|
-
### Loading Definitions Programmatically
|
|
302
|
-
|
|
303
|
-
```typescript
|
|
304
|
-
import { loadSpellDefinitions, loadSpellByName } from 'moflo/dist/src/cli/spells/index.js';
|
|
305
|
-
|
|
306
|
-
const { spells, errors } = loadSpellDefinitions({
|
|
307
|
-
shippedDir: 'node_modules/moflo/workflows/shipped',
|
|
308
|
-
userDirs: ['.claude/workflows', 'workflows/'],
|
|
309
|
-
});
|
|
310
|
-
const result = loadSpellByName('deploy-staging', { /* same options */ });
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
---
|
|
314
|
-
|
|
315
|
-
## Error Handling and Rollback
|
|
316
|
-
|
|
317
|
-
**The runner collects errors without throwing.** `SpellResult` always returns — check `result.success` and `result.errors`.
|
|
318
|
-
|
|
319
|
-
| Error Code | Meaning |
|
|
320
|
-
|------------|---------|
|
|
321
|
-
| `DEFINITION_VALIDATION_FAILED` | Invalid YAML/JSON or schema violation |
|
|
322
|
-
| `ARGUMENT_VALIDATION_FAILED` | Missing required argument or type mismatch |
|
|
323
|
-
| `UNKNOWN_STEP_TYPE` | No step command registered for this type |
|
|
324
|
-
| `STEP_VALIDATION_FAILED` | Step config fails command's schema validation |
|
|
325
|
-
| `STEP_EXECUTION_FAILED` | Step threw during execution |
|
|
326
|
-
| `STEP_TIMEOUT` | Step exceeded its timeout |
|
|
327
|
-
| `STEP_CANCELLED` | Spell cancelled via AbortSignal |
|
|
328
|
-
| `CONDITION_TARGET_NOT_FOUND` | Condition branch references nonexistent step ID |
|
|
329
|
-
| `PAUSED_STATE_NOT_FOUND` | No paused state for spell ID on resume |
|
|
330
|
-
| `PAUSED_STATE_EXPIRED` | Paused state exceeded stale timeout |
|
|
331
|
-
| `ROLLBACK_FAILED` | Rollback of completed steps failed |
|
|
332
|
-
| `SPELL_CANCELLED` | Entire spell was cancelled |
|
|
333
|
-
|
|
334
|
-
### continueOnError
|
|
335
|
-
|
|
336
|
-
**Set `continueOnError: true` on a step to keep running after failure.** The failed step is recorded in results but execution continues. Without this flag, a step failure triggers rollback of completed steps and terminates the spell.
|
|
337
|
-
|
|
338
|
-
---
|
|
339
|
-
|
|
340
|
-
## Pause and Resume
|
|
341
|
-
|
|
342
|
-
**Pause serializes spell state to memory. Resume reconstructs and continues from where it left off.**
|
|
343
|
-
|
|
344
|
-
```typescript
|
|
345
|
-
import { buildPausedState, persistPausedState, resumeSpell } from 'moflo/dist/src/cli/spells/index.js';
|
|
346
|
-
|
|
347
|
-
// Pause after step 2 of 5
|
|
348
|
-
const state = buildPausedState(spellId, definition, 2, variables, completedResults, args);
|
|
349
|
-
await persistPausedState(state, memory);
|
|
350
|
-
|
|
351
|
-
// Later: resume from step 3
|
|
352
|
-
const result = await resumeSpell(spellId, { memory, variables: { override: 'value' } });
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
**Stale timeout is 24 hours by default.** Paused state older than this is rejected on resume and cleaned up. Use `cleanupStalePaused(memory)` to sweep expired entries.
|
|
356
|
-
|
|
357
|
-
**Variable overrides on resume** allow injecting or modifying context between pause and resume (e.g., user edits a value in between).
|
|
258
|
+
Supported actions: `create-issue`, `create-pr`, `add-label`, `remove-label`, `comment`, `close-issue`, `close-pr`, `merge-pr`. Requires `gh` CLI installed and authenticated.
|
|
358
259
|
|
|
359
260
|
---
|
|
360
261
|
|
|
361
262
|
## Creating New Spell Definitions
|
|
362
263
|
|
|
363
|
-
|
|
264
|
+
To create a spell, write a `.yaml` file in the project's spell directory (typically `.claude/workflows/`, or the path configured in `moflo.yaml`).
|
|
364
265
|
|
|
365
266
|
1. Start with `name` and `steps`
|
|
366
267
|
2. Add `arguments` for any user-provided values
|
|
@@ -378,38 +279,15 @@ const result = await resumeSpell(spellId, { memory, variables: { override: 'valu
|
|
|
378
279
|
| Loop `over` resolves to an array | Loop command validates at execution |
|
|
379
280
|
| No circular condition jumps | Max-iteration guard catches these |
|
|
380
281
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
## Dry-Run Validation
|
|
384
|
-
|
|
385
|
-
**Always dry-run before executing a new or modified spell.** Dry-run validates the definition, resolves arguments, and checks step configs without executing anything.
|
|
386
|
-
|
|
387
|
-
```typescript
|
|
388
|
-
import { runSpellFromContent } from 'moflo/dist/src/cli/spells/index.js';
|
|
389
|
-
|
|
390
|
-
const result = await runSpellFromContent(yamlContent, 'my-spell.yaml', { dryRun: true });
|
|
391
|
-
if (!result.success) {
|
|
392
|
-
console.error('Validation errors:', result.errors);
|
|
393
|
-
}
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
Via MCP: pass `dryRun: true` to `mcp__moflo__spell_cast`.
|
|
397
|
-
|
|
398
|
-
---
|
|
399
|
-
|
|
400
|
-
## Credential Handling
|
|
401
|
-
|
|
402
|
-
**Credentials are accessed via `{credentials.KEY}` in interpolation.** The credential accessor is injected into the runner at creation time — spells never store credentials directly.
|
|
403
|
-
|
|
404
|
-
Credential values listed in `RunnerOptions.credentialValues` are automatically redacted from step output to prevent accidental exposure in logs or results.
|
|
282
|
+
**Always dry-run before executing a new or modified spell** (see `.claude/guidance/moflo-spell-runner.md` § Dry-Run Validation).
|
|
405
283
|
|
|
406
284
|
---
|
|
407
285
|
|
|
408
286
|
## See Also
|
|
409
287
|
|
|
410
|
-
- `.claude/guidance/
|
|
411
|
-
- `.claude/guidance/
|
|
412
|
-
- `.claude/guidance/
|
|
413
|
-
- `.claude/guidance/
|
|
414
|
-
- `.claude/guidance/
|
|
415
|
-
- `.claude/guidance/
|
|
288
|
+
- `.claude/guidance/moflo-spell-runner.md` — Running spells, MCP tools, dry-run, error codes, pause/resume, credentials, definition layering
|
|
289
|
+
- `.claude/guidance/moflo-spell-sandboxing.md` — Capability-based security for steps; required reading before authoring
|
|
290
|
+
- `.claude/guidance/moflo-spell-custom-steps.md` — Pluggable step commands: JS/TS files, YAML composites, `moflo-step-*` packages
|
|
291
|
+
- `.claude/guidance/moflo-spell-connectors.md` — Connectors: resource adapters, registry, step-vs-connector decision
|
|
292
|
+
- `.claude/guidance/moflo-spell-troubleshooting.md` — Common failure modes (sandbox/network, permission gaps, environment)
|
|
293
|
+
- `.claude/guidance/moflo-core-guidance.md` — CLI, hooks, swarm, memory reference
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Spell Runner — Execution, Layering, Errors, and Recovery
|
|
2
|
+
|
|
3
|
+
**Purpose:** How spells are run, validated, paused, resumed, and how errors and credentials are handled. For the YAML schema, step types, and authoring rules, see `.claude/guidance/moflo-spell-engine.md`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Running a Spell via MCP Tools
|
|
8
|
+
|
|
9
|
+
**Use `mcp__moflo__spell_cast` to execute a spell from a YAML/JSON file.** The bridge layer handles parsing, validation, and runner lifecycle automatically.
|
|
10
|
+
|
|
11
|
+
| MCP Tool | Purpose |
|
|
12
|
+
|----------|---------|
|
|
13
|
+
| `mcp__moflo__spell_cast` | Run spell from file content (YAML/JSON) |
|
|
14
|
+
| `mcp__moflo__spell_execute` | Execute a spell definition object directly |
|
|
15
|
+
| `mcp__moflo__spell_cancel` | Cancel a running spell by ID |
|
|
16
|
+
| `mcp__moflo__spell_status` | Check whether a spell is currently running |
|
|
17
|
+
| `mcp__moflo__spell_suspend` | Pause a running spell for later resumption |
|
|
18
|
+
| `mcp__moflo__spell_resume` | Resume a previously paused spell |
|
|
19
|
+
|
|
20
|
+
**Dry-run mode validates without executing.** Pass `dryRun: true` to check definition validity, argument resolution, and step config schemas before committing to execution.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Dry-Run Validation
|
|
25
|
+
|
|
26
|
+
**Always dry-run before executing a new or modified spell.** Dry-run validates the definition, resolves arguments, and checks step configs — nothing executes.
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { runSpellFromContent } from 'moflo/dist/src/cli/spells/index.js';
|
|
30
|
+
|
|
31
|
+
const result = await runSpellFromContent(yamlContent, 'my-spell.yaml', { dryRun: true });
|
|
32
|
+
if (!result.success) {
|
|
33
|
+
console.error('Validation errors:', result.errors);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Via MCP: pass `dryRun: true` to `mcp__moflo__spell_cast`.
|
|
38
|
+
|
|
39
|
+
Dry runs also show the per-step permission report — see `.claude/guidance/moflo-spell-sandboxing.md` § Permission Levels.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Shipped vs User Definition Layering
|
|
44
|
+
|
|
45
|
+
**Shipped definitions are bundled defaults. User definitions override shipped ones by name match.**
|
|
46
|
+
|
|
47
|
+
| Tier | Source | Priority |
|
|
48
|
+
|------|--------|----------|
|
|
49
|
+
| Shipped | Bundled in moflo package source (`workflows/shipped/`) | Lower |
|
|
50
|
+
| User | Project-local path (configurable via `moflo.yaml`) | Higher — overrides shipped by name |
|
|
51
|
+
|
|
52
|
+
### How Layering Works
|
|
53
|
+
|
|
54
|
+
1. `loadSpellDefinitions()` loads shipped definitions first
|
|
55
|
+
2. Then loads user definitions from configured directories
|
|
56
|
+
3. If a user definition has the same `name` as a shipped one, the user version wins
|
|
57
|
+
4. New names in user directories are additive (they extend, not replace, the set)
|
|
58
|
+
|
|
59
|
+
### Loading Definitions Programmatically
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { loadSpellDefinitions, loadSpellByName } from 'moflo/dist/src/cli/spells/index.js';
|
|
63
|
+
|
|
64
|
+
const { spells, errors } = loadSpellDefinitions({
|
|
65
|
+
shippedDir: 'node_modules/moflo/workflows/shipped',
|
|
66
|
+
userDirs: ['.claude/workflows', 'workflows/'],
|
|
67
|
+
});
|
|
68
|
+
const result = loadSpellByName('deploy-staging', { /* same options */ });
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Error Handling and Rollback
|
|
74
|
+
|
|
75
|
+
**The runner collects errors without throwing.** `SpellResult` always returns — check `result.success` and `result.errors`.
|
|
76
|
+
|
|
77
|
+
| Error Code | Meaning |
|
|
78
|
+
|------------|---------|
|
|
79
|
+
| `DEFINITION_VALIDATION_FAILED` | Invalid YAML/JSON or schema violation |
|
|
80
|
+
| `ARGUMENT_VALIDATION_FAILED` | Missing required argument or type mismatch |
|
|
81
|
+
| `UNKNOWN_STEP_TYPE` | No step command registered for this type |
|
|
82
|
+
| `STEP_VALIDATION_FAILED` | Step config fails the command's schema validation |
|
|
83
|
+
| `STEP_EXECUTION_FAILED` | Step threw during execution |
|
|
84
|
+
| `STEP_TIMEOUT` | Step exceeded its timeout |
|
|
85
|
+
| `STEP_CANCELLED` | Spell cancelled via AbortSignal |
|
|
86
|
+
| `CONDITION_TARGET_NOT_FOUND` | Condition branch references a nonexistent step ID |
|
|
87
|
+
| `PAUSED_STATE_NOT_FOUND` | No paused state for spell ID on resume |
|
|
88
|
+
| `PAUSED_STATE_EXPIRED` | Paused state exceeded the stale timeout |
|
|
89
|
+
| `ROLLBACK_FAILED` | Rollback of completed steps failed |
|
|
90
|
+
| `SPELL_CANCELLED` | Entire spell was cancelled |
|
|
91
|
+
|
|
92
|
+
### continueOnError
|
|
93
|
+
|
|
94
|
+
**Set `continueOnError: true` on a step to keep running after failure.** The failed step is recorded in results but execution continues. Without this flag, a step failure triggers rollback of completed steps and terminates the spell.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Pause and Resume
|
|
99
|
+
|
|
100
|
+
**Pause serializes spell state to memory. Resume reconstructs and continues from where it left off.**
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { buildPausedState, persistPausedState, resumeSpell } from 'moflo/dist/src/cli/spells/index.js';
|
|
104
|
+
|
|
105
|
+
// Pause after step 2 of 5
|
|
106
|
+
const state = buildPausedState(spellId, definition, 2, variables, completedResults, args);
|
|
107
|
+
await persistPausedState(state, memory);
|
|
108
|
+
|
|
109
|
+
// Later: resume from step 3
|
|
110
|
+
const result = await resumeSpell(spellId, { memory, variables: { override: 'value' } });
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Stale timeout is 24 hours by default.** Paused state older than this is rejected on resume and cleaned up. Use `cleanupStalePaused(memory)` to sweep expired entries.
|
|
114
|
+
|
|
115
|
+
**Variable overrides on resume** allow injecting or modifying context between pause and resume (e.g., user edits a value in between).
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Credential Handling
|
|
120
|
+
|
|
121
|
+
**Credentials are accessed via `{credentials.KEY}` in interpolation.** The credential accessor is injected into the runner at creation time — spells never store credentials directly.
|
|
122
|
+
|
|
123
|
+
Credential values listed in `RunnerOptions.credentialValues` are automatically redacted from step output to prevent accidental exposure in logs or results. The `credentials` capability gates access — see `.claude/guidance/moflo-spell-sandboxing.md`.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## See Also
|
|
128
|
+
|
|
129
|
+
- `.claude/guidance/moflo-spell-engine.md` — Definition format, step types, variable interpolation
|
|
130
|
+
- `.claude/guidance/moflo-spell-sandboxing.md` — Capability-based security and permission levels
|
|
131
|
+
- `.claude/guidance/moflo-spell-troubleshooting.md` — Common failure modes when running spells
|
|
132
|
+
- `.claude/guidance/moflo-spell-custom-steps.md` — Pluggable step commands
|
|
133
|
+
- `.claude/guidance/moflo-spell-connectors.md` — Resource connectors and the registry
|
|
134
|
+
- `.claude/guidance/moflo-core-guidance.md` — CLI, hooks, swarm, memory reference
|
|
@@ -135,14 +135,14 @@ Each method calls `enforceScope()` internally. If the resource is outside the st
|
|
|
135
135
|
| `bash` | `checkShell()` | **Enforced** |
|
|
136
136
|
| `browser` | `checkBrowserEvaluate()`, `checkNet()` | **Enforced** |
|
|
137
137
|
| `memory` | `checkMemory()` | **Enforced** |
|
|
138
|
-
| `agent` | `checkAgent()` | **Enforced**
|
|
139
|
-
| `github` | `checkShell()` | **Enforced**
|
|
140
|
-
| Connectors | `checkNet()` via `GatedConnectorAccessor` | **Enforced**
|
|
141
|
-
| Credentials | `checkCredentials()` | **Enforced**
|
|
138
|
+
| `agent` | `checkAgent()` | **Enforced** |
|
|
139
|
+
| `github` | `checkShell()` | **Enforced** |
|
|
140
|
+
| Connectors | `checkNet()` via `GatedConnectorAccessor` | **Enforced** |
|
|
141
|
+
| Credentials | `checkCredentials()` | **Enforced** |
|
|
142
142
|
| Control flow (`condition`, `loop`, `parallel`, `composite`) | N/A | No I/O — child steps individually checked |
|
|
143
143
|
| `wait`, `prompt` | N/A | No dangerous capabilities |
|
|
144
144
|
|
|
145
|
-
**Gateway is non-optional
|
|
145
|
+
**Gateway is non-optional**: `WorkflowContext.gateway` is required. A `DenyAllGateway` is the default — any code path that reaches a gateway check without going through `step-executor` (which installs a properly-scoped gateway) will fail loudly rather than silently skipping enforcement.
|
|
146
146
|
|
|
147
147
|
---
|
|
148
148
|
|
|
@@ -250,60 +250,13 @@ Before shipping any new or edited spell step, walk through every item. Silently-
|
|
|
250
250
|
|
|
251
251
|
When reviewing a spell PR, scan every bash step for a missing `permissionLevel` and ask: *does this step touch the network, or does it depend on network state from earlier?* If yes, `elevated` (or an explicit `net` grant) is required.
|
|
252
252
|
|
|
253
|
-
## Troubleshooting
|
|
254
|
-
|
|
255
|
-
### Symptom: bash step fails with DNS / SSH resolution errors inside a spell
|
|
256
|
-
|
|
257
|
-
Typical error messages from inside a bash step:
|
|
258
|
-
|
|
259
|
-
- `ssh: Could not resolve hostname github.com: Temporary failure in name resolution`
|
|
260
|
-
- `fatal: Could not read from remote repository.`
|
|
261
|
-
- `curl: (6) Could not resolve host ...`
|
|
262
|
-
- `getaddrinfo ENOTFOUND ...`
|
|
263
|
-
- Any other DNS/connection failure, even though the **same command works in your normal shell**.
|
|
264
|
-
|
|
265
|
-
**Tell-tale clue:** the error mentions `Temporary failure in name resolution` (a glibc-specific wording). That means the step is running inside a Linux sandbox (`bwrap` on Linux / WSL), **not** your outer shell — Git Bash or PowerShell won't produce that exact message.
|
|
266
|
-
|
|
267
|
-
**Root cause:** `src/cli/spells/core/bwrap-sandbox.ts` isolates the network by default:
|
|
268
|
-
|
|
269
|
-
```ts
|
|
270
|
-
if (!hasNet && !needsToolHomeAccess(options.permissionLevel)) {
|
|
271
|
-
args.push('--unshare-net'); // ← no network, no DNS
|
|
272
|
-
}
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
A bash step gets network access only when **one** of these is true:
|
|
276
|
-
|
|
277
|
-
1. The step declares a `net` capability, **or**
|
|
278
|
-
2. The step's `permissionLevel` is `elevated` or `autonomous`.
|
|
279
|
-
|
|
280
|
-
If neither applies, bwrap runs the command in a namespace with `--unshare-net`, and DNS silently fails. There is no log line announcing the network was taken away — you just see the command's own DNS error.
|
|
281
|
-
|
|
282
|
-
**Fix:** for any bash step that does `git pull`/`git push`/`git fetch`, `gh` API calls, `curl`, `npm install`, or any other outbound network:
|
|
283
|
-
|
|
284
|
-
```yaml
|
|
285
|
-
- id: create-branch
|
|
286
|
-
type: bash
|
|
287
|
-
permissionLevel: elevated # ← grants network in bwrap
|
|
288
|
-
config:
|
|
289
|
-
command: "git pull origin main && ..."
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
Or declare the `net` capability explicitly if the step doesn't need the full `elevated` profile (note: `bash-command.ts` must include `net` in its declared capabilities for the engine to accept the grant — otherwise you'll see `Capability violation: step type "bash" does not declare capability "net"`).
|
|
293
|
-
|
|
294
|
-
**Quick diagnosis checklist** when a spell's bash step can't reach the network:
|
|
295
|
-
|
|
296
|
-
1. Does the same command work in your outer shell? If yes, it's sandbox-related, not config.
|
|
297
|
-
2. Is the error wording glibc-style (`Temporary failure in name resolution`)? → bwrap is involved.
|
|
298
|
-
3. Open the spell YAML — does the failing step have `permissionLevel: elevated`? If not, add it and retry.
|
|
299
|
-
4. If you use `set -e` in a multi-command bash step, **do it**. Without it, a trailing `... || true` (common for stash-pop cleanups) will mask the real network failure and you'll see a confusing error several steps later (e.g. "pathspec did not match" when a branch that was never pulled/created is later checked out).
|
|
300
|
-
|
|
301
253
|
## See Also
|
|
302
254
|
|
|
303
|
-
- `.claude/guidance/
|
|
304
|
-
- `.claude/guidance/
|
|
305
|
-
- `.claude/guidance/
|
|
306
|
-
- `.claude/guidance/
|
|
255
|
+
- `.claude/guidance/moflo-spell-engine.md` — Spell definition format and step types
|
|
256
|
+
- `.claude/guidance/moflo-spell-runner.md` — Running spells, dry-run, error codes, pause/resume
|
|
257
|
+
- `.claude/guidance/moflo-spell-troubleshooting.md` — Sandbox/network failure modes (DNS errors, `--unshare-net`, `set -e` traps)
|
|
258
|
+
- `.claude/guidance/moflo-spell-connectors.md` — Optional resource adapters (not the enforcement layer)
|
|
259
|
+
- `.claude/guidance/moflo-core-guidance.md` — Full CLI/MCP reference
|
|
307
260
|
- `src/cli/spells/core/permission-resolver.ts` — Capability → permission level derivation
|
|
308
261
|
- `src/cli/spells/core/permission-disclosure.ts` — Risk classification and reporting
|
|
309
262
|
- `src/cli/spells/core/permission-acceptance.ts` — Acceptance storage and gate
|