metame-cli 1.4.33 → 1.5.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 (44) hide show
  1. package/README.md +187 -48
  2. package/index.js +148 -9
  3. package/package.json +6 -3
  4. package/scripts/daemon-admin-commands.js +254 -9
  5. package/scripts/daemon-agent-commands.js +64 -6
  6. package/scripts/daemon-agent-tools.js +26 -5
  7. package/scripts/daemon-bridges.js +110 -20
  8. package/scripts/daemon-claude-engine.js +704 -268
  9. package/scripts/daemon-command-router.js +24 -8
  10. package/scripts/daemon-default.yaml +28 -4
  11. package/scripts/daemon-engine-runtime.js +275 -0
  12. package/scripts/daemon-exec-commands.js +10 -4
  13. package/scripts/daemon-notify.js +37 -1
  14. package/scripts/daemon-runtime-lifecycle.js +2 -1
  15. package/scripts/daemon-session-commands.js +52 -4
  16. package/scripts/daemon-session-store.js +2 -1
  17. package/scripts/daemon-task-scheduler.js +87 -28
  18. package/scripts/daemon-user-acl.js +26 -9
  19. package/scripts/daemon.js +81 -17
  20. package/scripts/distill.js +323 -18
  21. package/scripts/docs/agent-guide.md +12 -0
  22. package/scripts/docs/maintenance-manual.md +119 -0
  23. package/scripts/docs/pointer-map.md +88 -0
  24. package/scripts/feishu-adapter.js +6 -1
  25. package/scripts/hooks/stop-session-capture.js +243 -0
  26. package/scripts/memory-extract.js +100 -5
  27. package/scripts/memory-nightly-reflect.js +196 -11
  28. package/scripts/memory.js +134 -3
  29. package/scripts/mentor-engine.js +405 -0
  30. package/scripts/platform.js +2 -0
  31. package/scripts/providers.js +169 -21
  32. package/scripts/schema.js +12 -0
  33. package/scripts/session-analytics.js +245 -12
  34. package/scripts/skill-changelog.js +245 -0
  35. package/scripts/skill-evolution.js +288 -5
  36. package/scripts/usage-classifier.js +1 -1
  37. package/scripts/daemon-admin-commands.test.js +0 -333
  38. package/scripts/daemon-task-envelope.test.js +0 -59
  39. package/scripts/daemon-task-scheduler.test.js +0 -106
  40. package/scripts/reliability-core.test.js +0 -280
  41. package/scripts/skill-evolution.test.js +0 -113
  42. package/scripts/task-board.test.js +0 -83
  43. package/scripts/test_daemon.js +0 -1407
  44. package/scripts/utils.test.js +0 -192
package/README.md CHANGED
@@ -24,7 +24,7 @@ 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 ≥ 18:**
27
+ **Already have Node.js ≥ 22.5:**
28
28
  ```bash
29
29
  npm install -g metame-cli
30
30
  metame
@@ -38,13 +38,22 @@ metame
38
38
 
39
39
  ---
40
40
 
41
- > ### 🚀 v1.4.19Multi-User ACL + Session Context Preview
41
+ > ### 🚀 v1.4.34Mentor Mode Step 4 + Distiller/Memory Closed Loop
42
42
  >
43
- > - **Multi-user permission system**: role-based ACL (admin / member / stranger) share your bots with teammates without giving them full access. Manage users with `/user` commands.
44
- > - **Session context preview**: `/resume` and `/sessions` now show the last message snippet so you know exactly what to pick up.
45
- > - **Team Task protocol**: multi-agent task board for cross-agent collaboration. Agents can dispatch and track tasks across workspaces.
46
- > - **Layered Memory Architecture**: three-layer memory (long-term facts, session summaries, session index)all automatic.
47
- > - **Unix Socket IPC**: dispatch latency <100ms.
43
+ > - **Multi-engine runtime adapter (MVP)**: daemon now supports engine routing by project (`project.engine`) with shared execution flow for Claude/Codex.
44
+ > - **Codex session continuity**: supports `exec`/`resume`, thread id backfill, one-shot resume fallback (max once per 10 minutes per chat), and auth/rate-limit error mapping.
45
+ > - **Agent engine inference**: natural-language agent creation can infer `codex`; default `claude` keeps zero-regression (no `engine` field persisted).
46
+ > - **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.
47
+ > - **Mentor mode hooks**: pre-flight emotion breaker, context-time mentor prompt, and post-flight reflection debt registration are wired into daemon flow.
48
+ > - **Distiller Step 4**: competence signals now merge into `user_competence_map` (upgrade-by-default, downgrade only with explicit evidence).
49
+ > - **Memory extraction labels**: `memory-extract` writes concept labels into `fact_labels` (linked by fact id from `saveFacts().savedFacts`).
50
+ > - **Nightly closed loop**: nightly reflection writes back `synthesized_insight` facts and generates `knowledge_capsule` documents + facts.
51
+ > - **Postmortem artifacts**: significant sessions now produce `postmortem` markdown and `bug_lesson` facts.
52
+ > - **Memory index**: auto-generated global index of all memory documents for instant retrieval.
53
+ > - **Auto-provisioning**: first run automatically deploys default CLAUDE.md, docs, and `dispatch_to` — zero manual setup.
54
+ > - **Token budget tracking**: daily token usage monitoring with per-category breakdown and 80% warning threshold.
55
+ > - **Multi-user ACL**: role-based permissions (admin / member / stranger) with binding protection.
56
+ > - **Windows native support**: cross-platform path handling, Named Pipes IPC, GBK-safe encoding.
48
57
  >
49
58
  > Zero configuration. It just works.
50
59
 
@@ -56,7 +65,9 @@ metame
56
65
 
57
66
  Claude Code forgets you every time you switch folders. MetaMe doesn't.
58
67
 
59
- A cognitive profile (`~/.claude_profile.yaml`) follows you everywhere — not just facts like "user prefers TypeScript", but *how you think*: your decision style, cognitive load preferences, communication patterns. It learns silently from your conversations via background distillation, no effort required.
68
+ A cognitive profile (`~/.claude_profile.yaml`) follows you everywhere — not just facts like "user prefers TypeScript", but *how you think*. The profile is built on a **6-dimension soul schema**: Values, Drive, Cognition Style, Stress & Shadow, Relational, and Identity Narrative — 67 fields organized into 4 tiers (T1 locked identity → T5 system-managed evolution). First-time users go through a **Genesis Interview**: a structured deep conversation that builds your cognitive fingerprint from scratch.
69
+
70
+ Once established, the profile updates silently from your conversations via background distillation — no effort required.
60
71
 
61
72
  ```
62
73
  $ metame
@@ -65,9 +76,10 @@ $ metame
65
76
  Link Established. What are we building?
66
77
  ```
67
78
 
68
- ### 2. Full Claude Code From Your Phone
79
+ ### 2. Full Claude/Codex Sessions From Your Phone
69
80
 
70
- Your Mac runs a daemon. Your phone sends messages via Telegram or Feishu. Same Claude Code engine — same tools, same files, same session.
81
+ Your Mac runs a daemon. Your phone sends messages via Telegram or Feishu.
82
+ Engine is selected per project (`project.engine: claude|codex`) — same tools, same files, same session continuity.
71
83
 
72
84
  ```
73
85
  You (phone): Fix the auth bug in api/login.ts
@@ -80,10 +92,10 @@ Start on your laptop, continue on the train. `/stop` to interrupt, `/undo` to ro
80
92
 
81
93
  ### 3. Layered Memory That Works While You Sleep
82
94
 
83
- MetaMe's memory system runs automatically in the background — no prompts, no manual saves.
95
+ MetaMe's memory system runs automatically in the background — no prompts, no manual saves. Five layers, fully autonomous.
84
96
 
85
97
  **Layer 1 — Long-term Facts**
86
- 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.
98
+ 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.
87
99
 
88
100
  **Layer 2 — Session Continuity**
89
101
  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.
@@ -91,12 +103,20 @@ Resuming a conversation after 2+ hours? MetaMe injects a brief summary of what y
91
103
  **Layer 3 — Session Index**
92
104
  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.
