Skip to content

fix: /mgw:project overwrites ROADMAP.md without creating STATE.md or archiving old phases #33

@snipcodeit

Description

@snipcodeit

Problem

When /mgw:project initializes a new milestone, it writes .planning/ROADMAP.md directly but does not create .planning/STATE.md and does not archive existing phase directories. This leaves GSD workflows in a broken state — STATE.md is required by every GSD workflow (progress, plan, execute, resume) and the stale phase directories cause the roadmap analyzer to mismap completed work.

Current Behavior

Running /mgw:project to create a new milestone roadmap:

  1. Writes .planning/ROADMAP.md with new phases — correct
  2. Writes .mgw/project.json for MGW state — correct
  3. Does NOT create .planning/STATE.md — GSD workflows break
  4. Does NOT archive old .planning/phases/*/ — roadmap analyzer maps stale directories to new phases by number
  5. Does NOT create/update .planning/MILESTONES.md — no milestone history

Observed Symptoms

  • /gsd:health reports BROKEN status (E004: STATE.md not found)
  • /gsd:progress shows 100% complete (8/8 plans) — mapping OLD phase directories to NEW roadmap entries
  • Phase names don't match: disk has 01-shared-workflow-hardening but roadmap Phase 1 is "Community Files"
  • All GSD workflows that read STATE.md on init will fail or produce incorrect routing

Expected Behavior

When /mgw:project creates a new milestone roadmap, it must also:

  1. Create .planning/STATE.md from the GSD template, initialized to "Phase 1 ready to plan"
  2. Archive old phase directories to .planning/ARCHIVED-phases-{old-milestone}/ (or defer to /gsd:complete-milestone)
  3. Create/update .planning/MILESTONES.md to track the transition

Root Cause

commands/project.md (the /mgw:project skill definition) has a "CRITICAL BOUNDARY (PROJ-05)" that intentionally stops after writing ROADMAP.md. The design rationale was "fast and deterministic" — but it crosses the GSD boundary by writing ROADMAP.md without maintaining the rest of GSD's state contract.

The GSD new-project workflow expects a roadmapper agent to create ROADMAP.md + STATE.md + REQUIREMENTS.md together as a unit. /mgw:project bypasses the roadmapper and only creates one of the three required files.

Architecture Constraint

MGW must not block GSD workflows. MGW is an orchestration layer that sits on top of GSD. It should either:

  • Option A: Delegate roadmap creation to GSD's roadmapper agent (which handles the full state lifecycle)
  • Option B: Create all required GSD state files when it writes ROADMAP.md directly
  • Option C: Call /gsd:health --repair after writing ROADMAP.md to regenerate missing state

The key principle: after any MGW operation, GSD workflows must work correctly. If MGW touches .planning/, it owns the responsibility of leaving it in a valid state.

Affected Files

File Role Status
commands/project.md Skill definition for /mgw:project Writes ROADMAP.md only
lib/gsd.cjs Bridge to GSD tools Has invokeGsdTool() but not used for state creation
lib/state.cjs MGW's own .mgw/ state Works correctly for MGW state

Immediate Fix Needed

For the current broken state:

  1. Archive 01-shared-workflow-hardening/, 02-template-engine/, 03-project-initialization/, 05-standalone-tools/ to .planning/ARCHIVED-phases-internal-dev/
  2. Create .planning/STATE.md from template, pointing at Phase 1 of current roadmap
  3. Ensure /gsd:health reports HEALTHY

Long-term Fix

Modify /mgw:project to maintain the full GSD state contract when writing ROADMAP.md. This means either spawning the roadmapper or explicitly creating STATE.md alongside ROADMAP.md using lib/gsd.cjs.

Reproduction

# In any repo with existing .planning/ phases
/mgw:project  # Creates new ROADMAP.md
/gsd:health   # Reports BROKEN - STATE.md missing
/gsd:progress # Shows incorrect completion mapping

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions