claude_memory 0.9.0 → 0.10.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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/memory.sqlite3 +0 -0
  3. data/.claude/rules/claude_memory.generated.md +63 -1
  4. data/.claude/skills/dashboard/SKILL.md +42 -0
  5. data/.claude/skills/release/SKILL.md +168 -0
  6. data/.claude-plugin/marketplace.json +1 -1
  7. data/.claude-plugin/plugin.json +1 -1
  8. data/CHANGELOG.md +92 -0
  9. data/CLAUDE.md +21 -5
  10. data/README.md +32 -2
  11. data/db/migrations/015_add_activity_events.rb +26 -0
  12. data/db/migrations/016_add_moment_feedback.rb +22 -0
  13. data/db/migrations/017_add_last_recalled_at.rb +15 -0
  14. data/docs/1_0_punchlist.md +190 -0
  15. data/docs/EXAMPLES.md +41 -2
  16. data/docs/GETTING_STARTED.md +31 -4
  17. data/docs/architecture.md +22 -7
  18. data/docs/audit-queries.md +131 -0
  19. data/docs/dashboard.md +172 -0
  20. data/docs/improvements.md +465 -9
  21. data/docs/influence/cq.md +187 -0
  22. data/docs/plugin.md +13 -6
  23. data/docs/quality_review.md +489 -172
  24. data/docs/reflection_memory_as_accumulating_judgment.md +67 -0
  25. data/lib/claude_memory/activity_log.rb +86 -0
  26. data/lib/claude_memory/commands/census_command.rb +210 -0
  27. data/lib/claude_memory/commands/completion_command.rb +3 -0
  28. data/lib/claude_memory/commands/dashboard_command.rb +54 -0
  29. data/lib/claude_memory/commands/dedupe_conflicts_command.rb +55 -0
  30. data/lib/claude_memory/commands/digest_command.rb +181 -0
  31. data/lib/claude_memory/commands/hook_command.rb +34 -0
  32. data/lib/claude_memory/commands/reclassify_references_command.rb +56 -0
  33. data/lib/claude_memory/commands/registry.rb +6 -1
  34. data/lib/claude_memory/commands/skills/distill-transcripts.md +13 -1
  35. data/lib/claude_memory/commands/stats_command.rb +38 -1
  36. data/lib/claude_memory/commands/sweep_command.rb +2 -0
  37. data/lib/claude_memory/configuration.rb +16 -0
  38. data/lib/claude_memory/core/relative_time.rb +9 -0
  39. data/lib/claude_memory/dashboard/api.rb +610 -0
  40. data/lib/claude_memory/dashboard/conflicts.rb +279 -0
  41. data/lib/claude_memory/dashboard/efficacy.rb +127 -0
  42. data/lib/claude_memory/dashboard/fact_presenter.rb +109 -0
  43. data/lib/claude_memory/dashboard/health.rb +175 -0
  44. data/lib/claude_memory/dashboard/index.html +2707 -0
  45. data/lib/claude_memory/dashboard/knowledge.rb +136 -0
  46. data/lib/claude_memory/dashboard/moments.rb +244 -0
  47. data/lib/claude_memory/dashboard/reuse.rb +97 -0
  48. data/lib/claude_memory/dashboard/scoped_fact_resolver.rb +95 -0
  49. data/lib/claude_memory/dashboard/server.rb +211 -0
  50. data/lib/claude_memory/dashboard/timeline.rb +68 -0
  51. data/lib/claude_memory/dashboard/trust.rb +285 -0
  52. data/lib/claude_memory/distill/reference_material_detector.rb +78 -0
  53. data/lib/claude_memory/hook/auto_memory_mirror.rb +112 -0
  54. data/lib/claude_memory/hook/context_injector.rb +97 -3
  55. data/lib/claude_memory/hook/handler.rb +50 -3
  56. data/lib/claude_memory/mcp/handlers/management_handlers.rb +8 -0
  57. data/lib/claude_memory/mcp/query_guide.rb +11 -0
  58. data/lib/claude_memory/mcp/server.rb +8 -2
  59. data/lib/claude_memory/mcp/text_summary.rb +29 -0
  60. data/lib/claude_memory/mcp/tool_definitions.rb +13 -0
  61. data/lib/claude_memory/mcp/tools.rb +148 -0
  62. data/lib/claude_memory/publish.rb +13 -21
  63. data/lib/claude_memory/recall/stale_detector.rb +67 -0
  64. data/lib/claude_memory/resolve/predicate_policy.rb +2 -0
  65. data/lib/claude_memory/resolve/resolver.rb +41 -11
  66. data/lib/claude_memory/store/llm_cache.rb +68 -0
  67. data/lib/claude_memory/store/metrics_aggregator.rb +96 -0
  68. data/lib/claude_memory/store/schema_manager.rb +1 -1
  69. data/lib/claude_memory/store/sqlite_store.rb +47 -143
  70. data/lib/claude_memory/store/store_manager.rb +29 -0
  71. data/lib/claude_memory/sweep/maintenance.rb +216 -0
  72. data/lib/claude_memory/sweep/recall_timestamp_refresher.rb +83 -0
  73. data/lib/claude_memory/sweep/sweeper.rb +2 -0
  74. data/lib/claude_memory/version.rb +1 -1
  75. data/lib/claude_memory.rb +22 -0
  76. metadata +50 -1
