metame-cli 1.4.34 β†’ 1.5.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.
Files changed (48) hide show
  1. package/README.md +136 -94
  2. package/index.js +312 -57
  3. package/package.json +8 -4
  4. package/scripts/agent-layer.js +320 -0
  5. package/scripts/daemon-admin-commands.js +328 -28
  6. package/scripts/daemon-agent-commands.js +145 -6
  7. package/scripts/daemon-agent-tools.js +163 -7
  8. package/scripts/daemon-bridges.js +110 -20
  9. package/scripts/daemon-checkpoints.js +36 -7
  10. package/scripts/daemon-claude-engine.js +849 -358
  11. package/scripts/daemon-command-router.js +31 -10
  12. package/scripts/daemon-default.yaml +28 -4
  13. package/scripts/daemon-engine-runtime.js +328 -0
  14. package/scripts/daemon-exec-commands.js +15 -7
  15. package/scripts/daemon-notify.js +37 -1
  16. package/scripts/daemon-ops-commands.js +8 -6
  17. package/scripts/daemon-runtime-lifecycle.js +129 -5
  18. package/scripts/daemon-session-commands.js +60 -25
  19. package/scripts/daemon-session-store.js +121 -13
  20. package/scripts/daemon-task-scheduler.js +129 -49
  21. package/scripts/daemon-user-acl.js +35 -9
  22. package/scripts/daemon.js +268 -33
  23. package/scripts/distill.js +327 -18
  24. package/scripts/docs/agent-guide.md +12 -0
  25. package/scripts/docs/maintenance-manual.md +155 -0
  26. package/scripts/docs/pointer-map.md +110 -0
  27. package/scripts/feishu-adapter.js +42 -13
  28. package/scripts/hooks/stop-session-capture.js +243 -0
  29. package/scripts/memory-extract.js +105 -6
  30. package/scripts/memory-nightly-reflect.js +199 -11
  31. package/scripts/memory.js +134 -3
  32. package/scripts/mentor-engine.js +405 -0
  33. package/scripts/platform.js +24 -0
  34. package/scripts/providers.js +182 -22
  35. package/scripts/schema.js +12 -0
  36. package/scripts/session-analytics.js +245 -12
  37. package/scripts/skill-changelog.js +245 -0
  38. package/scripts/skill-evolution.js +288 -5
  39. package/scripts/telegram-adapter.js +12 -8
  40. package/scripts/usage-classifier.js +1 -1
  41. package/scripts/daemon-admin-commands.test.js +0 -333
  42. package/scripts/daemon-task-envelope.test.js +0 -59
  43. package/scripts/daemon-task-scheduler.test.js +0 -106
  44. package/scripts/reliability-core.test.js +0 -280
  45. package/scripts/skill-evolution.test.js +0 -113
  46. package/scripts/task-board.test.js +0 -83
  47. package/scripts/test_daemon.js +0 -1407
  48. package/scripts/utils.test.js +0 -192
package/README.md CHANGED
@@ -24,27 +24,18 @@ No cloud. Your machine, your data.
24
24
  curl -fsSL https://raw.githubusercontent.com/Yaron9/MetaMe/main/install.sh | bash
