Skip to main content

Workflows

Workflows orchestrate tasks into complete processing pipelines. All workflows are defined in YAML and executed by JARVIS.

Workflow Structure

workflow:
  id: wf-example
  name: Example Workflow
  version: 1.0.0
  description: Short description

metadata:
  created: 2026-03-01
  updated: 2026-03-05
  author: @jarvis
  status: active

stages:
  - id: stage-1
    name: Stage Name
    tasks:
      - task_id: TSK-001
        inputs:
          param1: value1
        outputs:
          result: ${stage-1.result}
    on_success: stage-2
    on_failure: error-handler

  - id: stage-2
    name: Next Stage
    tasks:
      - task_id: TSK-002
        inputs:
          data: ${stage-1.result}

Available Workflows

wf-pipeline-full

Complete 5-phase processing pipeline. ID: wf-pipeline-full Purpose: Transform raw content into structured knowledge, dossiers, and agent memories. Stages: Checkpoints:
  • Created after each stage
  • Stored in /.claude/jarvis/CHECKPOINTS/
  • Format: CP-{timestamp}-{workflow-id}-{stage-id}.json
Resume:
/jarvis resume
# Auto-detects last checkpoint
Rollback:
/jarvis rollback CP-20260305120000-wf-pipeline-full-stage-3
Source: core/workflows/wf-pipeline-full.yaml:1-xxx

wf-ingest

Ingest new material into inbox. ID: wf-ingest Purpose: Download, transcribe, and organize external content. Stages: Output: Organized file in inbox/{PERSON}/{TYPE}/{filename}.txt Source: core/workflows/wf-ingest.yaml:1-xxx

wf-extract-dna

Extract DNA from narratives and assign to agent. ID: wf-extract-dna Purpose: Create cognitive DNA structure (5 layers) for mind clones. Stages: Source: core/workflows/wf-extract-dna.yaml:1-xxx

wf-conclave

Multi-agent deliberation workflow. ID: wf-conclave Purpose: Constitutional decision-making with critic, advocate, and synthesizer. Stages: Anti-loop Rule: Council runs once per query. No recursive re-runs. Source: core/workflows/wf-conclave.yaml:1-xxx

Workflow Execution

Via JARVIS

# Execute workflow
/jarvis run wf-pipeline-full --input source_file="inbox/..."

# Resume from checkpoint
/jarvis resume

# Rollback to checkpoint
/jarvis rollback CP-{id}

Via Slash Command

# Workflows mapped to commands
/process-jarvis "file.txt"  # → wf-pipeline-full
/ingest "https://..."        # → wf-ingest
/conclave "question"         # → wf-conclave

Programmatic

from core.workflows import execute_workflow

result = execute_workflow(
    workflow_id="wf-pipeline-full",
    inputs={"source_file": "inbox/source.txt"},
    checkpoint_dir=".claude/jarvis/CHECKPOINTS"
)

Checkpointing

Automatic Checkpoints

Created after each stage:
{
  "checkpoint_id": "CP-20260305120000-wf-pipeline-full-stage-2",
  "workflow_id": "wf-pipeline-full",
  "stage_id": "stage-2",
  "timestamp": "2026-03-05T12:00:00Z",
  "state": {
    "inputs": {...},
    "outputs": {...},
    "context": {...}
  },
  "artifacts": [
    "/processing/chunks/source-001.json",
    "/processing/canonical/CANONICAL-MAP.json"
  ]
}

Manual Checkpoints

/jarvis checkpoint "before-risky-operation"

Checkpoint Retention

  • Last 10 checkpoints per workflow kept
  • Older checkpoints archived to .claude/jarvis/CHECKPOINTS/archive/
  • Critical checkpoints (marked) never deleted

Error Handling

Retry Strategy

stages:
  - id: stage-1
    retry:
      max_attempts: 3
      backoff: exponential
      delay_seconds: 5

Failure Handlers

stages:
  - id: stage-1
    on_failure: error-handler

error_handlers:
  - id: error-handler
    tasks:
      - task_id: TSK-999
        inputs:
          error: ${stage-1.error}

Rollback on Failure

workflow:
  rollback_on_failure: true
  rollback_to: last_checkpoint

Quality Gates

Each stage can define quality gates:
stages:
  - id: stage-1
    quality_gate:
      id: QG-001
      checks:
        - condition: ${output.chunk_count} > 0
          message: "Must have at least 1 chunk"
        - condition: ${output.schema_valid} == true
          message: "Must pass schema validation"
      on_fail: rollback
Failure Actions:
  • rollback: Restore from last checkpoint
  • retry: Retry stage up to max_attempts
  • skip: Skip stage and continue
  • abort: Abort entire workflow

Creating Workflows

Workflow Template

workflow:
  id: wf-custom
  name: Custom Workflow
  version: 1.0.0
  description: Purpose and scope

metadata:
  created: 2026-03-01
  author: @human
  status: active
  tags: [category1, category2]

inputs:
  - name: param1
    type: string
    required: true
    description: What this param does

outputs:
  - name: result
    type: object
    location: /path/to/output

stages:
  - id: stage-1
    name: Stage Name
    tasks:
      - task_id: TSK-001
        inputs:
          param: ${workflow.inputs.param1}
    on_success: stage-2

  - id: stage-2
    name: Next Stage
    tasks:
      - task_id: TSK-002
    on_success: complete

Validation

# Validate workflow YAML
python core/intelligence/validate_workflow.py wf-custom.yaml

Registration

Add to core/workflows/README.md:
| ID | Name | Stages | Purpose |
|----|------|--------|--------|
| wf-custom | Custom Workflow | 2 | Brief description |

See Also

Build docs developers (and LLMs) love