Skip to content
lacause edited this page Mar 29, 2026 · 2 revisions

CLI Reference

OCC includes a command-line interface for development, validation, and execution.

Installation

The CLI is included when you install OCC:

cd OCC/mcp-server
npm install && npm run build

# Run via npm
npm run occ -- <command>

# Or directly
node dist/bin/occ.js <command>

Commands

occ list

List all available chains and pipelines.

$ occ list

Chains:
  deep-researcher (6 steps) — Multi-perspective research engine
  code-review (8 steps) — Intelligent code review pipeline
  content-engine (6 steps) — End-to-end content creation
  competitive-intel (4 steps) — Competitive intelligence analysis
  full-stack-scaffold (5 steps) — AI-powered project scaffolder
  market-monitor (4 steps) — Real-time market monitoring

Pipelines:
  research-to-content (2 chains) — Research then write article
  product-intelligence (2 chains) — Competitive analysis + market alerts

occ validate [path]

Lint and validate all chains in a directory. Catches:

  • Undefined variable references
  • Unreachable steps
  • Missing depends_on targets
  • Invalid router routes
  • Missing pre-tool fields
  • Unused output variables
  • Circular dependencies
  • Duplicate step IDs
$ occ validate ./chains

  ✓ code-review (8 steps)
  ✓ competitive-intel (4 steps)
  ⚠ content-engine (6 steps)
    info social_media: output_var "social_posts" is never referenced
  ✓ deep-researcher (6 steps)
  ✓ market-monitor (4 steps)

6 chains validated: 0 errors, 0 warnings

Exit code is 1 if any errors are found — perfect for CI:

# .github/workflows/ci.yml
- name: Validate chains
  run: cd mcp-server && node dist/bin/occ.js validate ../chains

occ dry-run <chain> [--input k=v]

Preview the execution plan without making any LLM calls. Shows:

  • Execution waves (parallel groups)
  • Prompt previews with resolved variables
  • Model assignments per step
  • Dependency graph
  • Cost estimates
$ occ dry-run deep-researcher --input topic="quantum computing"

Execution Plan: deep-researcher

  Wave 1 (3 parallel)
    search_mainstream [claude-sonnet-4-6]
    search_contrarian [claude-sonnet-4-6]
    search_academic   [claude-sonnet-4-6]

  Wave 2
    evaluate_sources  [claude-sonnet-4-6] ← search_mainstream, ...

  Wave 3
    merge_perspectives [claude-sonnet-4-6]

  Wave 4
    synthesize        [claude-sonnet-4-6]

Estimated Cost:
  Steps: 6 (4 waves)
  Models: claude-sonnet-4-6: 6 steps (~$0.126-$0.360)
  Total: ~$0.126-$0.360

occ run <chain> [--input k=v ...]

Execute a chain and stream real-time logs.

$ occ run deep-researcher --input topic="quantum computing"

Executing: deep-researcher
Inputs: {"topic":"quantum computing"}
Execution: 1a2b3c4d5e6f

[START] Chain: deep-researcher
  [STEP] Mainstream perspective ...
  [STEP] Contrarian perspective ...
  [STEP] Academic perspective ...
  [DONE] search_mainstream (12.3s, 450+1800 tokens)
  [DONE] search_contrarian (14.1s, 380+1600 tokens)
  [DONE] search_academic (11.8s, 420+1900 tokens)
  [STEP] Source reliability check ...
  [DONE] evaluate_sources (5.2s)
  [STEP] Merge all research ...
  [DONE] merge_perspectives (8.7s)
  [STEP] Final report ...
  [DONE] synthesize (15.4s)

--- Result ---
# Research Report: Quantum Computing ...

occ status <executionId>

Check the status of an execution.

$ occ status 1a2b3c4d

Execution: 1a2b3c4d
Chain: deep-researcher
Status: done
Duration: 47.2s

Steps:
  done    search_mainstream (12.3s) [450+1800 tokens]
  done    search_contrarian (14.1s) [380+1600 tokens]
  done    search_academic (11.8s) [420+1900 tokens]
  done    evaluate_sources (5.2s)
  done    merge_perspectives (8.7s)
  done    synthesize (15.4s)

occ logs <executionId>

Stream real-time SSE events for a running or completed execution.

$ occ logs 1a2b3c4d

occ cancel <executionId>

Cancel a running execution. Kills all active processes.

$ occ cancel 1a2b3c4d
Cancelled: 1a2b3c4d

occ queue

Show queue statistics and recent jobs.

$ occ queue

Queue Stats:
  Queued:   3
  Running:  2
  Done:     47
  Errors:   1
  Workers:  2/5
  Avg wait: 4s

Recent Jobs:
  done    deep-researcher (p5) → exec_abc123
  running code-review (p10)
  queued  content-engine (p3)

occ timeline <executionId>

Time-travel: view the full step checkpoint history.

$ occ timeline 1a2b3c4d

Timeline for 1a2b3c4d:

  done    search_mainstream (12.3s) [450+1800 tok]  2026-03-29 14:00:12
  done    search_contrarian (14.1s) [380+1600 tok]  2026-03-29 14:00:14
  done    search_academic (11.8s) [420+1900 tok]    2026-03-29 14:00:12
  done    evaluate_sources (5.2s)                    2026-03-29 14:00:26
  done    merge_perspectives (8.7s)                  2026-03-29 14:00:31
  done    synthesize (15.4s)                         2026-03-29 14:00:40

occ stats <chainName>

Execution statistics for a chain (from SQLite).

$ occ stats deep-researcher

Stats for deep-researcher:
  Total runs:     12
  Success rate:   91.7%
  Avg duration:   42.3s
  Total tokens:   14500 input, 38200 output
  Est. total cost: ~$0.617 (Sonnet rates)

occ approve / reject

Approve or reject a gate step.

$ occ approve 1a2b3c4d gate_step
Approved: 1a2b3c4d / gate_step

$ occ reject 1a2b3c4d gate_step
Rejected: 1a2b3c4d / gate_step

occ run-pipeline

Execute a pipeline (multi-chain workflow).

$ occ run-pipeline research-to-content --input topic="AI"

Executing pipeline: research-to-content
Inputs: {"topic":"AI"}
Execution: pip_abc123

occ health

Check server health, queue status, and MCP servers.

$ occ health

OCC server is running
  Version: 2.0.0
  Running executions: 2
  Queue: 3 queued, 2 running, 47 done
  MCP servers: github, brave-search
  URL: http://localhost:4242

Global Flags

Flag Description
--json Output raw JSON (for scripting, piping to jq, CI/CD)
--priority N, -p N Execution priority 1-10 (default: 5, higher = first)
--input k=v, -i k=v Chain/pipeline input (repeatable)
# Machine-readable output
occ stats deep-researcher --json | jq '.successRate'

# High-priority execution
occ run urgent-chain --input data="critical" --priority 10

Environment Variables

Variable Default Description
OCC_URL http://localhost:4242 Server URL for run/status/logs/health
CHAINS_DIR ../chains Chains directory for validate/dry-run
REST_PORT 4242 Server port (used to build OCC_URL)

Cost Estimation

Dry-run includes cost estimates based on average token usage per step:

Model Input cost/M Output cost/M Est. per step
claude-haiku-4-5 $0.25 $1.25 $0.002-$0.005
claude-sonnet-4-6 $3.00 $15.00 $0.021-$0.060
claude-opus-4-6 $15.00 $75.00 $0.105-$0.300

Estimates assume 2K-5K input tokens and 1K-3K output tokens per step.

See Also

Clone this wiki locally