25
25
  ```
26
26
 
27
- **Already have Node.js β‰₯ 22.5:**
28
- ```bash
29
- npm install -g metame-cli
30
- metame
31
- ```
32
-
33
- **Windows (PowerShell):**
34
- ```powershell
35
- npm install -g metame-cli
36
- metame
37
- ```
38
-
39
27
  ---
40
28
 
41
- > ### πŸš€ v1.4.33 β€” 6-Dimension Soul Schema + Nightly Reflection + Auto-Provisioning
29
+ > ### πŸš€ v1.5.0 β€” Dynamic Engine Default + Distill Coupling
42
30
  >
43
- > - **6-dimension soul schema**: cognitive profile upgraded from key-value pairs to a structured 67-field model covering Values, Drive, Cognition Style, Stress & Shadow, Relational, and Identity Narrative β€” with tier-based lock protection.
44
- > - **Nightly reflection**: every night, hot-zone facts are distilled into searchable decision logs and lessons learned.
45
- > - **Memory index**: auto-generated global index of all memory documents for instant retrieval.
46
- > - **Auto-provisioning**: first run automatically deploys default CLAUDE.md, docs, and `dispatch_to` β€” zero manual setup.
47
- > - **Token budget tracking**: daily token usage monitoring with per-category breakdown and 80% warning threshold.
31
+ > - **Dynamic default engine**: auto-detects installed CLI (claude/codex) at startup; pure-codex users work out of the box with zero config.
32
+ > - **`/engine` command**: switch global default engine from mobile (`/engine codex`), with three-layer priority: `project.engine > /engine setting > auto-detect`.
33
+ > - **Engine–distill coupling**: switching engine auto-pairs the distill model (claudeβ†’haiku, codexβ†’gpt-5.1-codex-mini) and distill binary.
34
+ > - **Engine-aware distill**: `callDistillModel` now routes through the correct CLI binary and parses codex JSON stream output.
35
+ > - **`/doctor` engine checks**: health check now validates CLI availability against the configured default engine.
36
+ > - **Multi-engine runtime adapter**: daemon supports engine routing by project (`project.engine`) with shared execution flow for Claude/Codex.
37
+ > - **Codex session continuity**: supports `exec`/`resume`, thread id backfill, one-shot resume fallback, and auth/rate-limit error mapping.
38
+ > - **Mentor mode hooks**: pre-flight emotion breaker, context-time mentor prompt, and post-flight reflection debt registration.
48
39
  > - **Multi-user ACL**: role-based permissions (admin / member / stranger) with binding protection.
49
40
  > - **Windows native support**: cross-platform path handling, Named Pipes IPC, GBK-safe encoding.
50
41
  >
@@ -69,9 +60,10 @@ $ metame
69
60
  Link Established. What are we building?
70
61
  ```
71
62
 
72
- ### 2. Full Claude Code From Your Phone
63
+ ### 2. Full Claude/Codex Sessions From Your Phone
73
64
 
74
- Your Mac runs a daemon. Your phone sends messages via Telegram or Feishu. Same Claude Code engine β€” same tools, same files, same session.
65
+ Your Mac runs a daemon. Your phone sends messages via Telegram or Feishu.
66
+ Engine is selected per project (`project.engine: claude|codex`) β€” same tools, same files, same session continuity.
75
67
 
76
68
  ```
77
69
  You (phone): Fix the auth bug in api/login.ts
@@ -87,7 +79,7 @@ Start on your laptop, continue on the train. `/stop` to interrupt, `/undo` to ro
87
79
  MetaMe's memory system runs automatically in the background β€” no prompts, no manual saves. Five layers, fully autonomous.
88
80
 
89
81
  **Layer 1 β€” Long-term Facts**
90
- When you go idle, MetaMe runs memory consolidation: extracts key decisions, patterns, and knowledge from your sessions into a persistent facts store. These are semantically recalled on every session start.
82
+ When you go idle, MetaMe runs memory consolidation: extracts key decisions, patterns, and knowledge from your sessions into a persistent facts store. Facts can also carry concept labels (`fact_labels`) for faster cross-domain retrieval.
91
83
 
92
84
  **Layer 2 β€” Session Continuity**
93
85
  Resuming a conversation after 2+ hours? MetaMe injects a brief summary of what you were working on last time β€” so you pick up where you left off without re-explaining context.
@@ -96,10 +88,10 @@ Resuming a conversation after 2+ hours? MetaMe injects a brief summary of what y
96
88
  Every session gets tagged with topics and intent. This powers future session routing: when you reference "that thing we worked on last week", MetaMe knows where to look.
97
89
 
98
90
  **Layer 4 β€” Nightly Reflection**
99
- Every night at 01:00, MetaMe reviews your most-accessed facts from the past week and distills them into high-level decision logs and operational lessons β€” searchable documents that grow your personal knowledge base over time.
91
+ Every night at 01:00, MetaMe reviews your most-accessed facts from the past week and distills them into high-level decision logs and operational lessons. Distilled outputs are also written back to `memory.db` as `synthesized_insight`, enabling retrieval in future sessions.
100
92
 
101
93
  **Layer 5 β€” Memory Index**
102
- At 01:30, an auto-generated global index (`INDEX.md`) maps every memory document across all categories. This serves as a fast lookup table so MetaMe always knows where to find relevant context.
94
+ At 01:30, an auto-generated global index (`INDEX.md`) maps every memory document across all categories (including capsules and postmortems). This serves as a fast lookup table so MetaMe always knows where to find relevant context.
103
95
 
104
96
  ```
