GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - bakabaka91/claude-baton: Never lose context between Claude Code sessions again. Auto-checkpoint, resume, EOD summaries β€” all local.

BranchesTags
Open more actions menu

Latest commit

 

History

97 Commits
97 Commits

Folders and files

NameName
Last commit message
Last commit date
.claude
.claude
 
 
.github
.github
 
 
assets
assets
 
 
bin
bin
 
 
commands
commands
 
 
prompts
prompts
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

🎭 claude-baton

Never lose context between Claude Code sessions again.

npm version CI License: MIT npm downloads


claude-baton demo

😀 The Problem

You're deep in a Claude Code session β€” 45 minutes in, multiple files changed, complex decisions made. Then:

  • Context gets compacted and Claude forgets what it was doing
  • You /clear or start a new session and lose everything
  • You spend 10 minutes re-explaining where you left off
  • Claude makes the same wrong decisions you already corrected

Sound familiar?

✨ The Solution

claude-baton gives Claude Code persistent memory across sessions. One command saves what was built, what's next, and why β€” one command brings it back. Context compaction? A PreCompact hook auto-saves before anything is lost.

Session 1                          Session 2
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Work on features   β”‚            β”‚  /memo-resume       β”‚
β”‚  Make decisions      β”‚            β”‚  ↓                  β”‚
β”‚  Hit blockers       β”‚            β”‚  Full context restoredβ”‚
β”‚  ...context compacts β”‚β”€β”€πŸ’Ύβ”€β”€β†’    β”‚  Decisions preserved β”‚
β”‚  (auto-saved!)      β”‚   DB      β”‚  Next steps ready    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚  Git diff shown      β”‚
                                   β”‚  Ready to continue!  β”‚
                                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 What You Get

  • πŸ”„ One-command resume β€” Start any session with /memo-resume to restore what was built, decisions, blockers, and next steps
  • πŸ’Ύ Auto-checkpoint β€” PreCompact hook saves your session state before Claude compacts context. You never have to remember.
  • πŸ“Š Diff intelligence β€” Resume shows what changed since your last session (new commits, modified files, dependency changes)
  • 🧠 Decision memory β€” Key decisions and their reasoning survive across sessions
  • πŸ“‹ EOD summaries β€” Generate end-of-day reports from all sessions with /memo-eod
  • πŸ’° Cost transparency β€” EOD shows daily LLM calls; claude-baton status shows all-time usage and DB size
  • πŸ”’ Fully local β€” All data in a local SQLite database. No cloud, no API keys, no data leaves your machine.

πŸ—οΈ Claude Code vs Claude Code + Baton

Claude Code is powerful, but it has structural limitations around context persistence. Here's what changes with claude-baton:

Scenario Claude Code alone Claude Code + Baton
Context compaction πŸ”΄ Claude silently loses session state. After compaction, it may forget decisions, repeat mistakes, or restart work already done. 🟒 PreCompact hook auto-saves a structured checkpoint before compaction. Claude resumes with full context.
New session πŸ”΄ Blank slate. You re-explain everything from scratch. Claude has to re-read files and rediscover project state. 🟒 /memo-resume loads the last checkpoint with what was built, decisions, blockers, next steps, and git diff since then.
Decision persistence πŸ”΄ "We decided not to use Redux because..." β€” gone after /clear. Claude may suggest Redux again next session. 🟒 Decisions and their reasoning are stored in checkpoints and surfaced on resume.
Long-running tasks πŸ”΄ Multi-session tasks lose continuity. Each session starts from zero context. 🟒 Chained checkpoints maintain a thread across sessions. Each auto-checkpoint includes the previous one for continuity.
Team handover πŸ”΄ No way to export what Claude was doing. Knowledge lives only in the conversation. 🟒 claude-baton export produces JSON. /memo-eod generates daily summaries of all sessions.
Git awareness 🟑 Claude can run git commands but doesn't automatically know what changed since last session. 🟒 Resume computes git diff since checkpoint β€” shows new commits, modified files, dependency changes.

🧱 The Moat: What Claude Code Can't Do Natively

Claude Code has no persistent structured memory across sessions. This is the fundamental gap:

  1. No session state survives /compact or /clear β€” Claude Code's context window is ephemeral. When it compacts, the nuanced understanding of why you made decisions, what you tried and rejected, and where you were headed is lost. CLAUDE.md can store project rules, but not dynamic session state.

  2. No automatic preservation β€” There's no built-in mechanism to save state before compaction. You'd have to manually write notes every time, which you won't.

  3. No structured handover β€” Even if you paste notes into a new session, Claude has to parse free-text. claude-baton provides structured data (what was built, current state, next steps, decisions, blockers, git context) that Claude can act on immediately.

  4. No cross-session diff intelligence β€” Claude Code can't tell you "3 files changed and 2 new commits landed since your last session." claude-baton compares checkpoint state against current git state and surfaces the delta.

  5. No session history β€” There's no way to look back at what you accomplished across multiple sessions in a day. claude-baton's /memo-eod synthesizes all checkpoints into a daily summary.

claude-baton fills these gaps by sitting alongside Claude Code as an MCP server β€” it doesn't replace anything, it adds the persistence layer that's missing.

πŸš€ Quick Start

Two commands. That's it.

npm install -g claude-baton
claude-baton setup

Upgrading

npm install -g claude-baton@latest
claude-baton setup                    # re-registers MCP server with new version

You must run claude-baton setup after upgrading β€” the MCP server runs as a long-lived process inside Claude Code, so it won't pick up the new version until re-registered.

Start a new Claude Code session and you're ready to go:

You: /memo-checkpoint     ← saves session state
You: /compact             ← safe, state is preserved
You: /memo-resume         ← restores everything

πŸ“Έ What It Looks Like

/memo-resume β€” Session handover briefing

## Session Resume β€” my-project β€” 2026-03-25

Resuming from checkpoint: 2026-03-25T15:26:07Z
Source: auto checkpoint

### Branch
main β€” currently on main

### Where We Left Off
v2.1.1 published on npm. Build clean. All tests passing.

### What Was Built (Last Session)
Implemented auto-checkpoint chaining with git diff context,
switched LLM from haiku to sonnet for better summarization quality.

### Decisions Made
Used claude mcp add for server registration instead of manual config.
Added source field (manual/auto) to distinguish checkpoint types.

### Next Steps
1. Test /memo-resume in a fresh session
2. Verify auto-checkpoint fires on context compaction

### Changes Since Checkpoint
No changes since checkpoint β€” clean working tree, HEAD at 795f9aa.

### Commits From Last Session
795f9aa 2.1.1
108b65e feat: switch LLM calls from haiku to sonnet
fe5dae0 docs: fix README to reflect claude mcp add registration

/memo-eod β€” End-of-day summary

## EOD Summary β€” my-project β€” 2026-03-25

### What Was Built / Shipped
feat: auto-checkpoint chaining and resume resilience
feat: allowed tools for frictionless slash commands
fix: MCP server registration via claude mcp add

### Decisions Made
- Used claude mcp add for correct MCP discovery
- Chained auto-checkpoints with previous context + git diff

### Git Stats
- Commits today: 12
- Files changed: 15
- Feature areas: feat, fix, docs, style, chore

πŸ”§ How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Claude Code Session                     β”‚
β”‚                                                           β”‚
β”‚  /memo-resume ←── reads latest checkpoint from DB         β”‚
β”‚       ↓                                                   β”‚
β”‚  You work normally                                        β”‚
β”‚       ↓                                                   β”‚
β”‚  /memo-checkpoint ──→ saves state + git context to DB     β”‚
β”‚       ↓                                                   β”‚
β”‚  /compact or /clear (safe!)                               β”‚
β”‚                                                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚  β”‚ πŸͺ PreCompact Hook (automatic)              β”‚         β”‚
β”‚  β”‚                                              β”‚         β”‚
β”‚  β”‚ Context about to compact?                    β”‚         β”‚
β”‚  β”‚   β†’ Read conversation transcript             β”‚         β”‚
β”‚  β”‚   β†’ Fetch previous checkpoint for chaining   β”‚         β”‚
β”‚  β”‚   β†’ Extract state via claude -p --model sonnetβ”‚        β”‚
β”‚  β”‚   β†’ Save auto-checkpoint to DB               β”‚         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          ↕
                 ~/.claude-baton/store.db
                    (local SQLite)

