metame-cli 1.3.23 β†’ 1.4.3

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/README.md CHANGED
@@ -26,6 +26,18 @@ npm install -g metame-cli && metame
26
26
 
27
27
  ---
28
28
 
29
+ > ### πŸš€ v1.4.0 β€” Layered Memory Architecture
30
+ >
31
+ > MetaMe now has a **three-layer memory system** that works completely in the background:
32
+ > - **Long-term facts** extracted from every session, recalled semantically on demand
33
+ > - **Session summary cache** β€” when you resume after a 2h+ gap, MetaMe injects what you were last working on
34
+ > - **Automatic session tagging** β€” every conversation is indexed by topic, enabling future session routing
35
+ > - **Unix Socket IPC** β€” dispatch latency dropped from ~60s to <100ms
36
+ >
37
+ > Zero configuration. It just works.
38
+
39
+ ---
40
+
29
41
  ## What It Does
30
42
 
31
43
  ### 1. Knows You Across Every Project
@@ -37,7 +49,8 @@ A cognitive profile (`~/.claude_profile.yaml`) follows you everywhere β€” not ju
37
49
  ```
38
50
  $ metame
39
51
  🧠 MetaMe: Distilling 7 moments in background...
40
- Ready, Neo. What are we building?
52
+ 🧠 Memory: 42 facts · 87 sessions tagged
53
+ Link Established. What are we building?
41
54
  ```
42
55
 
43
56
  ### 2. Full Claude Code From Your Phone
@@ -53,12 +66,68 @@ Claude: ✏️ Edit: api/login.ts
53
66
 
54
67
  Start on your laptop, continue on the train. `/stop` to interrupt, `/undo` to rollback, `/sh ls` for raw shell access when everything else breaks.
55
68
 
56
- ### 3. Runs Autonomously
69
+ ### 3. Layered Memory That Works While You Sleep
70
+
71
+ MetaMe's memory system runs automatically in the background β€” no prompts, no manual saves.
72
+
73
+ **Layer 1 β€” Long-term Facts**
74
+ 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.
75
+
76
+ **Layer 2 β€” Session Continuity**
77
+ 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.
78
+
79
+ **Layer 3 β€” Session Index**
80
+ 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.
81
+
82
+ ```
83
+ [Background, while you sleep]
84
+ idle 30min β†’ memory consolidation triggered
85
+ β†’ session_tags.json updated (topics indexed)
86
+ β†’ facts extracted β†’ ~/.metame/memory.db
87
+ β†’ session summary cached β†’ daemon_state.json
88
+
89
+ [Next morning, when you resume]
90
+ "continue from yesterday" β†’
91
+ [δΈŠζ¬‘ε―Ήθ―ζ‘˜θ¦] Auth refactor, decided on JWT with
92
+ refresh token rotation. Token expiry set to 15min.
93
+ ```
94
+
95
+ ### 4. Heartbeat β€” A Programmable Nervous System
96
+
97
+ Most AI tools react when you talk to them. MetaMe keeps running while you sleep.
57
98
 
58
- Schedule tasks that run on your machine and push results to your phone:
99
+ The heartbeat system is three-layered:
100
+
101
+ **Layer 0 β€” Kernel (always on, zero config)**
102
+ Built into the daemon. Runs every 60 seconds regardless of what's in your config:
103
+ - Drains the dispatch queue (IPC messages from other agents)
104
+ - Tracks daemon aliveness and rotates logs
105
+ - Detects when you go idle β†’ generates session continuity summaries
106
+
107
+ **Layer 1 β€” System Evolution (built-in defaults)**
108
+ Three tasks shipped out of the box. Only fire when you're idle β€” they never interrupt active work:
59
109
 
