metame-cli 1.5.3 β†’ 1.5.5

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 (51) hide show
  1. package/README.md +60 -18
  2. package/index.js +352 -79
  3. package/package.json +2 -2
  4. package/scripts/agent-layer.js +4 -2
  5. package/scripts/bin/dispatch_to +178 -90
  6. package/scripts/daemon-admin-commands.js +353 -105
  7. package/scripts/daemon-agent-commands.js +434 -66
  8. package/scripts/daemon-bridges.js +477 -68
  9. package/scripts/daemon-claude-engine.js +1267 -674
  10. package/scripts/daemon-command-router.js +205 -27
  11. package/scripts/daemon-command-session-route.js +118 -0
  12. package/scripts/daemon-default.yaml +7 -0
  13. package/scripts/daemon-engine-runtime.js +96 -20
  14. package/scripts/daemon-exec-commands.js +108 -49
  15. package/scripts/daemon-file-browser.js +64 -7
  16. package/scripts/daemon-notify.js +18 -4
  17. package/scripts/daemon-ops-commands.js +16 -2
  18. package/scripts/daemon-remote-dispatch.js +55 -1
  19. package/scripts/daemon-runtime-lifecycle.js +87 -0
  20. package/scripts/daemon-session-commands.js +102 -45
  21. package/scripts/daemon-session-store.js +497 -66
  22. package/scripts/daemon-siri-bridge.js +234 -0
  23. package/scripts/daemon-siri-imessage.js +209 -0
  24. package/scripts/daemon-task-scheduler.js +10 -2
  25. package/scripts/daemon.js +697 -179
  26. package/scripts/daemon.yaml +7 -0
  27. package/scripts/docs/agent-guide.md +36 -3
  28. package/scripts/docs/hook-config.md +134 -0
  29. package/scripts/docs/maintenance-manual.md +162 -5
  30. package/scripts/docs/pointer-map.md +60 -5
  31. package/scripts/feishu-adapter.js +7 -15
  32. package/scripts/hooks/doc-router.js +29 -0
  33. package/scripts/hooks/hook-utils.js +61 -0
  34. package/scripts/hooks/intent-doc-router.js +54 -0
  35. package/scripts/hooks/intent-engine.js +72 -0
  36. package/scripts/hooks/intent-file-transfer.js +51 -0
  37. package/scripts/hooks/intent-memory-recall.js +35 -0
  38. package/scripts/hooks/intent-ops-assist.js +54 -0
  39. package/scripts/hooks/intent-task-create.js +35 -0
  40. package/scripts/hooks/intent-team-dispatch.js +106 -0
  41. package/scripts/hooks/team-context.js +143 -0
  42. package/scripts/intent-registry.js +59 -0
  43. package/scripts/memory-extract.js +59 -0
  44. package/scripts/memory-nightly-reflect.js +109 -43
  45. package/scripts/memory.js +55 -17
  46. package/scripts/mentor-engine.js +6 -0
  47. package/scripts/schema.js +1 -0
  48. package/scripts/self-reflect.js +110 -12
  49. package/scripts/session-analytics.js +160 -0
  50. package/scripts/signal-capture.js +1 -1
  51. package/scripts/team-dispatch.js +315 -0
package/README.md CHANGED
@@ -26,15 +26,17 @@ curl -fsSL https://raw.githubusercontent.com/Yaron9/MetaMe/main/install.sh | bas
26
26
 
27
27
  ---
28
28
 
29
- > ### πŸš€ v1.5.0 β€” Dynamic Engine Default + Distill Coupling
29
+ > ### πŸš€ v1.5.4 β€” Agent Soul Layer Auto-Repair & Intent Engine
30
30
  >
31
+ > - **Cross-device dispatch**: Team members can run on remote machines. Add `peer: windows` to a member and messages route automatically via a Feishu relay chat β€” HMAC-signed, dedup-protected, zero manual routing.
32
+ > - **`/dispatch peers`**: View remote dispatch config, relay chat, and all remote team members from mobile.
33
+ > - **`dispatch_to peer:project`**: Dispatch tasks to remote peers from CLI, admin commands, or Claude sessions.
34
+ > - **Unified team dispatch**: Shared `team-dispatch.js` module β€” single source of truth for project/member resolution, roster hints, and prompt enrichment.
35
+ > - **Team broadcast**: Real-time cross-agent visibility in shared group chats with nickname routing and sticky follow.
36
+ > - **Unified intent engine**: Config-driven intent dispatcher replacing standalone hooks for team communication, ops assist, and task creation.
37
+ > - **Modular agent wizards**: New streamlined CLI flows for creating teams and cloning agents.
31
38
  > - **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
