Skip to content

feat(flow-orchestrate): multi-agent orchestrator skill for Flow development#28

Open
claucondor wants to merge 28 commits intoonflow:mainfrom
claucondor:feature/flow-orchestrate
Open

feat(flow-orchestrate): multi-agent orchestrator skill for Flow development#28
claucondor wants to merge 28 commits intoonflow:mainfrom
claucondor:feature/flow-orchestrate

Conversation

@claucondor
Copy link
Copy Markdown

Summary

Adds a flow-orchestrate skill that routes complex, multi-domain Flow development tasks to specialized subagents. Each agent receives only the reference files for its domain — keeping per-agent context 80-90% leaner than loading all 50 reference files.

Validated end-to-end: a single prompt produced a production-ready NFT contract, passed a security audit (2 High findings found and fixed), deployed to emulator, profiled CU across N=10–1000, and computed a governance-updatable mint fee — all without manual coding. See claucondor/flow-orchestator-test.

Requirements

Mode What it uses Requirement
Pipeline (most tasks) parallel Agent() calls, sequential handoffs none — works out of the box
Team mode (back-and-forth cycles) TeamCreate + SendMessage peer-to-peer CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in ~/.claude/settings.json

The orchestrator detects which mode to use based on task complexity and documents the check command inline in SKILL.md. Most workflows run as a pipeline and need no flag.

What's included

flow-orchestrate/SKILL.md — orchestrator briefing: agent roster with capabilities and limitations, plugin root resolution, workspace scoping, parallel vs sequential rules, Team vs subagent decision criteria, experimental flag requirement, plan announcement format.

flow-orchestrate/agents/ — 8 agent templates:

Agent Domain
cu-profiler CU cost measurement via testnet sweep
storage-architect Cadence resource layout optimization
cross-vm-bridge Cadence↔EVM boundary (COA, ABI encoding, dryCall)
cadence-deploy compile → deploy → verify cycle
economic-designer fees, treasury design, solvency analysis
security-auditor vulnerability audit with severity-rated findings
test-architect CDC native + Go/overflow test suites
frontend-dev React UI with @onflow/react-sdk

Each template: role, when-to-spawn criteria, refs to embed, full prompt with embedded domain knowledge, team peer-routing (who sends what to whom), token budget.

flow-orchestrate/references/task-routing.md — decision tree: task keywords → agent sets, Phase 0 dependency install, parallel/sequential ordering, file conflict detection.

flow-orchestrate/references/handoff-format.md — structured output each agent must produce so downstream agents consume results without re-reading everything.

New cross-skill references:

  • cadence-lang/references/cu-optimization.md — CU cost table, high-CU patterns, MAX_SAFE_N methodology
  • flow-dev-setup/references/testing-patterns.md — CDC native vs Go/overflow decision tree, adversarial test categories
  • flow-project-setup/references/upgrade-strategies.md — allowed/forbidden upgrades, new-name migration, rollback
  • flow-defi/references/protocol-architecture.md — appended cross-VM failure modes

Design decisions

Phase 0 always runs first. The orchestrator runs flow dependencies install before any agent touches .cdc files. Agents never search the filesystem for standard contracts.

Project root is explicit in every agent prompt. Prevents agents from reading files from unrelated projects on the same machine.

Agent templates are a base, not a fixed list. Orchestrator adds cadence-scaffold refs when generating new code, and domain refs (access-control, transactions) when the task calls for it.

Test run

claucondor/flow-orchestator-test — 7 commits tracing each agent's output, 176 tool calls, ~22 min. CU model: CU(N) = 4.46N + 9.68 (R²=0.9999), MAX_SAFE_N=2013, MINT_FEE=0.00000025 FLOW.

Introduces the flow-orchestrate skill that routes multi-domain tasks to
specialized subagents. Each agent loads only the references for its domain,
reducing per-agent context by 80-90% vs. loading all 50 reference files.
task-routing.md: decision tree mapping task keywords to agent sets,
parallel vs. sequential ordering, and file conflict detection.
handoff-format.md: structured output format each agent must produce
so downstream agents can consume work without re-reading everything.
…specialists