105
97
  [Background, while you sleep]
@@ -133,9 +125,9 @@ Five tasks shipped out of the box. They are precondition-gated and run only when
133
125
 
134
126
  ```yaml
135
127
  - cognitive-distill # 4h Β· has signals? β†’ distill preferences into profile
136
- - memory-extract # 4h Β· scan sessions β†’ extract long-term facts + topic tags
128
+ - memory-extract # 4h Β· scan sessions β†’ extract long-term facts + concept labels
137
129
  - skill-evolve # 6h Β· has signals? β†’ evolve skills from task outcomes
138
- - nightly-reflect # 01:00 daily Β· hot facts β†’ decision logs + lessons learned
130
+ - nightly-reflect # 01:00 daily Β· hot facts β†’ decisions/lessons + synthesized facts + capsules
139
131
  - memory-index # 01:30 daily Β· regenerate global memory index
140
132
  ```
141
133
 
@@ -195,70 +187,91 @@ Chain skills into multi-step workflows β€” research β†’ write β†’ publish β€” fu
195
187
 
196
188
  ### 5. Skills That Evolve Themselves
197
189
 
198
- MetaMe has a living skill ecosystem. Skills aren't static configs β€” they grow.
190
+ MetaMe's current skill loop is queue-driven and reviewable (not magic black-box automation).
199
191
 
200
- - **Auto-discovery**: When a task fails or a capability is missing, MetaMe's skill-scout automatically searches for, installs, and verifies new skills.
201
- - **Learning by watching**: Can't automate a complex browser workflow? Say "ζˆ‘ζ₯ζΌ”η€Ί" and MetaMe records your actions, then converts them into a reusable skill.
202
- - **Post-task evolution**: After every significant task, the skill-evolution-manager reviews what worked and what didn't, then surgically updates the relevant skills with new knowledge.
203
- - **Composable**: Skills chain together in workflows. A `deep-research` skill feeds into `tech-writing`, which feeds into `wechat-publisher` β€” each one improving from real usage.
192
+ - **Signal capture**: task outcomes and failures are captured into evolution signals.
193
+ - **Hot/cold evolution**: `skill-evolution` runs on task hot path and heartbeat cold path.
194
+ - **Workflow proposals**: repeated multi-tool patterns are merged into workflow sketches and queued as proposals.
195
+ - **Human approval gate**: review and operate with `/skill-evo list`, `/skill-evo approve <id>`, `/skill-evo done <id>`, `/skill-evo dismiss <id>`.
196
+ - **Skill manager fallback**: when capability is missing, runtime routes to `skill-manager` skill guidance instead of blind guessing.
204
197
 
205
198
  ```
206
- Task fails β†’ skill-scout finds a skill β†’ installs β†’ retries β†’ succeeds
207
- ↓
208
- skill-evolution-manager
209
- updates skill with lessons learned
199
+ task outcome/failure β†’ skill signal buffer
200
+ β†’ hot/cold evolution
201
+ β†’ proposal queue
202
+ β†’ /skill-evo approve|done|dismiss
210
203
  ```
211
204
 
212
205
  ---
213
206
 
214
- ## Quick Start
207
+ ## Install
215
208
 
216
- ```bash
217
- curl -fsSL https://raw.githubusercontent.com/Yaron9/MetaMe/main/install.sh | bash
218
- ```
209
+ MetaMe is the orchestration layer. Claude Code and Codex are the engines. You install them together.
219
210
 
220
- **Already have Node.js β‰₯ 22.5:**
221
- ```bash
222
- npm install -g metame-cli
223
- metame
224
- ```
211
+ ### One-liner by user type
212
+
213
+ | You use | Install command | First login |
214
+ |---------|----------------|-------------|
215
+ | **Claude Code** | `npm install -g @anthropic-ai/claude-code metame-cli` | `claude` |
216
+ | **Codex** | `npm install -g @openai/codex metame-cli` | `codex login` |
217
+ | **Both** | `npm install -g @anthropic-ai/claude-code @openai/codex metame-cli` | `claude` + `codex login` |
218
+ | **Claude plugin** (no npm) | `claude plugin install github:Yaron9/MetaMe/plugin` | `claude` |
225
219
 
226
- > **First run auto-provisioning:** MetaMe automatically deploys a default `CLAUDE.md`, documentation files, and the `dispatch_to` tool to `~/.metame/`. No manual setup needed.
220
+ > **No Node.js?** Run `curl -fsSL https://raw.githubusercontent.com/Yaron9/MetaMe/main/install.sh | bash` β€” it installs Node + MetaMe for you.
221
+ >
222
+ > **Windows?** Use PowerShell/CMD natively. WSL has proxy and path issues.
223
+
224
+ ### Setup (3 minutes)
227
225
 
228
- **Setup guide (3 minutes):**
226
+ | Step | What to do |
227
+ |------|-----------|
228
+ | 1. Launch | `metame` (Claude) or `metame codex` (Codex) |
229
+ | 2. Genesis Interview | Just chat β€” MetaMe auto-starts a deep soul interview on first run β†’ builds `~/.claude_profile.yaml` |
230
+ | 3. Connect phone | Say "help me set up mobile access" β†’ interactive Telegram/Feishu bot wizard |
231
+ | 4. Start daemon | `metame start` β†’ background daemon launches, bot goes online |
232
+ | 5. Register with OS | macOS: `metame daemon install-launchd` Β· Windows: `metame daemon install-task-scheduler` |
229
233
 
230
- | Step | What to do | What happens |
231
- |------|-----------|-------------|
232
- | 1. Log in to Claude | Run `claude` and complete the login (Anthropic account or API key) | Claude Code is ready to use |
233
- | 2. Launch MetaMe | Run `metame` | Opens a Claude session with MetaMe loaded |
234
- | 3. Genesis Interview | Just chat β€” MetaMe will automatically start a deep soul interview on first run | Builds `~/.claude_profile.yaml` (6-dimension cognitive profile) |
235
- | 4. Connect phone | Say "help me set up mobile access" or "connect my phone" | Interactive wizard for Telegram/Feishu bot setup β†’ `~/.metame/daemon.yaml` |
236
- | 5. Start daemon | `metame start` | Background daemon launches, bot goes online |
237
- | 6. Register with system | macOS: `metame daemon install-launchd` Β· Windows: `metame daemon install-task-scheduler` Β· Linux: see below | Always-on, crash recovery |
234
+ > **First time?** Just run `metame` and talk naturally. Everything is conversational.
238
235
 
239
- > **First time?** Just run `metame` and talk naturally. The interview and setup are conversational β€” no commands to memorize.
236
+ ### Create your first Agent
237
+
238
+ 1. In any existing group, say: `Create an agent, directory ~/xxx, responsible for xxx`
239
+ 2. Bot replies: Agent created β€” **send `/activate` in your new group to bind it**
240
+ 3. Create a new group, add the bot, send `/activate` β†’ binding complete
241
+
242
+ > Want more Agents? Repeat the flow. Each group = independent AI workspace.
243
+
244
+ ### Update / Uninstall
240
245
 
241
- **Update MetaMe:**
242
246
  ```bash
247
+ # Update
243
248
  npm install -g metame-cli
244
- ```
245
249
 
246
- > **What does system registration mean?**
247
- > Once registered, MetaMe runs in the background automatically β€” screen locked, lid closed, woken from sleep β€” as long as the machine is on. Scheduled tasks fire on time. No terminal window needed.
250
+ # Uninstall
251
+ metame stop && npm uninstall -g metame-cli
248
252
 
249
- **Windows β€” register with Task Scheduler:**
250
-
251
- ```powershell
252
- metame daemon install-task-scheduler
253
+ # Optional: remove data
254
+ rm -rf ~/.metame ~/.claude_profile.yaml
253
255
  ```
254
256
 
255
- > The daemon auto-starts at login. Remove with: `schtasks /delete /tn "MetaMe-Daemon" /f`
257
+ Optional service cleanup:
258
+ - macOS: `launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.metame.daemon.plist && rm -f ~/Library/LaunchAgents/com.metame.daemon.plist`
259
+ - Windows: `schtasks /delete /tn "MetaMe-Daemon" /f`
260
+ - Linux/WSL: `systemctl --user disable --now metame && rm -f ~/.config/systemd/user/metame.service`
261
+
262
+ ### Platform notes
256
263
 
257
- > **Windows notes:** Emoji display uses ASCII fallback (`[OK]`, `[FAIL]`) for GBK terminal compatibility. Named Pipes replace Unix sockets for IPC. `/mac` commands are not available.
264
+ <details>
265
+ <summary>Windows</summary>
258
266
 
259
- > **Windows users: install natively, not via WSL.** WSL often fails to inherit the host's network proxy (causing npm install and Claude API timeouts), has path mapping issues, and process management doesn't interoperate. `npm install -g metame-cli` directly in PowerShell/CMD is the most reliable approach.
267
+ - Emoji auto-degrades to ASCII (`[OK]`, `[FAIL]`) for GBK compatibility
268
+ - IPC uses Named Pipes instead of Unix sockets
269
+ - `/mac` commands are not available
270
+ - **Install natively in PowerShell/CMD, not via WSL**
271
+ </details>
260
272
 
261
- **WSL2 / Linux β€” register with systemd:**
273
+ <details>
274
+ <summary>WSL2 / Linux β€” systemd registration</summary>
262
275
 
263
276
  ```bash
264
277
  cat > ~/.config/systemd/user/metame.service << 'EOF'
@@ -279,17 +292,15 @@ systemctl --user enable metame
279
292
  systemctl --user start metame
280
293
  ```
281
294
 
282
- > WSL2 requires systemd enabled first: add `[boot]\nsystemd=true` to `/etc/wsl.conf`, then restart WSL.
283
-
284
- > **WSL limitation:** `/mac` commands (macOS AppleScript/JXA automation) are not available.
295
+ > Requires systemd enabled: add `[boot]\nsystemd=true` to `/etc/wsl.conf`, then restart WSL.
285
296
 
286
- **Create your first Agent:**
297
+ </details>
287
298
 
288
- 1. In any existing group, say: `Create an agent, directory ~/xxx, responsible for xxx`
289
- 2. Bot replies: βœ… Agent created β€” **send `/activate` in your new group to bind it**
290
- 3. Create a new group, add the bot, send `/activate` β†’ binding complete
299
+ ### FAQ
291
300
 
292
- > Want more Agents? Repeat: create in any group β†’ new target group β†’ `/activate`. Each group = independent AI workspace.
301
+ - **Does plugin mode support daemon + phone?** Yes. Plugin auto-starts daemon when `daemon.yaml` exists.
302
+ - **Does MetaMe bundle Claude or Codex?** No. `metame-cli` is engine-agnostic β€” you install engine(s) separately.
303
+ - **One engine only?** Works fine. `/doctor` marks the missing engine as warning, not failure.
293
304
 