39
  > - **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
40
  > - **Mentor mode hooks**: pre-flight emotion breaker, context-time mentor prompt, and post-flight reflection debt registration.
39
41
  > - **Multi-user ACL**: role-based permissions (admin / member / stranger) with binding protection.
40
42
  > - **Windows native support**: cross-platform path handling, Named Pipes IPC, GBK-safe encoding.
@@ -317,6 +319,7 @@ systemctl --user start metame
317
319
  | **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. |
318
320
  | **Multi-Agent** | Multiple projects with dedicated chat groups. `/agent bind` for one-tap setup. True parallel execution. |
319
321
  | **Team Routing** | Project-level team clones: multiple AI agents work in parallel within a single chat group. Nickname routing, sticky follow, `/stop` per member, broadcast visibility. |
322
+ | **Cross-Device Dispatch** | Team members can run on different machines. `member.peer` marks remote agents β€” messages route via a Feishu relay chat with HMAC-SHA256 signing and 5-minute TTL dedup. `/dispatch peers` to view config, `dispatch_to peer:project` for explicit routing. |
320
323
  | **Browser Automation** | Built-in Playwright MCP. Browser control out of the box for every user. |
321
324
  | **Cross-Platform** | Native support for macOS and Windows. Platform abstraction layer handles spawn, IPC, process management, and terminal encoding automatically. |
322
325
  | **Provider Relay** | Route through any Anthropic-compatible API. Use GPT-4, DeepSeek, Gemini β€” zero config file mutation. |
@@ -419,7 +422,7 @@ All agents share your cognitive profile (`~/.claude_profile.yaml`) β€” they all
419
422
 
420
423
  ## Team Routing
421
424
 
422
- MetaMe supports project-level team clones β€” multiple AI agents (digital twins) sharing the same workspace, working in parallel within a single Feishu group.
425
+ MetaMe supports project-level team clones β€” multiple AI agents (digital twins) sharing the same workspace, working in parallel within a single Feishu group. Team members can run locally or on remote machines.
423
426
 
424
427
  ### Configuration
425
428
 
@@ -440,6 +443,12 @@ projects:
440
443
  nicknames:
441
444
  - η”²
442
445
  auto_dispatch: true
446
+ - key: hunter
447
+ name: ηŒŽζ‰‹
448
+ icon: 🎯
449
+ peer: windows # runs on another machine
450
+ nicknames:
451
+ - ηŒŽζ‰‹
443
452
  ```
444
453
 
445
454
  ### Key Features
@@ -449,9 +458,30 @@ projects:
449
458
  - **`/stop` precision**: `/stop δΉ™` stops a specific member; `/stop` stops the sticky member; reply-quote `/stop` stops the quoted member
450
459
  - **Auto-dispatch**: when the main agent is busy, messages are automatically routed to idle `auto_dispatch` members
451
460
  - **Broadcast**: with `broadcast: true`, inter-member `dispatch_to` messages are shown as cards in the group chat
461
+ - **Cross-device members**: add `peer: <device>` to a team member β€” messages route via a Feishu relay chat with HMAC signing and dedup protection
452
462
 
453
463
  Each team member runs on a virtual chatId (`_agent_{key}`) and appears with its own card title (e.g. `πŸ€– Jarvis Β· δΉ™`).
454
464
 
465
+ ### Cross-Device Dispatch
466
+
467
+ Team members with `peer` field run on a different machine. Configure `feishu.remote_dispatch` on both machines with the same relay chat and shared secret, but do not share the same Feishu bot between machines. Each machine must use its own Feishu app/bot credentials.
468
+
469
+ ```yaml
470
+ feishu:
471
+ remote_dispatch:
472
+ enabled: true
473
+ self: mac # unique peer name per machine
474
+ chat_id: oc_relay_xxx # shared relay group
475
+ secret: shared-secret-key # HMAC signing key
476
+ ```
477
+
478
+ Why separate bots are required:
479
+ - Feishu may deliver relay-chat events to either online client for the same bot.
480
+ - Current remote-dispatch handling drops packets addressed to a different `self` peer.
481
+ - If Windows and Mac share one bot, the wrong machine can consume and discard the packet.
482
+
483
+ Use from mobile: `/dispatch to windows:hunter research competitors` or just mention by nickname β€” routing is automatic. Use `/dispatch peers` to check remote config status.
484
+
455
485
  ## Mobile Commands
456
486
 
457
487
  | Command | Action |
@@ -469,7 +499,14 @@ Each team member runs on a virtual chatId (`_agent_{key}`) and appears with its
469
499
  | `/distill-model` | Show/update background distill model (default: `haiku`) |
470
500
  | `/mentor` | Mentor mode control: on/off/level/status |
471
501
  | `/activate` | Activate and bind the most recently created pending agent in a new group |
502
+ | `/agent new` | Interactive wizard to create a new agent |
503
+ | `/agent new team` | Team wizard: create multiple parallel agent clones under a project |
504
+ | `/agent new clone` | Clone wizard: create a clone sharing the current agent's role |
472
505
  | `/agent bind <name> [dir]` | Manually register group as dedicated agent |
506
+ | `/agent soul repair` | Idempotent rebuild of agent soul layer (links SOUL.md / MEMORY.md) |
507
+ | `/msg <agent> <message>` | Send a direct message to a team member or agent (e.g. `/msg δΉ™ check this`) |
508
+ | `/broadcast [on\|off]` | Toggle team broadcast for the current project (show inter-agent dispatches as cards) |
509
+ | `/stop <nickname>` | Stop a specific team member (e.g. `/stop δΉ™`) |
473
510
  | `/mac` | macOS control helper: permissions check/open + AppleScript/JXA execution |
474
511
  | `/sh <cmd>` | Raw shell β€” bypasses Claude |
475
512
  | `/memory` | Memory stats: fact count, session tags, DB size |
@@ -480,6 +517,8 @@ Each team member runs on a virtual chatId (`_agent_{key}`) and appears with its
480
517
  | `/user list` | List all configured users |
481
518
  | `/user remove <open_id>` | Remove a user |
482
519
  | `/sessions` | Browse recent sessions with last message preview |
520
+ | `/dispatch peers` | View remote dispatch configuration and remote team members |
521
+ | `/dispatch to <target> <prompt>` | Dispatch task to agent or remote peer (`peer:project` format supported) |
483
522
  | `/teamtask create <agent> <goal>` | Create a cross-agent collaboration task |
484
523
  | `/teamtask` | List recent TeamTasks (last 10) |
485
524
  | `/teamtask <task_id>` | View task detail |
@@ -506,8 +545,9 @@ Level mapping:
506
545
 
507
546
  ## Hook Optimizations (Default On)
508
547
 
509
- MetaMe installs and maintains two core Claude hooks automatically on launch:
548
+ MetaMe installs and maintains core Claude hooks automatically on launch:
510
549
 
550
+ - `UserPromptSubmit` hook (`scripts/hooks/intent-engine.js`): Unified intent engine for team dispatch, ops assist, and task creation hints.
511
551
  - `UserPromptSubmit` hook (`scripts/signal-capture.js`): captures high-signal preference/task traces with layered filtering.
512
552
  - `Stop` hook (`scripts/hooks/stop-session-capture.js`): records session-end/tool-failure signals with watermark protection.
513
553
 
@@ -517,7 +557,7 @@ If hook installation fails, MetaMe logs and continues the session (non-blocking
517
557
 
518
558
  ```
519
559
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” Telegram/Feishu β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
520
- β”‚ Your Phone β”‚ ◄──────────────────────► β”‚ MetaMe Daemon β”‚
560
+ β”‚ Your Phone β”‚ ◄──────────────────────► β”‚ MetaMe Daemon (Mac) β”‚
521
561
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ (your machine, 24/7) β”‚
522
562
  β”‚ β”‚
523
563
  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
@@ -526,18 +566,20 @@ If hook installation fails, MetaMe logs and continues the session (non-blocking
526
566
  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
527
567
  β”‚ β”‚
528
568
  β”‚ ~/.claude_profile β”‚
529
- β”‚ (6-dim soul schema) β”‚
530
- β”‚ β”‚
531
569
  β”‚ ~/.metame/memory.db β”‚
532
- β”‚ session_tags.json β”‚
533
- β”‚ (5-layer memory) β”‚
534
- β”‚ β”‚
535
570
  β”‚ dispatch_to (auto-deployed)β”‚
571
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
572
+ β”‚
573
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
574
+ β”‚ Feishu Relay Chat β”‚
575
+ β”‚ (HMAC-signed packets) β”‚
576
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
577
+ β”‚
578
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
579
+ β”‚ MetaMe Daemon (Windows) β”‚
580
+ β”‚ peer: "windows" β”‚
581
+ β”‚ Remote team members here β”‚
536
582
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
537
- ↑
538
- idle β†’ summaries + memory tasks
539
- 01:00 β†’ nightly reflection
540
- 01:30 β†’ memory index rebuild
541
583
  ```
542
584
 
543
585
  - **Profile** (`~/.claude_profile.yaml`): 6-dimension soul schema. Injected into every Claude session via `CLAUDE.md`.