Update spec documents by analyzing git history to sync task status with reality.
Synchronize spec documents with actual project state by analyzing git commits and working directory changes.
/spec.update [spec-path] [--mode=status|content|full] [--context="user instructions"]
Arguments:
spec-path (optional): Path to spec file. If omitted, finds most recent in ./specs/active/*/--mode (optional):status (default): Update completion status onlycontent: Update spec structure based on learningsfull: Both status and content updates--context (optional): Manual overrides/clarificationsFind spec file:
./specs/active/**/spec.md for most recentParse structure:
Determine baseline:
Run git commands to gather evidence:
# Commits since plan creation
git log --oneline --since="<plan-creation-time>" --all
git log --stat --since="<plan-creation-time>" --all
# Current state
git status --short
git branch -vv
# Files changed since baseline
git diff <baseline>..HEAD --name-status
Collect:
If TodoWrite has entries matching spec tasks:
status: completedstatus: in_progressmeta.last_updated and meta.progress fieldsThis catches any completions that weren't synced immediately during task execution.
For each task:
Search for evidence:
Determine status:
completed: Clear evidence in commits + files existin_progress: Working directory changes or partial completionpending: No evidenceblocked: Explicit context or dependencies not met (add to task's blocked_by field)Collect evidence notes:
Status mode (--mode=status):
Update task statuses and add evidence:
tasks:
- id: PROJ-001
content: Set up project structure
status: completed
active_form: Setting up project structure
evidence:
commits: [c228fea, 2f069d7]
files: [src/feature_link/temporal.py, tests/test_errata_example.py]
- id: PROJ-002
content: Implement core logic
status: in_progress
active_form: Implementing core logic
evidence:
notes: "3 files changed in working directory"
- id: PROJ-003
content: Write integration tests
status: pending
active_form: Writing integration tests
meta:
last_updated: 2025-12-17
progress: 1/3
Content mode (--mode=content):
Also update structure:
add_task() functionupdate_task()discard_task()User context: If --context provided, apply manual overrides (takes precedence over auto-detection).
## Spec Update Summary
Spec: ./specs/active/refactor/
Tasks: tasks.yaml (progress: 5/10)
Baseline: c228fea (2025-11-06)
Status:
✓ Completed: 5 tasks
• In Progress: 2 tasks
○ Pending: 3 tasks
Recent Activity:
- 8 commits since plan creation
- 12 files modified
Next actions:
1. REFAC-006: Implement validation (ready)
2. REFAC-007: Add error handling (ready)
Strong evidence (auto-mark complete):
Weak evidence (mark in-progress):
Conservative approach: When uncertain, prefer in-progress over completed
# Update most recent spec status
/spec.update
# Full update with content changes
/spec.update --mode=full
# Manual override for blocker
/spec.update --context="Task 5 blocked waiting for API docs"
# Specific spec
/spec.update ./specs/active/auth/spec.md --mode=full
/spec.create/spec.archive decisionBest practice: Run at end of each work session to keep synchronized with reality.