Operational pipelines for Claude Code
Readable agents. Inspectable state. Predictable costs.
Building a pipeline with Claude Code? Start with CLAUDE.md.
Claude Code is great for tasks. But when you need multi-step pipelines β research β analyze β generate, batch processing overnight, workflows that run unattended β you hit gaps:
- No state persistence between steps
- No resume after failure
- No coordination for parallel workers
- No cost control
claude-pipe is a set of conventions that fills these gaps. File-based state you can cat. Flat orchestration you can debug. Agents you can git blame.
Claude Code has architectural constraints. claude-pipe works with them:
| Constraint | Why It Exists | Convention |
|---|---|---|
| Subagents can't spawn subagents | Forces flat hierarchy β easier debugging | Manager = Skill (ROOT reads instructions) |
| Context is finite | Prevents runaway costs | Workers write to files, not context |
| Model is "blind" until Read() | Explicit I/O = traceable | File-based state: cat state.yaml |
| Skills are steering, not code | Flexible, not brittle | Conventions over enforcement |
Result: Flat orchestration, file-based state, predictable costs.
| Problem | Without claude-pipe | With claude-pipe |
|---|---|---|
| Pipeline fails at step 4 | Re-run from scratch | Resume from step 4 |
| Agent loops forever | $50 bill | Circuit breaker stops it |
| "What happened?" | Dig through logs | cat artifacts/state.yaml |
| Share with team | Copy-paste prompts | git push |
ROOT orchestrates, Workers execute, Files persist.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER β
β (slash commands) β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ
β ROOT β
β (Claude Code CLI) β
β β
β βββββββββββ βββββββββββ βββββββββββ β
β β Skill β β Skill β β Skill β Skills β
β β(manager)β β(atomic) β β(domain) β (libs) β
β βββββββββββ βββββββββββ βββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββ β
β β Task tool β β
β β (spawn subagents) β β
β βββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β
βββββββββββββββΌββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββ βββββββββββββ βββββββββββββ
β Worker β β Worker β β Worker β
β (subagent)β β (subagent)β β (subagent)β
βββββββ¬ββββββ βββββββ¬ββββββ βββββββ¬ββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββ
β FILES β
β (L0 β L1 β L2 β L3) β
β (persistent state layer) β
βββββββββββββββββββββββββββββββββββββββββββββ
Key insight: Manager is a Skill loaded into ROOT (not a separate agent). ROOT reads manager instructions and executes them directly. This is how you get orchestration despite the flat hierarchy constraint.
State flows through four layers:
L0 (Config) β L1 (Directives) β L2 (Operational) β L3 (Artifacts)
user_profile.yaml plan.yaml aspects/*.yaml FINAL_REPORT.md
directives.yaml synthesis.yaml
| Layer | What | Mutability | Example |
|---|---|---|---|
| L0 | User config | User-edited | user_profile.yaml |
| L1 | Session plan | Agent-generated, user-approved | plan.yaml |
| L2 | Working data | Agent-generated | aspects/*.yaml |
| L3 | Final outputs | Append-only | FINAL_REPORT.md |
Contract: L1 constraints always override L2 decisions. L3 must trace to L2 sources.
Semantic decomposition β parallel research β synthesis.
βββββββββββββββ βββββββββββββββββββ βββββββββββββ βββββββββββββ
β Planning ββββββΆβ Parallel ResearchββββββΆβ Synthesis ββββββΆβ Report β
β (1 agent) β β (N agents) β β (1 agent) β β β
βββββββββββββββ βββββββββββββββββββ βββββββββββββ βββββββββββββ
β β β β
βΌ βΌ βΌ βΌ
plan.yaml aspects/*.yaml synthesis.yaml FINAL_REPORT.md
State file enables resume:
# artifacts/{session}/state.yaml
current_phase: synthesis
phase_states:
planning: completed
research: completed
synthesis: in_progress
workers:
aspect_1: completed
aspect_2: completed
aspect_3: failed # β Resume re-runs only thisβ examples/research-pipeline/
Data partitioning β parallel classification β aggregation.
βββββββββββββββ βββββββββββββββββββ βββββββββββββ
β Partition ββββββΆβ Classify ΓN ββββββΆβ Aggregate β
β β β (parallel) β β β
βββββββββββββββ βββββββββββββββββββ βββββββββββββ
β β β
βΌ βΌ βΌ
manifest.yaml batches/*.yaml taxonomy.yaml
Use when: Large datasets that can be processed independently per batch.
β examples/batch-classifier/
Codebase scanning β parallel module documentation β assembly β docs site.
βββββββββββ βββββββββββββββββββ ββββββββββββ βββββββββββ ββββββββββββ
β Scan ββββββΆβ Document ΓN ββββββΆβ Assemble ββββββΆβ Quality ββββββΆβ Emit ΓM β
β β β (per module) β β β β Gate β β(per file) β
βββββββββββ βββββββββββββββββββ ββββββββββββ βββββββββββ ββββββββββββ
β β β β β
βΌ βΌ βΌ βΌ βΌ
plan.yaml modules/*.yaml assembly.yaml quality.yaml docs/*.md
Pattern: Subagent = Module (structural partitioning). Double fan-out: once per module, once per output file. Zero external deps.
Reconnaissance β parallel vulnerability scanning β triage β severity-ranked report.
βββββββββββ βββββββββββββββββββ ββββββββββββ βββββββββββ ββββββββββββ
β Recon ββββββΆβ Scan Γ7 ββββββΆβ Triage ββββββΆβ Quality ββββββΆβ Report β
β β β(per vuln category)β β β β Gate β β β
βββββββββββ βββββββββββββββββββ ββββββββββββ βββββββββββ ββββββββββββ
β β β β β
βΌ βΌ βΌ βΌ βΌ
recon.yaml findings/*.yaml triage.yaml quality.yaml SECURITY_REPORT.md
Pattern: Subagent = Category (domain expertise partitioning). Each scanner is an expert in one OWASP category. Zero external deps.
When N tasks are independent:
## Manager Skill Instructions
For each aspect in plan.aspects:
Task(
subagent_type: "general-purpose",
prompt: "Load aspect-researcher. Research: {aspect.name}",
run_in_background: true
)
Wait for all tasks to complete.Key: All Task calls in ONE message = parallel execution.
When each phase depends on the previous:
Phase 1 β Gate β Phase 2 β Gate β Phase 3
β β β
βΌ βΌ βΌ
plan.yaml aspects/*.yaml synthesis.yaml
Gates = transition conditions:
gate:
type: file_exists
condition: "plan.yaml exists"
gate:
type: quality_threshold
condition: "min 3 aspects completed"Skills are knowledge libraries, not agents. They inject instructions into context.
Agent A + grounding-protocol = Agent A that doesn't hallucinate
Agent B + grounding-protocol = Agent B that doesn't hallucinate
| Type | Purpose | Example |
|---|---|---|
| atomic | Single operation | tier-weights, slop-check |
| composite | Combined operations | source-evaluation |
| domain | Knowledge pack | training-science |
| manager | Workflow instructions | manager-research |
Manager skill = orchestration instructions that ROOT executes directly.
.claude/
βββ agents/ # Agent definitions (markdown)
βββ skills/ # Skill definitions (markdown)
artifacts/
βββ {session}/ # Runtime outputs (gitignored)
βββ state.yaml # Pipeline state
βββ ... # Phase outputs
For Claude Code: Read CLAUDE.md β it has the step-by-step recipe for building a pipeline.
For humans: Read the Quickstart Guide β annotated walkthrough with decision trees and a minimal example.
To run an example:
cd examples/research-pipeline
/manager-research "your topic"
Good fit:
- Multi-step research pipelines
- Data processing: gather β analyze β generate
- Workflows with phases and quality gates
- Overnight / unattended runs
- Teams sharing agent conventions via git
Not a good fit:
- Simple single-agent tasks
- Real-time chat applications
- Tasks without intermediate state
- Sub-millisecond latency requirements
- ROOT orchestrates, Workers execute β no nested spawns
- Skills are shared libraries β knowledge reuse
- Files are state β everything persists to YAML
- Layers have contracts β L1 constrains L2, L2 feeds L3
- Manager = Skill β workflow instructions for ROOT
| Primitive | What It Does |
|---|---|
Task(run_in_background: true) |
Spawn parallel worker |
TaskOutput(block: true) |
Wait for worker |
Skill("manager-x") |
Load orchestration instructions |
state.yaml |
Pipeline state for resume |
| Convention | Why |
|---|---|
| Workers write to files | Context stays small, state persists |
| Manager is a Skill | ROOT must control spawning |
| Gates between phases | Quality control, cost control |
| Session directories | Isolate runs, enable replay |
Running pipelines on OpenClaw (or other alternative Claude frontends)? See OPENCLAW.md for the adaptation guide β only fan-out phases need changes.
See CONTRIBUTING.md.
MIT β see LICENSE.