@bjlee2024/claude-mem 13.4.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 (101) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.codex-plugin/plugin.json +46 -0
  3. package/LICENSE +202 -0
  4. package/README.md +419 -0
  5. package/dist/npx-cli/index.js +10001 -0
  6. package/dist/opencode-plugin/index.js +67 -0
  7. package/openclaw/Dockerfile.e2e +46 -0
  8. package/openclaw/SKILL.md +462 -0
  9. package/openclaw/TESTING.md +279 -0
  10. package/openclaw/dist/index.js +15 -0
  11. package/openclaw/e2e-verify.sh +222 -0
  12. package/openclaw/install.sh +1653 -0
  13. package/openclaw/openclaw.plugin.json +98 -0
  14. package/openclaw/package.json +21 -0
  15. package/openclaw/src/index.test.ts +1124 -0
  16. package/openclaw/src/index.ts +1092 -0
  17. package/openclaw/test-e2e.sh +40 -0
  18. package/openclaw/test-install.sh +2086 -0
  19. package/openclaw/test-sse-consumer.js +98 -0
  20. package/openclaw/tsconfig.json +26 -0
  21. package/package.json +211 -0
  22. package/plugin/.claude-plugin/plugin.json +24 -0
  23. package/plugin/.codex-plugin/plugin.json +46 -0
  24. package/plugin/.mcp.json +12 -0
  25. package/plugin/hooks/bugfixes-2026-01-10.md +92 -0
  26. package/plugin/hooks/codex-hooks.json +74 -0
  27. package/plugin/hooks/hooks.json +87 -0
  28. package/plugin/modes/code--ar.json +24 -0
  29. package/plugin/modes/code--bn.json +24 -0
  30. package/plugin/modes/code--chill.json +8 -0
  31. package/plugin/modes/code--cs.json +24 -0
  32. package/plugin/modes/code--da.json +24 -0
  33. package/plugin/modes/code--de.json +24 -0
  34. package/plugin/modes/code--el.json +24 -0
  35. package/plugin/modes/code--es.json +24 -0
  36. package/plugin/modes/code--fi.json +24 -0
  37. package/plugin/modes/code--fr.json +24 -0
  38. package/plugin/modes/code--he.json +24 -0
  39. package/plugin/modes/code--hi.json +24 -0
  40. package/plugin/modes/code--hu.json +24 -0
  41. package/plugin/modes/code--id.json +24 -0
  42. package/plugin/modes/code--it.json +24 -0
  43. package/plugin/modes/code--ja.json +24 -0
  44. package/plugin/modes/code--ko.json +24 -0
  45. package/plugin/modes/code--nl.json +24 -0
  46. package/plugin/modes/code--no.json +24 -0
  47. package/plugin/modes/code--pl.json +24 -0
  48. package/plugin/modes/code--pt-br.json +24 -0
  49. package/plugin/modes/code--ro.json +24 -0
  50. package/plugin/modes/code--ru.json +24 -0
  51. package/plugin/modes/code--sv.json +24 -0
  52. package/plugin/modes/code--th.json +24 -0
  53. package/plugin/modes/code--tr.json +24 -0
  54. package/plugin/modes/code--uk.json +24 -0
  55. package/plugin/modes/code--ur.json +25 -0
  56. package/plugin/modes/code--vi.json +24 -0
  57. package/plugin/modes/code--zh.json +24 -0
  58. package/plugin/modes/code.json +139 -0
  59. package/plugin/modes/email-investigation.json +120 -0
  60. package/plugin/modes/law-study--chill.json +7 -0
  61. package/plugin/modes/law-study-CLAUDE.md +85 -0
  62. package/plugin/modes/law-study.json +120 -0
  63. package/plugin/modes/meme-tokens.json +125 -0
  64. package/plugin/package.json +46 -0
  65. package/plugin/scripts/bun-runner.js +216 -0
  66. package/plugin/scripts/context-generator.cjs +795 -0
  67. package/plugin/scripts/mcp-server.cjs +239 -0
  68. package/plugin/scripts/server-beta-service.cjs +9856 -0
  69. package/plugin/scripts/statusline-counts.js +40 -0
  70. package/plugin/scripts/version-check.js +69 -0
  71. package/plugin/scripts/worker-cli.js +19 -0
  72. package/plugin/scripts/worker-service.cjs +2368 -0
  73. package/plugin/scripts/worker-wrapper.cjs +2 -0
  74. package/plugin/skills/babysit/SKILL.md +87 -0
  75. package/plugin/skills/design-is/SKILL.md +312 -0
  76. package/plugin/skills/do/SKILL.md +45 -0
  77. package/plugin/skills/how-it-works/SKILL.md +22 -0
  78. package/plugin/skills/how-it-works/onboarding-explainer.md +17 -0
  79. package/plugin/skills/knowledge-agent/SKILL.md +80 -0
  80. package/plugin/skills/learn-codebase/SKILL.md +21 -0
  81. package/plugin/skills/make-plan/SKILL.md +67 -0
  82. package/plugin/skills/mem-search/SKILL.md +131 -0
  83. package/plugin/skills/oh-my-issues/SKILL.md +226 -0
  84. package/plugin/skills/pathfinder/SKILL.md +111 -0
  85. package/plugin/skills/smart-explore/SKILL.md +190 -0
  86. package/plugin/skills/timeline-report/SKILL.md +211 -0
  87. package/plugin/skills/version-bump/SKILL.md +68 -0
  88. package/plugin/skills/version-bump/scripts/generate_changelog.js +34 -0
  89. package/plugin/skills/weekly-digests/SKILL.md +262 -0
  90. package/plugin/skills/wowerpoint/SKILL.md +205 -0
  91. package/plugin/ui/assets/fonts/monaspace-radon-var.woff +0 -0
  92. package/plugin/ui/assets/fonts/monaspace-radon-var.woff2 +0 -0
  93. package/plugin/ui/claude-mem-logo-for-dark-mode.webp +0 -0
  94. package/plugin/ui/claude-mem-logo-stylized.png +0 -0
  95. package/plugin/ui/claude-mem-logomark.webp +0 -0
  96. package/plugin/ui/icon-thick-completed.svg +8 -0
  97. package/plugin/ui/icon-thick-investigated.svg +8 -0
  98. package/plugin/ui/icon-thick-learned.svg +12 -0
  99. package/plugin/ui/icon-thick-next-steps.svg +8 -0
  100. package/plugin/ui/viewer-bundle.js +65 -0
  101. package/plugin/ui/viewer.html +3145 -0
