memex-mvp 0.9.0 → 0.9.1

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.
package/HELP.md CHANGED
@@ -348,7 +348,7 @@ Magic-фича. Когда ты открываешь Claude Code в проект
348
348
 
349
349
  **Технически:** SessionStart hook в `~/.claude/settings.json`. При старте каждой Claude Code сессии хук вызывает `memex context` → memex выдаёт markdown summary → Claude получает его как system message _до_ твоего первого вопроса.
350
350
 
351
- **Установка:** во время `memex-sync install` будет промпт `[Y/n]` соглашайся (Y по default'у). Или установи позже:
351
+ **Установка:** проще всего — `curl -fsSL https://memex.parallelclaw.ai/install.sh | bash` поставит memex + daemon + auto-context хук одной командой. Если ставил memex вручную — во время `memex-sync install` будет промпт `[Y/n]` (соглашайся, Y по default'у). Или установи хук позже:
352
352
 
353
353
  ```bash
354
354
  memex hook install # добавить хук
@@ -378,7 +378,7 @@ memex context --freshness-days 30 # только последние 30 дне
378
378
  1. Вызови `memex_overview`. Внимание на статус-баннер сверху:
379
379
  - 🟢 daemon работает — всё ок, может ещё не успел проиндексировать
380
380
  - 🔴 daemon установлен но не работает — `launchctl load ~/Library/LaunchAgents/com.parallelclaw.memex.sync.plist`
381
- - ⚪ daemon не установлен — `npx memex-sync install` из директории memex-mvp
381
+ - ⚪ daemon не установлен — самый простой способ: `curl -fsSL https://memex.parallelclaw.ai/install.sh | bash` (поставит сам всё). Или вручную: `memex-sync install`.
382
382
 
383
383
  ### Хочу проиндексировать существующие сессии (бэкфилл)
384
384
 
package/README.md CHANGED
@@ -26,6 +26,23 @@ MCP server → Cursor · Cline · Claude Code · Continue · Zed · Codex ·
26
26
 
27
27
  ## Install in 60 seconds
28
28
 
29
+ **One-line install (recommended):**
30
+
31
+ ```sh
32
+ curl -fsSL https://memex.parallelclaw.ai/install.sh | bash
33
+ ```
34
+
35
+ That single command:
36
+ 1. Verifies Node ≥ 20.
37
+ 2. Runs `npm install -g memex-mvp`, auto-fixing `EACCES` by moving npm's prefix to `~/.npm-global` (no `sudo` needed, ever).
38
+ 3. Installs the auto-capture daemon (`memex-sync install`) **with** the v0.8 Brian Chesky auto-context hook into `~/.claude/settings.json` (preserves existing hooks).
39
+ 4. Backfills history (`memex-sync scan`) so memex already knows about your past sessions.
40
+ 5. If `claude` (Claude Code CLI) is on PATH, runs `claude mcp add memex --scope user -- memex` to wire MCP automatically.
41
+
42
+ Idempotent — safe to re-run. To inspect the script before piping to bash: `curl -fsSL https://memex.parallelclaw.ai/install.sh | less`.
43
+
44
+ **Prefer manual install?**
45
+
29
46
  ```sh
30
47
  npm install -g memex-mvp
31
48
  memex-sync install # macOS LaunchAgent for auto-capture
package/README.ru.md CHANGED
@@ -83,6 +83,23 @@ MCP server (stdio JSON-RPC)
83
83
 
84
84
  ## Установка за 60 секунд
85
85
 
86
+ **Установка в одну строку (рекомендуется):**
87
+
88
+ ```bash
89
+ curl -fsSL https://memex.parallelclaw.ai/install.sh | bash
90
+ ```
91
+
92
+ Эта команда сама делает:
93
+ 1. Проверяет Node ≥ 20.
94
+ 2. Запускает `npm install -g memex-mvp`, и если ловит `EACCES` — сама переносит npm prefix в `~/.npm-global` (sudo больше не нужен — никогда, ни для одного `npm install -g`).
95
+ 3. Поднимает auto-capture daemon (`memex-sync install`) **вместе с** Brian Chesky auto-context хуком (v0.8+) в `~/.claude/settings.json` (другие хуки не трогает).
96
+ 4. Бэкфиллит историю (`memex-sync scan`) — memex сразу знает о твоих прошлых сессиях.
97
+ 5. Если на машине найден Claude Code CLI (`claude`), вызывает `claude mcp add memex --scope user -- memex` — MCP прописывается автоматом.
98
+
99
+ Идемпотентно — безопасно перезапускать. Хочешь сначала посмотреть скрипт: `curl -fsSL https://memex.parallelclaw.ai/install.sh | less`.
100
+
101
+ **Или вручную:**
102
+
86
103
  ```bash
87
104
  npm install -g memex-mvp
88
105
  memex-sync install # macOS LaunchAgent для auto-capture
@@ -133,14 +133,25 @@ function htmlToText(html) {
133
133
 
134
134
  /**
135
135
  * Parse a Telegram date title into Unix timestamp.
136
- * Format: "2024-01-01 14:23:45 UTC+03:00" (or "UTC-04:00", etc.)
136
+ * Telegram emits dates in the user's locale format, e.g.:
137
+ * • "2024-01-01 14:23:45 UTC+03:00" (ISO — English locale)
138
+ * • "01.01.2024 14:23:45 UTC+03:00" (European — Russian / German / etc.)
139
+ * • "01/01/2024 14:23:45 UTC+03:00" (US slash format — less common in exports)
137
140
  * Returns { tsUnix, isoString } or null if unparseable.
138
141
  */
139
142
  function parseTelegramDate(title) {
140
143
  if (!title) return null;
141
- const m = title.match(/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})(?:\s+UTC([+-])(\d{2}):(\d{2}))?$/);
142
- if (!m) return null;
143
- const [, y, mo, d, h, mi, s, sign, oh, om] = m;
144
+ let y, mo, d, h, mi, s, sign, oh, om;
145
+ // ISO: YYYY-MM-DD HH:MM:SS [UTC±HH:MM]
146
+ let m = title.match(/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})(?:\s+UTC([+-])(\d{2}):(\d{2}))?$/);
147
+ if (m) {
148
+ [, y, mo, d, h, mi, s, sign, oh, om] = m;
149
+ } else {
150
+ // European: DD.MM.YYYY HH:MM:SS [UTC±HH:MM] (also supports "/" or "-" as separator)
151
+ m = title.match(/^(\d{2})[.\/-](\d{2})[.\/-](\d{4})\s+(\d{2}):(\d{2}):(\d{2})(?:\s+UTC([+-])(\d{2}):(\d{2}))?$/);
152
+ if (!m) return null;
153
+ [, d, mo, y, h, mi, s, sign, oh, om] = m;
154
+ }
144
155
  // Construct an ISO 8601 string with the explicit offset (or UTC if absent)
145
156
  const offset = sign ? `${sign}${oh}:${om}` : 'Z';
146
157
  const iso = `${y}-${mo}-${d}T${h}:${mi}:${s}${offset}`;
@@ -246,19 +257,23 @@ function slugify(s) {
246
257
  * Falls back to directory name basename, then "Telegram chat".
247
258
  */
248
259
  function extractChatTitle(htmlContent, fallbackPath) {
249
- // Try the <title>...</title>
260
+ // PREFER the page_header — it's the actual chat name as shown in Telegram.
261
+ // The <title> tag is often the locale-specific "Exported Data" / "Telegram"
262
+ // boilerplate, which we want to avoid.
263
+ const headerM = htmlContent.match(/<div class="page_header"[\s\S]*?<div class="text bold"[^>]*>\s*([\s\S]*?)\s*<\/div>/);
264
+ if (headerM) {
265
+ const t = htmlToText(headerM[1]).trim();
266
+ if (t) return t;
267
+ }
268
+ // Fallback: <title>...</title> — strip "Chat Export" / "Telegram" / "Exported Data" suffixes
250
269
  const titleM = htmlContent.match(/<title>\s*([^<]+?)\s*<\/title>/i);
251
270
  if (titleM) {
252
271
  let t = titleM[1].trim();
253
- // Telegram titles often look like "Alice — Chat Export"
254
272
  t = t.replace(/\s*[—-]\s*(Chat Export|Telegram).*$/i, '').trim();
255
- if (t && t !== 'Telegram') return t;
256
- }
257
- // Try the page_header text
258
- const headerM = htmlContent.match(/<div class="text bold"[^>]*>\s*([\s\S]*?)\s*<\/div>/);
259
- if (headerM) {
260
- const t = htmlToText(headerM[1]).trim();
261
- if (t) return t;
273
+ // Skip locale boilerplate that Telegram itself uses as the page <title>
274
+ if (t && !/^(Telegram|Exported Data|Экспорт(ированные)? данные|Эспортированные данные)$/i.test(t)) {
275
+ return t;
276
+ }
262
277
  }
263
278
  // Fallback: dirname of the parent ChatExport_xxx folder
264
279
  if (fallbackPath) {
@@ -326,6 +341,17 @@ export function parseTelegramHtmlExport(path, opts = {}) {
326
341
  // We use a simple numeric hash so the synthetic chat_id is stable across re-imports.
327
342
  const chatId = stableChatId(chatTitle || 'Telegram chat', allMessages[0]?.date_unixtime || '0');
328
343
 
344
+ // Detect chat type from sender diversity. A `personal_chat` has at most 2 distinct
345
+ // senders (you + the other person). 3+ distinct senders → group / supergroup.
346
+ // We can't distinguish private_group vs public_supergroup from HTML alone, so we
347
+ // call it `private_group` (matches the JSON export taxonomy).
348
+ const distinctSenders = new Set();
349
+ for (const m of allMessages) {
350
+ if (m.from && m.from !== 'Unknown') distinctSenders.add(m.from);
351
+ if (distinctSenders.size > 2) break;
352
+ }
353
+ const chatType = distinctSenders.size > 2 ? 'private_group' : 'personal_chat';
354
+
329
355
  return {
330
356
  personal_information: { user_id: '' },
331
357
  chats: {
@@ -333,7 +359,7 @@ export function parseTelegramHtmlExport(path, opts = {}) {
333
359
  {
334
360
  id: chatId,
335
361
  name: chatTitle || 'Telegram chat',
336
- type: 'personal_chat',
362
+ type: chatType,
337
363
  messages: allMessages,
338
364
  },
339
365
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memex-mvp",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Local-first MCP server for cross-agent AI memory. One SQLite + FTS5 corpus across Claude Code, Cowork, Cursor, Continue, Zed, Obsidian, and Telegram — passively captured, verbatim, searchable from any MCP-compatible client.",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -7,13 +7,12 @@
7
7
  After you drop the skill into your agent (`~/.claude/skills/` for Claude Code, or your client's equivalent), saying **"install memex"** triggers a guided installation:
8
8
 
9
9
  1. **Discovery** — read-only checks for which MCP client you're using and what AI data already exists on your machine
10
- 2. **`npm install -g memex-mvp`** with EACCES fallbacks (one-shot sudo OR permanent prefix-fix; the agent asks you which)
11
- 3. **MCP config merge** — adds a single absolute-path `command` entry into your client's `mcpServers` config. Never overwrites your other servers
12
- 4. **`memex-sync install`**registers the macOS LaunchAgent for live auto-capture
13
- 5. **`memex-sync scan`**one-time backfill of every session that already exists on disk
14
- 6. **Restart hint + verification commands** — including the v0.7+ CLI fallback (`memex overview`, `memex search "foo"`) so you can verify memex works even if MCP didn't wire up cleanly
10
+ 2. **Fast path (v1.1+)** — `curl -fsSL https://memex.parallelclaw.ai/install.sh | bash`: one hosted bash script does npm install (with EACCES auto-fix to `~/.npm-global`), daemon setup, v0.8 auto-context hook, history backfill, and `claude mcp add memex` if Claude Code CLI is on PATH. Idempotent.
11
+ 3. **Fallback: manual five-step** — if curl fails, the user declines, or the agent is inside a GUI client (Cursor/Cline/Continue/Zed) where the MCP config still needs editing: `npm install -g memex-mvp` → MCP config merge `memex-sync install` → `memex-sync scan`.
12
+ 4. **MCP config merge** (only needed for GUI clients) adds a single absolute-path `command` entry into your client's `mcpServers` config. Never overwrites your other servers.
13
+ 5. **Restart hint + verification commands** including the v0.7+ CLI fallback (`memex overview`, `memex search "foo"`) so you can verify memex works even if MCP didn't wire up cleanly.
15
14
 
16
- End-to-end: **~2 minutes**, fully observable (agent shows each command before running).
15
+ End-to-end: **~60 seconds** via fast path, **~2 minutes** via manual flow, fully observable (agent shows each command before running).
17
16
 
18
17
  ## What is memex?
19
18
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: install-memex
3
3
  description: Make Claude, Cursor, Cline, Continue, and Zed remember every AI conversation forever — one local SQLite corpus shared across all of them. Installs memex (local-first MCP server) in ~2 minutes — npm install, MCP config wiring, auto-capture daemon, history backfill. No cloud, no account, verbatim storage. Also indexes Obsidian notes, Telegram chats, and any URL the user wants to save (web pages, Perplexity threads, AI chat shares — memex_store_document tool, v0.6+). Use when the user says "install memex", "set up memex", "add memory to my AI", "make my agent remember across sessions", or similar.
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  metadata:
6
6
  openclaw:
7
7
  emoji: "📚"
@@ -48,7 +48,32 @@ Scan the user's setup so you can tailor advice and tell them exactly what memex
48
48
  - "After install, memex will auto-index conversations from: [detected sources]"
49
49
  4. Wait for the user's "ok" before starting step 1.
50
50
 
51
- ## Five-step install
51
+ ## Fast path — one-line installer (try this first)
52
+
53
+ memex ships a hosted bash installer that does steps 1, 3, and 4 in a single run — and also wires up Claude Code's MCP entry if `claude` is on PATH. It's idempotent (safe to re-run), auto-fixes the `EACCES` case by moving npm's prefix to `~/.npm-global`, and prompts before enabling the auto-context hook.
54
+
55
+ Show this command to the user, explain what it does, get their **explicit ok**, then run:
56
+
57
+ ```sh
58
+ curl -fsSL https://memex.parallelclaw.ai/install.sh | bash
59
+ ```
60
+
61
+ What the script does, in order:
62
+ 1. Checks Node ≥ 20.
63
+ 2. `npm install -g memex-mvp` — on EACCES, sets `npm config set prefix ~/.npm-global`, appends PATH to `~/.zshrc`, retries.
64
+ 3. `memex-sync install` with `--auto-context yes` (Brian Chesky hook into `~/.claude/settings.json` — preserves other hooks).
65
+ 4. `memex-sync scan` — backfills existing history.
66
+ 5. `claude mcp add memex --scope user -- memex` if Claude Code CLI is detected.
67
+
68
+ After the script finishes:
69
+ - If the user is in **Claude Code (CLI)** → install is complete. Skip straight to step 5 (verification + restart).
70
+ - If the user is in **Cursor / Cline / Continue / Zed** → the npm install + daemon + auto-context + scan are done, but the GUI client's MCP config still needs the memex entry. **Skip step 1 (already installed)**, **skip step 3** (daemon already installed) and **skip step 4** (scan already ran). **Do step 2** (wire MCP into the GUI client's config) and **step 5** (verify + restart).
71
+
72
+ If the script fails for any reason — non-zero exit, weird output, user uncomfortable piping curl to bash — fall back to the **Manual five-step install** below.
73
+
74
+ To inspect what the script does first: `curl -fsSL https://memex.parallelclaw.ai/install.sh | less` (don't pipe to bash).
75
+
76
+ ## Manual five-step install (if the fast path didn't fit)
52
77
 
53
78
  Do these in order. Show each command before running it. Stop and ask if anything fails or looks wrong.
54
79
 
@@ -224,4 +249,4 @@ This is also useful for agents without native MCP support (OpenCode + Kimi, plai
224
249
 
225
250
  ## Begin
226
251
 
227
- Greet the user, confirm which MCP client you're running inside, and run the Discovery checks before any install actions.
252
+ Greet the user, confirm which MCP client you're running inside, and run the Discovery checks before any install actions. After Discovery, **propose the fast path (curl one-liner) first** — it covers ~90% of cases in one shot. Only fall back to the manual five-step install if the user objects, the script fails, or you're inside a GUI client where you'll still need to do step 2 manually after the script runs.
@@ -2,6 +2,52 @@
2
2
 
3
3
  Sample interactions when the user invokes this skill. These show typical happy paths and how the skill handles common edge cases.
4
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 / Cline / Continue / Zed — still need 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
+ > ✗ Continue / Zed not found
20
+ > ```
21
+ >
22
+ > After install, memex will auto-index conversations from: **Claude Code, Cowork**. You can drop Telegram exports into `~/.memex/inbox/` later if needed.
23
+ >
24
+ > 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:
25
+ >
26
+ > ```sh
27
+ > curl -fsSL https://memex.parallelclaw.ai/install.sh | bash
28
+ > ```
29
+ >
30
+ > **User:** ok
31
+ >
32
+ > **Agent:** [runs the curl command, streams output]
33
+ >
34
+ > ```
35
+ > ▸ memex one-line installer
36
+ > ▸ Node v20.11.1 — ok
37
+ > ▸ Installing memex-mvp from npm...
38
+ > ✓ memex 0.9.0 ready at /Users/you/.npm-global/bin/memex
39
+ > ▸ Installing memex-sync (LaunchAgent + auto-context hook)...
40
+ > ✓ daemon running (PID 41872)
41
+ > ✓ Brian Chesky auto-context hook added to ~/.claude/settings.json
42
+ > ▸ Backfilling history (memex-sync scan)...
43
+ > ✓ 87 conversations indexed
44
+ > ▸ Wiring MCP into Claude Code...
45
+ > ✓ claude mcp add memex — done
46
+ > ▸ All set. Quit Claude Code (Cmd+Q) and reopen any project. Memex will inject prior context before your first message.
47
+ > ```
48
+ >
49
+ > 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.
50
+
5
51
  ---
6
52
 
7
53
  ## Example 1 · Happy path on a fresh Cursor install