294
305
  ---
295
306
 
@@ -298,9 +309,9 @@ systemctl --user start metame
298
309
  | Capability | What It Does |
299
310
  |-----------|-------------|
300
311
  | **Cognitive Profile** | 6-dimension soul schema (Values, Drive, Cognition Style, Stress & Shadow, Relational, Identity Narrative). 67 fields, tier-locked, 800-token budget. First-time Genesis Interview builds your profile from scratch. |
301
- | **Layered Memory** | Five-tier memory: long-term facts (semantic recall), session summaries (continuity bridge), session index (topic tags), nightly reflection (decision/lesson distillation), memory index (global lookup). All automatic. |
302
- | **Mobile Bridge** | Full Claude Code via Telegram/Feishu. Stateful sessions, file transfer both ways, real-time streaming status. |
303
- | **Skill Evolution** | Self-healing skill system. Auto-discovers missing skills, learns from browser recordings, evolves after every task. Skills get smarter over time. |
312
+ | **Layered Memory** | Five-tier memory: long-term facts (+ concept labels), session summaries (continuity bridge), session index (topic tags), nightly reflection (distill + write-back), memory index (global lookup). All automatic. |
313
+ | **Mobile Bridge** | Full Claude/Codex via Telegram/Feishu. Stateful sessions, file transfer both ways, real-time streaming status. |
314
+ | **Skill Evolution** | Queue-driven skill evolution: captures task signals, generates workflow proposals, and supports explicit approval/resolve via `/skill-evo` commands. |
304
315
  | **Token Budget** | Daily token usage tracking with per-category breakdown. Configurable daily limit, automatic 80% warning threshold, usage history with rollover. |
305
316
  | **Auto-Provisioning** | First run deploys default CLAUDE.md, documentation, and `dispatch_to` to `~/.metame/`. Subsequent runs sync scripts without overwriting user config. |
306
317
  | **Heartbeat System** | Three-layer programmable nervous system. Layer 0 kernel always-on (zero config). Layer 1 system evolution built-in (5 tasks: distill + memory + skills + nightly reflection + memory index). Layer 2 your custom scheduled tasks with `require_idle`, `precondition`, `notify`, workflows. |
@@ -309,6 +320,7 @@ systemctl --user start metame
309
320
  | **Cross-Platform** | Native support for macOS and Windows. Platform abstraction layer handles spawn, IPC, process management, and terminal encoding automatically. |
310
321
  | **Provider Relay** | Route through any Anthropic-compatible API. Use GPT-4, DeepSeek, Gemini β€” zero config file mutation. |
311
322
  | **Metacognition** | Detects behavioral patterns (decision style, comfort zones, goal drift) and injects mirror observations. Zero extra API cost. |
323
+ | **Mentor Mode** | `/mentor on|off|level|status` controls friction mode. Emotion breaker, zone-adaptive mentor prompts, and reflection debt run as optional hooks. |
312
324
  | **Multi-User ACL** | Role-based permission system (admin / member / stranger). Share bots with teammates safely. Dynamic user management via `/user` commands with hot-reload config. |
313
325
  | **Team Task** | Multi-agent task board for cross-agent collaboration. Agents can create, assign, and track tasks across workspaces. N-agent session scoping for parallel team workflows. |
314
326
  | **Emergency Tools** | `/doctor` diagnostics, `/mac` macOS control helpers, `/sh` raw shell, `/fix` config restore, `/undo` git-based rollback. |
@@ -417,6 +429,9 @@ All agents share your cognitive profile (`~/.claude_profile.yaml`) β€” they all
417
429
  | `/undo <hash>` | Roll back to a specific git checkpoint |
418
430
  | `/list` | Browse & download project files |
419
431
  | `/model` | Switch model (sonnet/opus/haiku) |