60
110
  ```yaml
61
- # ~/.metame/daemon.yaml
111
+ - cognitive-distill # 4h Β· has signals? β†’ distill preferences into profile
112
+ - memory-extract # 2h Β· scan sessions β†’ extract long-term facts + topic tags
113
+ - skill-evolve # 6h Β· has signals? β†’ evolve skills from task outcomes
114
+ ```
115
+
116
+ `precondition` guards mean zero tokens burned when there's nothing to process.
117
+
118
+ **Layer 2 β€” Your Tasks (fully customizable)**
119
+ Anything you want Claude to do on a schedule, per project, with push notifications:
120
+
121
+ ```yaml
122
+ projects:
123
+ my_blog:
124
+ heartbeat_tasks:
125
+ - name: "daily-draft"
126
+ prompt: "Research top AI news and write an article"
127
+ interval: "24h"
128
+ model: "sonnet"
129
+ notify: true
130
+
62
131
  heartbeat:
63
132
  tasks:
64
133
  - name: "morning-brief"
@@ -67,7 +136,7 @@ heartbeat:
67
136
  notify: true
68
137
  ```
69
138
 
70
- Chain skills into workflows β€” research, write, publish β€” fully automated:
139
+ Chain skills into multi-step workflows β€” research β†’ write β†’ publish β€” fully automated:
71
140
 
72
141
  ```yaml
73
142
  - name: "daily-content"
@@ -81,7 +150,9 @@ Chain skills into workflows β€” research, write, publish β€” fully automated:
81
150
  prompt: "Publish it"
82
151
  ```
83
152
 
