Skip to content

Workflow YAML Schema Reference

Animus workflow YAML is authored in .animus/workflows.yaml and .animus/workflows/*.yaml. Those files are merged with installed pack overlays to produce the effective workflow configuration that workflow-runner executes. This document describes the authored YAML surface.

For the target direction of phase output contracts, universal verdicts, and YAML-defined phase-local fields, see Phase Contracts.

Top-Level Structure

A workflow YAML file can contain any combination of these top-level sections:

yaml
mcp_servers:     # MCP server definitions
agents:          # Agent profile definitions
agent_channels:  # Agent communication channel definitions
phases:          # Reusable phase execution definitions
workflows:       # Named workflow pipelines

All sections are optional. Multiple YAML files in .animus/workflows/ are merged, and project YAML can override installed pack workflows.


mcp_servers

Declares external MCP servers that agents can connect to during execution.

yaml
mcp_servers:
  <server_name>:
    command: <string>           # Required. Binary to execute.
    args: [<string>, ...]       # Optional. Command arguments.
    transport: <string>         # Optional. Transport type (default: stdio).
    env:                        # Optional. Environment variables.
      KEY: "value"
    tools:                      # Optional. Allowed tool name prefixes.
      - "tool.prefix"
    config:                     # Optional. Arbitrary key-value config.
      key: value

Fields

FieldTypeRequiredDescription
commandstringyesExecutable command (e.g., npx, animus, python)
argsstring[]noArguments passed to the command
transportstringnoMCP transport protocol (default: stdio)
envmap<string, string>noEnvironment variables for the server process
toolsstring[]noTool name prefixes to allow from this server
configmap<string, any>noArbitrary configuration passed to the server

Variable Interpolation

Every string scalar in .animus/workflows.yaml, .animus/workflows/*.yaml, and pack-shipped workflow overlays supports shell-style ${VAR} interpolation. Substitution runs before YAML parsing, so subject backend configs, provider tokens, MCP env blocks, phase env overrides, and any other string field all use the same syntax:

FormMeaning
${VAR}Required. Errors with file path + line number if VAR is unset.
${VAR:-default}Optional. Falls back to literal default.
${VAR:?message}Required with custom error message.
$$Literal $.
yaml
mcp_servers:
  hubspot:
    command: npx
    args: ["-y", "@hubspot/mcp-server"]
    env:
      HUBSPOT_ACCESS_TOKEN: "${HUBSPOT_ACCESS_TOKEN}"
      HUBSPOT_BASE_URL: "${HUBSPOT_BASE_URL:-https://api.hubapi.com}"

For subject backend and provider config patterns (and guidance on keeping secrets out of YAML), see Workflow YAML environment variable interpolation.


agents

Declares agent profiles that phases can reference. Each profile specifies the model, tool, and behavioral configuration for an agent.

yaml
agents:
  <profile_name>:
    name: <string>               # Optional. Display name used in prompts/UI.
    description: <string>        # Optional. Human-readable description.
    system_prompt: |             # Optional. System prompt for the agent.
      You are a code reviewer...
    role: <string>               # Optional. Role identifier.
    persona:                     # Optional. Personality/style configuration.
      style: <string>
      traits: [<string>, ...]
      instructions: <string>
      customizations: {}
    memory:                      # Optional. Project-scoped memory behavior.
      enabled: true
      scope: project
      max_context_chars: 6000
      write_policy: explicit
    communication:               # Optional. Project-scoped channel access.
      enabled: true
      channels: [engineering]
      can_message: [reviewer]
      max_context_chars: 8000
    model: <string>              # Optional. Model to use (e.g., claude-sonnet-4-6).
    tool: <string>               # Optional. CLI tool to use (e.g., claude, codex, gemini).
    tool_profile: <string>       # Optional. Named global Claude profile; only valid with tool=claude.
    mcp_servers:                 # Optional. MCP server names this agent can access.
      - "animus"
      - "hubspot"
    skills:                      # Optional. Skill identifiers.
      - "skill-name"
    capabilities:                # Optional. Boolean capability flags.
      can_write: true
    tool_policy:                 # Optional. Tool access control.
      mode: "allowlist"
      allowed: ["tool.name"]

Fields

FieldTypeRequiredDescription
namestringnoHuman-readable display name for this agent
descriptionstringnoHuman-readable description of the agent
system_promptstringnoSystem prompt injected into the agent's context
rolestringnoRole identifier for the agent
personaobjectnoPersonality/style config injected into the agent's system context
memoryobjectnoProject-scoped memory settings. When enabled, bounded memory entries are injected into phase prompts
communicationobjectnoChannel and direct-message permissions. When enabled, bounded recent channel messages are injected into phase prompts
modelstringnoLLM model identifier
toolstringnoCLI tool to invoke (claude, codex, gemini, etc.)
tool_profilestringnoNamed global Claude profile to resolve into launch env; only valid for claude
mcp_serversstring[]noNames of mcp_servers entries this agent can use
skillsstring[]noSkill identifiers to attach. Skills resolve from built-ins, .animus/config/skill_definitions/*.yml, and Markdown skills such as .animus/skills/<name>/SKILL.md or .animus/skills/<name>.md
capabilitiesmap<string, bool>noCapability flags
tool_policyobjectnoTool access control policy

Agent profiles defined in YAML are merged into the agent runtime config during compilation. Phase definitions reference agents by profile name.

Claude profile references resolve against the user's global Animus config, not the repository. This keeps account-specific paths such as CLAUDE_CONFIG_DIR out of project files.


agent_channels

Declares project-scoped communication channels for YAML-defined agents.

yaml
agent_channels:
  engineering:
    description: Implementation coordination
    participants: [architect, implementer, reviewer]
    max_context_chars: 8000

Messages are stored under the scoped runtime state directory and can be written through animus agent message send or the MCP tool animus.agent.message.send. Agents only receive channel context when their profile has communication.enabled: true and lists that channel.

FieldTypeRequiredDescription
descriptionstringnoHuman-readable channel description
participantsstring[]yesAgent profile IDs allowed in the channel
max_context_charsnumbernoMaximum recent channel context injected into prompts

phases

Declares reusable phase execution definitions. Workflow phase entries reference these definitions by ID.

yaml
phases:
  implementation:
    mode: agent
    agent: default
    directive: "Implement the change."
    skills:
      - implementation
      - code-review
    runtime:
      tool: claude
      model: claude-sonnet-4-6
      tool_profile: overflow
  code-review:
    mode: agent
    agent: po-reviewer
    skills:
      - code-review

Fields

FieldTypeRequiredDescription
modestringyesExecution mode: agent, command, or manual
agentstringnoAgent profile name to use for the phase
directivestringnoPhase-specific instruction appended to the prompt contract
system_promptstringnoPhase-specific system prompt
skillsstring[]noSkill identifiers to resolve, validate, and apply at phase runtime. Markdown skills in .animus/skills are loaded as prompt-only skills
runtimeobjectnoTool/model/runtime overrides for the phase
capabilitiesobjectnoStructured phase capability flags
output_contractobjectnoStructured result contract for the phase
output_json_schemaobjectnoAdditional JSON schema constraints for the result
decision_contractobjectnoStructured phase decision contract
retryobjectnoRetry policy for the phase
commandobjectnoCommand execution definition when mode: command
manualobjectnoManual gate definition when mode: manual
default_toolstringnoDefault tool hint for the phase

Phase skills are validated during config load. At runtime they can inject prompt fragments, model/tool policy overrides, MCP attachments, timeout overrides, launch args/env, and capability overrides. Installed registry skills work the same as local skills when a definition snapshot is present in Animus state.

When runtime.tool_profile is set, the effective tool must resolve to claude. Animus looks up the named profile in the user's global config and injects its environment into the Claude launch contract.


variables

Declares variables that can be used throughout the workflow. Variables support defaults and can be overridden at runtime via --input-json.

yaml
variables:
  - name: target_branch
    description: "Branch to merge into"
    required: false
    default: "main"
  - name: reviewer
    description: "Assigned reviewer"
    required: true

Fields

FieldTypeRequiredDescription
namestringyesVariable name
descriptionstringnoHuman-readable description
requiredbooleannoWhether the variable must be provided (default: false)
defaultstringnoDefault value if not provided

pipelines (Workflow Definitions)

Pipelines define named workflow sequences. Each pipeline is a WorkflowDefinition with an ordered list of phases and optional post-success hooks.

A pipeline is defined as a top-level key under pipelines (or directly as a workflow definition with id, name, description, phases, etc.):

yaml
# Defining workflows directly at the top level
id: my-workflow
name: My Workflow
description: A workflow that does things
phases:
  - research
  - implementation
  - id: code-review
    agent: po-reviewer
    max_rework_attempts: 3
    on_verdict:
      rework:
        target: implementation
      advance:
        target: testing
      fail:
        target: ""
    skip_if:
      - "task.type == 'hotfix'"
  - testing
post_success:
  merge:
    strategy: merge
    target_branch: main
    create_pr: true
    auto_merge: false
    cleanup_worktree: true
variables:
  - name: target_branch
    default: main

Workflow Definition Fields

FieldTypeRequiredDescription
idstringyesUnique workflow identifier
namestringyesHuman-readable workflow name
descriptionstringnoWorkflow description
phasesPhaseEntry[]yesOrdered list of phase entries
post_successPostSuccessConfignoActions to perform after all phases succeed
variablesVariable[]noVariables used by this workflow

Phase Output Contracts

Today, workflow YAML supports execution configuration such as decision_contract, output_contract, and output_json_schema. The intended long-term direction is to keep YAML as the authored surface while moving toward a simpler phase contract model:

  • every phase emits the same universal verdict-driven envelope
  • YAML defines extra phase-local fields and their descriptions
  • the runtime composes and validates an effective contract in memory
  • users do not manage standalone JSON schema files

See Phase Contracts for the target model.

Phase Entry Types

Each entry in the phases array can be one of three types:

Simple (string)

A bare string referencing a phase definition by ID:

yaml
phases:
  - research
  - implementation
  - testing

Rich (object with id)

An inline phase configuration with routing, rework limits, and conditional skipping:

yaml
phases:
  - id: code-review
    agent: po-reviewer
    max_rework_attempts: 3
    system_prompt_override: "Focus on security"
    skip_if:
      - "task.type == 'docs'"
    on_verdict:
      rework:
        target: implementation
      advance:
        target: testing
      fail:
        target: ""
FieldTypeRequiredDescription
idstringyesPhase definition ID to execute
agentstringnoAgent profile name to use for this phase
max_rework_attemptsintegernoMaximum rework loops before failing (default: 3)
system_prompt_overridestringnoOverride the agent's system prompt for this phase
skip_ifstring[]noConditions under which to skip this phase
on_verdictmap<string, TransitionConfig>noRouting rules keyed by verdict name

SubWorkflow (object with workflow_ref)

Embeds another workflow definition as a nested sub-workflow:

yaml
phases:
  - workflow_ref: hotfix-pipeline
FieldTypeRequiredDescription
workflow_refstringyesID of the workflow definition to embed

on_verdict Routing

The on_verdict map controls what happens after a phase produces a decision. Keys are verdict names, values are transition configs:

yaml
on_verdict:
  rework:
    target: implementation     # Go back to implementation phase
  advance:
    target: testing            # Proceed to testing phase
  fail:
    target: ""                 # Terminate the workflow
  skip:
    target: deployment         # Jump to deployment
VerdictDescription
reworkPhase needs rework; route to the specified target phase
advancePhase succeeded; proceed to the specified target phase
failPhase failed fatally; terminate or route to error handling
skipPhase should be skipped; jump to the specified target

Each transition has:

FieldTypeRequiredDescription
targetstringyesPhase ID to transition to (empty string = terminate)
guardstringnoOptional guard condition for the transition

post_success

Actions to perform after all phases complete successfully:

yaml
post_success:
  merge:
    strategy: merge            # merge, squash, or rebase
    target_branch: main        # Branch to merge into
    create_pr: true            # Create a pull request
    auto_merge: false          # Auto-merge the PR
    cleanup_worktree: true     # Remove the worktree after merge
FieldTypeDefaultDescription
merge.strategystring"merge"Git merge strategy: merge, squash, or rebase
merge.target_branchstring"main"Target branch for the merge
merge.create_prbooleanfalseWhether to create a pull request
merge.auto_mergebooleanfalseWhether to auto-merge the PR
merge.cleanup_worktreebooleantrueWhether to remove the worktree after merge

PhaseDecision

When a phase completes, the agent (or automated system) produces a PhaseDecision:

FieldTypeDescription
kindstringDecision type identifier
phase_idstringThe phase that produced this decision
verdictstringOne of: advance, rework, fail, skip
confidencefloatConfidence score (0.0 to 1.0)
riskstringRisk level of the decision
reasonstringHuman-readable explanation
evidencestring[]Supporting evidence for the decision
target_phasestring?Explicit target phase (overrides on_verdict routing)

Complete Annotated Example

yaml
# .animus/workflows/custom.yaml

# Agent profiles
agents:
  default:
    model: claude-sonnet-4-6
    tool: claude

  po-reviewer:
    system_prompt: |
      You are a Product Owner reviewing completed development work.
      Verify that ALL acceptance criteria are fully met.
    model: claude-sonnet-4-6
    tool: claude

  requirements-refiner:
    system_prompt: |
      You are a requirements analyst. Take vague task descriptions
      and refine them into well-specified, testable acceptance criteria.
    model: claude-sonnet-4-6
    tool: claude

# MCP server integrations
mcp_servers:
  animus:
    command: animus
    args: ["mcp", "serve"]

# Workflow: standard development pipeline
id: default
name: Default Pipeline
description: Standard development workflow with research, implementation, and review
phases:
  # Phase 1: Research the codebase
  - research

  # Phase 2: Implement the solution
  - implementation

  # Phase 3: Review with rework routing
  - id: code-review
    agent: po-reviewer
    max_rework_attempts: 3
    on_verdict:
      rework:
        target: implementation
      advance:
        target: testing

  # Phase 4: Run tests
  - testing

post_success:
  merge:
    strategy: squash
    target_branch: main
    create_pr: true
    auto_merge: false
    cleanup_worktree: true

variables:
  - name: target_branch
    default: main

See also: Configuration, Status Values.

Released under the Elastic License 2.0 (ELv2).