va-claw 0.1.3 → 0.2.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 (56) hide show
  1. package/README.md +130 -0
  2. package/README.zh-CN.md +478 -0
  3. package/dist/va-claw-bundle.mjs +584 -64
  4. package/docs/releases/v0.1.3.md +20 -0
  5. package/package.json +1 -1
  6. package/packages/cli/dist/.tsbuildinfo +1 -1
  7. package/packages/cli/dist/claw-store.d.ts +38 -0
  8. package/packages/cli/dist/claw-store.d.ts.map +1 -0
  9. package/packages/cli/dist/claw-store.js +139 -0
  10. package/packages/cli/dist/claw-store.js.map +1 -0
  11. package/packages/cli/dist/deps.d.ts.map +1 -1
  12. package/packages/cli/dist/deps.js +2 -1
  13. package/packages/cli/dist/deps.js.map +1 -1
  14. package/packages/cli/dist/handlers.d.ts +20 -0
  15. package/packages/cli/dist/handlers.d.ts.map +1 -1
  16. package/packages/cli/dist/handlers.js +159 -1
  17. package/packages/cli/dist/handlers.js.map +1 -1
  18. package/packages/cli/dist/index.d.ts +2 -2
  19. package/packages/cli/dist/index.d.ts.map +1 -1
  20. package/packages/cli/dist/index.js +2 -2
  21. package/packages/cli/dist/index.js.map +1 -1
  22. package/packages/cli/dist/install-files.d.ts +1 -0
  23. package/packages/cli/dist/install-files.d.ts.map +1 -1
  24. package/packages/cli/dist/install-files.js +3 -0
  25. package/packages/cli/dist/install-files.js.map +1 -1
  26. package/packages/cli/dist/output.d.ts +2 -0
  27. package/packages/cli/dist/output.d.ts.map +1 -1
  28. package/packages/cli/dist/output.js +21 -0
  29. package/packages/cli/dist/output.js.map +1 -1
  30. package/packages/cli/dist/program.d.ts.map +1 -1
  31. package/packages/cli/dist/program.js +40 -1
  32. package/packages/cli/dist/program.js.map +1 -1
  33. package/packages/cli/dist/test-helpers.d.ts.map +1 -1
  34. package/packages/cli/dist/test-helpers.js +1 -0
  35. package/packages/cli/dist/test-helpers.js.map +1 -1
  36. package/packages/cli/dist/types.d.ts +1 -0
  37. package/packages/cli/dist/types.d.ts.map +1 -1
  38. package/packages/daemon/dist/.tsbuildinfo +1 -1
  39. package/packages/daemon/dist/wake-cycle.d.ts +19 -2
  40. package/packages/daemon/dist/wake-cycle.d.ts.map +1 -1
  41. package/packages/daemon/dist/wake-cycle.js +209 -30
  42. package/packages/daemon/dist/wake-cycle.js.map +1 -1
  43. package/packages/identity/dist/.tsbuildinfo +1 -1
  44. package/packages/identity/dist/defaults.d.ts +1 -0
  45. package/packages/identity/dist/defaults.d.ts.map +1 -1
  46. package/packages/identity/dist/defaults.js +6 -0
  47. package/packages/identity/dist/defaults.js.map +1 -1
  48. package/packages/identity/dist/render.d.ts.map +1 -1
  49. package/packages/identity/dist/render.js +27 -0
  50. package/packages/identity/dist/render.js.map +1 -1
  51. package/packages/identity/dist/types.d.ts +1 -0
  52. package/packages/identity/dist/types.d.ts.map +1 -1
  53. package/skills/claw-fleet-protocol.md +58 -0
  54. package/skills/install-va-claw.md +4 -0
  55. package/skills/memory-protocol.md +48 -0
  56. package/skills/migrate-to-va-claw.md +141 -0
package/README.md CHANGED
@@ -28,6 +28,8 @@
28
28
  <a href="#vs-openclaw">vs OpenClaw</a>
29
29
  </p>
30
30
 
31
+ > [中文文档](README.zh-CN.md)
32
+
31
33
  ---
32
34
 
33
35
  ## What is va-claw?
