claude-mem 3.3.7 → 3.3.9

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 (96) hide show
  1. package/README.md +183 -46
  2. package/dist/bin/cli.d.ts +2 -0
  3. package/dist/bin/cli.js +179 -0
  4. package/dist/commands/compress.d.ts +2 -0
  5. package/dist/commands/compress.js +27 -0
  6. package/dist/commands/hooks.d.ts +19 -0
  7. package/dist/commands/hooks.js +131 -0
  8. package/dist/commands/install.d.ts +2 -0
  9. package/dist/commands/install.js +836 -0
  10. package/dist/commands/load-context.d.ts +2 -0
  11. package/dist/commands/load-context.js +151 -0
  12. package/dist/commands/logs.d.ts +2 -0
  13. package/dist/commands/logs.js +76 -0
  14. package/dist/commands/migrate-to-jsonl.d.ts +5 -0
  15. package/dist/commands/migrate-to-jsonl.js +99 -0
  16. package/dist/commands/restore.d.ts +1 -0
  17. package/dist/commands/restore.js +20 -0
  18. package/dist/commands/status.d.ts +1 -0
  19. package/dist/commands/status.js +136 -0
  20. package/dist/commands/trash-empty.d.ts +3 -0
  21. package/dist/commands/trash-empty.js +56 -0
  22. package/dist/commands/trash-view.d.ts +1 -0
  23. package/dist/commands/trash-view.js +101 -0
  24. package/dist/commands/trash.d.ts +6 -0
  25. package/dist/commands/trash.js +49 -0
  26. package/dist/commands/uninstall.d.ts +2 -0
  27. package/dist/commands/uninstall.js +107 -0
  28. package/dist/constants.d.ts +271 -0
  29. package/dist/constants.js +199 -0
  30. package/dist/core/compression/TranscriptCompressor.d.ts +79 -0
  31. package/dist/core/compression/TranscriptCompressor.js +585 -0
  32. package/dist/core/orchestration/PromptOrchestrator.d.ts +165 -0
  33. package/dist/core/orchestration/PromptOrchestrator.js +182 -0
  34. package/dist/lib/time-utils.d.ts +5 -0
  35. package/dist/lib/time-utils.js +70 -0
  36. package/dist/prompts/constants.d.ts +126 -0
  37. package/dist/prompts/constants.js +161 -0
  38. package/dist/prompts/index.d.ts +10 -0
  39. package/dist/prompts/index.js +11 -0
  40. package/dist/prompts/templates/analysis/AnalysisTemplates.d.ts +13 -0
  41. package/dist/prompts/templates/analysis/AnalysisTemplates.js +94 -0
  42. package/dist/prompts/templates/context/ContextTemplates.d.ts +119 -0
  43. package/dist/prompts/templates/context/ContextTemplates.js +399 -0
  44. package/dist/prompts/templates/hooks/HookTemplates.d.ts +175 -0
  45. package/dist/prompts/templates/hooks/HookTemplates.js +394 -0
  46. package/dist/prompts/templates/hooks/HookTemplates.test.d.ts +7 -0
  47. package/dist/prompts/templates/hooks/HookTemplates.test.js +127 -0
  48. package/dist/shared/config.d.ts +4 -0
  49. package/dist/shared/config.js +41 -0
  50. package/dist/shared/error-handler.d.ts +22 -0
  51. package/dist/shared/error-handler.js +142 -0
  52. package/dist/shared/logger.d.ts +19 -0
  53. package/dist/shared/logger.js +51 -0
  54. package/dist/shared/paths.d.ts +28 -0
  55. package/dist/shared/paths.js +100 -0
  56. package/dist/shared/settings.d.ts +41 -0
  57. package/dist/shared/settings.js +81 -0
  58. package/dist/shared/types.d.ts +145 -0
  59. package/dist/shared/types.js +78 -0
  60. package/docs/STATUS.md +155 -0
  61. package/docs/chroma-backend-migration.md +161 -0
  62. package/docs/landing-page-outline.md +287 -0
  63. package/docs/multi-platform-builds.md +96 -0
  64. package/docs/plans/cloud-service-plan.md +274 -0
  65. package/docs/plans/fix-response-format-issue.md +61 -0
  66. package/docs/plans/restructure-session-hook-output.md +102 -0
  67. package/docs/plans/session-start-hook-investigation.md +45 -0
  68. package/docs/plans/src-reorganization-plan.md +181 -0
  69. package/docs/plans/terminal-effects-decision.md +22 -0
  70. package/docs/plans/terminal-effects-integration.md +82 -0
  71. package/docs/plans/trash-bin-feature-plan.md +240 -0
  72. package/docs/plans/trash-bin-minimal-plan.md +102 -0
  73. package/docs/reference/bun-single-executable.md +584 -0
  74. package/docs/reference/cc-output-styles.md +99 -0
  75. package/docs/reference/chroma-mcp-project-memory-example.md +80 -0
  76. package/docs/reference/chroma-mcp-team-example.md +92 -0
  77. package/docs/reference/claude-code/cc-hooks.md +787 -0
  78. package/docs/reference/claude-code/cc-status-line.md +202 -0
  79. package/docs/reference/claude-code/hook-configuration.md +173 -0
  80. package/docs/reference/claude-code/hook-responses.md +127 -0
  81. package/docs/reference/claude-code/hooks.md +175 -0
  82. package/docs/reference/claude-code/mcp-configuration.md +133 -0
  83. package/docs/reference/claude-code/session-start-hook.md +82 -0
  84. package/docs/reference/load-context-format-example.md +33 -0
  85. package/docs/reference/mcp-sdk/mcp-typescript-sdk-readme.md +1323 -0
  86. package/docs/reference/mcp-sdk/server-implementation.md +286 -0
  87. package/docs/reference/mcp-sdk/stdio-transport.md +345 -0
  88. package/docs/todos/fix-response-format-tasks.md +43 -0
  89. package/docs/todos/implementation-todos.md +280 -0
  90. package/docs/todos/restructure-hook-output-tasks.md +103 -0
  91. package/docs/todos/session-start-hook-fix.md +26 -0
  92. package/docs/todos/terminal-effects-tasks.md +42 -0
  93. package/docs/todos/trash-bin-implementation-todos.md +348 -0
  94. package/docs/todos/trash-bin-minimal-todos.md +27 -0
  95. package/package.json +56 -6
  96. package/claude-mem +0 -0