The checkpoint lifecycle

  1. πŸ’Ύ Checkpoint β€” Captures what you built, current state, next steps, decisions, blockers, learnings (corrections, wrong assumptions, failed approaches), and git context (branch, uncommitted files, recent commits)

  2. πŸͺ Auto-checkpoint β€” Before context compaction, the PreCompact hook reads the transcript, fetches the previous checkpoint for continuity, and uses claude -p --model sonnet to extract a structured checkpoint automatically β€” including learnings from the session

  3. πŸ”„ Resume β€” Fetches the latest checkpoint, compares current git state vs checkpoint state, computes what changed (new commits, file diffs, dependency changes), and presents a structured handover briefing

  4. πŸ“Š EOD Summary β€” Synthesizes all checkpoints from the day into a daily summary: what was built, decisions made, blockers, and next steps

  5. πŸ”„ Retro β€” Analyzes recent checkpoints to find recurring learnings, cross-references with existing memory and CLAUDE.md, checks git history for correction patterns, and proposes actionable updates to your project's memory files and rules

πŸ“‹ Slash Commands

Command Description
/memo-resume πŸ”„ Restore context from last checkpoint β€” run this at session start
/memo-checkpoint πŸ’Ύ Save session state with git context and learnings β€” safe to /compact after
/memo-eod πŸ“Š End-of-day summary combining all sessions
/memo-retro πŸ”„ Analyze checkpoint history, surface recurring learnings, propose memory/CLAUDE.md updates

πŸ› οΈ CLI Commands

claude-baton setup               # πŸ”§ one-time setup (MCP, hooks, commands)
claude-baton status              # πŸ“Š checkpoint counts, LLM calls, db size
claude-baton projects            # πŸ“ list tracked projects
claude-baton export [--project]  # πŸ“€ export as JSON
claude-baton import <file>       # πŸ“₯ import from JSON
claude-baton reset [--project]   # πŸ—‘οΈ  clear data (with confirmation)
claude-baton uninstall           # ❌ remove everything cleanly
claude-baton uninstall --keep-data  # ❌ uninstall but preserve your data

πŸ”Œ MCP Tools

For automation and advanced use cases, claude-baton exposes 4 MCP tools:

Tool Description
save_checkpoint Save session state (what was built, current state, next steps, learnings, git context)
get_checkpoint Retrieve a checkpoint by ID, or the latest for the project
list_checkpoints List checkpoints by date or most recent (supports limit param)
daily_summary Generate EOD summary from the day's checkpoints

πŸ€” Why Not Just...

Alternative Limitation
Manual notes You have to remember to write them. You won't.
CLAUDE.md Great for project rules, not for session state that changes every hour
TodoWrite Tracks tasks, not context. Doesn't capture decisions, blockers, or git state
Just re-explain Wastes 5-10 minutes per session. Loses decision reasoning.
Git commit messages Captures what changed, not why or what's next

claude-baton captures the full session context β€” what was built, why decisions were made, what's blocked, and what to do next β€” automatically.

πŸ“¦ What Setup Does

claude-baton setup is a single command that configures everything:

βœ“ Registered MCP server (user scope β€” works across all projects)
βœ“ Registered PreCompact hook for auto-checkpoint
βœ“ Registered allowed tools (slash commands run without prompts)
βœ“ Initialized database at ~/.claude-baton/store.db
βœ“ Installed slash commands to ~/.claude/commands/

πŸ—„οΈ Data Model

All data lives locally in ~/.claude-baton/store.db:

  • checkpoints β€” session state snapshots with git context, source tracking (manual | auto)
  • daily_summaries β€” LLM-generated EOD summaries

No data leaves your machine. No cloud. No API keys. LLM calls use your existing claude -p subscription.

πŸ“‹ Requirements

  • Node.js >= 18
  • Claude Code CLI installed and authenticated
  • No API keys needed β€” all LLM calls use claude -p (your existing subscription)

πŸ§‘β€πŸ’» Development

git clone https://github.com/bakabaka91/claude-baton.git
cd claude-baton
npm install
npm run build
npm test            # 109 tests

πŸ—‘οΈ Uninstall

Clean removal β€” no traces left behind:

claude-baton uninstall        # removes hooks, MCP server, commands, and database
npm uninstall -g claude-baton # removes the binary

To keep your checkpoint data: claude-baton uninstall --keep-data

πŸ“„ License

MIT


Built for developers who are tired of re-explaining context to Claude.
npm Β· Issues Β· Contributing

About

Never lose context between Claude Code sessions again. Auto-checkpoint, resume, EOD summaries β€” all local.

www.npmjs.com/package/claude-baton

Topics

claudeclaude-codeclicontext-persistencedeveloper-toolsmcpsession-management

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity

Stars

25 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.