@@ -63,6 +65,18 @@ Or add it as a persistent skill so any future agent can self-install va-claw:
63
65
  va-claw skill add https://raw.githubusercontent.com/Vadaski/va-claw/main/skills/install-va-claw.md
64
66
  ```
65
67
 
68
+ Fleet management language support (`va-claw` + `claw` fleet status) is included by default after installation.
69
+
70
+ ### Migrating from OpenClaw or another AI assistant
71
+
72
+ If you already have memories stored in OpenClaw or another Claude-based assistant, use the migration skill to let the agent package its own memories into va-claw — zero manual work:
73
+
74
+ ```bash
75
+ /install https://raw.githubusercontent.com/Vadaski/va-claw/main/skills/migrate-to-va-claw.md
76
+ ```
77
+
78
+ The agent will introspect its stored context, generate a ready-to-run shell script of `va-claw memory memorize` commands, and explain why the move is good for both agent and user.
79
+
66
80
  ---
67
81
 
68
82
  ## Quick Start
@@ -95,6 +109,54 @@ va-claw memory recall "what was I working on"
95
109
  va-claw status
96
110
  ```
97
111
 
112
+ ### Tutorial use cases
113
+
114
+ **1. Query fleet status in natural language**
115
+
116
+ ```bash
117
+ va-claw protocol --text
118
+ ```
119
+
120
+ Outputs a fleet snapshot: daemon status, memory state, and the full list of running claws with their current status.
121
+
122
+ **2. Create and track a long-running claw**
123
+
124
+ ```bash
125
+ va-claw claw add review-claw \
126
+ --goal "Review PRs and summarize risks" \
127
+ --status "running" \
128
+ --tags "review,automation"
129
+ va-claw claw list
130
+ ```
131
+
132
+ The output should include `review-claw` with its goal, status, and tags confirming the task is registered.
133
+
134
+ **3. Update a running claw**
135
+
136
+ ```bash
137
+ va-claw claw set review-claw --status working --note "Investigating auth module"
138
+ va-claw claw heartbeat review-claw
139
+ ```
140
+
141
+ Use this to record what the claw is actively doing and refresh its last-seen timestamp.
142
+
143
+ **4. Quick fleet overview from the CLI**
144
+
145
+ ```bash
146
+ va-claw claw status
147
+ ```
148
+
149
+ Returns a summary of all claws with their run states, plus daemon and service health.
150
+
151
+ **5. Remove a claw and verify the fleet**
152
+
153
+ ```bash
154
+ va-claw claw remove review-claw
155
+ va-claw protocol --text
156
+ ```
157
+
158
+ Confirms the claw is gone and the fleet snapshot reflects the updated state.
159
+
98
160
  ---
99
161
 
100
162
  ## How It Works
@@ -138,6 +200,30 @@ va-claw status
138
200
 
139
201
  ## Features
140
202
 
203
+ ### 🕸 Fleet protocol for long-running claws
204
+
205
+ Once installed, you and your agent can query running claw status through natural language:
206
+
207
+ - "What are my claws doing?"
208
+ - "Show my claw fleet"
209
+ - "Give me a fleet snapshot"
210
+
211
+ This maps to:
212
+
213
+ ```bash
214
+ va-claw protocol --text
215
+ ```
216
+
217
+ Management operations remain through CLI:
218
+
219
+ ```bash
220
+ va-claw claw list
221
+ va-claw claw add <name> --goal "..." --status idle
222
+ va-claw claw set <name> --status running
223
+ va-claw claw heartbeat <name>
224
+ va-claw claw remove <name>
225
+ ```
226
+
141
227
  ### 🧠 Memory
142
228
 
143
229
  Structured SQLite memory with full CRUD, Ebbinghaus forgetting curve, and weighted recall. Your agent doesn't just log outputs — it remembers, forgets, and gets smarter over time.
@@ -198,6 +284,19 @@ Config lives at `~/.va-claw/config.json`:
198
284
  }
