Update docs and context for OpenSpec changes. Use when: saving session state, refreshing docs after implementation, or syncing change status.
Context and documentation synchronization for OpenSpec changes. Keeps CONTEXT-llm.md and docs in sync with implementation state.
flowchart LR
A["Get status via CLI"] --> B["Read current state"]
B --> C["Gather context"]
C --> D["Write updates"]
D --> E["Verify idempotent"]
classDef action fill:#C8E6C9,stroke:#388E3C,color:#000
class A,B,C,D,E action
Critical: Use openspec status for change state, never parse files directly.
Autonomous (no confirmation needed):
Ask-first (pause and confirm):
Always use CLI for status:
openspec status {change-id}
Never:
The CLI is the single source of truth for change status.
Full synchronization: updates CONTEXT-llm.md and refreshes docs in one command.
Input: $ARGUMENTS = change-id
Workflow:
openspec status {change-id} for current stategit status --short, git log -1 --onelineopenspec/changes/{change-id}/tasks.md for progressOutput:
✅ Sync complete for {change-id}
- CONTEXT-llm.md: updated
- Docs refreshed: {count} files
- Change status: {status from CLI}
Refresh documentation files only (no CONTEXT-llm.md update).
Input: $ARGUMENTS = change-id
Workflow:
openspec status {change-id} for affected filesopenspec/changes/{change-id}/proposal.md → Affected FilesOutput:
📚 Docs refresh for {change-id}
- Scanned: {n} affected files
- Updated: {m} docs
- Skipped: {k} (already current)
Save session state to CONTEXT-llm.md only (no docs refresh).
Input: $ARGUMENTS = change-id
Workflow:
openspec status {change-id}git status --shortgit log -3 --onelineopenspec/changes/{change-id}/tasks.mdCONTEXT-llm.md Template:
# Context: {change-id}
## Status
- Change: {status from openspec status}
- Tasks: {done}/{total} complete
- Git: {branch}, {clean|modified}
## Recent Commits
{last 3 commits}
## Current Focus
{current task or section being worked on}
## Next Steps
1. {next unchecked task}
2. {following task}
## Reference
- Proposal: openspec/changes/{change-id}/proposal.md
- Tasks: openspec/changes/{change-id}/tasks.md
- Project: openspec/project.md
Output:
💾 Context saved for {change-id}
- File: CONTEXT-llm.md
- Tasks: {done}/{total}
- Status: {status}
Before syncing, read openspec/project.md → Execution Philosophy → mode.
In garage mode: Minimal docs, just CONTEXT-llm.md. Don't gold-plate documentation. In scale mode: Ensure all docs accurate and up-to-date. In maintenance mode: Document changes carefully before modifying existing docs.
Running sync multiple times with same state produces identical output:
Output when no changes:
⏭️ Already in sync for {change-id}
- CONTEXT-llm.md: current
- Docs: current
- Last sync: {timestamp from file}
Before syncing, consult openspec/project.md → Exploration Strategy section:
primary files (project.md, proposal.md, tasks.md)