84
- ### 4. Skills That Evolve Themselves
153
+ Task options: `require_idle` (defer when you're active), `precondition` (shell guard β€” skip if false, zero tokens), `notify` (push result to phone), `model`, `cwd`, `allowedTools`, `timeout`.
154
+
155
+ ### 5. Skills That Evolve Themselves
85
156
 
86
157
  MetaMe has a living skill ecosystem. Skills aren't static configs β€” they grow.
87
158
 
@@ -92,13 +163,11 @@ MetaMe has a living skill ecosystem. Skills aren't static configs β€” they grow.
92
163
 
93
164
  ```
94
165
  Task fails β†’ skill-scout finds a skill β†’ installs β†’ retries β†’ succeeds
95
- ↓
96
- skill-evolution-manager
97
- updates skill with lessons learned
166
+ ↓
167
+ skill-evolution-manager
168
+ updates skill with lessons learned
98
169
  ```
99
170
 
100
- This is the difference between a tool library and an organism. OpenClaw has a skill marketplace; MetaMe has skills that **learn from their own failures**.
101
-
102
171
  ---
103
172
 
104
173
  ## Quick Start
@@ -143,15 +212,84 @@ Done. Open Telegram, message your bot.
143
212
  | Capability | What It Does |
144
213
  |-----------|-------------|
145
214
  | **Cognitive Profile** | Learns how you think across sessions. Schema-enforced, 800-token budget, auto-distilled via Haiku. Lock any value with `# [LOCKED]`. |
215
+ | **Layered Memory** | Three-tier memory: long-term facts (semantic recall), session summaries (continuity bridge), session index (topic tags). All automatic. |
146
216
  | **Mobile Bridge** | Full Claude Code via Telegram/Feishu. Stateful sessions, file transfer both ways, real-time streaming status. |
147
217
  | **Skill Evolution** | Self-healing skill system. Auto-discovers missing skills, learns from browser recordings, evolves after every task. Skills get smarter over time. |
148
- | **Heartbeat Tasks** | Scheduled Claude runs with cron-like intervals. Preconditions, workflows, push notifications. |
149
- | **Multi-Agent** | Multiple projects with dedicated chat groups. `/bind` for one-tap setup. True parallel execution. |
218
+ | **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. |
219
+ | **Multi-Agent** | Multiple projects with dedicated chat groups. `/agent bind` for one-tap setup. True parallel execution. |
150
220
  | **Browser Automation** | Built-in Playwright MCP. Browser control out of the box for every user. |
151
221
  | **Provider Relay** | Route through any Anthropic-compatible API. Use GPT-4, DeepSeek, Gemini β€” zero config file mutation. |
152
222
  | **Metacognition** | Detects behavioral patterns (decision style, comfort zones, goal drift) and injects mirror observations. Zero extra API cost. |
153
223
  | **Emergency Tools** | `/doctor` diagnostics, `/sh` raw shell, `/fix` config restore, `/undo` git-based rollback. |
154
224
 
225
+ ## Defining Your Agents
226
+
227
+ Agent configs live in `~/.metame/daemon.yaml` β€” local only, never uploaded to npm or Git.
228
+
229
+ ### From your phone (recommended)
230
+
231
+ The easiest way. Open any Telegram/Feishu group and use the `/agent` wizard:
232
+
233
+ | Command | What it does |
234
+ |---------|-------------|
235
+ | `/agent new` | Step-by-step wizard: pick a directory β†’ name the agent β†’ describe its role. MetaMe writes the role into `CLAUDE.md` automatically. |
236
+ | `/agent bind <name> [dir]` | Quick bind: register this group as a named agent, optionally set working directory. |
237
+ | `/agent list` | Show all configured agents. |
238
+ | `/agent edit` | Update the current agent's role description (rewrites its `CLAUDE.md` section). |
239
+ | `/agent reset` | Remove the current agent's role section. |
240
+
241
+ Example flow:
242
+ ```
243
+ You: /agent new
244
+ Bot: Please select a working directory:
245
+ πŸ“ ~/AGI πŸ“ ~/projects πŸ“ ~/Desktop
246
+ You: ~/AGI/MyProject
247
+ Bot: What should we name this agent?
248
+ You: 小美
249
+ Bot: Describe 小美's role and responsibilities:
250
+ You: Personal assistant. Manages my calendar, drafts messages, and tracks todos.
251
+ Bot: βœ… Agentγ€Œε°ηΎŽγ€created. CLAUDE.md updated with role definition.
252
+ ```
253
+
254
+ ### From config file (for power users)
255
+
256
+ ```yaml
257
+ # ~/.metame/daemon.yaml
258
+ projects:
259
+ assistant: # project key β€” used by dispatch_to
260
+ name: "Personal Assistant"
261
+ icon: "πŸ’…"
262
+ color: "blue"
263
+ cwd: "~/AGI/MyAssistant"
264
+ nicknames: ["小美", "εŠ©η†"]
265
+ heartbeat_tasks: []
266
+
267
+ coder:
268
+ name: "Backend Engineer"
269
+ icon: "πŸ› "
270
+ color: "orange"
271
+ cwd: "~/projects/backend"
272
+ heartbeat_tasks:
273
+ - name: "daily-review"
274
+ prompt: "Review yesterday's commits and flag any issues"
275
+ interval: "24h"
276
+ notify: true
277
+
278
+ feishu:
279
+ chat_agent_map:
280
+ oc_abc123: assistant # this group β†’ assistant agent
281
+ oc_def456: coder # this group β†’ coder agent
282
+ ```
283
+
284
+ All agents share your cognitive profile (`~/.claude_profile.yaml`) β€” they all know who you are. Each runs in its own `cwd` with its own Claude session, in parallel.
285
+
286
+ **Dispatch between agents** (from Claude or a heartbeat task):
287
+
288
+ ```bash
289
+ ~/.metame/bin/dispatch_to assistant "Schedule tomorrow's standup"
290
+ ~/.metame/bin/dispatch_to coder "Run the test suite and report results"
291
+ ```
292
+
155
293
  ## Mobile Commands
156
294
 
157
295
  | Command | Action |
@@ -160,33 +298,45 @@ Done. Open Telegram, message your bot.
160
298
  | `/new` | Start new session (project picker) |
161
299
  | `/resume` | Pick from session list |
162
300
  | `/stop` | Interrupt current task (ESC) |
163
- | `/undo` | Rollback with file restoration |
301
+ | `/undo` | Show recent messages as buttons β€” tap to roll back context + code to before that message |
302
+ | `/undo <hash>` | Roll back to a specific git checkpoint |
164
303
  | `/list` | Browse & download project files |
165
304
  | `/model` | Switch model (sonnet/opus/haiku) |
166
- | `/bind <name>` | Register group as dedicated agent |
305
+ | `/agent bind <name> [dir]` | Register group as dedicated agent |
167
306
  | `/sh <cmd>` | Raw shell β€” bypasses Claude |
307
+ | `/memory` | Memory stats: fact count, session tags, DB size |
308
+ | `/memory <keyword>` | Search long-term facts by keyword |
168
309
  | `/doctor` | Interactive diagnostics |
169
310
 
170
311
  ## How It Works
171
312
 
172
313
  ```
173
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” Telegram/Feishu β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
174
- β”‚ Your Phone β”‚ ◄──────────────────────► β”‚ MetaMe Daemon β”‚
175
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ (your Mac, 24/7) β”‚
176
- β”‚ β”‚
177
- β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
178
- β”‚ β”‚ Claude Code β”‚ β”‚
179
- β”‚ β”‚ (same engine) β”‚ β”‚
180
- β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
181
- β”‚ β”‚
182
- β”‚ ~/.claude_profile β”‚
183
- β”‚ (cognitive layer) β”‚
184
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
314
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” Telegram/Feishu β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
315
+ β”‚ Your Phone β”‚ ◄──────────────────────► β”‚ MetaMe Daemon β”‚
316
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ (your Mac, 24/7) β”‚
317
+ β”‚ β”‚
318
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
319
+ β”‚ β”‚ Claude Code β”‚ β”‚
320
+ β”‚ β”‚ (same engine) β”‚ β”‚
321
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
322
+ β”‚ β”‚
323
+ β”‚ ~/.claude_profile β”‚
324
+ β”‚ (cognitive layer) β”‚
325
+ β”‚ β”‚
326
+ β”‚ ~/.metame/memory.db β”‚
327
+ β”‚ session_tags.json β”‚
328
+ β”‚ (memory layer) ← NEW β”‚
329
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
330
+ ↑
331
+ sleep mode β†’ memory consolidation
332
+ (background, automatic)
185
333
  ```
186
334
 
187
335
  - **Profile** (`~/.claude_profile.yaml`): Your cognitive fingerprint. Injected into every Claude session via `CLAUDE.md`.
188
- - **Daemon** (`scripts/daemon.js`): Background process handling Telegram/Feishu messages, heartbeat tasks, and file watching.
336
+ - **Daemon** (`scripts/daemon.js`): Background process handling Telegram/Feishu messages, heartbeat tasks, Unix socket dispatch, and sleep-mode memory triggers.
189
337
  - **Distillation** (`scripts/distill.js`): On each launch, silently analyzes your recent messages and updates your profile.
338
+ - **Memory Extract** (`scripts/memory-extract.js`): Triggered on sleep mode. Extracts long-term facts and session topic tags from completed conversations.
339
+ - **Session Summarize** (`scripts/session-summarize.js`): Generates a 2-4 sentence summary for idle sessions. Injected as context when resuming after a 2h+ gap.
190
340
 
191
341
  ## Security
192
342
 
@@ -198,16 +348,32 @@ Done. Open Telegram, message your bot.
198
348
 
199
349
  ## Performance
200
350
 
201
- The entire cognitive layer costs ~800 tokens per session (0.4% of a 200k context window). Background distillation uses Haiku at minimal cost. Mobile commands like `/stop`, `/list`, `/undo` consume zero tokens.
351
+ | Metric | Value |
352
+ |--------|-------|
353
+ | Daemon memory (idle) | ~100 MB RSS β€” standard Node.js process baseline |
354
+ | Daemon CPU (idle, between heartbeats) | ~0% β€” event-loop sleeping |
355
+ | Cognitive profile injection | ~800 tokens/session (0.4% of 200k context) |
356
+ | Dispatch latency (Unix socket) | <100ms |
357
+ | Memory consolidation (per session) | ~1,500–2,000 tokens input + ~50–300 tokens output (Haiku) |
358
+ | Session summary (per session) | ~400–900 tokens input + ≀250 tokens output (Haiku) |
359
+ | Mobile commands (`/stop`, `/list`, `/undo`) | 0 tokens |
360
+
361
+ > 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 triggers on sleep mode (30-min idle), summaries trigger once per idle session.
202
362
 
203
- ## Plugin (Lightweight)
363
+ ## Plugin
204
364
 
205
- Don't need mobile access? Install as a Claude Code plugin β€” profile injection + slash commands only:
365
+ Install directly into Claude Code without npm:
206
366
 
207
367
  ```bash
208
368
  claude plugin install github:Yaron9/MetaMe/plugin
209
369
  ```
210
370
 
371
+ Includes: cognitive profile injection, daemon (Telegram/Feishu), heartbeat tasks, layered memory, all mobile commands, slash commands (`/metame:evolve`, `/metame:daemon`, `/metame:refresh`, etc.).
372
+
373
+ **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`.
374
+
375
+ 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.
376
+
211
377
  ## License
212
378
 
213
379
  MIT