Phased Plan Execution with One Commit Per Phase

When building a multi-phase system, track progress at the row level within each phase (Open → Started → Completed with timestamps), commit only when an entire phase is green, and never batch multiple phases into one commit. This granularity makes it possible to resume mid-phase, measure velocity, an...

Tags

Phased Plan Execution with One Commit Per Phase

The Lesson

When building a multi-phase system, track progress at the row level within each phase (Open → Started → Completed with timestamps), commit only when an entire phase is green, and never batch multiple phases into one commit. This granularity makes it possible to resume mid-phase, measure velocity, and bisect regressions to specific phases.

Context

A six-phase platform build went from empty repository to 203 passing tests in a single session: canonical schema, knowledge model population, Mermaid renderer, REST API, extraction pipeline, and Graphviz + React Flow frontend. Each phase had 6-9 task rows. The plan file (docs/diagram_plan.md) was the sole source of truth for progress — not git history, not memory, not conversation state.

What Happened

  1. A plan file was written with six phases, each containing a markdown table with columns: PhaseNo, Status, Started (PST), Completed (PST), Description. Initial state: all rows Open.
  2. Execution followed a strict loop: read the plan → find the first non-Completed row → flip to Started with a timestamp → do the work → verify (tests, lint) → flip to Completed with a timestamp → repeat.
  3. Each phase ended with a summary block recording what changed, and a single commit containing all of that phase's changes. No partial-phase commits. No multi-phase commits.
  4. The plan file itself was committed as part of each phase — so the git history shows both the code changes AND the plan state transitions in the same commit.
  5. Phase 4 had two commits (b7a6731 and 9018726) because the implementation summary update was missed in the first commit. This was the only deviation from the one-commit-per-phase rule, and it was visible in the plan because timestamps showed the gap.
  6. Test counts accumulated predictably: 33 → 70 → 112 → 143 → 184 → 203. Each phase's test delta was recorded in its summary, making it trivial to verify that no tests were lost or skipped.

Key Insights

Applicability

This pattern applies to any multi-phase build or migration where phases are independently verifiable: platform builds, database migrations, infrastructure provisioning, content migrations, multi-step refactors. It does NOT apply to exploratory or research work where the path is unknown — there, committing frequently (even with failing tests) preserves the exploration trail.

Related Lessons

Related Lessons