Skip to content

fix: /mgw:project creates STATE.md and archives old phases#34

Closed
snipcodeit wants to merge 2 commits intomainfrom
issue/33-mgw-project-state-md-archival
Closed

fix: /mgw:project creates STATE.md and archives old phases#34
snipcodeit wants to merge 2 commits intomainfrom
issue/33-mgw-project-state-md-archival

Conversation

@snipcodeit
Copy link
Owner

Summary

  • Adds archive_phases step to /mgw:project that moves existing .planning/phases/ to .planning/ARCHIVED-phases-pre-{name}-{date}/ before writing a new ROADMAP
  • Adds write_state step that creates .planning/STATE.md from the GSD template, initialized for Phase 1 with skip-if-exists guard
  • Updates the report and success_criteria sections to reflect both new steps

Closes #33

Changes

commands/project.md (+230 lines):

  • New archive_phases step inserted before write_roadmap — checks for existing phase directories, archives them with a timestamped name, sets ARCHIVE_STATUS
  • New write_state step inserted after write_roadmap — creates full GSD-compliant STATE.md with all 8 sections (Project Reference, Current Position, Performance Metrics, Accumulated Context, Session Continuity), sets STATE_STATUS
  • Updated report step GSD scaffold section to display ROADMAP_STATUS, STATE_STATUS, and ARCHIVE_STATUS
  • Updated success_criteria with two new checklist items

.claude/commands/mgw/project.md (mirror):

  • Byte-identical copy of commands/project.md

Test Plan

  • Verify archive_phases step appears before write_roadmap in commands/project.md
  • Verify write_state step appears after write_roadmap and before write_project_json
  • Verify STATE.md template follows GSD template format (all 8 sections present)
  • Verify both files are byte-identical: diff commands/project.md .claude/commands/mgw/project.md
  • Verify report section shows all three status variables
  • Verify success_criteria includes STATE.md and archival checks
  • Run /mgw:project on a test repo with existing .planning/phases/ — confirm archival + STATE.md creation
  • Run /mgw:project on a clean repo — confirm STATE.md created, archival skipped gracefully

Verification

GSD verifier passed 5/5 must-haves:

  1. archive_phases step exists before write_roadmap
  2. write_state step exists after write_roadmap
  3. STATE.md template is GSD-compliant
  4. Report and success_criteria updated
  5. Mirror files byte-identical

Stephen Miller and others added 2 commits February 26, 2026 17:15
- Insert archive_phases step before write_roadmap to preserve old phase dirs
- Insert write_state step after write_roadmap to create STATE.md from GSD template
- Update report step to show STATE.md and archival status
- Update success_criteria to include STATE.md and archival checks

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Copy updated commands/project.md to .claude/commands/mgw/project.md
- Both files are byte-identical with archive_phases and write_state steps

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@snipcodeit
Copy link
Owner Author

Testing Procedures

Quick Verification (code review)

# Step ordering
grep -n 'step name="archive_phases"\|step name="write_roadmap"\|step name="write_state"\|step name="write_project_json"' commands/project.md

# Mirror identical
diff commands/project.md .claude/commands/mgw/project.md

# STATE.md template sections present
grep -c '## Project Reference\|## Current Position\|## Performance Metrics\|## Accumulated Context\|## Session Continuity' commands/project.md

End-to-End Test

  1. Create a temp repo with existing .planning/phases/01-test/ directory
  2. Run /mgw:project against it
  3. Verify:
    • .planning/phases/ is gone, replaced by .planning/ARCHIVED-phases-pre-{name}-{date}/
    • .planning/STATE.md exists with Phase 1 initialization
    • /gsd:health reports HEALTHY (no E004)
  4. Run /mgw:project again (idempotent check):
    • STATE.md should be skipped ("exists")
    • ROADMAP.md should be skipped ("exists")

Edge Cases

  • No existing .planning/phases/ → archival skipped gracefully
  • STATE.md already exists → write_state skipped
  • Empty .planning/phases/ directory → archival skipped

@snipcodeit
Copy link
Owner Author

Closing — wrong approach. This PR adds more GSD file management to MGW, but the correct fix is the opposite: MGW should stop writing .planning/ROADMAP.md entirely and let GSD manage all .planning/ files. See replacement issue for the correct architecture.

@snipcodeit snipcodeit closed this Feb 26, 2026
@snipcodeit snipcodeit deleted the issue/33-mgw-project-state-md-archival branch March 2, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

slash-commands Changes to slash command files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant