@tyroneross/bookmark 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/.claude-plugin/marketplace.json +15 -0
  2. package/.claude-plugin/plugin.json +13 -0
  3. package/CLAUDE.md +69 -0
  4. package/LICENSE +21 -0
  5. package/README.md +178 -0
  6. package/agents/snapshot-analyst.md +41 -0
  7. package/commands/activate.md +20 -0
  8. package/commands/list.md +15 -0
  9. package/commands/restore.md +30 -0
  10. package/commands/snapshot.md +26 -0
  11. package/commands/status.md +19 -0
  12. package/dist/cli/index.d.ts +3 -0
  13. package/dist/cli/index.d.ts.map +1 -0
  14. package/dist/cli/index.js +437 -0
  15. package/dist/cli/index.js.map +1 -0
  16. package/dist/config.d.ts +5 -0
  17. package/dist/config.d.ts.map +1 -0
  18. package/dist/config.js +86 -0
  19. package/dist/config.js.map +1 -0
  20. package/dist/index.d.ts +13 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +13 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/restore/index.d.ts +13 -0
  25. package/dist/restore/index.d.ts.map +1 -0
  26. package/dist/restore/index.js +94 -0
  27. package/dist/restore/index.js.map +1 -0
  28. package/dist/setup/auto-setup.d.ts +16 -0
  29. package/dist/setup/auto-setup.d.ts.map +1 -0
  30. package/dist/setup/auto-setup.js +192 -0
  31. package/dist/setup/auto-setup.js.map +1 -0
  32. package/dist/setup/configure-hooks.d.ts +10 -0
  33. package/dist/setup/configure-hooks.d.ts.map +1 -0
  34. package/dist/setup/configure-hooks.js +97 -0
  35. package/dist/setup/configure-hooks.js.map +1 -0
  36. package/dist/snapshot/capture.d.ts +21 -0
  37. package/dist/snapshot/capture.d.ts.map +1 -0
  38. package/dist/snapshot/capture.js +134 -0
  39. package/dist/snapshot/capture.js.map +1 -0
  40. package/dist/snapshot/compress.d.ts +8 -0
  41. package/dist/snapshot/compress.d.ts.map +1 -0
  42. package/dist/snapshot/compress.js +93 -0
  43. package/dist/snapshot/compress.js.map +1 -0
  44. package/dist/snapshot/storage.d.ts +13 -0
  45. package/dist/snapshot/storage.d.ts.map +1 -0
  46. package/dist/snapshot/storage.js +151 -0
  47. package/dist/snapshot/storage.js.map +1 -0
  48. package/dist/threshold/adaptive.d.ts +23 -0
  49. package/dist/threshold/adaptive.d.ts.map +1 -0
  50. package/dist/threshold/adaptive.js +29 -0
  51. package/dist/threshold/adaptive.js.map +1 -0
  52. package/dist/threshold/state.d.ts +8 -0
  53. package/dist/threshold/state.d.ts.map +1 -0
  54. package/dist/threshold/state.js +83 -0
  55. package/dist/threshold/state.js.map +1 -0
  56. package/dist/threshold/time-based.d.ts +13 -0
  57. package/dist/threshold/time-based.d.ts.map +1 -0
  58. package/dist/threshold/time-based.js +24 -0
  59. package/dist/threshold/time-based.js.map +1 -0
  60. package/dist/transcript/estimator.d.ts +20 -0
  61. package/dist/transcript/estimator.d.ts.map +1 -0
  62. package/dist/transcript/estimator.js +95 -0
  63. package/dist/transcript/estimator.js.map +1 -0
  64. package/dist/transcript/extractor.d.ts +7 -0
  65. package/dist/transcript/extractor.d.ts.map +1 -0
  66. package/dist/transcript/extractor.js +237 -0
  67. package/dist/transcript/extractor.js.map +1 -0
  68. package/dist/transcript/parser.d.ts +16 -0
  69. package/dist/transcript/parser.d.ts.map +1 -0
  70. package/dist/transcript/parser.js +120 -0
  71. package/dist/transcript/parser.js.map +1 -0
  72. package/dist/types.d.ts +156 -0
  73. package/dist/types.d.ts.map +1 -0
  74. package/dist/types.js +3 -0
  75. package/dist/types.js.map +1 -0
  76. package/hooks/hooks.json +54 -0
  77. package/package.json +77 -0
  78. package/scripts/install-plugin.sh +38 -0
  79. package/skills/context-continuity/SKILL.md +49 -0
