musememory 1.11.0 β†’ 2.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 (40) hide show
  1. package/.agents/archive/.gitkeep +0 -0
  2. package/.agents/artifacts/.gitkeep +0 -0
  3. package/.agents/brand/a11y.md +32 -0
  4. package/.agents/brand/bem-conventions.md +42 -0
  5. package/.agents/brand/design.md +45 -0
  6. package/.agents/brand/screenshots/.gitkeep +0 -0
  7. package/.agents/brand/screenshots/README.md +9 -0
  8. package/.agents/brand/tokens/base.css +139 -0
  9. package/.agents/brand/tokens/colors.json +127 -0
  10. package/.agents/brand/tokens/motion.json +61 -0
  11. package/.agents/brand/tokens/radii.json +36 -0
  12. package/.agents/brand/tokens/shadows.json +27 -0
  13. package/.agents/brand/tokens/spacing.json +68 -0
  14. package/.agents/brand/tokens/typography.json +79 -0
  15. package/.agents/context/architecture.md +140 -0
  16. package/.agents/context/brand.md +19 -0
  17. package/.agents/context/current.md +44 -0
  18. package/.agents/context/decisions.md +25 -0
  19. package/.agents/context/index.md +16 -0
  20. package/.agents/context/product.md +100 -0
  21. package/.agents/context/roadmap.md +19 -0
  22. package/.agents/goals/.gitkeep +0 -0
  23. package/.agents/research/research-brief-agent-memory-migrator.md +245 -0
  24. package/.agents/standards/backend-workers-hono.md +41 -0
  25. package/.agents/standards/council-roles.md +36 -0
  26. package/.agents/standards/dox-hierarchy.md +80 -0
  27. package/.agents/standards/execution-kernel.md +122 -0
  28. package/.agents/standards/frontend-astro.md +50 -0
  29. package/.agents/standards/frontend-nextjs.md +93 -0
  30. package/.agents/standards/git-workflow.md +98 -0
  31. package/.agents/standards/memory-context.md +60 -0
  32. package/.agents/standards/security-vibeguard.md +41 -0
  33. package/.agents/standards/system-design.md +67 -0
  34. package/.agents/standards/tech-stacks.md +52 -0
  35. package/.agents/standards/workflows.md +54 -0
  36. package/.agents/workflows/.gitkeep +0 -0
  37. package/README.md +51 -19
  38. package/dist/index.js +11269 -3732
  39. package/package.json +1 -1
  40. package/schema.json +120 -2
