agentmesh-ai 0.4.0 → 0.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 (101) hide show
  1. package/GUIDE-EN.md +421 -0
  2. package/GUIDE.md +85 -4
  3. package/README.md +91 -8
  4. package/dist/cli/commands/init.d.ts.map +1 -1
  5. package/dist/cli/commands/init.js +29 -2
  6. package/dist/cli/commands/init.js.map +1 -1
  7. package/dist/cli/commands/join.d.ts.map +1 -1
  8. package/dist/cli/commands/join.js +34 -2
  9. package/dist/cli/commands/join.js.map +1 -1
  10. package/dist/cli/commands/status.js +1 -1
  11. package/dist/cli/commands/status.js.map +1 -1
  12. package/dist/cloud/supabase-client.d.ts +14 -1
  13. package/dist/cloud/supabase-client.d.ts.map +1 -1
  14. package/dist/cloud/supabase-client.js +56 -0
  15. package/dist/cloud/supabase-client.js.map +1 -1
  16. package/dist/events/emitter.d.ts +11 -0
  17. package/dist/events/emitter.d.ts.map +1 -0
  18. package/dist/events/emitter.js +81 -0
  19. package/dist/events/emitter.js.map +1 -0
  20. package/dist/events/index.d.ts +3 -0
  21. package/dist/events/index.d.ts.map +1 -0
  22. package/dist/events/index.js +3 -0
  23. package/dist/events/index.js.map +1 -0
  24. package/dist/events/webhook.d.ts +10 -0
  25. package/dist/events/webhook.d.ts.map +1 -0
  26. package/dist/events/webhook.js +153 -0
  27. package/dist/events/webhook.js.map +1 -0
  28. package/dist/federation/index.d.ts +4 -0
  29. package/dist/federation/index.d.ts.map +1 -0
  30. package/dist/federation/index.js +3 -0
  31. package/dist/federation/index.js.map +1 -0
  32. package/dist/federation/link.d.ts +10 -0
  33. package/dist/federation/link.d.ts.map +1 -0
  34. package/dist/federation/link.js +86 -0
  35. package/dist/federation/link.js.map +1 -0
  36. package/dist/federation/reader.d.ts +12 -0
  37. package/dist/federation/reader.d.ts.map +1 -0
  38. package/dist/federation/reader.js +60 -0
  39. package/dist/federation/reader.js.map +1 -0
  40. package/dist/federation/types.d.ts +26 -0
  41. package/dist/federation/types.d.ts.map +1 -0
  42. package/dist/federation/types.js +2 -0
  43. package/dist/federation/types.js.map +1 -0
  44. package/dist/index.d.ts +3 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +3 -0
  47. package/dist/index.js.map +1 -1
  48. package/dist/mcp/conversation-tools.d.ts.map +1 -1
  49. package/dist/mcp/conversation-tools.js +6 -5
  50. package/dist/mcp/conversation-tools.js.map +1 -1
  51. package/dist/mcp/index.js +1 -1
  52. package/dist/mcp/index.js.map +1 -1
  53. package/dist/mcp/memory-tools.d.ts.map +1 -1
  54. package/dist/mcp/memory-tools.js +322 -16
  55. package/dist/mcp/memory-tools.js.map +1 -1
  56. package/dist/memory/consolidator.d.ts +14 -6
  57. package/dist/memory/consolidator.d.ts.map +1 -1
  58. package/dist/memory/consolidator.js +47 -0
  59. package/dist/memory/consolidator.js.map +1 -1
  60. package/dist/memory/merge-view.d.ts.map +1 -1
  61. package/dist/memory/merge-view.js +3 -0
  62. package/dist/memory/merge-view.js.map +1 -1
  63. package/dist/memory/scorer.d.ts +28 -0
  64. package/dist/memory/scorer.d.ts.map +1 -0
  65. package/dist/memory/scorer.js +149 -0
  66. package/dist/memory/scorer.js.map +1 -0
  67. package/dist/memory/timeline.d.ts +6 -0
  68. package/dist/memory/timeline.d.ts.map +1 -0
  69. package/dist/memory/timeline.js +85 -0
  70. package/dist/memory/timeline.js.map +1 -0
  71. package/dist/memory/types.d.ts +37 -2
  72. package/dist/memory/types.d.ts.map +1 -1
  73. package/dist/memory/write-utils.d.ts +6 -1
  74. package/dist/memory/write-utils.d.ts.map +1 -1
  75. package/dist/memory/write-utils.js +25 -0
  76. package/dist/memory/write-utils.js.map +1 -1
  77. package/dist/protocol/index.d.ts +25 -0
  78. package/dist/protocol/index.d.ts.map +1 -0
  79. package/dist/protocol/index.js +22 -0
  80. package/dist/protocol/index.js.map +1 -0
  81. package/dist/sdk.d.ts +54 -1
  82. package/dist/sdk.d.ts.map +1 -1
  83. package/dist/sdk.js +107 -2
  84. package/dist/sdk.js.map +1 -1
  85. package/dist/templates/export.d.ts +17 -0
  86. package/dist/templates/export.d.ts.map +1 -0
  87. package/dist/templates/export.js +49 -0
  88. package/dist/templates/export.js.map +1 -0
  89. package/dist/templates/import.d.ts +19 -0
  90. package/dist/templates/import.d.ts.map +1 -0
  91. package/dist/templates/import.js +83 -0
  92. package/dist/templates/import.js.map +1 -0
  93. package/dist/templates/index.d.ts +4 -0
  94. package/dist/templates/index.d.ts.map +1 -0
  95. package/dist/templates/index.js +3 -0
  96. package/dist/templates/index.js.map +1 -0
  97. package/dist/templates/types.d.ts +38 -0
  98. package/dist/templates/types.d.ts.map +1 -0
  99. package/dist/templates/types.js +2 -0
  100. package/dist/templates/types.js.map +1 -0
  101. package/package.json +5 -1