data/docs/dashboard.md ADDED
@@ -0,0 +1,172 @@
1
+ # ClaudeMemory Dashboard
2
+
3
+ Local web UI for inspecting what memory knows, what it's been doing, and where
4
+ it's going wrong. Headline feature of v0.10.0.
5
+
6
+ ## Quick start
7
+
8
+ ```bash
9
+ claude-memory dashboard
10
+ ```
11
+
12
+ Opens `http://localhost:3377` in your default browser. Reads from both the
13
+ global (`~/.claude/memory.sqlite3`) and project (`.claude/memory.sqlite3`)
14
+ databases. No write side effects from page loads — the UI is a viewer with
15
+ explicit action buttons (reject / promote / feedback) where applicable.
16
+
17
+ ```bash
18
+ # Custom port
19
+ claude-memory dashboard --port 4000
20
+
21
+ # Don't auto-open the browser (e.g. running in tmux/headless)
22
+ claude-memory dashboard --no-open
23
+ ```
24
+
25
+ Press `Ctrl+C` in the terminal to stop the server.
26
+
27
+ ## What each panel shows
28
+
29
+ The dashboard is **feed-first**: the main view is a chronological stream of
30
+ *moments* (memory activity events), with sidebar panels giving aggregate signals.
31
+
32
+ ### Sidebar — Trust
33
+
34
+ Three at-a-glance signals so you can answer "is memory helping?" in one look:
35
+
36
+ - **This week's moments** — count of value-producing events (recall hits,
37
+ context injections, extractions). Includes a week-over-week delta.
38
+ - **What memory knows about you** — up to 5 global facts rendered as plain
39
+ English. The "fingerprint" of your cross-project preferences.
40
+ - **Needs review** — open conflicts (deduped to distinct contradictions) +
41
+ stale facts (active but not recalled in the configured window) + empty
42
+ recalls (queries that returned nothing).
43
+ - **Utilization (30d)** — of facts extracted in the last 30 days, what % has
44
+ Claude actually surfaced via recall or context injection. Color-coded
45
+ (green ≥40%, yellow ≥15%, red below). Hidden on fresh installs.
46
+ - **Feedback (30d)** — thumbs-up/down ratio from moments you've rated.
47
+
48
+ ### Feed — Moments
49
+
50
+ Real-time stream of memory activity, classified by kind:
51
+
52
+ - `recall_hit` / `recall_empty` — `memory.recall*` calls, with top fact IDs
53
+ resolved to their sentences. Click for full payload.
54
+ - `context_injection` — SessionStart context emitted into Claude's prompt,
55
+ with a preview and the facts it carried. `context_skipped` when injection
56
+ was empty.
57
+ - `extraction` — facts/entities created via `memory.store_extraction`,
58
+ inlined with content preview.
59
+ - `hook_ingest` / `hook_sweep` — pipeline activity.
60
+
61
+ Each moment has a 👍/👎 button. Use them deliberately — the ratio feeds the
62
+ Trust panel and is a calibration signal we read against retrieval quality
63
+ benchmarks.
64
+
65
+ Filter via query params: `kinds=recall_hit`, `before=<ISO timestamp>`.
66
+
67
+ ### Knowledge
68
+
69
+ Active facts grouped by predicate. Sections include:
70
+
71
+ - Decisions, Conventions, Architecture (multi-value)
72
+ - Tech stack (uses_database, uses_framework, uses_language, deployment_platform, auth_method)
73
+ - **References** (added 0.10.0) — facts auto-tagged as reference material
74
+ by `Distill::ReferenceMaterialDetector` (LOC counts, "X is a plugin…"
75
+ templates, author attributions). Separated from conventions to keep the
76
+ signal-to-noise ratio of the conventions section high.
77
+
78
+ ### Conflicts
79
+
80
+ Open contradictions, deduped at the display layer: identical
81
+ `(subject, predicate, object_pair)` detections collapse into one row with a
82
+ `×N` badge. The "Needs review" sidebar count uses the deduped count, not
83
+ raw rows.
84
+
85
+ Each row links to:
86
+ - Both sides of the conflict with provenance
87
+ - A bulk-reject action ("reject all rows that match this exact contradiction")
88
+ - The originating activity event
89
+
90
+ ### Reuse
91
+
92
+ Most-used facts in the time window. Useful for answering "which facts are
93
+ actually doing the work?" when you suspect memory is accumulating dead weight.
94
+
95
+ ### Activity (timeline)
96
+
97
+ Daily rollup of facts created, content ingested, hook events fired, and
98
+ recalls performed over the last 30 days. Click any day to drill into the
99
+ underlying events.
100
+
101
+ ### Health
102
+
103
+ Four checks: global database, project database, hooks installation,
104
+ sqlite-vec coverage. Each surfaces an actionable fix string (e.g.,
105
+ "Run `claude-memory init` to install the standard hook set"). Status
106
+ escalates to the worst individual check (error > warning > healthy).
107
+
108
+ ### Activity drill-down
109
+
110
+ Clicking any moment opens a modal with the parsed payload, prettified JSON,
111
+ and — for recall events — a "what triggered this?" correlation showing the
112
+ preceding ingest and the user prompt that motivated the recall.
113
+
114
+ ### Query tester
115
+
116
+ Run `memory.recall*` queries inline and see scored results, with optional
117
+ score traces (`vec_rank`, `fts_rank`, `rrf_final`) for hybrid retrieval
118
+ debugging. Surfaces an actionable hint if FTS5 corruption is detected
119
+ (suggests `claude-memory compact`).
120
+
121
+ ## When to use it
122
+
123
+ - **After any session that surprised you** — was the recall actually firing?
124
+ Did the fact you taught get extracted? The Moments feed answers both.
125
+ - **Before promoting a fact to global** — see what's already there in the
126
+ Knowledge panel, including dedupe siblings.
127
+ - **When `claude-memory doctor` warns about conflicts** — the Conflicts
128
+ panel groups duplicates so you don't have to handle them one row at a time.
129
+ - **When deciding what to keep** — the Reuse panel shows which facts have
130
+ earned their spot; everything else is staleness candidate per the
131
+ `claude-memory stats --stale` listing.
132
+
133
+ ## What it's not
134
+
135
+ - Not an editor for fact text (use `claude-memory promote` / `reject`).
136
+ - Not a replacement for the CLI — for headless / scripted use, prefer
137
+ `claude-memory stats`, `claude-memory digest`, `claude-memory census`.
138
+ - Not a multi-user surface — bound to localhost, single-process WEBrick.
139
+ - Not a long-running service — runs in the foreground; close when done.
140
+
141
+ ## Architecture
142
+
143
+ The dashboard is a thin web layer over the same `Recall`, `Conflicts`,
144
+ `Trust`, `Moments`, etc. classes the MCP server uses. Each panel is backed by
145
+ a dedicated module under `lib/claude_memory/dashboard/`:
146
+
147
+ | Panel / endpoint | Module | Responsibility |
148
+ |---|---|---|
149
+ | Trust sidebar | `Dashboard::Trust` | Weekly moments, fingerprint, utilization, feedback |
150
+ | Feed | `Dashboard::Moments` | Activity-event classification + presenter |
151
+ | Knowledge | `Dashboard::Knowledge` | Predicate-grouped fact summary |
152
+ | Conflicts | `Dashboard::Conflicts` | Dedup grouping, bulk-reject helper |
153
+ | Reuse | `Dashboard::Reuse` | Most-used-fact ranking |
154
+ | Health | `Dashboard::Health` | Four system checks with fix strings |
155
+ | Timeline | `Dashboard::Timeline` | 30-day daily rollup |
156
+ | Routing | `Dashboard::API` | HTTP-shape glue + per-endpoint formatting |
157
+
158
+ Connections are released after each request so the dashboard never holds a
159
+ WAL writer lock open across page loads.
160
+
161
+ ## Related CLI
162
+
163
+ - `claude-memory digest [--since DAYS] [--output FILE]` — markdown report of
164
+ the same Trust + Knowledge + Conflicts + Feedback signals, suitable for
165
+ email or commit-into-repo.
166
+ - `claude-memory census [--root DIR]` — privacy-safe cross-project
167
+ predicate vocabulary scan; pairs with the Knowledge panel for "what
168
+ predicates does my whole tree use?".
169
+ - `claude-memory stats --stale [--stale-days N]` — list facts the dashboard
170
+ flags as stale.
171
+ - `claude-memory dedupe-conflicts` / `reclassify-references` — one-shot
172
+ cleanups for what the Conflicts and Knowledge → References panels surface.