
Research
/Security News
Popular npm Packages in the keyv and Cacheable Namespaces Compromised in Active Supply Chain Attack
Popular npm packages keyv and cacheable compromised.
@tyroneross/bookmark
Advanced tools
Context snapshots for Claude Code — session continuity across compactions and terminals
Context snapshots for Claude Code.
You've been deep in a coding session. Claude knows your architecture, the decisions you've made, the bugs you've fixed, the open items left. Then the context window compacts — or you close your terminal and come back tomorrow.
Claude forgets everything.
Bookmark fixes this. It captures snapshots of your session context automatically and restores them when you return. No manual steps. No copy-pasting context. You pick up exactly where you left off.
Claude Code sessions are ephemeral. Context is lost when:
This creates a painful pattern: every new session starts with you re-explaining what you were working on, what you decided, what's still left to do.
Install it. Forget about it. It just works.
Bookmark runs as an external process — zero tokens consumed from your context window. Four hooks handle everything automatically:
| Hook | When | What |
|---|---|---|
| PreCompact | Before context compaction | Captures full context before it's compressed |
| SessionStart | New session begins | Restores prior context so Claude knows what you were doing |
| UserPromptSubmit | Every user message | Checks if a time-based snapshot is due |
| Stop | Session ends | Final snapshot preserving everything |
When you open a new terminal and run claude, Bookmark restores your prior context. Claude greets you knowing what you were working on, what decisions were made, and what's left to do.
Each snapshot extracts from the conversation transcript — no LLM calls needed:
All extraction uses pattern matching on the transcript. Zero API calls, zero cost, zero latency.
In a project (recommended):
npm install @tyroneross/bookmark
Hooks are configured automatically. Start a Claude Code session and you're covered.
Globally:
npm install -g @tyroneross/bookmark
Then activate in any project by typing /bookmark:activate in a Claude Code session, or run bookmark setup in your project directory.
As a Claude Code plugin:
claude plugin add github.com/tyroneross/bookmark
Use these inside Claude Code:
| Command | What it does |
|---|---|
/bookmark:snapshot | Take a manual snapshot right now |
/bookmark:restore | Restore from latest or a specific snapshot |
/bookmark:status | Show snapshot count, compaction cycles, last snapshot time |
/bookmark:list | List available snapshots with details |
/bookmark:activate | Set up Bookmark for the current project |
bookmark status # Show stats
bookmark list # List snapshots
bookmark show --latest # Show latest snapshot content
bookmark show SNAP_ID # Show specific snapshot
bookmark config # Show current configuration
bookmark config --interval 15 # Change snapshot interval to 15 minutes
bookmark setup # Interactive configuration
Bookmark gets smarter the more your context compacts. It tracks compaction cycles and adjusts when snapshots trigger:
| Compaction count | Snapshot triggers at | Behavior |
|---|---|---|
| 0 (never compacted) | 20% context remaining | Conservative — only near compaction |
| 1 (once) | 30% remaining | Earlier snapshots |
| 2 (twice) | 40% remaining | Even earlier |
| 3+ (frequent) | 50% remaining | Aggressive — snapshot at halfway |
Sessions that compact frequently get protected more aggressively. Sessions that never compact barely notice Bookmark is there.
Default: every 20 minutes of active session time. Configurable:
bookmark config --interval 10 # Every 10 minutes
bookmark config --interval 30 # Every 30 minutes
Or set via environment: BOOKMARK_INTERVAL=15
For higher-quality extraction, pass --smart to use Claude Haiku (~$0.001 per snapshot):
bookmark config --smart-default # Enable by default
Requires ANTHROPIC_API_KEY. Falls back to pattern matching if unavailable.
All data lives in your project at .claude/bookmarks/:
.claude/bookmarks/
├── LATEST.md # Hot context — what gets restored on SessionStart
├── index.json # Snapshot index with stats
├── state.json # Plugin state (compaction count, thresholds, timing)
├── config.json # Your preferences
├── snapshots/ # Full snapshot files
└── archive/ # Old snapshots (>30 days)
Automatically added to .gitignore — snapshot data never gets committed.
This is the key design principle. Every other approach to "memory" for Claude Code injects tokens into your context window, reducing the space available for actual work.
Bookmark runs as an external CLI process. The hooks invoke npx @tyroneross/bookmark — a separate Node process that reads the transcript file directly, extracts patterns, and writes snapshot files. The only context injection is ~500-800 tokens on SessionStart to restore prior session context.
All the heavy lifting happens outside the context window.
| Variable | Default | Description |
|---|---|---|
BOOKMARK_INTERVAL | 20 | Snapshot interval in minutes |
BOOKMARK_THRESHOLD | 0.2,0.3,0.4,0.5,0.6 | Adaptive threshold levels |
BOOKMARK_CONTEXT_LIMIT | 200000 | Context window size in tokens |
BOOKMARK_SMART | false | Enable smart extraction by default |
BOOKMARK_STORAGE_PATH | .claude/bookmarks | Storage directory |
BOOKMARK_VERBOSE | false | Enable verbose logging |
BOOKMARK_SKIP_SETUP | false | Skip postinstall auto-setup |
MIT
FAQs
Context snapshots for Claude Code — session continuity across compactions and terminals
We found that @tyroneross/bookmark demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.

Security News
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.