@@ -0,0 +1,190 @@
1
+ ---
2
+ name: smart-explore
3
+ description: Token-optimized structural code search using tree-sitter AST parsing. Use instead of reading full files when you need to understand code structure, find functions, or explore a codebase efficiently.
4
+ ---
5
+
6
+ # Smart Explore
7
+
8
+ Structural code exploration using AST parsing. **This skill overrides your default exploration behavior.** While this skill is active, use smart_search/smart_outline/smart_unfold as your primary tools instead of Read, Grep, and Glob.
9
+
10
+ **Core principle:** Index first, fetch on demand. Give yourself a map of the code before loading implementation details. The question before every file read should be: "do I need to see all of this, or can I get a structural overview first?" The answer is almost always: get the map.
11
+
12
+ ## Your Next Tool Call
13
+
14
+ This skill only loads instructions. You must call the MCP tools yourself. Your next action should be one of:
15
+
16
+ ```
17
+ smart_search(query="<topic>", path="./src") -- discover files + symbols across a directory
18
+ smart_outline(file_path="<file>") -- structural skeleton of one file
19
+ smart_unfold(file_path="<file>", symbol_name="<name>") -- full source of one symbol
20
+ ```
21
+
22
+ Do NOT run Grep, Glob, Read, or find to discover files first. `smart_search` walks directories, parses all code files, and returns ranked symbols in one call. It replaces the Glob → Grep → Read discovery cycle.
23
+
24
+ ## 3-Layer Workflow
25
+
26
+ ### Step 1: Search -- Discover Files and Symbols
27
+
28
+ ```
29
+ smart_search(query="shutdown", path="./src", max_results=15)
30
+ ```
31
+
32
+ **Returns:** Ranked symbols with signatures, line numbers, match reasons, plus folded file views (~2-6k tokens)
33
+
34
+ ```
35
+ -- Matching Symbols --
36
+ function performGracefulShutdown (services/infrastructure/GracefulShutdown.ts:56)
37
+ function httpShutdown (services/infrastructure/HealthMonitor.ts:92)
38
+ method WorkerService.shutdown (services/worker-service.ts:846)
39
+
40
+ -- Folded File Views --
41
+ services/infrastructure/GracefulShutdown.ts (7 symbols)
42
+ services/worker-service.ts (12 symbols)
43
+ ```
44
+
45
+ This is your discovery tool. It finds relevant files AND shows their structure. No Glob/find pre-scan needed.
46
+
47
+ **Parameters:**
48
+
49
+ - `query` (string, required) -- What to search for (function name, concept, class name)
50
+ - `path` (string) -- Root directory to search (defaults to cwd)
51
+ - `max_results` (number) -- Max matching symbols, default 20, max 50
52
+ - `file_pattern` (string, optional) -- Filter to specific files/paths
53
+
54
+ ### Step 2: Outline -- Get File Structure
55
+
56
+ ```
57
+ smart_outline(file_path="services/worker-service.ts")
58
+ ```
59
+
60
+ **Returns:** Complete structural skeleton -- all functions, classes, methods, properties, imports (~1-2k tokens per file)
61
+
62
+ **Skip this step** when Step 1's folded file views already provide enough structure. Most useful for files not covered by the search results.
63
+
64
+ **Parameters:**
65
+
66
+ - `file_path` (string, required) -- Path to the file
67
+
68
+ ### Step 3: Unfold -- See Implementation
69
+
70
+ Review symbols from Steps 1-2. Pick the ones you need. Unfold only those:
71
+
72
+ ```
73
+ smart_unfold(file_path="services/worker-service.ts", symbol_name="shutdown")
74
+ ```
75
+
76
+ **Returns:** Full source code of the specified symbol including JSDoc, decorators, and complete implementation (~400-2,100 tokens depending on symbol size). AST node boundaries guarantee completeness regardless of symbol size — unlike Read + agent summarization, which may truncate long methods.
77
+
78
+ **Parameters:**
79
+
80
+ - `file_path` (string, required) -- Path to the file (as returned by search/outline)
81
+ - `symbol_name` (string, required) -- Name of the function/class/method to expand
82
+
83
+ ## When to Use Standard Tools Instead
84
+
85
+ Use these only when smart_* tools are the wrong fit:
86
+
87
+ - **Grep:** Exact string/regex search ("find all TODO comments", "where is `ensureWorkerStarted` defined?")
88
+ - **Read:** Small files under ~100 lines, non-code files (JSON, markdown, config)
89
+ - **Glob:** File path patterns ("find all test files")
90
+ - **Explore agent:** When you need synthesized understanding across 6+ files, architecture narratives, or answers to open-ended questions like "how does this entire system work end-to-end?" Smart-explore is a scalpel — it answers "where is this?" and "show me that." It doesn't synthesize cross-file data flows, design decisions, or edge cases across an entire feature.
91
+
92
+ For code files over ~100 lines, prefer smart_outline + smart_unfold over Read.
93
+
94
+ ## Workflow Examples
95
+
96
+ **Discover how a feature works (cross-cutting):**
97
+
98
+ ```
99
+ 1. smart_search(query="shutdown", path="./src")
100
+ -> 14 symbols across 7 files, full picture in one call
101
+ 2. smart_unfold(file_path="services/infrastructure/GracefulShutdown.ts", symbol_name="performGracefulShutdown")
102
+ -> See the core implementation
103
+ ```
104
+
105
+ **Navigate a large file:**
106
+
107
+ ```
108
+ 1. smart_outline(file_path="services/worker-service.ts")
109
+ -> 1,466 tokens: 12 functions, WorkerService class with 24 members
110
+ 2. smart_unfold(file_path="services/worker-service.ts", symbol_name="startSessionProcessor")
111
+ -> 1,610 tokens: the specific method you need
112
+ Total: ~3,076 tokens vs ~12,000 to Read the full file
113
+ ```
114
+
115
+ **Write documentation about code (hybrid workflow):**
116
+
117
+ ```
118
+ 1. smart_search(query="feature name", path="./src") -- discover all relevant files and symbols
119
+ 2. smart_outline on key files -- understand structure
120
+ 3. smart_unfold on important functions -- get implementation details
121
+ 4. Read on small config/markdown/plan files -- get non-code context
122
+ ```
123
+
124
+ Use smart_* tools for code exploration, Read for non-code files. Mix freely.
125
+
126
+ **Exploration then precision:**
127
+
128
+ ```
129
+ 1. smart_search(query="session", path="./src", max_results=10)
130
+ -> 10 ranked symbols: SessionMetadata, SessionQueueProcessor, SessionSummary...
131
+ 2. Pick the relevant one, unfold it
132
+ ```
133
+
134
+ ## Token Economics
135
+
136
+ | Approach | Tokens | Use Case |
137
+ |----------|--------|----------|
138
+ | smart_outline | ~1,000-2,000 | "What's in this file?" |
139
+ | smart_unfold | ~400-2,100 | "Show me this function" |
140
+ | smart_search | ~2,000-6,000 | "Find all X across the codebase" |
141
+ | search + unfold | ~3,000-8,000 | End-to-end: find and read (the primary workflow) |
142
+ | Read (full file) | ~12,000+ | When you truly need everything |
143
+ | Explore agent | ~39,000-59,000 | Cross-file synthesis with narrative |
144
+
145
+ **4-8x savings** on file understanding (outline + unfold vs Read). **11-18x savings** on codebase exploration vs Explore agent. The narrower the query, the wider the gap — a 27-line function costs 55x less to read via unfold than via an Explore agent, because the agent still reads the entire file.
146
+
147
+ ## Language Support
148
+
149
+ Smart-explore uses **tree-sitter AST parsing** for structural analysis. Unsupported file types fall back to text-based search.
150
+
151
+ ### Bundled Languages
152
+
153
+ | Language | Extensions |
154
+ |----------|-----------|
155
+ | JavaScript | `.js`, `.mjs`, `.cjs` |
156
+ | TypeScript | `.ts` |
157
+ | TSX / JSX | `.tsx`, `.jsx` |
158
+ | Python | `.py`, `.pyw` |
159
+ | Go | `.go` |
160
+ | Rust | `.rs` |
161
+ | Ruby | `.rb` |
162
+ | Java | `.java` |
163
+ | C | `.c`, `.h` |
164
+ | C++ | `.cpp`, `.cc`, `.cxx`, `.hpp`, `.hh` |
165
+
166
+ Files with unrecognized extensions are parsed as plain text — `smart_search` still works (grep-style), but `smart_outline` and `smart_unfold` will not extract structured symbols.
167
+
168
+ ### Custom Grammars (`.claude-mem.json`)
169
+
170
+ You can register additional tree-sitter grammars for file types not in the bundled list. Create or update `.claude-mem.json` in your project root:
171
+
172
+ ```json
173
+ {
174
+ "grammars": {
175
+ ".sol": "tree-sitter-solidity",
176
+ ".graphql": "tree-sitter-graphql"
177
+ }
178
+ }
179
+ ```
180
+
181
+ Each key is a file extension; each value is the npm package name of the tree-sitter grammar. The grammar must be installed locally (`npm install tree-sitter-solidity`). Once registered, `smart_outline` and `smart_unfold` will parse those extensions structurally instead of falling back to plain text.
182
+
183
+ ### Markdown Special Support
184
+
185
+ Markdown files (`.md`, `.mdx`) receive special handling beyond the generic plain-text fallback:
186
+
187
+ - **`smart_outline`** — extracts headings (`#`, `##`, `###`) as the symbol tree. Use it to navigate long documents without reading the full file.
188
+ - **`smart_search`** — searches within code fences as well as prose, so queries for function names inside ` ```ts ``` ` blocks work as expected.
189
+ - **`smart_unfold`** — expands heading sections rather than function bodies; each section up to the next same-level heading is returned as a chunk.
190
+ - **Frontmatter** — YAML frontmatter (lines between leading `---` delimiters) is included in `smart_outline` output under a synthetic `frontmatter` symbol so metadata like `title:` and `description:` is visible without reading the whole file.
@@ -0,0 +1,211 @@
1
+ ---
2
+ name: timeline-report
3
+ description: Generate a "Journey Into [Project]" narrative report analyzing a project's entire development history from claude-mem's timeline. Use when asked for a timeline report, project history analysis, development journey, or full project report.
4
+ ---
5
+
6
+ # Timeline Report
7
+
8
+ Generate a comprehensive narrative analysis of a project's entire development history using claude-mem's persistent memory timeline.
9
+
10
+ ## When to Use
11
+
12
+ Use when users ask for:
13
+
14
+ - "Write a timeline report"
15
+ - "Journey into [project]"
16
+ - "Analyze my project history"
17
+ - "Full project report"
18
+ - "Summarize the entire development history"
19
+ - "What's the story of this project?"
20
+
21
+ ## Prerequisites
22
+
23
+ The claude-mem worker must be running. The project must have claude-mem observations recorded.
24
+
25
+ **Resolve the worker port** (do this once at the start and reuse `$WORKER_PORT` in every curl call below):
26
+
27
+ ```bash
28
+ WORKER_PORT="${CLAUDE_MEM_WORKER_PORT:-$(node -e "const fs=require('fs'),p=require('path'),os=require('os');const uid=(typeof process.getuid==='function'?process.getuid():77);const fallback=String(37700+(uid%100));try{const s=JSON.parse(fs.readFileSync(p.join(os.homedir(),'.claude-mem','settings.json'),'utf-8'));process.stdout.write(String(s.CLAUDE_MEM_WORKER_PORT||fallback));}catch{process.stdout.write(fallback);}" 2>/dev/null)}"
29
+ ```
30
+
31
+ This honors `CLAUDE_MEM_WORKER_PORT` env, then `~/.claude-mem/settings.json`, then falls back to the per-UID default `37700 + (uid % 100)` — matching how the worker itself picks its port. Required for multi-account setups (#2101) and any user who has overridden the default port (#2103).
32
+
33
+ ## Workflow
34
+
35
+ ### Step 1: Determine the Project Name
36
+
37
+ Ask the user which project to analyze if not obvious from context. The project name is typically the directory name of the project (e.g., "tokyo", "my-app"). If the user says "this project", use the current working directory's basename.
38
+
39
+ **Worktree Detection:** Before using the directory basename, check if the current directory is a git worktree. In a worktree, the data source is the **parent project**, not the worktree directory itself. Run:
40
+
41
+ ```bash
42
+ git_dir=$(git rev-parse --git-dir 2>/dev/null)
43
+ git_common_dir=$(git rev-parse --git-common-dir 2>/dev/null)
44
+ if [ "$git_dir" != "$git_common_dir" ]; then
45
+ # We're in a worktree — resolve the parent project name
46
+ parent_project=$(basename "$(dirname "$git_common_dir")")
47
+ echo "Worktree detected. Parent project: $parent_project"
48
+ else
49
+ parent_project=$(basename "$PWD")
50
+ fi
51
+ echo "$parent_project"
52
+ ```
53
+
54
+ If a worktree is detected, use `$parent_project` (the basename of the parent repo) as the project name for all API calls. Inform the user: "Detected git worktree. Using parent project '[name]' as the data source."
55
+
56
+ ### Step 2: Fetch the Full Timeline
57
+
58
+ Use Bash to fetch the complete timeline from the claude-mem worker API:
59
+
60
+ ```bash
61
+ curl -s "http://localhost:${WORKER_PORT}/api/context/inject?project=PROJECT_NAME&full=true"
62
+ ```
63
+
64
+ This returns the entire compressed timeline -- every observation, session boundary, and summary across the project's full history. The response is pre-formatted markdown optimized for LLM consumption.
65
+
66
+ **Token estimates:** The full timeline size depends on the project's history:
67
+ - Small project (< 1,000 observations): ~20-50K tokens
68
+ - Medium project (1,000-10,000 observations): ~50-300K tokens
69
+ - Large project (10,000-35,000 observations): ~300-750K tokens
70
+
71
+ If the response is empty or returns an error, the worker may not be running or the project name may be wrong. Try `curl -s "http://localhost:${WORKER_PORT}/api/search?query=*&limit=1"` to verify the worker is healthy.
72
+
73
+ ### Step 3: Estimate Token Count
74
+
75
+ Before proceeding, estimate the token count of the fetched timeline (roughly 1 token per 4 characters). Report this to the user:
76
+
77
+ ```
78
+ Timeline fetched: ~X observations, estimated ~Yk tokens.
79
+ This analysis will consume approximately Yk input tokens + ~5-10k output tokens.
80
+ Proceed? (y/n)
81
+ ```
82
+
83
+ Wait for user confirmation before continuing if the timeline exceeds 100K tokens.
84
+
85
+ ### Step 4: Analyze with a Subagent
86
+
87
+ Deploy an Agent (using the Task tool) with the full timeline and the following analysis prompt. Pass the ENTIRE timeline as context to the agent. The agent should also be instructed to query the SQLite database at `~/.claude-mem/claude-mem.db` for the Token Economics section.
88
+
89
+ **Agent prompt:**
90
+
91
+ ```
92
+ You are a technical historian analyzing a software project's complete development timeline from claude-mem's persistent memory system. The timeline below contains every observation, session boundary, and summary recorded across the project's entire history.
93
+
94
+ You also have access to the claude-mem SQLite database at ~/.claude-mem/claude-mem.db. Use it to run queries for the Token Economics & Memory ROI section. The database has an "observations" table with columns: id, memory_session_id, project, text, type, title, subtitle, facts, narrative, concepts, files_read, files_modified, prompt_number, discovery_tokens, created_at, created_at_epoch, source_tool, source_input_summary.
95
+
96
+ Write a comprehensive narrative report titled "Journey Into [PROJECT_NAME]" that covers:
97
+
98
+ ## Required Sections
99
+
100
+ 1. **Project Genesis** -- When and how the project started. What were the first commits, the initial vision, the founding technical decisions? What problem was being solved?
101
+
102
+ 2. **Architectural Evolution** -- How did the architecture change over time? What were the major pivots? Why did they happen? Trace the evolution from initial design through each significant restructuring.
103
+
104
+ 3. **Key Breakthroughs** -- Identify the "aha" moments: when a difficult problem was finally solved, when a new approach unlocked progress, when a prototype first worked. These are the observations where the tone shifts from investigation to resolution.
105
+
106
+ 4. **Work Patterns** -- Analyze the rhythm of development. Identify debugging cycles (clusters of bug fixes), feature sprints (rapid observation sequences), refactoring phases (architectural changes without new features), and exploration phases (many discoveries without changes).
107
+
108
+ 5. **Technical Debt** -- Track where shortcuts were taken and when they were paid back. Identify patterns of accumulation (rapid feature work) and resolution (dedicated refactoring sessions).
109
+
110
+ 6. **Challenges and Debugging Sagas** -- The hardest problems encountered. Multi-session debugging efforts, architectural dead-ends that required backtracking, platform-specific issues that took days to resolve.
111
+
112
+ 7. **Memory and Continuity** -- How did persistent memory (claude-mem itself, if applicable) affect the development process? Were there moments where recalled context from prior sessions saved significant time or prevented repeated mistakes?
113
+
114
+ 8. **Token Economics & Memory ROI** -- Quantitative analysis of how memory recall saved work:
115
+ - Query the database directly for these metrics using `sqlite3 ~/.claude-mem/claude-mem.db`
116
+ - Count total discovery_tokens across all observations (the original cost of all work)
117
+ - Count sessions that had context injection available (sessions after the first)
118
+ - Calculate the compression ratio: average discovery_tokens vs average read_tokens per observation
119
+ - Identify the highest-value observations (highest discovery_tokens -- these are the most expensive decisions, bugs, and discoveries that memory prevents re-doing)
120
+ - Identify explicit recall events (observations where source_tool contains "search", "smart_search", "get_observations", "timeline", or where narrative mentions "recalled", "from memory", "previous session")
121
+ - Estimate passive recall savings: each session with context injection receives ~50 observations. Use a 30% relevance factor (conservative estimate that 30% of injected context prevents re-work). Savings = sessions_with_context × avg_discovery_value_of_50_obs_window × 0.30
122
+ - Estimate explicit recall savings: ~10K tokens per explicit recall query
123
+ - Calculate net ROI: total_savings / total_read_tokens_invested
124
+ - Present as a table with monthly breakdown
125
+ - Highlight the top 5 most expensive observations by discovery_tokens -- these represent the highest-value memories in the system (architecture decisions, hard bugs, implementation plans that cost 100K+ tokens to produce originally)
126
+
127
+ Use these SQL queries as a starting point:
128
+ ```sql
129
+ -- Total discovery tokens
130
+ SELECT SUM(discovery_tokens) FROM observations WHERE project = 'PROJECT_NAME';
131
+
132
+ -- Sessions with context available (not the first session)
133
+ SELECT COUNT(DISTINCT memory_session_id) FROM observations WHERE project = 'PROJECT_NAME';
134
+
135
+ -- Average tokens per observation
136
+ SELECT AVG(discovery_tokens) as avg_discovery, AVG(LENGTH(title || COALESCE(subtitle,'') || COALESCE(narrative,'') || COALESCE(facts,'')) / 4) as avg_read FROM observations WHERE project = 'PROJECT_NAME' AND discovery_tokens > 0;
137
+
138
+ -- Top 5 most expensive observations (highest-value memories)
139
+ SELECT id, title, discovery_tokens FROM observations WHERE project = 'PROJECT_NAME' ORDER BY discovery_tokens DESC LIMIT 5;
140
+
141
+ -- Monthly breakdown
142
+ SELECT strftime('%Y-%m', created_at) as month, COUNT(*) as obs, SUM(discovery_tokens) as total_discovery, COUNT(DISTINCT memory_session_id) as sessions FROM observations WHERE project = 'PROJECT_NAME' GROUP BY month ORDER BY month;
143
+
144
+ -- Explicit recall events
145
+ SELECT COUNT(*) FROM observations WHERE project = 'PROJECT_NAME' AND (source_tool LIKE '%search%' OR source_tool LIKE '%timeline%' OR source_tool LIKE '%get_observations%' OR narrative LIKE '%recalled%' OR narrative LIKE '%from memory%' OR narrative LIKE '%previous session%');
146
+ ```
147
+
148
+ 9. **Timeline Statistics** -- Quantitative summary:
149
+ - Date range (first observation to last)
150
+ - Total observations and sessions
151
+ - Breakdown by observation type (features, bug fixes, discoveries, decisions, changes)
152
+ - Most active days/weeks
153
+ - Longest debugging sessions
154
+
155
+ 10. **Lessons and Meta-Observations** -- What patterns emerge from the full history? What would a new developer learn about this codebase from reading the timeline? What recurring themes or principles guided development?
156
+
157
+ ## Writing Style
158
+
159
+ - Write as a technical narrative, not a list of bullet points
160
+ - Use specific observation IDs and timestamps when referencing events (e.g., "On Dec 14 (#26766), the root cause was finally identified...")
161
+ - Connect events across time -- show how early decisions created later consequences
162
+ - Be honest about struggles and dead ends, not just successes
163
+ - Target 3,000-6,000 words depending on project size
164
+ - Use markdown formatting with headers, emphasis, and code references where appropriate
165
+
166
+ ## Important
167
+
168
+ - Analyze the ENTIRE timeline chronologically -- do not skip early history
169
+ - Look for narrative arcs: problem -> investigation -> solution
170
+ - Identify turning points where the project's direction fundamentally changed
171
+ - Note any observations about the development process itself (tooling, workflow, collaboration patterns)
172
+
173
+ Here is the complete project timeline:
174
+
175
+ [TIMELINE CONTENT GOES HERE]
176
+ ```
177
+
178
+ ### Step 5: Save the Report
179
+
180
+ Save the agent's output as a markdown file. Default location:
181
+
182
+ ```
183
+ ./journey-into-PROJECT_NAME.md
184
+ ```
185
+
186
+ Or if the user specified a different output path, use that instead.
187
+
188
+ ### Step 6: Report Completion
189
+
190
+ Tell the user:
191
+ - Where the report was saved
192
+ - The approximate token cost (input timeline + output report)
193
+ - The date range covered
194
+ - Number of observations analyzed
195
+
196
+ ## Error Handling
197
+
198
+ - **Empty timeline:** "No observations found for project 'X'. Check the project name with: `curl -s \"http://localhost:${WORKER_PORT}/api/search?query=*&limit=1\"`"
199
+ - **Worker not running:** "The claude-mem worker is not responding on port ${WORKER_PORT}. Start it with your usual method or check `ps aux | grep worker-service`."
200
+ - **Timeline too large:** For projects with 50,000+ observations, the timeline may exceed context limits. Suggest using date range filtering: `curl -s "http://localhost:${WORKER_PORT}/api/context/inject?project=X&full=true"` -- the current endpoint returns all observations; for extremely large projects, the user may want to analyze in time-windowed segments.
201
+
202
+ ## Example
203
+
204
+ User: "Write a journey report for the tokyo project"
205
+
206
+ 1. Fetch: `curl -s "http://localhost:${WORKER_PORT}/api/context/inject?project=tokyo&full=true"`
207
+ 2. Estimate: "Timeline fetched: ~34,722 observations, estimated ~718K tokens. Proceed?"
208
+ 3. User confirms
209
+ 4. Deploy analysis agent with full timeline
210
+ 5. Save to `./journey-into-tokyo.md`
211
+ 6. Report: "Report saved. Analyzed 34,722 observations spanning Oct 2025 - Mar 2026 (~718K input tokens, ~8K output tokens)."
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: claude-code-plugin-release
3
+ description: Automated semantic versioning and release workflow for Claude Code plugins. Handles version increments across package.json, marketplace.json, plugin.json manifests, npm publishing (so `npx claude-mem@X.Y.Z` resolves), build verification, git tagging, GitHub releases, and changelog generation.
4
+ ---
5
+
6
+ # Version Bump & Release Workflow
7
+
8
+ **IMPORTANT:** Plan and write detailed release notes before starting.
9
+
10
+ **CRITICAL:** Commit EVERYTHING (including build artifacts). At the end of this workflow, NOTHING should be left uncommitted or unpushed. Run `git status` at the end to verify.
11
+
12
+ ## Preparation
13
+
14
+ 1. **Analyze**: Determine if the change is **PATCH** (bug fixes), **MINOR** (features), or **MAJOR** (breaking).
15
+ 2. **Environment**: Identify repository owner/name from `git remote -v`.
16
+ 3. **Paths — every file that carries the version string**:
17
+ - `package.json` — **the npm/npx-published version** (`npx claude-mem@X.Y.Z` resolves from this)
18
+ - `plugin/package.json` — bundled plugin runtime deps
19
+ - `.claude-plugin/marketplace.json` — version inside `plugins[0].version`
20
+ - `.claude-plugin/plugin.json` — top-level Claude-plugin manifest
21
+ - `plugin/.claude-plugin/plugin.json` — bundled Claude-plugin manifest
22
+ - `.codex-plugin/plugin.json` — Codex-plugin manifest
23
+ - `openclaw/openclaw.plugin.json` — OpenClaw plugin manifest
24
+
25
+ Verify coverage before editing: `git grep -l "\"version\": \"<OLD>\""` should list all seven. If a new manifest has been added since this doc was last updated, update this list.
26
+
27
+ ## Workflow
28
+
29
+ 1. **Update**: Increment the version string in every path above. Do NOT touch `CHANGELOG.md` — it's regenerated.
30
+ 2. **Verify**: `git grep -n "\"version\": \"<NEW>\""` — confirm all seven files match. `git grep -n "\"version\": \"<OLD>\""` — should return zero hits.
31
+ 3. **Build and sync**: `npm run build-and-sync` to regenerate artifacts, sync the local marketplace copy, restart the worker, and clear the queue. Do not use plain `npm run build` for release validation because it can leave the local marketplace/worker out of sync.
32
+ 4. **Commit**: `git add -A && git commit -m "chore: bump version to X.Y.Z"`.
33
+ 5. **Tag**: `git tag -a vX.Y.Z -m "Version X.Y.Z"`.
34
+ 6. **Push**: `git push origin main && git push origin vX.Y.Z`.
35
+ 7. **Publish to npm** (this is what makes `npx claude-mem@X.Y.Z` work):
36
+ ```bash
37
+ npm publish
38
+ ```
39
+ The `prepublishOnly` script re-runs the package build automatically. After publish, run `npm run build-and-sync` again if the publish build touched local artifacts. Confirm publish succeeded:
40
+ ```bash
41
+ npm view claude-mem@X.Y.Z version # should print X.Y.Z
42
+ ```
43
+ Alternative: `npm run release:patch` / `release:minor` / `release:major` invokes `np` and handles tag+push+publish in one shot — use ONLY if you skipped steps 4–6, otherwise `np` will error on the existing tag.
44
+ 8. **GitHub release**: `gh release create vX.Y.Z --title "vX.Y.Z" --notes "RELEASE_NOTES"`.
45
+ 9. **Changelog**: Regenerate via the project's changelog script:
46
+ ```bash
47
+ npm run changelog:generate
48
+ ```
49
+ (Runs `node scripts/generate-changelog.js`, which pulls releases from the GitHub API and rewrites `CHANGELOG.md`.)
50
+ 10. **Sync changelog**: Commit and push the updated `CHANGELOG.md`.
51
+ 11. **Notify**: Run the Discord notification from `~/Scripts/claude-mem/`, where the `.env` with Discord webhook details lives:
52
+ ```bash
53
+ cd ~/Scripts/claude-mem/ && npm run discord:notify vX.Y.Z
54
+ ```
55
+ Do this even when the release worktree does not have a local `.env`.
56
+ 12. **Finalize**: `git status` — working tree must be clean.
57
+
58
+ ## Checklist
59
+
60
+ - [ ] All seven config files have matching versions
61
+ - [ ] `git grep` for old version returns zero hits
62
+ - [ ] `npm run build-and-sync` succeeded
63
+ - [ ] Git tag created and pushed
64
+ - [ ] **`npm publish` succeeded and `npm view claude-mem@X.Y.Z version` confirms it** (so `npx claude-mem@X.Y.Z` resolves)
65
+ - [ ] GitHub release created with notes
66
+ - [ ] `CHANGELOG.md` updated and pushed
67
+ - [ ] Discord notification run from `~/Scripts/claude-mem/`
68
+ - [ ] `git status` shows clean tree
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ const fs = require('fs');
3
+
4
+ function generate() {
5
+ try {
6
+ const input = fs.readFileSync(0, 'utf8');
7
+ if (!input || input.trim() === '') {
8
+ process.stderr.write('No input received on stdin
9
+ ');
10
+ process.exit(1);
11
+ }
12
+
13
+ const releases = JSON.parse(input);
14
+ const lines = ['# Changelog', '', 'All notable changes to this project.', ''];
15
+
16
+ releases.slice(0, 50).forEach(r => {
17
+ const date = r.published_at.split('T')[0];
18
+ lines.push(`## [${r.tag_name}] - ${date}`);
19
+ lines.push('');
20
+ if (r.body) lines.push(r.body.trim());
21
+ lines.push('');
22
+ });
23
+
24
+ process.stdout.write(lines.join('
25
+ ') + '
26
+ ');
27
+ } catch (err) {
28
+ process.stderr.write(`Error generating changelog: ${err.message}
29
+ `);
30
+ process.exit(1);
31
+ }
32
+ }
33
+
34
+ generate();