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
|
@@ -5,27 +5,21 @@ description: "Create, edit, and validate spell definitions (YAML/JSON) that comp
|
|
|
5
5
|
|
|
6
6
|
# Spell Builder
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Purpose: produce production-ready spell definitions (YAML/JSON) that compose step commands and connectors into end-to-end automated spells, with proper data flow, validation, and engine integration.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Read First — Companion Files
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
| File | When to read |
|
|
13
|
+
|------|--------------|
|
|
14
|
+
| [architecture.md](architecture.md) | **Always** — three-layer model (spell → step → connector); putting logic in the wrong layer is the most common mistake |
|
|
15
|
+
| [permissions.md](permissions.md) | When defining or editing any step — required disclosure & dry-run report format |
|
|
16
|
+
| [preflight.md](preflight.md) | When the step depends on runtime state (clean git tree, logged-in CLI, reachable host) |
|
|
13
17
|
|
|
14
18
|
## Prerequisites
|
|
15
19
|
|
|
16
20
|
- MoFlo project with `cli/spells` package
|
|
17
21
|
- Familiarity with YAML syntax
|
|
18
22
|
|
|
19
|
-
## What This Skill Does
|
|
20
|
-
|
|
21
|
-
1. Guides you through building a **spell definition** (YAML/JSON)
|
|
22
|
-
2. Discovers available **step commands** and **connectors** to compose
|
|
23
|
-
3. Wires up **data flow** between steps via variable references
|
|
24
|
-
4. Validates the generated definition against the engine schema
|
|
25
|
-
5. Outputs the spell file to the correct project directory
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
23
|
## Quick Start
|
|
30
24
|
|
|
31
25
|
Ask the user:
|
|
@@ -44,8 +38,6 @@ Then follow the appropriate section below.
|
|
|
44
38
|
|
|
45
39
|
### Step 1: Gather Spell Metadata
|
|
46
40
|
|
|
47
|
-
Ask the user for:
|
|
48
|
-
|
|
49
41
|
| Field | Required | Example |
|
|
50
42
|
|-------|----------|---------|
|
|
51
43
|
| **Name** | Yes (kebab-case) | `deploy-staging`, `security-audit` |
|
|
@@ -56,7 +48,7 @@ Ask the user for:
|
|
|
56
48
|
|
|
57
49
|
### Step 2: Define Arguments (Optional)
|
|
58
50
|
|
|
59
|
-
If the spell needs runtime parameters, define
|
|
51
|
+
If the spell needs runtime parameters, define each argument:
|
|
60
52
|
|
|
61
53
|
| Field | Required | Description |
|
|
62
54
|
|-------|----------|-------------|
|
|
@@ -65,139 +57,42 @@ If the spell needs runtime parameters, define arguments:
|
|
|
65
57
|
| **Required** | Optional (default `false`) | Whether the argument must be provided |
|
|
66
58
|
| **Default** | Optional | Default value if not provided |
|
|
67
59
|
| **Enum** | Optional | Allowed values (e.g., `[low, medium, high]`) |
|
|
68
|
-
| **Description** | Optional | Help text
|
|
60
|
+
| **Description** | Optional | Help text |
|
|
69
61
|
|
|
70
|
-
Arguments are referenced
|
|
62
|
+
Arguments are referenced via `{args.argumentName}`.
|
|
71
63
|
|
|
72
64
|
### Step 3: Define Steps
|
|
73
65
|
|
|
74
|
-
Walk the user through adding steps one at a time. For each step
|
|
66
|
+
Walk the user through adding steps one at a time. For each step:
|
|
75
67
|
|
|
76
68
|
| Field | Required | Description |
|
|
77
69
|
|-------|----------|-------------|
|
|
78
70
|
| **ID** | Yes (unique) | Step identifier (kebab-case, e.g., `run-tests`) |
|
|
79
71
|
| **Type** | Yes | One of the available step command types (see Discovery section) |
|
|
80
|
-
| **Config** | Yes | Type-specific configuration (see per-
|
|
72
|
+
| **Config** | Yes | Type-specific configuration (see per-step README) |
|
|
81
73
|
| **Output** | Optional | Variable name to store step output (for downstream steps) |
|
|
82
74
|
| **Continue on Error** | Optional | `true` to proceed even if this step fails |
|
|
83
75
|
| **MoFlo Level** | Optional | Override spell-level mofloLevel (can only narrow, not escalate) |
|
|
84
|
-
| **Permission Level** | Optional | `readonly`, `standard`, `elevated`, `autonomous` —
|
|
85
|
-
|
|
86
|
-
**Data flow between steps:** Use `{stepId.outputKey}` syntax to reference output from a previous step. For example, if step `fetch-data` outputs a `url` field, a later step can use `{fetch-data.url}` in its config.
|
|
87
|
-
|
|
88
|
-
#### REQUIRED: Permission Disclosure on Step Creation
|
|
89
|
-
|
|
90
|
-
**After defining each step, you MUST display its permission requirements.** This is not optional — users must understand what each step can do before it becomes part of a spell.
|
|
91
|
-
|
|
92
|
-
For each step, determine and display:
|
|
93
|
-
|
|
94
|
-
1. **Permission level** — derived from capabilities or explicit `permissionLevel`:
|
|
95
|
-
- `readonly` (Read, Glob, Grep) — safe, analysis only
|
|
96
|
-
- `standard` (Edit, Write, Read, Glob, Grep) — can modify files
|
|
97
|
-
- `elevated` (Edit, Write, Bash, Read, Glob, Grep) — can run shell commands
|
|
98
|
-
- `autonomous` (all tools) — unrestricted, requires explicit opt-in
|
|
99
|
-
|
|
100
|
-
2. **Risk classification** — based on the step's capabilities:
|
|
101
|
-
- **[SAFE]** — `fs:read`, `memory` only — no side effects
|
|
102
|
-
- **[SENSITIVE]** — `agent`, `net`, `browser` — can read external data or spawn processes
|
|
103
|
-
- **[DESTRUCTIVE]** — `shell`, `fs:write`, `browser:evaluate`, `credentials` — can permanently modify/delete data
|
|
104
|
-
|
|
105
|
-
3. **Specific warnings** — for each destructive or sensitive capability, explain:
|
|
106
|
-
- `shell`: "Can execute arbitrary shell commands (rm, git push, etc.)"
|
|
107
|
-
- `fs:write`: "Can create, overwrite, or delete files on disk"
|
|
108
|
-
- `credentials`: "Can access stored secrets and API keys"
|
|
109
|
-
- `agent`: "Can spawn autonomous Claude sub-agents"
|
|
110
|
-
- `net`: "Can make network requests to external services"
|
|
111
|
-
|
|
112
|
-
**Display format (show after every step definition):**
|
|
113
|
-
|
|
114
|
-
```
|
|
115
|
-
Permissions for step "deploy-code":
|
|
116
|
-
[DESTRUCTIVE] deploy-code (bash)
|
|
117
|
-
Permission level: elevated
|
|
118
|
-
Allowed tools: Edit, Write, Bash, Read, Glob, Grep
|
|
119
|
-
Warnings:
|
|
120
|
-
!! shell: Can execute arbitrary shell commands (rm, git push, etc.)
|
|
121
|
-
!! fs:write: Can create, overwrite, or delete files on disk
|
|
122
|
-
```
|
|
76
|
+
| **Permission Level** | Optional | `readonly`, `standard`, `elevated`, `autonomous` — auto-derived from capabilities when omitted |
|
|
123
77
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
Permissions for step "analyze-logs":
|
|
128
|
-
[SAFE] analyze-logs (bash)
|
|
129
|
-
Permission level: readonly
|
|
130
|
-
Allowed tools: Read, Glob, Grep
|
|
131
|
-
No destructive capabilities.
|
|
132
|
-
```
|
|
78
|
+
**Data flow between steps:** Use `{stepId.outputKey}` syntax to reference output from a previous step. For example, if step `fetch-data` outputs a `url` field, a later step can use `{fetch-data.url}`.
|
|
133
79
|
|
|
134
80
|
**Special variable references:**
|
|
135
81
|
- `{args.name}` — references a spell argument
|
|
136
82
|
- `{credentials.NAME}` — references a credential (resolved at runtime)
|
|
137
83
|
- `{stepId.outputKey}` — references output from a previous step
|
|
138
84
|
|
|
139
|
-
#### REQUIRED:
|
|
140
|
-
|
|
141
|
-
When a step depends on runtime state the user controls (clean git tree, logged-in CLI, reachable host, etc.), declare a `preflight:` block so the spell fails fast with a helpful message BEFORE any side effects occur.
|
|
142
|
-
|
|
143
|
-
**Every preflight MUST include a `hint:` field.** The hint is what the end user will see when the check fails. Without it they get raw shell output (`command "git diff --quiet" exited with 1, expected 0`), which looks like a bug in the spell engine.
|
|
144
|
-
|
|
145
|
-
Good hints:
|
|
146
|
-
- Speak in plain English (no command names, exit codes, or tool jargon).
|
|
147
|
-
- State the problem AND the fix in one or two sentences.
|
|
148
|
-
- Assume a non-technical reader.
|
|
149
|
-
|
|
150
|
-
```yaml
|
|
151
|
-
steps:
|
|
152
|
-
- id: create-branch
|
|
153
|
-
type: bash
|
|
154
|
-
preflight:
|
|
155
|
-
- name: "working tree clean (tracked changes)"
|
|
156
|
-
command: "git diff --quiet"
|
|
157
|
-
hint: "You have uncommitted changes to tracked files. Commit them or stash them (git stash) before running this spell."
|
|
158
|
-
- name: "gh cli authenticated"
|
|
159
|
-
command: "gh auth status"
|
|
160
|
-
hint: "The GitHub CLI isn't signed in. Run: gh auth login"
|
|
161
|
-
config:
|
|
162
|
-
command: "git checkout -b feature/new"
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
Bad hint (don't do this):
|
|
166
|
-
```yaml
|
|
167
|
-
hint: "git diff --quiet failed with exit code 1" # leaks command name + exit code
|
|
168
|
-
hint: "Precondition violated" # tells user nothing actionable
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
Preflights with no `hint` still work but produce unfriendly default output — flag this to the user as a quality issue before saving the spell.
|
|
172
|
-
|
|
173
|
-
##### Fatal vs warning severity
|
|
174
|
-
|
|
175
|
-
By default every preflight is `severity: fatal` — if it fails, the spell aborts. Some preflights are better expressed as `severity: warning`: the user gets to choose how to handle the problem, and the spell continues if they pick a resolution.
|
|
85
|
+
#### REQUIRED: Permission disclosure on step creation
|
|
176
86
|
|
|
177
|
-
|
|
178
|
-
- The underlying problem has a safe, one-step fix the user might reasonably want to apply.
|
|
179
|
-
- Proceeding is viable either way — the step itself is robust to the condition.
|
|
87
|
+
After defining each step, display its permission profile. **See [permissions.md](permissions.md) for the required format and per-capability warnings.** Apply automatically — users must understand what each step can do before it becomes part of a spell.
|
|
180
88
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
```yaml
|
|
184
|
-
preflight:
|
|
185
|
-
- name: "working tree clean (tracked changes)"
|
|
186
|
-
command: "git diff --quiet"
|
|
187
|
-
severity: "warning"
|
|
188
|
-
hint: "You have uncommitted changes. If you want them carried onto the new branch, pick 'Stash and carry over'."
|
|
189
|
-
resolutions:
|
|
190
|
-
- label: "Stash changes and carry them onto the new branch"
|
|
191
|
-
command: "git stash push --include-untracked --message 'pre-spell autostash'"
|
|
192
|
-
- label: "Commit changes to the current branch first, then continue"
|
|
193
|
-
command: "git commit -am 'wip: pre-spell snapshot'"
|
|
194
|
-
```
|
|
89
|
+
#### REQUIRED: Preflight checks with human-readable hints
|
|
195
90
|
|
|
196
|
-
|
|
91
|
+
When a step depends on runtime state the user controls (clean git tree, logged-in CLI, reachable host, etc.), declare a `preflight:` block so the spell fails fast with a helpful message before any side effects. Every preflight MUST include a `hint:` field — the user-visible message on failure. **See [preflight.md](preflight.md) for the full guide (severity levels, resolutions, hint copywriting rules).**
|
|
197
92
|
|
|
198
93
|
### Step 4: Generate the Spell YAML
|
|
199
94
|
|
|
200
|
-
Assemble the definition into
|
|
95
|
+
Assemble the definition into:
|
|
201
96
|
|
|
202
97
|
```yaml
|
|
203
98
|
name: <spell-name>
|
|
@@ -226,17 +121,17 @@ steps:
|
|
|
226
121
|
|
|
227
122
|
### Step 5: Validate the Spell
|
|
228
123
|
|
|
229
|
-
|
|
124
|
+
Validate against the engine schema. The following rules must pass:
|
|
230
125
|
|
|
231
126
|
1. **`name`** is required and must be a non-empty string
|
|
232
127
|
2. **`steps`** is required and must be a non-empty array
|
|
233
128
|
3. Each step must have a unique **`id`** (no duplicates)
|
|
234
129
|
4. Each step must have a valid **`type`** matching a known step command
|
|
235
|
-
5. **Variable references** (`{stepId.outputKey}`) must not be forward references
|
|
130
|
+
5. **Variable references** (`{stepId.outputKey}`) must not be forward references
|
|
236
131
|
6. **Argument references** (`{args.name}`) must match declared arguments
|
|
237
132
|
7. **`mofloLevel`** must be one of: `none`, `memory`, `hooks`, `full`, `recursive`
|
|
238
133
|
8. Step-level `mofloLevel` cannot exceed the spell-level `mofloLevel`
|
|
239
|
-
9. No **circular condition jumps
|
|
134
|
+
9. No **circular** condition jumps (condition steps referencing each other in a loop)
|
|
240
135
|
10. **Argument definitions** must have valid types, and defaults must match their declared type
|
|
241
136
|
11. **`permissionLevel`** (if declared) must be one of: `readonly`, `standard`, `elevated`, `autonomous`
|
|
242
137
|
|
|
@@ -244,56 +139,17 @@ If validation fails, show the specific errors and guide the user to fix them.
|
|
|
244
139
|
|
|
245
140
|
### Step 5b: REQUIRED — Permission Dry-Run Report
|
|
246
141
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
Display the report in this format:
|
|
250
|
-
|
|
251
|
-
```
|
|
252
|
-
Permission Report: <spell-name>
|
|
253
|
-
Overall risk: [DESTRUCTIVE] destructive
|
|
254
|
-
Permission hash: a1b2c3d4e5f6g7h8
|
|
255
|
-
|
|
256
|
-
[SAFE] fetch-config (bash)
|
|
257
|
-
Permission level: readonly
|
|
258
|
-
Allowed tools: Read, Glob, Grep
|
|
259
|
-
|
|
260
|
-
[DESTRUCTIVE] implement-story (bash)
|
|
261
|
-
Permission level: elevated
|
|
262
|
-
Allowed tools: Edit, Write, Bash, Read, Glob, Grep
|
|
263
|
-
Warnings:
|
|
264
|
-
!! shell: Can execute arbitrary shell commands (rm, git push, etc.)
|
|
265
|
-
!! fs:write: Can create, overwrite, or delete files on disk
|
|
266
|
-
|
|
267
|
-
[SENSITIVE] analyze-results (agent)
|
|
268
|
-
Permission level: standard
|
|
269
|
-
Allowed tools: Edit, Write, Read, Glob, Grep
|
|
270
|
-
Warnings:
|
|
271
|
-
! agent: Can spawn autonomous Claude sub-agents
|
|
272
|
-
|
|
273
|
-
--- DESTRUCTIVE STEPS ---
|
|
274
|
-
1 step(s) can make destructive changes:
|
|
275
|
-
- implement-story: shell, fs:write
|
|
276
|
-
|
|
277
|
-
These steps can modify files, run shell commands, or access credentials.
|
|
278
|
-
Review the spell definition before accepting.
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
**After showing the report, ask the user:**
|
|
282
|
-
|
|
283
|
-
> The spell requires the permissions shown above. Do you accept? (y/n)
|
|
284
|
-
|
|
285
|
-
If the user accepts, the permission hash is stored and subsequent runs will not prompt again (unless the spell's permissions change).
|
|
286
|
-
|
|
287
|
-
**Regular runs** (not dry-runs) do NOT show this verbose permission output — they just run quietly. The acceptance gate checks the stored hash and only blocks if it doesn't match.
|
|
142
|
+
After schema validation passes, display the full spell-wide permission report and require user acceptance before the spell can be cast. **See [permissions.md](permissions.md) for the exact format.** On acceptance the permission hash is stored — subsequent runs do not re-prompt unless the spell's permissions change.
|
|
288
143
|
|
|
289
144
|
### Step 6: Write the File
|
|
290
145
|
|
|
291
|
-
Ask the user where to save
|
|
146
|
+
Ask the user where to save:
|
|
292
147
|
|
|
293
148
|
- **Project spells:** `spells/<name>.yaml` (user-level, project-specific)
|
|
294
149
|
- **Claude spells:** `.claude/spells/<name>.yaml` (Claude Code integration)
|
|
295
150
|
|
|
296
|
-
|
|
151
|
+
Prefer the MCP tool when available:
|
|
152
|
+
|
|
297
153
|
```
|
|
298
154
|
mcp__moflo__spell_create — name, definition (YAML string), description
|
|
299
155
|
```
|
|
@@ -306,21 +162,14 @@ Or write the file directly to the chosen directory.
|
|
|
306
162
|
|
|
307
163
|
### Step 1: Load the Spell
|
|
308
164
|
|
|
309
|
-
Ask for the spell file path, or use `mcp__moflo__spell_list` to browse available spells.
|
|
310
|
-
|
|
311
|
-
Read the YAML/JSON file and parse the current definition.
|
|
165
|
+
Ask for the spell file path, or use `mcp__moflo__spell_list` to browse available spells. Read the YAML/JSON file and parse the current definition.
|
|
312
166
|
|
|
313
167
|
### Step 2: Present Current Structure
|
|
314
168
|
|
|
315
|
-
Show a summary
|
|
316
|
-
- Name, description, version, abbreviation
|
|
317
|
-
- Arguments (if any)
|
|
318
|
-
- Steps list with: id, type, output variable, continueOnError
|
|
169
|
+
Show a summary: name, description, version, abbreviation, arguments (if any), steps list with id/type/output variable/continueOnError.
|
|
319
170
|
|
|
320
171
|
### Step 3: Apply Changes
|
|
321
172
|
|
|
322
|
-
Support these edit operations:
|
|
323
|
-
|
|
324
173
|
| Operation | Description |
|
|
325
174
|
|-----------|-------------|
|
|
326
175
|
| **Add step** | Insert a new step at a given position |
|
|
@@ -331,9 +180,7 @@ Support these edit operations:
|
|
|
331
180
|
| **Add/remove arguments** | Modify spell argument definitions |
|
|
332
181
|
| **Update metadata** | Change name, description, version, abbreviation, mofloLevel |
|
|
333
182
|
|
|
334
|
-
After each change, re-validate
|
|
335
|
-
|
|
336
|
-
**REQUIRED: When adding or modifying a step, display its permission report** (same format as Section 1, Step 3 — Permission Disclosure on Step Creation). If the change introduces new destructive capabilities or raises the permission level, explicitly call this out to the user.
|
|
183
|
+
After each change, re-validate and show any errors introduced. **When adding or modifying a step, display its permission report (see [permissions.md](permissions.md)).** If the change introduces new destructive capabilities or raises the permission level, call this out explicitly.
|
|
337
184
|
|
|
338
185
|
### Step 4: Save
|
|
339
186
|
|
|
@@ -345,35 +192,33 @@ Write the updated YAML back to the original file (or a new path if requested).
|
|
|
345
192
|
|
|
346
193
|
### Step Commands
|
|
347
194
|
|
|
348
|
-
|
|
195
|
+
Each step type has its own self-contained README under `.claude/skills/spell-builder/steps/`:
|
|
349
196
|
|
|
350
197
|
```
|
|
351
198
|
.claude/skills/spell-builder/steps/
|
|
352
199
|
<step-name>/README.md — config, outputs, usage examples, source path
|
|
353
200
|
```
|
|
354
201
|
|
|
355
|
-
|
|
202
|
+
To find available steps, `Glob` `.claude/skills/spell-builder/steps/*/README.md` and read each H1.
|
|
356
203
|
|
|
357
204
|
**Runtime source:** `src/cli/spells/commands/` — each step is a TypeScript file registered in `index.ts`.
|
|
358
205
|
|
|
359
|
-
**Adding a new step:**
|
|
206
|
+
**Adding a new step:** create `steps/<name>/README.md` (use existing READMEs as templates and follow `.claude/guidance/moflo-guidance-rules.md`); the step source goes in `src/cli/spells/commands/` and is registered in `index.ts`. No changes to this SKILL.md needed.
|
|
360
207
|
|
|
361
208
|
### Connectors
|
|
362
209
|
|
|
363
|
-
|
|
210
|
+
Each connector has its own self-contained README under `.claude/skills/spell-builder/connectors/`:
|
|
364
211
|
|
|
365
212
|
```
|
|
366
213
|
.claude/skills/spell-builder/connectors/
|
|
367
214
|
<connector-name>/README.md — actions, capabilities, usage, source path
|
|
368
215
|
```
|
|
369
216
|
|
|
370
|
-
|
|
217
|
+
To find available connectors, `Glob` `.claude/skills/spell-builder/connectors/*/README.md`.
|
|
371
218
|
|
|
372
219
|
**Runtime source:** `src/cli/spells/connectors/` — each connector is a TypeScript file registered in `index.ts`.
|
|
373
220
|
|
|
374
|
-
**Adding a new connector:**
|
|
375
|
-
|
|
376
|
-
**When to create a new connector vs composing existing ones:** See [architecture.md](architecture.md) for the decision tree.
|
|
221
|
+
**Adding a new connector:** create `connectors/<name>/README.md`; the connector source goes in `src/cli/spells/connectors/` and is registered in `index.ts`. **When to create a new connector vs composing existing ones:** see [architecture.md](architecture.md).
|
|
377
222
|
|
|
378
223
|
---
|
|
379
224
|
|
|
@@ -385,19 +230,12 @@ Read the spell file (YAML or JSON). The parser auto-detects format.
|
|
|
385
230
|
|
|
386
231
|
### Step 2: Run Validation
|
|
387
232
|
|
|
388
|
-
Check against all engine validation rules
|
|
389
|
-
|
|
390
|
-
- Required fields: `name` (string), `steps` (non-empty array)
|
|
391
|
-
- Step integrity: unique IDs, valid types, valid config structure
|
|
392
|
-
- Variable references: no forward references, no undefined arguments
|
|
393
|
-
- MoFlo levels: valid values, step-level cannot exceed the spell-level
|
|
394
|
-
- Circular jumps: condition steps must not form cycles
|
|
395
|
-
- Arguments: valid types, defaults match declared type, enum consistency
|
|
233
|
+
Check against all engine validation rules from Section 1, Step 5.
|
|
396
234
|
|
|
397
235
|
### Step 3: Report Results
|
|
398
236
|
|
|
399
|
-
- **Valid:**
|
|
400
|
-
- **Invalid:**
|
|
237
|
+
- **Valid:** confirm the spell passes all checks.
|
|
238
|
+
- **Invalid:** list each error with its path and message, then offer to fix.
|
|
401
239
|
|
|
402
240
|
---
|
|
403
241
|
|
|
@@ -470,9 +308,6 @@ steps:
|
|
|
470
308
|
- name: "npm available"
|
|
471
309
|
command: "npm --version"
|
|
472
310
|
hint: "npm isn't installed or isn't on your PATH. Install Node.js from https://nodejs.org and try again."
|
|
473
|
-
- name: "target directory exists"
|
|
474
|
-
command: "test -d \"{args.target}\""
|
|
475
|
-
hint: "The directory you passed as --target doesn't exist. Check the path and try again."
|
|
476
311
|
config:
|
|
477
312
|
command: "npm audit --json"
|
|
478
313
|
cwd: "{args.target}"
|
|
@@ -484,30 +319,8 @@ steps:
|
|
|
484
319
|
prompt: |
|
|
485
320
|
Analyze the npm audit results and filter for severity >= {args.severity}.
|
|
486
321
|
Audit output: {scan-deps.result}
|
|
487
|
-
Produce a summary of vulnerabilities found.
|
|
488
322
|
output: analysis
|
|
489
323
|
|
|
490
|
-
- id: check-critical
|
|
491
|
-
type: condition
|
|
492
|
-
config:
|
|
493
|
-
expression: "{analysis.hasCritical} === true"
|
|
494
|
-
then: report-critical
|
|
495
|
-
else: report-clean
|
|
496
|
-
|
|
497
|
-
- id: report-critical
|
|
498
|
-
type: agent
|
|
499
|
-
config:
|
|
500
|
-
prompt: |
|
|
501
|
-
Critical vulnerabilities found. Generate a detailed report
|
|
502
|
-
with remediation steps for: {analysis.criticalItems}
|
|
503
|
-
|
|
504
|
-
- id: report-clean
|
|
505
|
-
type: agent
|
|
506
|
-
config:
|
|
507
|
-
prompt: |
|
|
508
|
-
No critical vulnerabilities. Generate a summary report
|
|
509
|
-
of {analysis.totalFindings} findings at {args.severity}+ severity.
|
|
510
|
-
|
|
511
324
|
- id: save-report
|
|
512
325
|
type: memory
|
|
513
326
|
config:
|
|
@@ -519,4 +332,4 @@ steps:
|
|
|
519
332
|
|
|
520
333
|
### Related Skills
|
|
521
334
|
|
|
522
|
-
- [/connector-builder](../connector-builder/)
|
|
335
|
+
- [/connector-builder](../connector-builder/) — scaffold new connectors and step commands when the spell needs a component that doesn't exist yet
|
|
@@ -153,7 +153,7 @@ steps:
|
|
|
153
153
|
|
|
154
154
|
## Documentation Rules for New Components
|
|
155
155
|
|
|
156
|
-
**Every new step, connector, or spell MUST include a README.md.** Apply the rules in `.claude/guidance/
|
|
156
|
+
**Every new step, connector, or spell MUST include a README.md.** Apply the rules in `.claude/guidance/moflo-guidance-rules.md` automatically — do not wait for the user to ask. Use existing READMEs in `steps/` and `connectors/` as templates.
|
|
157
157
|
|
|
158
158
|
**Where to put the README:**
|
|
159
159
|
- Steps: `.claude/skills/spell-builder/steps/<name>/README.md`
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Spell Permissions — Disclosure & Dry-Run Reporting
|
|
2
|
+
|
|
3
|
+
Purpose: when authoring or modifying a spell, you MUST surface what each step is allowed to do **before** the spell becomes runnable. This file is the canonical reference for that behaviour and is shared by the `spell-builder` and `connector-builder` skills.
|
|
4
|
+
|
|
5
|
+
## Permission Levels
|
|
6
|
+
|
|
7
|
+
Levels control which Claude CLI tools a step's sub-agent receives. Auto-derived from declared `capabilities` unless the step sets `permissionLevel:` explicitly. `autonomous` is never auto-derived — it requires explicit opt-in.
|
|
8
|
+
|
|
9
|
+
| Level | Tools | Auto-derived when |
|
|
10
|
+
|-------|-------|-------------------|
|
|
11
|
+
| `readonly` | Read, Glob, Grep | Only `fs:read`, `memory` capabilities |
|
|
12
|
+
| `standard` | Edit, Write, Read, Glob, Grep | Has `fs:write` or `agent`, no `shell`/`browser` |
|
|
13
|
+
| `elevated` | Edit, Write, Bash, Read, Glob, Grep | Has `shell` or `browser` |
|
|
14
|
+
| `autonomous` | All tools | Never auto — explicit opt-in only |
|
|
15
|
+
|
|
16
|
+
## Risk Classification
|
|
17
|
+
|
|
18
|
+
| Class | Triggered by | Meaning |
|
|
19
|
+
|-------|--------------|---------|
|
|
20
|
+
| `[SAFE]` | `fs:read`, `memory` only | No side effects |
|
|
21
|
+
| `[SENSITIVE]` | `agent`, `net`, `browser` | Reads external data or spawns processes |
|
|
22
|
+
| `[DESTRUCTIVE]` | `shell`, `fs:write`, `browser:evaluate`, `credentials` | Can permanently modify or delete data |
|
|
23
|
+
|
|
24
|
+
## Capability Warnings
|
|
25
|
+
|
|
26
|
+
For each destructive or sensitive capability declared on a step, include the matching warning in disclosure output:
|
|
27
|
+
|
|
28
|
+
| Capability | Warning text |
|
|
29
|
+
|------------|--------------|
|
|
30
|
+
| `shell` | "Can execute arbitrary shell commands (rm, git push, etc.)" |
|
|
31
|
+
| `fs:write` | "Can create, overwrite, or delete files on disk" |
|
|
32
|
+
| `credentials` | "Can access stored secrets and API keys" |
|
|
33
|
+
| `agent` | "Can spawn autonomous Claude sub-agents" |
|
|
34
|
+
| `net` | "Can make network requests to external services" |
|
|
35
|
+
| `browser` | "Can drive a browser session, including form submission and downloads" |
|
|
36
|
+
|
|
37
|
+
## Per-Step Disclosure (REQUIRED on step creation)
|
|
38
|
+
|
|
39
|
+
After defining or modifying a step, display its permission profile. For destructive/sensitive steps:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Permissions for step "deploy-code":
|
|
43
|
+
[DESTRUCTIVE] deploy-code (bash)
|
|
44
|
+
Permission level: elevated
|
|
45
|
+
Allowed tools: Edit, Write, Bash, Read, Glob, Grep
|
|
46
|
+
Warnings:
|
|
47
|
+
!! shell: Can execute arbitrary shell commands (rm, git push, etc.)
|
|
48
|
+
!! fs:write: Can create, overwrite, or delete files on disk
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For safe steps, still display — with a reassuring tone:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
Permissions for step "analyze-logs":
|
|
55
|
+
[SAFE] analyze-logs (bash)
|
|
56
|
+
Permission level: readonly
|
|
57
|
+
Allowed tools: Read, Glob, Grep
|
|
58
|
+
No destructive capabilities.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
When editing an existing step, if the change introduces new destructive capabilities or raises the permission level, call this out explicitly.
|
|
62
|
+
|
|
63
|
+
## Spell-Wide Dry-Run Report (REQUIRED before first run)
|
|
64
|
+
|
|
65
|
+
After schema validation passes for a new or updated spell, display the full permission report and require user acceptance before the spell can be cast:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Permission Report: <spell-name>
|
|
69
|
+
Overall risk: [DESTRUCTIVE] destructive
|
|
70
|
+
Permission hash: a1b2c3d4e5f6g7h8
|
|
71
|
+
|
|
72
|
+
[SAFE] fetch-config (bash)
|
|
73
|
+
Permission level: readonly
|
|
74
|
+
Allowed tools: Read, Glob, Grep
|
|
75
|
+
|
|
76
|
+
[DESTRUCTIVE] implement-story (bash)
|
|
77
|
+
Permission level: elevated
|
|
78
|
+
Allowed tools: Edit, Write, Bash, Read, Glob, Grep
|
|
79
|
+
Warnings:
|
|
80
|
+
!! shell: Can execute arbitrary shell commands (rm, git push, etc.)
|
|
81
|
+
!! fs:write: Can create, overwrite, or delete files on disk
|
|
82
|
+
|
|
83
|
+
[SENSITIVE] analyze-results (agent)
|
|
84
|
+
Permission level: standard
|
|
85
|
+
Allowed tools: Edit, Write, Read, Glob, Grep
|
|
86
|
+
Warnings:
|
|
87
|
+
! agent: Can spawn autonomous Claude sub-agents
|
|
88
|
+
|
|
89
|
+
--- DESTRUCTIVE STEPS ---
|
|
90
|
+
1 step(s) can make destructive changes:
|
|
91
|
+
- implement-story: shell, fs:write
|
|
92
|
+
|
|
93
|
+
These steps can modify files, run shell commands, or access credentials.
|
|
94
|
+
Review the spell definition before accepting.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Then ask:
|
|
98
|
+
|
|
99
|
+
> The spell requires the permissions shown above. Do you accept? (y/n)
|
|
100
|
+
|
|
101
|
+
On acceptance the permission hash is stored. Subsequent runs do NOT re-prompt unless the spell's permissions change. Regular runs (not dry-runs) skip this verbose output and silently check the stored hash.
|
|
102
|
+
|
|
103
|
+
## See Also
|
|
104
|
+
|
|
105
|
+
- [SKILL.md](SKILL.md) — main spell-builder skill
|
|
106
|
+
- [preflight.md](preflight.md) — preflight check authoring
|
|
107
|
+
- [architecture.md](architecture.md) — three-layer model (spell → step → connector)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Preflight Checks — Author Guide
|
|
2
|
+
|
|
3
|
+
Purpose: preflight checks let a step fail fast with a helpful message **before** any side effects occur, when the failure depends on runtime state the user controls (clean git tree, logged-in CLI, reachable host, etc.).
|
|
4
|
+
|
|
5
|
+
## Required: every preflight has a `hint:` field
|
|
6
|
+
|
|
7
|
+
The `hint:` is what the end user sees on failure. Without it they get raw shell output (`command "git diff --quiet" exited with 1, expected 0`) which looks like a bug in the spell engine.
|
|
8
|
+
|
|
9
|
+
Good hints:
|
|
10
|
+
- Plain English. No command names, exit codes, internal identifiers.
|
|
11
|
+
- State BOTH the problem AND the fix in one or two sentences.
|
|
12
|
+
- Assume a non-technical reader.
|
|
13
|
+
|
|
14
|
+
```yaml
|
|
15
|
+
steps:
|
|
16
|
+
- id: create-branch
|
|
17
|
+
type: bash
|
|
18
|
+
preflight:
|
|
19
|
+
- name: "working tree clean (tracked changes)"
|
|
20
|
+
command: "git diff --quiet"
|
|
21
|
+
hint: "You have uncommitted changes to tracked files. Commit them or stash them (git stash) before running this spell."
|
|
22
|
+
- name: "gh cli authenticated"
|
|
23
|
+
command: "gh auth status"
|
|
24
|
+
hint: "The GitHub CLI isn't signed in. Run: gh auth login"
|
|
25
|
+
config:
|
|
26
|
+
command: "git checkout -b feature/new"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Bad hints (don't do this):
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
hint: "git diff --quiet failed with exit code 1" # leaks command name + exit code
|
|
33
|
+
hint: "Precondition violated" # tells user nothing actionable
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Preflights without `hint` still work but produce unfriendly default output — flag this as a quality issue before saving the spell.
|
|
37
|
+
|
|
38
|
+
## Severity: fatal vs warning
|
|
39
|
+
|
|
40
|
+
Default `severity: fatal` — failure aborts the spell. Use `severity: warning` ONLY when:
|
|
41
|
+
|
|
42
|
+
- The underlying problem has a safe, one-step fix the user might reasonably want to apply.
|
|
43
|
+
- Proceeding is viable either way — the step itself is robust to the condition.
|
|
44
|
+
|
|
45
|
+
Warning preflights MUST declare `resolutions:` — a list the user can pick from. Each resolution has a `label` and an optional `command` to run before continuing. If `command` is omitted, picking the resolution just proceeds (useful for "I'll handle it myself").
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
preflight:
|
|
49
|
+
- name: "working tree clean (tracked changes)"
|
|
50
|
+
command: "git diff --quiet"
|
|
51
|
+
severity: "warning"
|
|
52
|
+
hint: "You have uncommitted changes. If you want them carried onto the new branch, pick 'Stash and carry over'."
|
|
53
|
+
resolutions:
|
|
54
|
+
- label: "Stash changes and carry them onto the new branch"
|
|
55
|
+
command: "git stash push --include-untracked --message 'pre-spell autostash'"
|
|
56
|
+
- label: "Commit changes to the current branch first, then continue"
|
|
57
|
+
command: "git commit -am 'wip: pre-spell snapshot'"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
In non-interactive contexts (CI, daemons, scheduled spells) warnings automatically behave like fatals — there is no one to prompt. Don't use `warning` to silently ignore a problem; if ignoring is always safe, the check shouldn't be there.
|
|
61
|
+
|
|
62
|
+
## Step-Command Preflight Checks (TypeScript)
|
|
63
|
+
|
|
64
|
+
When authoring a step command (see `connector-builder`), the `preflight:` array on the command takes a `check` function. The `reason` string returned on failure is shown verbatim to end users — same copywriting rules apply.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
preflight: [
|
|
68
|
+
{
|
|
69
|
+
name: '<service> reachable',
|
|
70
|
+
severity: 'fatal',
|
|
71
|
+
check: async (config, ctx) => {
|
|
72
|
+
const ok = await ping(config.endpoint);
|
|
73
|
+
if (ok) return { passed: true };
|
|
74
|
+
return {
|
|
75
|
+
passed: false,
|
|
76
|
+
reason: `Can't reach ${config.endpoint}. Check your network connection or the service URL in your spell config.`,
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'local cache fresh',
|
|
82
|
+
severity: 'warning',
|
|
83
|
+
resolutions: [
|
|
84
|
+
{ label: 'Refresh the cache now', command: '<type>-cli cache refresh' },
|
|
85
|
+
{ label: 'Continue with stale cache' },
|
|
86
|
+
],
|
|
87
|
+
check: async (config) => {
|
|
88
|
+
const stale = await isCacheStale(config.endpoint);
|
|
89
|
+
return stale
|
|
90
|
+
? { passed: false, reason: 'Your local cache is more than 24 hours old and may produce outdated results.' }
|
|
91
|
+
: { passed: true };
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## See Also
|
|
98
|
+
|
|
99
|
+
- [SKILL.md](SKILL.md) — main spell-builder skill
|
|
100
|
+
- [permissions.md](permissions.md) — permission disclosure & dry-run reporting
|
|
101
|
+
- [architecture.md](architecture.md) — three-layer model
|
|
@@ -143,7 +143,7 @@ If the user asks to **run now** without altering the cadence:
|
|
|
143
143
|
- **Catch-up window** (default 1h, `scheduler.catchUpWindowMs` in `moflo.yaml`): if the daemon was offline when a run was due, runs within the window still fire on the next poll. Older missed runs are skipped with a `schedule:skipped` event.
|
|
144
144
|
- **maxConcurrent** (default 2): caps the number of scheduled spells running concurrently. Same-schedule overlap is never allowed.
|
|
145
145
|
- **No update CLI yet**: `flo spell schedule` exposes create/list/cancel only. To change a cadence, cancel + recreate.
|
|
146
|
-
- **Spell-required sandboxing
|
|
146
|
+
- **Spell-required sandboxing**: when sandbox-required spells become enforced, scheduled runs will honor it just like manual casts — a missing sandbox skips the run with a `schedule:skipped` event.
|
|
147
147
|
|
|
148
148
|
## Output
|
|
149
149
|
|
|
@@ -163,5 +163,4 @@ Daemon: running | needs-start
|
|
|
163
163
|
|
|
164
164
|
## Reference
|
|
165
165
|
|
|
166
|
-
- Full daemon scheduler docs:
|
|
167
|
-
- Tracking issue: https://github.com/eric-cielo/moflo/issues/877
|
|
166
|
+
- Full daemon scheduler docs: see `docs/SPELLS.md#scheduling` in the moflo source tree
|