Skip to content

Agent Orchestration

The Control and Execution planes handle the lifecycle of autonomous code implementation.

Orchestration Fleet: Agent Roles and Quality Gates

SPEED avoids “dirtying” the main working directory by executing every task in an isolated git worktree.

  1. Creation: For a given task, SPEED creates a new branch and matches it to a physical worktree path in .speed/worktrees/.
  2. Dependency Injection: To avoid slow npm install or pip install cycles, SPEED symlinks node_modules or .venv from the project root into the worktree.
  3. Execution: The developer agent runs its toolset entirely within this sandbox.
  4. Integration: Upon success, the branch is merged back to the feature branch and the worktree is pruned.

The “Resilience Fleet” is a set of deterministic agent roles combined with automated quality gates.

RoleResponsibility
ArchitectHigh-level planning and dependency mapping.
Plan VerifierMathematical and logical validation of the Architect’s output.
DeveloperAtomic implementation of a single task.
ReviewerAuditing the Developer’s diff against the Technical Schemas and original product spec.
DebuggerRoot cause analysis on failed tasks. Produces diagnosis and fix instruction for retries.
CoherenceFinal check of interface stability across all tasks in a feature.

For the full I/O specification of each role (what it receives, what it produces, which model tier), see the Agent Fleet reference.

Quality gates are the primary grounding mechanism for agents.

GateTypeDescription
SyntaxFactEnsures code parses (AST validation). No LLM required.
SchemaFactVerifies changes against DB schemas or API contracts.
Lint/TypesQualityRuns eslint, tsc, or mypy.
TestsQualityRuns the project’s test suite (Vitest, Pytest, etc.).
SASTSecuritySemgrep static analysis for code-level vulnerabilities. OWASP-mapped.
SCASecurityDependency scanning for known CVEs in third-party packages.
SecretsSecurityPattern-based detection of leaked credentials and API keys.

Developer agents are scoped to the files declared by the Architect in files_touched. SPEED enforces this with graduated severity:

Undeclared FilesBehavior
1-2Warning logged. Agent continues.
3+Classified as decomposition_error. Task fails.

The SCOPE_STRICT environment variable overrides this behavior (strict = any undeclared file fails, disabled = no enforcement).

When a task fails, the system classifies it into one of six subclasses using budget data, gate results, and agent output patterns. The classification drives recovery:

ClassSubclassRecovery
Pipelinecontext_cut, exploration_death, decomposition_error, spec_gapFix the pipeline input (budget, spec, decomposition).
Complexityexceeded_capacity, implementation_errorRetry with guidance, escalate model, or split the task.

For the full classification system and recovery recipes, see Troubleshooting.