Save session state for recovery after compaction or failures. Default: save to local files (.claude/state/). With --mcp: also save to MCP memory for cross-session persistence.
Document Version: 2.0 Last Updated: 2026-02-14 Status: ACTIVE
<!-- prettier-ignore-end -->Save current state so you can recover after compaction or session failure.
/session-end instead (runs metrics pipeline,
compliance checks, and commits)/checkpoint # Save to local files only
/checkpoint --mcp # Save to local files + MCP memory
## Quick Recovery
**Last Checkpoint**: YYYY-MM-DD HH:MM **Branch**: `branch-name-here` **Working
On**: [brief task description] **Files Modified**: [list or "none"] **Next
Step**: [what to do next] **Uncommitted Work**: yes/no
Update .claude/state/handoff.json:
{
"timestamp": "ISO datetime",
"git": {
"branch": "current branch",
"lastCommit": "hash + message",
"uncommittedFiles": ["list"]
},
"currentTask": "what you are working on",
"completedSteps": ["step 1", "step 2"],
"pendingSteps": ["step 3", "step 4"],
"notes": "anything important for resumption"
}
For multi-step tasks, also write .claude/state/task-{name}.state.json:
{
"task": "task-name",
"started": "ISO datetime",
"lastUpdated": "ISO datetime",
"steps": [
{ "name": "Step 1", "status": "completed" },
{ "name": "Step 2", "status": "in_progress" }
],
"context": { "branch": "branch-name", "notes": "key info" }
}
If uncommitted work exists and the task is at a safe point:
git add -A && git commit -m "WIP: checkpoint before potential failure"
--mcp flag)When --mcp is specified, also save structured entities to MCP memory.
Use mcp__memory__create_entities():
entities = [
{
name: "Session_2026-01-28_TaskName",
entityType: "session_context",
observations: [
"Working on: [task description]",
"Completed: [what was done]",
"Decision: [key choice made]",
"Files: [files modified]",
"Next: [pending work]",
],
},
];
| Type | Use For |
|---|---|
session_context | Current work status, progress, next steps |
architectural_decision | Design choices with rationale |
bug_investigation | Debugging context, findings, hypotheses |
feature_implementation | Feature details, approach, progress |
Session_YYYY-MM-DD_BriefTaskNameDecision_FeatureName_ChoiceBug_ComponentName_IssueLink related entities with mcp__memory__create_relations().
After saving, report what was preserved:
Saved to MCP memory:
- Session context: [summary]
- Decisions: [count]
To retrieve later: mcp__memory__read_graph()
On resume after compaction:
.claude/state/handoff.json.claude/state/task-*.state.jsonmcp__memory__search_nodes("Session_")git log and git status| Version | Date | Description |
|---|---|---|
| 1.0 | 2026-02-25 | Initial implementation |