claude-memory-explorer 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 (80) hide show
  1. package/.claude-plugin/plugin.json +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +177 -0
  4. package/dist/cli/commands/dedupe.d.ts +1 -0
  5. package/dist/cli/commands/dedupe.js +187 -0
  6. package/dist/cli/commands/dedupe.js.map +1 -0
  7. package/dist/cli/commands/doctor.d.ts +1 -0
  8. package/dist/cli/commands/doctor.js +177 -0
  9. package/dist/cli/commands/doctor.js.map +1 -0
  10. package/dist/cli/commands/lint.d.ts +1 -0
  11. package/dist/cli/commands/lint.js +139 -0
  12. package/dist/cli/commands/lint.js.map +1 -0
  13. package/dist/cli/commands/list.d.ts +1 -0
  14. package/dist/cli/commands/list.js +97 -0
  15. package/dist/cli/commands/list.js.map +1 -0
  16. package/dist/cli/commands/mcp.d.ts +1 -0
  17. package/dist/cli/commands/mcp.js +105 -0
  18. package/dist/cli/commands/mcp.js.map +1 -0
  19. package/dist/cli/commands/merge.d.ts +1 -0
  20. package/dist/cli/commands/merge.js +111 -0
  21. package/dist/cli/commands/merge.js.map +1 -0
  22. package/dist/cli/commands/promote.d.ts +1 -0
  23. package/dist/cli/commands/promote.js +157 -0
  24. package/dist/cli/commands/promote.js.map +1 -0
  25. package/dist/cli/commands/tui.d.ts +1 -0
  26. package/dist/cli/commands/tui.js +60 -0
  27. package/dist/cli/commands/tui.js.map +1 -0
  28. package/dist/cli/commands/undo.d.ts +1 -0
  29. package/dist/cli/commands/undo.js +157 -0
  30. package/dist/cli/commands/undo.js.map +1 -0
  31. package/dist/cli/index.d.ts +2 -0
  32. package/dist/cli/index.js +85 -0
  33. package/dist/cli/index.js.map +1 -0
  34. package/dist/cli/tui/App.d.ts +8 -0
  35. package/dist/cli/tui/App.js +333 -0
  36. package/dist/cli/tui/App.js.map +1 -0
  37. package/dist/core/apply.d.ts +27 -0
  38. package/dist/core/apply.js +191 -0
  39. package/dist/core/apply.js.map +1 -0
  40. package/dist/core/claudeMd.d.ts +27 -0
  41. package/dist/core/claudeMd.js +103 -0
  42. package/dist/core/claudeMd.js.map +1 -0
  43. package/dist/core/dedupe.d.ts +78 -0
  44. package/dist/core/dedupe.js +212 -0
  45. package/dist/core/dedupe.js.map +1 -0
  46. package/dist/core/doctor.d.ts +35 -0
  47. package/dist/core/doctor.js +106 -0
  48. package/dist/core/doctor.js.map +1 -0
  49. package/dist/core/journal.d.ts +31 -0
  50. package/dist/core/journal.js +64 -0
  51. package/dist/core/journal.js.map +1 -0
  52. package/dist/core/lint.d.ts +26 -0
  53. package/dist/core/lint.js +254 -0
  54. package/dist/core/lint.js.map +1 -0
  55. package/dist/core/memoryIndex.d.ts +42 -0
  56. package/dist/core/memoryIndex.js +81 -0
  57. package/dist/core/memoryIndex.js.map +1 -0
  58. package/dist/core/merge.d.ts +19 -0
  59. package/dist/core/merge.js +58 -0
  60. package/dist/core/merge.js.map +1 -0
  61. package/dist/core/parse.d.ts +2 -0
  62. package/dist/core/parse.js +84 -0
  63. package/dist/core/parse.js.map +1 -0
  64. package/dist/core/plan.d.ts +34 -0
  65. package/dist/core/plan.js +85 -0
  66. package/dist/core/plan.js.map +1 -0
  67. package/dist/core/promote.d.ts +29 -0
  68. package/dist/core/promote.js +103 -0
  69. package/dist/core/promote.js.map +1 -0
  70. package/dist/core/scan.d.ts +16 -0
  71. package/dist/core/scan.js +81 -0
  72. package/dist/core/scan.js.map +1 -0
  73. package/dist/core/types.d.ts +36 -0
  74. package/dist/core/types.js +4 -0
  75. package/dist/core/types.js.map +1 -0
  76. package/dist/mcp/server.d.ts +13 -0
  77. package/dist/mcp/server.js +211 -0
  78. package/dist/mcp/server.js.map +1 -0
  79. package/package.json +71 -0
  80. package/skills/curate-memory/SKILL.md +60 -0
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "claude-memory-explorer",
3
+ "version": "0.1.0",
4
+ "description": "Browse, dedupe, lint, and promote your Claude Code auto-memory across every project. CLI + TUI + MCP server.",
5
+ "type": "module",
6
+ "bin": {
7
+ "memex": "dist/cli/index.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "skills",
12
+ ".claude-plugin",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/hseinmoussa/claude-memory-explorer.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/hseinmoussa/claude-memory-explorer/issues"
22
+ },
23
+ "homepage": "https://github.com/hseinmoussa/claude-memory-explorer#readme",
24
+ "scripts": {
25
+ "build": "tsc && chmod +x dist/cli/index.js",
26
+ "dev": "tsx src/cli/index.ts",
27
+ "pretest": "npm run build",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "typecheck": "tsc --noEmit",
31
+ "clean": "rm -rf dist",
32
+ "prepublishOnly": "npm run clean && npm run typecheck && npm test && npm run build"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "keywords": [
38
+ "claude",
39
+ "claude-code",
40
+ "memory",
41
+ "mcp",
42
+ "mcp-server",
43
+ "anthropic",
44
+ "cli",
45
+ "tui",
46
+ "ink",
47
+ "plugin",
48
+ "dedupe",
49
+ "lint"
50
+ ],
51
+ "author": "Hussein Moussa",
52
+ "license": "MIT",
53
+ "engines": {
54
+ "node": ">=20"
55
+ },
56
+ "devDependencies": {
57
+ "@types/node": "^22.10.0",
58
+ "@types/react": "^18.3.0",
59
+ "ink-testing-library": "^4.0.0",
60
+ "tsx": "^4.19.0",
61
+ "typescript": "^5.7.0",
62
+ "vitest": "^2.1.0"
63
+ },
64
+ "dependencies": {
65
+ "@modelcontextprotocol/sdk": "^1.18.0",
66
+ "gray-matter": "^4.0.3",
67
+ "ink": "^5.0.1",
68
+ "react": "^18.3.1",
69
+ "zod": "^3.23.0"
70
+ }
71
+ }
@@ -0,0 +1,60 @@
1
+ ---
2
+ description: Curate Claude Code auto-memory across all projects — find duplicates, stale facts, conflicts, structural issues (broken YAML, dangling references, over-cap MEMORY.md), and memories that should be promoted to global (~/.claude/CLAUDE.md). Use when the user says "clean up my memory", "dedupe my memory", "find stale memories", "promote this memory to global", "memex doctor", "/curate-memory", or describes wanting the memory tree in better shape. Operates across ALL projects (~/.claude/projects/*/memory/) — covers the cross-project gap that the built-in consolidate-memory skill does not.
3
+ allowed-tools: Read mcp__memex__*
4
+ ---
5
+
6
+ # Curate auto-memory
7
+
8
+ You have an MCP server `memex` available. Use its tools to audit and improve the user's memory tree without making destructive changes the user hasn't confirmed.
9
+
10
+ ## Available tools
11
+
12
+ (All tools are exposed at `mcp__memex__<name>` — the model handles the
13
+ namespace prefix; we use the short names in this skill for readability.)
14
+
15
+ Read-only:
16
+ - `memex.doctor` — full health report. **Always start here.**
17
+ - `memex.list_memories` — Memory[] across all projects, filterable
18
+ - `memex.find_duplicates` — cross-project clusters
19
+ - `memex.lint` — structural issues (broken-yaml, dangling-ref, missing-index, orphan-file, untyped-file, over-cap)
20
+ - `memex.journal_list` / `memex.journal_latest` — the mutation log
21
+
22
+ Plan generators (build a Plan, do NOT execute):
23
+ - `memex.plan_merge` — collapse a duplicate cluster to its representative
24
+ - `memex.plan_promote_memory` — move one memory to ~/.claude/CLAUDE.md
25
+ - `memex.plan_promote_cluster` — replace whole cluster with one CLAUDE.md block
26
+
27
+ Mutating (only run after confirming with the user):
28
+ - `memex.apply_plan` — execute a Plan. Always journaled at ~/.claude/.memex/log/
29
+ - `memex.undo` — reverse the most recent applied plan (or any by id)
30
+
31
+ ## Workflow
32
+
33
+ 1. **Always start with `doctor`.** It's the cheapest, most informative single call.
34
+ 2. **Triage**:
35
+ - Any `error`-severity issues (broken-yaml, over-cap, unreadable) — surface them first; offer to help the user fix manually (broken YAML is not safely auto-fixable).
36
+ - Cross-project duplicate clusters flagged as `promotionCandidate` — strongly suggest `plan_promote_cluster` (one block in CLAUDE.md replaces N project copies).
37
+ - Plain duplicates (cluster, not promote candidate) — suggest `plan_merge` to collapse to the representative.
38
+ - `info` issues (untyped-file, orphan-file when no pointer index) — mention but don't push.
39
+ 3. **Before any mutation**: call the appropriate `plan_*` tool, then show the resulting Plan to the user (count of ops, file paths, byte savings). Ask: "Apply this? (y/n)". Only call `apply_plan` after explicit yes.
40
+ 4. **After applying**: print the new journal entry id and tell the user how to reverse: `memex undo` (CLI) or call `memex.undo` again here.
41
+ 5. **Composition**: this skill is cross-project. The built-in `consolidate-memory` skill is intra-project. They compose — run consolidate-memory per project first if needed, then run this for the cross-project sweep.
42
+
43
+ ## What NOT to do
44
+
45
+ - **Never call `apply_plan` without explicit user confirmation.** The plan generator output is the confirmation surface — show it and wait.
46
+ - **Never modify files outside `~/.claude/projects/<slug>/memory/` and `~/.claude/CLAUDE.md`.** memex enforces this, but don't suggest workarounds that would.
47
+ - **Don't try to fix broken-yaml automatically.** Report the file path + the hint memex gives, and let the user open it.
48
+ - **Don't promote `project`- or `reference`-typed memories** — those are project-scoped by design. Only `user` and `feedback` types are sensible promotion candidates.
49
+
50
+ ## Example session
51
+
52
+ User: "clean up my claude memory"
53
+
54
+ You:
55
+ 1. Call `memex.doctor` → see 1 error (broken-yaml) and 1 promotion candidate cluster.
56
+ 2. Report the broken-yaml first; suggest the user open the file (provide the path + hint).
57
+ 3. Call `memex.plan_promote_cluster` for the candidate cluster.
58
+ 4. Show the Plan: "Would write 1 block to ~/.claude/CLAUDE.md and delete 3 source files across 3 projects. Apply?"
59
+ 5. On confirm, call `memex.apply_plan` with the plan.
60
+ 6. Confirm success and provide the undo id.