199
285
  ```
200
286
 
287
+ **Realistic `wakePrompt` example for a developer agent:**
288
+
289
+ ```json
290
+ {
291
+ "name": "Nova",
292
+ "persona": "Precise and calm. Senior engineer mindset.",
293
+ "systemPrompt": "Act with continuity. Check memory before starting.",
294
+ "wakePrompt": "Open the current repository and do a quick operator health pass: inspect git status, note any uncommitted changes, check the most recent CI/test signals, identify the highest-risk file touched recently, and leave a short summary with the next concrete action if attention is needed.",
295
+ "wakeTimeoutMs": 300000,
296
+ "loopInterval": "0 * * * *"
297
+ }
298
+ ```
299
+
201
300
  ### ⏰ Wake Loop
202
301
 
203
302
  A local cron daemon that wakes your agent on a schedule and writes the output back into memory.
@@ -210,6 +309,28 @@ va-claw status # check health + last wake time
210
309
 
211
310
  Use cases: daily standup summaries, repo health checks, automated PR reviews, background research.
212
311
 
312
+ ## Long-running considerations
313
+
314
+ If you plan to keep `va-claw` running for weeks or months, treat the wake loop like an always-on operator process: budget tokens, watch local disk growth, and rotate logs before they become noise.
315
+
316
+ **Token budget estimation:** a simple planning formula is `wakes per day × average tokens per wake`. Hourly wakes are `24/day`; every 15 minutes is `96/day`. If your prompt + tool output averages 1.5k tokens, an hourly loop is roughly `36k tokens/day` and a 15-minute loop is roughly `144k tokens/day`. Start with a conservative interval, then tighten it only when the wake output is consistently actionable.
317
+
318
+ **`memory.db` growth:** the SQLite store at `~/.va-claw/memory.db` grows with every saved wake. For short repo-health summaries, expect roughly low single-digit KB per wake; for verbose research or review loops it can climb much faster. A practical habit is to check size monthly with `du -h ~/.va-claw/memory.db`, run `va-claw memory consolidate` on a cadence, and avoid wake prompts that dump full diffs or long logs unless you actually need them remembered.
319
+
320
+ **`wake.log` rotation:** each wake also appends one JSON line to `~/.va-claw/wake.log`, including timestamp, duration, exit code, and the last 2 KB of combined output. Create the file on first run, then rotate it with your OS tooling before it grows indefinitely. A minimal `logrotate` example on Linux:
321
+
322
+ ```conf
323
+ /home/you/.va-claw/wake.log {
324
+ size 1M
325
+ rotate 7
326
+ copytruncate
327
+ missingok
328
+ notifempty
329
+ }
330
+ ```
331
+
332
+ On macOS, the equivalent is usually a small `newsyslog.conf` rule or a periodic `mv ~/.va-claw/wake.log ~/.va-claw/wake.log.$(date +%F)` job. The important part is simple: keep a few recent log files, drop the oldest ones, and never let wake diagnostics grow without bound.
333
+
213
334
  ---
214
335
 
215
336
  ## Skills
@@ -287,6 +408,7 @@ va-claw channel slack start
287
408
  # Core
288
409
  va-claw install [--for claude-code|codex|all]
289
410
  va-claw start | stop | status | uninstall
411
+ va-claw protocol [--text]
290
412
 
291
413
  # Identity
292
414
  va-claw identity setup | show | edit
@@ -305,6 +427,14 @@ va-claw memory clear
305
427
  # Skills
306
428
  va-claw skill list | add <path-or-url> | remove <name> | show <name>
307
429
 
430
+ # Long-running claw fleet
431
+ va-claw claw status
432
+ va-claw claw list
433
+ va-claw claw add <name> [--goal ...] [--status running|working|idle|waiting|error|offline|stopped] [--cli-command ...] [--note ...] [--tags ...]
434
+ va-claw claw set <name> [--goal ...] [--status ...] [--cli-command ...] [--note ...] [--tags ...] [--seen]
435
+ va-claw claw heartbeat <name>
436
+ va-claw claw remove <name>
437
+
308
438
  # Channels
309
439
  va-claw channel discord setup | start | stop | status
310
440
  va-claw channel telegram setup --token <t> | start | stop | status
@@ -0,0 +1,478 @@
1
+ <h1 align="center">va-claw</h1>
2
+
3
+ <p align="center">
4
+ <b>30 秒,让你的 Claude Code 或 OpenCode 进化成 OpenClaw。</b>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/Vadaski/va-claw/actions/workflows/ci.yml">
9
+ <img src="https://github.com/Vadaski/va-claw/actions/workflows/ci.yml/badge.svg" alt="CI">
10
+ </a>
11
+ <a href="https://www.npmjs.com/package/va-claw">
12
+ <img src="https://img.shields.io/npm/v/va-claw.svg" alt="npm">
13
+ </a>
14
+ <a href="LICENSE">
15
+ <img src="https://img.shields.io/github/license/Vadaski/va-claw.svg" alt="License">
16
+ </a>
17
+ <a href="https://www.npmjs.com/package/va-claw">
18
+ <img src="https://img.shields.io/npm/dm/va-claw.svg" alt="Downloads">
19
+ </a>
20
+ </p>
21
+
22
+ <p align="center">
23
+ <a href="https://vadaski.github.io/va-claw">🌐 官网</a> •
24
+ <a href="#快速开始">快速开始</a> •
25
+ <a href="#工作原理">工作原理</a> •
26
+ <a href="#功能详解">功能详解</a> •
27
+ <a href="#频道接入">频道接入</a> •
28
+ <a href="#对比-openclaw">对比 OpenClaw</a>
29
+ </p>
30
+
31
+ > [English](README.md)
32
+
33
+ ---
34
+
35
+ ## va-claw 是什么?
36
+
37
+ <p align="center">
38
+ <img src="docs/comic.svg" alt="va-claw comic strip: from session-reset pain to OpenClaw fleet" width="900"/>
39
+ </p>
40
+
41
+ **va-claw** 是一个轻量插件,为你已有的任意 CLI Agent 添加 OpenClaw 的三大核心能力:
42
+
43
+ | | 没有 va-claw | 有 va-claw |
44
+ |---|---|---|
45
+ | **记忆** | 每次会话重置 | 持久化 SQLite 记忆,支持语义搜索 |
46
+ | **身份** | 通用助手 | 固定 persona,每次会话自动注入 |
47
+ | **唤醒循环** | 需要你主动触发 | 定时守护进程自动唤醒 Agent |
48
+
49
+ > *无需新网关,无需学新 CLI。装上插件,你现有的 `claude` 或 `codex` 就拥有了持久记忆、固定身份,并能在后台自主运行。*
50
+
51
+ ---
52
+
53
+ ## 通过 Skill 安装(零配置)
54
+
55
+ 最快的安装方式是在任意 Claude Code 或 OpenCode 会话中执行安装 skill,Agent 会自动完成所有步骤——检查先决条件、执行安装、配置身份、启动守护进程。
56
+
57
+ ```bash
58
+ # 在任意 Claude Code 或 OpenCode 会话中运行:
59
+ /install https://raw.githubusercontent.com/Vadaski/va-claw/main/skills/install-va-claw.md
60
+ ```
61
+
62
+ 或者将其添加为持久 skill,以便未来任意 Agent 都能自行安装 va-claw:
63
+
64
+ ```bash
65
+ va-claw skill add https://raw.githubusercontent.com/Vadaski/va-claw/main/skills/install-va-claw.md
66
+ ```
67
+
68
+ 安装完成后,fleet 管理语言支持(`va-claw` + `claw` fleet 状态查询)默认已包含。
69
+
70
+ ### 从 OpenClaw 或其他 AI 助手迁移
71
+
72
+ 如果你在 OpenClaw 或其他 Claude 系助手中已积累了记忆数据,可以使用迁移 skill 让 Agent 自动打包记忆并导入 va-claw,无需任何手动操作:
73
+
74
+ ```bash
75
+ /install https://raw.githubusercontent.com/Vadaski/va-claw/main/skills/migrate-to-va-claw.md
76
+ ```
77
+
78
+ Agent 会自检已存储的上下文,生成一份可直接运行的 `va-claw memory memorize` 命令脚本,并解释为什么迁移对 Agent 和用户都有好处。
79
+
80
+ ---
81
+
82
+ ## 快速开始
83
+
84
+ ### 先决条件
85
+
86
+ - **Node.js** >= 22
87
+ - 已安装 **Claude Code**(`npm install -g @anthropic-ai/claude-code`)或 **OpenCode / Codex**
88
+
89
+ ### 安装并启动
90
+
91
+ ```bash
92
+ npm install -g va-claw
93
+ va-claw install # 将身份注入 ~/.claude/CLAUDE.md 或 ~/.codex/instructions.md
94
+ va-claw start # 启动后台守护进程
95
+ ```
96
+
97
+ 就这些。你的 CLI Agent 现在拥有了记忆、固定身份,并在后台自主运行。
98
+
99
+ ### 第一步
100
+
101
+ ```bash
102
+ # 查看 Agent 最近在做什么
103
+ va-claw memory list
104
+
105
+ # 搜索历史唤醒输出
106
+ va-claw memory recall "上次在做什么"
107
+
108
+ # 检查守护进程健康状态
109
+ va-claw status
110
+ ```
111
+
112
+ ### 使用示例
113
+
114
+ **1. 用自然语言查询 fleet 状态**
115
+
116
+ ```bash
117
+ va-claw protocol --text
118
+ ```
119
+
120
+ 输出一份 fleet 快照:守护进程状态、记忆状态,以及所有 claw 的名称与当前运行状态。
121
+
122
+ **2. 创建并追踪一个长期任务 claw**
123
+
124
+ ```bash
125
+ va-claw claw add review-claw \
126
+ --goal "Review PRs and summarize risks" \
127
+ --status "running" \
128
+ --tags "review,automation"
129
+ va-claw claw list
130
+ ```
131
+
132
+ 输出应包含 `review-claw` 的 goal、status、tags,表明任务已注册成功。
133
+
134
+ **3. 更新运行中的 claw**
135
+
136
+ ```bash
137
+ va-claw claw set review-claw --status working --note "Investigating auth module"
138
+ va-claw claw heartbeat review-claw
139
+ ```
140
+
141
+ 用于记录 claw 当前正在处理的内容,并刷新最后活跃时间。
142
+
143
+ **4. 快速查看 fleet 概览**
144
+
145
+ ```bash
146
+ va-claw claw status
147
+ ```
148
+
149
+ 返回所有 claw 的运行状态摘要,附带守护进程与服务健康信息。
150
+
151
+ **5. 下线过期 claw 并验证**
152
+
153
+ ```bash
154
+ va-claw claw remove review-claw
155
+ va-claw protocol --text
156
+ ```
157
+
158
+ 确认该 claw 已消失,fleet 快照已更新。
159
+
160
+ ---
161
+
162
+ ## 工作原理
163
+
164
+ ```
165
+ ┌──────────────────┐ ┌──────────────────┐
166
+ │ Claude Code │ │ OpenCode/Codex │
167
+ └────────┬─────────┘ └────────┬─────────┘
168
+ │ 注入身份 │ 注入身份
169
+ │ 通过 CLAUDE.md / instructions.md
170
+ └──────────┬───────────────┘
171
+
172
+ ┌──────────▼───────────┐
173
+ │ va-claw 守护进程 │
174
+ │ │
175
+ │ ┌────────────────┐ │
176
+ │ │ 唤醒循环 │ │ ← cron 定时,静默运行
177
+ │ │ (croner) │ │
178
+ │ └───────┬────────┘ │
179
+ │ │ │
180
+ │ ┌───────▼────────┐ │
181
+ │ │ 记忆存储 │ │ ← SQLite,~/.va-claw/memory.db
182
+ │ │ (node:sqlite) │ │
183
+ │ └───────┬────────┘ │
184
+ │ │ │
185
+ │ ┌───────▼────────┐ │
186
+ │ │ Skills 层 │ │ ← Markdown 格式,零编译
187
+ │ └────────────────┘ │
188
+ └──────────────────────┘
189
+
190
+ ┌───────────┼───────────┐
191
+ │ │ │
192
+ ┌────▼────┐ ┌────▼────┐ ┌───▼─────┐
193
+ │ Discord │ │Telegram │ │ Slack │
194
+ └─────────┘ └─────────┘ └─────────┘
195
+ ```
196
+
197
+ **单一守护进程。本地 SQLite。零云端依赖。** 每次唤醒的输出自动写入记忆,下一次会话始终有上下文可用。
198
+
199
+ ---
200
+
201
+ ## 功能详解
202
+
203
+ ### 🕸 长期 claw 的 Fleet 协议
204
+
205
+ 安装完成后,你和 Agent 都可以通过自然语言查询 claw 运行状态:
206
+
207
+ - "我的 claw 们都在干什么?"
208
+ - "显示我的 claw fleet"
209
+ - "给我一份 fleet 快照"
210
+
211
+ 这会映射到:
212
+
213
+ ```bash
214
+ va-claw protocol --text
215
+ ```
216
+
217
+ 管理操作通过 CLI 完成:
218
+
219
+ ```bash
220
+ va-claw claw list
221
+ va-claw claw add <name> --goal "..." --status idle
222
+ va-claw claw set <name> --status running
223
+ va-claw claw heartbeat <name>
224
+ va-claw claw remove <name>
225
+ ```
226
+
227
+ ### 🧠 记忆
228
+
229
+ 结构化 SQLite 记忆,支持完整 CRUD、艾宾浩斯遗忘曲线和加权召回。Agent 不只是记录输出——它会记忆、遗忘,并随时间变得更智能。
230
+
231
+ **存储一条命名记忆:**
232
+
233
+ ```bash
234
+ va-claw memory memorize "auth-pattern" \
235
+ "Always use JWT with 1h expiry and refresh token rotation" \
236
+ --tags auth,security \
237
+ --importance 0.9 \
238
+ --details "Single-use refresh tokens mandatory after Feb incident"
239
+ ```
240
+
241
+ **完整 CRUD:**
242
+
243
+ ```bash
244
+ va-claw memory get auth-pattern # 按 key 检索
245
+ va-claw memory update auth-pattern --importance 1.0 # 更新字段
246
+ va-claw memory forget auth-pattern # 删除单条记忆
247
+ va-claw memory clear # 清空全部
248
+ ```
249
+
250
+ **召回:**
251
+
252
+ ```bash
253
+ va-claw memory recall "JWT authentication" # 加权搜索:tags > triggers > essence > details
254
+ va-claw memory list --limit 20 # 最近条目
255
+ ```
256
+
257
+ **维护(艾宾浩斯模型):**
258
+
259
+ ```bash
260
+ va-claw memory consolidate # 清理衰减记忆,强化最近访问的条目
261
+ va-claw memory reflect # 按 tag 分组的 Markdown 摘要
262
+ ```
263
+
264
+ 每条记忆都有 `strength`、`importance` 和 `decayTau`。高重要性记忆的衰减速度慢约 3 倍。访问一条记忆会强化它。`consolidate` 自动执行遗忘曲线并清理已失效的条目。
265
+
266
+ ### 🎭 身份
267
+
268
+ 定义 Agent 的名称、persona 和行为方式一次,自动注入每一次 Claude Code 或 OpenCode 会话。
269
+
270
+ ```bash
271
+ va-claw identity setup # 交互式向导
272
+ va-claw identity show # 查看当前配置
273
+ ```
274
+
275
+ 配置文件位于 `~/.va-claw/config.json`:
276
+
277
+ ```json
278
+ {
279
+ "name": "Nova",
280
+ "persona": "Precise and calm. Senior engineer mindset.",
281
+ "systemPrompt": "Act with continuity. Check memory before starting.",
282
+ "wakePrompt": "Check repo status and summarize what needs attention.",
283
+ "loopInterval": "0 * * * *"
284
+ }
285
+ ```
286
+
287
+ **开发者 Agent 的真实 `wakePrompt` 示例:**
288
+
289
+ ```json
290
+ {
291
+ "name": "Nova",
292
+ "persona": "Precise and calm. Senior engineer mindset.",
293
+ "systemPrompt": "Act with continuity. Check memory before starting.",
294
+ "wakePrompt": "Open the current repository and do a quick operator health pass: inspect git status, note any uncommitted changes, check the most recent CI/test signals, identify the highest-risk file touched recently, and leave a short summary with the next concrete action if attention is needed.",
295
+ "wakeTimeoutMs": 300000,
296
+ "loopInterval": "0 * * * *"
297
+ }
298
+ ```
299
+
300
+ ### ⏰ 唤醒循环
301
+
302
+ 本地 cron 守护进程,按计划唤醒 Agent 并将输出写回记忆。
303
+
304
+ ```bash
305
+ va-claw start # 启动守护进程
306
+ va-claw stop # 停止守护进程
307
+ va-claw status # 检查健康状态 + 最后唤醒时间
308
+ ```
309
+
310
+ 典型用途:每日站会摘要、仓库健康检查、自动 PR 审查、后台调研。
311
+
312
+ ## 长期运行注意事项
313
+
314
+ 如果计划让 `va-claw` 持续运行数周或数月,请把唤醒循环当作一个常驻运营进程来对待:规划 token 预算,关注本地磁盘增长,在日志积累成噪音之前做好轮转。
315
+
316
+ **Token 预算估算:** 简单公式是 `每日唤醒次数 × 平均每次唤醒 token 数`。每小时唤醒是 `24次/天`;每 15 分钟唤醒是 `96次/天`。若 prompt + 工具输出平均 1.5k token,每小时循环大约消耗 `36k token/天`,15 分钟循环大约 `144k token/天`。建议从保守的频率开始,仅在唤醒输出持续有价值时才缩短间隔。
317
+
318
+ **`memory.db` 增长:** `~/.va-claw/memory.db` 中的 SQLite 存储会随每次唤醒保存而增长。简短的仓库健康摘要每次约增长低个位数 KB;详细的调研或审查循环则增长更快。建议每月用 `du -h ~/.va-claw/memory.db` 检查大小,定期运行 `va-claw memory consolidate`,并避免在 wake prompt 中倾倒完整 diff 或长日志(除非你确实需要记住这些内容)。
319
+
320
+ **`wake.log` 轮转:** 每次唤醒都会向 `~/.va-claw/wake.log` 追加一行 JSON,包含时间戳、耗时、退出码和最后 2 KB 的合并输出。首次运行时自动创建该文件,之后使用系统工具轮转,避免无限增长。Linux 下的 `logrotate` 最简示例:
321
+
322
+ ```conf
323
+ /home/you/.va-claw/wake.log {
324
+ size 1M
325
+ rotate 7
326
+ copytruncate
327
+ missingok
328
+ notifempty
329
+ }
330
+ ```
331
+
332
+ 在 macOS 上,通常可以用一条小的 `newsyslog.conf` 规则或定期执行 `mv ~/.va-claw/wake.log ~/.va-claw/wake.log.$(date +%F)` 来实现。核心原则很简单:保留最近几份日志文件,删除最旧的,不要让唤醒诊断日志无限增长。
333
+
334
+ ---
335
+
336
+ ## Skills
337
+
338
+ 用普通 Markdown 文件扩展 Agent 行为——无需编译,无需配置:
339
+
340
+ ```bash
341
+ va-claw skill add ./my-skill.md # 本地文件
342
+ va-claw skill add https://example.com/skills/git.md # 远程 URL
343
+
344
+ va-claw skill list
345
+ va-claw skill show <name>
346
+ va-claw skill remove <name>
347
+ ```
348
+
349
+ > **安全提示:** 安装来源不明的 skill 前,请先用 [Skill Vetter](https://clawhub.ai/spclaudehome/Skill-vetter) 审查——这是一个零占用的 skill,会检查凭证访问、外部请求、混淆代码等风险,并生成风险报告。
350
+ >
351
+ > ```bash
352
+ > # 安装一次,永久可用
353
+ > va-claw skill add https://clawhub.ai/spclaudehome/Skill-vetter
354
+ > ```
355
+
356
+ skill 文件格式示例:
357
+
358
+ ```markdown
359
+ ---
360
+ name: git-hygiene
361
+ description: Check for stale branches and large commits
362
+ version: 1.0.0
363
+ triggers:
364
+ - git
365
+ - branch
366
+ - commit
367
+ ---
368
+
369
+ When checking the repository, always:
370
+ 1. List branches older than 30 days
371
+ 2. Flag commits larger than 500 lines
372
+ 3. Suggest a cleanup plan
373
+ ```
374
+
375
+ ---
376
+
377
+ ## 频道接入
378
+
379
+ 将唤醒循环接入 Discord、Telegram 或 Slack,远程接收输出并发送指令。
380
+
381
+ ### Discord
382
+
383
+ ```bash
384
+ va-claw channel discord setup
385
+ va-claw channel discord start
386
+ va-claw channel discord status
387
+ ```
388
+
389
+ ### Telegram
390
+
391
+ ```bash
392
+ va-claw channel telegram setup --token <bot-token>
393
+ va-claw channel telegram start
394
+ ```
395
+
396
+ ### Slack
397
+
398
+ ```bash
399
+ va-claw channel slack setup --bot-token <xoxb-...> --app-token <xapp-...>
400
+ va-claw channel slack start
401
+ ```
402
+
403
+ ---
404
+
405
+ ## 完整 CLI 参考
406
+
407
+ ```bash
408
+ # 核心
409
+ va-claw install [--for claude-code|codex|all]
410
+ va-claw start | stop | status | uninstall
411
+ va-claw protocol [--text]
412
+
413
+ # 身份
414
+ va-claw identity setup | show | edit
415
+
416
+ # 记忆 — 完整 CRUD + 艾宾浩斯生命周期
417
+ va-claw memory memorize <key> <essence> [--tags t1,t2] [--details "..."] [--importance 0-1]
418
+ va-claw memory get <key>
419
+ va-claw memory update <key> [--essence "..."] [--tags "..."] [--importance 0-1] [--details "..."]
420
+ va-claw memory forget <key>
421
+ va-claw memory recall <query> [--limit <n>]
422
+ va-claw memory list [--limit <n>]
423
+ va-claw memory consolidate
424
+ va-claw memory reflect
425
+ va-claw memory clear
426
+
427
+ # Skills
428
+ va-claw skill list | add <path-or-url> | remove <name> | show <name>
429
+
430
+ # 长期 claw fleet
431
+ va-claw claw status
432
+ va-claw claw list
433
+ va-claw claw add <name> [--goal ...] [--status running|working|idle|waiting|error|offline|stopped] [--cli-command ...] [--note ...] [--tags ...]
434
+ va-claw claw set <name> [--goal ...] [--status ...] [--cli-command ...] [--note ...] [--tags ...] [--seen]
435
+ va-claw claw heartbeat <name>
436
+ va-claw claw remove <name>
437
+
438
+ # 频道
439
+ va-claw channel discord setup | start | stop | status
440
+ va-claw channel telegram setup --token <t> | start | stop | status
441
+ va-claw channel slack setup --bot-token <t> --app-token <t> | start | stop | status
442
+ ```
443
+
444
+ ---
445
+
446
+ ## 对比 OpenClaw
447
+
448
+ | | **va-claw** | **OpenClaw** |
449
+ |---|---|---|
450
+ | **定位** | 现有 CLI 的插件 | 独立 AI Agent 系统 |
451
+ | **安装** | `npm install -g va-claw` | 完整网关安装 |
452
+ | **Agent** | Claude Code、OpenCode、Codex | 自有运行时 |
453
+ | **记忆** | SQLite(本地) | SQLite + Markdown 压缩 |
454
+ | **频道** | Discord、Telegram、Slack | WhatsApp、iMessage 等更多 |
455
+ | **体积** | ~2 MB,零云端依赖 | 完整服务栈 |
456
+ | **适合** | 已在用 Claude Code / Codex 的开发者 | 想要独立专属 Agent 的用户 |
457
+
458
+ **va-claw = OpenClaw 的灵魂 + Claude Code 的躯体。** 如果你已经在为 Claude Code 或 OpenCode 付费,不必再单独跑一套 Agent 系统——只需把你缺少的三大能力装上即可。
459
+
460
+ ---
461
+
462
+ ## 开发
463
+
464
+ ```bash
465
+ git clone https://github.com/Vadaski/va-claw.git
466
+ cd va-claw
467
+ pnpm install
468
+ pnpm build
469
+ pnpm test
470
+ ```
471
+
472
+ 贡献指南见 [CONTRIBUTING.md](CONTRIBUTING.md)。
473
+
474
+ ---
475
+
476
+ ## 许可证
477
+
478
+ [MIT](LICENSE) © Vadaski