432
+ | `/engine` | Show/switch default engine (`claude`/`codex`) |
433
+ | `/distill-model` | Show/update background distill model (default: `haiku`) |
434
+ | `/mentor` | Mentor mode control: on/off/level/status |
420
435
  | `/activate` | Activate and bind the most recently created pending agent in a new group |
421
436
  | `/agent bind <name> [dir]` | Manually register group as dedicated agent |
422
437
  | `/mac` | macOS control helper: permissions check/open + AppleScript/JXA execution |
@@ -434,6 +449,34 @@ All agents share your cognitive profile (`~/.claude_profile.yaml`) β€” they all
434
449
  | `/teamtask <task_id>` | View task detail |
435
450
  | `/teamtask resume <task_id>` | Resume a task |
436
451
 
452
+ ## Mentor Mode (Why + How)
453
+
454
+ Mentor Mode is designed for users who want MetaMe to actively improve decision quality, not just execute commands.
455
+
456
+ - `/mentor on` β€” enable mentor hooks
457
+ - `/mentor off` β€” disable mentor hooks
458
+ - `/mentor level <0-10>` β€” set friction level
459
+ - `/mentor status` β€” show current mode/level
460
+
461
+ Runtime behavior:
462
+ - Pre-flight emotion breaker (cooldown-aware)
463
+ - Context-time mentor prompts (zone-aware: comfort/stretch/panic)
464
+ - Reflection debt registration on heavy code outputs (intense mode)
465
+
466
+ Level mapping:
467
+ - `0-3` β†’ `gentle`
468
+ - `4-7` β†’ `active`
469
+ - `8-10` β†’ `intense`
470
+
471
+ ## Hook Optimizations (Default On)
472
+
473
+ MetaMe installs and maintains two core Claude hooks automatically on launch:
474
+
475
+ - `UserPromptSubmit` hook (`scripts/signal-capture.js`): captures high-signal preference/task traces with layered filtering.
476
+ - `Stop` hook (`scripts/hooks/stop-session-capture.js`): records session-end/tool-failure signals with watermark protection.
477
+
478
+ If hook installation fails, MetaMe logs and continues the session (non-blocking fallback).
479
+
437
480
  ## How It Works
438
481
 
