docs(zh-CN): sync Chinese docs with latest upstream changes (#341)

* docs(zh-CN): sync Chinese docs with latest upstream changes

* docs(zh-CN): update link

---------

Co-authored-by: neo <neo.dowithless@gmail.com>
This commit is contained in:
zdoc.app
2026-03-08 06:48:02 +08:00
committed by GitHub
parent da17d33ac3
commit abcf38b085
53 changed files with 2977 additions and 610 deletions

View File

@@ -1,10 +1,10 @@
---
description: 启动 NanoClaw 代理 REPL —— 一个由 claude CLI 驱动的持久、会话感知的 AI 助手
description: 启动 NanoClaw v2 — ECC 的持久、零依赖 REPL具备模型路由、技能热加载、分支、压缩、导出和指标功能
---
# Claw 命令
启动一个交互式 AI 代理会话,该会话将会话历史持久化到磁盘,并可选择加载 ECC 技能上下文
启动一个具有持久化 Markdown 历史记录和操作控制的交互式 AI 代理会话。
## 使用方法
@@ -23,57 +23,29 @@ npm run claw
| 变量 | 默认值 | 描述 |
|----------|---------|-------------|
| `CLAW_SESSION` | `default` | 会话名称(字母数字 + 连字符) |
| `CLAW_SKILLS` | *(空)* | 要加载为系统上下文的技能名称,以逗号分隔 |
| `CLAW_SKILLS` | *(空)* | 启动时加载的以逗号分隔的技能列表 |
| `CLAW_MODEL` | `sonnet` | 会话的默认模型 |
## REPL 命令
在 REPL 内部,直接在提示符下输入这些命令:
```
/clear Clear current session history
/history Print full conversation history
/sessions List all saved sessions
/help Show available commands
exit Quit the REPL
```text
/help Show help
/clear Clear current session history
/history Print full conversation history
/sessions List saved sessions
/model [name] Show/set model
/load <skill-name> Hot-load a skill into context
/branch <session-name> Branch current session
/search <query> Search query across sessions
/compact Compact old turns, keep recent context
/export <md|json|txt> [path] Export session
/metrics Show session metrics
exit Quit
```
## 工作原理
## 说明
1. 读取 `CLAW_SESSION` 环境变量以选择命名会话(默认:`default`
2. `~/.claude/claw/{session}.md` 加载会话历史
3. 可选地从 `CLAW_SKILLS` 环境变量加载 ECC 技能上下文
4. 进入一个阻塞式提示循环 —— 每条用户消息都会连同完整历史记录发送到 `claude -p`
5. 响应会被追加到会话文件中,以便在重启后保持持久性
## 会话存储
会话以 Markdown 文件形式存储在 `~/.claude/claw/` 中:
```
~/.claude/claw/default.md
~/.claude/claw/my-project.md
```
每一轮对话的格式如下:
```markdown
### [2025-01-15T10:30:00.000Z] 用户
这个函数是做什么的?
---
### [2025-01-15T10:30:05.000Z] 助手
这个函数用于计算...
---
```
## 示例
```bash
# Start default session
node scripts/claw.js
# Named session
CLAW_SESSION=my-project node scripts/claw.js
# With skill context
CLAW_SKILLS=tdd-workflow,security-review node scripts/claw.js
```
* NanoClaw 保持零依赖。
* 会话存储在 `~/.claude/claw/<session>.md`
* 压缩会保留最近的回合并写入压缩头。
* 导出支持 Markdown、JSON 回合和纯文本。