parallelclaw 1.0.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 (62) hide show
  1. package/CHANGELOG.md +204 -0
  2. package/HELP.md +600 -0
  3. package/LICENSE +21 -0
  4. package/MULTI_MACHINE.md +152 -0
  5. package/README.md +417 -0
  6. package/README.ru.md +740 -0
  7. package/SYNC.md +844 -0
  8. package/bot/README.md +173 -0
  9. package/bot/config.js +66 -0
  10. package/bot/inbox.js +153 -0
  11. package/bot/index.js +294 -0
  12. package/bot/nexara.js +61 -0
  13. package/bot/poll.js +304 -0
  14. package/bot/search.js +155 -0
  15. package/bot/telegram.js +96 -0
  16. package/ingest.js +2712 -0
  17. package/lib/cli/index.js +1987 -0
  18. package/lib/config.js +220 -0
  19. package/lib/db-init.js +158 -0
  20. package/lib/hook/install.js +268 -0
  21. package/lib/import-telegram.js +158 -0
  22. package/lib/ingest-file.js +779 -0
  23. package/lib/notify-click-action.js +281 -0
  24. package/lib/openclaw-channel.js +643 -0
  25. package/lib/parse-cursor.js +172 -0
  26. package/lib/parse-obsidian.js +256 -0
  27. package/lib/parse-telegram-html.js +384 -0
  28. package/lib/parse.js +175 -0
  29. package/lib/render-markdown.js +0 -0
  30. package/lib/store-doc/canonicalize.js +116 -0
  31. package/lib/store-doc/detect.js +209 -0
  32. package/lib/store-doc/extract-title.js +162 -0
  33. package/lib/sync/auth.js +80 -0
  34. package/lib/sync/cert.js +144 -0
  35. package/lib/sync/cli.js +906 -0
  36. package/lib/sync/client.js +138 -0
  37. package/lib/sync/config.js +130 -0
  38. package/lib/sync/pair.js +145 -0
  39. package/lib/sync/pull.js +158 -0
  40. package/lib/sync/push.js +305 -0
  41. package/lib/sync/replicate.js +335 -0
  42. package/lib/sync/server.js +224 -0
  43. package/lib/sync/service.js +726 -0
  44. package/lib/tasks.js +215 -0
  45. package/lib/telegram-decisions.js +165 -0
  46. package/lib/telegram-discovery.js +373 -0
  47. package/lib/telegram-notify.js +272 -0
  48. package/lib/telegram-pending.js +200 -0
  49. package/lib/web/index.js +265 -0
  50. package/lib/web/routes/conversation.js +193 -0
  51. package/lib/web/routes/conversations.js +180 -0
  52. package/lib/web/routes/dashboard.js +175 -0
  53. package/lib/web/routes/pending.js +277 -0
  54. package/lib/web/routes/settings.js +226 -0
  55. package/lib/web/static/style.css +393 -0
  56. package/lib/web/templates.js +234 -0
  57. package/package.json +84 -0
  58. package/server.js +3816 -0
  59. package/skills/install-memex/README.md +109 -0
  60. package/skills/install-memex/SKILL.md +342 -0
  61. package/skills/install-memex/examples.md +294 -0
  62. package/skills/install-memex-claw/SKILL.md +423 -0
@@ -0,0 +1,294 @@
1
+ # Example dialogues
2
+
3
+ Sample interactions when the user invokes this skill. These show typical happy paths and how the skill handles common edge cases.
4
+
5
+ > **Note (v1.1+):** The skill now leads with the **fast-path one-liner** (`curl -fsSL https://memex.parallelclaw.ai/install.sh | bash`) after Discovery โ€” see Example 0 below. The legacy five-step examples (1โ€“5 below) stay as the fallback when the agent is inside a GUI client (Cursor โ€” still needs step 2 manually after the script), the user declines curl, or the script fails.
6
+
7
+ ---
8
+
9
+ ## Example 0 ยท Fast path on Claude Code CLI (v1.1+)
10
+
11
+ > **User:** install memex
12
+ >
13
+ > **Agent:** ๐Ÿ‘‹ You're running inside Claude Code CLI. Let me run a quick discovery first.
14
+ >
15
+ > ```
16
+ > โœ“ Found Claude Code data at ~/.claude/projects/ (14 sessions)
17
+ > โœ“ Found Cowork sessions (5 subagent transcripts)
18
+ > โœ— Cursor data not found
19
+ > ```
20
+ >
21
+ > After install, memex will auto-index conversations from: **Claude Code, Cowork**. v0.10+ also auto-detects Telegram Desktop exports โ€” when you export a chat, I'll ask which to import.
22
+ >
23
+ > The fast path is a single hosted bash script that does **npm install (with EACCES auto-fix), daemon setup, Brian Chesky auto-context hook, history backfill, and `claude mcp add memex`** all in one go. Idempotent. Want me to run:
24
+ >
25
+ > ```sh
26
+ > curl -fsSL https://memex.parallelclaw.ai/install.sh | bash
27
+ > ```
28
+ >
29
+ > **User:** ok
30
+ >
31
+ > **Agent:** [runs the curl command, streams output]
32
+ >
33
+ > ```
34
+ > โ–ธ memex one-line installer
35
+ > โ–ธ Node v20.11.1 โ€” ok
36
+ > โ–ธ Installing parallelclaw from npm...
37
+ > โœ“ memex 0.9.0 ready at /Users/you/.npm-global/bin/memex
38
+ > โ–ธ Installing memex-sync (LaunchAgent + auto-context hook)...
39
+ > โœ“ daemon running (PID 41872)
40
+ > โœ“ Brian Chesky auto-context hook added to ~/.claude/settings.json
41
+ > โ–ธ Backfilling history (memex-sync scan)...
42
+ > โœ“ 87 conversations indexed
43
+ > โ–ธ Wiring MCP into Claude Code...
44
+ > โœ“ claude mcp add memex โ€” done
45
+ > โ–ธ All set. Quit Claude Code (Cmd+Q) and reopen any project. Memex will inject prior context before your first message.
46
+ > ```
47
+ >
48
+ > All five steps done in ~25 seconds. Quit Claude Code (Cmd+Q) and reopen โ€” when you open any project you've worked in, memex will inject relevant context before you even type. Try: `memex overview` from terminal to confirm.
49
+
50
+ ---
51
+
52
+ ## Example 1 ยท Happy path on a fresh Cursor install
53
+
54
+ > **User:** install memex
55
+ >
56
+ > **Agent:** ๐Ÿ‘‹ You're running inside Cursor. Let me run a quick discovery before any install actions...
57
+ >
58
+ > ```
59
+ > โœ“ Found Claude Code data at ~/.claude/projects/ (12 sessions)
60
+ > โœ“ Found Cowork sessions (4 subagent transcripts)
61
+ > โœ“ Cursor data found โ€” I'll write MCP config to ~/.cursor/mcp.json
62
+ > โœ— Continue config not found
63
+ > โœ— Zed config not found
64
+ > ```
65
+ >
66
+ > After install, memex will auto-index conversations from: **Claude Code, Cowork, Cursor**. v0.10+ Telegram capture also kicks in automatically โ€” when you export a chat from Telegram Desktop, I'll ask which to import. If you also use Obsidian, we can wire that vault in after.
67
+ >
68
+ > Ready to proceed with Step 1?
69
+ >
70
+ > **User:** yes
71
+ >
72
+ > **Agent:** Running `npm install -g parallelclaw`...
73
+ >
74
+ > ```
75
+ > + parallelclaw@0.5.4
76
+ > ```
77
+ >
78
+ > โœ“ Memex installed. Verifying: `which memex` โ†’ `/usr/local/bin/memex`. Good.
79
+ >
80
+ > Step 2: I'm about to merge a new entry into your `~/.cursor/mcp.json`. Here's the diff:
81
+ >
82
+ > ```diff
83
+ > {
84
+ > "mcpServers": {
85
+ > "github": { ... },
86
+ > + "memex": {
87
+ > + "command": "/usr/local/bin/memex"
88
+ > + }
89
+ > }
90
+ > }
91
+ > ```
92
+ >
93
+ > Looks correct? (Y/n)
94
+ >
95
+ > **User:** yes
96
+ >
97
+ > **Agent:** โœ“ Config saved.
98
+ >
99
+ > Step 3: `memex-sync install` โ€” sets up the macOS LaunchAgent that auto-captures new Claude Code / Cowork / Cursor sessions...
100
+ >
101
+ > ```
102
+ > โœ“ memex-sync installed
103
+ > โœ“ daemon running (PID 47291)
104
+ > โœ“ watching 12 sessions across 3 source roots
105
+ > ```
106
+ >
107
+ > Step 4: `memex-sync scan` to backfill existing history. This indexes everything already on your disk โ€” might take 30-90 seconds...
108
+ >
109
+ > ```
110
+ > ingested 847 messages from 12 conversations
111
+ > ```
112
+ >
113
+ > โœ“ All done. **Restart Cursor (Cmd+Q + reopen)** so it picks up the new memex tools. After restart, try:
114
+ >
115
+ > - "what does memex have in memory?"
116
+ > - "search memex for [a recent topic you worked on]"
117
+ > - "list my memex projects"
118
+
119
+ ---
120
+
121
+ ## Example 2 ยท EACCES recovery (macOS system Node) โ€” recommend B by default
122
+
123
+ > **User:** install memex
124
+ >
125
+ > **Agent:** [runs discovery, gets user OK] Step 1: `npm install -g parallelclaw`...
126
+ >
127
+ > ```
128
+ > npm error code EACCES
129
+ > npm error path: '/usr/local/lib/node_modules/parallelclaw'
130
+ > ```
131
+ >
132
+ > Hit EACCES โ€” your Node is installed in a system directory that npm can't write to without admin rights. Two fixes:
133
+ >
134
+ > **A)** Quick: `sudo npm install -g parallelclaw` โ€” one-time, requires your password
135
+ >
136
+ > **B)** Permanent fix: I'll move npm's install location to your home directory. After this, no `npm install -g` will ever ask for sudo again, for any package. Five commands, one-time.
137
+ >
138
+ > I recommend **B** โ€” it's a permanent improvement that benefits all your future Node tools, not just memex. **Proceed with B?**
139
+ >
140
+ > **User:** ok
141
+ >
142
+ > **Agent:** Running the 5 prefix-fix commands:
143
+ >
144
+ > ```sh
145
+ > mkdir -p ~/.npm-global
146
+ > npm config set prefix ~/.npm-global
147
+ > echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
148
+ > source ~/.zshrc
149
+ > npm install -g parallelclaw
150
+ > ```
151
+ >
152
+ > โœ“ Done. Verifying:
153
+ >
154
+ > ```
155
+ > which memex โ†’ /Users/macbook/.npm-global/bin/memex
156
+ > ```
157
+ >
158
+ > Now continuing to Step 2 with this path...
159
+
160
+ ---
161
+
162
+ ## Example 3 ยท Wants only Claude Code, not the daemon
163
+
164
+ > **User:** install memex but skip the daemon
165
+ >
166
+ > **Agent:** Sure โ€” that means memex will be available as a tool, but new sessions won't be auto-captured. You'll need to run `memex-sync scan` manually whenever you want to index recent sessions. Got it?
167
+ >
168
+ > **User:** yes
169
+ >
170
+ > **Agent:** [runs Steps 1, 2, 4 โ€” skipping `memex-sync install` in Step 3]
171
+ >
172
+ > โœ“ Memex installed, MCP config wired, backfill complete (847 messages from existing sessions).
173
+ >
174
+ > Since you skipped the daemon, here's how to refresh memex going forward:
175
+ > ```sh
176
+ > memex-sync scan
177
+ > ```
178
+ >
179
+ > You can install the daemon any time later: `memex-sync install`.
180
+
181
+ ---
182
+
183
+ ## Example 4 ยท Existing memex install detected
184
+
185
+ > **User:** install memex
186
+ >
187
+ > **Agent:** Quick check: `which memex` โ†’ `/usr/local/bin/memex`. You already have memex installed.
188
+ >
189
+ > Running `memex-sync status`:
190
+ > ```
191
+ > daemon running (PID 47291), watching 12 sessions
192
+ > last capture: 4 minutes ago
193
+ > ```
194
+ >
195
+ > Memex is working. What would you like to do?
196
+ >
197
+ > - **Reinstall** (e.g. to update to the latest version): I can run `npm install -g parallelclaw@latest`
198
+ > - **Add a new source** (Obsidian vault, Telegram exports, etc.)
199
+ > - **Add memex to another MCP client** (you have it in Cursor; want it in Claude Code too?)
200
+ > - **Nothing** โ€” already good
201
+
202
+ ---
203
+
204
+ ## Example 5 ยท Web-only agent (no shell access)
205
+
206
+ > **User:** install memex
207
+ >
208
+ > **Agent:** I see you're running me through claude.ai web โ€” I don't have access to your machine's shell, so I can't run `npm install` or write files for you.
209
+ >
210
+ > You have three options to install memex:
211
+ >
212
+ > 1. **CLI agents** (best UX): Open Claude Code, Cursor, or OpenClaw and ask me there. Those have shell access and will run this skill end-to-end.
213
+ >
214
+ > 2. **Manual install** (~5 minutes, you run the commands): Follow https://memex.parallelclaw.ai/#quickstart โ€” 4 steps in your terminal.
215
+ >
216
+ > 3. **One-liner from terminal**:
217
+ > ```sh
218
+ > npm install -g parallelclaw
219
+ > memex-sync install
220
+ > ```
221
+ > Then add `{"mcpServers": {"memex": {"command": "$(which memex)"}}}` to your MCP client's config file. Details: https://memex.parallelclaw.ai
222
+ >
223
+ > Which path works for you?
224
+
225
+ ---
226
+
227
+ ---
228
+
229
+ ## Example 6 ยท Right after install โ€” testing URL save (v0.6+)
230
+
231
+ > **User:** save https://en.wikipedia.org/wiki/As_We_May_Think to memex
232
+ >
233
+ > **Agent:** Fetching the page with WebFetch...
234
+ >
235
+ > ```
236
+ > โœ“ Got 12,847 chars from en.wikipedia.org
237
+ > ```
238
+ >
239
+ > Calling `memex_store_document(content, url=https://en.wikipedia.org/wiki/As_We_May_Think, title=auto)`...
240
+ >
241
+ > ```
242
+ > โœ“ stored
243
+ > conversation_id: web-d3b07a384d1b
244
+ > title: "As We May Think"
245
+ > length: 12,847 chars
246
+ > warnings: []
247
+ > ```
248
+ >
249
+ > Saved. Try searching it now: *"search memex for memex Bush 1945"* โ€” the article will show up alongside any AI chats where you discussed it.
250
+ >
251
+ > ๐Ÿ’ก By the way, you can save any URL this way โ€” Perplexity threads, blog posts, ChatGPT shares, Twitter threads, GitHub discussions. For Perplexity specifically, the thread must be made Public first (Share โ†’ Public link). For Cloudflare-protected sites, memex auto-falls back through `r.jina.ai` proxy.
252
+
253
+ ---
254
+
255
+ ---
256
+
257
+ ## Example 7 ยท MCP didn't connect โ€” agent recommends CLI fallback (v0.7+)
258
+
259
+ > **User:** ok, I installed memex. but when I ask Claude "show me what memex has", nothing happens.
260
+ >
261
+ > **Agent:** Could be a MCP-config issue with your Claude client โ€” let's verify memex itself is healthy first, separately from MCP:
262
+ >
263
+ > ```sh
264
+ > memex overview
265
+ > ```
266
+ >
267
+ > ```
268
+ > memex corpus snapshot
269
+ >
270
+ > Total: 1,247 messages in 23 conversations
271
+ >
272
+ > By source:
273
+ > claude-code 742 msgs ยท 18 chats ยท 2026-04-06 โ†’ 2026-05-15
274
+ > claude-cowork 312 msgs ยท 4 chats ยท 2026-04-06 โ†’ 2026-05-07
275
+ > ...
276
+ > ```
277
+ >
278
+ > Memex itself is healthy โ€” your data is there. The problem is the MCP wiring in your Claude client.
279
+ >
280
+ > Try `memex search "recent topic you discussed"` directly in the terminal โ€” if that returns hits, you've got a fully-working memex; it's just not exposed to your Claude session yet.
281
+ >
282
+ > Then check your Claude MCP config (`~/.claude/config.json` or equivalent) โ€” the `memex` entry should have an absolute path. Run `which memex` to get it, and verify it's there. If you need to re-do the wiring, ask me again โ€” I'll re-run step 2 of the install.
283
+
284
+ ---
285
+
286
+ ## What these examples illustrate about the skill's behavior
287
+
288
+ - **Always discover first**, then ask for confirmation before any write action
289
+ - **Show every command** before running it; show diffs for config edits
290
+ - **Recommend the better default** with a clear reason (e.g. Option B for EACCES) instead of forcing the user to weigh both options blind. Fall back to alternatives only if explicitly chosen.
291
+ - **Detect and adapt** to existing installs, missing prerequisites, partial setups
292
+ - **Refuse gracefully** when running in a context where the install can't actually work (web-only agents)
293
+
294
+ If you see the skill *not* doing one of these things, that's a bug โ€” report it at https://github.com/parallelclaw/memex-mvp/issues.