Workflow System
YAML-defined execution plans with schema validation, graph safety guarantees, routing reliability controls, and template reference integrity.
Context
As workflows became the core product surface, confidence requirements moved beyond basic schema validation. Failure handling needed deterministic retry metadata, workflow safety needed graph-level guarantees, routing needed regression fixtures, and template references needed static validation.
Core Decisions
1. YAML + Schema as the Structural Contract
Workflow files remain in YAML, validated by a JSON schema. Schema hardening includes strict onFailure shape, required retry metadata (retryStrategy, initialDelayMs, maxDelayMs, jitter), and conditional action constraints.
2. Policy-as-Code for Semantic Governance
A policy file governs workflow classes, retry guardrails, review-step requirements for mutating flows, verification requirements with explicit exemptions, and compaction thresholds.
3. Graph Safety Guarantees
Graph tests enforce:
- At least one root step
- No dependency cycles
- At least one terminal step
- Every step can reach a terminal node
gotocannot self-target- Conditional
gotopaths must includeretriesExhausted -> abortguard
4. Routing Reliability Controls
Deterministic routing engine fixture tests, a corpus of expected prompt-to-workflow mappings, overlap-risk checks, and an explicit allowlist for known acceptable ambiguities.
5. Template Reference Integrity
Template reference tests validate that {{context.*}} references map to declared context keys, {{step.field}} references map to declared step outputs, and guarded support for match.* references in pre-check prompts.
Workflow Assurance Stack
Workflow YAML
Source of truth for execution plans, authored by workflow contributors.
Schema Validation
Structural correctness enforced by workflow.schema.json.
Policy Validation
Semantic governance checked against workflow.policies.json.
Graph & Routing Tests
Safety guarantees, routing corpus, and overlap detection.
CI Gate
All checks must pass before merge via yarn test:agents.