@@ -0,0 +1,133 @@
1
+ # MCP Configuration Documentation
2
+ ## Source: Official Claude Code Docs v2025
3
+ ## Last Verified: 2025-08-31
4
+
5
+ ## MCP Configuration File Locations
6
+
7
+ ### User Scope
8
+ - **File**: `~/.claude.json`
9
+ - **Purpose**: User-wide MCP servers available across all projects
10
+ - **Persistence**: Persists across projects
11
+ - **Example Path**: `/Users/username/.claude.json`
12
+
13
+ ### Project Scope
14
+ - **File**: `./.mcp.json`
15
+ - **Purpose**: Project-specific servers for team collaboration
16
+ - **Persistence**: Checked into version control
17
+ - **Example Path**: `/path/to/project/.mcp.json`
18
+
19
+ ### Local Scope
20
+ - **Status**: Not officially documented
21
+ - **Implementation**: Currently uses `~/.claude.json` (may need revision)
22
+
23
+ ## Configuration Structure
24
+
25
+ ```json
26
+ {
27
+ "mcpServers": {
28
+ "server-name": {
29
+ "command": "command-to-run",
30
+ "args": ["arg1", "arg2"],
31
+ "env": {
32
+ "ENV_VAR": "value"
33
+ }
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ ## Example Configurations
40
+
41
+ ### Memory Server (stdio)
42
+ ```json
43
+ {
44
+ "mcpServers": {
45
+ "claude-mem": {
46
+ "command": "npx",
47
+ "args": ["-y", "@modelcontextprotocol/server-memory"]
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ ### HTTP Server
54
+ ```json
55
+ {
56
+ "mcpServers": {
57
+ "api-server": {
58
+ "type": "sse",
59
+ "url": "${API_BASE_URL:-https://api.example.com}/mcp",
60
+ "headers": {
61
+ "Authorization": "Bearer ${API_KEY}"
62
+ }
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ ## Environment Variable Expansion
69
+
70
+ MCP configs support environment variable expansion:
71
+ - `${VAR}` - Direct expansion
72
+ - `${VAR:-default}` - With fallback value
73
+
74
+ Applicable fields:
75
+ - `command`
76
+ - `args`
77
+ - `env`
78
+ - `url`
79
+ - `headers`
80
+
81
+ ## CLI Commands
82
+
83
+ ```bash
84
+ # Add a server
85
+ claude mcp add <name> <command> [args...]
86
+
87
+ # Add with scope
88
+ claude mcp add <name> --scope project /path/to/server
89
+ claude mcp add <name> --scope user /path/to/server
90
+
91
+ # List servers
92
+ claude mcp list
93
+
94
+ # Get server details
95
+ claude mcp get <name>
96
+
97
+ # Remove server
98
+ claude mcp remove <name>
99
+
100
+ # Check status (within Claude Code)
101
+ /mcp
102
+ ```
103
+
104
+ ## Tool Naming Convention
105
+
106
+ MCP tools follow the pattern: `mcp__<serverName>__<toolName>`
107
+
108
+ Example:
109
+ - Server: `claude-mem`
110
+ - Tool: `create_entities`
111
+ - Full name: `mcp__claude_mem__create_entities`
112
+
113
+ ## Security Considerations
114
+
115
+ 1. **Tool Permissions**: Must explicitly allow MCP tools via `--allowedTools`
116
+ 2. **Server Trust**: Only use MCP servers from trusted sources
117
+ 3. **Credential Management**: Use environment variables for sensitive data
118
+ 4. **Audit Trail**: MCP operations can be monitored via hooks
119
+
120
+ ## Common Issues
121
+
122
+ ### Issue: MCP server not connecting
123
+ **Solution**: Check that the command and args are correct, and npx is in PATH
124
+
125
+ ### Issue: Tools not available
126
+ **Solution**: Ensure server is in allowed list and properly configured
127
+
128
+ ### Issue: Configuration not loading
129
+ **Solution**: Verify JSON syntax and file location
130
+
131
+ ## References
132
+ - Official Docs: https://docs.anthropic.com/en/docs/claude-code/mcp
133
+ - MCP Protocol: https://modelcontextprotocol.io/
@@ -0,0 +1,82 @@
1
+ # SessionStart Hook Documentation
2
+
3
+ ## Official Documentation Reference
4
+ - **Source**: https://docs.anthropic.com/en/docs/claude-code/hooks#sessionstart
5
+ - **Last Verified**: 2025-08-31
6
+ - **Version**: Claude Code v2025
7
+
8
+ ## Hook Payload Structure
9
+
10
+ The SessionStart hook receives the following JSON payload via stdin:
11
+
12
+ ```json
13
+ {
14
+ "session_id": "string",
15
+ "transcript_path": "string",
16
+ "hook_event_name": "SessionStart",
17
+ "source": "startup" | "compact" | "vscode" | "web"
18
+ }
19
+ ```
20
+
21
+ ### Field Descriptions
22
+
23
+ - **session_id**: Unique identifier for the Claude Code session
24
+ - **transcript_path**: Path to the conversation transcript JSONL file
25
+ - **hook_event_name**: Always "SessionStart" for this hook
26
+ - **source**: Indicates how the session was initiated:
27
+ - `"startup"`: New session started normally (should load context)
28
+ - `"compact"`: Session started after compaction (may skip context)
29
+ - `"vscode"`: Session initiated from VS Code extension
30
+ - `"web"`: Session initiated from web interface
31
+
32
+ ## Response Format
33
+
34
+ The hook should output JSON in the following format to add context:
35
+
36
+ ```json
37
+ {
38
+ "hookSpecificOutput": {
39
+ "hookEventName": "SessionStart",
40
+ "additionalContext": "string"
41
+ }
42
+ }
43
+ ```
44
+
45
+ ### Response Fields
46
+
47
+ - **hookSpecificOutput**: Container for hook-specific output
48
+ - **hookEventName**: Must be "SessionStart"
49
+ - **additionalContext**: String content to add to the session context
50
+
51
+ ## Implementation Notes
52
+
53
+ ### Context Loading Strategy
54
+
55
+ The hook should determine whether to load context based on the `source` field:
56
+
57
+ 1. **For "startup" source**: Load full context from memory
58
+ 2. **For "compact" source**: Skip or load minimal context (session continuing after compaction)
59
+ 3. **For "vscode"/"web" sources**: Load context as appropriate
60
+
61
+ ### Error Handling
62
+
63
+ - If context loading fails, exit silently (exit code 0)
64
+ - Do not break the session start with errors
65
+ - Log errors to separate log file if needed
66
+
67
+ ## Common Mistakes
68
+
69
+ ### Incorrect Field Check (FIXED)
70
+ **Wrong**: Checking `payload.reason === 'continue'`
71
+ **Correct**: Checking `payload.source === 'compact'`
72
+
73
+ The payload does not have a `reason` field. The `source` field indicates the session initiation context.
74
+
75
+ ## Code Location
76
+ - **File**: `/Users/alexnewman/Scripts/claude-mem/hooks/session-start.js`
77
+ - **Line**: 53-66 (field check and documentation)
78
+
79
+ ## Cross-References
80
+ - General Hooks Documentation: [docs/claude-code/hooks.md](./hooks.md)
81
+ - Hook Response Formats: [docs/claude-code/hook-responses.md](./hook-responses.md)
82
+ - MCP Configuration: [docs/claude-code/mcp-configuration.md](./mcp-configuration.md)
@@ -0,0 +1,33 @@
1
+ <session-start-hook>
2
+
3
+ 🧠 What's new: Thursday, September 4, 2025 at 06:13 PM EDT
4
+ ====================================================================
5
+ Established Claude memory management infrastructure with compression tools for session archiving. Optimized session summary generation with compact command overviews for improved retrieval efficiency.
6
+
7
+ 📚 Recent Context
8
+ ====================================================================
9
+ 👀 in claude_mem_source_d096f650-76a3-4163-9b7a-19f36a13c648_{number}:
10
+
11
+ 1. Removed maxTurns:1 limitation that prevented Claude from completing multi-step compression with tool calls
12
+ — maxTurns, Claude SDK, compression fix, MCP tools
13
+
14
+ 3. Deployed steve-krug-ux agent to redesign prompt from pipe-separated to JSON with XMLResponse tags
15
+ — steve-krug-ux, JSON format, prompt redesign
16
+
17
+ 5. Expanded TranscriptCompressor to use all 13 claude-mem MCP tools for intelligent compression
18
+ — allowedTools, MCP tools expansion, TranscriptCompressor
19
+
20
+ 6. Traced index population failure through multiple system layers to identify root cause
21
+ — debugging, ContextTemplates, claude-mem-index, trace
22
+
23
+ ======================================================================
24
+ 👀 in claude_mem_source_d096f650-76a3-4163-9b7a-19f36a13c648_{number}:
25
+
26
+ 1. Implemented Claude memory management and compression tools system
27
+ — memory management, compression, archiving, session context
28
+
29
+ 2. Generated compact command overview for session summaries
30
+ — command overview, session summaries, memory retrieval
31
+
32
+ ======================================================================
33
+ </session-start-hook>