claude_memory 0.1.0 β†’ 0.2.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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/.mind.mv2.aLCUZd +0 -0
  3. data/.claude/memory.sqlite3 +0 -0
  4. data/.claude/rules/claude_memory.generated.md +7 -1
  5. data/.claude/settings.json +0 -4
  6. data/.claude/settings.local.json +4 -1
  7. data/.claude-plugin/plugin.json +1 -1
  8. data/.claude.json +11 -0
  9. data/.ruby-version +1 -0
  10. data/CHANGELOG.md +62 -11
  11. data/CLAUDE.md +87 -24
  12. data/README.md +76 -159
  13. data/docs/EXAMPLES.md +436 -0
  14. data/docs/RELEASE_NOTES_v0.2.0.md +179 -0
  15. data/docs/RUBY_COMMUNITY_POST_v0.2.0.md +582 -0
  16. data/docs/SOCIAL_MEDIA_v0.2.0.md +420 -0
  17. data/docs/architecture.md +360 -0
  18. data/docs/expert_review.md +1718 -0
  19. data/docs/feature_adoption_plan.md +1241 -0
  20. data/docs/feature_adoption_plan_revised.md +2374 -0
  21. data/docs/improvements.md +1325 -0
  22. data/docs/quality_review.md +1544 -0
  23. data/docs/review_summary.md +480 -0
  24. data/lefthook.yml +10 -0
  25. data/lib/claude_memory/cli.rb +16 -844
  26. data/lib/claude_memory/commands/base_command.rb +95 -0
  27. data/lib/claude_memory/commands/changes_command.rb +39 -0
  28. data/lib/claude_memory/commands/conflicts_command.rb +37 -0
  29. data/lib/claude_memory/commands/db_init_command.rb +40 -0
  30. data/lib/claude_memory/commands/doctor_command.rb +147 -0
  31. data/lib/claude_memory/commands/explain_command.rb +65 -0
  32. data/lib/claude_memory/commands/help_command.rb +37 -0
  33. data/lib/claude_memory/commands/hook_command.rb +106 -0
  34. data/lib/claude_memory/commands/ingest_command.rb +47 -0
  35. data/lib/claude_memory/commands/init_command.rb +218 -0
  36. data/lib/claude_memory/commands/promote_command.rb +30 -0
  37. data/lib/claude_memory/commands/publish_command.rb +36 -0
  38. data/lib/claude_memory/commands/recall_command.rb +61 -0
  39. data/lib/claude_memory/commands/registry.rb +55 -0
  40. data/lib/claude_memory/commands/search_command.rb +43 -0
  41. data/lib/claude_memory/commands/serve_mcp_command.rb +16 -0
  42. data/lib/claude_memory/commands/sweep_command.rb +36 -0
  43. data/lib/claude_memory/commands/version_command.rb +13 -0
  44. data/lib/claude_memory/configuration.rb +38 -0
  45. data/lib/claude_memory/core/fact_id.rb +41 -0
  46. data/lib/claude_memory/core/null_explanation.rb +47 -0
  47. data/lib/claude_memory/core/null_fact.rb +30 -0
  48. data/lib/claude_memory/core/result.rb +143 -0
  49. data/lib/claude_memory/core/session_id.rb +37 -0
  50. data/lib/claude_memory/core/token_estimator.rb +33 -0
  51. data/lib/claude_memory/core/transcript_path.rb +37 -0
  52. data/lib/claude_memory/domain/conflict.rb +51 -0
  53. data/lib/claude_memory/domain/entity.rb +51 -0
  54. data/lib/claude_memory/domain/fact.rb +70 -0
  55. data/lib/claude_memory/domain/provenance.rb +48 -0
  56. data/lib/claude_memory/hook/exit_codes.rb +18 -0
  57. data/lib/claude_memory/hook/handler.rb +7 -2
  58. data/lib/claude_memory/index/index_query.rb +89 -0
  59. data/lib/claude_memory/index/index_query_logic.rb +41 -0
  60. data/lib/claude_memory/index/query_options.rb +67 -0
  61. data/lib/claude_memory/infrastructure/file_system.rb +29 -0
  62. data/lib/claude_memory/infrastructure/in_memory_file_system.rb +32 -0
  63. data/lib/claude_memory/ingest/content_sanitizer.rb +42 -0
  64. data/lib/claude_memory/ingest/ingester.rb +3 -0
  65. data/lib/claude_memory/ingest/privacy_tag.rb +48 -0
  66. data/lib/claude_memory/mcp/tools.rb +174 -1
  67. data/lib/claude_memory/publish.rb +29 -20
  68. data/lib/claude_memory/recall.rb +164 -16
  69. data/lib/claude_memory/resolve/resolver.rb +41 -37
  70. data/lib/claude_memory/shortcuts.rb +56 -0
  71. data/lib/claude_memory/store/store_manager.rb +35 -32
  72. data/lib/claude_memory/templates/hooks.example.json +0 -4
  73. data/lib/claude_memory/version.rb +1 -1
  74. data/lib/claude_memory.rb +59 -21
  75. metadata +55 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 015ffacff45c0d7976124cbf40c2188d03f3fd182f24de2eab83bd5c0273107e
