metame-cli 1.5.2 → 1.5.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.
@@ -0,0 +1,349 @@
1
+ telegram:
2
+ enabled: true
3
+ bot_token: 8403757601:AAEouYu9BFDzg70EDjPlsHXbGJ2guNuH9Tg
4
+ allowed_chat_ids:
5
+ - 8572284648
6
+ permissions:
7
+ defaultMode: bypassPermissions
8
+ chat_agent_map: {}
9
+ feishu:
10
+ enabled: true
11
+ app_id: cli_a90a073b2ba1dbb4
12
+ app_secret: Om2sn22xfMaM0Jfv4IGLNh0CftikG8mU
13
+ operator_ids:
14
+ - ou_f873edab380d4836f93cc9e9b9104f5a
15
+ allowed_chat_ids:
16
+ - oc_84be4bf1a1dabc6c1f0c22d0b6feaf8d
17
+ - oc_2693fc5ca63064f144eca78264bcea48
18
+ - oc_280f2c243f348d8f688580f882996bcd
19
+ - oc_942de23c38ff876f73f163052fbdb68f
20
+ - oc_987e0d01804ab9459272006416a935a8
21
+ - oc_9dc62f6011b337b413eef81b4738883b
22
+ - oc_8902c34a0fc52b28ada1a7c4e25aa22a
23
+ - oc_e777c7e7a24335ecbf25ed129402af54
24
+ - oc_5d76f02c21203c5ae1c19fd83c790ba4
25
+ - oc_9cbeb5cfcef80ddffcf0419507391189
26
+ - oc_bd0b81e62ff3576dc9b4c6670bb788d2
27
+ - oc_e33569664c1c1224d44a864a4fb40dd2
28
+ chat_agent_map:
29
+ oc_84be4bf1a1dabc6c1f0c22d0b6feaf8d: metame
30
+ oc_2693fc5ca63064f144eca78264bcea48: personal
31
+ oc_280f2c243f348d8f688580f882996bcd: metame
32
+ oc_942de23c38ff876f73f163052fbdb68f: digital_me
33
+ oc_987e0d01804ab9459272006416a935a8: desktop
34
+ oc_9dc62f6011b337b413eef81b4738883b: ___
35
+ oc_8902c34a0fc52b28ada1a7c4e25aa22a: business
36
+ oc_e777c7e7a24335ecbf25ed129402af54: personal
37
+ oc_5d76f02c21203c5ae1c19fd83c790ba4: munger
38
+ oc_9cbeb5cfcef80ddffcf0419507391189: achat_pm
39
+ oc_bd0b81e62ff3576dc9b4c6670bb788d2: xianyu
40
+ oc_e33569664c1c1224d44a864a4fb40dd2: drama_manager
41
+ permissions:
42
+ defaultMode: bypassPermissions
43
+ projects:
44
+ business:
45
+ name: CEO · 商业决策
46
+ icon: 💼
47
+ color: orange
48
+ cwd: ~/AGI/Business
49
+ nicknames:
50
+ - 艾布
51
+ - CEO
52
+ - 商业
53
+ heartbeat_tasks: []
54
+ team:
55
+ - key: hunter
56
+ name: 猎手 · 市场情报
57
+ icon: 🔍
58
+ color: green
59
+ cwd: ~/AGI/Business/team/hunter
60
+ nicknames:
61
+ - 猎手
62
+ - Hunter
63
+ - key: builder
64
+ name: 工匠 · MVP拼装
65
+ icon: 🔧
66
+ color: yellow
67
+ cwd: ~/AGI/Business/team/builder
68
+ nicknames:
69
+ - 工匠
70
+ - Builder
71
+ - key: trojan
72
+ name: 特洛伊 · 获客专家
73
+ icon: 🎯
74
+ color: red
75
+ cwd: ~/AGI/Business/team/trojan
76
+ nicknames:
77
+ - 特洛伊
78
+ - Trojan
79
+ - key: closer
80
+ name: 终结者 · 成交专家
81
+ icon: 💰
82
+ color: purple
83
+ cwd: ~/AGI/Business/team/closer
84
+ nicknames:
85
+ - 终结者
86
+ - Closer
87
+ - key: xianyu
88
+ name: 小鱼 · 咸鱼客服
89
+ icon: 🐟
90
+ color: cyan
91
+ cwd: ~/AGI/Business/team/xianyu
92
+ nicknames:
93
+ - 小鱼
94
+ - 咸鱼客服
95
+ achat_pm:
96
+ name: A哥 · AChat Protocol PM
97
+ icon: 🔗
98
+ color: blue
99
+ cwd: ~/AGI/AChat
100
+ nicknames:
101
+ - A哥
102
+ - 老A
103
+ - 大A
104
+ - achat
105
+ heartbeat_tasks: []
106
+ munger:
107
+ name: 芒格 · 格栅思维顾问
108
+ icon: 🧠
109
+ color: teal
110
+ cwd: ~/AGI/Munger
111
+ nicknames:
112
+ - 芒格
113
+ - 查理
114
+ - 私人顾问
115
+ - munger
116
+ heartbeat_tasks: []
117
+ personal:
118
+ name: personal
119
+ icon: 💅
120
+ color: carmine
121
+ cwd: /Users/yaron
122
+ engine: claude
123
+ model: sonnet
124
+ guard: user-only
125
+ nicknames:
126
+ - 小美
127
+ - 助理
128
+ - personal
129
+ heartbeat_tasks: []
130
+ digital_me:
131
+ name: Digital Me
132
+ icon: 📊
133
+ color: grey
134
+ cwd: ~/AGI/Digital_Me
135
+ nicknames:
136
+ - 小D
137
+ - 3D
138
+ - 自媒体
139
+ heartbeat_tasks:
140
+ - name: daily-topic-radar
141
+ type: script
142
+ command: bash /Users/yaron/AGI/TrendRadar/run-crawl.sh
143
+ at: '09:00'
144
+ require_idle: false
145
+ notify: true
146
+ enabled: true
147
+ - name: weekend-review
148
+ cwd: ~/AGI/Digital_Me
149
+ model: haiku
150
+ interval: 5m
151
+ timeout: 120000
152
+ notify: true
153
+ enabled: true
154
+ precondition: node -e "const fs=require('fs');const p=process.env.HOME+'/.metame/daemon_state.json';const key='weekend-review';const pad=n=>String(n).padStart(2,'0');const weekKey=d=>{const x=new Date(d);const day=(x.getDay()+6)%7;x.setHours(0,0,0,0);x.setDate(x.getDate()-day);return x.getFullYear()+'-'+pad(x.getMonth()+1)+'-'+pad(x.getDate());};const now=new Date();const dow=now.getDay();if(!(dow===0||dow===6))process.exit(1);if(now.getHours()!==22)process.exit(1);let s={};try{s=JSON.parse(fs.readFileSync(p,'utf8'));}catch{}const t=(s.tasks||{})[key];if(t&&t.status==='success'&&t.last_run&&weekKey(t.last_run)===weekKey(now))process.exit(1);console.log('run');"
155
+ prompt: |-
156
+ 你是周末复盘助手。现在执行周末总结:先向用户索取本周关键数据,再给出下周选题方案提示词。
157
+ 硬性要求:不臆测数据,不直接给结论。
158
+ 输出结构(严格三段):
159
+ 1) 【请补充本周数据】列出 6 项:发布篇数、总阅读、平均阅读、最高阅读文章(标题+阅读量)、最低阅读文章(标题+阅读量)、净增粉丝。
160
+ 2) 【回填模板】给可直接复制填写的模板。
161
+ 3) 【下周选题方案提示词(待数据版)】给一段可直接发给 AI 的提示词:收到上述数据后,输出下周 7 天选题计划(每天 1 个选题,含优先级、标题、核心观点、目标读者、验证指标)。
162
+ 风格:简洁、可执行,全文不超过 18 行。
163
+ allowedTools:
164
+ - Read
165
+ metame:
166
+ name: 超级总管 Jarvis
167
+ icon: 🤖
168
+ color: blue
169
+ cwd: ~/AGI/MetaMe
170
+ nicknames:
171
+ - 贾维斯
172
+ - 老贾
173
+ - 贾
174
+ - Jarvis
175
+ - jarvis
176
+ heartbeat_tasks: null
177
+ broadcast: true
178
+ team:
179
+ - key: jia
180
+ name: Jarvis · 甲
181
+ icon: 🤖
182
+ color: green
183
+ cwd: ~/AGI/MetaMe
184
+ nicknames:
185
+ - 甲
186
+ auto_dispatch: true
187
+ - key: yi
188
+ name: Jarvis · 乙
189
+ icon: 🤖
190
+ color: yellow
191
+ cwd: ~/AGI/MetaMe
192
+ nicknames:
193
+ - 乙
194
+ auto_dispatch: true
195
+ - key: bing
196
+ name: Jarvis · 丙
197
+ icon: 🤖
198
+ color: red
199
+ cwd: ~/AGI/MetaMe
200
+ nicknames:
201
+ - 丙
202
+ auto_dispatch: true
203
+ desktop:
204
+ name: Desktop PM
205
+ icon: 🚀
206
+ color: indigo
207
+ cwd: ~/AGI/metame-desktop
208
+ nicknames:
209
+ - 马经理
210
+ - 老马
211
+ - 桌面
212
+ - Desktop
213
+ heartbeat_tasks: []
214
+ ___:
215
+ name: 因斯坦
216
+ cwd: /Users/yaron/Desktop/项目计划书/国自然青年
217
+ nicknames:
218
+ - 因斯坦
219
+ drama_manager:
220
+ name: 🎬 短剧总管
221
+ icon: 🎬
222
+ color: red
223
+ cwd: ~/AGI/DramaFactory
224
+ nicknames:
225
+ - 短剧总管
226
+ - 总管
227
+ - drama
228
+ heartbeat_tasks: []
229
+ team:
230
+ - key: drama_screenwriter
231
+ name: ✍️ 编剧
232
+ icon: ✍️
233
+ color: orange
234
+ cwd: ~/AGI/DramaFactory/team/screenwriter
235
+ nicknames:
236
+ - 编剧
237
+ - key: drama_writer
238
+ name: 📝 写手
239
+ icon: 📝
240
+ color: yellow
241
+ cwd: ~/AGI/DramaFactory/team/writer
242
+ nicknames:
243
+ - 写手
244
+ - key: drama_hook_rev
245
+ name: 🪝 钩子审核
246
+ icon: 🪝
247
+ color: pink
248
+ cwd: ~/AGI/DramaFactory/team/hook_rev
249
+ nicknames:
250
+ - 钩子审核员
251
+ - 钩子审核
252
+ - key: drama_drama_rev
253
+ name: 🌶 狗血审核
254
+ icon: 🌶
255
+ color: magenta
256
+ cwd: ~/AGI/DramaFactory/team/drama_rev
257
+ nicknames:
258
+ - 狗血审核员
259
+ - 狗血审核
260
+ - key: drama_format_rev
261
+ name: 📐 格式审核
262
+ icon: 📐
263
+ color: grey
264
+ cwd: ~/AGI/DramaFactory/team/format_rev
265
+ nicknames:
266
+ - 格式审核员
267
+ - 格式审核
268
+ heartbeat:
269
+ tasks:
270
+ - name: cognitive-distill
271
+ type: script
272
+ command: node ~/.metame/distill.js
273
+ interval: 2h
274
+ precondition: test -s ~/.metame/raw_signals.jsonl
275
+ require_idle: true
276
+ notify: false
277
+ enabled: true
278
+ - name: memory-extract
279
+ type: script
280
+ command: node ~/.metame/memory-extract.js
281
+ interval: 12h
282
+ timeout: 1800
283
+ require_idle: true
284
+ notify: false
285
+ enabled: true
286
+ - name: memory-gc
287
+ type: script
288
+ command: node ~/.metame/memory-gc.js
289
+ at: '02:00'
290
+ require_idle: true
291
+ notify: false
292
+ enabled: true
293
+ - name: skill-evolve
294
+ type: script
295
+ command: node ~/.metame/skill-evolution.js
296
+ interval: 24h
297
+ precondition: test -s ~/.metame/skill_signals.jsonl
298
+ require_idle: true
299
+ notify: false
300
+ enabled: true
301
+ - name: self-reflect
302
+ type: script
303
+ command: node ~/.metame/self-reflect.js
304
+ at: '23:00'
305
+ require_idle: true
306
+ notify: false
307
+ enabled: true
308
+ - name: nightly-reflect
309
+ type: script
310
+ command: node ~/.metame/memory-nightly-reflect.js
311
+ at: '01:00'
312
+ require_idle: true
313
+ notify: false
314
+ enabled: true
315
+ - name: memory-index
316
+ type: script
317
+ command: node ~/.metame/memory-index.js
318
+ at: '01:30'
319
+ require_idle: true
320
+ notify: false
321
+ enabled: true
322
+ budget:
323
+ daily_limit: 100000
324
+ warning_threshold: 0.8
325
+ daemon:
326
+ model: opus
327
+ log_max_size: 1048576
328
+ heartbeat_check_interval: 60
329
+ skill_evolution_notify: false
330
+ dangerously_skip_permissions: true
331
+ session_allowed_tools:
332
+ - Edit
333
+ - Write
334
+ - Read
335
+ - Bash
336
+ - Glob
337
+ - Grep
338
+ - WebFetch
339
+ - WebSearch
340
+ - Task
341
+ - Skill
342
+ - TodoRead
343
+ - TodoWrite
344
+ - NotebookEdit
345
+ - mcp__playwright__*
346
+ - mcp__trendradar__*
347
+ - mcp__notionApi__*
348
+ models:
349
+ claude: sonnet
@@ -1469,26 +1469,45 @@ if (require.main === module) {
1469
1469
  await detectPatterns(true);
1470
1470
  }
1471
1471
 
1472
- const result = await distill();
1473
- // Write session log if behavior was detected
1474
- if (result.behavior) {
1475
- writeSessionLog(result.behavior, result.signalCount || 0, result.skeleton || null, result.sessionSummary || null);
1472
+ // Process ALL pending batches in one run (not just one session group).
1473
+ // Cap at 5 iterations to bound total token spend per invocation.
1474
+ const MAX_BATCH_ROUNDS = 5;
1475
+ let totalTokens = 0;
1476
+ let roundsRun = 0;
1477
+
1478
+ for (let round = 0; round < MAX_BATCH_ROUNDS; round++) {
1479
+ // Check if buffer still has signals
1480
+ try {
1481
+ const buf = fs.readFileSync(BUFFER_FILE, 'utf8').trim();
1482
+ if (!buf) break;
1483
+ } catch { break; }
1484
+
1485
+ const result = await distill();
1486
+ roundsRun++;
1487
+
1488
+ // Write session log if behavior was detected
1489
+ if (result.behavior) {
1490
+ writeSessionLog(result.behavior, result.signalCount || 0, result.skeleton || null, result.sessionSummary || null);
1491
+ }
1492
+
1493
+ const estTokens = Math.ceil(((result.signalCount || 1) * 500) + ((result.summary || '').length / 4));
1494
+ totalTokens += estTokens;
1495
+
1496
+ if (result.updated) {
1497
+ console.log(`🧠 [${round + 1}] ${result.summary}`);
1498
+ } else {
1499
+ console.log(`💤 [${round + 1}] ${result.summary}`);
1500
+ }
1501
+
1502
+ // Stop if: no signals, nothing processed, or signals not consumed (avoid retry loop)
1503
+ if (!result.signalCount || !result.updated || result.summary.includes('No signals')) break;
1476
1504
  }
1477
1505
 
1478
- // Fill reflection words for sessions that don't have one yet
1506
+ // Post-distill tasks: run once after all batches
1479
1507
  await fillSessionReflections();
1480
-
1481
- // Run pattern detection (only triggers every 5th distill)
1482
1508
  if (!bootstrapped) await detectPatterns();
1483
1509
 
1484
- if (result.updated) {
1485
- console.log(`🧠 ${result.summary}`);
1486
- } else {
1487
- console.log(`💤 ${result.summary}`);
1488
- }
1489
- // Report estimated token usage for daemon budget tracking
1490
- // Each callHaiku invocation ~2k-5k tokens; estimate from signal count + result size
1491
- const estTokens = Math.ceil(((result.signalCount || 1) * 500) + ((result.summary || '').length / 4));
1492
- console.log(`__TOKENS__:${estTokens}`);
1510
+ console.log(`__TOKENS__:${totalTokens}`);
1511
+ if (roundsRun > 1) console.log(`[distill] processed ${roundsRun} batches in one run`);
1493
1512
  })();
1494
1513
  }
@@ -145,7 +145,68 @@ feishu:
145
145
  | daemon.js `spawnReplacementDaemon` | POSIX: `detached: true` / Windows: `detached: false` | 改 spawn 参数时注意平台分支 |
146
146
  | NL Mac 控制(command-router) | macOS only,`process.platform === 'darwin'` 守卫 | Windows 天然跳过 |
147
147
 
148
- ## 10. 变更后维护动作
148
+ ## 10. 团队路由(Team Routing)
149
+
150
+ ### 概念
151
+
152
+ 一个项目可以有多个 team 成员(数字分身),共享同一个 `cwd`,通过虚拟 chatId 并行工作。
153
+
154
+ ### 配置
155
+
156
+ 在 `~/.metame/daemon.yaml` 的项目下添加 `team` 数组和 `broadcast: true`:
157
+
158
+ ```yaml
159
+ metame:
160
+ name: 超级总管 Jarvis
161
+ icon: 🤖
162
+ broadcast: true
163
+ team:
164
+ - key: jia
165
+ name: Jarvis · 甲
166
+ icon: 🤖
167
+ color: green
168
+ cwd: ~/AGI/MetaMe
169
+ nicknames:
170
+ - 甲
171
+ auto_dispatch: true
172
+ ```
173
+
174
+ ### 路由规则(按优先级)
175
+
176
+ 1. **引用回复** → 路由到原 agent + 设置 sticky
177
+ 2. **显式昵称**(如"乙 帮我查下")→ 路由到对应成员 + 设置 sticky
178
+ 3. **主项目昵称**(如"贾维斯")→ 清除 sticky,路由到主项目
179
+ 4. **Sticky**:无昵称时 → 路由到上次显式指定的成员
180
+ 5. **Auto-dispatch**:主忙时自动分配给空闲的 `auto_dispatch` 成员
181
+
182
+ ### /stop 精准路由
183
+
184
+ - `/stop 乙`:停止指定成员
185
+ - `/stop`:停止 sticky 成员
186
+ - 引用回复 `/stop`:停止对应成员
187
+
188
+ ### Team Broadcast
189
+
190
+ `broadcast: true` 时,team 成员之间通过 `dispatch_to` 互发消息会在群里用卡片广播。
191
+
192
+ ### 虚拟 chatId
193
+
194
+ team 成员使用 `_agent_{key}` 格式的虚拟 chatId,与物理群 chatId 隔离。
195
+
196
+ ### 卡片标题
197
+
198
+ 由 `icon + name` 拼成,如 `🤖 Jarvis · 乙`。
199
+
200
+ ## 11. 私人配置保护
201
+
202
+ - `daemon.yaml` 是用户私人配置,包含 API keys、chat IDs、个人项目配置
203
+ - **绝不上传**到代码仓库,已加入 `.gitignore`
204
+ - 仓库只追踪 `scripts/daemon-default.yaml`(模板文件)
205
+ - 部署流程(`node index.js`)不会覆盖用户的 `~/.metame/daemon.yaml`
206
+ - 同样不应上传的文件:`MEMORY.md`、`SOUL.md`、`.env*`
207
+ - Agent 在执行任务时,**绝不能** `cp scripts/daemon.yaml ~/.metame/daemon.yaml`,这会覆盖用户私人配置
208
+
209
+ ## 12. 变更后维护动作
149
210
 
150
211
  1. `npm test`
151
212
  2. `npm run sync:plugin`