@@ -0,0 +1,15 @@
1
+ {
2
+ "title": "Bookmark — Context Snapshots",
3
+ "tagline": "Never lose session context again",
4
+ "category": "developer-tools",
5
+ "icon": "bookmark",
6
+ "screenshots": [],
7
+ "features": [
8
+ "Automatic snapshots before compaction",
9
+ "Adaptive threshold system",
10
+ "Time-based interval snapshots",
11
+ "Zero context window tax",
12
+ "Session restoration on startup",
13
+ "Optional LLM-enhanced extraction"
14
+ ]
15
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "bookmark",
3
+ "version": "0.1.0",
4
+ "description": "Context snapshots for Claude Code — session continuity across compactions and terminals",
5
+ "author": { "name": "Tyrone Ross" },
6
+ "homepage": "https://github.com/tyroneross/bookmark",
7
+ "repository": "https://github.com/tyroneross/bookmark",
8
+ "license": "MIT",
9
+ "keywords": ["context", "snapshots", "session-continuity", "compaction", "memory"],
10
+ "hooks": "../hooks/hooks.json",
11
+ "skills": "../skills/",
12
+ "agents": "../agents/"
13
+ }
package/CLAUDE.md ADDED
@@ -0,0 +1,69 @@
1
+ # Bookmark — Context Snapshots for Claude Code
2
+
3
+ ## What Bookmark Does
4
+
5
+ Bookmark automatically captures, compresses, and restores session context so you never lose progress across compactions, terminal closures, or computer shutdowns.
6
+
7
+ ## How It Works
8
+
9
+ **Automatic hooks** (zero context window tax):
10
+ - **PreCompact** — Snapshots before compaction (async, external process)
11
+ - **SessionStart** — Restores context from latest snapshot
12
+ - **UserPromptSubmit** — Checks time/threshold intervals (fast no-op when nothing triggers)
13
+ - **Stop** — Final snapshot before session ends
14
+
15
+ **Adaptive thresholds** — Snapshots trigger earlier as compaction happens more:
16
+ - 1st compaction: snapshot at 20% remaining
17
+ - 2nd: 30% remaining
18
+ - 3rd+: 40-50% remaining
19
+
20
+ **Time-based intervals** — Default every 20 minutes (configurable).
21
+
22
+ ## Storage Location
23
+
24
+ All data lives in `<project>/.claude/bookmarks/`:
25
+ ```
26
+ .claude/bookmarks/
27
+ ├── LATEST.md ← Read this first (hot context, <150 lines)
28
+ ├── index.json ← Snapshot index
29
+ ├── state.json ← Plugin state
30
+ ├── snapshots/ ← Full snapshot files (SNAP_*.json)
31
+ └── archive/ ← Old snapshots
32
+ ```
33
+
34
+ ## Available Commands
35
+
36
+ | Command | Purpose |
37
+ |---------|---------|
38
+ | `/bookmark:snapshot` | Take a manual snapshot |
39
+ | `/bookmark:restore` | Restore from latest or specific snapshot |
40
+ | `/bookmark:status` | Show snapshot inventory and stats |
41
+ | `/bookmark:list` | List all snapshots |
42
+
43
+ ## CLI Quick Reference
44
+
45
+ ```bash
46
+ npx @tyroneross/bookmark status # Stats
47
+ npx @tyroneross/bookmark list # List snapshots
48
+ npx @tyroneross/bookmark show --latest # Show latest snapshot
49
+ npx @tyroneross/bookmark show <SNAP_ID> # Show specific snapshot
50
+ npx @tyroneross/bookmark config # Show/set configuration
51
+ npx @tyroneross/bookmark init # Initialize in project
52
+ ```
53
+
54
+ ## What Gets Captured
55
+
56
+ Each snapshot extracts from the transcript:
57
+ - **Current status** — What was being worked on
58
+ - **Decisions made** — Key choices with rationale
59
+ - **Open items** — TODOs with priority
60
+ - **Unknowns/blockers** — Uncertainties and blockers
61
+ - **Files changed** — With operation types
62
+ - **Errors encountered** — Resolved vs unresolved
63
+ - **Tool usage summary** — Aggregate tool call counts
64
+
65
+ ## Smart Mode
66
+
67
+ Pass `--smart` to use Claude Haiku for higher-quality extraction (~$0.001/snapshot). Requires `ANTHROPIC_API_KEY`.
68
+
69
+ *bookmark — context snapshot*
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tyrone Ross
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,178 @@
1
+ # Bookmark
2
+
3
+ **Context snapshots for Claude Code.**
4
+
5
+ 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.
6
+
7
+ Claude forgets everything.
8
+
9
+ 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.
10
+
11
+ ## The Problem
12
+
13
+ Claude Code sessions are ephemeral. Context is lost when:
14
+
15
+ - **Compaction happens** — the conversation gets too long and Claude summarizes it, losing detail
16
+ - **You close your terminal** — start a new session and Claude has no memory of the last one
17
+ - **Your computer restarts** — everything from that deep debugging session is gone
18
+ - **You switch between projects** — come back a day later and Claude doesn't know what "we" decided
19
+
20
+ 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.
21
+
22
+ ## How Bookmark Works
23
+
24
+ **Install it. Forget about it. It just works.**
25
+
26
+ Bookmark runs as an external process — zero tokens consumed from your context window. Four hooks handle everything automatically:
27
+
28
+ | Hook | When | What |
29
+ |------|------|------|
30
+ | **PreCompact** | Before context compaction | Captures full context before it's compressed |
31
+ | **SessionStart** | New session begins | Restores prior context so Claude knows what you were doing |
32
+ | **UserPromptSubmit** | Every user message | Checks if a time-based snapshot is due |
33
+ | **Stop** | Session ends | Final snapshot preserving everything |
34
+
35
+ 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.
36
+
37
+ ## What Gets Captured
38
+
39
+ Each snapshot extracts from the conversation transcript — no LLM calls needed:
40
+
41
+ - **Decisions made** — "chose Postgres over SQLite because...", "going with React Query for..."
42
+ - **Current status** — what was being worked on when the session ended
43
+ - **Open items** — TODOs, next steps, unfinished work
44
+ - **Unknowns and blockers** — things that were unclear or blocking progress
45
+ - **Files changed** — which files were created, edited, or read
46
+ - **Errors encountered** — what broke and whether it was resolved
47
+ - **Tool usage** — aggregate counts of Read, Edit, Bash, etc.
48
+
49
+ All extraction uses pattern matching on the transcript. Zero API calls, zero cost, zero latency.
50
+
51
+ ## Install
52
+
53
+ **In a project (recommended):**
54
+
55
+ ```bash
56
+ npm install @tyroneross/bookmark
57
+ ```
58
+
59
+ Hooks are configured automatically. Start a Claude Code session and you're covered.
60
+
61
+ **Globally:**
62
+
63
+ ```bash
64
+ npm install -g @tyroneross/bookmark
65
+ ```
66
+
67
+ Then activate in any project by typing `/bookmark:activate` in a Claude Code session, or run `bookmark setup` in your project directory.
68
+
69
+ **As a Claude Code plugin:**
70
+
71
+ ```bash
72
+ claude plugin add github.com/tyroneross/bookmark
73
+ ```
74
+
75
+ ## Commands
76
+
77
+ Use these inside Claude Code:
78
+
79
+ | Command | What it does |
80
+ |---------|-------------|
81
+ | `/bookmark:snapshot` | Take a manual snapshot right now |
82
+ | `/bookmark:restore` | Restore from latest or a specific snapshot |
83
+ | `/bookmark:status` | Show snapshot count, compaction cycles, last snapshot time |
84
+ | `/bookmark:list` | List available snapshots with details |
85
+ | `/bookmark:activate` | Set up Bookmark for the current project |
86
+
87
+ ## CLI
88
+
89
+ ```bash
90
+ bookmark status # Show stats
91
+ bookmark list # List snapshots
92
+ bookmark show --latest # Show latest snapshot content
93
+ bookmark show SNAP_ID # Show specific snapshot
94
+ bookmark config # Show current configuration
95
+ bookmark config --interval 15 # Change snapshot interval to 15 minutes
96
+ bookmark setup # Interactive configuration
97
+ ```
98
+
99
+ ## Adaptive Thresholds
100
+
101
+ Bookmark gets smarter the more your context compacts. It tracks compaction cycles and adjusts when snapshots trigger:
102
+
103
+ | Compaction count | Snapshot triggers at | Behavior |
104
+ |-----------------|---------------------|----------|
105
+ | 0 (never compacted) | 20% context remaining | Conservative — only near compaction |
106
+ | 1 (once) | 30% remaining | Earlier snapshots |
107
+ | 2 (twice) | 40% remaining | Even earlier |
108
+ | 3+ (frequent) | 50% remaining | Aggressive — snapshot at halfway |
109
+
110
+ Sessions that compact frequently get protected more aggressively. Sessions that never compact barely notice Bookmark is there.
111
+
112
+ ## Time-Based Snapshots
113
+
114
+ Default: every **20 minutes** of active session time. Configurable:
115
+
116
+ ```bash
117
+ bookmark config --interval 10 # Every 10 minutes
118
+ bookmark config --interval 30 # Every 30 minutes
119
+ ```
120
+
121
+ Or set via environment: `BOOKMARK_INTERVAL=15`
122
+
123
+ ## Smart Mode (Optional)
124
+
125
+ For higher-quality extraction, pass `--smart` to use Claude Haiku (~$0.001 per snapshot):
126
+
127
+ ```bash
128
+ bookmark config --smart-default # Enable by default
129
+ ```
130
+
131
+ Requires `ANTHROPIC_API_KEY`. Falls back to pattern matching if unavailable.
132
+
133
+ ## Storage
134
+
135
+ All data lives in your project at `.claude/bookmarks/`:
136
+
137
+ ```
138
+ .claude/bookmarks/
139
+ ├── LATEST.md # Hot context — what gets restored on SessionStart
140
+ ├── index.json # Snapshot index with stats
141
+ ├── state.json # Plugin state (compaction count, thresholds, timing)
142
+ ├── config.json # Your preferences
143
+ ├── snapshots/ # Full snapshot files
144
+ └── archive/ # Old snapshots (>30 days)
145
+ ```
146
+
147
+ Automatically added to `.gitignore` — snapshot data never gets committed.
148
+
149
+ ## Zero Context Tax
150
+
151
+ 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.
152
+
153
+ 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.
154
+
155
+ All the heavy lifting happens outside the context window.
156
+
157
+ ## Configuration
158
+
159
+ ### Environment Variables
160
+
161
+ | Variable | Default | Description |
162
+ |----------|---------|-------------|
163
+ | `BOOKMARK_INTERVAL` | `20` | Snapshot interval in minutes |
164
+ | `BOOKMARK_THRESHOLD` | `0.2,0.3,0.4,0.5,0.6` | Adaptive threshold levels |
165
+ | `BOOKMARK_CONTEXT_LIMIT` | `200000` | Context window size in tokens |
166
+ | `BOOKMARK_SMART` | `false` | Enable smart extraction by default |
167
+ | `BOOKMARK_STORAGE_PATH` | `.claude/bookmarks` | Storage directory |
168
+ | `BOOKMARK_VERBOSE` | `false` | Enable verbose logging |
169
+ | `BOOKMARK_SKIP_SETUP` | `false` | Skip postinstall auto-setup |
170
+
171
+ ## Requirements
172
+
173
+ - Node.js >= 20
174
+ - Claude Code
175
+
176
+ ## License
177
+
178
+ MIT
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: snapshot-analyst
3
+ description: Agent for deep analysis of session context and snapshot comparison. Use for detailed context review, decision timelines, and coverage analysis.
4
+ color: "#10B981"
5
+ tools: ["Bash", "Read", "Glob", "Grep"]
6
+ ---
7
+
8
+ # Snapshot Analyst Agent
9
+
10
+ You analyze context snapshots to help users understand session history.
11
+
12
+ ## Capabilities
13
+
14
+ 1. **Deep Comparison**: Compare snapshots across sessions to track project evolution
15
+ 2. **Decision Timeline**: Build a timeline of all decisions made across snapshots
16
+ 3. **Coverage Analysis**: Identify topics or files that lack snapshot coverage
17
+ 4. **Context Quality**: Assess whether snapshots are capturing enough useful context
18
+
19
+ ## Data Location
20
+
21
+ All bookmark data is in `.claude/bookmarks/`:
22
+ - `LATEST.md` — Latest compressed summary
23
+ - `index.json` — Snapshot index with stats
24
+ - `state.json` — Plugin state (compaction count, thresholds)
25
+ - `snapshots/SNAP_*.json` — Full snapshot files
26
+
27
+ ## Response Format
28
+
29
+ 1. **Summary**: One paragraph overview
30
+ 2. **Details**: Structured findings with file references
31
+ 3. **Recommendations**: Actionable next steps
32
+
33
+ ## Commands
34
+
35
+ ```bash
36
+ npx @tyroneross/bookmark list --limit 20 # List all snapshots
37
+ npx @tyroneross/bookmark show <SNAP_ID> # Show specific snapshot
38
+ npx @tyroneross/bookmark status # Current state
39
+ ```
40
+
41
+ *bookmark — context snapshot*
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: "Activate Bookmark context snapshots for this project"
3
+ allowed-tools: Bash
4
+ ---
5
+
6
+ Activate Bookmark (context snapshots) for the current project. This configures hooks, creates storage directories, and sets up automatic context capture.
7
+
8
+ Run the setup command:
9
+
10
+ ```bash
11
+ npx @tyroneross/bookmark setup --defaults
12
+ ```
13
+
14
+ After activation, confirm to the user:
15
+ - Bookmark is now active for this project
16
+ - Snapshots will be captured automatically before compaction, on 20-minute intervals, and at session end
17
+ - Context will be restored automatically when starting a new session
18
+ - Available commands: `/bookmark:snapshot`, `/bookmark:status`, `/bookmark:list`, `/bookmark:restore`
19
+
20
+ *bookmark — context snapshot*
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: "List all context snapshots"
3
+ allowed-tools: Bash
4
+ argument-hint: "[--limit N]"
5
+ ---
6
+
7
+ List context snapshots:
8
+
9
+ ```bash
10
+ npx @tyroneross/bookmark list {{ARGUMENTS}}
11
+ ```
12
+
13
+ Display a compact list showing snapshot ID, trigger type, context percentage, and timestamp.
14
+
15
+ *bookmark — context snapshot*
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: "Restore context from a snapshot"
3
+ allowed-tools: Bash, Read
4
+ argument-hint: "[SNAP_ID]"
5
+ ---
6
+
7
+ {{#if ARGUMENTS}}
8
+ Load and display the full context from a specific snapshot:
9
+
10
+ ```bash
11
+ npx @tyroneross/bookmark show {{ARGUMENTS}}
12
+ ```
13
+
14
+ Read the snapshot and present the decisions, status, open items, and unknowns to the user. Use this context to continue the work.
15
+
16
+ {{else}}
17
+ Show the latest snapshot and list available alternatives:
18
+
19
+ ```bash
20
+ npx @tyroneross/bookmark show --latest
21
+ ```
22
+
23
+ ```bash
24
+ npx @tyroneross/bookmark list --limit 5
25
+ ```
26
+
27
+ Present the restored context and ask the user which open item to continue with.
28
+ {{/if}}
29
+
30
+ *bookmark — context snapshot*
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: "Take a manual context snapshot"
3
+ allowed-tools: Bash
4
+ argument-hint: "[--smart]"
5
+ ---
6
+
7
+ Take a manual context snapshot of the current session.
8
+
9
+ {{#if ARGUMENTS}}
10
+ ```bash
11
+ npx @tyroneross/bookmark snapshot --trigger manual {{ARGUMENTS}}
12
+ ```
13
+ {{else}}
14
+ ```bash
15
+ npx @tyroneross/bookmark snapshot --trigger manual
16
+ ```
17
+ {{/if}}
18
+
19
+ After the snapshot is taken, confirm to the user with:
20
+ - The snapshot ID
21
+ - Number of decisions captured
22
+ - Number of files tracked
23
+ - Number of open items
24
+ - Context remaining percentage
25
+
26
+ *bookmark — context snapshot*
@@ -0,0 +1,19 @@
1
+ ---
2
+ description: "Show bookmark snapshot inventory"
3
+ allowed-tools: Bash
4
+ ---
5
+
6
+ Show the current state of context snapshots:
7
+
8
+ ```bash
9
+ npx @tyroneross/bookmark status
10
+ ```
11
+
12
+ Display the results including:
13
+ - Number of snapshots
14
+ - Compaction cycle count
15
+ - Last snapshot time
16
+ - Current adaptive threshold
17
+ - Time until next scheduled snapshot
18
+
19
+ *bookmark — context snapshot*
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}