4
- data.tar.gz: 68879337aca9ec2b5e9574df1982aead620975b84448cf0ca385d00690619d5b
3
+ metadata.gz: cba9abfc06579e1d4e979fe20c81b6c751351b2001c9efc0f7144973454d9b2d
4
+ data.tar.gz: 95e420c5c7e6705564332c68d3728ee9cf43984e89207bdce46121223dac1ddc
5
5
  SHA512:
6
- metadata.gz: 3c3ba3ea0f53e035b7ea377bc2c81fc398d7476bfb1019594db274e6aba67e2d92d09420e5f8c08ce1695a0f0128b1cb03d6931df92c172f57f3dc903233c41a
7
- data.tar.gz: f4f1c185a02b2c5a469dac940e4b06a2cd37a67d0efc4ae8199d4688a2a3511eaf856ea393ecfb9f8972febe6d05cf490c384071a9e349e307d8adf20753219f
6
+ metadata.gz: c6b7ee6d2ff3ab5cea00e99995781d295527859cc328b1572220075cff829ff089090d871cb40d65a5d4e8d9b518a66637bc32d3c3d6ab98b14a8968338cce1a
7
+ data.tar.gz: 17884491cf569f5627fa3f4b4328eb214625236d75585517bd4dd3a30b393c0e6f2b33198087207916e8a9c65c00bc6360db3b2f042f7aaff057b605dda50df8
Binary file
Binary file
@@ -1,13 +1,19 @@
1
1
  <!--
2
2
  This file is auto-generated by claude-memory.
3
3
  Do not edit manually - changes will be overwritten.
4
- Generated: 2026-01-20T22:15:57Z
4
+ Generated: 2026-01-22T18:04:05Z
5
5
  -->
6
6
 
7
7
  # Project Memory
8
8
 
9
9
  ## Conventions
10
10
 
11
+ - frozen_string_literal: true in all Ruby files
12
+ - RSpec format documentation
13
+ - Default Rake task runs spec and standard
14
+ - Pre-commit hook runs standard:fix and stages changes
15
+ - Pre-commit hook runs tests
16
+ - Ruby version 3.2 minimum
11
17
  - run linting with 'bundle exec rake standard'
12
18
  - Ruby 3.2+ required
13
19
  - frozen_string_literal: true in all Ruby files
