Session continuity and context recovery for Claude Code. Auto-tracks your work via hooks, survives autocompact, and generates rich continuation prompts.
Note: this is an experimental plugin born from my config. It does work pretty well, but beware of bugs.
- Automatic Tracking: Hooks capture file edits, todos, plans, and user decisions as you work
- Session Handoffs: Create explicit checkpoints with
/handofffor seamless continuation - Autocompact Survival: Session markers survive context summarization for automatic recovery
- Rich Context Recovery:
/startgathers project state and can restore from handoffs - Optional Integrations: Enhanced context from beads, claude-harness, claude-mem, and agent-mail
# Add the marketplace (one-time setup)
/plugin marketplace add sethyanow/session-context
# Install the plugin
/plugin install session-context@sethyanowGather project context and recover from previous sessions.
/start # Normal session start
/start handoff=abc # Restore specific handoff
Create an explicit checkpoint before ending a session or when context is low.
/handoff
This generates a continuation prompt you can paste into your next session.
At session start, the plugin's SessionStart hook automatically gathers and injects session context directly into the conversation. This means:
- No MCP call needed - Session data is pre-loaded before
/startruns - Faster startup - Context is immediately available
- Token efficient - Eliminates round-trip to MCP server
The hook gathers:
- Git status (branch, uncommitted files, recent commits)
- Beads triage (if
.beads/exists) - Harness state (if
.claude-harness/exists) - Agent Mail status (if configured)
- Recovery checkpoint info (if available)
When you run /start, it uses this pre-loaded data directly instead of calling the MCP.
The plugin installs hooks that capture your work:
| Hook | Trigger | Captures |
|---|---|---|
dot-start-handler.ts |
SessionStart | Pre-loads session context |
track-edit.ts |
Edit, Write, NotebookEdit | Modified file paths |
track-todos.ts |
TodoWrite | Current todo list |
track-plan.ts |
ExitPlanMode | Full plan content |
track-qa.ts |
AskUserQuestion | User decisions |
Data is stored in ~/.claude/session-context/handoffs/.
- During work, hooks maintain a rolling checkpoint with your current state
- When ready to end a session, run
/handoff - Plugin generates a continuation prompt with:
- What you were doing
- Key decisions made
- Next steps to take
- Copy the prompt for your next session
- New session detects the session marker and auto-recovers
The continuation prompt includes a session marker:
<!-- session:abc123 -->This marker survives Claude's context summarization. When detected after autocompact, the plugin automatically loads full context from storage.
The plugin provides three MCP tools:
Gather session startup data with optional handoff recovery.
Note: Session data is typically pre-loaded by the
SessionStarthook, making this call unnecessary for normal startup. Use this MCP tool as a fallback or when you need to restore a specific handoff.
get_session_status({
level: "full", // minimal | standard | full
handoff: "abc123" // Optional: restore specific handoff
})Levels:
minimal: project, harness, beads countsstandard: + beads_triage, agentmailfull: + skill_usage, claude_mem references
Create explicit checkpoint with continuation prompt.
create_handoff({
task: "Implementing user auth",
summary: "Added login endpoint, working on JWT",
nextSteps: ["Add token refresh", "Write tests"],
decisions: ["Using JWT over sessions"],
blockers: []
})Update rolling checkpoint (called by hooks).
update_checkpoint({
files: ["src/auth.ts"],
todos: [...],
plan: { path: "...", content: "..." }
})The plugin auto-detects and enhances with optional integrations:
| Integration | Detection | Enhancement |
|---|---|---|
| Git | Always | Branch, uncommitted, recent commits |
| Beads | .beads/ exists |
Issue triage, actionable work |
| Claude Harness | .claude-harness/ exists |
Features, memory, loop state |
| Agent Mail | MCP configured | Inbox status, file reservations |
| Claude-Mem | MCP configured | Observation ID references |
Create ~/.claude/session-context/config.json:
{
"checkpointTTL": "24h",
"maxHandoffs": 10,
"integrations": {
"beads": true,
"harness": true,
"claudeMem": true,
"agentMail": true
},
"tracking": {
"files": true,
"todos": true,
"plans": true,
"decisions": true
}
}Data is stored in ~/.claude/session-context/:
~/.claude/session-context/
├── config.json # Plugin configuration
└── handoffs/
├── {hash}-current.json # Rolling checkpoint (per-project)
└── {id}.json # Explicit handoffs
# Run the MCP server directly
cd mcp
bun run start
# Type check
bun run typecheck
# Build for distribution
bun run buildThis plugin builds on and integrates with several excellent projects:
- Beads by @steveyegge - Dependency-aware issue tracking and task management
- Claude Harness by @panayiotism - Feature tracking and agentic loop management
- Claude-Mem by @thedotmack - Persistent memory and observation storage
- MCP Agent Mail by @Dicklesworthstone - Multi-agent coordination and messaging
Thanks to all these maintainers for their work on the Claude Code ecosystem!
MIT