Draft Embedded Pipeline State
Use When
- A short pipeline needs safe resume behavior.
- The agent reruns the same draft multiple times across stages.
- Stage state should travel with the working artifact rather than live
in scattered side files.
Core Rule
- Put pipeline state inside the draft artifact itself.
- The artifact that defines the work should also record what has already
completed.
Inputs
- draft artifact:
JSON or equivalent structured working file
- ordered stage list
- per-stage artifacts or errors
Outputs
- updated draft with embedded pipeline state
- per-stage records:
status, timestamp, artifact paths, and failure notes
- resume-safe stage summary
Workflow
- Initialize an internal pipeline-state object on first run.
- After each successful stage, record
done, timestamp, and artifact
references.
- After each failed stage, record
failedand the failure reason. - On rerun, skip stages already marked done unless forced.
- Keep the summary human-readable enough that an agent can inspect the
artifact and know where to resume.
Good Pattern
- one durable working artifact carries both plan and stage state
- reruns skip cleanly completed stages
- artifacts are discoverable from the state record
- failure state is explicit instead of implied by missing files
Bad Pattern
- separate hidden state files with no clear relation to the draft
- rerunning everything because the pipeline cannot tell what succeeded
- missing artifact paths after a stage is marked done
- state reset without explicit force behavior