pipeline
Pipeline
Orchestrate triage → align → execute phases with machine-validated gates and artifact-based resume. Each phase narrows scope until a constraint contract is tight enough for autonomous execution.
Principles
- Forward-only phase progression: triage → align → execute. No phase type can repeat in the same position without superseding the prior one.
state.jsonis a thin cached projection (<2KB).events.ndjsonis the authoritative ledger.- All paths are repo-root-relative. Never store absolute paths.
- The pipeline orchestrator owns
.pipeline/state. manage-codex owns relay child state. - Execute output artifacts are owned by the pipeline orchestrator, not the child workflow.
Filesystem Contract
.pipeline/
state.json # thin active index (<2KB)
events.ndjson # append-only mutation ledger
mission/ # mission documents
constraints/sets/ # promoted constraint sets
phases/
<phase-id>/
artifacts/ # phase output artifacts + resume.md
runtime/ # execute phases only
relay/ # child workflow state (manage-codex relay root)
adapter-status.json
adapter-lock.json
Setup & Resume
# Initialize a new pipeline
./scripts/pipeline/update-pipeline.sh --event init_pipeline --mission-id <id>
# Resume: read state.json, then check adapter-status.json for active execute phases
cat .pipeline/state.json | python3 -c "import json,sys; print(json.dumps(json.load(sys.stdin), indent=2))"
Resume protocol:
- Read
state.json— checkstatus,current_phase_id,latest_resume - If an execute phase has
child_workflow, readadapter-status.jsonat the phase'sadapter.status_path - If adapter-status is fresher, run
child_checkpointto reconcile forward - If adapter-status is stale (>30min) and non-terminal, surface to user
- If
automatic_resume.blockedis true, surface the drift to user before continuing - Never dispatch a new child workflow if
adapter-lock.jsonexists and status is non-terminal
Triage
Interactive phase. The orchestrator explores the problem space with the user.
./scripts/pipeline/update-pipeline.sh --event phase_added --phase-id phase-001-triage --phase-type triage --skill-version v1
./scripts/pipeline/update-pipeline.sh --event phase_started --phase-id phase-001-triage
# ... interactive work produces mission document ...
./scripts/pipeline/update-pipeline.sh --event mission_activated --mission-path .pipeline/mission/mission-v001.md
./scripts/pipeline/update-pipeline.sh --event phase_completed --phase-id phase-001-triage
Align
Interactive phase. Narrows scope into a machine-checkable constraint contract.
Required output artifacts (gate-checked): execution-spec.md, constraints.json,
verification-plan.md. Recommended (not gate-checked in v1): decision-log.md for traceability.
./scripts/pipeline/update-pipeline.sh --event phase_added --phase-id phase-002-align --phase-type align --skill-version v1
./scripts/pipeline/update-pipeline.sh --event phase_started --phase-id phase-002-align
# ... interactive work produces artifacts ...
./scripts/pipeline/update-pipeline.sh --event artifact_recorded --phase-id phase-002-align --artifact-id execution-spec --artifact-path .pipeline/phases/phase-002-align/artifacts/execution-spec.md --artifact-role output
./scripts/pipeline/update-pipeline.sh --event artifact_recorded --phase-id phase-002-align --artifact-id constraints --artifact-path .pipeline/phases/phase-002-align/artifacts/constraints.json --artifact-role output
./scripts/pipeline/update-pipeline.sh --event constraint_set_activated --constraint-path .pipeline/phases/phase-002-align/artifacts/constraints.json
./scripts/pipeline/update-pipeline.sh --event phase_completed --phase-id phase-002-align
Execution Readiness Gate
Machine-validated gate between align and execute. Cannot be bypassed by prose.
./scripts/pipeline/update-pipeline.sh --event gate_passed --phase-id phase-002-align --summary "Execution readiness confirmed"
./scripts/pipeline/update-pipeline.sh --event gate_failed --phase-id phase-002-align --summary "open_questions nonzero"
Gate checks (all must pass):
constraints.jsonexists and is valid JSONallowed_pathsis a non-empty array with no wildcardsinterface_changesfield existsverification_commandsis non-emptynon_goalsis non-emptyopen_questionsis empty ([])
A failed gate blocks execute. Add a new align phase to address the gaps.
Execute
Autonomous phase. Dispatches manage-codex with an explicit --root pointing at the
phase's relay directory.
# Add execute phase (requires adapter metadata)
./scripts/pipeline/update-pipeline.sh --event phase_added --phase-id phase-003-execute --phase-type execute --skill-version v1 --adapter-id manage-codex-relay --adapter-version v1
# Start (blocked unless predecessor gate passed)
./scripts/pipeline/update-pipeline.sh --event phase_started --phase-id phase-003-execute
# Pipeline orchestrator creates the task header before dispatch
# artifacts/manage-codex-header.md — owned by pipeline orchestrator
# Dispatch manage-codex with explicit relay root
cat .pipeline/phases/phase-003-execute/runtime/relay/prompt.md | codex exec --full-auto -o .pipeline/phases/phase-003-execute/runtime/relay/last-messages/last-message-{slice_id}.txt -
# Monitor child workflow
./scripts/pipeline/update-pipeline.sh --event child_checkpoint --phase-id phase-003-execute
# After child workflow completes, orchestrator creates output artifacts:
# artifacts/output.md — owned by pipeline orchestrator
# artifacts/gate-report.json — owned by pipeline orchestrator
./scripts/pipeline/update-pipeline.sh --event phase_completed --phase-id phase-003-execute
./scripts/pipeline/update-pipeline.sh --event pipeline_completed
Execute output artifact ownership:
artifacts/manage-codex-header.md— created by pipeline orchestrator before dispatchartifacts/output.md— created by pipeline orchestrator after child completesartifacts/gate-report.json— created by pipeline orchestrator after child completes
Forward-Only Rule
Phase progression is forward-only. If a gate fails or constraints change:
- Supersede the current phase:
--event superseded --phase-id <id> --summary <reason> - Add a new phase of the same or earlier type
active_epoch_idincrements on supersession
Circuit Breakers
Escalate to the user when:
- Adapter-status is stale (>30 minutes, non-terminal)
- Artifact drift detected on a locked phase
automatic_resume.blockedis true in state
User Briefing
pipeline status: read-only view ofstate.json— current phase, child workflow status, resume pointer, automatic resume statepipeline resume: start fromstate.json, reconcile adapter-status, then continuepipeline init: create.pipeline/, write initialstate.json, prompt for mission