Documentation

Getting started

From install to your first workflow in 5 minutes.

Three file formats, one closed loop

OSOP uses three formats that work together:

.osop

Workflow definition — what SHOULD happen

Blueprint
.osoplog

Execution record — what ACTUALLY happened

Lab notebook
.sop

SOP Document — groups multiple .osop into one collection

Folder
Define → Execute → Record → Synthesize → Define (better)

The closed loop. Every iteration makes the workflow better.

Quick start

1
Install the CLI
pip install osop
2
Create your first workflow

Save this as my-workflow.osop.yaml:

my-workflow.osop.yaml
osop_version: "2.0"
id: "my-first-workflow"
name: "Hello OSOP"
description: "A simple two-step workflow."
tags: [tutorial]

nodes:
  - id: "greet"
    type: "agent"
    name: "Generate Greeting"
    purpose: "AI generates a personalized greeting."
    runtime:
      provider: anthropic
      model: claude-sonnet-4-20250514

  - id: "review"
    type: "human"
    name: "Human Review"
    purpose: "Human reviews the AI output."

edges:
  - from: "greet"
    to: "review"
    mode: "sequential"
3
Validate and visualize
terminal
$ osop validate my-workflow.osop.yaml
✓ Valid OSOP workflow: "Hello OSOP"
  2 nodes, 1 edge, 0 warnings

$ osop run my-workflow.osop.yaml --dry-run
  → [agent] greet: dry_run
  → [human] review: dry_run
  COMPLETED — 0 executed, 0 skipped

$ osop run my-workflow.osop.yaml
  → [agent] greet: completed ($0.0023)
  → [human] review: skipped (interactive mode off)
  COMPLETED — 1 executed, 1 skipped — $0.0023

Or drag the file into the visual editor to see an interactive node graph.

The .osop format

A .osop file is a YAML document that defines a workflow as a directed acyclic graph (DAG). It has three main sections:

Metadata

Top-level fields: osop_version, id, name, description, version, tags.

Nodes (16 types)

CategoryTypes
Actorshuman, agent, company, department
Technicalapi, cli, db, git, docker, cicd, infra, mcp
Flow Controlsystem, event, gateway, data

Edges (13 modes)

Edges connect nodes and define execution flow:

sequentialparallelconditionalloopfallbackspawnerrortimeoutcompensationmessagedataflowsignalweighted

The .osoplog format

After executing a workflow, a .osoplog file records what actually happened. It is an immutable execution record containing:

Run metadata
run_id, workflow_id, status (COMPLETED/FAILED), total duration
Trigger info
Who started it, when, how (manual, scheduled, webhook)
Node records
Per-node: status, duration, attempt count, inputs/outputs
Tool usage
Which tools were called, how many times, on which files
AI metadata
Model used, prompt tokens, completion tokens, cost
Reasoning
What question was asked, what was chosen, confidence level
Human decisions
Who reviewed, what they decided, any notes
Sub-agent tracking
Parent-child relationships, spawn indices for multi-agent workflows

The .sop format (SOP Document)

A .sop file groups multiple .osop workflows into a single browsable document. Think of it as a folder or table of contents for your workflows.

Structure

Top-level: sop_version, id, name, sections. Each section contains name, description, and workflow references (ref paths to .osop files).

my-api-docs.sop
sop_version: "1.0"
id: "stripe-api-docs"
name: "Stripe API — Complete SOP Documentation"
author: "Engineering Team"

sections:
  - name: "Payment Flows"
    description: "Core payment processing workflows."
    workflows:
      - ref: "./stripe-payment-flow.osop.yaml"
        title: "Create Payment"
      - ref: "./stripe-refund-flow.osop.yaml"
        title: "Process Refund"

  - name: "Customer Management"
    workflows:
      - ref: "./stripe-create-customer.osop.yaml"
        title: "Create Customer"

Rendering

A .sop file renders into a standalone SOP Doc HTML with collapsible sections, table of contents, and Visual/YAML tabs for each workflow.

Use cases

API documentation — group all API endpoint SOPs
Team runbooks — group incident response, deploy, rollback
Session summaries — group all workflows from a Claude Code session

Synthesize: .osoplog → optimized .osop

Feed multiple execution records to AI. It analyzes patterns across runs and produces an optimized workflow.

1
Input: one or more .osoplog files (+ optional base .osop)
2
Process: AI aggregates stats, detects slow steps, failure hotspots, parallelization opportunities
3
Output: optimized .osop + insights on what changed and why
terminal
$ osop synthesize run1.osoplog.yaml run2.osoplog.yaml run3.osoplog.yaml \
    --goal "reduce cost and parallelize where possible" \
    -o optimized.osop.yaml

  Analyzing 3 execution records...
  Total nodes: 24 | Avg duration: 142s | Total cost: $0.47
  ✓ Synthesized: optimized.osop.yaml
    - 3 steps parallelized (was sequential)
    - 1 retry policy added (node "deploy" failed 2/3 runs)
    - Estimated improvement: -38% duration, -22% cost

CLI commands

terminal
# Scaffold a new workflow
$ osop init --name "My Pipeline" --type agent

# Validate against JSON Schema
$ osop validate workflow.osop.yaml

# Dry-run (preview without side effects)
$ osop run workflow.osop.yaml --dry-run

# Real execution with LLM calls
$ osop run workflow.osop.yaml

# Execute with shell commands (requires explicit opt-in)
$ osop run workflow.osop.yaml --allow-exec

# Generate execution log
$ osop run workflow.osop.yaml --log output.osoplog.yaml

# Generate HTML report
$ osop report workflow.osop.yaml output.osoplog.yaml -o report.html
NEW: osop initNEW: real agent executionNEW: --allow-exec security gate

Integrate with your AI tool

OSOP works with 18 AI coding agents. The universal installer auto-detects which tools you have:

$ git clone https://github.com/Archie0125/osop-agent-rules.git
$ cd osop-agent-rules
$ ./install.sh       # auto-detect Cursor, Windsurf, Cline, etc.
$ ./install.sh --all # install for all 18 platforms

See the full list at github.com/Archie0125/osop-agent-rules.

Next steps