Skip to main content

Overview

The health command validates .planning/ directory integrity, reports actionable issues, and optionally repairs them. It checks for missing files, invalid configurations, inconsistent state, and orphaned plans.

Syntax

--repair
flag
Automatically fix detected issues. Without this flag, health command only reports problems without making changes.

How It Works

  1. Scans .planning/ directory for structure and files
  2. Validates critical files (STATE.md, ROADMAP.md, CONTEXT.md)
  3. Checks phase consistency between plans and roadmap
  4. Detects orphaned work (incomplete phases, abandoned debugs)
  5. Reports issues with severity levels
  6. Repairs if --repair flag is provided

Health Checks

Critical Files

Checks:
  • .planning/STATE.md exists and is valid JSON/YAML
  • .planning/ROADMAP.md exists with phase definitions
  • .planning/CONTEXT.md exists (can be empty)
Issues detected:
  • Missing STATE.md
  • Corrupted STATE.md (invalid format)
  • Missing ROADMAP.md
  • Missing CONTEXT.md

Phase Consistency

Checks:
  • Phases in roadmap match phase directories
  • Completed phases have SUMMARY.md
  • In-progress phases have PLAN.md
  • Phase numbers are sequential
Issues detected:
  • Phase in roadmap but no directory
  • Phase directory but not in roadmap
  • Completed phase without SUMMARY.md
  • Phase number gaps or duplicates

Orphaned Work

Checks:
  • No .continue-here.md older than 7 days
  • No debug sessions in investigating state older than 3 days
  • No quick tasks without STATE.md entries
Issues detected:
  • Stale checkpoint files
  • Abandoned debug sessions
  • Untracked quick tasks

Git Consistency

Checks:
  • No uncommitted changes in .planning/
  • Phase commits exist for completed phases
  • No .planning/ files in gitignore
Issues detected:
  • Uncommitted planning files
  • Completed phase without commit

Usage Examples

Check health without repairs

Output:

Check and repair issues

Output:

Healthy project

Output:

Corrupted state

Output:

Issue Severity Levels

❌ Critical (Blocks Work)

  • Missing STATE.md
  • Corrupted STATE.md
  • Missing ROADMAP.md
  • Invalid phase structure
Action: Must repair before continuing work

⚠️ Warning (Should Fix)

  • Missing SUMMARY.md for completed phase
  • Phase directory without roadmap entry
  • Stale checkpoint files (>7 days)
  • Abandoned debug sessions (>3 days)
Action: Repair when convenient, doesn’t block work

ℹ️ Info (Nice to Fix)

  • Uncommitted changes in .planning/
  • Quick tasks not in STATE.md
  • Empty CONTEXT.md sections
Action: Optional cleanup

Repair Actions

STATE.md Reconstruction

Phase Sync

Checkpoint Cleanup

Debug Session Cleanup

When to Run Health Check

Run health check

  • After long break from project
  • After manual file edits
  • Before important milestones
  • If commands behave unexpectedly
  • After force-push or branch operations
  • Periodically (monthly for active projects)

Run with --repair

  • When health check reports issues
  • After recovering from editor crash
  • After git conflicts in .planning/
  • When STATE.md seems wrong
  • Before demo or presentation

Exit Codes

  • 0 - No issues detected
  • 1 - Warning-level issues (doesn’t block work)
  • 2 - Critical issues (blocks work)
Useful for CI/CD:
  • resume-work - Resumes work (runs health check implicitly)
  • progress - Shows progress (reports if health issues)
  • new-project - Creates healthy structure
  • pause-work - Creates checkpoint (checked by health)