439
482
  ```
@@ -442,8 +485,8 @@ All agents share your cognitive profile (`~/.claude_profile.yaml`) β€” they all
442
485
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ (your machine, 24/7) β”‚
443
486
  β”‚ β”‚
444
487
  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
445
- β”‚ β”‚ Claude Code β”‚ β”‚
446
- β”‚ β”‚ (same engine) β”‚ β”‚
488
+ β”‚ β”‚ Claude/Codex β”‚ β”‚
489
+ β”‚ β”‚ (same runtime)β”‚ β”‚
447
490
  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
448
491
  β”‚ β”‚
449
492
  β”‚ ~/.claude_profile β”‚
@@ -463,12 +506,19 @@ All agents share your cognitive profile (`~/.claude_profile.yaml`) β€” they all
463
506
 
464
507
  - **Profile** (`~/.claude_profile.yaml`): 6-dimension soul schema. Injected into every Claude session via `CLAUDE.md`.
465
508
  - **Daemon**: Background process handling Telegram/Feishu messages, heartbeat tasks, Unix socket dispatch, and idle/sleep transitions.
466
- - **Distillation**: Heartbeat task (4h, signal-gated) that updates your cognitive profile.
467
- - **Memory Extract**: Heartbeat task (4h, idle-gated) that extracts long-term facts and session topic tags.
468
- - **Nightly Reflection**: Daily at 01:00. Distills hot-zone facts into decision logs and operational lessons.
509
+ - **Runtime Adapter** (`scripts/daemon-engine-runtime.js`): normalizes engine args/env/event parsing across Claude/Codex.
510
+ - **Distillation**: Heartbeat task (4h, signal-gated) that updates your cognitive profile, merges competence signals, and emits postmortems for significant sessions.
511
+ - **Memory Extract**: Heartbeat task (4h, idle-gated) that extracts long-term facts, then writes concept labels (`fact_labels`) linked by fact id.
512
+ - **Nightly Reflection**: Daily at 01:00. Distills hot-zone facts into decision logs/lessons, writes back `synthesized_insight`, and generates knowledge capsules.
469
513
  - **Memory Index**: Daily at 01:30. Regenerates the global memory index for fast retrieval.
470
514
  - **Session Summarize**: Generates a brief summary for idle sessions. Injected as context when resuming after a 2h+ gap.
471
515
 
516
+ ## Scripts Docs Pointer Map
517
+
518
+ Use `scripts/docs/pointer-map.md` as the source-of-truth map for script entry points and Step 1-4 landing zones (`session-analytics` / `mentor-engine` / `daemon-claude-engine` / `distill` / `memory-extract` / `memory-nightly-reflect`).
519
+
520
+ For day-2 operations and troubleshooting (engine routing, codex login/rate-limit, compact boundary), use `scripts/docs/maintenance-manual.md`.
521
+
472
522
  ## Security
473
523
 
474
524
  - All data stays on your machine. No cloud, no telemetry.
@@ -488,24 +538,16 @@ All agents share your cognitive profile (`~/.claude_profile.yaml`) β€” they all
488
538
  | Cognitive profile injection | ~800 tokens/session (0.4% of 200k context) |
489
539
  | Dispatch latency (Unix socket) | <100ms |
490
540
  | Memory consolidation (per session) | ~1,500–2,000 tokens input + ~50–300 tokens output (Haiku) |
491
- | Session summary (per session) | ~400–900 tokens input + ≀250 tokens output (Haiku) |
541
+ | Session summary (per session) | ~400–900 tokens input + ≀250 tokens output (distill model configurable) |
492
542
  | Mobile commands (`/stop`, `/list`, `/undo`) | 0 tokens |
493
543
 
494
- > Both memory consolidation and session summarization run in the background via Haiku (`--model haiku`). Input is capped by code: skeleton text ≀ 3,000 chars, summary output ≀ 500 chars. Neither runs per-message β€” memory consolidation follows heartbeat schedule with idle/precondition guards, and summaries trigger once per idle session on sleep-mode transitions.
544
+ > Memory consolidation and session summarization run in the background via the configured distill model (`/distill-model`, default `haiku`). Input is capped by code: skeleton text ≀ 3,000 chars, summary output ≀ 500 chars. Neither runs per-message β€” memory consolidation follows heartbeat schedule with idle/precondition guards, and summaries trigger once per idle session on sleep-mode transitions.
495
545
 
496
546
  ## Plugin
497
547
 
498
- Install directly into Claude Code without npm:
499
-
500
- ```bash
501
- claude plugin install github:Yaron9/MetaMe/plugin
502
- ```
503
-
504
- Includes: cognitive profile injection, daemon (Telegram/Feishu), heartbeat tasks, layered memory, all mobile commands, slash commands (`/metame:evolve`, `/metame:daemon`, `/metame:refresh`, etc.).
505
-
506
- **One key difference from the npm CLI:** the plugin daemon starts when you open Claude Code and stops when you close it. It does not run 24/7 in the background. For always-on mobile access (receiving messages while Claude Code is closed), use the npm CLI with `metame daemon install-launchd`.
548
+ Install directly into Claude Code without npm: `claude plugin install github:Yaron9/MetaMe/plugin`
507
549
 
508
- Use the plugin if you prefer not to install a global npm package and only need mobile access while Claude Code is open. Use the npm CLI (`metame-cli`) for 24/7 daemon, the `metame` command, and first-run interview.
550
+ All features included. Plugin auto-starts daemon on `SessionStart` (if `daemon.yaml` exists). Does **not** auto-register OS service β€” after reboot, open Claude once or start daemon manually.
509
551
 
510
552
  ## Contributing
511
553