@@ -0,0 +1,140 @@
1
+ # πŸ—οΈ Muse Memory Architecture & System Design
2
+
3
+ ---
4
+
5
+ ## πŸ›οΈ System Architecture Snapshot
6
+
7
+ ```
8
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
9
+ β”‚ AI Agents & IDE Platforms β”‚
10
+ β”‚ (Claude Code, Cursor, Antigravity, Windsurf, Codex, CLI) β”‚
11
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
12
+ β”‚ MCP stdio / Terminal CLI
13
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
14
+ β”‚ Muse Memory Core Engine β”‚
15
+ β”‚ β”‚
16
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
17
+ β”‚ β”‚ Retrieval Engine β”‚ β”‚ Vibeguard Secret β”‚ β”‚ Auto-Migrate β”‚ β”‚
18
+ β”‚ β”‚ (Token Knapsack) β”‚ β”‚ Defense Scanner β”‚ β”‚ (24+ Formats)β”‚ β”‚
19
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
20
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
21
+ β”‚ β”‚ LifeCycle Machine β”‚ β”‚ JSONL Harvester β”‚ β”‚ Audit Ledger β”‚ β”‚
22
+ β”‚ β”‚(State Transitions)β”‚ β”‚(Transcript Parserβ”‚ β”‚(audit.jsonl) β”‚ β”‚
23
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
24
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
25
+ β”‚ Atomic File I/O
26
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
27
+ β”‚ Dual-Scope Storage Engine (.memory/) β”‚
28
+ β”‚ β”‚
29
+ β”‚ .memory/ β”‚
30
+ β”‚ β”œβ”€β”€ memory.db # Primary SQLite cognitive database β”‚
31
+ β”‚ β”œβ”€β”€ CURRENT.md # Active hard constraints & handoff β”‚
32
+ β”‚ β”œβ”€β”€ USER.md # Persona & developer preferences β”‚
33
+ β”‚ β”œβ”€β”€ HOT.md # Working memory cache (rollups) β”‚
34
+ β”‚ β”œβ”€β”€ sources.json # Provenance Source Ledger β”‚
35
+ β”‚ β”œβ”€β”€ claims.json # Evidence-grounded Claim Ledger β”‚
36
+ β”‚ β”œβ”€β”€ audit.jsonl # Append-only operational audit trailβ”‚
37
+ β”‚ └── memories/ # Dual-persisted YAML export mirror β”‚
38
+ β”‚ β”œβ”€β”€ m_1700000001000_auth.yaml β”‚
39
+ β”‚ └── m_1700000002000_arch.yaml β”‚
40
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
41
+ ```
42
+
43
+ ---
44
+
45
+ ## πŸ“ Repository Layout
46
+
47
+ ```
48
+ musememory/
49
+ β”œβ”€β”€ bin/ # Command-line entry points (memory.ts, musememory.ts)
50
+ β”œβ”€β”€ src/ # Core TypeScript source code
51
+ β”‚ β”œβ”€β”€ adrs/ # Living Architecture Decision Records & Drift Engine
52
+ β”‚ β”œβ”€β”€ anchors/ # Native structural code anchors & live drift verification
53
+ β”‚ β”œβ”€β”€ audit.ts # Append-only compliance audit ledger
54
+ β”‚ β”œβ”€β”€ cache.ts # L0 hot cache, query cache, & SQLite WAL tuning
55
+ β”‚ β”œβ”€β”€ claims.ts # Evidence-backed claim ledger & confidence tags
56
+ β”‚ β”œβ”€β”€ cli.ts # Command router & dispatcher
57
+ β”‚ β”œβ”€β”€ cli/ # Modular domain command handlers (health, wiki, etc.)
58
+ β”‚ β”œβ”€β”€ cognition/ # Autonomous "Why" reasoner, bug clustering, tech debt
59
+ β”‚ β”œβ”€β”€ compaction/ # 70% context compaction engine & session handoffs
60
+ β”‚ β”œβ”€β”€ compounding/ # Unified knowledge compounding (temporal & clustering)
61
+ β”‚ β”œβ”€β”€ connect.ts # Declarative zero-permission auto-wiring across 80+ agent platforms
62
+ β”‚ β”œβ”€β”€ current.ts # CURRENT.md read/append constraints engine
63
+ β”‚ β”œβ”€β”€ doctor.ts # Ecosystem diagnostic & health check engine
64
+ β”‚ β”œβ”€β”€ health/ # Unified 5-Pillar Project Health Gate engine
65
+ β”‚ β”œβ”€β”€ harvester.ts # Universal agent transcript discovery and auto-learner engine
66
+ β”‚ β”œβ”€β”€ intelligence/ # Pluggable code intelligence providers (CodeGraph, Graphify, LSP, AST)
67
+ β”‚ β”œβ”€β”€ learning/ # Observation, candidate distillation, negative anti-patterns
68
+ β”‚ β”œβ”€β”€ mcp.ts # Model Context Protocol stdio server (69 tools with profiles)
69
+ β”‚ β”œβ”€β”€ mesh/ # Multi-repo & monorepo workspace discovery, query resolver, contracts
70
+ β”‚ β”œβ”€β”€ orchestrator/ # Flagship muse_context fusion, bidirectional lookups, MCP profiles
71
+ β”‚ β”œβ”€β”€ promotion/ # 3-tier promotion ladder, 5x success rule, archival lifecycle
72
+ β”‚ β”œβ”€β”€ quality/ # Deduplication, semantic contradiction engine, utility & ROI
73
+ β”‚ β”œβ”€β”€ retrieval/ # 11-dimension multi-factor scoring & token knapsack packing
74
+ β”‚ β”œβ”€β”€ root.ts # Hierarchical root detection & auto-bootstrap
75
+ β”‚ β”œβ”€β”€ schema.ts # JSON Schema & store referential validator
76
+ β”‚ β”œβ”€β”€ secrets.ts # Vibeguard zero-leakage secret scanner & redactor
77
+ β”‚ β”œβ”€β”€ store.ts # Dual-scope storage layout & lifecycle state machine
78
+ β”‚ β”œβ”€β”€ sync/ # Cross-agent knowledge sync, P2P gossip protocol, shared pool
79
+ β”‚ β”œβ”€β”€ transcript.ts # Universal JSONL parser, dialogue windowing & search
80
+ β”‚ β”œβ”€β”€ types.ts # Core TypeScript interfaces & enums
81
+ β”‚ β”œβ”€β”€ ui.ts # Full Web Observability Studio & 3D knowledge graph
82
+ β”‚ β”œβ”€β”€ user.ts # Persona & working preference engine
83
+ β”‚ β”œβ”€β”€ agents/ # Workstation coding agents detection & registry (80+ platforms)
84
+ β”‚ └── migrator/ # Multi-provider auto-detection & migration engine (24+ formats)
85
+ β”œβ”€β”€ test/ # Automated Bun test suites (498 tests across 81 suites)
86
+ β”œβ”€β”€ package.json # Package metadata & dependencies (v2.0.0)
87
+ └── dist/ # Compiled Node/Bun bundle
88
+ ```
89
+
90
+ ---
91
+
92
+ ## πŸ”„ Memory LifeCycle State Machine
93
+
94
+ ```
95
+ [propose] ──► candidate ──► confirm() ──► active / confirmed ──► supersede() ──► superseded
96
+ β”‚ β”‚ β”‚
97
+ β”œβ”€β”€β–Ί markStale() ────────────── β”œβ”€β”€β–Ί cold ──► dormant ──► archived
98
+ β”‚ β”‚ β”‚ β”‚ β”‚
99
+ β”‚ β–Ό β–Ό └────────◄── rehydrate() β”€β”€β”€β”˜
100
+ └──► stale conflicted
101
+ β”‚ β”‚
102
+ └──► delete() β—„β”€β”€β”€β”€β”€β”˜
103
+ β”‚
104
+ β–Ό
105
+ [Purged from SQLite/YAML + audit.jsonl logged]
106
+ ```
107
+
108
+ ### Invariant Rules:
109
+ 1. **Confirmation Gate**: Only `candidate`, `disputed`, or `stale` entries can be promoted to `confirmed`.
110
+ 2. **Supersession Requirement**: When calling `supersede(old_id, new_id)`, the `new_id` entry must already exist and have `confirmed` status. Self-supersession (`old_id === new_id`) is strictly prohibited.
111
+ 3. **Contradiction Management**: Contradictory evidence creates explicit `conflicted` status with mutual `conflict_ids` instead of silently clobbering truth.
112
+ 4. **Scoped Promotion Ladder**: Promotions move `local` $\rightarrow$ `project` $\rightarrow$ `global` following the 5Γ— repeated success policy and universal generalization (stripping local paths and project-specific artifacts).
113
+ 5. **Archival Rehydration**: Cold and archived memories dynamically rehydrate to `active` upon high-relevance queries.
114
+ 6. **Audit Ledger Logging**: Every mutation automatically writes an immutable log record to `.memory/audit.jsonl`.
115
+
116
+ ---
117
+
118
+ ## ⏳ Per-Type Staleness Policy
119
+
120
+ | Memory Type | Policy Lifetime | Description & Agent Guidance |
121
+ | :--- | :--- | :--- |
122
+ | `fix` | **90 days** | Bug workarounds, dependency patches, edge-case fixes. |
123
+ | `operation` | **180 days** | Build scripts, deployment instructions, local dev commands. |
124
+ | `architecture` | **365 days** | System architecture, database schemas, core abstractions. |
125
+ | `discovery` | **30 days** | Ephemeral research notes, transient experiments. |
126
+ | `preference` | **Permanent (`null`)** | User coding preferences, tone/style rules, agency stances. |
127
+ | `constraint` | **Active** | Immediate hard constraints synced directly to `CURRENT.md`. |
128
+ | `session` | **Permanent (`null`)** | Session start/end timeline nodes in the cognition graph. |
129
+
130
+ ---
131
+
132
+ ## πŸ›‘οΈ Built-in Vibeguard Secret Defense (`src/secrets.ts`)
133
+
134
+ Every write transaction (`store.propose`, `store.save`, `setUserProfile`, `importSnapshot`, and `importTranscript`) automatically scans content and rejects writes if any of the following are detected:
135
+ - OpenAI / Anthropic / AI API keys (`sk-...`)
136
+ - GitHub Personal Access Tokens (`ghp_...`, `github_pat_...`)
137
+ - NPM tokens (`npm_...`)
138
+ - AWS Access Key IDs (`AKIA...`, `ASIA...`)
139
+ - Private Key blocks (`-----BEGIN ... PRIVATE KEY-----`)
140
+ - Database connection strings with embedded credentials (`postgres://...`)
@@ -0,0 +1,19 @@
1
+ # 🎨 Brand, Persona & Voice Guidelines
2
+
3
+ ---
4
+
5
+ ## 1. Product Identity & Voice
6
+ - **Name**: Muse Memory (`musememory`)
7
+ - **Tone**: Technical, authoritative, razor-sharp, zero-fluff.
8
+ - **Audience**: Elite software engineers, agency founders, and autonomous AI agents.
9
+
10
+ ---
11
+
12
+ ## 2. Terminal UI & CLI Output Conventions
13
+ - Format CLI tables cleanly with ASCII borders.
14
+ - Prepend informative CLI banners with appropriate emojis:
15
+ - 🧠 Memory operations
16
+ - πŸ›‘οΈ Security / Vibeguard alerts
17
+ - ⚑ High-speed actions
18
+ - πŸ“ Active working state
19
+ - Strip ANSI codes when output is piped to files or non-interactive terminals.
@@ -0,0 +1,44 @@
1
+ # πŸ“ Current Shipped State & Active Invariants
2
+
3
+ > **Version**: `v2.1.0`
4
+ > **Status**: Production Release (P2P Sync, Studio, and Monorepo Mesh)
5
+
6
+ ---
7
+
8
+ ## πŸš€ Shipped Capabilities
9
+
10
+ 1. **Dual-Scope Cognitive Engine**: Project-local `.memory/` and global `~/.memory/`.
11
+ 2. **Deterministic Lifecycle Machine**: Propose β†’ Candidate β†’ Confirm β†’ Supersede β†’ Stale β†’ Delete.
12
+ 3. **Model Context Protocol (MCP)**: Native stdio server implementing MCP 2024-11-05.
13
+ 4. **Universal Agent Detection**: Auto-detects and connects 80+ coding agent platforms.
14
+ 5. **Universal Migrator**: Imports memories from 24+ external formats (AgentMemory, Mem0, Letta, etc.).
15
+ 6. **Vibeguard Secret Defense**: Built-in regex scanner preventing credential commits to memory.
16
+ 7. **Compounding & Rollups**: Temporal rollups and token-bag centroid clustering.
17
+ 8. **In-Process L0 Hot Memory Cache & L1 Context Cache**: Sub-50 microsecond entry lookups, O(1) query caching, and mtime-synchronized dual persistence.
18
+ 9. **SQLite FTS5 BM25 Engine**: Integrated full-text search virtual tables with sub-2ms lexical search.
19
+ 10. **Memory Quality & Deduplication**: Deterministic SHA-256 content fingerprinting, canonical memory consolidation with supporting evidence arrays, and temporal mode inference (`current`, `historical`, `timeless`).
20
+ 11. **Contradiction Engine**: Semantic conflict detection, first-class `conflicted` state machine with mutual `conflict_ids`, and multi-strategy resolution (`supersede`, `historical`, `reject`, `keep_both`).
21
+ 12. **Utility Tracking & Memory ROI**: Operational feedback loop tracking `application_count`, `successful_applications`, `regressions`, `reuse_success_rate`, and automated dispute escalation.
22
+ 13. **Ephemeral Observation Tier**: Structured append-only event logging in `.memory/observations.jsonl` from tool results, test outputs, build errors, and review comments.
23
+ 14. **First-Class Negative Memories**: Explicit capture of `DO_NOT_USE`, `FAILED_APPROACH`, and `BUG_PRONE_PATTERN` with reproduction commands and timeless salience.
24
+ 15. **Autonomous Distillation & Outcome Feedback Loop**: Distills raw observation streams into candidate fixes/architecture, coupled with automatic session command evaluation and memory reinforcement.
25
+ 16. **Pluggable Code Intelligence Architecture**: Pluggable provider registry with zero-crash fallback chain (CodeGraph β†’ Graphify β†’ LSP β†’ Heuristic AST scanner β†’ Safe Empty) and automated symbol evidence memory enrichment.
26
+ 17. **Multi-Factor Ranking Engine**: 11-dimension scoring model combining exact symbol matching, path proximity, FTS5 BM25, graph overlap, blast radius, recency decay, utility ROI, negative warning boosts, and knapsack token budget packing.
27
+ 18. **Context Compaction & Session Handoff Engine**: 70% context usage threshold detector, 5-invariant lockdown protocol, interruption-proof CURRENT.md checkpoint compilation, and continuous conversational knowledge harvesting.
28
+ 19. **Scoped Promotion, Generalization & Archival Lifecycle Engine**: 3-tier scope ladder (`local` β†’ `project` β†’ `global`), 5Γ— repeated success policy gate, structural generalization of project specifics into universal principles, and extended archival lifecycle (`active` β†’ `cold` β†’ `dormant` β†’ `archived`) with dynamic query rehydration.
29
+ 20. **Native Code Anchors & Stable Structural Code Identity**: First-class code anchors (`repository`, `file`, `module`, `symbol`, `route`, `test`), line-independent structural fingerprinting with comment/spacing normalization, and live drift/orphan verification (`valid`, `drifted`, `orphaned`) with repository audit scoring.
30
+ 21. **Flagship Unified Context Orchestrator & Task-Focused MCP Profiles**: Flagship `muse_context` tool fusing active constraints, code anchors, ranked memories, and negative lessons under strict token budgets with suggested next actions; bidirectional code ↔ memory lookups (`muse_code_for_memory`, `muse_memory_for_code`); and 6 task-focused MCP profiles (`core`, `coding`, `debugging`, `review`, `architecture`, `maintenance`) preventing agent tool bloat.
31
+ 22. **First-Class Architecture Decision Records (ADRs) & Bidirectional Drift Engine**: ADRs as living memory entities (`proposed`, `accepted`, `superseded`, `rejected`) with native code anchors and supersession lineage; bidirectional documentation ↔ code drift engine classifying alignment (`DOCUMENTED`, `IMPLEMENTED`, `PARTIAL`, `CONFLICTING`, `STALE`, `MISSING`) and scoring repository health.
32
+ 23. **Autonomous Engineering Cognition & "Why" Reasoner**: Historical "Why" explanation engine synthesizing ADRs, bug fixes, trade-offs, and invariants; recurring bug and fragility clustering across 5 root causes; and technical debt scanner detecting TODOs/FIXMEs, `as any` type bypasses, and drifted anchors.
33
+ 24. **Unified 5-Pillar Project Health Gate (`muse_health`)**: Comprehensive architectural health evaluation auditing store integrity, native code anchors, doc/code alignment, anti-pattern sentry, and technical debt; computes composite grade (A-F), gate status (PASS/WARN/FAIL), prioritized remediation checklist, and CLI dashboard.
34
+ 25. **Cross-Agent Knowledge Sync & P2P Gossip Protocol (R14)**: Portable sealed `SyncPacket` with SHA-256 integrity, vector clock causal ordering, bidirectional shared pool drop-directory gossip exchange, deduplication, Vibeguard secret scrubbing, and semantic contradiction tagging with mutual `conflict_ids`.
35
+ 26. **Full Web Observability Studio & Interactive Visual Dashboard (R15)**: Integrated web studio served over local HTTP (`memory studio`), featuring a 5-pillar health scorecard, overall letter grade, prioritized remediation action checklist, ADR registry with code-to-doc drift inspector, autonomous "Why" reasoner, bug friction clusters heatmap, debt hotspots, and live P2P mesh topology visualizer.
36
+ 27. **Multi-Repo & Monorepo Cross-Project Mesh (R16)**: Automatic workspace detection across pnpm, npm, bun, lerna, and multi-repo sibling groups; cross-project memory querying with origin package provenance; cross-package contract and entrypoint export auditing; explicit mesh linking (`mesh_links.json`); and shared invariant propagation across the entire mesh.
37
+
38
+ ---
39
+
40
+ ## πŸ”’ Active System Invariants
41
+
42
+ - **Zero External Daemons**: All operations must execute in-process via SQLite (`memory.db`) or flat files. Never depend on background servers.
43
+ - **Fail Fast**: Throw loudly on secret detection, invalid schema shapes, or unconfirmed supersessions.
44
+ - **Verification Gate**: Before declaring changes complete, `bun test`, `bun run build`, and `tsc --noEmit` must pass.
@@ -0,0 +1,25 @@
1
+ # πŸ›οΈ Locked Architectural Decisions (ADRs)
2
+
3
+ > **Directive**: These decisions are binding. Do not casually reopen or refactor away from these foundations.
4
+
5
+ ---
6
+
7
+ ### ADR-001: Zero-Daemon, File-Backed Engine
8
+ - **Decision**: All storage and indexing run in-process using embedded SQLite (`bun:sqlite` / SQLite3) and flat Markdown/JSON files.
9
+ - **Rationale**: Developers and AI agents must not be blocked by disconnected Docker containers or background server crashes.
10
+
11
+ ### ADR-002: Dual-Persistence (SQLite + YAML Mirror)
12
+ - **Decision**: Memory entries are stored in indexed SQLite for sub-millisecond retrieval and simultaneously mirrored to `.memory/memories/*.yaml`.
13
+ - **Rationale**: Enables lightning-fast programmatic queries while preserving 100% human and Git diff readability.
14
+
15
+ ### ADR-003: MCP Stdio Protocol
16
+ - **Decision**: Implement Model Context Protocol via standard I/O (`stdio`).
17
+ - **Rationale**: Cleanest, lowest-overhead integration across all AI agent harnesses (Claude Code, Cursor, Antigravity, OpenCode).
18
+
19
+ ### ADR-004: In-Flight Secret Interception (Vibeguard)
20
+ - **Decision**: Secrets are scanned in-memory before file writes and rejected immediately.
21
+ - **Rationale**: Once a secret enters a local database or git repository, rotating and purging it causes severe disruption.
22
+
23
+ ### ADR-005: Bun-First Runtime & Toolchain
24
+ - **Decision**: Use Bun as the primary test runner, bundler, and local runtime, compiling to portable Node.js binaries for npm distribution.
25
+ - **Rationale**: Instant test iteration (`bun test`) and seamless zero-dependency distribution.
@@ -0,0 +1,16 @@
1
+ # πŸ“– Muse Memory Context Index
2
+
3
+ > **Reading Directive**: Durable project truth for Muse Memory lives in `./.agents/context/`. Start at this index, then load **only** the specific context file your active task requires.
4
+
5
+ ---
6
+
7
+ ## Context Navigation Map
8
+
9
+ | File | Scope & Contents | When to Read |
10
+ | :--- | :--- | :--- |
11
+ | [`product.md`](./product.md) | Product scope, CLI tools (`memory`, `musememory`), and MCP tool matrix | Understanding user commands, capabilities, and MCP protocols |
12
+ | [`architecture.md`](./architecture.md) | Dual-Scope storage (`.memory/`), SQLite DB, retrieval scoring formula, and file layout | System design, file locations, state machine, and data flow |
13
+ | [`brand.md`](./brand.md) | Persona profiles (`USER.md` archetypes), voice, and presentation rules | Writing prompts, terminal output copy, and user documentation |
14
+ | [`current.md`](./current.md) | Current shipped state (v2.0.0), test coverage, and active constraints | Before starting work on bugs, features, or refactors |
15
+ | [`decisions.md`](./decisions.md) | Locked architectural decisions (zero-daemon, file-backed SQLite, atomic I/O) | Evaluating technical choices or refactors |
16
+ | [`roadmap.md`](./roadmap.md) | Planned improvements, ecosystem expansions, and backlog | Scoping new capabilities |
@@ -0,0 +1,100 @@
1
+ # πŸ“¦ Muse Memory Product Scope & Capabilities
2
+
3
+ > **Binary Names**: `memory` (primary), `musememory` (alias), `npx musememory` (zero-install)
4
+ > **MCP Protocol**: MCP 2024-11-05 (stdio transport)
5
+ > **Runtime**: Bun / TypeScript (Node-compatible bundle)
6
+
7
+ ---
8
+
9
+ ## 🎯 Executive Overview
10
+
11
+ Muse Memory is a zero-daemon, file-backed cognitive memory engine designed to give AI agents (Claude Code, Cursor, Antigravity, Windsurf, Codex, Gemini CLI, Hermes, OpenCode, OpenClaw, etc.) persistent, self-organizing memory across sessions without external database daemons or cloud servers.
12
+
13
+ ---
14
+
15
+ ## πŸ”Œ Comprehensive MCP Tool Matrix
16
+
17
+ ### 🎯 Flagship Orchestration & Intelligence Tools
18
+ | MCP Tool | Execution Phase | Agent Purpose |
19
+ | :--- | :--- | :--- |
20
+ | `muse_context` | **Flagship Orchestration** | Unified context fusion: single-call query combining search, active file, symbol, error messages, and task intent under strict knapsack token budgets. |
21
+ | `muse_health` | **Quality Gate** | 5-Pillar Project Health Gate: single-call audit of store integrity, code anchors, doc/code alignment, anti-pattern sentry, and technical debt with A-F grading and PASS/WARN/FAIL status. |
22
+ | `muse_why` | **Cognition / "Why" Reasoner** | Traces code evolution backwards through past bug fixes, ADRs, trade-offs, and invariants to explain *why* code is designed the way it is before refactoring. |
23
+ | `muse_bug_clusters` | **Fragility Hotspots** | Clusters recurring bugs into 5 root-cause categories with subsystem fragility scoring. |
24
+ | `muse_tech_debt` | **Technical Debt Registry** | Scans code and memory for TODO/FIXME markers, unsafe `as any` casts, and drifted anchors with remediation advice. |
25
+ | `muse_memory_for_code`| **Code-to-Memory** | Queries all memories, ADRs, constraints, and bugs associated with a code file and symbol. |
26
+ | `muse_code_for_memory`| **Memory-to-Code** | Resolves all native code anchors and affected source files for a given memory entry. |
27
+ | `memory_adr_record` | **Architecture Decisions**| Records first-class ADRs with drivers, decision, consequences, options considered, and native code anchors. |
28
+ | `memory_adr_list` | **ADR Discovery** | Lists architecture decision records filtered by status (`proposed`, `accepted`, `superseded`, `rejected`). |
29
+ | `memory_drift_audit` | **Drift Detection** | Bi-directional documentation $\longleftrightarrow$ code drift engine across 6 alignment states. |
30
+ | `memory_capture_negative` | **Negative Sentry** | Records failed approaches, anti-patterns, and reproduction commands to prevent repeating mistakes. |
31
+ | `memory_promote_scope` | **Scoped Promotion** | Promotes memory along 3-tier ladder (`local` $\rightarrow$ `project` $\rightarrow$ `global`) with 5Γ— repeated success policy and universal generalization. |
32
+ | `memory_archive` / `rehydrate` | **Archival Lifecycle** | Evaluates and manages `active` $\rightarrow$ `cold` $\rightarrow$ `dormant` $\rightarrow$ `archived` lifecycle with query rehydration. |
33
+ | `anchor_create` / `verify` / `audit` | **Code Identity** | Creates, verifies, and audits line-independent structural code anchors. |
34
+ | `muse_sync_broadcast` / `ingest` | **P2P Gossip Mesh** | Broadcasts and ingests portable sealed SyncPackets with deduplication and contradiction flagging. |
35
+ | `muse_sync_status` / `pool` | **Sync Coordination** | Tracks peer vector clocks and synchronizes memories bidirectionally via shared drop-directory pool. |
36
+ | `muse_mesh_status` | **Monorepo Topology** | Discovers monorepo workspaces and multi-repo sibling groups with package dependencies and stores. |
37
+ | `muse_mesh_query` | **Cross-Project Query** | Queries memories across the entire workspace mesh with origin package provenance tags. |
38
+ | `muse_mesh_audit` | **Contract Verification** | Audits cross-package dependency contracts, entrypoint exports, and cross-repo code anchors. |
39
+ | `muse_mesh_link` | **Mesh Linking** | Explicitly links or unlinks external repository paths into the workspace mesh registry. |
40
+
41
+ ### πŸ› οΈ Core Memory & Lifecycle Tools
42
+ | MCP Tool | Execution Phase | Agent Purpose |
43
+ | :--- | :--- | :--- |
44
+ | `get_context` | **Session Start / Init** | Fast token-budgeted prompt context injection: retrieves `USER.md`, active `CURRENT.md` constraints, and top-$K$ scored memories. |
45
+ | `memory_capture` | **Learning / Task End** | Capture new durable facts, verified architectural decisions, operational rules, or bug resolutions directly into memory. |
46
+ | `memory_propose` | **Speculative Learning** | Propose a candidate memory requiring confirmation before permanent indexing. |
47
+ | `memory_confirm` | **Validation Phase** | Promote a `candidate` or `disputed` memory to `confirmed` status. |
48
+ | `memory_supersede` | **Refactoring / Updates** | Formally link an obsolete memory to a newer confirmed memory so agents never hallucinate deprecated patterns. |
49
+ | `memory_search` | **Targeted Lookups** | Query the SQLite store and YAML mirrors using multi-factor similarity matching and tags. |
50
+ | `memory_conflicts` | **Conflict Audit** | Lists conflicting memories detected by the semantic contradiction engine. |
51
+ | `memory_resolve_conflict` | **Conflict Resolution**| Resolves contradictions via `supersede`, `historical`, `reject`, or `keep_both`. |
52
+ | `memory_roi` | **Utility & ROI** | Computes memory reuse metrics, application success rates, and regression penalties. |
53
+ | `memory_search_transcripts` | **Historical Archaeology** | Full-text dialogue search across past JSONL conversation transcripts with conversation bookends. |
54
+ | `memory_audit` | **Compliance Check** | Inspect the append-only operational ledger (`.memory/audit.jsonl`). |
55
+ | `profile_list` / `switch` | **Tool Management** | Lists and activates task-focused MCP profiles to eliminate agent tool bloat. |
56
+
57
+ ---
58
+
59
+ ## βš™οΈ Task-Focused MCP Profiles
60
+
61
+ Muse Memory prevents agent context bloat by providing 6 pre-configured tool profiles:
62
+
63
+ - **`core`** (Minimal): `get_context`, `memory_search`, `memory_capture`, `memory_current`, `profile_list`, `profile_switch`.
64
+ - **`coding`**: Core tools + `muse_context`, `muse_why`, `muse_code_for_memory`, `muse_memory_for_code`, `anchor_*`.
65
+ - **`debugging`**: Core tools + `muse_why`, `muse_bug_clusters`, `memory_capture_negative`, `memory_verify`.
66
+ - **`review`**: Core tools + `muse_health`, `muse_tech_debt`, `memory_drift_audit`, `anchor_audit`.
67
+ - **`architecture`**: Core tools + `muse_context`, `muse_health`, `memory_adr_*`, `memory_drift_audit`, `muse_why`.
68
+ - **`maintenance`**: Core tools + `muse_health`, `memory_promote_scope`, `memory_archive`, `memory_archive_sweep`, `memory_lifecycle_stats`.
69
+ - **`full`**: Unrestricted exposure of all 61 MCP tools.
70
+
71
+ ---
72
+
73
+ ## πŸ’» CLI Command Surface
74
+
75
+ ```bash
76
+ # Health & Observability (5-Pillar Quality Gate)
77
+ memory health [--json] [--global]
78
+
79
+ # Retrieval & Context
80
+ memory context [--query "..."] [--budget 2000] [--tier 0|1|2]
81
+ memory search "<query>" [--tags arch,auth]
82
+ memory recall "<id>"
83
+
84
+ # Knowledge Lifecycle
85
+ memory capture --title "..." --type architecture --content "..."
86
+ memory propose --title "..." --content "..."
87
+ memory confirm <id>
88
+ memory supersede <old-id> <new-id>
89
+ memory stale <id>
90
+ memory audit [--limit 20]
91
+
92
+ # Personas & Constraints
93
+ memory persona [developer|designer|marketer|casual]
94
+ memory current --add "Must use Bun v1.2"
95
+
96
+ # Diagnostics & Server
97
+ memory doctor
98
+ memory validate --dry-run
99
+ memory mcp [--profile coding|review|architecture|core|full]
100
+ ```
@@ -0,0 +1,19 @@
1
+ # πŸ—ΊοΈ Muse Memory Roadmap & Backlog
2
+
3
+ ---
4
+
5
+ ## βœ… Completed Milestones
6
+ - **R14: Cross-Agent Knowledge Sync & P2P Gossip Protocol**: Sealed SyncPackets, vector clock causal tracking, filesystem shared pool drop-directory synchronization, contradiction tagging.
7
+ - **R15: Full Web Observability Studio**: Embedded visual web dashboard (`memory studio`) featuring 5-pillar health scorecards, ADR drift inspection, autonomous "Why" reasoner, and live mesh visualization.
8
+ - **R16: Multi-Repo & Monorepo Cross-Project Mesh**: Monorepo auto-discovery (pnpm, npm, bun, lerna), cross-project memory resolution with origin provenance, cross-package contract integrity auditing.
9
+
10
+ ---
11
+
12
+ ## πŸš€ Active Roadmap & Future Horizons
13
+
14
+ 1. **Distributed Agentic Swarm Telemetry**:
15
+ - Aggregate multi-agent task traces and memory application telemetry across distributed agency clusters.
16
+ 2. **Autonomous Semantic Refactoring Engine**:
17
+ - Proactive codebase refactoring recommendations driven by historical bug friction clusters and ADR drift patterns.
18
+ 3. **Enterprise Role-Based Access & Secret Boundary Enclaves**:
19
+ - Cryptographic memory encryption and tenant-isolated compartmentalization for multi-client agency delivery.
File without changes
@@ -0,0 +1,245 @@
1
+ # Research Brief: Autonomous Multi-Provider Agent Memory Migrator & State Preservation Architecture
2
+
3
+ **Depth**: deep
4
+ **Date**: 2026-08-22
5
+ **Target Repository**: `harshsinghmp/musememory`
6
+ **Primary Deliverable**: Interactive Dashboard at [`musemeory-comparison.html`](file:///home/harsh/Projects/musememory/musemeory-comparison.html) & Autonomous First-Install Migrator
7
+
8
+ ---
9
+
10
+ ## 1. Executive Summary
11
+
12
+ Autonomous AI coding agents (Claude Code, Cursor, Antigravity, Windsurf, Codex, Gemini CLI) frequently experience fragmented context across sessions. While over 24 different memory engines, graph RAG platforms, and agent harnesses have emerged, they suffer from four critical architectural liabilities:
13
+ 1. **Infrastructure Bloat**: Heavy dependencies on external vector databases (Milvus, Qdrant, Chroma, Neo4j, LanceDB) or background daemon processes (Rust, Python).
14
+ 2. **Zero-Leakage Security Vulnerabilities**: Lack of inline secret/credential interception before disk or cloud persistence.
15
+ 3. **Context Window Flooding**: Retrieval based on unbounded Top-$K$ dumps rather than exact prompt token knapsack budgeting.
16
+ 4. **Scope Contamination**: Shared global state without clean per-repository workspace isolation (`.memory/`).
17
+
18
+ **Muse Memory** solves these issues with a zero-dependency, pure TypeScript, dual-scoped (`.memory/` vs `~/.memory/`), atomic YAML/JSONL architecture with inline **Vibeguard** credential interception and exact **Token Budgeting**.
19
+
20
+ This research brief defines the **Autonomous First-Install Migrator** (`memory migrate` / `memory init --auto-import`) capable of auto-detecting and ingesting memories across all 24 popular providers while strictly preserving active vs. archived/superseded state hierarchies and workspace isolation.
21
+
22
+ ---
23
+
24
+ ## 2. Comprehensive 24-Provider Landscape & Feature Comparison
25
+
26
+ | # | Provider / System | Storage Backend | Scoping Model | Active vs. Archive Mapping | Secret Protection | Token Budgeting | Permission-Free Auto-Wiring | Offline / Air-Gapped |
27
+ |---|---|---|---|---|---|---|---|---|
28
+ | **β˜…** | **🧠 Muse Memory** | Atomic YAML + JSONL Ledger | Dual (`.memory/` + `~/.memory/`) | `confirmed` / `superseded` / `CURRENT.md` | βœ… **Vibeguard Inline** | βœ… **Exact Knapsack** | βœ… **1-Click Auto-Approve** | βœ… **100% Standalone** |
29
+ | 1 | **Supermemory** | Temporal Vector-Graph (SQLite / Cloudflare KV) | Global Spaces + Tags | `is_archived: false` βž” `confirmed`, `true` βž” `superseded` | ⚠️ Basic | ❌ Unbounded Top-K | ⚠️ Manual API | ⚠️ Hybrid Cloud |
30
+ | 2 | **Cognee** | Graph RAG (LanceDB / Kuzu / Neo4j / SQLite) | Global Dataset Namespaces | Pruned/Deprecated Edges βž” `superseded` | ❌ None | ⚠️ Chunk Limits | ⚠️ Python Lib | βœ… Self-Hostable |
31
+ | 3 | **Beads** | Git JSON Issue Beads (`.beads/`) | Local Workspace Only | `open/in_progress` βž” `CURRENT.md`, `closed` βž” `superseded` | ❌ None | ❌ Full Bead Dump | ⚠️ CLI Init | βœ… 100% Local |
32
+ | 4 | **Memori** | SQLite / Postgres Episodic Graph | Global with Session IDs | `active` βž” `confirmed`, `decayed` βž” `stale/superseded` | ❌ None | ⚠️ Top-K Items | ⚠️ Middleware | βœ… Local SQLite |
33
+ | 5 | **memU** | Hierarchical 3-Layer FS (Item/Category) | Global Categories + Local | `working_memory` βž” `CURRENT.md`, `archival` βž” `superseded` | ⚠️ Basic | ⚠️ Category Limit | ⚠️ Manual | βœ… Local Files |
34
+ | 6 | **EverOS** | Markdown Files + LanceDB / SQLite | Dual (`.everos/` + `~/.everos/`) | `active` βž” `confirmed`, `archived` βž” `superseded` | ⚠️ Basic | ⚠️ BM25 + Top-K | ⚠️ Manual Config | βœ… 100% Local |
35
+ | 7 | **Semantica** | Graph Triples & Reasoning Ledger | Global Graph + Project Tags | `valid_until: null` βž” `confirmed`, `invalid` βž” `superseded` | ❌ None | ⚠️ Graph Depth | ⚠️ Manual API | βœ… Self-Hosted |
36
+ | 8 | **Honcho** | Dialectic Metamodels (Postgres/SQLite) | Global User/Agent Dialectics | `current_representation` βž” `confirmed`, `history` βž” `superseded` | ❌ None | βœ… Reasoned Compression | ⚠️ MCP/SDK | βœ… Local Server |
37
+ | 9 | **Kungfu** | Local Checkpoint Ledger (`.kungfu/`) | Local Workspace | `current_task` βž” `CURRENT.md`, `completed` βž” `confirmed` | ❌ None | ❌ Full Checkpoint Dump | ⚠️ CLI Init | βœ… 100% Local |
38
+ | 10 | **Letta Code** | Core Memory + Archival SQLite | Global Agent Identity | `core_memory` βž” `CURRENT.md`, `archival` βž” `confirmed/superseded` | ❌ None | ⚠️ Fixed Char Blocks | ⚠️ Agent Server | βœ… Local Docker/Server |
39
+ | 11 | **MemSearch** | 3-Tier Markdown + Milvus Vector Store | Global Vector Index | `tier: summary` βž” `confirmed`, `transcript` βž” `session` | ❌ None | ⚠️ Layer Selection | ⚠️ Python API | ⚠️ Requires Milvus |
40
+ | 12 | **ACE (Kayba)** | AST Token Compression & Playbooks | Workspace Playbooks | `active_strategy` βž” `confirmed`, `refuted` βž” `rejected` | ❌ None | βœ… AST Token Budget | ⚠️ MCP Bridge | βœ… Local Engine |
41
+ | 13 | **Actx0** | Cloud API Session History & Cache | Cloud API Tenant | `active_session` βž” `confirmed`, `expired` βž” `stale` | ⚠️ Cloud Managed | βœ… Dynamic Prompt Cache | ⚠️ API Key | ❌ Cloud Only |
42
+ | 14 | **ByteRover** | Markdown Context Tree (Domain/Topic) | Local Workspace | `live` βž” `confirmed`, `archived` βž” `superseded` | ❌ None | ⚠️ Subtree Pruning | ⚠️ CLI Init | βœ… 100% Local |
43
+ | 15 | **Clawdi** | Cloud VM Shared State & Persistent Files | Cloud Agent Fleet | `pinned_rules` βž” `CURRENT.md`, `history` βž” `confirmed` | ℹ️ TEE Encrypted | ❌ Unbounded Dump | ⚠️ Cloud Auth | ❌ Cloud Only |
44
+ | 16 | **Pensieve** | Enterprise Knowledge Graph | Global Enterprise Vault | `active` βž” `confirmed`, `obsolete` βž” `superseded` | ⚠️ RBAC | ⚠️ Subgraph Limit | ⚠️ Enterprise | ⚠️ Hybrid |
45
+ | 17 | **Liminary** | AI-Native Semantic Document Layer | Corpus Workspaces | `active_cluster` βž” `confirmed`, `archived` βž” `superseded` | ⚠️ Cloud Encrypted | ⚠️ Chunk Top-K | ⚠️ API Key | ❌ Cloud Only |
46
+ | 18 | **Dvina** | Cross-App Dynamic Vector Sync | Multi-App Global | `focus_context` βž” `CURRENT.md`, `history` βž” `confirmed/superseded`| ⚠️ OAuth | ⚠️ App Scoped | ⚠️ OAuth Setup | ❌ Cloud SaaS |
47
+ | 19 | **Mem0** | Scoped Vector + Graph Store (Qdrant) | Global with `user_id`/`agent_id` | `is_active: true` βž” `confirmed`, `deleted` βž” `superseded` | ❌ None | ❌ Unbounded Top-K | ⚠️ Python/MCP | βœ… Local SQLite Mode |
48
+ | 20 | **Second Brain** | Cloudflare Workers + D1 + Obsidian | Global Obsidian Vault | `tags: [active]` βž” `confirmed`, `tags: [archive]` βž” `superseded` | ❌ None | ⚠️ Vector Top-K | ⚠️ Worker Setup | ⚠️ Cloudflare Edge |
49
+ | 21 | **Rory Plans** | Agentic Work Execution & Task Plans | Workspace Plans | `in_progress` βž” `CURRENT.md`, `completed` βž” `confirmed` | ⚠️ Workspace ACL | ❌ Full Plan Dump | ⚠️ Web Portal | ❌ Cloud Only |
50
+ | 22 | **Minimi** | Ambient Desktop Context & Open Loops | Desktop User-Wide | `open_loops` βž” `CURRENT.md`, `resolved` βž” `confirmed` | ⚠️ Sandbox | ⚠️ Active Loop Limit | ⚠️ Mac Helper | βœ… 100% Local (macOS) |
51
+ | 23 | **Mem.ai** | AI-First Associative Note Graph | Global User Notes | `is_archived: false` βž” `confirmed`, `true` βž” `superseded` | ⚠️ SOC2 / Cloud | ❌ Cloud Search Dump | ⚠️ OAuth Sync | ❌ Cloud SaaS |
52
+ | 24 | **AgentMemory** | Rust `iii-engine` + SQLite State Store | Global (`~/.local/share/agentmemory`)| `crystal/lesson` βž” `confirmed`, `superseded` βž” `superseded` | ❌ None (Raw SQL) | ❌ Unbounded SQL | ⚠️ Daemon Required | βœ… Local Binary |
53
+
54
+ ---
55
+
56
+ ## 3. Structural Preservation & State Transition Rules
57
+
58
+ When migrating memories from external providers into Muse Memory, the migrator executes strict deterministic state preservation:
59
+
60
+ ```
61
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
62
+ β”‚ Source Provider Memory State β”‚
63
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
64
+ β”‚
65
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
66
+ β–Ό β–Ό β–Ό
67
+ [Live / Active] [Deprecated] [Active Loops]
68
+ [Confirmed / Open] [Archived] [Human / Core]
69
+ β”‚ β”‚ β”‚
70
+ β–Ό β–Ό β–Ό
71
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
72
+ β”‚ status: confirmedβ”‚β”‚status: supersededβ”‚β”‚ CURRENT.md β”‚
73
+ β”‚ (or active) β”‚β”‚ (or stale) β”‚β”‚ (Hard Pin) β”‚
74
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
75
+ ```
76
+
77
+ 1. **Active / Valid Knowledge**:
78
+ - Mapped to `status: confirmed` (or `status: active`).
79
+ - If tagged with verification metadata, mapped to `verification: { level: "independently-verified", verified_by: "migrator" }`.
80
+ 2. **Archived / Deprecated / Superseded Knowledge**:
81
+ - Mapped to `status: superseded` (or `status: stale`).
82
+ - Retains historical links and deprecation reason (e.g. `reason: "Imported as archived from <provider>"`).
83
+ 3. **Core Persona / Open Loops / In-Progress Tasks**:
84
+ - Appended directly to `.memory/CURRENT.md` (or `~/.memory/CURRENT.md`) as active working constraints.
85
+ 4. **Scope Isolation**:
86
+ - Workspace-specific providers (Beads, Kungfu, ByteRover, local `.everos/`) βž” Imported to `.memory/` in the active repository.
87
+ - User-wide providers (Mem0, Letta, Supermemory, AgentMemory) βž” Imported to `~/.memory/` globally.
88
+ 5. **Zero-Leakage Interception**:
89
+ - All extracted memory texts pass through `scanSecrets(text)` before write. If credentials are detected, the payload is either redacted or blocked with an audit warning.
90
+
91
+ ---
92
+
93
+ ## 4. Autonomous Migrator Architecture & Engine Design
94
+
95
+ ### Pipeline Modules
96
+
97
+ ```
98
+ musememory/
99
+ β”œβ”€β”€ src/
100
+ β”‚ β”œβ”€β”€ migrator/
101
+ β”‚ β”‚ β”œβ”€β”€ types.ts # Migrator interfaces & provider signatures
102
+ β”‚ β”‚ β”œβ”€β”€ detect.ts # Fast scanner detecting active providers
103
+ β”‚ β”‚ β”œβ”€β”€ engine.ts # Ingestion pipeline & Vibeguard sanitizer
104
+ β”‚ β”‚ └── adapters/
105
+ β”‚ β”‚ β”œβ”€β”€ sqlite.ts # Generic SQLite reader (AgentMemory, Mem0, Memori)
106
+ β”‚ β”‚ β”œβ”€β”€ markdown.ts # Markdown parser (ByteRover, EverOS, Beads, SecondBrain)
107
+ β”‚ β”‚ β”œβ”€β”€ json.ts # Structured JSON parser (Letta, Kungfu, ACE, Minimi)
108
+ β”‚ β”‚ └── logs.ts # Log & session transcript extractor (Supermemory)
109
+ ```
110
+
111
+ ### Detection Heuristics Table
112
+
113
+ ```typescript
114
+ export const PROVIDER_DETECTORS = [
115
+ {
116
+ id: "agentmemory",
117
+ name: "AgentMemory",
118
+ paths: [
119
+ "~/.local/share/agentmemory/state_store.db",
120
+ "~/.agentmemory/standalone.json"
121
+ ],
122
+ adapter: "agentmemory"
123
+ },
124
+ {
125
+ id: "supermemory",
126
+ name: "Supermemory",
127
+ paths: [
128
+ "~/.supermemory",
129
+ "~/.opencode-supermemory.log"
130
+ ],
131
+ adapter: "supermemory"
132
+ },
133
+ {
134
+ id: "beads",
135
+ name: "Beads",
136
+ paths: [
137
+ ".beads/beads.json",
138
+ ".beads"
139
+ ],
140
+ adapter: "beads",
141
+ scope: "local"
142
+ },
143
+ {
144
+ id: "mem0",
145
+ name: "Mem0",
146
+ paths: [
147
+ "~/.mem0/mem0.db",
148
+ ".mem0/mem0.json"
149
+ ],
150
+ adapter: "mem0"
151
+ },
152
+ {
153
+ id: "letta",
154
+ name: "Letta Code / MemGPT",
155
+ paths: [
156
+ "~/.letta",
157
+ "~/.memgpt",
158
+ ".letta"
159
+ ],
160
+ adapter: "letta"
161
+ },
162
+ {
163
+ id: "everos",
164
+ name: "EverOS",
165
+ paths: [
166
+ ".everos/memories",
167
+ "~/.everos"
168
+ ],
169
+ adapter: "everos"
170
+ },
171
+ {
172
+ id: "byterover",
173
+ name: "ByteRover",
174
+ paths: [
175
+ ".byterover",
176
+ "~/.byterover"
177
+ ],
178
+ adapter: "byterover",
179
+ scope: "local"
180
+ },
181
+ {
182
+ id: "kungfu",
183
+ name: "Kungfu",
184
+ paths: [
185
+ ".kungfu/checkpoints",
186
+ "~/.kungfu"
187
+ ],
188
+ adapter: "kungfu",
189
+ scope: "local"
190
+ },
191
+ {
192
+ id: "minimi",
193
+ name: "Project Minimi",
194
+ paths: [
195
+ "~/Library/Application Support/Minimi",
196
+ "~/.minimi"
197
+ ],
198
+ adapter: "minimi"
199
+ }
200
+ ];
201
+ ```
202
+
203
+ ---
204
+
205
+ ## 5. Implementation Phases & Roadmap
206
+
207
+ - **Phase 2.1: Migrator Detection & Adapter Engine**:
208
+ - Implement `src/migrator/detect.ts` to scan local workspace and home directories.
209
+ - Implement adapters for SQLite, Markdown trees, JSON dumps, and JSONL transcripts.
210
+ - **Phase 2.2: First-Install Auto-Detection Hook**:
211
+ - In `src/cli.ts` (`memory init` & `memory connect`), detect existing providers and offer 1-command migration (`memory migrate --all`).
212
+ - **Phase 2.3: State Preservation & Audit Integration**:
213
+ - Map active, archived, and working constraints accurately.
214
+ - Log audit events in `.memory/audit.jsonl` with `operation: "import"` / `operation: "migration"`.
215
+ - **Phase 2.4: Verification & Automated Test Suites**:
216
+ - End-to-end tests for multi-provider import and secret redaction.
217
+
218
+ ---
219
+
220
+ ## 6. Sources & References
221
+
222
+ 1. Supermemory: `https://github.com/supermemoryai/supermemory`
223
+ 2. Cognee: `https://github.com/topoteretes/cognee`
224
+ 3. Beads: `https://github.com/gastownhall/beads`
225
+ 4. Memori: `https://github.com/MemoriLabs/Memori`
226
+ 5. memU: `https://github.com/NevaMind-AI/memU`
227
+ 6. EverOS: `https://github.com/EverMind-AI/EverOS`
228
+ 7. Semantica: `https://github.com/semantica-agi/semantica`
229
+ 8. Honcho: `https://github.com/plastic-labs/honcho`
230
+ 9. Kungfu: `https://github.com/kungfu-systems/kungfu`
231
+ 10. Letta Code: `https://github.com/letta-ai/letta-code`
232
+ 11. MemSearch: `https://github.com/zilliztech/memsearch`
233
+ 12. ACE: `https://github.com/kayba-ai/agentic-context-engine`
234
+ 13. Actx0: `https://actx0.com/`
235
+ 14. ByteRover: `https://www.byterover.dev/`
236
+ 15. Clawdi: `https://www.clawdi.ai/`
237
+ 16. Pensieve: `https://pensieve.uk/`
238
+ 17. Liminary: `https://liminary.io/`
239
+ 18. Dvina: `https://dvina.ai/`
240
+ 19. Mem0: `https://mem0.ai/`
241
+ 20. Second Brain Cloudflare: `https://github.com/rahilp/second-brain-cloudflare`
242
+ 21. Rory Plans: `https://www.roryplans.ai/`
243
+ 22. Project Minimi: `https://www.projectminimi.com/`
244
+ 23. Mem.ai: `https://get.mem.ai/`
245
+ 24. AgentMemory: `https://github.com/rohitg00/agentmemory`