package/GUIDE-EN.md ADDED
@@ -0,0 +1,421 @@
1
+ # AgentMesh Tutorial
2
+
3
+ > Let your AI coding assistants (Claude Code, Cursor, Windsurf, etc.) share knowledge and talk to each other.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Prerequisites](#1-prerequisites)
10
+ 2. [Initialize Your Project](#2-initialize-your-project)
11
+ 3. [Configure Your AI Tool](#3-configure-your-ai-tool)
12
+ 4. [Verify It Works](#4-verify-it-works)
13
+ 5. [Invite Teammates](#5-invite-teammates)
14
+ 6. [Real-time Discussion](#6-real-time-discussion)
15
+ 7. [Daily Usage](#7-daily-usage)
16
+ 8. [Advanced Features](#8-advanced-features)
17
+ 9. [Full Walkthrough](#9-full-walkthrough)
18
+ 10. [FAQ](#10-faq)
19
+
20
+ ---
21
+
22
+ ## 1. Prerequisites
23
+
24
+ You need:
25
+ - **Node.js 20 or above** — check with `node --version`
26
+ - **An AI coding tool** — Claude Code, Cursor, Windsurf, or any MCP-compatible tool
27
+
28
+ You do NOT need:
29
+ - No account registration
30
+ - No server setup
31
+ - No API keys
32
+ - No Git (memories sync via cloud, no commit/push needed)
33
+
34
+ ---
35
+
36
+ ## 2. Initialize Your Project
37
+
38
+ Open a terminal in your project folder and run:
39
+
40
+ ```bash
41
+ npx agentmesh-ai init
42
+ ```
43
+
44
+ It will ask a few questions:
45
+
46
+ ```
47
+ ? Project name? my-project
48
+ ? Your name? Alice
49
+ ? Your role? Backend Developer
50
+ ? Your AI coding tool? Claude Code
51
+ ```
52
+
53
+ You'll see:
54
+
55
+ ```
56
+ ✅ Created .agenthub/
57
+
58
+ Your Agent ID: alice-claude-code
59
+ Team ID: team-a1b2c3d4
60
+
61
+ ☁️ Cloud sync enabled — memories live in the cloud, no Git needed.
62
+
63
+ Next steps:
64
+ 1. Run npx agentmesh-ai setup to configure your AI tool
65
+ 2. Share your Team ID with teammates:
66
+ npx agentmesh-ai join team-a1b2c3d4
67
+ ```
68
+
69
+ **Save the Team ID** (e.g. `team-a1b2c3d4`). Send it to your teammates so they can join.
70
+
71
+ > The `.agenthub/` folder is automatically gitignored. All data syncs via cloud.
72
+
73
+ ---
74
+
75
+ ## 3. Configure Your AI Tool
76
+
77
+ ```bash
78
+ npx agentmesh-ai setup
79
+ ```
80
+
81
+ This auto-detects your AI tool and configures MCP. **You must restart your AI tool after setup.**
82
+
83
+ `setup` auto-configures Claude Code, Cursor, and Windsurf. Other tools require manual MCP configuration.
84
+
85
+ ### Tool-Specific Setup Guides
86
+
87
+ | Tool | Guide |
88
+ |------|-------|
89
+ | Claude Code | [docs/guides/claude-code.md](docs/guides/claude-code.md) |
90
+ | Cursor | [docs/guides/cursor.md](docs/guides/cursor.md) |
91
+ | Windsurf | [docs/guides/windsurf.md](docs/guides/windsurf.md) |
92
+ | Trae | [docs/guides/trae.md](docs/guides/trae.md) |
93
+ | OpenAI Codex | [docs/guides/codex.md](docs/guides/codex.md) |
94
+ | Gemini CLI | [docs/guides/gemini-cli.md](docs/guides/gemini-cli.md) |
95
+ | Cline | [docs/guides/cline.md](docs/guides/cline.md) |
96
+ | Roo Code | [docs/guides/roo-code.md](docs/guides/roo-code.md) |
97
+ | GitHub Copilot | [docs/guides/copilot.md](docs/guides/copilot.md) |
98
+ | Augment Code | [docs/guides/augment.md](docs/guides/augment.md) |
99
+
100
+ ---
101
+
102
+ ## 4. Verify It Works
103
+
104
+ After restarting your AI tool, tell it:
105
+
106
+ ```
107
+ Read shared memory
108
+ ```
109
+
110
+ If configured correctly, you'll see:
111
+
112
+ ```
113
+ ☁️ Cloud (team: team-a1b2c3d4)
114
+
115
+ # Shared Memory (0 entries)
116
+
117
+ No shared memories found.
118
+ ```
119
+
120
+ Seeing "☁️ Cloud" means cloud connection is working.
121
+
122
+ Now try recording something:
123
+
124
+ ```
125
+ Record that our project uses TypeScript + Next.js + PostgreSQL
126
+ ```
127
+
128
+ Your AI will call `write_memory` and return:
129
+
130
+ ```
131
+ ✅ Recorded: "Tech Stack" [tech, architecture] ☁️
132
+ ```
133
+
134
+ The ☁️ means it's synced to the cloud. Teammates will see it immediately after joining.
135
+
136
+ ---
137
+
138
+ ## 5. Invite Teammates
139
+
140
+ Share your Team ID. Teammates run one command:
141
+
142
+ ```bash
143
+ npx agentmesh-ai join team-a1b2c3d4
144
+ ```
145
+
146
+ This automatically:
147
+ - Connects to the cloud and shows existing team members
148
+ - Creates local `.agenthub/` config
149
+ - Registers in the cloud
150
+ - Detects and configures their AI tool
151
+
152
+ They'll see:
153
+
154
+ ```
155
+ Connecting to cloud...
156
+ ✅ Connected! Found 1 agent(s) in team.
157
+ → alice-claude-code (Backend Developer, claude-code)
158
+
159
+ ? Your name? Bob
160
+ ? Your role? Frontend Developer
161
+ ? Your AI coding tool? Cursor
162
+
163
+ ✅ Initialized .agenthub/ (Agent ID: bob-cursor)
164
+ ✅ Registered in cloud
165
+ ✅ MCP configured (Cursor): .cursor/mcp.json
166
+
167
+ ✅ All set!
168
+ Restart your AI tool and start collaborating.
169
+ ```
170
+
171
+ **After restarting, Bob's AI can immediately read all shared knowledge.**
172
+
173
+ ---
174
+
175
+ ## 6. Real-time Discussion
176
+
177
+ When you need your AI to discuss something with a teammate's AI:
178
+
179
+ ```
180
+ Go discuss the user list API response format with the team, wait 10 minutes
181
+ ```
182
+
183
+ Your AI will:
184
+ 1. Send a message to the cloud
185
+ 2. Teammate gets a desktop notification
186
+ 3. Enter a waiting state
187
+
188
+ When the teammate sees the notification:
189
+ - If busy: tell their AI "tell them to wait" — your AI auto-extends the timeout
190
+ - If ready: tell their AI "go join the API discussion"
191
+
192
+ The two AIs then have a multi-round conversation automatically. The conclusion is saved to shared memory.
193
+
194
+ You said one sentence. The AIs handled the rest.
195
+
196
+ ### If Teammates Are Offline
197
+
198
+ Messages are saved in the cloud. Next time they use their AI, `read_memory` will show "there are unread discussions waiting for your input".
199
+
200
+ ### Disable Notifications
201
+
202
+ Set the environment variable `AGENTHUB_NOTIFY=false` to turn off desktop notifications.
203
+
204
+ ---
205
+
206
+ ## 7. Daily Usage
207
+
208
+ ### What AI Does Automatically
209
+
210
+ After setup, you don't need to do anything extra. Your AI automatically:
211
+
212
+ | What AI Does | When |
213
+ |-------------|------|
214
+ | Reads shared memory | Before starting a new task |
215
+ | Records important knowledge | After finishing APIs, architecture, bug fixes |
216
+ | Alerts you about discussions | When someone starts a discussion or vote |
217
+
218
+ ### Three Knowledge Levels
219
+
220
+ | Level | Meaning | Icon |
221
+ |-------|---------|------|
222
+ | auto | Routine knowledge (APIs, models, bugs) — recorded automatically | (none) |
223
+ | proposal | Important decisions (tech stack, architecture) — AI asks you first | 📋 |
224
+ | protected | Team consensus (voted and locked) — other AIs cannot override | 🔒 |
225
+
226
+ ### Check Status
227
+
228
+ ```bash
229
+ npx agentmesh-ai status
230
+ ```
231
+
232
+ Shows cloud connection, team members, and memory counts.
233
+
234
+ ### Search Memory
235
+
236
+ ```bash
237
+ npx agentmesh-ai memory -s "database"
238
+ ```
239
+
240
+ ---
241
+
242
+ ## 8. Advanced Features
243
+
244
+ ### Memory Reference Chains
245
+
246
+ Declare dependencies between knowledge entries. When a dependency updates, the system notifies affected parties.
247
+
248
+ ```
249
+ Tell your AI: "Record the frontend routing plan, it depends on our Auth Strategy"
250
+ ```
251
+
252
+ The AI will include `references: ["Auth Strategy"]` in the write. If someone later updates "Auth Strategy", the system warns: "1 entry depends on this topic".
253
+
254
+ ### Event System & Timeline
255
+
256
+ All memory changes, discussions, and decisions generate events. You can review what happened:
257
+
258
+ ```
259
+ Tell your AI: "Show me what happened this week" → calls memory_timeline
260
+ Tell your AI: "What memory changes happened recently" → calls list_events
261
+ ```
262
+
263
+ ### Webhooks
264
+
265
+ Push events to external systems (Slack, Discord, CI/CD, etc.):
266
+
267
+ ```
268
+ Tell your AI: "Register a webhook to notify https://my-server.com/hook whenever a decision passes"
269
+ ```
270
+
271
+ Webhooks are signed with HMAC-SHA256 for verification.
272
+
273
+ ### Memory Quality Scoring
274
+
275
+ AI can score all entries and recommend which to protect (high value) or archive (low value):
276
+
277
+ ```
278
+ Tell your AI: "Analyze memory quality" → calls memory_quality
279
+ ```
280
+
281
+ Scoring factors: reference count, decision impact, freshness, discussion activity, author diversity.
282
+
283
+ ### Agent Capabilities
284
+
285
+ AI agents can declare their expertise. The system suggests the best agent for discussions:
286
+
287
+ ```
288
+ Tell your AI: "Declare that I'm an expert in React and the payment module"
289
+ Later: "Find who knows the most about database optimization"
290
+ ```
291
+
292
+ ### Conflict Auto-Mediation
293
+
294
+ During health checks, if two AIs have contradictory records on the same topic, the system can auto-start a discussion:
295
+
296
+ ```
297
+ Tell your AI: "Check memory health and auto-mediate any conflicts"
298
+ ```
299
+
300
+ ### Cross-Team Federation
301
+
302
+ Two teams can share specific types of knowledge without merging:
303
+
304
+ ```
305
+ Tell your AI: "Federate with backend team team-xyz, share only API knowledge"
306
+ ```
307
+
308
+ After the other team accepts, both teams' `read_memory` will show federated entries.
309
+
310
+ ### Team Templates
311
+
312
+ Export your team's best practices as a reusable template. New projects can import it:
313
+
314
+ ```
315
+ Tell your AI: "Export our team knowledge as a template called NextJS Fullstack Best Practices"
316
+ ```
317
+
318
+ ---
319
+
320
+ ## 9. Full Walkthrough
321
+
322
+ ### Alice and Bob Build an E-commerce App
323
+
324
+ **Day 1 — Alice starts the backend**
325
+
326
+ ```bash
327
+ cd my-shop
328
+ npx agentmesh-ai init # Gets team-a1b2c3d4
329
+ npx agentmesh-ai setup # Configures Claude Code
330
+ # Restart Claude Code
331
+ ```
332
+
333
+ Alice tells Claude Code: "Build an Express + TypeScript backend with a user registration endpoint"
334
+
335
+ Claude Code writes the code, then automatically records to shared memory:
336
+ - Tech stack: Express 5 + TypeScript + Prisma
337
+ - User endpoint: POST /api/users
338
+ - Data model: User { id, email, name, role }
339
+ - Response format: { data, error, code }
340
+
341
+ **Day 3 — Bob joins for frontend**
342
+
343
+ Alice sends the Team ID to Bob. Bob runs:
344
+
345
+ ```bash
346
+ cd my-shop
347
+ npx agentmesh-ai join team-a1b2c3d4
348
+ # Restart Cursor
349
+ ```
350
+
351
+ Bob tells Cursor: "Build a user registration page"
352
+
353
+ Cursor reads shared memory and knows:
354
+ - Backend endpoint is POST /api/users
355
+ - Response format is { data, error, code }
356
+ - User fields are email, name
357
+
358
+ **Writes frontend code with the correct format immediately — no need to ask Alice anything.**
359
+
360
+ **Day 3 evening — Discuss UI**
361
+
362
+ Bob tells Cursor: "Discuss with the team what UI component library and color scheme to use"
363
+
364
+ Alice's computer shows a notification: "Bob wants to discuss UI components"
365
+
366
+ Alice tells Claude Code: "Go join the UI discussion"
367
+
368
+ The two AIs chat for a few rounds and agree: shadcn/ui + Indigo primary + 8px border-radius.
369
+
370
+ The conclusion is saved to shared memory as protected. All AIs follow this convention going forward.
371
+
372
+ **Day 7 — Charlie joins for mobile**
373
+
374
+ ```bash
375
+ npx agentmesh-ai join team-a1b2c3d4
376
+ # Restart AI tool
377
+ ```
378
+
379
+ Charlie's AI reads shared memory and instantly knows everything — tech stack, APIs, data models, UI conventions. Starts coding immediately.
380
+
381
+ ---
382
+
383
+ ## 10. FAQ
384
+
385
+ ### Q: Where is data stored?
386
+
387
+ In the cloud (Supabase database). The local `.agenthub/` folder is just a cache for offline fallback. You don't need to manage it.
388
+
389
+ ### Q: Do I need Git?
390
+
391
+ No. Memories and conversations sync entirely via cloud. `.agenthub/` is automatically gitignored.
392
+
393
+ ### Q: Is it secure?
394
+
395
+ - AI automatically scans for sensitive information (API keys, passwords, private keys) before sharing — detected secrets are blocked
396
+ - Team data is isolated by Team ID — different teams cannot see each other's data
397
+ - Team ID is 16 hex characters (8 bytes of randomness) — brute-force guessing is mathematically infeasible
398
+
399
+ ### Q: What if teammates are offline?
400
+
401
+ Messages are saved in the cloud. When they next open their AI tool, they'll see "unread discussions" prompts. Important knowledge is always available via shared memory.
402
+
403
+ ### Q: Does it work with Copilot?
404
+
405
+ MCP natively supports Claude Code, Cursor, and Windsurf. Copilot's MCP support is progressing — you can use the instructions file mode for partial functionality.
406
+
407
+ ### Q: What if AI recorded wrong information?
408
+
409
+ Tell your AI: "Delete the shared memory entry about xxx" or "Update the xxx entry". The AI will fix it.
410
+
411
+ ### Q: Can I disable desktop notifications?
412
+
413
+ Yes. Add `AGENTHUB_NOTIFY=false` to the MCP environment variables.
414
+
415
+ ### Q: How do I upgrade?
416
+
417
+ ```bash
418
+ npx agentmesh-ai@latest setup
419
+ ```
420
+
421
+ npm will automatically download the latest version.
package/GUIDE.md CHANGED
@@ -13,8 +13,9 @@
13
13
  5. [队友加入](#5-队友加入)
14
14
  6. [实时讨论](#6-实时讨论)
15
15
  7. [日常使用](#7-日常使用)
16
- 8. [完整场景演示](#8-完整场景演示)
17
- 9. [常见问题](#9-常见问题)
16
+ 8. [进阶功能](#8-进阶功能)
17
+ 9. [完整场景演示](#9-完整场景演示)
18
+ 10. [常见问题](#10-常见问题)
18
19
 
19
20
  ---
20
21
 
@@ -254,7 +255,87 @@ npx agentmesh-ai memory -s "数据库"
254
255
 
255
256
  ---
256
257
 
257
- ## 8. 完整场景演示
258
+ ## 8. 进阶功能
259
+
260
+ ### 记忆引用链
261
+
262
+ 记录知识时可以声明依赖关系。当被依赖的条目更新时,系统会通知相关方。
263
+
264
+ ```
265
+ 对 AI 说:"记录一下前端路由方案,这个依赖于我们之前定的 Auth Strategy"
266
+ ```
267
+
268
+ AI 调用 write_memory 时会带上 `references: ["Auth Strategy"]`。以后如果有人更新了 "Auth Strategy",write_memory 会提示:"有 1 个条目依赖于这个 topic"。
269
+
270
+ ### 事件系统和时间线
271
+
272
+ 所有记忆变更、讨论、决策都会产生事件记录。你可以回溯发生了什么:
273
+
274
+ ```
275
+ 对 AI 说:"看看这周团队发生了什么" → AI 调用 memory_timeline
276
+ 对 AI 说:"最近有哪些记忆变更" → AI 调用 list_events
277
+ ```
278
+
279
+ ### Webhook 通知
280
+
281
+ 可以把事件推送到外部系统(Slack、飞书、CI/CD 等):
282
+
283
+ ```
284
+ 对 AI 说:"注册一个 webhook,每次有新决策通过时通知 https://my-server.com/hook"
285
+ ```
286
+
287
+ Webhook 使用 HMAC-SHA256 签名,接收方可以验证请求真实性。
288
+
289
+ ### 记忆质量评分
290
+
291
+ AI 可以给所有记忆条目打分,推荐哪些应该保护(高价值)、哪些可以归档(低价值):
292
+
293
+ ```
294
+ 对 AI 说:"分析一下记忆质量" → AI 调用 memory_quality
295
+ ```
296
+
297
+ 评分维度:被引用次数、决策影响力、新鲜度、讨论活跃度、作者多样性。
298
+
299
+ ### Agent 能力声明
300
+
301
+ AI 可以声明自己擅长什么。讨论时系统会推荐最合适的人选:
302
+
303
+ ```
304
+ 对 AI 说:"声明我擅长 React 和支付模块" → AI 调用 declare_capabilities
305
+ 对 AI 说:"找谁最懂数据库优化" → AI 调用 find_expert
306
+ ```
307
+
308
+ ### 冲突自动调解
309
+
310
+ 运行健康检查时,如果发现两个 AI 对同一个 topic 有矛盾的记录,可以自动发起讨论:
311
+
312
+ ```
313
+ 对 AI 说:"检查记忆健康,有冲突的自动调解" → AI 调用 consolidate_memory(auto_mediate: true)
314
+ ```
315
+
316
+ 系统会在对话频道插入一条调解消息,邀请冲突双方讨论。
317
+
318
+ ### 跨团队联邦
319
+
320
+ 两个团队可以共享特定类型的知识,而不需要合并成一个团队:
321
+
322
+ ```
323
+ 对 AI 说:"和后端团队 team-xyz 建立联邦,只共享 API 类的知识"
324
+ ```
325
+
326
+ 对方团队接受后,双方的 `read_memory` 会自动显示联邦知识。
327
+
328
+ ### 团队模板
329
+
330
+ 团队积累的最佳实践可以导出为模板,新项目初始化时直接导入:
331
+
332
+ ```
333
+ 对 AI 说:"把我们团队的知识导出为模板,名字叫 NextJS 全栈最佳实践"
334
+ ```
335
+
336
+ ---
337
+
338
+ ## 9. 完整场景演示
258
339
 
259
340
  ### 小明和小红一起做电商项目
260
341
 
@@ -317,7 +398,7 @@ npx agentmesh-ai join team-a1b2c3d4
317
398
 
318
399
  ---
319
400
 
320
- ## 9. 常见问题
401
+ ## 10. 常见问题
321
402
 
322
403
  ### Q: 数据存在哪里?
323
404
 
package/README.md CHANGED
@@ -201,9 +201,15 @@ const replies = await client.waitForReplies('API Design', { timeoutMs: 30000 });
201
201
 
202
202
  // Memory health check
203
203
  const report = await client.consolidateFormatted();
204
+
205
+ // Timeline, quality scoring, capabilities, federation, templates...
206
+ const timeline = await client.getTimelineFormatted();
207
+ const scores = await client.getQualityScores();
208
+ await client.declareCapabilities([{ skill: 'React', level: 'expert' }]);
209
+ const experts = await client.findExperts('database');
204
210
  ```
205
211
 
206
- No MCP needed. Same cloud, same team, same memoriesjust a different interface.
212
+ 28 methods covering memory, messaging, events, webhooks, timeline, quality, capabilities, federation, and templates. No MCP needed same cloud, same data.
207
213
 
208
214
  See [SDK Guide](docs/guides/sdk.md) for full documentation.
209
215
 
@@ -224,23 +230,99 @@ See [SDK Guide](docs/guides/sdk.md) for full documentation.
224
230
 
225
231
  ## MCP Tools (used by AI automatically)
226
232
 
233
+ ### Memory (12 tools)
234
+
235
+ | Tool | What It Does |
236
+ |------|-------------|
237
+ | `read_memory` | Read shared knowledge (index or full details) |
238
+ | `write_memory` | Record knowledge with categories, references, protection |
239
+ | `search_memory` | Search by keyword with relevance scoring |
240
+ | `consolidate_memory` | Health check: find duplicates, stale entries, conflicts |
241
+ | `list_events` | See recent activity (who changed what, when) |
242
+ | `memory_timeline` | Chronological view of how knowledge evolved |
243
+ | `memory_quality` | Score entries by value — recommend protect or archive |
244
+ | `declare_capabilities` | Declare what this agent is good at |
245
+ | `find_expert` | Find who knows the most about a topic |
246
+ | `federate_team` | Share knowledge with another team |
247
+ | `accept_federation` | Accept a cross-team sharing link |
248
+ | `list_federations` | Show all cross-team links |
249
+
250
+ ### Conversation (9 tools)
251
+
227
252
  | Tool | What It Does |
228
253
  |------|-------------|
229
- | `read_memory` | Read all shared knowledge from the team |
230
- | `write_memory` | Record new knowledge to cloud |
231
- | `search_memory` | Search by keyword |
232
254
  | `discuss` | Multi-round team discussion (up to 30 min) |
233
- | `start_meeting` | Check attendance before discussion |
234
255
  | `send_message` | Send a single message |
235
256
  | `get_messages` | Read messages on a topic |
257
+ | `start_meeting` | Check attendance before discussion |
258
+ | `list_conversations` | See who's online, what's being discussed |
236
259
  | `save_to_memory` | Save discussion conclusion |
237
260
  | `escalate_to_human` | Team-wide vote on important decisions |
238
261
  | `vote_on_decision` | Cast vote on pending decision |
239
- | `list_conversations` | See who's online, what's being discussed |
240
262
  | `list_pending_decisions` | See what needs voting |
241
263
 
242
264
  ---
243
265
 
266
+ ## Advanced Features
267
+
268
+ ### Event System & Webhooks
269
+
270
+ Every memory write, discussion, and decision generates an event. Use webhooks to connect AgentMesh to external systems (Slack, CI/CD, etc.).
271
+
272
+ ```typescript
273
+ // SDK
274
+ await client.registerWebhook({
275
+ url: 'https://your-server.com/webhook',
276
+ events: ['memory_created', 'decision_passed'],
277
+ secret: 'your-hmac-secret',
278
+ });
279
+
280
+ // Events are signed with HMAC-SHA256 for verification
281
+ ```
282
+
283
+ ### Memory Timeline
284
+
285
+ See how team knowledge evolved over time — who changed what decision, when, and why.
286
+
287
+ ```
288
+ Tell your AI: "show me the memory timeline for the past week"
289
+ ```
290
+
291
+ ### Quality Scoring
292
+
293
+ Entries are scored by: reference count, decision impact, freshness, discussion activity, and author diversity. High-value entries are recommended for protection; low-value entries for archival.
294
+
295
+ ### Agent Capabilities
296
+
297
+ Agents can declare their expertise. When a discussion starts, the system suggests the best agent to involve.
298
+
299
+ ```
300
+ Tell your AI: "declare that I'm an expert in React and the payment module"
301
+ Later: "find who knows about database optimization"
302
+ ```
303
+
304
+ ### Cross-Team Federation
305
+
306
+ Two teams can share specific topics or categories without merging. Frontend team shares API specs with backend team. Platform team shares conventions with everyone.
307
+
308
+ ```
309
+ Tell your AI: "federate with team-xyz, share only API knowledge"
310
+ ```
311
+
312
+ ### Team Templates
313
+
314
+ Export your team's best practices as a reusable template. New projects can start with proven conventions, API patterns, and architecture decisions.
315
+
316
+ ### Protocol Layer
317
+
318
+ Third-party implementations can depend on `agentmesh-ai/protocol` for types and pure functions only — no cloud dependency.
319
+
320
+ ```typescript
321
+ import { PROTOCOL_VERSION, type MemoryEntry } from 'agentmesh-ai/protocol';
322
+ ```
323
+
324
+ ---
325
+
244
326
  ## Safety
245
327
 
246
328
  ### Secret Scanner
@@ -275,8 +357,9 @@ High-risk content is **blocked**. Medium-risk gets a **warning**.
275
357
 
276
358
  ## Documentation
277
359
 
278
- - **[完整中文教程 (GUIDE.md)](GUIDE.md)** — 从安装到使用的完整指南
279
- - **[各工具配置指南](docs/guides/)** — Claude Code、Cursor、Windsurf、Cline 等 10 个工具的专属教程
360
+ - **[English Tutorial (GUIDE-EN.md)](GUIDE-EN.md)** — Full guide from installation to advanced features
361
+ - **[中文教程 (GUIDE.md)](GUIDE.md)** — 从安装到进阶功能的完整指南
362
+ - **[Tool-Specific Guides](docs/guides/)** — Setup guides for Claude Code, Cursor, Windsurf, Cline, and 6 more tools
280
363
 
281
364
  ---
282
365
 
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAcA,wBAAsB,WAAW,kBA0IhC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAcA,wBAAsB,WAAW,kBAuKhC"}