Roster now matches production agents: cu-profiler, storage-architect,
cross-vm-bridge, cadence-deploy, economic-designer, security-auditor,
test-architect. Each mapped to the specific skill refs they embed.
cu-profiler: measures real CU costs on testnet using sweep methodology,
extracts fees from FlowFees.FeesDeducted events, outputs MAX_SAFE_N.
storage-architect: optimizes Cadence resource layout using atree internals
(dict vs array, borrow-outside-loops, 512-byte inlining, composite key packing).
First agent called when CU budget is exceeded.
cross-vm-bridge: handles Cadence<->EVM boundary (EVM.dryCall vs coa.call,
manual ABI encoding, inline decode rule, COA borrow pattern, gas defaults).
cadence-deploy: owns compile->deploy->verify cycle with common error table,
update-vs-redeploy decision rule, and post-deploy verification checklist.
Translates CU Profiler output into protocol fee parameters: INDEX_FEE,
treasury split ratios, solvency analysis across FLOW price scenarios,
loyalty point sustainability, and royalty cut validation (UFix64 silent bug).
Works from measured numbers only — never estimates independently.
security-auditor: full Cadence vulnerability taxonomy (access control gaps,
storage path bugs, arithmetic, resource handling, capability abuse, loyalty
farming), 7-pass methodology, severity classification, per-finding output format.

test-architect: CDC native vs Go/overflow decision tree, adversarial test
categories for all known exploit classes, coverage interpretation with known
system-contract limitation.
task-routing: workflows for the 7 production agents (cu-profiler,
storage-architect, cross-vm-bridge, cadence-deploy, economic-designer,
security-auditor, test-architect) with concrete scope examples per agent.

handoff-format: agent-specific handoff block examples covering all
real inter-agent transitions (audit→fix, profiler→designer, tests→deploy).
Adds agent capabilities table (what each agent does, tools it uses,
what it cannot do), team communication block to append to every agent
prompt in team mode, and peer-to-peer SendMessage protocol so agents
coordinate directly without routing through the orchestrator.
…chitect

Both agents now know each other's capabilities and communicate directly
via SendMessage: auditor sends findings to test-architect, test-architect
sends results to cadence-deploy. No relay through team-lead.
cu-profiler sends MAX_SAFE_N directly to economic-designer and notifies
storage-architect of baseline. storage-architect triggers cu-profiler
re-measure and alerts security-auditor of path changes. economic-designer
waits for cu-profiler input, then sends INDEX_FEE to cadence-deploy.
cadence-deploy waits for security-auditor PASS, then pushes contract
address directly to frontend-dev. cross-vm-bridge alerts security-auditor
of files ready and cadence-deploy of required EVM addresses. frontend-dev
waits for cadence-deploy address before configuring FlowProvider.
…to project dir

Agents were escaping the project directory and reading files from other
repos when resolving imports. Two fixes: plugin refs now resolve from
<plugin-root>/skills/<path> instead of a filesystem search; every agent
prompt now receives an explicit project root constraint.
…fold

Without local dependencies, agents resolve NonFungibleToken and MetadataViews
by searching the filesystem and may find contracts in unrelated projects.
Phase 0 ensures standard contracts are available in the project before
any agent touches .cdc files.
…riteria

Orchestrator now outputs a visible plan block before spawning any agent
so the user knows what is about to run and why.

TeamCreate decision criteria: use teams when agents need mid-task peer
coordination (cycles, back-and-forth, blocking waits). Use parallel
Agent() for clean linear pipelines where each phase feeds the next.
- cu-profiler: add cu-optimization.md (CU cost table, high-CU patterns)
- cadence-deploy: add upgrade-strategies.md (allowed changes, rollback)
- test-architect: add testing-patterns.md (adversarial categories, CDC vs Go)
Template refs cover the common case. Orchestrator should add cadence-scaffold
refs when an agent generates new code, and other domain refs when relevant.
Documents when to add: scaffold-contract, scaffold-transaction, scaffold-defi,
access-control, transactions.
…ssing

Team mode (TeamCreate + SendMessage) requires the flag in settings.json.
Parallel Agent() calls work without it and cover most pipeline workflows.
Add check command and settings snippet so users can enable team mode.
@claucondor claucondor marked this pull request as ready for review April 21, 2026 04:04
@claucondor claucondor requested a review from a team as a code owner April 21, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant