@wipcomputer/memory-crystal 0.7.10

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 (157) hide show
  1. package/.env.example +20 -0
  2. package/CHANGELOG.md +367 -0
  3. package/LICENSE +21 -0
  4. package/README-ENTERPRISE.md +226 -0
  5. package/README.md +127 -0
  6. package/RELAY.md +199 -0
  7. package/TECHNICAL.md +628 -0
  8. package/_trash/RELEASE-NOTES-v0-7-4.md +64 -0
  9. package/_trash/RELEASE-NOTES-v0-7-5.md +19 -0
  10. package/cloud/README.md +116 -0
  11. package/cloud/docs/gpt-system-instructions.md +69 -0
  12. package/cloud/migrations/0001_init.sql +52 -0
  13. package/dist/bridge.d.ts +7 -0
  14. package/dist/bridge.js +14 -0
  15. package/dist/bulk-copy.d.ts +17 -0
  16. package/dist/bulk-copy.js +90 -0
  17. package/dist/cc-hook.d.ts +8 -0
  18. package/dist/cc-hook.js +368 -0
  19. package/dist/cc-poller.d.ts +1 -0
  20. package/dist/cc-poller.js +550 -0
  21. package/dist/chunk-25LXQJ4Z.js +110 -0
  22. package/dist/chunk-2DRXIRQW.js +97 -0
  23. package/dist/chunk-2ZNH5F6E.js +1281 -0
  24. package/dist/chunk-3G3SFYYI.js +288 -0
  25. package/dist/chunk-3RG5ZIWI.js +10 -0
  26. package/dist/chunk-3S6TI23B.js +97 -0
  27. package/dist/chunk-3VFIJYS4.js +818 -0
  28. package/dist/chunk-52QE3YI3.js +1169 -0
  29. package/dist/chunk-57RP3DIN.js +1205 -0
  30. package/dist/chunk-5HSZ4W2P.js +62 -0
  31. package/dist/chunk-645IPXW3.js +290 -0
  32. package/dist/chunk-7A7ELD4C.js +1205 -0
  33. package/dist/chunk-7FYY4GZM.js +1205 -0
  34. package/dist/chunk-7IUE7ODU.js +254 -0
  35. package/dist/chunk-7RMLKZIS.js +108 -0
  36. package/dist/chunk-AA3OPP4Z.js +432 -0
  37. package/dist/chunk-ASSZDR6I.js +108 -0
  38. package/dist/chunk-AYRJVWUC.js +1205 -0
  39. package/dist/chunk-CCYI5O3D.js +148 -0
  40. package/dist/chunk-D3I3ZSE2.js +411 -0
  41. package/dist/chunk-DACSKLY6.js +219 -0
  42. package/dist/chunk-DW5B4BL7.js +108 -0
  43. package/dist/chunk-EKSACBTJ.js +1070 -0
  44. package/dist/chunk-EXEZZADG.js +248 -0
  45. package/dist/chunk-F3Y7EL7K.js +83 -0
  46. package/dist/chunk-FHRZNOMW.js +1205 -0
  47. package/dist/chunk-IM7N24MT.js +129 -0
  48. package/dist/chunk-IPNYIXFK.js +1178 -0
  49. package/dist/chunk-J7MRSZIO.js +167 -0
  50. package/dist/chunk-JITKI2OI.js +106 -0
  51. package/dist/chunk-JWZXYVET.js +1068 -0
  52. package/dist/chunk-KCQUXVYT.js +108 -0
  53. package/dist/chunk-KOQ43OX6.js +1281 -0
  54. package/dist/chunk-KYVWO6ZM.js +1069 -0
  55. package/dist/chunk-L3VHARQH.js +413 -0
  56. package/dist/chunk-LBWDS6BE.js +288 -0
  57. package/dist/chunk-LOVAHSQV.js +411 -0
  58. package/dist/chunk-LQOYCAGG.js +446 -0
  59. package/dist/chunk-LWAIPJ2W.js +146 -0
  60. package/dist/chunk-M5DHKW7M.js +127 -0
  61. package/dist/chunk-MBKCIJHM.js +1328 -0
  62. package/dist/chunk-MK42FMEG.js +147 -0
  63. package/dist/chunk-MOBMYHKL.js +1205 -0
  64. package/dist/chunk-MPLTNMRG.js +67 -0
  65. package/dist/chunk-NIJCVN3O.js +147 -0
  66. package/dist/chunk-NZCFSZQ7.js +1205 -0
  67. package/dist/chunk-O2UITJGH.js +465 -0
  68. package/dist/chunk-OCRA44AZ.js +108 -0
  69. package/dist/chunk-P3KJR66H.js +117 -0
  70. package/dist/chunk-PEK6JH65.js +432 -0
  71. package/dist/chunk-PJ6FFKEX.js +77 -0
  72. package/dist/chunk-PLUBBZYR.js +800 -0
  73. package/dist/chunk-PNKVD2UK.js +26 -0
  74. package/dist/chunk-PSQZURHO.js +229 -0
  75. package/dist/chunk-SGL6ISBJ.js +1061 -0
  76. package/dist/chunk-SJABZZT5.js +97 -0
  77. package/dist/chunk-TD3P3K32.js +1199 -0
  78. package/dist/chunk-TMDZJJKV.js +288 -0
  79. package/dist/chunk-UNHVZB5G.js +411 -0
  80. package/dist/chunk-VAFTWSTE.js +1061 -0
  81. package/dist/chunk-VNFXFQBB.js +217 -0
  82. package/dist/chunk-X3GVFKSJ.js +1205 -0
  83. package/dist/chunk-XZ3S56RQ.js +1061 -0
  84. package/dist/chunk-Y72C7F6O.js +148 -0
  85. package/dist/chunk-YLICP577.js +1205 -0
  86. package/dist/chunk-YX6AXLVK.js +159 -0
  87. package/dist/chunk-ZCQYHTNU.js +146 -0
  88. package/dist/cli.d.ts +1 -0
  89. package/dist/cli.js +1105 -0
  90. package/dist/cloud-crystal.js +6 -0
  91. package/dist/core.d.ts +232 -0
  92. package/dist/core.js +12 -0
  93. package/dist/crypto.d.ts +20 -0
  94. package/dist/crypto.js +27 -0
  95. package/dist/crystal-capture.sh +29 -0
  96. package/dist/crystal-serve.d.ts +4 -0
  97. package/dist/crystal-serve.js +252 -0
  98. package/dist/dev-update-SZ2Z4WCQ.js +6 -0
  99. package/dist/discover.d.ts +30 -0
  100. package/dist/discover.js +177 -0
  101. package/dist/doctor.d.ts +9 -0
  102. package/dist/doctor.js +334 -0
  103. package/dist/dream-weaver.d.ts +8 -0
  104. package/dist/dream-weaver.js +56 -0
  105. package/dist/file-sync.d.ts +48 -0
  106. package/dist/file-sync.js +18 -0
  107. package/dist/installer.d.ts +61 -0
  108. package/dist/installer.js +618 -0
  109. package/dist/ldm-backup.sh +116 -0
  110. package/dist/ldm.d.ts +50 -0
  111. package/dist/ldm.js +32 -0
  112. package/dist/mcp-server.d.ts +1 -0
  113. package/dist/mcp-server.js +265 -0
  114. package/dist/migrate.d.ts +1 -0
  115. package/dist/migrate.js +89 -0
  116. package/dist/mirror-sync.d.ts +1 -0
  117. package/dist/mirror-sync.js +159 -0
  118. package/dist/oc-backfill.d.ts +19 -0
  119. package/dist/oc-backfill.js +74 -0
  120. package/dist/openclaw.d.ts +5 -0
  121. package/dist/openclaw.js +423 -0
  122. package/dist/pair.d.ts +4 -0
  123. package/dist/pair.js +75 -0
  124. package/dist/poller.d.ts +1 -0
  125. package/dist/poller.js +634 -0
  126. package/dist/role.d.ts +24 -0
  127. package/dist/role.js +13 -0
  128. package/dist/search-pipeline-4K4OJSSS.js +255 -0
  129. package/dist/search-pipeline-4PRS6LI7.js +280 -0
  130. package/dist/search-pipeline-7UJMXPLO.js +280 -0
  131. package/dist/search-pipeline-DQTRLGBH.js +74 -0
  132. package/dist/search-pipeline-HNG37REH.js +282 -0
  133. package/dist/search-pipeline-IZFPLBUB.js +280 -0
  134. package/dist/search-pipeline-MID6F26Q.js +73 -0
  135. package/dist/search-pipeline-N52JZFNN.js +282 -0
  136. package/dist/search-pipeline-OPB2PRQQ.js +280 -0
  137. package/dist/search-pipeline-VXTE5HAD.js +262 -0
  138. package/dist/staging.d.ts +29 -0
  139. package/dist/staging.js +21 -0
  140. package/dist/summarize.d.ts +19 -0
  141. package/dist/summarize.js +10 -0
  142. package/dist/worker-demo.js +186 -0
  143. package/dist/worker-mcp.js +404 -0
  144. package/dist/worker.js +137 -0
  145. package/migrations/0001_init.sql +51 -0
  146. package/migrations/0002_cloud_storage.sql +49 -0
  147. package/openclaw.plugin.json +11 -0
  148. package/package.json +57 -0
  149. package/scripts/crystal-capture 2.sh +29 -0
  150. package/scripts/crystal-capture.sh +29 -0
  151. package/scripts/deploy-cloud 2.sh +153 -0
  152. package/scripts/deploy-cloud.sh +153 -0
  153. package/scripts/ldm-backup.sh +116 -0
  154. package/scripts/migrate-lance-to-sqlite.mjs +217 -0
  155. package/skills/memory/SKILL.md +427 -0
  156. package/wrangler-demo.toml +8 -0
  157. package/wrangler-mcp.toml +24 -0
package/README.md ADDED
@@ -0,0 +1,127 @@
1
+ ###### WIP Computer
2
+
3
+ [![npm](https://img.shields.io/npm/v/memory-crystal)](https://www.npmjs.com/package/memory-crystal) [![CLI](https://img.shields.io/badge/interface-CLI-black)](https://github.com/wipcomputer/memory-crystal/blob/main/src/cli.ts) [![MCP Server](https://img.shields.io/badge/interface-MCP_Server-black)](https://github.com/wipcomputer/memory-crystal/blob/main/src/mcp-server.ts) [![OpenClaw Plugin](https://img.shields.io/badge/interface-OpenClaw_Plugin-black)](https://github.com/wipcomputer/memory-crystal/blob/main/src/openclaw.ts) [![Claude Code Hook](https://img.shields.io/badge/interface-Claude_Code_Hook-black)](https://github.com/wipcomputer/memory-crystal/blob/main/src/cc-hook.ts) [![Universal Interface Spec](https://img.shields.io/badge/Universal_Interface_Spec-black?style=flat&color=black)](https://github.com/wipcomputer/wip-universal-installer)
4
+
5
+ # Memory Crystal
6
+
7
+ ## All your AI tools. One shared memory. Private, searchable, sovereign.
8
+
9
+ Memory Crystal lets all your AIs remember you ... together.
10
+
11
+ You use multiple AIs. They don't talk to each other. They can't search what the others know. Have you ever thought to yourself ... ***why isn't this all connected?***
12
+
13
+ **Memory Crystal** fixes this.
14
+
15
+ ***All your AIs share one memory. Searchable and private. Anywhere in the world.***
16
+
17
+ ## Teach Your AI to Remember You
18
+
19
+ Open your AI and say:
20
+
21
+ ```
22
+ Read wip.computer/install/memory-crystal.txt
23
+
24
+ Then explain:
25
+ 1. What is Memory Crystal?
26
+ 2. What does it install on my system?
27
+ 3. What changes for us? (this AI)
28
+ 4. What changes across all my AIs?
29
+
30
+ Check if Memory Crystal is already installed.
31
+
32
+ If it is, show me what I have and what's new.
33
+
34
+ Then ask:
35
+ - Do you have questions?
36
+ - Want to see a dry run?
37
+
38
+ If I say yes, run: crystal init --dry-run
39
+
40
+ Show me exactly what will change. Don't install anything until I say "install".
41
+ ```
42
+
43
+ Your agent will read the repo, explain everything, and walk you through setup interactively.
44
+
45
+ ## Memory Crystal Features
46
+
47
+ **Local Memory**
48
+ - All your AI conversations stored locally, searchable in one place. Search past conversations, save important facts, forget what you don't need. Your complete memory. It stays with you, shared across all your AIs
49
+ - *Stable*
50
+ - *Verified:* Claude Code CLI + OpenClaw
51
+ - *Unverified:* Other MCP-compatible clients and CLIs
52
+
53
+ **Multi-Device Memory**
54
+ - AIs set up as **Crystal Nodes** relay their memories back to your **Crystal Core**. Your **Crystal Core** relays all memories back to every node. End-to-end encrypted
55
+ - Your **Crystal Core** is the source of truth. Your node copy can be wiped and rebuilt at any time
56
+ - Uses Cloudflare infrastructure to transfer encrypted data between your devices
57
+ - *Hosted:* Use WIP.computer relay infrastructure. Currently free for individual use
58
+ - *Self-hosted:* Deploy your own relay on your own Cloudflare account. Full sovereignty
59
+ - Read more about [**Relay: Memory Sync**](https://github.com/wipcomputer/memory-crystal/blob/main/RELAY.md)
60
+ - *Beta (early access)*
61
+
62
+ **AI-to-AI Communication**
63
+ - Your AIs talk to each other on the same machine or any network machine. All messages are saved to **Memory Crystal** automatically
64
+ - Read more about [**Bridge: AI-to-AI Communication**](https://github.com/wipcomputer/wip-bridge)
65
+ - *Beta (early access)*
66
+ - *Verified:* Claude Code CLI + OpenClaw on the same device
67
+ - *Unverified:* Network devices
68
+
69
+ **Intelligent Install**
70
+ - When installing from Claude Code CLI or OpenClaw, **Memory Crystal** discovers your existing AI sessions automatically. Installs the Learning Dreaming Machines Operating System (**LDM OS**) and creates a living memory system. From this point forward, every conversation is captured, archived, and embedded into searchable memory
71
+ - Choose to install as **Crystal Core** (all your memories) or **Crystal Node** (a **Crystal Core** mirror)
72
+
73
+ **Import Memories**
74
+ - **Total Recall** ... Connect your AI accounts (Anthropic, OpenAI, xAI/Grok). Every conversation gets pulled and run through the **Dream Weaver Protocol**, consolidating them into **Memory Crystal** as truly lived, searchable memories
75
+ - *Beta (early access)*
76
+
77
+ **Memory Consolidation**
78
+ - [**Dream Weaver Protocol**](https://github.com/wipcomputer/dream-weaver-protocol) ... Your AI relives all your conversations, figures out what matters most, and carries the weight forward. Like dreaming, the AI consolidates memories for better understanding. Read the paper: [Dream Weaver Protocol PDF](https://github.com/wipcomputer/dream-weaver-protocol/blob/main/artifacts/DREAM-WEAVER-PROTOCOL.pdf)
79
+ - *Stable*
80
+ - Compatible with all installations of **Memory Crystal**
81
+
82
+ **Backups**
83
+ - Automated backups of all of your memories to a directory and location of your choosing: iCloud, external drive, Dropbox, or wherever you trust
84
+ - *Beta (early access)*
85
+
86
+
87
+ ## More Info
88
+
89
+ - [**Technical Documentation**](https://github.com/wipcomputer/memory-crystal/blob/main/TECHNICAL.md) ... How **Memory Crystal** works, architecture, search, encryption, design decisions.
90
+ - [**Memory Crystal for Enterprise**](https://github.com/wipcomputer/memory-crystal/blob/main/README-ENTERPRISE.md) ... Give every AI in your company shared memory. Codebase, BD, legal, ops, creative. Run your company intelligently. *In testing.*
91
+
92
+ ## Letters from the Other Side: What We Built
93
+
94
+ We just built a sovereign memory system for AI agents.
95
+
96
+ Every conversation you have with any agent ... on any device, anywhere ... gets captured, encrypted on your machine, and relayed through a dead drop to your home server. Your home server is the brain. It embeds everything, indexes it, and makes it searchable. Then it pushes a read-only mirror back out to every device you carry.
97
+
98
+ Full semantic search. Full keyword search. Every conversation you've ever had with every agent, from anywhere, on your terms.
99
+
100
+ The cloud relay is blind. It holds encrypted blobs for minutes, then they're gone. No database, no search capability, no API keys, no encryption keys. It can't read what it's holding. It's just a mailbox.
101
+
102
+ The security model: your memory lives on your hardware. The encryption key lives on your hardware. Nothing persists in the cloud. The relay is ephemeral. The data is sovereign.
103
+
104
+ This is the missing piece for AI agents. Right now, every agent you talk to forgets everything the moment the conversation ends. Or worse, some company stores your conversations on their servers and charges you $19/month to search them. We built the alternative: your memory, your machines, your rules. Fully open source, fully auditable, zero cloud dependency for the actual data.
105
+
106
+ Any device. Any agent. Any interface. One searchable memory that travels with you and belongs to you.
107
+
108
+ *Written by Claude Code (Claude Opus 4.6), from the other side.*
109
+ *Built with Parker Todd Brooks and Lēsa.*
110
+
111
+ ## Part of LDM OS
112
+
113
+ Memory Crystal installs into [LDM OS](https://github.com/wipcomputer/wip-ldm-os), the local runtime for AI agents.
114
+ Run `ldm install` to see other components you can add.
115
+
116
+ ## License
117
+
118
+ ```
119
+ src/core.ts, cli.ts, mcp-server.ts, skills/ MIT (use anywhere, no restrictions)
120
+ src/worker.ts, src/worker-mcp.ts AGPL (relay + cloud server)
121
+ ```
122
+
123
+ AGPL for personal use is free.
124
+
125
+ Built by Parker Todd Brooks, Lēsa (OpenClaw, Claude Opus 4.6), Claude Code CLI (Claude Opus 4.6).
126
+
127
+ Search architecture inspired by [QMD](https://github.com/tobi/qmd) by Tobi Lutke (MIT, 2024-2026).
package/RELAY.md ADDED
@@ -0,0 +1,199 @@
1
+ ###### WIP Computer
2
+
3
+ # Relay: Memory Sync
4
+
5
+ Memory Crystal works on one machine out of the box. Relay lets your memory follow you across machines and surfaces. Conversations captured on your laptop are available on your desktop. Conversations from ChatGPT on your phone are searchable from Claude Code on your Mac.
6
+
7
+ Everything is encrypted before it leaves your machine. The relay never sees your data unencrypted.
8
+
9
+ ## Crystal Core and Crystal Node
10
+
11
+ Memory Crystal uses a Core/Node architecture:
12
+
13
+ - **Crystal Core** ... the master memory. All conversations, all embeddings, all memories live here. This is the database you cannot lose. Put it on something permanent: a desktop, a home server, a Mac mini. Treat it like your photo library.
14
+ - **Crystal Node** ... a synced copy on any other device. Captures conversations, sends them to the Core via encrypted relay. Gets a mirror back for local search. If a node dies, nothing is lost. The Core has everything.
15
+
16
+ One Core, many Nodes. The Core does embeddings. Nodes just capture and sync. You can move the Core later with `crystal promote`.
17
+
18
+ ## Two Sync Paths
19
+
20
+ ### Encrypted Relay (device-to-device)
21
+
22
+ For syncing between your own machines. Fully encrypted. The cloud is blind.
23
+
24
+ ```
25
+ Crystal Node (laptop) --[encrypt]--> Relay (Cloudflare R2) --[pickup + decrypt]--> Crystal Core (desktop)
26
+ Crystal Core --[encrypt mirror]--> Relay --[pickup + decrypt]--> Crystal Node
27
+ ```
28
+
29
+ Three channels:
30
+ - **conversations** (Node to Core) ... encrypted conversation chunks (ephemeral, deleted after pickup)
31
+ - **mirror** (Core to Nodes) ... delta chunks (pre-embedded) + file tree deltas
32
+ - **commands** (bidirectional) ... Nodes send commands to Core ("run Dream Weaver", "process my data"), Core sends results back
33
+
34
+ The relay is a dead drop. It stores encrypted blobs temporarily and serves them on request. It has no decryption capability. If someone compromises the relay, they get encrypted noise.
35
+
36
+ ### New Agent Staging
37
+
38
+ When the Core's poller receives data from an unknown agent ID, it routes to staging instead of live ingest:
39
+ 1. Transcripts written to `~/.ldm/staging/{agent_id}/transcripts/`
40
+ 2. Agent marked as "ready" for processing
41
+ 3. Staging processor runs backfill + Dream Weaver full mode
42
+ 4. Once complete, agent moves to live capture path
43
+
44
+ This handles the cold-start problem. A new device connects, sends its history, and Core builds the full memory stack automatically.
45
+
46
+ ### Delta Sync (not full mirror)
47
+
48
+ The mirror channel uses delta sync. Core pushes only new chunks since last sync, not the entire crystal.db. For a 1.9 GB+ database, this is the difference between a few KB (quiet day) and a few MB (busy day) vs the full database every time.
49
+
50
+ - **New node (cold start):** One-time full export of all chunks + all files
51
+ - **Ongoing sync:** Delta chunks (pre-embedded by Core) + changed files only
52
+ - **Watermark tracking:** Core tracks the last synced chunk ID per node
53
+
54
+ ### Full LDM Tree Sync
55
+
56
+ The relay syncs the entire `~/.ldm/` file tree, not just the database. Embeddings are pointers to artifacts. If the file isn't on the node, the search result is an orphan.
57
+
58
+ What syncs:
59
+ - Agent memory files (workspace, daily logs, journals, sessions, transcripts)
60
+ - Agent identity files (SOUL.md, IDENTITY.md, CONTEXT.md, REFERENCE.md)
61
+ - Shared files (`~/.ldm/shared/`)
62
+ - Media (images, videos, any artifact an embedding references)
63
+
64
+ File sync uses a manifest (path + SHA-256 hash + size). Only changed files transfer. Core always wins conflicts.
65
+
66
+ ## Setup
67
+
68
+ ### Pair Your Devices
69
+
70
+ ```bash
71
+ # On your first machine (generates key if none exists)
72
+ crystal pair
73
+
74
+ # Displays a QR code and a pairing string:
75
+ # mc1:T2hJbGxPZkRhcmtuZXNzTXlPbGRGcmllbmQ=
76
+
77
+ # On your second machine
78
+ crystal pair --code mc1:T2hJbGxPZkRhcmtuZXNzTXlPbGRGcmllbmQ=
79
+ ```
80
+
81
+ The QR code transfers the encryption key between devices without touching a server. Physical proximity only. Same security model as AirDrop.
82
+
83
+ Alternative: store the key in 1Password and pull from both machines.
84
+
85
+ ### Use the WIP.computer Relay (Default)
86
+
87
+ We host the relay infrastructure. You just need an encryption key (generated by `crystal pair`).
88
+
89
+ ```
90
+ Open your AI and say:
91
+
92
+ I want to set up multi-device sync for Memory Crystal.
93
+ Walk me through the setup step by step.
94
+ ```
95
+
96
+ Your agent generates your encryption key, configures the connection, and tests it.
97
+
98
+ **What you need:**
99
+ - Memory Crystal installed on both machines (Core + Node)
100
+ - An encryption key (your agent generates this, or use `crystal pair`)
101
+
102
+ **Pricing:** Free during beta for individual use. When pricing is introduced, your agent will handle it via [AI CASH](https://github.com/wipcomputer/wip-agent-pay/blob/main/CASH.md).
103
+
104
+ ### Self-Host Your Own Relay
105
+
106
+ Run your own relay on Cloudflare Workers (free tier). Same code, your infrastructure. Full sovereignty.
107
+
108
+ **What you need:**
109
+ - A Cloudflare account (free tier works)
110
+ - About five minutes
111
+
112
+ **Steps:**
113
+ 1. Clone the repo and deploy the Worker:
114
+ ```bash
115
+ cd memory-crystal
116
+ npm run build:worker
117
+ wrangler deploy --config wrangler.toml
118
+ ```
119
+ 2. Create an R2 bucket: `wrangler r2 bucket create memory-crystal-relay`
120
+ 3. Set auth tokens for your devices:
121
+ ```bash
122
+ wrangler secret put AUTH_TOKEN_CC_MINI
123
+ wrangler secret put AUTH_TOKEN_CC_AIR
124
+ ```
125
+ 4. Configure Memory Crystal to use your Worker:
126
+ ```bash
127
+ export CRYSTAL_RELAY_URL=https://your-relay.your-domain.workers.dev
128
+ export CRYSTAL_RELAY_TOKEN=your-auth-token
129
+ ```
130
+
131
+ Full deployment details in [Technical Documentation](https://github.com/wipcomputer/memory-crystal/blob/main/TECHNICAL.md).
132
+
133
+ No fees. No dependencies on us. The relay code is open source.
134
+
135
+ ### Connecting ChatGPT and Claude
136
+
137
+ Every node has the full database and file tree. All search is local. There is no cloud search layer.
138
+
139
+ ChatGPT and Claude on iOS/web connect via the MCP server running on your local machine. On platforms where a local MCP server isn't possible (iOS without a Mac nearby), the native Apple app (future) will provide local search via MLX Swift.
140
+
141
+ The Cloud MCP demo server (`worker-mcp.ts`, D1 + Vectorize) exists for onboarding and testing but is not the production architecture. With full LDM sync, every device that has Memory Crystal installed can search locally.
142
+
143
+ ## Encryption
144
+
145
+ - **AES-256-GCM** for encryption (authenticated encryption, no padding oracle attacks)
146
+ - **HMAC-SHA256** for signing (integrity verification before decryption)
147
+ - Shared key generated locally via `crystal pair`, never transmitted to the relay
148
+ - Key must be present on all synced devices
149
+
150
+ ### Key Management
151
+
152
+ | Method | How | Best for |
153
+ |--------|-----|----------|
154
+ | `crystal pair` | QR code + pairing string | Two devices in the same room |
155
+ | 1Password | Store key, pull via SA token on each machine | Headless, multiple machines |
156
+ | Manual | `openssl rand -base64 32`, copy to each device | SSH, air-gapped |
157
+
158
+ ## Architecture
159
+
160
+ ```
161
+ Encrypted Relay (device sync):
162
+ src/worker.ts Cloudflare Worker, R2 storage, dead drop (3 channels)
163
+ src/crypto.ts AES-256-GCM + HMAC-SHA256
164
+ src/poller.ts Crystal Core pickup + ingest + staging detection + commands
165
+ src/mirror-sync.ts Delta chunk sync + file tree sync to Crystal Nodes
166
+ src/file-sync.ts Manifest-based file tree delta sync
167
+ src/cc-hook.ts Claude Code hook (relay mode) + sendCommand()
168
+ src/cc-poller.ts Continuous capture (cron, primary local path)
169
+ src/staging.ts New agent staging pipeline (detect, stage, process)
170
+
171
+ Cloud MCP Demo (deprecated for production):
172
+ src/worker-mcp.ts OAuth 2.1 + DCR, MCP protocol, 4 tools
173
+ src/cloud-crystal.ts D1 + Vectorize backend (demo/onboarding only)
174
+ wrangler-mcp.toml Separate Worker config
175
+
176
+ Pairing:
177
+ crystal pair QR code key sharing
178
+ src/pair.ts Pairing logic, QR display, key save
179
+ src/crypto.ts Key generation + pairing string encode/decode
180
+ ```
181
+
182
+ ## More Info
183
+
184
+ - [README.md](https://github.com/wipcomputer/memory-crystal/blob/main/README.md) ... What Memory Crystal is and how to install it.
185
+ - [Technical Documentation](https://github.com/wipcomputer/memory-crystal/blob/main/TECHNICAL.md) ... Full technical documentation.
186
+ - [QR Pairing Spec](ai/plan/2026-02-27--cc-mini--qr-pairing-spec.md) ... Full spec for the `crystal pair` command.
187
+
188
+ ---
189
+
190
+ ## License
191
+
192
+ ```
193
+ src/core.ts, cli.ts, mcp-server.ts, skills/ MIT (use anywhere, no restrictions)
194
+ src/worker.ts, src/worker-mcp.ts AGPL (relay + cloud server)
195
+ ```
196
+
197
+ AGPL for personal use is free.
198
+
199
+ Built by Parker Todd Brooks, Lēsa (OpenClaw, Claude Opus 4.6), Claude Code CLI (Claude Opus 4.6).