93
105
 
106
+ **Layer 4 — Nightly Reflection**
107
+ 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.
108
+
109
+ **Layer 5 — Memory Index**
110
+ 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.
111
+
94
112
  ```
95
113
  [Background, while you sleep]
96
114
  idle 30min → memory consolidation triggered
97
115
  → session_tags.json updated (topics indexed)
98
116
  → facts extracted → ~/.metame/memory.db
99
117
  → session summary cached → daemon_state.json
118
+ 01:00 → nightly reflection: hot facts → decisions + lessons
119
+ 01:30 → memory index regenerated
100
120
 
101
121
  [Next morning, when you resume]
102
122
  "continue from yesterday" →
@@ -117,12 +137,14 @@ Built into the daemon. Runs every 60 seconds regardless of what's in your config
117
137
  - Detects when you go idle → generates session continuity summaries
118
138
 
119
139
  **Layer 1 — System Evolution (built-in defaults)**
120
- Three tasks shipped out of the box. They are precondition-gated and run only when useful:
140
+ Five tasks shipped out of the box. They are precondition-gated and run only when useful:
121
141
 
122
142
  ```yaml
123
143
  - cognitive-distill # 4h · has signals? → distill preferences into profile
124
- - memory-extract # 4h · scan sessions → extract long-term facts + topic tags
144
+ - memory-extract # 4h · scan sessions → extract long-term facts + concept labels
125
145
  - skill-evolve # 6h · has signals? → evolve skills from task outcomes
146
+ - nightly-reflect # 01:00 daily · hot facts → decisions/lessons + synthesized facts + capsules
147
+ - memory-index # 01:30 daily · regenerate global memory index
126
148
  ```
127
149
 
128
150
  `precondition` guards mean zero tokens burned when there's nothing to process.
@@ -181,18 +203,19 @@ Chain skills into multi-step workflows — research → write → publish — fu
181
203
 
182
204
  ### 5. Skills That Evolve Themselves
183
205
 
184
- MetaMe has a living skill ecosystem. Skills aren't static configs they grow.
206
+ MetaMe's current skill loop is queue-driven and reviewable (not magic black-box automation).
185
207
 
186
- - **Auto-discovery**: When a task fails or a capability is missing, MetaMe's skill-scout automatically searches for, installs, and verifies new skills.
187
- - **Learning by watching**: Can't automate a complex browser workflow? Say "我来演示" and MetaMe records your actions, then converts them into a reusable skill.
188
- - **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.
189
- - **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.
208
+ - **Signal capture**: task outcomes and failures are captured into evolution signals.
209
+ - **Hot/cold evolution**: `skill-evolution` runs on task hot path and heartbeat cold path.
210
+ - **Workflow proposals**: repeated multi-tool patterns are merged into workflow sketches and queued as proposals.
211
+ - **Human approval gate**: review and operate with `/skill-evo list`, `/skill-evo approve <id>`, `/skill-evo done <id>`, `/skill-evo dismiss <id>`.
212
+ - **Skill manager fallback**: when capability is missing, runtime routes to `skill-manager` skill guidance instead of blind guessing.
190
213
 
191
214
  ```
192
- Task fails → skill-scout finds a skill → installs → retries → succeeds
193
-
194
- skill-evolution-manager
195
- updates skill with lessons learned
215
+ task outcome/failure → skill signal buffer
216
+ → hot/cold evolution
217
+ → proposal queue
218
+ /skill-evo approve|done|dismiss
196
219
  ```
197
220
 
198
221
  ---
@@ -203,19 +226,21 @@ Task fails → skill-scout finds a skill → installs → retries → succeeds
203
226
  curl -fsSL https://raw.githubusercontent.com/Yaron9/MetaMe/main/install.sh | bash
204
227
  ```
205
228
 
206
- **Already have Node.js ≥ 18:**
229
+ **Already have Node.js ≥ 22.5:**
207
230
  ```bash
208
231
  npm install -g metame-cli
209
232
  metame
210
233
  ```
211
234
 