@@ -2,7 +2,6 @@
2
2
  "hooks": {
3
3
  "Stop": [
4
4
  {
5
- "matcher": "",
6
5
  "hooks": [
7
6
  {
8
7
  "type": "command",
@@ -14,7 +13,6 @@
14
13
  ],
15
14
  "SessionStart": [
16
15
  {
17
- "matcher": "",
18
16
  "hooks": [
19
17
  {
20
18
  "type": "command",
@@ -26,7 +24,6 @@
26
24
  ],
27
25
  "PreCompact": [
28
26
  {
29
- "matcher": "",
30
27
  "hooks": [
31
28
  {
32
29
  "type": "command",
@@ -43,7 +40,6 @@
43
40
  ],
44
41
  "SessionEnd": [
45
42
  {
46
- "matcher": "",
47
43
  "hooks": [
48
44
  {
49
45
  "type": "command",
@@ -14,7 +14,10 @@
14
14
  "mcp__memory__memory_changes",
15
15
  "mcp__memory__memory_status",
16
16
  "mcp__memory__memory_store_extraction",
17
- "mcp__memory__memory_explain"
17
+ "mcp__memory__memory_explain",
18
+ "Bash(bundle exec rspec:*)",
19
+ "Bash(bundle exec rake:*)",
20
+ "mcp__plugin_claude-memory_memory__memory_store_extraction"
18
21
  ]
19
22
  },
20
23
  "enableAllProjectMcpServers": true
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-memory",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Long-term self-managed memory for Claude Code with fact extraction, truth maintenance, and provenance tracking",
5
5
  "author": {
6
6
  "name": "Valentino Stoll"
data/.claude.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "claude-memory": {
4
+ "type": "stdio",
5
+ "command": "claude-memory",
6
+ "args": [
7
+ "serve-mcp"
8
+ ]
9
+ }
10
+ }
11
+ }
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 4.0.1
data/CHANGELOG.md CHANGED
@@ -4,19 +4,70 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.0] - 2026-01-22
8
+
7
9
  ### Added
8
10
 
9
- - **Claude Code Plugin**: Full plugin structure for seamless Claude Code integration
10
- - `.claude-plugin/plugin.json` manifest
11
- - `.claude-plugin/marketplace.json` for plugin distribution
12
- - `hooks/hooks.json` with prompt hooks for Claude-powered extraction
13
- - `skills/memory/SKILL.md` for `/memory` command
14
- - **Claude-Powered Fact Extraction**: New `memory.store_extraction` MCP tool
15
- - Accepts structured JSON with entities, facts, and decisions
16
- - Prompt hooks ask Claude to extract facts on session stop
17
- - No API key required - uses Claude Code's own session
18
- - Full schema validation with truth maintenance
19
- - **Empty Query Handling**: FTS5 search now gracefully handles empty queries
11
+ **Privacy & Security**
12
+ - Privacy tag system: `<private>`, `<no-memory>`, `<secret>` tags strip sensitive content from ingestion
13
+ - ContentSanitizer module with comprehensive sanitization logic
14
+ - ReDoS protection: Maximum 100 tags per ingestion to prevent regex attacks
15
+ - 100% test coverage for ContentSanitizer (security-critical module)
16
+
17
+ **Token Economics & Performance**
18
+ - Progressive disclosure pattern with two-phase queries:
19
+ - `memory.recall_index` - Lightweight index with previews (~50 tokens per fact)
20
+ - `memory.recall_details` - Full details on demand with provenance
21
+ - TokenEstimator module for accurate query result sizing
22
+ - 10x token reduction for initial memory searches
23
+ - N+1 query elimination in Recall class (reduced from 2N+1 to 3 queries via batch loading)
24
+ - IndexQuery object for cleaner full-text search logic
25
+ - QueryOptions parameter object for consistent option handling
26
+
27
+ **Semantic Shortcuts**
28
+ - `memory.decisions` - Quick access to architectural decisions and accepted proposals
29
+ - `memory.conventions` - Global coding conventions and style preferences
30
+ - `memory.architecture` - Framework choices and architectural patterns
31
+ - Shortcuts query builder with centralized predicate configuration
32
+ - Pre-configured queries eliminate manual search construction
33
+
34
+ **Claude Code Plugin**
35
+ - Full plugin structure for seamless Claude Code integration
36
+ - `.claude-plugin/plugin.json` manifest with marketplace metadata
37
+ - `hooks/hooks.json` with prompt hooks for Claude-powered extraction
38
+ - `skills/memory/SKILL.md` for `/memory` command
39
+
40
+ **Claude-Powered Fact Extraction**
41
+ - `memory.store_extraction` MCP tool for structured fact storage
42
+ - Accepts JSON with entities, facts, and decisions
43
+ - Prompt hooks trigger extraction on session stop
44
+ - No API key required - uses Claude Code's own session
45
+ - Full schema validation with truth maintenance
46
+
47
+ **Developer Experience**
48
+ - Exit code strategy for hooks with semantic constants:
49
+ - `SUCCESS = 0` - Operation completed successfully
50
+ - `WARNING = 1` - Completed with warnings (e.g., skipped ingestion)
51
+ - `ERROR = 2` - Operation failed
52
+ - Comprehensive hook tests covering all event types (13 test cases)
53
+ - PrivacyTag value object for type-safe tag handling
54
+ - Empty query handling for FTS5 search
55
+
56
+ **Testing & Quality**
57
+ - 157 new test examples (grew from 426 to 583 total)
58
+ - 100% coverage for TokenEstimator (accuracy-critical)
59
+ - Comprehensive privacy tag tests including ReDoS protection
60
+ - Hook exit code verification tests
61
+
62
+ ### Changed
63
+ - CLI hook commands now return standardized exit codes instead of mixed returns
64
+ - Recall queries optimized with batch loading for provenance and entities
65
+ - Index searches use QueryOptions for consistent parameter handling
66
+
67
+ ### Documentation
68
+ - README restructured for clarity and quick onboarding
69
+ - New comprehensive examples documentation
70
+ - Simplified getting started experience
20
71
 
21
72
  ## [0.1.0] - 2026-01-20
22
73
 
data/CLAUDE.md CHANGED
@@ -75,43 +75,84 @@ Transcripts β†’ Ingest β†’ Index (FTS5)
75
75
 
76
76
  ### Module Structure
77
77
 
78
- - **`Store`**: SQLite database access via Sequel (`sqlite_store.rb`, `store_manager.rb`)
78
+ #### Application Layer
79
+
80
+ - **`CLI`**: Thin command router (`cli.rb`) - 41 lines
81
+ - Routes commands to dedicated command classes via Registry
82
+ - No business logic (pure dispatcher)
83
+
84
+ - **`Commands`**: Individual command classes (`commands/`)
85
+ - Each command is a separate class (HelpCommand, DoctorCommand, etc.)
86
+ - All commands inherit from BaseCommand
87
+ - Dependency injection for I/O (stdout, stderr, stdin)
88
+ - 16 commands total, each focused on single responsibility
89
+
90
+ - **`Configuration`**: Centralized ENV access (`configuration.rb`)
91
+ - Single source of truth for paths and environment variables
92
+ - Testable with custom ENV hash
93
+
94
+ #### Core Domain Layer
95
+
96
+ - **`Domain`**: Rich domain models with business logic (`domain/`)
97
+ - `Fact`: Facts with validation, status checking (active?, superseded?)
98
+ - `Entity`: Entities with type checking (database?, framework?)
99
+ - `Provenance`: Evidence with strength checking (stated?, inferred?)
100
+ - `Conflict`: Conflicts with status tracking (open?, resolved?)
101
+ - All domain objects are immutable (frozen) and self-validating
102
+
103
+ - **`Core`**: Value objects and null objects (`core/`)
104
+ - Value objects: SessionId, TranscriptPath, FactId (type-safe primitives)
105
+ - Null objects: NullFact, NullExplanation (eliminates nil checks)
106
+ - Result: Success/Failure pattern for consistent error handling
107
+
108
+ #### Infrastructure Layer
109
+
110
+ - **`Store`**: SQLite database access via Sequel (`store/`)
111
+ - `SQLiteStore`: Database operations
112
+ - `StoreManager`: Dual-database connection manager
79
113
  - Schema includes: content_items, entities, facts, provenance, fact_links, conflicts
80
- - Schema migrations in `ensure_schema!` and `migrate_to_v2!`
114
+ - Transaction safety for multi-step operations
115
+
116
+ - **`Infrastructure`**: I/O abstractions (`infrastructure/`)
117
+ - `FileSystem`: Real filesystem wrapper
118
+ - `InMemoryFileSystem`: Fast in-memory testing without disk I/O
81
119
 
82
- - **`Ingest`**: Transcript reading and delta-based ingestion (`ingester.rb`, `transcript_reader.rb`)
120
+ #### Business Logic Layer
121
+
122
+ - **`Ingest`**: Transcript reading and delta-based ingestion (`ingest/`)
83
123
  - Tracks cursor position per session to avoid re-processing
84
124
 
85
- - **`Index`**: Full-text search using SQLite FTS5 (`lexical_fts.rb`)
86
- - No embeddings required for MVP
125
+ - **`Index`**: Full-text search using SQLite FTS5 (`index/`)
126
+ - Optimized with batch queries to eliminate N+1 issues
87
127
 
88
- - **`Distill`**: Fact extraction interface (`distiller.rb`, `null_distiller.rb`)
128
+ - **`Distill`**: Fact extraction interface (`distill/`)
89
129
  - Pluggable distiller design (current: NullDistiller stub)
90
130
  - Extracts entities, facts, scope hints from content
91
131
 
92
- - **`Resolve`**: Truth maintenance and conflict resolution (`resolver.rb`, `predicate_policy.rb`)
132
+ - **`Resolve`**: Truth maintenance and conflict resolution (`resolve/`)
93
133
  - Determines equivalence, supersession, or conflicts
94
134
  - PredicatePolicy controls single-value vs multi-value predicates
135
+ - Transaction safety for atomic operations
95
136
 
96
137
  - **`Recall`**: Query interface for facts (`recall.rb`)
97
138
  - Searches both global + project databases
139
+ - Batch queries to avoid N+1 performance issues
98
140
  - Returns facts with provenance receipts
99
141
 
100
- - **`Sweep`**: Maintenance and pruning (`sweeper.rb`)
142
+ - **`Sweep`**: Maintenance and pruning (`sweep/`)
101
143
 
102
- - **`Publish`**: Snapshot generation to Claude Code memory files (`publish.rb`)
144
+ - **`Publish`**: Snapshot generation (`publish.rb`)
145
+ - Uses FileSystem abstraction for testability
103
146
  - Modes: shared (repo), local (uncommitted), home (user directory)
104
147
 
105
- - **`MCP`**: Model Context Protocol server and tools (`mcp/server.rb`, `mcp/tools.rb`)
106
- - Exposes memory tools to Claude Code: recall, explain, promote, status, conflicts, changes, sweep_now
148
+ - **`MCP`**: Model Context Protocol server and tools (`mcp/`)
149
+ - Exposes memory tools to Claude Code
150
+ - Tools: recall, explain, promote, status, conflicts, changes, sweep_now
107
151
 
108
- - **`Hook`**: Hook entrypoint handlers (`hook/handler.rb`)
152
+ - **`Hook`**: Hook entrypoint handlers (`hook/`)
109
153
  - Reads stdin JSON from Claude Code hooks
110
154
  - Routes to ingest/sweep/publish commands
111
155
 
112
- - **`CLI`**: Command-line interface (`cli.rb`)
113
- - All user-facing commands and option parsing
114
-
115
156
  ### Database Schema
116
157
 
117
158
  Key tables (defined in `sqlite_store.rb`):
@@ -149,11 +190,28 @@ When writing tests:
149
190
 
150
191
  ### Adding a New CLI Command
151
192
 
152
- 1. Add command name to `CLI#run` case statement
153
- 2. Implement private method (e.g., `my_command_cmd`)
154
- 3. Add parser method (e.g., `parse_my_command_options`)
155
- 4. Update `print_help` output
156
- 5. Add corresponding tests in `spec/claude_memory/cli_spec.rb`
193
+ 1. Create new command class in `lib/claude_memory/commands/` (e.g., `my_command.rb`)
194
+ 2. Inherit from `BaseCommand` and implement `call(args)` method
195
+ 3. Add command to `Commands::Registry::COMMANDS` hash
196
+ 4. Add corresponding tests in `spec/claude_memory/commands/my_command_spec.rb`
197
+ 5. Use dependency injection for I/O (stdout, stderr, stdin) for testability
198
+
199
+ Example:
200
+ ```ruby
201
+ class MyCommand < BaseCommand
202
+ def call(args)
203
+ opts = parse_options(args, {flag: false}) do |o|
204
+ OptionParser.new do |parser|
205
+ parser.on("--flag", "Enable flag") { o[:flag] = true }
206
+ end
207
+ end
208
+ return 1 if opts.nil?
209
+
210
+ stdout.puts "Command executed!"
211
+ 0 # Exit code
212
+ end
213
+ end
214
+ ```
157
215
 
158
216
  ### Adding a New MCP Tool
159
217
 
@@ -177,11 +235,16 @@ Single-value predicates (like "uses_database") supersede old values. Multi-value
177
235
  ## Important Files
178
236
 
179
237
  - `lib/claude_memory.rb`: Main module, requires, database path helpers
180
- - `lib/claude_memory/cli.rb`: All CLI command implementations (800+ lines)
238
+ - `lib/claude_memory/cli.rb`: Thin command router (41 lines)
239
+ - `lib/claude_memory/commands/`: Individual command classes (16 commands)
240
+ - `lib/claude_memory/configuration.rb`: Centralized configuration and ENV access
241
+ - `lib/claude_memory/domain/`: Domain models (Fact, Entity, Provenance, Conflict)
242
+ - `lib/claude_memory/core/`: Value objects and null objects
243
+ - `lib/claude_memory/infrastructure/`: I/O abstractions (FileSystem)
181
244
  - `lib/claude_memory/store/store_manager.rb`: Dual-database connection manager
182
- - `lib/claude_memory/resolve/resolver.rb`: Truth maintenance logic
183
- - `lib/claude_memory/recall.rb`: Fact query and merging logic
184
- - `docs/updated_plan.md`: Comprehensive architectural plan and milestones
245
+ - `lib/claude_memory/resolve/resolver.rb`: Truth maintenance with transaction safety
246
+ - `lib/claude_memory/recall.rb`: Optimized fact query with batch loading
247
+ - `docs/quality_review.md`: Quality improvements and refactoring notes
185
248
  - `claude_memory.gemspec`: Gem metadata and dependencies
186
249
 
187
250
  ## MCP Integration
data/README.md CHANGED
@@ -1,200 +1,109 @@
1
1
  # ClaudeMemory
2
2
 
3
- Turn-key Ruby gem providing Claude Code with instant, high-quality, long-term, self-managed memory using **Claude Code Hooks + MCP + Output Style**, with minimal dependencies (SQLite by default).
3
+ **Long-term memory for Claude Code** - automatic, intelligent, zero-configuration
4
4
 
5
- ## Features
5
+ [![Gem Version](https://badge.fury.io/rb/claude_memory.svg)](https://badge.fury.io/rb/claude_memory)
6
6
 
7
- - **Automated ingestion**: Claude Code hooks trigger delta-based transcript ingestion
8
- - **Claude-powered fact extraction**: Uses Claude's own intelligence to extract facts (no API key needed)
9
- - **Truth maintenance**: Deterministic conflict/supersession resolution
10
- - **Full-text search**: SQLite FTS5 for fast recall without embeddings
11
- - **MCP integration**: Memory tools accessible directly in Claude Code
12
- - **Snapshot publishing**: Curated memory files for Claude Code's built-in system
13
- - **Claude Code Plugin**: Install as a plugin for seamless integration
7
+ ## What It Does
14
8
 
15
- ## Installation
9
+ ClaudeMemory gives Claude Code a persistent memory across all your conversations.
10
+ It automatically:
11
+ - βœ… Extracts durable facts from conversations (tech stack, preferences, decisions)
12
+ - βœ… Remembers project-specific and global knowledge
13
+ - βœ… Provides instant recall without manual prompting
14
+ - βœ… Maintains truth (handles conflicts, supersession)
16
15
 
17
- ```bash
18
- gem install claude_memory
19
- ```
16
+ **No API keys. No configuration. Just works.**
20
17
 
21
- Or add to your Gemfile:
18
+ ## Quick Start
22
19
 
23
- ```ruby
24
- gem 'claude_memory'
20
+ ### Install
21
+ ```bash
22
+ gem install claude_memory
25
23
  ```
26
24
 
27
- ## Quick Start
28
-
25
+ ### Initialize
29
26
  ```bash
30
- # Initialize in your project (project-local)
31
- cd your-project
27
+ # In your project
28
+ cd my-project
32
29
  claude-memory init
33
30
 
34
- # Or install globally for all projects
31
+ # Or globally for all projects
35
32
  claude-memory init --global
36
33
 
37
34
  # Verify setup
38
35
  claude-memory doctor
39
36
  ```
40
37
 
41
- ## Commands
42
-
43
- | Command | Description |
44
- |---------|-------------|
45
- | `init` | Initialize ClaudeMemory in a project |
46
- | `db:init` | Initialize the SQLite database |
47
- | `ingest` | Ingest transcript delta |
48
- | `hook ingest` | Hook entrypoint for ingest (reads stdin JSON) |
49
- | `hook sweep` | Hook entrypoint for sweep (reads stdin JSON) |
50
- | `hook publish` | Hook entrypoint for publish (reads stdin JSON) |
51
- | `search` | Search indexed content |
52
- | `recall` | Recall facts matching a query |
53
- | `explain` | Explain a fact with provenance receipts |
54
- | `conflicts` | Show open conflicts |
55
- | `changes` | Show recent fact changes |
56
- | `publish` | Publish snapshot to Claude Code memory |
57
- | `sweep` | Run maintenance/pruning |
58
- | `serve-mcp` | Start MCP server for Claude Code |
59
- | `doctor` | Check system health |
60
-
61
- ## Usage Examples
62
-
63
- ### Ingest Content
38
+ ### Use with Claude Code
39
+ Just talk naturally! Memory happens automatically.
64
40
 
65
- ```bash
66
- claude-memory ingest \
67
- --source claude_code \
68
- --session-id sess-123 \
69
- --transcript-path ~/.claude/projects/myproject/transcripts/latest.jsonl
70
41
  ```
42
+ You: "I'm building a Rails app with PostgreSQL, deploying to Heroku"
43
+ Claude: [helps with setup]
71
44
 
72
- ### Recall Facts
73
-
74
- ```bash
75
- claude-memory recall "database"
76
- # Returns facts + provenance receipts
77
-
78
- claude-memory recall "database" --scope project
79
- # Only facts scoped to current project
80
-
81
- claude-memory recall "preferences" --scope global
82
- # Only global facts (apply to all projects)
83
-
84
- claude-memory explain 42
85
- # Detailed explanation with supersession/conflict links
45
+ # Behind the scenes:
46
+ # - Session transcript ingested
47
+ # - Facts extracted automatically
48
+ # - No user action needed
86
49
  ```
87
50
 
88
- ### Publish Snapshot
89
-
90
- ```bash
91
- # Publish to .claude/rules/ (shared, default)
92
- claude-memory publish
93
-
94
- # Publish to local file (not committed)
95
- claude-memory publish --mode local
96
-
97
- # Publish to user home directory
98
- claude-memory publish --mode home
51
+ **Later:**
99
52
  ```
100
-
101
- ### MCP Tools
102
-
103
- When configured, these tools are available in Claude Code:
104
-
105
- - `memory.recall` - Search for relevant facts (supports scope filtering)
106
- - `memory.explain` - Get detailed fact provenance
107
- - `memory.promote` - Promote a project fact to global memory
108
- - `memory.store_extraction` - Store extracted facts from a conversation
109
- - `memory.changes` - Recent fact updates
110
- - `memory.conflicts` - Open contradictions
111
- - `memory.sweep_now` - Run maintenance
112
- - `memory.status` - System health check
113
-
114
- ## Scope: Global vs Project
115
-
116
- Facts are scoped to control where they apply:
117
-
118
- | Scope | Description | Example |
119
- |-------|-------------|---------|
120
- | `project` | Applies only to the current project | "This app uses PostgreSQL" |
121
- | `global` | Applies across all projects | "I prefer 4-space indentation" |
122
-
123
- **Automatic detection**: The distiller recognizes signals like "always", "in all projects", or "my preference" and sets `scope_hint: "global"`.
124
-
125
- **Manual promotion**: Use `memory.set_scope` in Claude Code or the user can say "make that preference global" and Claude will call the tool.
126
-
127
- ## Claude Code Plugin
128
-
129
- ClaudeMemory is available as a Claude Code plugin for seamless integration.
130
-
131
- ### Install as Plugin
132
-
133
- ```bash
134
- # Add the marketplace
135
- /plugin marketplace add /path/to/claude_memory
136
-
137
- # Install the plugin
138
- /plugin install claude-memory
53
+ You: "Help me add a background job"
54
+ Claude: "Based on my memory, you're using Rails with PostgreSQL..."
139
55
  ```
140
56
 
141
- ### Plugin Components
57
+ πŸ‘‰ **[See Getting Started Guide β†’](docs/GETTING_STARTED.md)**
58
+ πŸ‘‰ **[View Example Conversations β†’](docs/EXAMPLES.md)**
142
59
 
143
- | Component | Description |
144
- |-----------|-------------|
145
- | **MCP Server** | Exposes memory tools to Claude |
146
- | **Hooks** | Automatic ingestion, extraction, and publishing |
147
- | **Skill** | `/memory` command for manual interaction |
60
+ ## How It Works
148
61
 
149
- ### How Claude-Powered Extraction Works
62
+ 1. **You chat with Claude** - Tell it about your project
63
+ 2. **Facts are extracted** - Claude identifies durable knowledge
64
+ 3. **Memory persists** - Stored locally in SQLite
65
+ 4. **Automatic recall** - Claude remembers in future conversations
150
66
 
151
- ClaudeMemory uses **prompt hooks** to leverage Claude's own intelligence for fact extractionβ€”no separate API key required:
67
+ πŸ‘‰ **[Architecture Deep Dive β†’](docs/architecture.md)**
152
68
 
153
- 1. **On session stop**: A prompt hook asks Claude to review what it learned
154
- 2. **Claude extracts facts**: Using its understanding of the conversation, Claude identifies durable facts
155
- 3. **Stores via MCP**: Claude calls `memory.store_extraction` to persist the facts
156
- 4. **Truth maintenance**: The resolver handles conflicts and supersession automatically
69
+ ## Key Features
157
70
 
158
- This approach means:
159
- - βœ… No API key configuration needed
160
- - βœ… Uses Claude's full contextual understanding
161
- - βœ… Extracts only genuinely useful, durable facts
162
- - βœ… Respects scope (project vs global)
71
+ - **Dual Scope**: Project-specific + global user preferences
72
+ - **Privacy First**: `<private>` tags exclude sensitive data
73
+ - **Progressive Disclosure**: Lightweight queries before full details
74
+ - **Semantic Shortcuts**: Quick access to decisions, conventions, architecture
75
+ - **Truth Maintenance**: Automatic conflict resolution
76
+ - **Claude-Powered**: Uses Claude's intelligence to extract facts (no API key needed)
77
+ - **Token Efficient**: 10x reduction in memory queries with progressive disclosure
163
78
 
164
- ### Fact Types Extracted
79
+ ## Privacy Control
165
80
 
166
- | Predicate | Description | Example |
167
- |-----------|-------------|---------|
168
- | `uses_database` | Database technology | "PostgreSQL" |
169
- | `uses_framework` | Framework choice | "Rails", "React" |
170
- | `deployment_platform` | Where deployed | "Vercel", "AWS" |
171
- | `convention` | Coding standards | "4-space indentation" |
172
- | `decision` | Architectural choice | "Use microservices" |
173
- | `auth_method` | Authentication approach | "JWT tokens" |
174
-
175
- ## Architecture
81
+ Exclude sensitive data from memory using privacy tags:
176
82
 
177
83
  ```
178
- Transcripts β†’ Ingest β†’ FTS Index
179
- ↓
180
- Claude Prompt Hook β†’ Extract entities/facts/signals
181
- ↓
182
- memory.store_extraction (MCP)
183
- ↓
184
- Resolve β†’ Truth maintenance (conflicts/supersession)
185
- ↓
186
- Store β†’ SQLite (facts, provenance, entities, scope)
187
- ↓
188
- Publish β†’ .claude/rules/claude_memory.generated.md
84
+ You: "My API key is <private>sk-abc123</private>"
85
+ Claude: [uses it during session]
86
+
87
+ # Stored: "API endpoint configured with key"
88
+ # NOT stored: "sk-abc123"
189
89
  ```
190
90
 
191
- ## Configuration
91
+ Supported tags: `<private>`, `<no-memory>`, `<secret>`
192
92
 
193
- The database location defaults to `.claude_memory.sqlite3` in the project root.
93
+ ## Documentation
194
94
 
195
- Override with `--db PATH` on any command.
95
+ - πŸ“– [Getting Started](docs/GETTING_STARTED.md) - Step-by-step onboarding *(coming soon)*
96
+ - πŸ’‘ [Examples](docs/EXAMPLES.md) - Use cases and workflows
97
+ - πŸ”§ [Plugin Setup](docs/PLUGIN.md) - Claude Code integration
98
+ - πŸ—οΈ [Architecture](docs/architecture.md) - Technical deep dive
99
+ - πŸ“ [Changelog](CHANGELOG.md) - Release notes
196
100
 
197
- ## Development
101
+ ## For Developers
102
+
103
+ - **Language:** Ruby 3.2+
104
+ - **Storage:** SQLite3 (no external services)
105
+ - **Testing:** 583 examples, 100% core coverage
106
+ - **Code Style:** Standard Ruby
198
107
 
199
108
  ```bash
200
109
  git clone https://github.com/codenamev/claude_memory
@@ -203,10 +112,18 @@ bin/setup
203
112
  bundle exec rspec
204
113
  ```
205
114
 
115
+ πŸ‘‰ **[Development Guide β†’](CLAUDE.md)**
116
+
117
+ ## Support
118
+
119
+ - πŸ› [Report a bug](https://github.com/codenamev/claude_memory/issues)
120
+ - πŸ’¬ [Discussions](https://github.com/codenamev/claude_memory/discussions)
121
+ - πŸ“§ Email: valentino@hanamirb.org
122
+
206
123
  ## License
207
124
 
208
- MIT License - see [LICENSE.txt](LICENSE.txt)
125
+ MIT - see [LICENSE.txt](LICENSE.txt)
209
126
 
210
- ## Contributing
127
+ ---
211
128
 
212
- Bug reports and pull requests welcome at https://github.com/codenamev/claude_memory
129
+ **Made with ❀️ by [Valentino Stoll](https://github.com/codenamev)**