235
+ > **First run auto-provisioning:** MetaMe automatically deploys a default `CLAUDE.md`, documentation files, and the `dispatch_to` tool to `~/.metame/`. No manual setup needed.
236
+
212
237
  **Setup guide (3 minutes):**
213
238
 
214
239
  | Step | What to do | What happens |
215
240
  |------|-----------|-------------|
216
- | 1. Log in to Claude | Run `claude` and complete the login (Anthropic account or API key) | Claude Code is ready to use |
217
- | 2. Launch MetaMe | Run `metame` | Opens a Claude session with MetaMe loaded |
218
- | 3. Cognitive interview | Just chat — MetaMe will automatically start a deep interview on first run | Builds `~/.claude_profile.yaml` (your digital twin's brain) |
241
+ | 1. Log in to your engine | Run `claude` (Claude user) or `codex login` (Codex user) | Your local CLI engine is ready |
242
+ | 2. Launch MetaMe | Run `metame` (Claude) or `metame codex` (Codex) | Opens a MetaMe-initialized session |
243
+ | 3. Genesis Interview | Just chat — MetaMe will automatically start a deep soul interview on first run | Builds `~/.claude_profile.yaml` (6-dimension cognitive profile) |
219
244
  | 4. Connect phone | Say "help me set up mobile access" or "connect my phone" | Interactive wizard for Telegram/Feishu bot setup → `~/.metame/daemon.yaml` |
220
245
  | 5. Start daemon | `metame start` | Background daemon launches, bot goes online |
221
246
  | 6. Register with system | macOS: `metame daemon install-launchd` · Windows: `metame daemon install-task-scheduler` · Linux: see below | Always-on, crash recovery |
@@ -227,6 +252,68 @@ metame
227
252
  npm install -g metame-cli
228
253
  ```
229
254
 
255
+ ### Install Path By User Type
256
+
257
+ **Claude Code only (plugin path, one-liner):**
258
+ ```bash
259
+ claude plugin install github:Yaron9/MetaMe/plugin
260
+ ```
261
+
262
+ **Claude Code only (npm CLI path, one-liner):**
263
+ ```bash
264
+ npm install -g @anthropic-ai/claude-code metame-cli && claude && metame
265
+ ```
266
+
267
+ **Codex only (CLI path, one-liner):**
268
+ ```bash
269
+ npm install -g @openai/codex metame-cli && codex login && metame codex
270
+ ```
271
+
272
+ **Claude + Codex (one-liner):**
273
+ ```bash
274
+ npm install -g @anthropic-ai/claude-code @openai/codex metame-cli
275
+ ```
276
+
277
+ Then run `claude` once (Claude login), `codex login` once (Codex login), and use:
278
+ - `metame` for Claude
279
+ - `metame codex` for Codex
280
+
281
+ > `metame-cli` is engine-agnostic. It does not bundle Claude or Codex.
282
+ > You install the engine(s) separately, and MetaMe routes/launches them.
283
+
284
+ ### Install FAQ
285
+
286
+ - **Does Claude plugin mode support daemon + phone access?** Yes. Plugin mode can start the daemon (via `SessionStart` after `daemon.yaml` exists), and phone access works while the daemon is running.
287
+ - **Does `npm install -g metame-cli` install Claude or Codex?** No. It only installs MetaMe. Install `@anthropic-ai/claude-code` and/or `@openai/codex` separately.
288
+ - **If I only install one engine, does MetaMe still work?** Yes. MetaMe will run on the installed engine. `/doctor` marks the non-default missing engine as warning, not hard failure.
289
+
290
+ ### Uninstall (CLI Path)
291
+
292
+ ```bash
293
+ metame stop
294
+ npm uninstall -g metame-cli
295
+ ```
296
+
297
+ Codex-only cleanup:
298
+ ```bash
299
+ npm uninstall -g metame-cli @openai/codex
300
+ ```
301
+
302
+ Claude-only cleanup:
303
+ ```bash
304
+ npm uninstall -g metame-cli @anthropic-ai/claude-code
305
+ ```
306
+
307
+ Optional data cleanup:
308
+ ```bash
309
+ rm -rf ~/.metame ~/.claude_profile.yaml
310
+ ```
311
+
312
+ Optional service cleanup:
313
+ - macOS: `launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.metame.daemon.plist && rm -f ~/Library/LaunchAgents/com.metame.daemon.plist`
314
+ - Windows: `schtasks /delete /tn "MetaMe-Daemon" /f`
315
+ - Linux/WSL(systemd): `systemctl --user disable --now metame && rm -f ~/.config/systemd/user/metame.service`
316
+
230
317
  > **What does system registration mean?**
231
318
  > 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.
232
319
 
@@ -281,16 +368,19 @@ systemctl --user start metame
281
368
 
282
369
  | Capability | What It Does |
283
370
  |-----------|-------------|
284
- | **Cognitive Profile** | Learns how you think across sessions. Schema-enforced, 800-token budget, auto-distilled via Haiku. Lock any value with `# [LOCKED]`. |
285
- | **Layered Memory** | Three-tier memory: long-term facts (semantic recall), session summaries (continuity bridge), session index (topic tags). All automatic. |
286
- | **Mobile Bridge** | Full Claude Code via Telegram/Feishu. Stateful sessions, file transfer both ways, real-time streaming status. |
287
- | **Skill Evolution** | Self-healing skill system. Auto-discovers missing skills, learns from browser recordings, evolves after every task. Skills get smarter over time. |
288
- | **Heartbeat System** | Three-layer programmable nervous system. Layer 0 kernel always-on (zero config). Layer 1 system evolution built-in (distill + memory + skills). Layer 2 your custom scheduled tasks with `require_idle`, `precondition`, `notify`, workflows. |
371
+ | **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. |
372
+ | **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. |
373
+ | **Mobile Bridge** | Full Claude/Codex via Telegram/Feishu. Stateful sessions, file transfer both ways, real-time streaming status. |
374
+ | **Skill Evolution** | Queue-driven skill evolution: captures task signals, generates workflow proposals, and supports explicit approval/resolve via `/skill-evo` commands. |
375
+ | **Token Budget** | Daily token usage tracking with per-category breakdown. Configurable daily limit, automatic 80% warning threshold, usage history with rollover. |
376
+ | **Auto-Provisioning** | First run deploys default CLAUDE.md, documentation, and `dispatch_to` to `~/.metame/`. Subsequent runs sync scripts without overwriting user config. |
377
+ | **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. |
289
378
  | **Multi-Agent** | Multiple projects with dedicated chat groups. `/agent bind` for one-tap setup. True parallel execution. |
290
379
  | **Browser Automation** | Built-in Playwright MCP. Browser control out of the box for every user. |
291
380
  | **Cross-Platform** | Native support for macOS and Windows. Platform abstraction layer handles spawn, IPC, process management, and terminal encoding automatically. |
292
381
  | **Provider Relay** | Route through any Anthropic-compatible API. Use GPT-4, DeepSeek, Gemini — zero config file mutation. |
293
382
  | **Metacognition** | Detects behavioral patterns (decision style, comfort zones, goal drift) and injects mirror observations. Zero extra API cost. |
383
+ | **Mentor Mode** | `/mentor on|off|level|status` controls friction mode. Emotion breaker, zone-adaptive mentor prompts, and reflection debt run as optional hooks. |
294
384
  | **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. |
295
385
  | **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. |
296
386
  | **Emergency Tools** | `/doctor` diagnostics, `/mac` macOS control helpers, `/sh` raw shell, `/fix` config restore, `/undo` git-based rollback. |
@@ -399,6 +489,9 @@ All agents share your cognitive profile (`~/.claude_profile.yaml`) — they all
399
489
  | `/undo <hash>` | Roll back to a specific git checkpoint |
400
490
  | `/list` | Browse & download project files |
401
491
  | `/model` | Switch model (sonnet/opus/haiku) |
492
+ | `/engine` | Show/switch default engine (`claude`/`codex`) |
493
+ | `/distill-model` | Show/update background distill model (default: `haiku`) |
494
+ | `/mentor` | Mentor mode control: on/off/level/status |
402
495
  | `/activate` | Activate and bind the most recently created pending agent in a new group |
403
496
  | `/agent bind <name> [dir]` | Manually register group as dedicated agent |
404
497
  | `/mac` | macOS control helper: permissions check/open + AppleScript/JXA execution |
@@ -416,6 +509,34 @@ All agents share your cognitive profile (`~/.claude_profile.yaml`) — they all
416
509
  | `/teamtask <task_id>` | View task detail |
417
510
  | `/teamtask resume <task_id>` | Resume a task |
418
511
 
512
+ ## Mentor Mode (Why + How)
513
+
514
+ Mentor Mode is designed for users who want MetaMe to actively improve decision quality, not just execute commands.
515
+
516
+ - `/mentor on` — enable mentor hooks
517
+ - `/mentor off` — disable mentor hooks
518
+ - `/mentor level <0-10>` — set friction level
519
+ - `/mentor status` — show current mode/level
520
+
521
+ Runtime behavior:
522
+ - Pre-flight emotion breaker (cooldown-aware)
523
+ - Context-time mentor prompts (zone-aware: comfort/stretch/panic)
524
+ - Reflection debt registration on heavy code outputs (intense mode)
525
+
526
+ Level mapping:
527
+ - `0-3` → `gentle`
528
+ - `4-7` → `active`
529
+ - `8-10` → `intense`
530
+
531
+ ## Hook Optimizations (Default On)
532
+
533
+ MetaMe installs and maintains two core Claude hooks automatically on launch:
534
+
535
+ - `UserPromptSubmit` hook (`scripts/signal-capture.js`): captures high-signal preference/task traces with layered filtering.
536
+ - `Stop` hook (`scripts/hooks/stop-session-capture.js`): records session-end/tool-failure signals with watermark protection.
537
+
538
+ If hook installation fails, MetaMe logs and continues the session (non-blocking fallback).
539
+
419
540
  ## How It Works
420
541
 
421
542
  ```
@@ -424,32 +545,46 @@ All agents share your cognitive profile (`~/.claude_profile.yaml`) — they all
424
545
  └─────────────┘ │ (your machine, 24/7) │
425
546
  │ │
426
547
  │ ┌──────────────┐ │
427
- │ │ Claude Code │ │
428
- │ │ (same engine) │ │
548
+ │ │ Claude/Codex │ │
549
+ │ │ (same runtime)│ │
429
550
  │ └──────────────┘ │
430
551
  │ │
431
552
  │ ~/.claude_profile │
432
- │ (cognitive layer)
553
+ │ (6-dim soul schema)
433
554
  │ │
434
555
  │ ~/.metame/memory.db │
435
556
  │ session_tags.json │
436
- │ (memory layer) ← NEW
557
+ │ (5-layer memory)
558
+ │ │
559
+ │ dispatch_to (auto-deployed)│
437
560
  └──────────────────────────────┘
438
561
 
439
- idle mode → summaries + background memory tasks
440
- (automatic, precondition-gated)
562
+ idle → summaries + memory tasks
563
+ 01:00 → nightly reflection
564
+ 01:30 → memory index rebuild
441
565
  ```
442
566
 
443
- - **Profile** (`~/.claude_profile.yaml`): Your cognitive fingerprint. Injected into every Claude session via `CLAUDE.md`.
444
- - **Daemon** (`scripts/daemon.js`): Background process handling Telegram/Feishu messages, heartbeat tasks, Unix socket dispatch, and idle/sleep transitions.
445
- - **Distillation** (`scripts/distill.js`): Heartbeat task (default 4h, signal-gated) that updates your profile.
446
- - **Memory Extract** (`scripts/memory-extract.js`): Heartbeat task (default 4h, idle-gated) that extracts long-term facts and session topic tags.
447
- - **Session Summarize** (`scripts/session-summarize.js`): Generates a 2-4 sentence summary for idle sessions. Injected as context when resuming after a 2h+ gap.
567
+ - **Profile** (`~/.claude_profile.yaml`): 6-dimension soul schema. Injected into every Claude session via `CLAUDE.md`.
568
+ - **Daemon**: Background process handling Telegram/Feishu messages, heartbeat tasks, Unix socket dispatch, and idle/sleep transitions.
569
+ - **Runtime Adapter** (`scripts/daemon-engine-runtime.js`): normalizes engine args/env/event parsing across Claude/Codex.
570
+ - **Distillation**: Heartbeat task (4h, signal-gated) that updates your cognitive profile, merges competence signals, and emits postmortems for significant sessions.
571
+ - **Memory Extract**: Heartbeat task (4h, idle-gated) that extracts long-term facts, then writes concept labels (`fact_labels`) linked by fact id.
572
+ - **Nightly Reflection**: Daily at 01:00. Distills hot-zone facts into decision logs/lessons, writes back `synthesized_insight`, and generates knowledge capsules.
573
+ - **Memory Index**: Daily at 01:30. Regenerates the global memory index for fast retrieval.
574
+ - **Session Summarize**: Generates a brief summary for idle sessions. Injected as context when resuming after a 2h+ gap.
575
+
576
+ ## Scripts Docs Pointer Map
577
+
578
+ 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`).
579
+
580
+ For day-2 operations and troubleshooting (engine routing, codex login/rate-limit, compact boundary), use `scripts/docs/maintenance-manual.md`.
448
581
 
449
582
  ## Security
450
583
 
451
584
  - All data stays on your machine. No cloud, no telemetry.
452
585
  - `allowed_chat_ids` whitelist — new groups get a smart prompt: if a pending agent activation exists, they're guided to send `/activate`; otherwise they receive setup instructions.
586
+ - **Multi-user ACL**: role-based permissions (admin / member / stranger). Admins manage access via `/user` commands with hot-reload config.
587
+ - **Binding protection**: each group can only be bound to one agent. Existing bindings cannot be overwritten without explicit `force:true`.
453
588
  - `operator_ids` for shared groups — non-operators get read-only mode.
454
589
  - `~/.metame/` directory is mode 700.
455
590
  - Bot tokens stored locally, never transmitted.
@@ -460,13 +595,13 @@ All agents share your cognitive profile (`~/.claude_profile.yaml`) — they all
460
595
  |--------|-------|
461
596
  | Daemon memory (idle) | ~100 MB RSS — standard Node.js process baseline |
462
597
  | Daemon CPU (idle, between heartbeats) | ~0% — event-loop sleeping |
463
- | Cognitive profile injection | ~600 tokens/session (0.3% of 200k context) |
598
+ | Cognitive profile injection | ~800 tokens/session (0.4% of 200k context) |
464
599
  | Dispatch latency (Unix socket) | <100ms |
465
600
  | Memory consolidation (per session) | ~1,500–2,000 tokens input + ~50–300 tokens output (Haiku) |
466
- | Session summary (per session) | ~400–900 tokens input + ≤250 tokens output (Haiku) |
601
+ | Session summary (per session) | ~400–900 tokens input + ≤250 tokens output (distill model configurable) |
467
602
  | Mobile commands (`/stop`, `/list`, `/undo`) | 0 tokens |
468
603
 
469
- > 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.
604
+ > 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.
470
605
 
471
606
  ## Plugin
472
607
 
@@ -478,9 +613,13 @@ claude plugin install github:Yaron9/MetaMe/plugin
478
613
 
479
614
  Includes: cognitive profile injection, daemon (Telegram/Feishu), heartbeat tasks, layered memory, all mobile commands, slash commands (`/metame:evolve`, `/metame:daemon`, `/metame:refresh`, etc.).
480
615
 
481
- **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`.
616
+ **Current behavior (code-aligned):**
617
+ - Plugin auto-starts daemon on Claude `SessionStart` (if `~/.metame/daemon.yaml` exists).
618
+ - Daemon runs detached; phone access works while daemon is running.
619
+ - Plugin path does **not** auto-register OS service (launchd/task-scheduler/systemd). After reboot, open Claude once or run daemon start manually.
482
620
 
483
- 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.
621
+ Use the plugin if you want zero npm-global setup and Claude-integrated bootstrap.
622
+ Use npm CLI (`metame-cli`) if you want explicit system-service management and CLI-first operations.
484
623
 
485
624
  ## Contributing
486
625