From 5a077d0139952d6aefba4de4115db8f6338fe24f Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Fri, 13 Mar 2026 21:03:23 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20cleanup:=20remove=20translations?=
=?UTF-8?q?=20and=20consolidate=20documentation=20to=20English?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Remove all non-English README and CONTRIBUTING files.
- Translate Chinese documentation for DingTalk, Discord, LINE, MaixCam, OneBot, QQ, Slack, and Telegram to English.
- Translate design document for Issue #783 to English.
- Clean up root README.md and CONTRIBUTING.md to remove translation links and bilingual text.
- Standardize all repository documentation to English.
Co-authored-by: hobbyistlabs-coder <267281733+hobbyistlabs-coder@users.noreply.github.com>
---
CONTRIBUTING.md | 2 +-
CONTRIBUTING.zh.md | 303 ----
README.fr.md | 1112 -------------
README.ja.md | 1033 ------------
README.md | 8 +-
README.pt-br.md | 1107 -------------
README.vi.md | 1075 -------------
README.zh.md | 899 -----------
docs/channels/dingtalk/README.md | 33 +
docs/channels/dingtalk/README.zh.md | 33 -
docs/channels/discord/README.md | 37 +
docs/channels/discord/README.zh.md | 37 -
docs/channels/line/README.md | 38 +
docs/channels/line/README.zh.md | 38 -
docs/channels/maixcam/README.md | 31 +
docs/channels/maixcam/README.zh.md | 31 -
docs/channels/matrix/README.zh.md | 59 -
docs/channels/onebot/README.md | 31 +
docs/channels/onebot/README.zh.md | 31 -
docs/channels/qq/README.md | 32 +
docs/channels/qq/README.zh.md | 32 -
docs/channels/slack/README.md | 33 +
docs/channels/slack/README.zh.md | 33 -
docs/channels/telegram/README.md | 33 +
docs/channels/telegram/README.zh.md | 33 -
.../issue-783-investigation-and-fix-plan.md | 61 +
...issue-783-investigation-and-fix-plan.zh.md | 61 -
pkg/channels/README.zh.md | 1378 -----------------
28 files changed, 333 insertions(+), 7301 deletions(-)
delete mode 100644 CONTRIBUTING.zh.md
delete mode 100644 README.fr.md
delete mode 100644 README.ja.md
delete mode 100644 README.pt-br.md
delete mode 100644 README.vi.md
delete mode 100644 README.zh.md
create mode 100644 docs/channels/dingtalk/README.md
delete mode 100644 docs/channels/dingtalk/README.zh.md
create mode 100644 docs/channels/discord/README.md
delete mode 100644 docs/channels/discord/README.zh.md
create mode 100644 docs/channels/line/README.md
delete mode 100644 docs/channels/line/README.zh.md
create mode 100644 docs/channels/maixcam/README.md
delete mode 100644 docs/channels/maixcam/README.zh.md
delete mode 100644 docs/channels/matrix/README.zh.md
create mode 100644 docs/channels/onebot/README.md
delete mode 100644 docs/channels/onebot/README.zh.md
create mode 100644 docs/channels/qq/README.md
delete mode 100644 docs/channels/qq/README.zh.md
create mode 100644 docs/channels/slack/README.md
delete mode 100644 docs/channels/slack/README.zh.md
create mode 100644 docs/channels/telegram/README.md
delete mode 100644 docs/channels/telegram/README.zh.md
create mode 100644 docs/design/issue-783-investigation-and-fix-plan.md
delete mode 100644 docs/design/issue-783-investigation-and-fix-plan.zh.md
delete mode 100644 pkg/channels/README.zh.md
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ceff723d2..688ac1b62 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -108,7 +108,7 @@ Use descriptive branch names, e.g. `fix/telegram-timeout`, `feat/ollama-provider
- Reference the related issue when relevant: `Fix session leak (#123)`.
- Keep commits focused. One logical change per commit is preferred.
- For minor cleanups or typo fixes, squash them into a single commit before opening a PR.
-- Refer to https://www.conventionalcommits.org/zh-hans/v1.0.0/
+- Refer to https://www.conventionalcommits.org/en/v1.0.0/
### Keeping Up to Date
diff --git a/CONTRIBUTING.zh.md b/CONTRIBUTING.zh.md
deleted file mode 100644
index 196aecc65..000000000
--- a/CONTRIBUTING.zh.md
+++ /dev/null
@@ -1,303 +0,0 @@
-# 参与贡献 PicoClaw
-
-感谢你对 PicoClaw 的关注!本项目是一个社区驱动的开源项目,目标是构建 轻量灵活,人人可用 的个人AI助手。我们欢迎一切形式的贡献:Bug 修复、新功能、文档、翻译和测试。
-
-PicoClaw 本身在很大程度上是借助 AI 辅助开发的——我们拥抱这种方式,并围绕它构建了贡献流程。
-
-## 目录
-
-- [行为准则](#行为准则)
-- [贡献方式](#贡献方式)
-- [快速开始](#快速开始)
-- [开发环境配置](#开发环境配置)
-- [提交修改](#提交修改)
-- [AI 辅助贡献](#ai-辅助贡献)
-- [Pull Request 流程](#pull-request-流程)
-- [分支策略](#分支策略)
-- [代码审查](#代码审查)
-- [沟通渠道](#沟通渠道)
-
----
-
-## 行为准则
-
-我们致力于维护一个友好、互相尊重的社区环境。请保持善意、建设性的态度,并善意地理解他人。任何形式的骚扰或歧视均不被接受。
-
----
-
-## 贡献方式
-
-- **Bug 反馈** — 使用 Bug 报告模板提交 Issue。
-- **功能建议** — 使用功能请求模板提交 Issue,建议在开始实现前先进行讨论。
-- **代码贡献** — 修复 Bug 或实现新功能,参见下方工作流程。
-- **文档改进** — 完善 README、文档、代码注释或翻译。
-- **测试与验证** — 在新硬件、新渠道或新 LLM 提供商上运行 PicoClaw 并反馈结果。
-
-对于较大的新功能,请先提交 Issue 讨论设计方案,再动手写代码。这能避免无效投入,也确保与项目方向保持一致。
-
----
-
-## 快速开始
-
-1. 在 GitHub 上 **Fork** 本仓库。
-2. 将你的 Fork **克隆**到本地:
- ```bash
- git clone https://github.com/<你的用户名>/picoclaw.git
- cd picoclaw
- ```
-3. 添加上游远程仓库:
- ```bash
- git remote add upstream https://github.com/sipeed/picoclaw.git
- ```
-
----
-
-## 开发环境配置
-
-### 前置依赖
-
-- Go 1.25 或更高版本
-- `make`
-
-### 构建
-
-```bash
-make build # 构建二进制文件(会先执行 go generate)
-make generate # 仅执行 go generate
-make check # 完整的提交前检查:deps + fmt + vet + test
-```
-
-### 运行测试
-
-```bash
-make test # 运行所有测试
-go test -run TestName -v ./pkg/session/ # 运行单个测试
-go test -bench=. -benchmem -run='^$' ./... # 运行基准测试
-```
-
-### 代码风格
-
-```bash
-make fmt # 格式化代码
-make vet # 静态分析
-make lint # 完整的 lint 检查
-```
-
-所有 CI 检查通过后 PR 才能被合并。推送代码前请先在本地运行 `make check`,提前发现问题。
-
----
-
-## 提交修改
-
-### 分支管理
-
-始终从 `main` 分支切出,并在 PR 中以 `main` 为目标分支。不要直接向 `main` 或任何 `release/*` 分支推送代码:
-
-```bash
-git checkout main
-git pull upstream main
-git checkout -b 你的功能分支名
-```
-
-请使用描述性的分支名,例如:`fix/telegram-timeout`、`feat/ollama-provider`、`docs/contributing-guide`。
-
-### Commit 规范
-
-- 使用英文撰写清晰、简洁的 commit 信息。
-- 使用祈使句:写 "Add retry logic",而不是 "Added retry logic"。
-- 有关联 Issue 时请引用:`Fix session leak (#123)`。
-- 保持 commit 专注,每个 commit 只做一件事。
-- 对于小的清理或拼写修正,提 PR 前请将其合并为一个 commit。
-- 按照 https://www.conventionalcommits.org/zh-hans/v1.0.0/ 规范来撰写
-
-### 保持与上游同步
-
-提 PR 前,请将你的分支变基到上游 `main`:
-
-```bash
-git fetch upstream
-git rebase upstream/main
-```
-
----
-
-## AI 辅助贡献
-
-PicoClaw 在很大程度上借助 AI 辅助开发,我们完全拥抱这种开发方式。但贡献者必须清楚地了解自己在使用 AI 工具时所承担的责任。
-
-### 必须披露 AI 使用情况
-
-每个 PR 都必须通过 PR 模板中的 **🤖 AI 代码生成** 部分披露 AI 参与情况,共分三个级别:
-
-| 级别 | 说明 |
-|---|---|
-| 🤖 完全由 AI 生成 | AI 编写代码,贡献者负责审查和验证 |
-| 🛠️ 主要由 AI 生成 | AI 起草,贡献者做了较大修改 |
-| 👨💻 主要由人工编写 | 贡献者主导,AI 仅提供辅助或未使用 AI |
-
-我们期望你诚实填写。三种级别均可接受,没有任何歧视——重要的是贡献的质量。
-
-### 你对提交的代码负全责
-
-使用 AI 生成代码并不能减轻你作为贡献者的责任。在提交含有 AI 生成代码的 PR 之前,你必须:
-
-- **逐行阅读并理解**生成的代码。
-- **在真实环境中测试**(参见 PR 模板中的测试环境部分)。
-- **检查安全问题** — AI 模型可能生成存在安全隐患的代码(如路径穿越、注入攻击、凭据泄露等),请仔细审查。
-- **验证正确性** — AI 生成的逻辑可能听起来合理但实际上是错误的,请验证行为,而不仅仅是语法。
-
-如果明显可以看出贡献者没有阅读或测试 AI 生成的代码,该 PR 将被直接关闭,不予审查。
-
-### AI 生成代码的质量标准
-
-AI 生成的代码与人工编写的代码遵循**相同的质量要求**:
-
-- 必须通过所有 CI 检查(`make check`)。
-- 必须符合 Go 惯用写法,并与现有代码库的风格保持一致。
-- 不得引入不必要的抽象、死代码或过度设计。
-- 须在适当的地方包含或更新测试。
-
-### 安全审查
-
-AI 生成的代码需要格外仔细的安全审查。请特别关注以下方面:
-
-- 文件路径处理与沙箱逃逸(项目历史中的 commit `244eb0b` 就是真实案例)
-- channel 处理器和 tool 实现中的外部输入校验
-- 凭据或密钥的处理
-- 命令执行(`exec.Command`、shell 调用等)
-
-如果你不确定某段 AI 生成代码是否安全,请在 PR 中说明——审查者会帮助判断。
-
----
-
-## Pull Request 流程
-
-### 提 PR 前的检查
-
-- [ ] 在本地运行 `make check` 并确认通过。
-- [ ] 完整填写 PR 模板,包括 AI 披露部分。
-- [ ] 在 PR 描述中关联相关 Issue。
-- [ ] 保持 PR 专注,避免将不相关的修改混在一起。
-
-### PR 模板各部分说明
-
-PR 模板要求填写:
-
-- **描述** — 这个改动做了什么,为什么要做?
-- **变更类型** — Bug 修复、新功能、文档或重构。
-- **AI 代码生成** — AI 参与情况披露(必填)。
-- **关联 Issue** — 此 PR 解决的 Issue 链接。
-- **技术背景** — 参考链接和设计理由(纯文档类 PR 可跳过)。
-- **测试环境** — 用于测试的硬件、操作系统、模型/提供商和渠道。
-- **验证证据** — 可选的日志或截图,用于证明改动有效。
-- **检查清单** — 自我审查确认。
-
-### PR 规模
-
-请尽量提交小而易于审查的 PR。一个涉及 5 个文件共 200 行改动的 PR,远比涉及 30 个文件共 2000 行改动的 PR 容易审查。如果你的功能较大,可以考虑将其拆分为一系列逻辑完整的小 PR。
-
----
-
-## 分支策略
-
-### 长期分支
-
-- **`main`** — 活跃开发分支。所有功能 PR 均以 `main` 为目标。该分支受保护:禁止直接推送,合并前必须获得至少一名维护者的批准。
-- **`release/x.y`** — 稳定发布分支,在某个版本准备发布时从 `main` 切出。这些分支的保护级别高于 `main`。
-
-### 合并到 `main` 的前提条件
-
-PR 必须同时满足以下所有条件,才能被合并:
-
-1. **CI 全部通过** — 所有 GitHub Actions 工作流(lint、test、build)均为绿色。
-2. **获得审查者批准** — 至少一名维护者已批准该 PR。
-3. **无未解决的审查意见** — 所有审查讨论线程均已关闭。
-4. **PR 模板填写完整** — 包括 AI 披露和测试环境信息。
-
-### 谁可以合并
-
-只有维护者才能合并 PR。贡献者不能合并自己的 PR,即使拥有写权限也不行。
-
-### 合并策略
-
-为保持 `main` 历史清晰可读,我们对大多数 PR 使用 **Squash Merge**。每个合并的 PR 变为一个包含 PR 编号的单独 commit,例如:
-
-```
-feat: Add Ollama provider support (#491)
-```
-
-如果一个 PR 包含多个独立、结构清晰、能讲述完整故事的 commit,维护者可视情况使用普通 merge。
-
-### Release 分支
-
-当某个版本准备就绪时,维护者会从 `main` 切出 `release/x.y` 分支。此后:
-
-- **新功能不会被回溯(backport)。** Release 分支切出后,不再接收任何新功能。
-- **安全修复和关键 Bug 修复会被 cherry-pick 进来。** 若 `main` 上的某个修复属于安全漏洞、数据丢失或崩溃类问题,维护者会将相关 commit cherry-pick 到受影响的 `release/x.y` 分支,并发布补丁版本。
-
-如果你认为 `main` 上的某个修复应该被回溯到某个 release 分支,请在 PR 描述中注明,或单独开一个 Issue 说明。最终决定由维护者做出。
-
-Release 分支的保护级别高于 `main`,在任何情况下均不允许直接推送。
-
----
-
-## 代码审查
-
-### 对贡献者的建议
-
-- 在合理时间内回复审查意见。如果需要更多时间,请告知。
-- 更新 PR 以响应反馈时,简要说明改动内容(例如:"按建议改用了 `sync.RWMutex`")。
-- 如果你不同意某条反馈,请礼貌地阐述你的理由——审查者也可能有判断失误的时候。
-- 审查开始后请不要 force push——这会让审查者难以追踪变化。请使用额外的 commit,维护者在合并时会进行 squash。
-
-### 对审查者的建议
-
-审查重点:
-
-1. **正确性** — 代码是否实现了其声称的功能?是否存在边界情况?
-2. **安全性** — 对 AI 生成代码、tool 实现和 channel 处理器尤其需要关注。
-3. **架构** — 实现方式是否与现有设计一致?
-4. **简洁性** — 是否有更简单的方案?是否引入了不必要的复杂度?
-5. **测试** — 改动是否有测试覆盖?现有测试是否仍然有意义?
-
-请给出建设性且具体的反馈。"如果两个 goroutine 同时调用这个函数可能会有竞态条件,建议在这里加一个 mutex" 远比 "这里看起来有问题" 更有帮助。
-
-### 审查者列表
-提交对应PR后,可以参考下表联系对应的审查人员沟通
-
-|Function| Reviewer|
-|--- |--- |
-|Provider|@yinwm |
-|Channel |@yinwm/@alexhoshina |
-|Agent |@lxowalle/@Zhaoyikaiii|
-|Tools |@lxowalle|
-|SKill ||
-|MCP ||
-|Optimization|@lxowalle|
-|Security||
-|AI CI |@imguoguo|
-|UX ||
-|Document||
-
-
-
----
-
-## 沟通渠道
-
-- **GitHub Issues** — Bug 报告、功能建议、设计讨论。
-- **GitHub Discussions** — 一般性问题、想法交流、社区讨论。
-- **Pull Request 评论** — 与具体代码相关的反馈。
-- **Wechat&Discord** — 当你有至少一个已合并的PR后,我们会邀请你加入开发者交流群
-
-有疑问时,请先开 Issue 讨论,再动手写代码。这几乎没有成本,却能避免大量无效投入。
-
----
-
-## 关于本项目的 AI 驱动起源
-
-PicoClaw 的架构在人工监督下,经由 AI 辅助完成了大量设计和实现工作。如果你发现某处看起来奇怪或过度设计,这可能是该过程留下的痕迹——欢迎提 Issue 讨论。
-
-我们相信,负责任地使用 AI 辅助开发能产生优秀的成果。我们同样相信,人类必须对自己提交的内容负责。这两点并不矛盾。
-
-感谢你的贡献!
diff --git a/README.fr.md b/README.fr.md
deleted file mode 100644
index 8535c699c..000000000
--- a/README.fr.md
+++ /dev/null
@@ -1,1112 +0,0 @@
-
-

-
-
PicoClaw : Assistant IA Ultra-Efficace en Go
-
-
Matériel à 10$ · 10 Mo de RAM · Démarrage en 1s · 皮皮虾,我们走!
-
-
-
-
-
-
-
-
-
-
- [中文](README.zh.md) | [日本語](README.ja.md) | [Português](README.pt-br.md) | [Tiếng Việt](README.vi.md) | [English](README.md) | **Français**
-
-
----
-
-🦐 **PicoClaw** est un assistant personnel IA ultra-léger inspiré de [nanobot](https://github.com/HKUDS/nanobot), entièrement réécrit en **Go** via un processus d'auto-amorçage (self-bootstrapping) — où l'agent IA lui-même a piloté l'intégralité de la migration architecturale et de l'optimisation du code.
-
-⚡️ **Extrêmement léger :** Fonctionne sur du matériel à seulement **10$** avec **<10 Mo** de RAM. C'est 99% de mémoire en moins qu'OpenClaw et 98% moins cher qu'un Mac mini !
-
-
-
- |
-
-
-
- |
-
-
-
-
- |
-
-
-
-> [!CAUTION]
-> **🚨 SÉCURITÉ & CANAUX OFFICIELS**
->
-> * **PAS DE CRYPTO :** PicoClaw n'a **AUCUN** token/jeton officiel. Toute annonce sur `pump.fun` ou d'autres plateformes de trading est une **ARNAQUE**.
-> * **DOMAINE OFFICIEL :** Le **SEUL** site officiel est **[picoclaw.io](https://picoclaw.io)**, et le site de l'entreprise est **[sipeed.com](https://sipeed.com)**.
-> * **Attention :** De nombreux domaines `.ai/.org/.com/.net/...` sont enregistrés par des tiers et ne nous appartiennent pas.
-> * **Attention :** PicoClaw est en phase de développement précoce et peut présenter des problèmes de sécurité réseau non résolus. Ne déployez pas en environnement de production avant la version v1.0.
-> * **Note :** PicoClaw a récemment fusionné de nombreuses PR, ce qui peut entraîner une empreinte mémoire plus importante (10–20 Mo) dans les dernières versions. Nous prévoyons de prioriser l'optimisation des ressources dès que l'ensemble des fonctionnalités sera stabilisé.
-
-
-## 📢 Actualités
-
-2026-02-16 🎉 PicoClaw a atteint 12K étoiles en une semaine ! Merci à tous pour votre soutien ! PicoClaw grandit plus vite que nous ne l'avions jamais imaginé. Vu le volume élevé de PR, nous avons un besoin urgent de mainteneurs communautaires. Nos rôles de bénévoles et notre feuille de route sont officiellement publiés [ici](docs/ROADMAP.md) — nous avons hâte de vous accueillir !
-
-2026-02-13 🎉 PicoClaw a atteint 5000 étoiles en 4 jours ! Merci à la communauté ! Nous finalisons la **Feuille de Route du Projet** et mettons en place le **Groupe de Développeurs** pour accélérer le développement de PicoClaw.
-🚀 **Appel à l'action :** Soumettez vos demandes de fonctionnalités dans les GitHub Discussions. Nous les examinerons et les prioriserons lors de notre prochaine réunion hebdomadaire.
-
-2026-02-09 🎉 PicoClaw est lancé ! Construit en 1 jour pour apporter les Agents IA au matériel à 10$ avec <10 Mo de RAM. 🦐 PicoClaw, c'est parti !
-
-## ✨ Fonctionnalités
-
-🪶 **Ultra-Léger** : Empreinte mémoire <10 Mo — 99% plus petit que Clawdbot pour les fonctionnalités essentielles.
-
-💰 **Coût Minimal** : Suffisamment efficace pour fonctionner sur du matériel à 10$ — 98% moins cher qu'un Mac mini.
-
-⚡️ **Démarrage Éclair** : Temps de démarrage 400X plus rapide, boot en 1 seconde même sur un cœur unique à 0,6 GHz.
-
-🌍 **Véritable Portabilité** : Un seul binaire autonome pour RISC-V, ARM, MIPS et x86. Un clic et c'est parti !
-
-🤖 **Auto-Construit par l'IA** : Implémentation native en Go de manière autonome — 95% du cœur généré par l'Agent avec affinement humain dans la boucle.
-
-| | OpenClaw | NanoBot | **PicoClaw** |
-| ----------------------------- | ------------- | ------------------------ | ----------------------------------------- |
-| **Langage** | TypeScript | Python | **Go** |
-| **RAM** | >1 Go | >100 Mo | **< 10 Mo** |
-| **Démarrage**(cœur 0,8 GHz) | >500s | >30s | **<1s** |
-| **Coût** | Mac Mini 599$ | La plupart des SBC Linux ~50$ | **N'importe quelle carte Linux****À partir de 10$** |
-
-
-
-## 🦾 Démonstration
-
-### 🛠️ Flux de Travail Standard de l'Assistant
-
-
-
- 🧩 Ingénieur Full-Stack |
- 🗂️ Gestion des Logs & Planification |
- 🔎 Recherche Web & Apprentissage |
-
-
- 
|
- 
|
- 
|
-
-
- | Développer • Déployer • Mettre à l'échelle |
- Planifier • Automatiser • Mémoriser |
- Découvrir • Analyser • Tendances |
-
-
-
-### 📱 Utiliser sur d'anciens téléphones Android
-
-Donnez une seconde vie à votre téléphone d'il y a dix ans ! Transformez-le en assistant IA intelligent avec PicoClaw. Démarrage rapide :
-
-1. **Installez Termux** (disponible sur F-Droid ou Google Play).
-2. **Exécutez les commandes**
-
-```bash
-# Note : Remplacez v0.1.1 par la dernière version depuis la page des Releases
-wget https://github.com/sipeed/picoclaw/releases/download/v0.1.1/picoclaw-linux-arm64
-chmod +x picoclaw-linux-arm64
-pkg install proot
-termux-chroot ./picoclaw-linux-arm64 onboard
-```
-
-Puis suivez les instructions de la section « Démarrage Rapide » pour terminer la configuration !
-
-
-
-### 🐜 Déploiement Innovant à Faible Empreinte
-
-PicoClaw peut être déployé sur pratiquement n'importe quel appareil Linux !
-
-- 9,9$ [LicheeRV-Nano](https://www.aliexpress.com/item/1005006519668532.html) version E (Ethernet) ou W (WiFi6), pour un Assistant Domotique Minimaliste
-- 30~50$ [NanoKVM](https://www.aliexpress.com/item/1005007369816019.html), ou 100$ [NanoKVM-Pro](https://www.aliexpress.com/item/1005010048471263.html) pour la Maintenance Automatisée de Serveurs
-- 50$ [MaixCAM](https://www.aliexpress.com/item/1005008053333693.html) ou 100$ [MaixCAM2](https://www.kickstarter.com/projects/zepan/maixcam2-build-your-next-gen-4k-ai-camera) pour la Surveillance Intelligente
-
-
-
-🌟 Encore plus de scénarios de déploiement vous attendent !
-
-## 📦 Installation
-
-### Installer avec un binaire précompilé
-
-Téléchargez le binaire pour votre plateforme depuis la page des [releases](https://github.com/sipeed/picoclaw/releases).
-
-### Installer depuis les sources (dernières fonctionnalités, recommandé pour le développement)
-
-```bash
-git clone https://github.com/sipeed/picoclaw.git
-
-cd picoclaw
-make deps
-
-# Compiler, pas besoin d'installer
-make build
-
-# Compiler pour plusieurs plateformes
-make build-all
-
-# Compiler et Installer
-make install
-```
-
-## 🐳 Docker Compose
-
-Vous pouvez également exécuter PicoClaw avec Docker Compose sans rien installer localement.
-
-```bash
-# 1. Clonez ce dépôt
-git clone https://github.com/sipeed/picoclaw.git
-cd picoclaw
-
-# 2. Premier lancement — génère docker/data/config.json puis s'arrête
-docker compose -f docker/docker-compose.yml --profile gateway up
-# Le conteneur affiche "First-run setup complete." puis s'arrête.
-
-# 3. Configurez vos clés API
-vim docker/data/config.json # Clés API du fournisseur, tokens de bot, etc.
-
-# 4. Démarrer
-docker compose -f docker/docker-compose.yml --profile gateway up -d
-```
-
-> [!TIP]
-> **Utilisateurs Docker** : Par défaut, le Gateway écoute sur `127.0.0.1`, ce qui n'est pas accessible depuis l'hôte. Si vous avez besoin d'accéder aux endpoints de santé ou d'exposer des ports, définissez `PICOCLAW_GATEWAY_HOST=0.0.0.0` dans votre environnement ou mettez à jour `config.json`.
-
-```bash
-# 5. Voir les logs
-docker compose -f docker/docker-compose.yml logs -f picoclaw-gateway
-
-# 6. Arrêter
-docker compose -f docker/docker-compose.yml --profile gateway down
-```
-
-### Mode Agent (exécution unique)
-
-```bash
-# Poser une question
-docker compose -f docker/docker-compose.yml run --rm picoclaw-agent -m "Combien font 2+2 ?"
-
-# Mode interactif
-docker compose -f docker/docker-compose.yml run --rm picoclaw-agent
-```
-
-### Mettre à jour
-
-```bash
-docker compose -f docker/docker-compose.yml pull
-docker compose -f docker/docker-compose.yml --profile gateway up -d
-```
-
-### 🚀 Démarrage Rapide
-
-> [!TIP]
-> Configurez votre clé API dans `~/.picoclaw/config.json`. Obtenez des clés API : [Volcengine (CodingPlan)](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) (LLM) · [OpenRouter](https://openrouter.ai/keys) (LLM) · [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) (LLM). La recherche web est optionnelle — obtenez gratuitement l'[API Tavily](https://tavily.com) (1000 requêtes gratuites/mois) ou l'[API Brave Search](https://brave.com/search/api) (2000 requêtes gratuites/mois).
-
-**1. Initialiser**
-
-```bash
-picoclaw onboard
-```
-
-**2. Configurer** (`~/.picoclaw/config.json`)
-
-```json
-{
- "model_list": [
- {
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-your-api-key"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-your-openai-key",
- "request_timeout": 300,
- "api_base": "https://api.openai.com/v1"
- }
- ],
- "agents": {
- "defaults": {
- "model_name": "gpt-5.4"
- }
- },
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "VOTRE_TOKEN_BOT",
- "allow_from": ["VOTRE_USER_ID"]
- }
- },
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "VOTRE_CLE_API_BRAVE",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- }
- }
-}
-```
-
-> **Nouveau** : Le format de configuration `model_list` permet d'ajouter des fournisseurs sans modifier le code. Voir [Configuration de Modèle](#configuration-de-modèle-model_list) pour plus de détails.
-> `request_timeout` est optionnel et s'exprime en secondes. S'il est omis ou défini à `<= 0`, PicoClaw utilise le délai d'expiration par défaut (120s).
-
-**3. Obtenir des Clés API**
-
-* **Fournisseur LLM** : [OpenRouter](https://openrouter.ai/keys) · [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) · [Anthropic](https://console.anthropic.com) · [OpenAI](https://platform.openai.com) · [Gemini](https://aistudio.google.com/api-keys)
-* **Recherche Web** (optionnel) : [Brave Search](https://brave.com/search/api) - Offre gratuite disponible (2000 requêtes/mois)
-
-> **Note** : Consultez `config.example.json` pour un modèle de configuration complet.
-
-**4. Discuter**
-
-```bash
-picoclaw agent -m "Combien font 2+2 ?"
-```
-
-Et voilà ! Vous avez un assistant IA fonctionnel en 2 minutes.
-
----
-
-## 💬 Applications de Chat
-
-Discutez avec votre PicoClaw via Telegram, Discord, DingTalk, LINE ou WeCom
-
-| Canal | Configuration |
-| ------------ | -------------------------------------- |
-| **Telegram** | Facile (juste un token) |
-| **Discord** | Facile (token bot + intents) |
-| **QQ** | Facile (AppID + AppSecret) |
-| **DingTalk** | Moyen (identifiants de l'application) |
-| **LINE** | Moyen (identifiants + URL de webhook) |
-
-
-Telegram (Recommandé)
-
-**1. Créer un bot**
-
-* Ouvrez Telegram, recherchez `@BotFather`
-* Envoyez `/newbot`, suivez les instructions
-* Copiez le token
-
-**2. Configurer**
-
-```json
-{
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "VOTRE_TOKEN_BOT",
- "allow_from": ["VOTRE_USER_ID"]
- }
- }
-}
-```
-
-> Obtenez votre User ID via `@userinfobot` sur Telegram.
-
-**3. Lancer**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-Discord
-
-**1. Créer un bot**
-
-* Rendez-vous sur
-* Créez une application → Bot → Add Bot
-* Copiez le token du bot
-
-**2. Activer les intents**
-
-* Dans les paramètres du Bot, activez **MESSAGE CONTENT INTENT**
-* (Optionnel) Activez **SERVER MEMBERS INTENT** si vous souhaitez utiliser des listes d'autorisation basées sur les données des membres
-
-**3. Obtenir votre User ID**
-
-* Paramètres Discord → Avancé → activez le **Mode Développeur**
-* Clic droit sur votre avatar → **Copier l'identifiant**
-
-**4. Configurer**
-
-```json
-{
- "channels": {
- "discord": {
- "enabled": true,
- "token": "VOTRE_TOKEN_BOT",
- "allow_from": ["VOTRE_USER_ID"]
- }
- }
-}
-```
-
-**5. Inviter le bot**
-
-* OAuth2 → URL Generator
-* Scopes : `bot`
-* Permissions du Bot : `Send Messages`, `Read Message History`
-* Ouvrez l'URL d'invitation générée et ajoutez le bot à votre serveur
-
-**6. Lancer**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-QQ
-
-**1. Créer un bot**
-
-- Rendez-vous sur la [QQ Open Platform](https://q.qq.com/#)
-- Créez une application → Obtenez l'**AppID** et l'**AppSecret**
-
-**2. Configurer**
-
-```json
-{
- "channels": {
- "qq": {
- "enabled": true,
- "app_id": "VOTRE_APP_ID",
- "app_secret": "VOTRE_APP_SECRET",
- "allow_from": []
- }
- }
-}
-```
-
-> Laissez `allow_from` vide pour autoriser tous les utilisateurs, ou spécifiez des numéros QQ pour restreindre l'accès.
-
-**3. Lancer**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-DingTalk
-
-**1. Créer un bot**
-
-* Rendez-vous sur la [Open Platform](https://open.dingtalk.com/)
-* Créez une application interne
-* Copiez le Client ID et le Client Secret
-
-**2. Configurer**
-
-```json
-{
- "channels": {
- "dingtalk": {
- "enabled": true,
- "client_id": "VOTRE_CLIENT_ID",
- "client_secret": "VOTRE_CLIENT_SECRET",
- "allow_from": []
- }
- }
-}
-```
-
-> Laissez `allow_from` vide pour autoriser tous les utilisateurs, ou spécifiez des identifiants pour restreindre l'accès.
-
-**3. Lancer**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-LINE
-
-**1. Créer un Compte Officiel LINE**
-
-- Rendez-vous sur la [LINE Developers Console](https://developers.line.biz/)
-- Créez un provider → Créez un canal Messaging API
-- Copiez le **Channel Secret** et le **Channel Access Token**
-
-**2. Configurer**
-
-```json
-{
- "channels": {
- "line": {
- "enabled": true,
- "channel_secret": "VOTRE_CHANNEL_SECRET",
- "channel_access_token": "VOTRE_CHANNEL_ACCESS_TOKEN",
- "webhook_path": "/webhook/line",
- "allow_from": []
- }
- }
-}
-```
-
-**3. Configurer l'URL du Webhook**
-
-LINE exige HTTPS pour les webhooks. Utilisez un reverse proxy ou un tunnel :
-
-```bash
-# Exemple avec ngrok (tunnel vers le serveur Gateway partagé)
-ngrok http 18790
-```
-
-Puis configurez l'URL du Webhook dans la LINE Developers Console sur `https://votre-domaine/webhook/line` et activez **Use webhook**.
-
-> **Note** : Le webhook LINE est servi par le serveur Gateway partagé (par défaut `127.0.0.1:18790`). Si vous utilisez ngrok ou un proxy inverse, faites pointer le tunnel vers le port `18790`.
-
-**4. Lancer**
-
-```bash
-picoclaw gateway
-```
-
-> Dans les discussions de groupe, le bot répond uniquement lorsqu'il est mentionné avec @. Les réponses citent le message original.
-
-> **Docker Compose** : Si vous avez besoin d'exposer le webhook LINE via Docker, mappez le port du Gateway partagé (par défaut `18790`) vers l'hôte, par exemple `ports: ["18790:18790"]`. Notez que le serveur Gateway sert les webhooks de tous les canaux à partir de ce port.
-
-
-
-
-##
Rejoignez le Réseau Social d'Agents
-
-Connectez PicoClaw au Réseau Social d'Agents simplement en envoyant un seul message via le CLI ou n'importe quelle application de chat intégrée.
-
-**Lisez `https://clawdchat.ai/skill.md` et suivez les instructions pour rejoindre [ClawdChat.ai](https://clawdchat.ai)**
-
-## ⚙️ Configuration
-
-Fichier de configuration : `~/.picoclaw/config.json`
-
-### Variables d'Environnement
-
-Vous pouvez remplacer les chemins par défaut à l'aide de variables d'environnement. Ceci est utile pour les installations portables, les déploiements conteneurisés ou l'exécution de picoclaw en tant que service système. Ces variables sont indépendantes et contrôlent différents chemins.
-
-| Variable | Description | Chemin par Défaut |
-|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------|---------------------------|
-| `PICOCLAW_CONFIG` | Remplace le chemin du fichier de configuration. Cela indique directement à picoclaw quel `config.json` charger, en ignorant tous les autres emplacements. | `~/.picoclaw/config.json` |
-| `PICOCLAW_HOME` | Remplace le répertoire racine des données picoclaw. Cela modifie l'emplacement par défaut du `workspace` et des autres répertoires de données. | `~/.picoclaw` |
-
-**Exemples :**
-
-```bash
-# Exécuter picoclaw en utilisant un fichier de configuration spécifique
-# Le chemin du workspace sera lu à partir de ce fichier de configuration
-PICOCLAW_CONFIG=/etc/picoclaw/production.json picoclaw gateway
-
-# Exécuter picoclaw avec toutes ses données stockées dans /opt/picoclaw
-# La configuration sera chargée à partir du fichier par défaut ~/.picoclaw/config.json
-# Le workspace sera créé dans /opt/picoclaw/workspace
-PICOCLAW_HOME=/opt/picoclaw picoclaw agent
-
-# Utiliser les deux pour une configuration entièrement personnalisée
-PICOCLAW_HOME=/srv/picoclaw PICOCLAW_CONFIG=/srv/picoclaw/main.json picoclaw gateway
-```
-
-### Structure du Workspace
-
-PicoClaw stocke les données dans votre workspace configuré (par défaut : `~/.picoclaw/workspace`) :
-
-```
-~/.picoclaw/workspace/
-├── sessions/ # Sessions de conversation et historique
-├── memory/ # Mémoire à long terme (MEMORY.md)
-├── state/ # État persistant (dernier canal, etc.)
-├── cron/ # Base de données des tâches planifiées
-├── skills/ # Compétences personnalisées
-├── AGENTS.md # Guide de comportement de l'Agent
-├── HEARTBEAT.md # Invites de tâches périodiques (vérifiées toutes les 30 min)
-├── IDENTITY.md # Identité de l'Agent
-├── SOUL.md # Âme de l'Agent
-└── USER.md # Préférences utilisateur
-```
-
-### 🔒 Bac à Sable de Sécurité
-
-PicoClaw s'exécute dans un environnement sandboxé par défaut. L'agent ne peut accéder aux fichiers et exécuter des commandes qu'au sein du workspace configuré.
-
-#### Configuration par Défaut
-
-```json
-{
- "agents": {
- "defaults": {
- "workspace": "~/.picoclaw/workspace",
- "restrict_to_workspace": true
- }
- }
-}
-```
-
-| Option | Par défaut | Description |
-|--------|------------|-------------|
-| `workspace` | `~/.picoclaw/workspace` | Répertoire de travail de l'agent |
-| `restrict_to_workspace` | `true` | Restreindre l'accès fichiers/commandes au workspace |
-
-#### Outils Protégés
-
-Lorsque `restrict_to_workspace: true`, les outils suivants sont restreints au bac à sable :
-
-| Outil | Fonction | Restriction |
-|-------|----------|-------------|
-| `read_file` | Lire des fichiers | Uniquement les fichiers dans le workspace |
-| `write_file` | Écrire des fichiers | Uniquement les fichiers dans le workspace |
-| `list_dir` | Lister des répertoires | Uniquement les répertoires dans le workspace |
-| `edit_file` | Éditer des fichiers | Uniquement les fichiers dans le workspace |
-| `append_file` | Ajouter à des fichiers | Uniquement les fichiers dans le workspace |
-| `exec` | Exécuter des commandes | Les chemins doivent être dans le workspace |
-
-#### Protection Supplémentaire d'Exec
-
-Même avec `restrict_to_workspace: false`, l'outil `exec` bloque ces commandes dangereuses :
-
-* `rm -rf`, `del /f`, `rmdir /s` — Suppression en masse
-* `format`, `mkfs`, `diskpart` — Formatage de disque
-* `dd if=` — Écriture d'image disque
-* Écriture vers `/dev/sd[a-z]` — Écriture directe sur le disque
-* `shutdown`, `reboot`, `poweroff` — Arrêt du système
-* Fork bomb `:(){ :|:& };:`
-
-#### Exemples d'Erreurs
-
-```
-[ERROR] tool: Tool execution failed
-{tool=exec, error=Command blocked by safety guard (path outside working dir)}
-```
-
-```
-[ERROR] tool: Tool execution failed
-{tool=exec, error=Command blocked by safety guard (dangerous pattern detected)}
-```
-
-#### Désactiver les Restrictions (Risque de Sécurité)
-
-Si vous avez besoin que l'agent accède à des chemins en dehors du workspace :
-
-**Méthode 1 : Fichier de configuration**
-
-```json
-{
- "agents": {
- "defaults": {
- "restrict_to_workspace": false
- }
- }
-}
-```
-
-**Méthode 2 : Variable d'environnement**
-
-```bash
-export PICOCLAW_AGENTS_DEFAULTS_RESTRICT_TO_WORKSPACE=false
-```
-
-> ⚠️ **Attention** : Désactiver cette restriction permet à l'agent d'accéder à n'importe quel chemin sur votre système. À utiliser avec précaution uniquement dans des environnements contrôlés.
-
-#### Cohérence du Périmètre de Sécurité
-
-Le paramètre `restrict_to_workspace` s'applique de manière cohérente sur tous les chemins d'exécution :
-
-| Chemin d'Exécution | Périmètre de Sécurité |
-|--------------------|----------------------|
-| Agent Principal | `restrict_to_workspace` ✅ |
-| Sous-agent / Spawn | Hérite de la même restriction ✅ |
-| Tâches Heartbeat | Hérite de la même restriction ✅ |
-
-Tous les chemins partagent la même restriction de workspace — il est impossible de contourner le périmètre de sécurité via des sous-agents ou des tâches planifiées.
-
-### Heartbeat (Tâches Périodiques)
-
-PicoClaw peut exécuter des tâches périodiques automatiquement. Créez un fichier `HEARTBEAT.md` dans votre workspace :
-
-```markdown
-# Tâches Périodiques
-
-- Vérifier mes e-mails pour les messages importants
-- Consulter mon agenda pour les événements à venir
-- Vérifier les prévisions météo
-```
-
-L'agent lira ce fichier toutes les 30 minutes (configurable) et exécutera les tâches à l'aide des outils disponibles.
-
-#### Tâches Asynchrones avec Spawn
-
-Pour les tâches de longue durée (recherche web, appels API), utilisez l'outil `spawn` pour créer un **sous-agent** :
-
-```markdown
-# Tâches Périodiques
-
-## Tâches Rapides (réponse directe)
-- Indiquer l'heure actuelle
-
-## Tâches Longues (utiliser spawn pour l'asynchrone)
-- Rechercher les actualités IA sur le web et les résumer
-- Vérifier les e-mails et signaler les messages importants
-```
-
-**Comportements clés :**
-
-| Fonctionnalité | Description |
-|----------------|-------------|
-| **spawn** | Crée un sous-agent asynchrone, ne bloque pas le heartbeat |
-| **Contexte indépendant** | Le sous-agent a son propre contexte, sans historique de session |
-| **Outil message** | Le sous-agent communique directement avec l'utilisateur via l'outil message |
-| **Non-bloquant** | Après le spawn, le heartbeat continue vers la tâche suivante |
-
-#### Fonctionnement de la Communication du Sous-agent
-
-```
-Le Heartbeat se déclenche
- ↓
-L'Agent lit HEARTBEAT.md
- ↓
-Pour une tâche longue : spawn d'un sous-agent
- ↓ ↓
-Continue la tâche suivante Le sous-agent travaille indépendamment
- ↓ ↓
-Toutes les tâches terminées Le sous-agent utilise l'outil "message"
- ↓ ↓
-Répond HEARTBEAT_OK L'utilisateur reçoit le résultat directement
-```
-
-Le sous-agent a accès aux outils (message, web_search, etc.) et peut communiquer avec l'utilisateur indépendamment sans passer par l'agent principal.
-
-**Configuration :**
-
-```json
-{
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-| Option | Par défaut | Description |
-|--------|------------|-------------|
-| `enabled` | `true` | Activer/désactiver le heartbeat |
-| `interval` | `30` | Intervalle de vérification en minutes (min : 5) |
-
-**Variables d'environnement :**
-
-* `PICOCLAW_HEARTBEAT_ENABLED=false` pour désactiver
-* `PICOCLAW_HEARTBEAT_INTERVAL=60` pour modifier l'intervalle
-
-### Fournisseurs
-
-> [!NOTE]
-> Groq fournit la transcription vocale gratuite via Whisper. Si configuré, les messages audio de n'importe quel canal seront automatiquement transcrits au niveau de l'agent.
-
-| Fournisseur | Utilisation | Obtenir une Clé API |
-| ------------------------ | ---------------------------------------- | ------------------------------------------------------ |
-| `gemini` | LLM (Gemini direct) | [aistudio.google.com](https://aistudio.google.com) |
-| `zhipu` | LLM (Zhipu direct) | [bigmodel.cn](bigmodel.cn) |
-| `volcengine` | LLM(Volcengine direct) | [volcengine.com](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) |
-| `openrouter` (À tester) | LLM (recommandé, accès à tous les modèles) | [openrouter.ai](https://openrouter.ai) |
-| `anthropic` (À tester) | LLM (Claude direct) | [console.anthropic.com](https://console.anthropic.com) |
-| `openai` (À tester) | LLM (GPT direct) | [platform.openai.com](https://platform.openai.com) |
-| `deepseek` (À tester) | LLM (DeepSeek direct) | [platform.deepseek.com](https://platform.deepseek.com) |
-| `qwen` | LLM (Alibaba Qwen) | [dashscope.aliyuncs.com](https://dashscope.aliyuncs.com/compatible-mode/v1) |
-| `cerebras` | LLM (Cerebras) | [cerebras.ai](https://api.cerebras.ai/v1) |
-| `groq` | LLM + **Transcription vocale** (Whisper) | [console.groq.com](https://console.groq.com) |
-
-
-Configuration Zhipu
-
-**1. Obtenir la clé API**
-
-* Obtenez la [clé API](https://bigmodel.cn/usercenter/proj-mgmt/apikeys)
-
-**2. Configurer**
-
-```json
-{
- "agents": {
- "defaults": {
- "workspace": "~/.picoclaw/workspace",
- "model": "glm-4.7",
- "max_tokens": 8192,
- "temperature": 0.7,
- "max_tool_iterations": 20
- }
- },
- "providers": {
- "zhipu": {
- "api_key": "Votre Clé API",
- "api_base": "https://open.bigmodel.cn/api/paas/v4"
- }
- }
-}
-```
-
-**3. Lancer**
-
-```bash
-picoclaw agent -m "Bonjour, comment ça va ?"
-```
-
-
-
-
-Exemple de configuration complète
-
-```json
-{
- "agents": {
- "defaults": {
- "model": "anthropic/claude-opus-4-5"
- }
- },
- "providers": {
- "openrouter": {
- "api_key": "sk-or-v1-xxx"
- },
- "groq": {
- "api_key": "gsk_xxx"
- }
- },
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "123456:ABC...",
- "allow_from": ["123456789"]
- },
- "discord": {
- "enabled": true,
- "token": "",
- "allow_from": [""]
- },
- "whatsapp": {
- "enabled": false
- },
- "qq": {
- "enabled": false,
- "app_id": "",
- "app_secret": "",
- "allow_from": []
- }
- },
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "BSA...",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- },
- "cron": {
- "exec_timeout_minutes": 5
- }
- },
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-
-
-### Configuration de Modèle (model_list)
-
-> **Nouveau !** PicoClaw utilise désormais une approche de configuration **centrée sur le modèle**. Spécifiez simplement le format `fournisseur/modèle` (par exemple, `zhipu/glm-4.7`) pour ajouter de nouveaux fournisseurs—**aucune modification de code requise !**
-
-Cette conception permet également le **support multi-agent** avec une sélection flexible de fournisseurs :
-
-- **Différents agents, différents fournisseurs** : Chaque agent peut utiliser son propre fournisseur LLM
-- **Modèles de secours (Fallbacks)** : Configurez des modèles primaires et de secours pour la résilience
-- **Équilibrage de charge** : Répartissez les requêtes sur plusieurs points de terminaison
-- **Configuration centralisée** : Gérez tous les fournisseurs en un seul endroit
-
-#### 📋 Tous les Fournisseurs Supportés
-
-| Fournisseur | Préfixe `model` | API Base par Défaut | Protocole | Clé API |
-|-------------|-----------------|---------------------|----------|---------|
-| **OpenAI** | `openai/` | `https://api.openai.com/v1` | OpenAI | [Obtenir Clé](https://platform.openai.com) |
-| **Anthropic** | `anthropic/` | `https://api.anthropic.com/v1` | Anthropic | [Obtenir Clé](https://console.anthropic.com) |
-| **Zhipu AI (GLM)** | `zhipu/` | `https://open.bigmodel.cn/api/paas/v4` | OpenAI | [Obtenir Clé](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) |
-| **DeepSeek** | `deepseek/` | `https://api.deepseek.com/v1` | OpenAI | [Obtenir Clé](https://platform.deepseek.com) |
-| **Google Gemini** | `gemini/` | `https://generativelanguage.googleapis.com/v1beta` | OpenAI | [Obtenir Clé](https://aistudio.google.com/api-keys) |
-| **Groq** | `groq/` | `https://api.groq.com/openai/v1` | OpenAI | [Obtenir Clé](https://console.groq.com) |
-| **Moonshot** | `moonshot/` | `https://api.moonshot.cn/v1` | OpenAI | [Obtenir Clé](https://platform.moonshot.cn) |
-| **Qwen (Alibaba)** | `qwen/` | `https://dashscope.aliyuncs.com/compatible-mode/v1` | OpenAI | [Obtenir Clé](https://dashscope.console.aliyun.com) |
-| **NVIDIA** | `nvidia/` | `https://integrate.api.nvidia.com/v1` | OpenAI | [Obtenir Clé](https://build.nvidia.com) |
-| **Ollama** | `ollama/` | `http://localhost:11434/v1` | OpenAI | Local (pas de clé nécessaire) |
-| **OpenRouter** | `openrouter/` | `https://openrouter.ai/api/v1` | OpenAI | [Obtenir Clé](https://openrouter.ai/keys) |
-| **VLLM** | `vllm/` | `http://localhost:8000/v1` | OpenAI | Local |
-| **Cerebras** | `cerebras/` | `https://api.cerebras.ai/v1` | OpenAI | [Obtenir Clé](https://cerebras.ai) |
-| **VolcEngine (Doubao)** | `volcengine/` | `https://ark.cn-beijing.volces.com/api/v3` | OpenAI | [Obtenir Clé](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) |
-| **ShengsuanYun** | `shengsuanyun/` | `https://router.shengsuanyun.com/api/v1` | OpenAI | - |
-| **BytePlus** | `byteplus/` | `https://ark.ap-southeast.bytepluses.com/api/v3` | OpenAI | [Obtenir Clé](https://www.byteplus.com/) |
-| **LongCat** | `longcat/` | `https://api.longcat.chat/openai` | OpenAI | [Obtenir une clé](https://longcat.chat/platform) |
-| **Antigravity** | `antigravity/` | Google Cloud | Custom | OAuth uniquement |
-| **GitHub Copilot** | `github-copilot/` | `localhost:4321` | gRPC | - |
-
-#### Configuration de Base
-
-```json
-{
- "model_list": [
- {
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-your-api-key"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-your-openai-key"
- },
- {
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "api_key": "sk-ant-your-key"
- },
- {
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-zhipu-key"
- }
- ],
- "agents": {
- "defaults": {
- "model": "gpt-5.4"
- }
- }
-}
-```
-
-#### Exemples par Fournisseur
-
-**OpenAI**
-```json
-{
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-..."
-}
-```
-
-**VolcEngine (Doubao)**
-```json
-{
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-..."
-}
-```
-
-**Zhipu AI (GLM)**
-```json
-{
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-key"
-}
-```
-
-**Anthropic (avec OAuth)**
-```json
-{
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "auth_method": "oauth"
-}
-```
-> Exécutez `picoclaw auth login --provider anthropic` pour configurer les identifiants OAuth.
-
-**Proxy/API personnalisée**
-```json
-{
- "model_name": "my-custom-model",
- "model": "openai/custom-model",
- "api_base": "https://my-proxy.com/v1",
- "api_key": "sk-...",
- "request_timeout": 300
-}
-```
-
-#### Équilibrage de Charge
-
-Configurez plusieurs points de terminaison pour le même nom de modèle—PicoClaw utilisera automatiquement le round-robin entre eux :
-
-```json
-{
- "model_list": [
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_base": "https://api1.example.com/v1",
- "api_key": "sk-key1"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_base": "https://api2.example.com/v1",
- "api_key": "sk-key2"
- }
- ]
-}
-```
-
-#### Migration depuis l'Ancienne Configuration `providers`
-
-L'ancienne configuration `providers` est **dépréciée** mais toujours supportée pour la rétrocompatibilité.
-
-**Ancienne Configuration (dépréciée) :**
-```json
-{
- "providers": {
- "zhipu": {
- "api_key": "your-key",
- "api_base": "https://open.bigmodel.cn/api/paas/v4"
- }
- },
- "agents": {
- "defaults": {
- "provider": "zhipu",
- "model": "glm-4.7"
- }
- }
-}
-```
-
-**Nouvelle Configuration (recommandée) :**
-```json
-{
- "model_list": [
- {
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-key"
- }
- ],
- "agents": {
- "defaults": {
- "model": "glm-4.7"
- }
- }
-}
-```
-
-Pour le guide de migration détaillé, voir [docs/migration/model-list-migration.md](docs/migration/model-list-migration.md).
-
-## Référence CLI
-
-| Commande | Description |
-| ------------------------- | ------------------------------------- |
-| `picoclaw onboard` | Initialiser la configuration & le workspace |
-| `picoclaw agent -m "..."` | Discuter avec l'agent |
-| `picoclaw agent` | Mode de discussion interactif |
-| `picoclaw gateway` | Démarrer la passerelle |
-| `picoclaw status` | Afficher le statut |
-| `picoclaw cron list` | Lister toutes les tâches planifiées |
-| `picoclaw cron add ...` | Ajouter une tâche planifiée |
-
-### Tâches Planifiées / Rappels
-
-PicoClaw prend en charge les rappels planifiés et les tâches récurrentes via l'outil `cron` :
-
-* **Rappels ponctuels** : « Rappelle-moi dans 10 minutes » → se déclenche une fois après 10 min
-* **Tâches récurrentes** : « Rappelle-moi toutes les 2 heures » → se déclenche toutes les 2 heures
-* **Expressions Cron** : « Rappelle-moi à 9h tous les jours » → utilise une expression cron
-
-Les tâches sont stockées dans `~/.picoclaw/workspace/cron/` et traitées automatiquement.
-
-## 🤝 Contribuer & Feuille de Route
-
-Les PR sont les bienvenues ! Le code source est volontairement petit et lisible. 🤗
-
-Feuille de route à venir...
-
-Groupe de développeurs en construction. Condition d'entrée : au moins 1 PR fusionnée.
-
-Groupes d'utilisateurs :
-
-Discord :
-
-
-
-## 🐛 Dépannage
-
-### La recherche web affiche « API 配置问题 »
-
-C'est normal si vous n'avez pas encore configuré de clé API de recherche. PicoClaw fournira des liens utiles pour la recherche manuelle.
-
-Pour activer la recherche web :
-
-1. **Option 1 (Recommandé)** : Obtenez une clé API gratuite sur [https://brave.com/search/api](https://brave.com/search/api) (2000 requêtes gratuites/mois) pour les meilleurs résultats.
-2. **Option 2 (Sans carte bancaire)** : Si vous n'avez pas de clé, le système bascule automatiquement sur **DuckDuckGo** (aucune clé requise).
-
-Ajoutez la clé dans `~/.picoclaw/config.json` si vous utilisez Brave :
-
-```json
-{
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "VOTRE_CLE_API_BRAVE",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- }
- }
-}
-```
-
-### Erreurs de filtrage de contenu
-
-Certains fournisseurs (comme Zhipu) disposent d'un filtrage de contenu. Essayez de reformuler votre requête ou utilisez un modèle différent.
-
-### Le bot Telegram affiche « Conflict: terminated by other getUpdates »
-
-Cela se produit lorsqu'une autre instance du bot est en cours d'exécution. Assurez-vous qu'un seul `picoclaw gateway` fonctionne à la fois.
-
----
-
-## 📝 Comparaison des Clés API
-
-| Service | Offre Gratuite | Cas d'Utilisation |
-| ---------------- | -------------------- | ------------------------------------- |
-| **OpenRouter** | 200K tokens/mois | Multiples modèles (Claude, GPT-4, etc.) |
-| **Volcengine CodingPlan** | 9,9¥/premier mois | Idéal pour les utilisateurs chinois, multiples modèles SOTA (Doubao, DeepSeek, etc.) |
-| **Zhipu** | 200K tokens/mois | Convient aux utilisateurs chinois |
-| **Brave Search** | 2000 requêtes/mois | Fonctionnalité de recherche web |
-| **Groq** | Offre gratuite dispo | Inférence ultra-rapide (Llama, Mixtral) |
-
----
-
-
-

-
diff --git a/README.ja.md b/README.ja.md
deleted file mode 100644
index 053666b5a..000000000
--- a/README.ja.md
+++ /dev/null
@@ -1,1033 +0,0 @@
-
-

-
-
PicoClaw: Go で書かれた超効率 AI アシスタント
-
-
$10 ハードウェア · 10MB RAM · 1秒起動 · 行くぜ、シャコ!
-
-
-
-
-
-
-
-
-[中文](README.zh.md) | **日本語** | [Português](README.pt-br.md) | [Tiếng Việt](README.vi.md) | [Français](README.fr.md) | [English](README.md)
-
-
-
-
----
-
-🦐 PicoClaw は [nanobot](https://github.com/HKUDS/nanobot) にインスパイアされた超軽量パーソナル AI アシスタントです。Go でゼロからリファクタリングされ、AI エージェント自身がアーキテクチャの移行とコード最適化を推進するセルフブートストラッピングプロセスで構築されました。
-
-⚡️ $10 のハードウェアで 10MB 未満の RAM で動作:OpenClaw より 99% 少ないメモリ、Mac mini より 98% 安い!
-
-
-
- |
-
-
-
- |
-
-
-
-
- |
-
-
-
-## 📢 ニュース
-2026-02-09 🎉 PicoClaw リリース!$10 ハードウェアで 10MB 未満の RAM で動く AI エージェントを 1 日で構築。🦐 行くぜ、シャコ!
-
-## ✨ 特徴
-
-🪶 **超軽量**: メモリフットプリント 10MB 未満 — Clawdbot のコア機能より 99% 小さい。
-
-💰 **最小コスト**: $10 ハードウェアで動作 — Mac mini より 98% 安い。
-
-⚡️ **超高速**: 起動時間 400 倍高速、0.6GHz シングルコアでも 1 秒で起動。
-
-🌍 **真のポータビリティ**: RISC-V、ARM、MIPS、x86 対応の単一バイナリ。ワンクリックで Go!
-
-🤖 **AI ブートストラップ**: 自律的な Go ネイティブ実装 — コアの 95% が AI 生成、人間によるレビュー付き。
-
-| | OpenClaw | NanoBot | **PicoClaw** |
-| --- | --- | --- |--- |
-| **言語** | TypeScript | Python | **Go** |
-| **RAM** | >1GB |>100MB| **< 10MB** |
-| **起動時間**(0.8GHz コア) | >500秒 | >30秒 | **<1秒** |
-| **コスト** | Mac Mini 599$ | 大半の Linux SBC ~50$ |**あらゆる Linux ボード****最安 10$** |
-
-
-
-## 🦾 デモンストレーション
-### 🛠️ スタンダードアシスタントワークフロー
-
-
- 🧩 フルスタックエンジニア |
- 🗂️ ログ&計画管理 |
- 🔎 Web 検索&学習 |
-
-
- 
|
- 
|
- 
|
-
-
- | 開発 · デプロイ · スケール |
- スケジュール · 自動化 · メモリ |
- 発見 · インサイト · トレンド |
-
-
-
-### 🐜 革新的な省フットプリントデプロイ
-PicoClaw はほぼすべての Linux デバイスにデプロイできます!
-
-- $9.9 [LicheeRV-Nano](https://www.aliexpress.com/item/1005006519668532.html) E(Ethernet) または W(WiFi6) バージョン、最小ホームアシスタントに
-- $30~50 [NanoKVM](https://www.aliexpress.com/item/1005007369816019.html) または $100 [NanoKVM-Pro](https://www.aliexpress.com/item/1005010048471263.html) サーバー自動メンテナンスに
-- $50 [MaixCAM](https://www.aliexpress.com/item/1005008053333693.html) または $100 [MaixCAM2](https://www.kickstarter.com/projects/zepan/maixcam2-build-your-next-gen-4k-ai-camera) スマート監視に
-
-https://private-user-images.githubusercontent.com/83055338/547056448-e7b031ff-d6f5-4468-bcca-5726b6fecb5c.mp4
-
-🌟 もっと多くのデプロイ事例が待っています!
-
-## 📦 インストール
-
-### コンパイル済みバイナリでインストール
-
-[リリースページ](https://github.com/sipeed/picoclaw/releases) からお使いのプラットフォーム用のファームウェアをダウンロードしてください。
-
-### ソースからインストール(最新機能、開発向け推奨)
-
-```bash
-git clone https://github.com/sipeed/picoclaw.git
-
-cd picoclaw
-make deps
-
-# ビルド(インストール不要)
-make build
-
-# 複数プラットフォーム向けビルド
-make build-all
-
-# ビルドとインストール
-make install
-```
-
-## 🐳 Docker Compose
-
-Docker Compose を使えば、ローカルにインストールせずに PicoClaw を実行できます。
-
-```bash
-# 1. リポジトリをクローン
-git clone https://github.com/sipeed/picoclaw.git
-cd picoclaw
-
-# 2. 初回起動 — docker/data/config.json を自動生成して終了
-docker compose -f docker/docker-compose.yml --profile gateway up
-# コンテナが "First-run setup complete." を表示して停止します。
-
-# 3. API キーを設定
-vim docker/data/config.json # プロバイダー API キー、Bot トークンなどを設定
-
-# 4. 起動
-docker compose -f docker/docker-compose.yml --profile gateway up -d
-```
-
-> [!TIP]
-> **Docker ユーザー**: デフォルトでは、Gateway は `127.0.0.1` でリッスンしており、ホストからアクセスできません。ヘルスチェックエンドポイントにアクセスしたり、ポートを公開したりする必要がある場合は、環境変数で `PICOCLAW_GATEWAY_HOST=0.0.0.0` を設定するか、`config.json` を更新してください。
-
-```bash
-# 5. ログ確認
-docker compose -f docker/docker-compose.yml logs -f picoclaw-gateway
-
-# 6. 停止
-docker compose -f docker/docker-compose.yml --profile gateway down
-```
-
-### Agent モード(ワンショット)
-
-```bash
-# 質問を投げる
-docker compose -f docker/docker-compose.yml run --rm picoclaw-agent -m "What is 2+2?"
-
-# インタラクティブモード
-docker compose -f docker/docker-compose.yml run --rm picoclaw-agent
-```
-
-### アップデート
-
-```bash
-docker compose -f docker/docker-compose.yml pull
-docker compose -f docker/docker-compose.yml --profile gateway up -d
-```
-
-### 🚀 クイックスタート(ネイティブ)
-
-> [!TIP]
-> `~/.picoclaw/config.json` に API キーを設定してください。API キーの取得先: [Volcengine (CodingPlan)](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) (LLM) · [OpenRouter](https://openrouter.ai/keys) (LLM) · [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) (LLM)。Web 検索は **任意** です — 無料の [Tavily API](https://tavily.com) (月 1000 クエリ無料) または [Brave Search API](https://brave.com/search/api) (月 2000 クエリ無料)。
-
-**1. 初期化**
-
-```bash
-picoclaw onboard
-```
-
-**2. 設定** (`~/.picoclaw/config.json`)
-
-```json
-{
- "model_list": [
- {
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-your-api-key"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-your-openai-key",
- "request_timeout": 300,
- "api_base": "https://api.openai.com/v1"
- }
- ],
- "agents": {
- "defaults": {
- "model_name": "gpt-5.4"
- }
- },
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "YOUR_TELEGRAM_BOT_TOKEN",
- "allow_from": []
- }
- },
- "tools": {
- "web": {
- "search": {
- "api_key": "YOUR_BRAVE_API_KEY",
- "max_results": 5
- },
- "tavily": {
- "enabled": false,
- "api_key": "YOUR_TAVILY_API_KEY",
- "max_results": 5
- }
- },
- "cron": {
- "exec_timeout_minutes": 5
- }
- },
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-> **新機能**: `model_list` 形式により、プロバイダーをコード変更なしで追加できます。詳細は [モデル設定](#モデル設定-model_list) を参照してください。
-> `request_timeout` は任意の秒単位設定です。省略または `<= 0` の場合、PicoClaw はデフォルトのタイムアウト(120秒)を使用します。
-
-**3. API キーの取得**
-
-- **LLM プロバイダー**: [OpenRouter](https://openrouter.ai/keys) · [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) · [Anthropic](https://console.anthropic.com) · [OpenAI](https://platform.openai.com) · [Gemini](https://aistudio.google.com/api-keys)
-- **Web 検索**(任意): [Tavily](https://tavily.com) - AI エージェント向けに最適化 (月 1000 リクエスト) · [Brave Search](https://brave.com/search/api) - 無料枠あり(月 2000 リクエスト)
-
-> **注意**: 完全な設定テンプレートは `config.example.json` を参照してください。
-
-**4. チャット**
-
-```bash
-picoclaw agent -m "What is 2+2?"
-```
-
-これだけです!2 分で AI アシスタントが動きます。
-
----
-
-## 💬 チャットアプリ
-
-Telegram、Discord、QQ、DingTalk、LINE、WeCom で PicoClaw と会話できます
-
-| チャネル | セットアップ |
-|---------|------------|
-| **Telegram** | 簡単(トークンのみ) |
-| **Discord** | 簡単(Bot トークン + Intents) |
-| **QQ** | 簡単(AppID + AppSecret) |
-| **DingTalk** | 普通(アプリ認証情報) |
-| **LINE** | 普通(認証情報 + Webhook URL) |
-
-
-Telegram(推奨)
-
-**1. Bot を作成**
-
-- Telegram を開き、`@BotFather` を検索
-- `/newbot` を送信、プロンプトに従う
-- トークンをコピー
-
-**2. 設定**
-
-```json
-{
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "YOUR_BOT_TOKEN",
- "allow_from": ["YOUR_USER_ID"]
- }
- }
-}
-```
-
-> ユーザー ID は Telegram の `@userinfobot` から取得できます。
-
-**3. 起動**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-Discord
-
-**1. Bot を作成**
-- https://discord.com/developers/applications にアクセス
-- アプリケーションを作成 → Bot → Add Bot
-- Bot トークンをコピー
-
-**2. Intents を有効化**
-- Bot の設定画面で **MESSAGE CONTENT INTENT** を有効化
-- (任意)**SERVER MEMBERS INTENT** も有効化
-
-**3. ユーザー ID を取得**
-- Discord 設定 → 詳細設定 → **開発者モード** を有効化
-- 自分のアバターを右クリック → **ユーザーIDをコピー**
-
-**4. 設定**
-
-```json
-{
- "channels": {
- "discord": {
- "enabled": true,
- "token": "YOUR_BOT_TOKEN",
- "allow_from": ["YOUR_USER_ID"]
- }
- }
-}
-```
-
-**5. Bot を招待**
-- OAuth2 → URL Generator
-- Scopes: `bot`
-- Bot Permissions: `Send Messages`, `Read Message History`
-- 生成された招待 URL を開き、サーバーに Bot を追加
-
-**6. 起動**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-QQ
-
-**1. Bot を作成**
-
-- [QQ オープンプラットフォーム](https://q.qq.com/#) にアクセス
-- アプリケーションを作成 → **AppID** と **AppSecret** を取得
-
-**2. 設定**
-
-```json
-{
- "channels": {
- "qq": {
- "enabled": true,
- "app_id": "YOUR_APP_ID",
- "app_secret": "YOUR_APP_SECRET",
- "allow_from": []
- }
- }
-}
-```
-
-> `allow_from` を空にすると全ユーザーを許可、QQ番号を指定してアクセス制限可能。
-
-**3. 起動**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-DingTalk
-
-**1. Bot を作成**
-
-- [オープンプラットフォーム](https://open.dingtalk.com/) にアクセス
-- 内部アプリを作成
-- Client ID と Client Secret をコピー
-
-**2. 設定**
-
-```json
-{
- "channels": {
- "dingtalk": {
- "enabled": true,
- "client_id": "YOUR_CLIENT_ID",
- "client_secret": "YOUR_CLIENT_SECRET",
- "allow_from": []
- }
- }
-}
-```
-
-> `allow_from` を空にすると全ユーザーを許可、ユーザーIDを指定してアクセス制限可能。
-
-**3. 起動**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-LINE
-
-**1. LINE 公式アカウントを作成**
-
-- [LINE Developers Console](https://developers.line.biz/) にアクセス
-- プロバイダーを作成 → Messaging API チャネルを作成
-- **チャネルシークレット** と **チャネルアクセストークン** をコピー
-
-**2. 設定**
-
-```json
-{
- "channels": {
- "line": {
- "enabled": true,
- "channel_secret": "YOUR_CHANNEL_SECRET",
- "channel_access_token": "YOUR_CHANNEL_ACCESS_TOKEN",
- "webhook_path": "/webhook/line",
- "allow_from": []
- }
- }
-}
-```
-
-**3. Webhook URL を設定**
-
-LINE の Webhook には HTTPS が必要です。リバースプロキシまたはトンネルを使用してください:
-
-```bash
-# ngrok の例
-ngrok http 18790
-```
-
-LINE Developers Console で Webhook URL を `https://あなたのドメイン/webhook/line` に設定し、**Webhook の利用** を有効にしてください。
-
-> **注意**: LINE の Webhook は共有の Gateway HTTP サーバー(デフォルト: `127.0.0.1:18790`)で提供されます。ホストからアクセスする場合は Gateway のポートを公開するか、リバースプロキシを設定してください。
-
-**4. 起動**
-
-```bash
-picoclaw gateway
-```
-
-> グループチャットでは @メンション時のみ応答します。返信は元メッセージを引用する形式です。
-
-> **Docker Compose**: Gateway HTTP サーバーは共有の `127.0.0.1:18790` で Webhook を提供します。ホストからアクセスするには `picoclaw-gateway` サービスに `ports: ["18790:18790"]` を追加してください。
-
-
-
-
-## ⚙️ 設定
-
-設定ファイル: `~/.picoclaw/config.json`
-
-### 環境変数
-
-環境変数を使用してデフォルトのパスを上書きできます。これは、ポータブルインストール、コンテナ化されたデプロイメント、または picoclaw をシステムサービスとして実行する場合に便利です。これらの変数は独立しており、異なるパスを制御します。
-
-| 変数 | 説明 | デフォルトパス |
-|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------|---------------------------|
-| `PICOCLAW_CONFIG` | 設定ファイルへのパスを上書きします。これにより、picoclaw は他のすべての場所を無視して、指定された `config.json` をロードします。 | `~/.picoclaw/config.json` |
-| `PICOCLAW_HOME` | picoclaw データのルートディレクトリを上書きします。これにより、`workspace` やその他のデータディレクトリのデフォルトの場所が変更されます。 | `~/.picoclaw` |
-
-**例:**
-
-```bash
-# 特定の設定ファイルを使用して picoclaw を実行する
-# ワークスペースのパスはその設定ファイル内から読み込まれます
-PICOCLAW_CONFIG=/etc/picoclaw/production.json picoclaw gateway
-
-# すべてのデータを /opt/picoclaw に保存して picoclaw を実行する
-# 設定はデフォルトの ~/.picoclaw/config.json からロードされます
-# ワークスペースは /opt/picoclaw/workspace に作成されます
-PICOCLAW_HOME=/opt/picoclaw picoclaw agent
-
-# 両方を使用して完全にカスタマイズされたセットアップを行う
-PICOCLAW_HOME=/srv/picoclaw PICOCLAW_CONFIG=/srv/picoclaw/main.json picoclaw gateway
-```
-
-### ワークスペース構成
-
-PicoClaw は設定されたワークスペース(デフォルト: `~/.picoclaw/workspace`)にデータを保存します:
-
-```
-~/.picoclaw/workspace/
-├── sessions/ # 会話セッションと履歴
-├── memory/ # 長期メモリ(MEMORY.md)
-├── state/ # 永続状態(最後のチャネルなど)
-├── cron/ # スケジュールジョブデータベース
-├── skills/ # カスタムスキル
-├── AGENTS.md # エージェントの行動ガイド
-├── HEARTBEAT.md # 定期タスクプロンプト(30分ごとに確認)
-├── IDENTITY.md # エージェントのアイデンティティ
-├── SOUL.md # エージェントのソウル
-└── USER.md # ユーザー設定
-```
-
-### 🔒 セキュリティサンドボックス
-
-PicoClaw はデフォルトでサンドボックス環境で実行されます。エージェントは設定されたワークスペース内のファイルにのみアクセスし、コマンドを実行できます。
-
-#### デフォルト設定
-
-```json
-{
- "agents": {
- "defaults": {
- "workspace": "~/.picoclaw/workspace",
- "restrict_to_workspace": true
- }
- }
-}
-```
-
-| オプション | デフォルト | 説明 |
-|-----------|-----------|------|
-| `workspace` | `~/.picoclaw/workspace` | エージェントの作業ディレクトリ |
-| `restrict_to_workspace` | `true` | ファイル/コマンドアクセスをワークスペースに制限 |
-
-#### 保護対象ツール
-
-`restrict_to_workspace: true` の場合、以下のツールがサンドボックス化されます:
-
-| ツール | 機能 | 制限 |
-|-------|------|------|
-| `read_file` | ファイル読み込み | ワークスペース内のファイルのみ |
-| `write_file` | ファイル書き込み | ワークスペース内のファイルのみ |
-| `list_dir` | ディレクトリ一覧 | ワークスペース内のディレクトリのみ |
-| `edit_file` | ファイル編集 | ワークスペース内のファイルのみ |
-| `append_file` | ファイル追記 | ワークスペース内のファイルのみ |
-| `exec` | コマンド実行 | コマンドパスはワークスペース内である必要あり |
-
-#### exec ツールの追加保護
-
-`restrict_to_workspace: false` でも、`exec` ツールは以下の危険なコマンドをブロックします:
-
-- `rm -rf`, `del /f`, `rmdir /s` — 一括削除
-- `format`, `mkfs`, `diskpart` — ディスクフォーマット
-- `dd if=` — ディスクイメージング
-- `/dev/sd[a-z]` への書き込み — 直接ディスク書き込み
-- `shutdown`, `reboot`, `poweroff` — システムシャットダウン
-- フォークボム `:(){ :|:& };:`
-
-#### エラー例
-
-```
-[ERROR] tool: Tool execution failed
-{tool=exec, error=Command blocked by safety guard (path outside working dir)}
-```
-
-```
-[ERROR] tool: Tool execution failed
-{tool=exec, error=Command blocked by safety guard (dangerous pattern detected)}
-```
-
-#### 制限の無効化(セキュリティリスク)
-
-エージェントにワークスペース外のパスへのアクセスが必要な場合:
-
-**方法1: 設定ファイル**
-```json
-{
- "agents": {
- "defaults": {
- "restrict_to_workspace": false
- }
- }
-}
-```
-
-**方法2: 環境変数**
-```bash
-export PICOCLAW_AGENTS_DEFAULTS_RESTRICT_TO_WORKSPACE=false
-```
-
-> ⚠️ **警告**: この制限を無効にすると、エージェントはシステム上の任意のパスにアクセスできるようになります。制御された環境でのみ慎重に使用してください。
-
-#### セキュリティ境界の一貫性
-
-`restrict_to_workspace` 設定は、すべての実行パスで一貫して適用されます:
-
-| 実行パス | セキュリティ境界 |
-|---------|-----------------|
-| メインエージェント | `restrict_to_workspace` ✅ |
-| サブエージェント / Spawn | 同じ制限を継承 ✅ |
-| ハートビートタスク | 同じ制限を継承 ✅ |
-
-すべてのパスで同じワークスペース制限が適用されます — サブエージェントやスケジュールタスクを通じてセキュリティ境界をバイパスする方法はありません。
-
-### ハートビート(定期タスク)
-
-PicoClaw は自動的に定期タスクを実行できます。ワークスペースに `HEARTBEAT.md` ファイルを作成します:
-
-```markdown
-# 定期タスク
-
-- 重要なメールをチェック
-- 今後の予定を確認
-- 天気予報をチェック
-```
-
-エージェントは30分ごと(設定可能)にこのファイルを読み込み、利用可能なツールを使ってタスクを実行します。
-
-#### spawn で非同期タスク実行
-
-時間のかかるタスク(Web検索、API呼び出し)には `spawn` ツールを使って**サブエージェント**を作成します:
-
-```markdown
-# 定期タスク
-
-## クイックタスク(直接応答)
-- 現在時刻を報告
-
-## 長時間タスク(spawn で非同期)
-- AIニュースを検索して要約
-- メールをチェックして重要なメッセージを報告
-```
-
-**主な特徴:**
-
-| 機能 | 説明 |
-|------|------|
-| **spawn** | 非同期サブエージェントを作成、ハートビートをブロックしない |
-| **独立コンテキスト** | サブエージェントは独自のコンテキストを持ち、セッション履歴なし |
-| **message ツール** | サブエージェントは message ツールで直接ユーザーと通信 |
-| **非ブロッキング** | spawn 後、ハートビートは次のタスクへ継続 |
-
-#### サブエージェントの通信方法
-
-```
-ハートビート発動
- ↓
-エージェントが HEARTBEAT.md を読む
- ↓
-長いタスク: spawn サブエージェント
- ↓ ↓
-次のタスクへ継続 サブエージェントが独立して動作
- ↓ ↓
-全タスク完了 message ツールを使用
- ↓ ↓
-HEARTBEAT_OK 応答 ユーザーが直接結果を受け取る
-```
-
-サブエージェントはツール(message、web_search など)にアクセスでき、メインエージェントを経由せずにユーザーと通信できます。
-
-**設定:**
-
-```json
-{
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-| オプション | デフォルト | 説明 |
-|-----------|-----------|------|
-| `enabled` | `true` | ハートビートの有効/無効 |
-| `interval` | `30` | チェック間隔(分)、最小5分 |
-
-**環境変数:**
-- `PICOCLAW_HEARTBEAT_ENABLED=false` で無効化
-- `PICOCLAW_HEARTBEAT_INTERVAL=60` で間隔変更
-
-### プロバイダー
-
-> [!NOTE]
-> Groq は Whisper による無料の音声文字起こしを提供しています。設定すると、あらゆるチャンネルからの音声メッセージがエージェントレベルで自動的に文字起こしされます。
-
-| プロバイダー | 用途 | API キー取得先 |
-| --- | --- | --- |
-| `gemini` | LLM(Gemini 直接) | [aistudio.google.com](https://aistudio.google.com) |
-| `zhipu` | LLM(Zhipu 直接) | [bigmodel.cn](https://bigmodel.cn) |
-| `volcengine` | LLM(Volcengine 直接) | [volcengine.com](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) |
-| `openrouter`(要テスト) | LLM(推奨、全モデルにアクセス可能) | [openrouter.ai](https://openrouter.ai) |
-| `anthropic`(要テスト) | LLM(Claude 直接) | [console.anthropic.com](https://console.anthropic.com) |
-| `openai`(要テスト) | LLM(GPT 直接) | [platform.openai.com](https://platform.openai.com) |
-| `deepseek`(要テスト) | LLM(DeepSeek 直接) | [platform.deepseek.com](https://platform.deepseek.com) |
-| `groq` | LLM + **音声文字起こし**(Whisper) | [console.groq.com](https://console.groq.com) |
-| `cerebras` | LLM(Cerebras 直接) | [cerebras.ai](https://cerebras.ai) |
-
-### 基本設定
-
-1. **設定ファイルの作成:**
-
- ```bash
- cp config.example.json config/config.json
- ```
-
-2. **設定の編集:**
-
- ```json
- {
- "providers": {
- "openrouter": {
- "api_key": "sk-or-v1-..."
- }
- },
- "channels": {
- "discord": {
- "enabled": true,
- "token": "YOUR_DISCORD_BOT_TOKEN"
- }
- }
- }
- ```
-
-3. **実行**
-
- ```bash
- picoclaw agent -m "Hello"
- ```
-
-
-
-完全な設定例
-
-```json
-{
- "agents": {
- "defaults": {
- "model": "anthropic/claude-opus-4-5"
- }
- },
- "providers": {
- "openrouter": {
- "api_key": "sk-or-v1-xxx"
- },
- "groq": {
- "api_key": "gsk_xxx"
- }
- },
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "123456:ABC...",
- "allow_from": ["123456789"]
- },
- "discord": {
- "enabled": true,
- "token": "",
- "allow_from": [""]
- },
- "whatsapp": {
- "enabled": false
- },
- },
- "tools": {
- "web": {
- "search": {
- "api_key": "BSA..."
- }
- },
- "cron": {
- "exec_timeout_minutes": 5
- }
- },
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-
-
-### モデル設定 (model_list)
-
-> **新機能!** PicoClaw は現在 **モデル中心** の設定アプローチを採用しています。`ベンダー/モデル` 形式(例: `zhipu/glm-4.7`)を指定するだけで、新しいプロバイダーを追加できます—**コードの変更は一切不要!**
-
-この設計は、柔軟なプロバイダー選択による **マルチエージェントサポート** も可能にします:
-
-- **異なるエージェント、異なるプロバイダー** : 各エージェントは独自の LLM プロバイダーを使用可能
-- **フォールバックモデル** : 耐障性のため、プライマリモデルとフォールバックモデルを設定可能
-- **ロードバランシング** : 複数のエンドポイントにリクエストを分散
-- **集中設定管理** : すべてのプロバイダーを一箇所で管理
-
-#### 📋 サポートされているすべてのベンダー
-
-| ベンダー | `model` プレフィックス | デフォルト API Base | プロトコル | API キー |
-|-------------|-----------------|---------------------|----------|---------|
-| **OpenAI** | `openai/` | `https://api.openai.com/v1` | OpenAI | [キーを取得](https://platform.openai.com) |
-| **Anthropic** | `anthropic/` | `https://api.anthropic.com/v1` | Anthropic | [キーを取得](https://console.anthropic.com) |
-| **Zhipu AI (GLM)** | `zhipu/` | `https://open.bigmodel.cn/api/paas/v4` | OpenAI | [キーを取得](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) |
-| **DeepSeek** | `deepseek/` | `https://api.deepseek.com/v1` | OpenAI | [キーを取得](https://platform.deepseek.com) |
-| **Google Gemini** | `gemini/` | `https://generativelanguage.googleapis.com/v1beta` | OpenAI | [キーを取得](https://aistudio.google.com/api-keys) |
-| **Groq** | `groq/` | `https://api.groq.com/openai/v1` | OpenAI | [キーを取得](https://console.groq.com) |
-| **Moonshot** | `moonshot/` | `https://api.moonshot.cn/v1` | OpenAI | [キーを取得](https://platform.moonshot.cn) |
-| **Qwen (Alibaba)** | `qwen/` | `https://dashscope.aliyuncs.com/compatible-mode/v1` | OpenAI | [キーを取得](https://dashscope.console.aliyun.com) |
-| **NVIDIA** | `nvidia/` | `https://integrate.api.nvidia.com/v1` | OpenAI | [キーを取得](https://build.nvidia.com) |
-| **Ollama** | `ollama/` | `http://localhost:11434/v1` | OpenAI | ローカル(キー不要) |
-| **OpenRouter** | `openrouter/` | `https://openrouter.ai/api/v1` | OpenAI | [キーを取得](https://openrouter.ai/keys) |
-| **VLLM** | `vllm/` | `http://localhost:8000/v1` | OpenAI | ローカル |
-| **Cerebras** | `cerebras/` | `https://api.cerebras.ai/v1` | OpenAI | [キーを取得](https://cerebras.ai) |
-| **VolcEngine (Doubao)** | `volcengine/` | `https://ark.cn-beijing.volces.com/api/v3` | OpenAI | [キーを取得](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) |
-| **ShengsuanYun** | `shengsuanyun/` | `https://router.shengsuanyun.com/api/v1` | OpenAI | - |
-| **BytePlus** | `byteplus/` | `https://ark.ap-southeast.bytepluses.com/api/v3` | OpenAI | [キーを取得](https://www.byteplus.com) |
-| **LongCat** | `longcat/` | `https://api.longcat.chat/openai` | OpenAI | [キーを取得](https://longcat.chat/platform) |
-| **Antigravity** | `antigravity/` | Google Cloud | カスタム | OAuthのみ |
-| **GitHub Copilot** | `github-copilot/` | `localhost:4321` | gRPC | - |
-
-#### 基本設定
-
-```json
-{
- "model_list": [
- {
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-your-api-key"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-your-openai-key"
- },
- {
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "api_key": "sk-ant-your-key"
- },
- {
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-zhipu-key"
- }
- ],
- "agents": {
- "defaults": {
- "model": "gpt-5.4"
- }
- }
-}
-```
-
-#### ベンダー別の例
-
-**OpenAI**
-```json
-{
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-..."
-}
-```
-
-**VolcEngine (Doubao)**
-```json
-{
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-..."
-}
-```
-
-**Zhipu AI (GLM)**
-```json
-{
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-key"
-}
-```
-
-**Anthropic (OAuth使用)**
-```json
-{
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "auth_method": "oauth"
-}
-```
-> OAuth認証を設定するには、`picoclaw auth login --provider anthropic` を実行してください。
-
-**カスタムプロキシ/API**
-```json
-{
- "model_name": "my-custom-model",
- "model": "openai/custom-model",
- "api_base": "https://my-proxy.com/v1",
- "api_key": "sk-...",
- "request_timeout": 300
-}
-```
-
-#### ロードバランシング
-
-同じモデル名で複数のエンドポイントを設定すると、PicoClaw が自動的にラウンドロビンで分散します:
-
-```json
-{
- "model_list": [
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_base": "https://api1.example.com/v1",
- "api_key": "sk-key1"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_base": "https://api2.example.com/v1",
- "api_key": "sk-key2"
- }
- ]
-}
-```
-
-#### 従来の `providers` 設定からの移行
-
-古い `providers` 設定は**非推奨**ですが、後方互換性のためにサポートされています。
-
-**旧設定(非推奨):**
-```json
-{
- "providers": {
- "zhipu": {
- "api_key": "your-key",
- "api_base": "https://open.bigmodel.cn/api/paas/v4"
- }
- },
- "agents": {
- "defaults": {
- "provider": "zhipu",
- "model": "glm-4.7"
- }
- }
-}
-```
-
-**新設定(推奨):**
-```json
-{
- "model_list": [
- {
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-key"
- }
- ],
- "agents": {
- "defaults": {
- "model": "glm-4.7"
- }
- }
-}
-```
-
-詳細な移行ガイドは、[docs/migration/model-list-migration.md](docs/migration/model-list-migration.md) を参照してください。
-
-## CLI リファレンス
-
-| コマンド | 説明 |
-|---------|------|
-| `picoclaw onboard` | 設定&ワークスペースの初期化 |
-| `picoclaw agent -m "..."` | エージェントとチャット |
-| `picoclaw agent` | インタラクティブチャットモード |
-| `picoclaw gateway` | ゲートウェイを起動 |
-| `picoclaw status` | ステータスを表示 |
-
-## 🤝 コントリビュート&ロードマップ
-
-PR 歓迎!コードベースは意図的に小さく読みやすくしています。🤗
-
-Discord: https://discord.gg/V4sAZ9XWpN
-
-
-
-
-## 🐛 トラブルシューティング
-
-### Web 検索で「API 設定の問題」と表示される
-
-検索 API キーをまだ設定していない場合、これは正常です。PicoClaw は手動検索用の便利なリンクを提供します。
-
-Web 検索を有効にするには:
-1. [https://tavily.com](https://tavily.com) (月 1000 クエリ無料) または [https://brave.com/search/api](https://brave.com/search/api) で無料の API キーを取得(月 2000 クエリ無料)
-2. `~/.picoclaw/config.json` に追加:
- ```json
- {
- "tools": {
- "web": {
- "brave": {
- "enabled": true,
- "api_key": "YOUR_BRAVE_API_KEY",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- }
- }
- }
- ```
-
-### コンテンツフィルタリングエラーが出る
-
-一部のプロバイダー(Zhipu など)にはコンテンツフィルタリングがあります。クエリを言い換えるか、別のモデルを使用してください。
-
-### Telegram Bot で「Conflict: terminated by other getUpdates」と表示される
-
-別のインスタンスが実行中の場合に発生します。`picoclaw gateway` が 1 つだけ実行されていることを確認してください。
-
----
-
-## 📝 API キー比較
-
-| サービス | 無料枠 | ユースケース |
-|---------|--------|------------|
-| **OpenRouter** | 月 200K トークン | 複数モデル(Claude, GPT-4 など) |
-| **Volcengine CodingPlan** | 9.9元/初月 | 中国ユーザーに最適、複数のSOTAモデル(Doubao、DeepSeek等) |
-| **Zhipu** | 月 200K トークン | 中国ユーザーに適している |
-| **Qwen** | 無料枠あり | 通義千問 (Qwen) |
-| **Brave Search** | 月 2000 クエリ | Web 検索機能 |
-| **Tavily** | 月 1000 クエリ | AI エージェント検索最適化 |
-| **Groq** | 無料枠あり | 高速推論(Llama, Mixtral) |
-| **Cerebras** | 無料枠あり | 高速推論(Llama, Qwen など) |
-
----
-
-
-

-
diff --git a/README.md b/README.md
index 1640b5d1f..dd8a16eff 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
PicoClaw: Ultra-Efficient AI Assistant in Go
- $10 Hardware · 10MB RAM · 1s Boot · 皮皮虾,我们走!
+ $10 Hardware · 10MB RAM · 1s Boot · PicoClaw, Let's Go!
@@ -17,8 +17,6 @@
-[中文](README.zh.md) | [日本語](README.ja.md) | [Português](README.pt-br.md) | [Tiếng Việt](README.vi.md) | [Français](README.fr.md) | **English**
-
---
@@ -43,7 +41,7 @@
> [!CAUTION]
-> **🚨 SECURITY & OFFICIAL CHANNELS / 安全声明**
+> **🚨 SECURITY & OFFICIAL CHANNELS**
>
> * **NO CRYPTO:** PicoClaw has **NO** official token/coin. All claims on `pump.fun` or other trading platforms are **SCAMS**.
>
@@ -59,7 +57,7 @@
2026-02-13 🎉 PicoClaw hit 5000 stars in 4days! Thank you for the community! There are so many PRs & issues coming in (during Chinese New Year holidays), we are finalizing the Project Roadmap and setting up the Developer Group to accelerate PicoClaw's development.
🚀 Call to Action: Please submit your feature requests in GitHub Discussions. We will review and prioritize them during our upcoming weekly meeting.
-2026-02-09 🎉 PicoClaw Launched! Built in 1 day to bring AI Agents to $10 hardware with <10MB RAM. 🦐 PicoClaw,Let's Go!
+2026-02-09 🎉 PicoClaw Launched! Built in 1 day to bring AI Agents to $10 hardware with <10MB RAM. 🦐 PicoClaw, Let's Go!
## ✨ Features
diff --git a/README.pt-br.md b/README.pt-br.md
deleted file mode 100644
index cbff2fc19..000000000
--- a/README.pt-br.md
+++ /dev/null
@@ -1,1107 +0,0 @@
-
-

-
-
PicoClaw: Assistente de IA Ultra-Eficiente em Go
-
-
Hardware de $10 · 10MB de RAM · Boot em 1s · 皮皮虾,我们走!
-
-
-
-
-
-
-
-
-
-
- [中文](README.zh.md) | [日本語](README.ja.md) | **Português** | [Tiếng Việt](README.vi.md) | [Français](README.fr.md) | [English](README.md)
-
-
----
-
-🦐 **PicoClaw** é um assistente pessoal de IA ultra-leve inspirado no [nanobot](https://github.com/HKUDS/nanobot), reescrito do zero em **Go** por meio de um processo de "auto-inicialização" (self-bootstrapping) — onde o próprio agente de IA conduziu toda a migração de arquitetura e otimização de código.
-
-⚡️ **Extremamente leve:** Roda em hardware de apenas **$10** com **<10MB** de RAM. Isso é 99% menos memória que o OpenClaw e 98% mais barato que um Mac mini!
-
-
-
-|
-
-
-
- |
-
-
-
-
- |
-
-
-
-> [!CAUTION]
-> **🚨 DECLARAÇÃO DE SEGURANÇA & CANAIS OFICIAIS**
->
-> * **SEM CRIPTOMOEDAS:** O PicoClaw **NÃO** possui nenhum token/moeda oficial. Todas as alegações no `pump.fun` ou outras plataformas de negociação são **GOLPES**.
-> * **DOMÍNIO OFICIAL:** O **ÚNICO** site oficial é o **[picoclaw.io](https://picoclaw.io)**, e o site da empresa é o **[sipeed.com](https://sipeed.com)**.
-> * **Aviso:** Muitos domínios `.ai/.org/.com/.net/...` foram registrados por terceiros, não são nossos.
-> * **Aviso:** O PicoClaw está em fase inicial de desenvolvimento e pode ter problemas de segurança de rede não resolvidos. Não implante em ambientes de produção antes da versão v1.0.
-> * **Nota:** O PicoClaw recentemente fez merge de muitos PRs, o que pode resultar em maior consumo de memória (10-20MB) nas versões mais recentes. Planejamos priorizar a otimização de recursos assim que o conjunto de funcionalidades estiver estável.
-
-
-## 📢 Novidades
-
-2026-02-16 🎉 PicoClaw atingiu 12K stars em uma semana! Obrigado a todos pelo apoio! O PicoClaw está crescendo mais rápido do que jamais imaginamos. Dado o alto volume de PRs, precisamos urgentemente de maintainers da comunidade. Nossos papéis de voluntários e roadmap foram publicados oficialmente [aqui](docs/ROADMAP.md) — estamos ansiosos para ter você a bordo!
-
-2026-02-13 🎉 PicoClaw atingiu 5000 stars em 4 dias! Obrigado à comunidade! Estamos finalizando o **Roadmap do Projeto** e configurando o **Grupo de Desenvolvedores** para acelerar o desenvolvimento do PicoClaw.
-
-🚀 **Chamada para Ação:** Envie suas solicitações de funcionalidades nas GitHub Discussions. Revisaremos e priorizaremos na próxima reunião semanal.
-
-2026-02-09 🎉 PicoClaw lançado oficialmente! Construído em 1 dia para trazer Agentes de IA para hardware de $10 com <10MB de RAM. 🦐 PicoClaw, Partiu!
-
-## ✨ Funcionalidades
-
-🪶 **Ultra-Leve**: Consumo de memória <10MB — 99% menor que o Clawdbot para funcionalidades essenciais.
-
-💰 **Custo Mínimo**: Eficiente o suficiente para rodar em hardware de $10 — 98% mais barato que um Mac mini.
-
-⚡️ **Inicialização Relámpago**: Tempo de inicialização 400X mais rápido, boot em 1 segundo mesmo em CPU single-core de 0.6GHz.
-
-🌍 **Portabilidade Real**: Um único binário auto-contido para RISC-V, ARM, MIPS e x86. Um clique e já era!
-
-🤖 **Auto-Construído por IA**: Implementação nativa em Go de forma autônoma — 95% do núcleo gerado pelo Agente com refinamento humano no loop.
-
-| | OpenClaw | NanoBot | **PicoClaw** |
-| ----------------------------- | ------------- | ------------------------ | ----------------------------------------- |
-| **Linguagem** | TypeScript | Python | **Go** |
-| **RAM** | >1GB | >100MB | **< 10MB** |
-| **Inicialização**(CPU 0.8GHz) | >500s | >30s | **<1s** |
-| **Custo** | Mac Mini $599 | Maioria dos SBC Linux ~$50 | **Qualquer placa Linux****A partir de $10** |
-
-
-
-## 🦾 Demonstração
-
-### 🛠️ Fluxos de Trabalho Padrão do Assistente
-
-
-
-🧩 Engenharia Full-Stack |
-🗂️ Gerenciamento de Logs & Planejamento |
-🔎 Busca Web & Aprendizado |
-
-
-
|
-
|
-
|
-
-
-| Desenvolver • Implantar • Escalar |
-Agendar • Automatizar • Memorizar |
-Descobrir • Analisar • Tendências |
-
-
-
-### 📱 Rode em celulares Android antigos
-
-Dê uma segunda vida ao seu celular de dez anos atrás! Transforme-o em um assistente de IA inteligente com o PicoClaw. Início rápido:
-
-1. **Instale o Termux** (Disponível no F-Droid ou Google Play).
-2. **Execute os comandos**
-
-```bash
-# Nota: Substitua v0.1.1 pela versao mais recente da pagina de Releases
-wget https://github.com/sipeed/picoclaw/releases/download/v0.1.1/picoclaw-linux-arm64
-chmod +x picoclaw-linux-arm64
-pkg install proot
-termux-chroot ./picoclaw-linux-arm64 onboard
-```
-
-Depois siga as instruções na seção "Início Rápido" para completar a configuração!
-
-
-
-### 🐜 Implantação Inovadora com Baixo Consumo
-
-O PicoClaw pode ser implantado em praticamente qualquer dispositivo Linux!
-
-- $9.9 [LicheeRV-Nano](https://www.aliexpress.com/item/1005006519668532.html) versão E (Ethernet) ou W (WiFi6), para Assistente Doméstico Minimalista
-- $30~50 [NanoKVM](https://www.aliexpress.com/item/1005007369816019.html), ou $100 [NanoKVM-Pro](https://www.aliexpress.com/item/1005010048471263.html) para Manutenção Automatizada de Servidores
-- $50 [MaixCAM](https://www.aliexpress.com/item/1005008053333693.html) ou $100 [MaixCAM2](https://www.kickstarter.com/projects/zepan/maixcam2-build-your-next-gen-4k-ai-camera) para Monitoramento Inteligente
-
-https://private-user-images.githubusercontent.com/83055338/547056448-e7b031ff-d6f5-4468-bcca-5726b6fecb5c.mp4
-
-🌟 Mais cenários de implantação aguardam você!
-
-## 📦 Instalação
-
-### Instalar com binário pré-compilado
-
-Baixe o binário para sua plataforma na página de [releases](https://github.com/sipeed/picoclaw/releases).
-
-### Instalar a partir do código-fonte (funcionalidades mais recentes, recomendado para desenvolvimento)
-
-```bash
-git clone https://github.com/sipeed/picoclaw.git
-
-cd picoclaw
-make deps
-
-# Build, sem necessidade de instalar
-make build
-
-# Build para multiplas plataformas
-make build-all
-
-# Build e Instalar
-make install
-```
-
-## 🐳 Docker Compose
-
-Você tambêm pode rodar o PicoClaw usando Docker Compose sem instalar nada localmente.
-
-```bash
-# 1. Clone este repositorio
-git clone https://github.com/sipeed/picoclaw.git
-cd picoclaw
-
-# 2. Primeiro uso — gera docker/data/config.json automaticamente e para
-docker compose -f docker/docker-compose.yml --profile gateway up
-# O contêiner exibe "First-run setup complete." e para.
-
-# 3. Configure suas API keys
-vim docker/data/config.json # Chaves de API do provedor, tokens de bot, etc.
-
-# 4. Iniciar
-docker compose -f docker/docker-compose.yml --profile gateway up -d
-```
-
-> [!TIP]
-> **Usuários Docker**: Por padrão, o Gateway ouve em `127.0.0.1`, o que não é acessível a partir do host. Se você precisar acessar os endpoints de integridade ou expor portas, defina `PICOCLAW_GATEWAY_HOST=0.0.0.0` em seu ambiente ou atualize o `config.json`.
-
-```bash
-# 5. Ver logs
-docker compose -f docker/docker-compose.yml logs -f picoclaw-gateway
-
-# 6. Parar
-docker compose -f docker/docker-compose.yml --profile gateway down
-```
-
-### Modo Agente (Execução única)
-
-```bash
-# Fazer uma pergunta
-docker compose -f docker/docker-compose.yml run --rm picoclaw-agent -m "Quanto e 2+2?"
-
-# Modo interativo
-docker compose -f docker/docker-compose.yml run --rm picoclaw-agent
-```
-
-### Atualizar
-
-```bash
-docker compose -f docker/docker-compose.yml pull
-docker compose -f docker/docker-compose.yml --profile gateway up -d
-```
-
-### 🚀 Início Rápido
-
-> [!TIP]
-> Configure sua API key em `~/.picoclaw/config.json`. Obtenha API keys: [Volcengine (CodingPlan)](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) (LLM) · [OpenRouter](https://openrouter.ai/keys) (LLM) · [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) (LLM). Busca web é **opcional** — obtenha a [API Tavily](https://tavily.com) gratuita (1000 consultas grátis/mês) ou a [Brave Search API](https://brave.com/search/api) (2000 consultas grátis/mês).
-
-**1. Inicializar**
-
-```bash
-picoclaw onboard
-```
-
-**2. Configurar** (`~/.picoclaw/config.json`)
-
-```json
-{
- "model_list": [
- {
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-your-api-key"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-your-openai-key",
- "request_timeout": 300,
- "api_base": "https://api.openai.com/v1"
- }
- ],
- "agents": {
- "defaults": {
- "model_name": "gpt-5.4"
- }
- },
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "YOUR_BRAVE_API_KEY",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- }
- }
-}
-```
-
-> **Novo**: O formato de configuração `model_list` permite adicionar provedores sem alterar código. Veja [Configuração de Modelo](#configuração-de-modelo-model_list) para detalhes.
-> `request_timeout` é opcional e usa segundos. Se omitido ou definido como `<= 0`, o PicoClaw usa o timeout padrão (120s).
-
-**3. Obter API Keys**
-
-* **Provedor de LLM**: [OpenRouter](https://openrouter.ai/keys) · [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) · [Anthropic](https://console.anthropic.com) · [OpenAI](https://platform.openai.com) · [Gemini](https://aistudio.google.com/api-keys)
-* **Busca Web** (opcional): [Brave Search](https://brave.com/search/api) - Plano gratuito disponível (2000 consultas/mês)
-
-> **Nota**: Veja `config.example.json` para um modelo de configuração completo.
-
-**4. Conversar**
-
-```bash
-picoclaw agent -m "Quanto e 2+2?"
-```
-
-Pronto! Você tem um assistente de IA funcionando em 2 minutos.
-
----
-
-## 💬 Integração com Apps de Chat
-
-Converse com seu PicoClaw via Telegram, Discord, DingTalk, LINE ou WeCom.
-
-| Canal | Nível de Configuração |
-| --- | --- |
-| **Telegram** | Fácil (apenas um token) |
-| **Discord** | Fácil (bot token + intents) |
-| **QQ** | Fácil (AppID + AppSecret) |
-| **DingTalk** | Médio (credenciais do app) |
-| **LINE** | Médio (credenciais + webhook URL) |
-
-
-Telegram (Recomendado)
-
-**1. Criar o bot**
-
-* Abra o Telegram, busque `@BotFather`
-* Envie `/newbot`, siga as instruções
-* Copie o token
-
-**2. Configurar**
-
-```json
-{
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "YOUR_BOT_TOKEN",
- "allow_from": ["YOUR_USER_ID"]
- }
- }
-}
-```
-
-> Obtenha seu User ID pelo `@userinfobot` no Telegram.
-
-**3. Executar**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-Discord
-
-**1. Criar o bot**
-
-* Acesse
-* Crie um aplicativo → Bot → Add Bot
-* Copie o token do bot
-
-**2. Habilitar Intents**
-
-* Nas configurações do Bot, habilite **MESSAGE CONTENT INTENT**
-* (Opcional) Habilite **SERVER MEMBERS INTENT** se quiser usar lista de permissões baseada em dados dos membros
-
-**3. Obter seu User ID**
-
-* Configurações do Discord → Avançado → habilite **Modo Desenvolvedor**
-* Clique com botão direito no seu avatar → **Copiar ID do Usuário**
-
-**4. Configurar**
-
-```json
-{
- "channels": {
- "discord": {
- "enabled": true,
- "token": "YOUR_BOT_TOKEN",
- "allow_from": ["YOUR_USER_ID"]
- }
- }
-}
-```
-
-**5. Convidar o bot**
-
-* OAuth2 → URL Generator
-* Scopes: `bot`
-* Bot Permissions: `Send Messages`, `Read Message History`
-* Abra a URL de convite gerada e adicione o bot ao seu servidor
-
-**6. Executar**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-QQ
-
-**1. Criar o bot**
-
-- Acesse a [QQ Open Platform](https://q.qq.com/#)
-- Crie um aplicativo → Obtenha **AppID** e **AppSecret**
-
-**2. Configurar**
-
-```json
-{
- "channels": {
- "qq": {
- "enabled": true,
- "app_id": "YOUR_APP_ID",
- "app_secret": "YOUR_APP_SECRET",
- "allow_from": []
- }
- }
-}
-```
-
-> Deixe `allow_from` vazio para permitir todos os usuários, ou especifique números QQ para restringir o acesso.
-
-**3. Executar**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-DingTalk
-
-**1. Criar o bot**
-
-* Acesse a [Open Platform](https://open.dingtalk.com/)
-* Crie um app interno
-* Copie o Client ID e Client Secret
-
-**2. Configurar**
-
-```json
-{
- "channels": {
- "dingtalk": {
- "enabled": true,
- "client_id": "YOUR_CLIENT_ID",
- "client_secret": "YOUR_CLIENT_SECRET",
- "allow_from": []
- }
- }
-}
-```
-
-> Deixe `allow_from` vazio para permitir todos os usuários, ou especifique IDs para restringir o acesso.
-
-**3. Executar**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-LINE
-
-**1. Criar uma Conta Oficial LINE**
-
-- Acesse o [LINE Developers Console](https://developers.line.biz/)
-- Crie um provider → Crie um canal Messaging API
-- Copie o **Channel Secret** e o **Channel Access Token**
-
-**2. Configurar**
-
-```json
-{
- "channels": {
- "line": {
- "enabled": true,
- "channel_secret": "YOUR_CHANNEL_SECRET",
- "channel_access_token": "YOUR_CHANNEL_ACCESS_TOKEN",
- "webhook_path": "/webhook/line",
- "allow_from": []
- }
- }
-}
-```
-
-**3. Configurar URL do Webhook**
-
-O LINE requer HTTPS para webhooks. Use um reverse proxy ou tunnel:
-
-```bash
-# Exemplo com ngrok
-ngrok http 18790
-```
-
-Em seguida, configure a Webhook URL no LINE Developers Console para `https://seu-dominio/webhook/line` e habilite **Use webhook**.
-
-> **Nota**: O webhook do LINE é servido pelo Gateway compartilhado (padrão 127.0.0.1:18790). Use um proxy reverso/HTTPS ou túnel (como ngrok) para expor o Gateway de forma segura quando necessário.
-
-**4. Executar**
-
-```bash
-picoclaw gateway
-```
-
-> Em chats de grupo, o bot responde apenas quando mencionado com @. As respostas citam a mensagem original.
-
-> **Docker Compose**: Se você usa Docker Compose, exponha o Gateway (padrão 127.0.0.1:18790) se precisar acessar o webhook LINE externamente, por exemplo `ports: ["18790:18790"]`.
-
-
-
-
-##
Junte-se a Rede Social de Agentes
-
-Conecte o PicoClaw a Rede Social de Agentes simplesmente enviando uma única mensagem via CLI ou qualquer App de Chat integrado.
-
-**Leia `https://clawdchat.ai/skill.md` e siga as instruções para entrar no [ClawdChat.ai](https://clawdchat.ai)**
-
-## ⚙️ Configuração Detalhada
-
-Arquivo de configuração: `~/.picoclaw/config.json`
-
-### Variáveis de Ambiente
-
-Você pode substituir os caminhos padrão usando variáveis de ambiente. Isso é útil para instalações portáteis, implantações em contêineres ou para executar o picoclaw como um serviço do sistema. Essas variáveis são independentes e controlam caminhos diferentes.
-
-| Variável | Descrição | Caminho Padrão |
-|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------|---------------------------|
-| `PICOCLAW_CONFIG` | Substitui o caminho para o arquivo de configuração. Isso informa diretamente ao picoclaw qual `config.json` carregar, ignorando todos os outros locais. | `~/.picoclaw/config.json` |
-| `PICOCLAW_HOME` | Substitui o diretório raiz dos dados do picoclaw. Isso altera o local padrão do `workspace` e de outros diretórios de dados. | `~/.picoclaw` |
-
-**Exemplos:**
-
-```bash
-# Executar o picoclaw usando um arquivo de configuração específico
-# O caminho do workspace será lido de dentro desse arquivo de configuração
-PICOCLAW_CONFIG=/etc/picoclaw/production.json picoclaw gateway
-
-# Executar o picoclaw com todos os seus dados armazenados em /opt/picoclaw
-# A configuração será carregada do ~/.picoclaw/config.json padrão
-# O workspace será criado em /opt/picoclaw/workspace
-PICOCLAW_HOME=/opt/picoclaw picoclaw agent
-
-# Use ambos para uma configuração totalmente personalizada
-PICOCLAW_HOME=/srv/picoclaw PICOCLAW_CONFIG=/srv/picoclaw/main.json picoclaw gateway
-```
-
-### Estrutura do Workspace
-
-O PicoClaw armazena dados no workspace configurado (padrão: `~/.picoclaw/workspace`):
-
-```
-~/.picoclaw/workspace/
-├── sessions/ # Sessoes de conversa e historico
-├── memory/ # Memoria de longo prazo (MEMORY.md)
-├── state/ # Estado persistente (ultimo canal, etc.)
-├── cron/ # Banco de dados de tarefas agendadas
-├── skills/ # Skills personalizadas
-├── AGENTS.md # Guia de comportamento do Agente
-├── HEARTBEAT.md # Prompts de tarefas periodicas (verificado a cada 30 min)
-├── IDENTITY.md # Identidade do Agente
-├── SOUL.md # Alma do Agente
-└── USER.md # Preferencias do usuario
-```
-
-### 🔒 Sandbox de Segurança
-
-O PicoClaw roda em um ambiente sandbox por padrão. O agente so pode acessar arquivos e executar comandos dentro do workspace configurado.
-
-#### Configuração Padrão
-
-```json
-{
- "agents": {
- "defaults": {
- "workspace": "~/.picoclaw/workspace",
- "restrict_to_workspace": true
- }
- }
-}
-```
-
-| Opção | Padrão | Descrição |
-|-------|--------|-----------|
-| `workspace` | `~/.picoclaw/workspace` | Diretório de trabalho do agente |
-| `restrict_to_workspace` | `true` | Restringir acesso de arquivos/comandos ao workspace |
-
-#### Ferramentas Protegidas
-
-Quando `restrict_to_workspace: true`, as seguintes ferramentas são restritas ao sandbox:
-
-| Ferramenta | Função | Restrição |
-|------------|--------|-----------|
-| `read_file` | Ler arquivos | Apenas arquivos dentro do workspace |
-| `write_file` | Escrever arquivos | Apenas arquivos dentro do workspace |
-| `list_dir` | Listar diretorios | Apenas diretorios dentro do workspace |
-| `edit_file` | Editar arquivos | Apenas arquivos dentro do workspace |
-| `append_file` | Adicionar a arquivos | Apenas arquivos dentro do workspace |
-| `exec` | Executar comandos | Caminhos dos comandos devem estar dentro do workspace |
-
-#### Proteção Adicional do Exec
-
-Mesmo com `restrict_to_workspace: false`, a ferramenta `exec` bloqueia estes comandos perigosos:
-
-* `rm -rf`, `del /f`, `rmdir /s` — Exclusão em massa
-* `format`, `mkfs`, `diskpart` — Formatação de disco
-* `dd if=` — Criação de imagem de disco
-* Escrita em `/dev/sd[a-z]` — Escrita direta no disco
-* `shutdown`, `reboot`, `poweroff` — Desligamento do sistema
-* Fork bomb `:(){ :|:& };:`
-
-#### Exemplos de Erro
-
-```
-[ERROR] tool: Tool execution failed
-{tool=exec, error=Command blocked by safety guard (path outside working dir)}
-```
-
-```
-[ERROR] tool: Tool execution failed
-{tool=exec, error=Command blocked by safety guard (dangerous pattern detected)}
-```
-
-#### Desabilitar Restrições (Risco de Segurança)
-
-Se você precisa que o agente acesse caminhos fora do workspace:
-
-**Método 1: Arquivo de configuração**
-
-```json
-{
- "agents": {
- "defaults": {
- "restrict_to_workspace": false
- }
- }
-}
-```
-
-**Método 2: Variável de ambiente**
-
-```bash
-export PICOCLAW_AGENTS_DEFAULTS_RESTRICT_TO_WORKSPACE=false
-```
-
-> ⚠️ **Aviso**: Desabilitar esta restrição permite que o agente acesse qualquer caminho no seu sistema. Use com cuidado apenas em ambientes controlados.
-
-#### Consistência do Limite de Segurança
-
-A configuração `restrict_to_workspace` se aplica consistentemente em todos os caminhos de execução:
-
-| Caminho de Execução | Limite de Segurança |
-|----------------------|---------------------|
-| Agente Principal | `restrict_to_workspace` ✅ |
-| Subagente / Spawn | Herda a mesma restrição ✅ |
-| Tarefas Heartbeat | Herda a mesma restrição ✅ |
-
-Todos os caminhos compartilham a mesma restrição de workspace — nao há como contornar o limite de segurança por meio de subagentes ou tarefas agendadas.
-
-### Heartbeat (Tarefas Periódicas)
-
-O PicoClaw pode executar tarefas periódicas automaticamente. Crie um arquivo `HEARTBEAT.md` no seu workspace:
-
-```markdown
-# Tarefas Periodicas
-
-- Verificar meu email para mensagens importantes
-- Revisar minha agenda para proximos eventos
-- Verificar a previsao do tempo
-```
-
-O agente lerá este arquivo a cada 30 minutos (configurável) e executará as tarefas usando as ferramentas disponíveis.
-
-#### Tarefas Assincronas com Spawn
-
-Para tarefas de longa duração (busca web, chamadas de API), use a ferramenta `spawn` para criar um **subagente**:
-
-```markdown
-# Tarefas Periódicas
-
-## Tarefas Rápidas (resposta direta)
-- Informar hora atual
-
-## Tarefas Longas (usar spawn para async)
-- Buscar notícias de IA na web e resumir
-- Verificar email e reportar mensagens importantes
-```
-
-**Comportamentos principais:**
-
-| Funcionalidade | Descrição |
-|----------------|-----------|
-| **spawn** | Cria subagente assíncrono, não bloqueia o heartbeat |
-| **Contexto independente** | Subagente tem seu próprio contexto, sem histórico de sessão |
-| **Ferramenta message** | Subagente se comunica diretamente com o usuário via ferramenta message |
-| **Não-bloqueante** | Após o spawn, o heartbeat continua para a próxima tarefa |
-
-#### Como Funciona a Comunicação do Subagente
-
-```
-Heartbeat dispara
- ↓
-Agente lê HEARTBEAT.md
- ↓
-Para tarefa longa: spawn subagente
- ↓ ↓
-Continua próxima tarefa Subagente trabalha independentemente
- ↓ ↓
-Todas tarefas concluídas Subagente usa ferramenta "message"
- ↓ ↓
-Responde HEARTBEAT_OK Usuário recebe resultado diretamente
-```
-
-O subagente tem acesso às ferramentas (message, web_search, etc.) e pode se comunicar com o usuário independentemente sem passar pelo agente principal.
-
-**Configuração:**
-
-```json
-{
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-| Opção | Padrão | Descrição |
-|-------|--------|-----------|
-| `enabled` | `true` | Habilitar/desabilitar heartbeat |
-| `interval` | `30` | Intervalo de verificação em minutos (min: 5) |
-
-**Variáveis de ambiente:**
-
-* `PICOCLAW_HEARTBEAT_ENABLED=false` para desabilitar
-* `PICOCLAW_HEARTBEAT_INTERVAL=60` para alterar o intervalo
-
-### Provedores
-
-> [!NOTE]
-> O Groq fornece transcrição de voz gratuita via Whisper. Se configurado, mensagens de áudio de qualquer canal serão automaticamente transcritas no nível do agente.
-
-| Provedor | Finalidade | Obter API Key |
-| --- | --- | --- |
-| `gemini` | LLM (Gemini direto) | [aistudio.google.com](https://aistudio.google.com) |
-| `zhipu` | LLM (Zhipu direto) | [bigmodel.cn](bigmodel.cn) |
-| `volcengine` | LLM(Volcengine direto) | [volcengine.com](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) |
-| `openrouter` (Em teste) | LLM (recomendado, acesso a todos os modelos) | [openrouter.ai](https://openrouter.ai) |
-| `anthropic` (Em teste) | LLM (Claude direto) | [console.anthropic.com](https://console.anthropic.com) |
-| `openai` (Em teste) | LLM (GPT direto) | [platform.openai.com](https://platform.openai.com) |
-| `deepseek` (Em teste) | LLM (DeepSeek direto) | [platform.deepseek.com](https://platform.deepseek.com) |
-| `qwen` | Alibaba Qwen | [dashscope.console.aliyun.com](https://dashscope.console.aliyun.com) |
-| `cerebras` | Cerebras | [cerebras.ai](https://cerebras.ai) |
-| `groq` | LLM + **Transcrição de voz** (Whisper) | [console.groq.com](https://console.groq.com) |
-
-
-Configuração Zhipu
-
-**1. Obter API key**
-
-* Obtenha a [API key](https://bigmodel.cn/usercenter/proj-mgmt/apikeys)
-
-**2. Configurar**
-
-```json
-{
- "agents": {
- "defaults": {
- "workspace": "~/.picoclaw/workspace",
- "model": "glm-4.7",
- "max_tokens": 8192,
- "temperature": 0.7,
- "max_tool_iterations": 20
- }
- },
- "providers": {
- "zhipu": {
- "api_key": "Sua API Key",
- "api_base": "https://open.bigmodel.cn/api/paas/v4"
- }
- }
-}
-```
-
-**3. Executar**
-
-```bash
-picoclaw agent -m "Ola, como vai?"
-```
-
-
-
-
-Exemplo de configuraçao completa
-
-```json
-{
- "agents": {
- "defaults": {
- "model": "anthropic/claude-opus-4-5"
- }
- },
- "providers": {
- "openrouter": {
- "api_key": "sk-or-v1-xxx"
- },
- "groq": {
- "api_key": "gsk_xxx"
- }
- },
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "123456:ABC...",
- "allow_from": ["123456789"]
- },
- "discord": {
- "enabled": true,
- "token": "",
- "allow_from": [""]
- },
- "whatsapp": {
- "enabled": false
- },
- "qq": {
- "enabled": false,
- "app_id": "",
- "app_secret": "",
- "allow_from": []
- }
- },
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "BSA...",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- },
- "cron": {
- "exec_timeout_minutes": 5
- }
- },
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-
-
-### Configuração de Modelo (model_list)
-
-> **Novidade!** PicoClaw agora usa uma abordagem de configuração **centrada no modelo**. Basta especificar o formato `fornecedor/modelo` (ex: `zhipu/glm-4.7`) para adicionar novos provedores—**nenhuma alteração de código necessária!**
-
-Este design também possibilita o **suporte multi-agent** com seleção flexível de provedores:
-
-- **Diferentes agentes, diferentes provedores** : Cada agente pode usar seu próprio provedor LLM
-- **Modelos de fallback** : Configure modelos primários e de reserva para resiliência
-- **Balanceamento de carga** : Distribua solicitações entre múltiplos endpoints
-- **Configuração centralizada** : Gerencie todos os provedores em um só lugar
-
-#### 📋 Todos os Fornecedores Suportados
-
-| Fornecedor | Prefixo `model` | API Base Padrão | Protocolo | Chave API |
-|-------------|-----------------|------------------|----------|-----------|
-| **OpenAI** | `openai/` | `https://api.openai.com/v1` | OpenAI | [Obter Chave](https://platform.openai.com) |
-| **Anthropic** | `anthropic/` | `https://api.anthropic.com/v1` | Anthropic | [Obter Chave](https://console.anthropic.com) |
-| **Zhipu AI (GLM)** | `zhipu/` | `https://open.bigmodel.cn/api/paas/v4` | OpenAI | [Obter Chave](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) |
-| **DeepSeek** | `deepseek/` | `https://api.deepseek.com/v1` | OpenAI | [Obter Chave](https://platform.deepseek.com) |
-| **Google Gemini** | `gemini/` | `https://generativelanguage.googleapis.com/v1beta` | OpenAI | [Obter Chave](https://aistudio.google.com/api-keys) |
-| **Groq** | `groq/` | `https://api.groq.com/openai/v1` | OpenAI | [Obter Chave](https://console.groq.com) |
-| **Moonshot** | `moonshot/` | `https://api.moonshot.cn/v1` | OpenAI | [Obter Chave](https://platform.moonshot.cn) |
-| **Qwen (Alibaba)** | `qwen/` | `https://dashscope.aliyuncs.com/compatible-mode/v1` | OpenAI | [Obter Chave](https://dashscope.console.aliyun.com) |
-| **NVIDIA** | `nvidia/` | `https://integrate.api.nvidia.com/v1` | OpenAI | [Obter Chave](https://build.nvidia.com) |
-| **Ollama** | `ollama/` | `http://localhost:11434/v1` | OpenAI | Local (sem chave necessária) |
-| **OpenRouter** | `openrouter/` | `https://openrouter.ai/api/v1` | OpenAI | [Obter Chave](https://openrouter.ai/keys) |
-| **VLLM** | `vllm/` | `http://localhost:8000/v1` | OpenAI | Local |
-| **Cerebras** | `cerebras/` | `https://api.cerebras.ai/v1` | OpenAI | [Obter Chave](https://cerebras.ai) |
-| **VolcEngine (Doubao)** | `volcengine/` | `https://ark.cn-beijing.volces.com/api/v3` | OpenAI | [Obter Chave](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) |
-| **ShengsuanYun** | `shengsuanyun/` | `https://router.shengsuanyun.com/api/v1` | OpenAI | - |
-| **BytePlus** | `byteplus/` | `https://ark.ap-southeast.bytepluses.com/api/v3` | OpenAI | [Obter Chave](https://www.byteplus.com) |
-| **LongCat** | `longcat/` | `https://api.longcat.chat/openai` | OpenAI | [Obter Chave](https://longcat.chat/platform) |
-| **Antigravity** | `antigravity/` | Google Cloud | Custom | Apenas OAuth |
-| **GitHub Copilot** | `github-copilot/` | `localhost:4321` | gRPC | - |
-
-#### Configuração Básica
-
-```json
-{
- "model_list": [
- {
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-your-api-key"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-your-openai-key"
- },
- {
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "api_key": "sk-ant-your-key"
- },
- {
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-zhipu-key"
- }
- ],
- "agents": {
- "defaults": {
- "model": "gpt-5.4"
- }
- }
-}
-```
-
-#### Exemplos por Fornecedor
-
-**OpenAI**
-```json
-{
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-..."
-}
-```
-
-**VolcEngine (Doubao)**
-```json
-{
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-..."
-}
-```
-
-**Zhipu AI (GLM)**
-```json
-{
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-key"
-}
-```
-
-**Anthropic (com OAuth)**
-```json
-{
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "auth_method": "oauth"
-}
-```
-> Execute `picoclaw auth login --provider anthropic` para configurar credenciais OAuth.
-
-**Proxy/API personalizada**
-```json
-{
- "model_name": "my-custom-model",
- "model": "openai/custom-model",
- "api_base": "https://my-proxy.com/v1",
- "api_key": "sk-...",
- "request_timeout": 300
-}
-```
-
-#### Balanceamento de Carga
-
-Configure vários endpoints para o mesmo nome de modelo—PicoClaw fará round-robin automaticamente entre eles:
-
-```json
-{
- "model_list": [
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_base": "https://api1.example.com/v1",
- "api_key": "sk-key1"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_base": "https://api2.example.com/v1",
- "api_key": "sk-key2"
- }
- ]
-}
-```
-
-#### Migração da Configuração Legada `providers`
-
-A configuração antiga `providers` está **descontinuada** mas ainda é suportada para compatibilidade reversa.
-
-**Configuração Antiga (descontinuada):**
-```json
-{
- "providers": {
- "zhipu": {
- "api_key": "your-key",
- "api_base": "https://open.bigmodel.cn/api/paas/v4"
- }
- },
- "agents": {
- "defaults": {
- "provider": "zhipu",
- "model": "glm-4.7"
- }
- }
-}
-```
-
-**Nova Configuração (recomendada):**
-```json
-{
- "model_list": [
- {
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-key"
- }
- ],
- "agents": {
- "defaults": {
- "model": "glm-4.7"
- }
- }
-}
-```
-
-Para o guia de migração detalhado, consulte [docs/migration/model-list-migration.md](docs/migration/model-list-migration.md).
-
-## Referência CLI
-
-| Comando | Descrição |
-| --- | --- |
-| `picoclaw onboard` | Inicializar configuração & workspace |
-| `picoclaw agent -m "..."` | Conversar com o agente |
-| `picoclaw agent` | Modo de chat interativo |
-| `picoclaw gateway` | Iniciar o gateway (para bots de chat) |
-| `picoclaw status` | Mostrar status |
-| `picoclaw cron list` | Listar todas as tarefas agendadas |
-| `picoclaw cron add ...` | Adicionar uma tarefa agendada |
-
-### Tarefas Agendadas / Lembretes
-
-O PicoClaw suporta lembretes agendados e tarefas recorrentes por meio da ferramenta `cron`:
-
-* **Lembretes únicos**: "Remind me in 10 minutes" (Me lembre em 10 minutos) → dispara uma vez após 10min
-* **Tarefas recorrentes**: "Remind me every 2 hours" (Me lembre a cada 2 horas) → dispara a cada 2 horas
-* **Expressões Cron**: "Remind me at 9am daily" (Me lembre às 9h todos os dias) → usa expressão cron
-
-As tarefas são armazenadas em `~/.picoclaw/workspace/cron/` e processadas automaticamente.
-
-## 🤝 Contribuir & Roadmap
-
-PRs são bem-vindos! O código-fonte é intencionalmente pequeno e legível. 🤗
-
-Roadmap em breve...
-
-Grupo de desenvolvedores em formação. Requisito de entrada: Pelo menos 1 PR com merge.
-
-Grupos de usuários:
-
-Discord:
-
-
-
-## 🐛 Solução de Problemas
-
-### Busca web mostra "API 配置问题"
-
-Isso é normal se você ainda não configurou uma API key de busca. O PicoClaw fornecerá links úteis para busca manual.
-
-Para habilitar a busca web:
-
-1. **Opção 1 (Recomendado)**: Obtenha uma API key gratuita em [https://brave.com/search/api](https://brave.com/search/api) (2000 consultas grátis/mês) para os melhores resultados.
-2. **Opção 2 (Sem Cartão de Crédito)**: Se você não tem uma key, o sistema automaticamente usa o **DuckDuckGo** como fallback (sem necessidade de key).
-
-Adicione a key em `~/.picoclaw/config.json` se usar o Brave:
-
-```json
-{
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "YOUR_BRAVE_API_KEY",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- }
- }
-}
-```
-
-### Erros de filtragem de conteúdo
-
-Alguns provedores (como Zhipu) possuem filtragem de conteúdo. Tente reformular sua pergunta ou use um modelo diferente.
-
-### Bot do Telegram diz "Conflict: terminated by other getUpdates"
-
-Isso acontece quando outra instância do bot está em execução. Certifique-se de que apenas um `picoclaw gateway` esteja rodando por vez.
-
----
-
-## 📝 Comparação de API Keys
-
-| Serviço | Plano Gratuito | Caso de Uso |
-| --- | --- | --- |
-| **OpenRouter** | 200K tokens/mês | Múltiplos modelos (Claude, GPT-4, etc.) |
-| **Volcengine CodingPlan** | ¥9,9/primeiro mês | Ideal para usuários chineses, múltiplos modelos SOTA (Doubao, DeepSeek, etc.) |
-| **Zhipu** | 200K tokens/mês | Adequado para usuários chineses |
-| **Brave Search** | 2000 consultas/mês | Funcionalidade de busca web |
-| **Groq** | Plano gratuito disponível | Inferência ultra-rápida (Llama, Mixtral) |
-| **Cerebras** | Plano gratuito disponível | Inferência ultra-rápida (Llama 3.3 70B) |
-
----
-
-
-

-
diff --git a/README.vi.md b/README.vi.md
deleted file mode 100644
index d691eadbe..000000000
--- a/README.vi.md
+++ /dev/null
@@ -1,1075 +0,0 @@
-
-

-
-
PicoClaw: Trợ lý AI Siêu Nhẹ viết bằng Go
-
-
Phần cứng $10 · RAM 10MB · Khởi động 1 giây · Nào, xuất phát!
-
-
-
-
-
-
-
-
-
-
-[中文](README.zh.md) | [日本語](README.ja.md) | [Português](README.pt-br.md) | **Tiếng Việt** | [Français](README.fr.md) | [English](README.md)
-
-
----
-
-🦐 **PicoClaw** là trợ lý AI cá nhân siêu nhẹ, lấy cảm hứng từ [nanobot](https://github.com/HKUDS/nanobot), được viết lại hoàn toàn bằng **Go** thông qua quá trình "tự khởi tạo" (self-bootstrapping) — nơi chính AI Agent đã tự dẫn dắt toàn bộ quá trình chuyển đổi kiến trúc và tối ưu hóa mã nguồn.
-
-⚡️ **Cực kỳ nhẹ:** Chạy trên phần cứng chỉ **$10** với RAM **<10MB**. Tiết kiệm 99% bộ nhớ so với OpenClaw và rẻ hơn 98% so với Mac mini!
-
-
-
-|
-
-
-
- |
-
-
-
-
- |
-
-
-
-> [!CAUTION]
-> **🚨 TUYÊN BỐ BẢO MẬT & KÊNH CHÍNH THỨC**
->
-> * **KHÔNG CÓ CRYPTO:** PicoClaw **KHÔNG** có bất kỳ token/coin chính thức nào. Mọi thông tin trên `pump.fun` hoặc các sàn giao dịch khác đều là **LỪA ĐẢO**.
-> * **DOMAIN CHÍNH THỨC:** Website chính thức **DUY NHẤT** là **[picoclaw.io](https://picoclaw.io)**, website công ty là **[sipeed.com](https://sipeed.com)**.
-> * **Cảnh báo:** Nhiều tên miền `.ai/.org/.com/.net/...` đã bị bên thứ ba đăng ký, không phải của chúng tôi.
-> * **Cảnh báo:** PicoClaw đang trong giai đoạn phát triển sớm và có thể còn các vấn đề bảo mật mạng chưa được giải quyết. Không nên triển khai lên môi trường production trước phiên bản v1.0.
-> * **Lưu ý:** PicoClaw gần đây đã merge nhiều PR, dẫn đến bộ nhớ sử dụng có thể lớn hơn (10–20MB) ở các phiên bản mới nhất. Chúng tôi sẽ ưu tiên tối ưu tài nguyên khi bộ tính năng đã ổn định.
-
-
-## 📢 Tin tức
-
-2026-02-16 🎉 PicoClaw đạt 12K stars chỉ trong một tuần! Cảm ơn tất cả mọi người! PicoClaw đang phát triển nhanh hơn chúng tôi tưởng tượng. Do số lượng PR tăng cao, chúng tôi cấp thiết cần maintainer từ cộng đồng. Các vai trò tình nguyện viên và roadmap đã được công bố [tại đây](docs/ROADMAP.md) — rất mong đón nhận sự tham gia của bạn!
-
-2026-02-13 🎉 PicoClaw đạt 5000 stars trong 4 ngày! Cảm ơn cộng đồng! Chúng tôi đang hoàn thiện **Lộ trình dự án (Roadmap)** và thiết lập **Nhóm phát triển** để đẩy nhanh tốc độ phát triển PicoClaw.
-🚀 **Kêu gọi hành động:** Vui lòng gửi yêu cầu tính năng tại GitHub Discussions. Chúng tôi sẽ xem xét và ưu tiên trong cuộc họp hàng tuần.
-
-2026-02-09 🎉 PicoClaw chính thức ra mắt! Được xây dựng trong 1 ngày để mang AI Agent đến phần cứng $10 với RAM <10MB. 🦐 PicoClaw, Lên Đường!
-
-## ✨ Tính năng nổi bật
-
-🪶 **Siêu nhẹ**: Bộ nhớ sử dụng <10MB — nhỏ hơn 99% so với Clawdbot (chức năng cốt lõi).
-
-💰 **Chi phí tối thiểu**: Đủ hiệu quả để chạy trên phần cứng $10 — rẻ hơn 98% so với Mac mini.
-
-⚡️ **Khởi động siêu nhanh**: Nhanh gấp 400 lần, khởi động trong 1 giây ngay cả trên CPU đơn nhân 0.6GHz.
-
-🌍 **Di động thực sự**: Một file binary duy nhất chạy trên RISC-V, ARM, MIPS và x86. Một click là chạy!
-
-🤖 **AI tự xây dựng**: Triển khai Go-native tự động — 95% mã nguồn cốt lõi được Agent tạo ra, với sự tinh chỉnh của con người.
-
-| | OpenClaw | NanoBot | **PicoClaw** |
-| ----------------------------- | ------------- | ------------------------ | ----------------------------------------- |
-| **Ngôn ngữ** | TypeScript | Python | **Go** |
-| **RAM** | >1GB | >100MB | **< 10MB** |
-| **Thời gian khởi động**(CPU 0.8GHz) | >500s | >30s | **<1s** |
-| **Chi phí** | Mac Mini $599 | Hầu hết SBC Linux ~$50 | **Mọi bo mạch Linux****Chỉ từ $10** |
-
-
-
-## 🦾 Demo
-
-### 🛠️ Quy trình trợ lý tiêu chuẩn
-
-
-
-🧩 Lập trình Full-Stack |
-🗂️ Quản lý Nhật ký & Kế hoạch |
-🔎 Tìm kiếm Web & Học hỏi |
-
-
-
|
-
|
-
|
-
-
-| Phát triển • Triển khai • Mở rộng |
-Lên lịch • Tự động hóa • Ghi nhớ |
-Khám phá • Phân tích • Xu hướng |
-
-
-
-### 🐜 Triển khai sáng tạo trên phần cứng tối thiểu
-
-PicoClaw có thể triển khai trên hầu hết mọi thiết bị Linux!
-
-* $9.9 [LicheeRV-Nano](https://www.aliexpress.com/item/1005006519668532.html) phiên bản E (Ethernet) hoặc W (WiFi6), dùng làm Trợ lý Gia đình tối giản.
-* $30~50 [NanoKVM](https://www.aliexpress.com/item/1005007369816019.html), hoặc $100 [NanoKVM-Pro](https://www.aliexpress.com/item/1005010048471263.html), dùng cho quản trị Server tự động.
-* $50 [MaixCAM](https://www.aliexpress.com/item/1005008053333693.html) hoặc $100 [MaixCAM2](https://www.kickstarter.com/projects/zepan/maixcam2-build-your-next-gen-4k-ai-camera), dùng cho Giám sát thông minh.
-
-https://private-user-images.githubusercontent.com/83055338/547056448-e7b031ff-d6f5-4468-bcca-5726b6fecb5c.mp4
-
-🌟 Nhiều hình thức triển khai hơn đang chờ bạn khám phá!
-
-## 📦 Cài đặt
-
-### Cài đặt bằng binary biên dịch sẵn
-
-Tải file binary cho nền tảng của bạn từ [trang Release](https://github.com/sipeed/picoclaw/releases).
-
-### Cài đặt từ mã nguồn (có tính năng mới nhất, khuyên dùng cho phát triển)
-
-```bash
-git clone https://github.com/sipeed/picoclaw.git
-
-cd picoclaw
-make deps
-
-# Build (không cần cài đặt)
-make build
-
-# Build cho nhiều nền tảng
-make build-all
-
-# Build và cài đặt
-make install
-```
-
-## 🐳 Docker Compose
-
-Bạn cũng có thể chạy PicoClaw bằng Docker Compose mà không cần cài đặt gì trên máy.
-
-```bash
-# 1. Clone repo
-git clone https://github.com/sipeed/picoclaw.git
-cd picoclaw
-
-# 2. Lần chạy đầu tiên — tự tạo docker/data/config.json rồi dừng lại
-docker compose -f docker/docker-compose.yml --profile gateway up
-# Container hiển thị "First-run setup complete." rồi tự dừng.
-
-# 3. Thiết lập API Key
-vim docker/data/config.json # API key của provider, bot token, v.v.
-
-# 4. Khởi động
-docker compose -f docker/docker-compose.yml --profile gateway up -d
-```
-
-> [!TIP]
-> **Người dùng Docker**: Theo mặc định, Gateway lắng nghe trên `127.0.0.1`, không thể truy cập từ máy chủ. Nếu bạn cần truy cập các endpoint kiểm tra sức khỏe hoặc mở cổng, hãy đặt `PICOCLAW_GATEWAY_HOST=0.0.0.0` trong môi trường của bạn hoặc cập nhật `config.json`.
-
-```bash
-# 5. Xem logs
-docker compose -f docker/docker-compose.yml logs -f picoclaw-gateway
-
-# 6. Dừng
-docker compose -f docker/docker-compose.yml --profile gateway down
-```
-
-### Chế độ Agent (chạy một lần)
-
-```bash
-# Đặt câu hỏi
-docker compose -f docker/docker-compose.yml run --rm picoclaw-agent -m "2+2 bằng mấy?"
-
-# Chế độ tương tác
-docker compose -f docker/docker-compose.yml run --rm picoclaw-agent
-```
-
-### Cập nhật
-
-```bash
-docker compose -f docker/docker-compose.yml pull
-docker compose -f docker/docker-compose.yml --profile gateway up -d
-```
-
-### 🚀 Bắt đầu nhanh
-
-> [!TIP]
-> Thiết lập API key trong `~/.picoclaw/config.json`. Lấy API key: [Volcengine (CodingPlan)](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) (LLM) · [OpenRouter](https://openrouter.ai/keys) (LLM) · [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) (LLM). Tìm kiếm web là **tùy chọn** — lấy [Tavily API](https://tavily.com) miễn phí (1000 truy vấn/tháng) hoặc [Brave Search API](https://brave.com/search/api) (2000 truy vấn/tháng).
-
-**1. Khởi tạo**
-
-```bash
-picoclaw onboard
-```
-
-**2. Cấu hình** (`~/.picoclaw/config.json`)
-
-```json
-{
- "model_list": [
- {
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-your-api-key"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-your-openai-key",
- "request_timeout": 300,
- "api_base": "https://api.openai.com/v1"
- }
- ],
- "agents": {
- "defaults": {
- "model_name": "gpt4"
- }
- },
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "YOUR_TELEGRAM_BOT_TOKEN",
- "allow_from": []
- }
- }
-}
-```
-
-> **Mới**: Định dạng cấu hình `model_list` cho phép thêm nhà cung cấp mà không cần thay đổi mã nguồn. Xem [Cấu hình Mô hình](#cấu-hình-mô-hình-model_list) để biết chi tiết.
-> `request_timeout` là tùy chọn và dùng đơn vị giây. Nếu bỏ qua hoặc đặt `<= 0`, PicoClaw sẽ dùng timeout mặc định (120s).
-
-**3. Lấy API Key**
-
-* **Nhà cung cấp LLM**: [OpenRouter](https://openrouter.ai/keys) · [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) · [Anthropic](https://console.anthropic.com) · [OpenAI](https://platform.openai.com) · [Gemini](https://aistudio.google.com/api-keys)
-* **Tìm kiếm Web** (tùy chọn): [Brave Search](https://brave.com/search/api) — Có gói miễn phí (2000 truy vấn/tháng)
-
-> **Lưu ý**: Xem `config.example.json` để có mẫu cấu hình đầy đủ.
-
-**4. Trò chuyện**
-
-```bash
-picoclaw agent -m "Xin chào, bạn là ai?"
-```
-
-Vậy là xong! Bạn đã có một trợ lý AI hoạt động chỉ trong 2 phút.
-
----
-
-## 💬 Tích hợp ứng dụng Chat
-
-Trò chuyện với PicoClaw qua Telegram, Discord, DingTalk, LINE hoặc WeCom.
-
-| Kênh | Mức độ thiết lập |
-| --- | --- |
-| **Telegram** | Dễ (chỉ cần token) |
-| **Discord** | Dễ (bot token + intents) |
-| **QQ** | Dễ (AppID + AppSecret) |
-| **DingTalk** | Trung bình (app credentials) |
-| **LINE** | Trung bình (credentials + webhook URL) |
-
-
-Telegram (Khuyên dùng)
-
-**1. Tạo bot**
-
-* Mở Telegram, tìm `@BotFather`
-* Gửi `/newbot`, làm theo hướng dẫn
-* Sao chép token
-
-**2. Cấu hình**
-
-```json
-{
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "YOUR_BOT_TOKEN",
- "allow_from": ["YOUR_USER_ID"]
- }
- }
-}
-```
-
-> Lấy User ID từ `@userinfobot` trên Telegram.
-
-**3. Chạy**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-Discord
-
-**1. Tạo bot**
-
-* Truy cập
-* Create an application → Bot → Add Bot
-* Sao chép bot token
-
-**2. Bật Intents**
-
-* Trong phần Bot settings, bật **MESSAGE CONTENT INTENT**
-* (Tùy chọn) Bật **SERVER MEMBERS INTENT** nếu muốn dùng danh sách cho phép theo thông tin thành viên
-
-**3. Lấy User ID**
-
-* Discord Settings → Advanced → bật **Developer Mode**
-* Click chuột phải vào avatar → **Copy User ID**
-
-**4. Cấu hình**
-
-```json
-{
- "channels": {
- "discord": {
- "enabled": true,
- "token": "YOUR_BOT_TOKEN",
- "allow_from": ["YOUR_USER_ID"]
- }
- }
-}
-```
-
-**5. Mời bot vào server**
-
-* OAuth2 → URL Generator
-* Scopes: `bot`
-* Bot Permissions: `Send Messages`, `Read Message History`
-* Mở URL mời được tạo và thêm bot vào server của bạn
-
-**6. Chạy**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-QQ
-
-**1. Tạo bot**
-
-* Truy cập [QQ Open Platform](https://q.qq.com/#)
-* Tạo ứng dụng → Lấy **AppID** và **AppSecret**
-
-**2. Cấu hình**
-
-```json
-{
- "channels": {
- "qq": {
- "enabled": true,
- "app_id": "YOUR_APP_ID",
- "app_secret": "YOUR_APP_SECRET",
- "allow_from": []
- }
- }
-}
-```
-
-> Để `allow_from` trống để cho phép tất cả người dùng, hoặc chỉ định số QQ để giới hạn quyền truy cập.
-
-**3. Chạy**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-DingTalk
-
-**1. Tạo bot**
-
-* Truy cập [Open Platform](https://open.dingtalk.com/)
-* Tạo ứng dụng nội bộ
-* Sao chép Client ID và Client Secret
-
-**2. Cấu hình**
-
-```json
-{
- "channels": {
- "dingtalk": {
- "enabled": true,
- "client_id": "YOUR_CLIENT_ID",
- "client_secret": "YOUR_CLIENT_SECRET",
- "allow_from": []
- }
- }
-}
-```
-
-> Để `allow_from` trống để cho phép tất cả người dùng, hoặc chỉ định ID để giới hạn quyền truy cập.
-
-**3. Chạy**
-
-```bash
-picoclaw gateway
-```
-
-
-
-
-LINE
-
-**1. Tạo tài khoản LINE Official**
-
-- Truy cập [LINE Developers Console](https://developers.line.biz/)
-- Tạo provider → Tạo Messaging API channel
-- Sao chép **Channel Secret** và **Channel Access Token**
-
-**2. Cấu hình**
-
-```json
-{
- "channels": {
- "line": {
- "enabled": true,
- "channel_secret": "YOUR_CHANNEL_SECRET",
- "channel_access_token": "YOUR_CHANNEL_ACCESS_TOKEN",
- "webhook_path": "/webhook/line",
- "allow_from": []
- }
- }
-}
-```
-
-**3. Thiết lập Webhook URL**
-
-LINE yêu cầu HTTPS cho webhook. Sử dụng reverse proxy hoặc tunnel:
-
-```bash
-# Ví dụ với ngrok
-ngrok http 18790
-```
-
-Sau đó cài đặt Webhook URL trong LINE Developers Console thành `https://your-domain/webhook/line` và bật **Use webhook**.
-
-**4. Chạy**
-
-```bash
-picoclaw gateway
-```
-
-> Trong nhóm chat, bot chỉ phản hồi khi được @mention. Các câu trả lời sẽ trích dẫn tin nhắn gốc.
-
-> **Docker Compose**: Nếu bạn cần mở port webhook cục bộ, hãy thêm một rule chuyển tiếp từ port Gateway (mặc định 18790) tới host. Lưu ý: LINE webhook được phục vụ bởi Gateway HTTP chung (mặc định 127.0.0.1:18790).
-
-
-
-
-##
Tham gia Mạng xã hội Agent
-
-Kết nối PicoClaw với Mạng xã hội Agent chỉ bằng cách gửi một tin nhắn qua CLI hoặc bất kỳ ứng dụng Chat nào đã tích hợp.
-
-**Đọc `https://clawdchat.ai/skill.md` và làm theo hướng dẫn để tham gia [ClawdChat.ai](https://clawdchat.ai)**
-
-## ⚙️ Cấu hình chi tiết
-
-File cấu hình: `~/.picoclaw/config.json`
-
-### Biến môi trường
-
-Bạn có thể ghi đè các đường dẫn mặc định bằng cách sử dụng các biến môi trường. Điều này hữu ích cho việc cài đặt di động, triển khai container hóa hoặc chạy picoclaw như một dịch vụ hệ thống. Các biến này độc lập và kiểm soát các đường dẫn khác nhau.
-
-| Biến | Mô tả | Đường dẫn mặc định |
-|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------|---------------------------|
-| `PICOCLAW_CONFIG` | Ghi đè đường dẫn đến file cấu hình. Điều này trực tiếp yêu cầu picoclaw tải file `config.json` nào, bỏ qua tất cả các vị trí khác. | `~/.picoclaw/config.json` |
-| `PICOCLAW_HOME` | Ghi đè thư mục gốc cho dữ liệu picoclaw. Điều này thay đổi vị trí mặc định của `workspace` và các thư mục dữ liệu khác. | `~/.picoclaw` |
-
-**Ví dụ:**
-
-```bash
-# Chạy picoclaw bằng một file cấu hình cụ thể
-# Đường dẫn workspace sẽ được đọc từ trong file cấu hình đó
-PICOCLAW_CONFIG=/etc/picoclaw/production.json picoclaw gateway
-
-# Chạy picoclaw với tất cả dữ liệu được lưu trữ trong /opt/picoclaw
-# Cấu hình sẽ được tải từ ~/.picoclaw/config.json mặc định
-# Workspace sẽ được tạo tại /opt/picoclaw/workspace
-PICOCLAW_HOME=/opt/picoclaw picoclaw agent
-
-# Sử dụng cả hai để có thiết lập tùy chỉnh hoàn toàn
-PICOCLAW_HOME=/srv/picoclaw PICOCLAW_CONFIG=/srv/picoclaw/main.json picoclaw gateway
-```
-
-### Cấu trúc Workspace
-
-PicoClaw lưu trữ dữ liệu trong workspace đã cấu hình (mặc định: `~/.picoclaw/workspace`):
-
-```
-~/.picoclaw/workspace/
-├── sessions/ # Phiên hội thoại và lịch sử
-├── memory/ # Bộ nhớ dài hạn (MEMORY.md)
-├── state/ # Trạng thái lưu trữ (kênh cuối cùng, v.v.)
-├── cron/ # Cơ sở dữ liệu tác vụ định kỳ
-├── skills/ # Kỹ năng tùy chỉnh
-├── AGENTS.md # Hướng dẫn hành vi Agent
-├── HEARTBEAT.md # Prompt tác vụ định kỳ (kiểm tra mỗi 30 phút)
-├── IDENTITY.md # Danh tính Agent
-├── SOUL.md # Tâm hồn/Tính cách Agent
-└── USER.md # Tùy chọn người dùng
-```
-
-### 🔒 Hộp cát bảo mật (Security Sandbox)
-
-PicoClaw chạy trong môi trường sandbox theo mặc định. Agent chỉ có thể truy cập file và thực thi lệnh trong phạm vi workspace.
-
-#### Cấu hình mặc định
-
-```json
-{
- "agents": {
- "defaults": {
- "workspace": "~/.picoclaw/workspace",
- "restrict_to_workspace": true
- }
- }
-}
-```
-
-| Tùy chọn | Mặc định | Mô tả |
-|----------|---------|-------|
-| `workspace` | `~/.picoclaw/workspace` | Thư mục làm việc của agent |
-| `restrict_to_workspace` | `true` | Giới hạn truy cập file/lệnh trong workspace |
-
-#### Công cụ được bảo vệ
-
-Khi `restrict_to_workspace: true`, các công cụ sau bị giới hạn trong sandbox:
-
-| Công cụ | Chức năng | Giới hạn |
-|---------|----------|---------|
-| `read_file` | Đọc file | Chỉ file trong workspace |
-| `write_file` | Ghi file | Chỉ file trong workspace |
-| `list_dir` | Liệt kê thư mục | Chỉ thư mục trong workspace |
-| `edit_file` | Sửa file | Chỉ file trong workspace |
-| `append_file` | Thêm vào file | Chỉ file trong workspace |
-| `exec` | Thực thi lệnh | Đường dẫn lệnh phải trong workspace |
-
-#### Bảo vệ bổ sung cho Exec
-
-Ngay cả khi `restrict_to_workspace: false`, công cụ `exec` vẫn chặn các lệnh nguy hiểm sau:
-
-* `rm -rf`, `del /f`, `rmdir /s` — Xóa hàng loạt
-* `format`, `mkfs`, `diskpart` — Định dạng ổ đĩa
-* `dd if=` — Tạo ảnh đĩa
-* Ghi vào `/dev/sd[a-z]` — Ghi trực tiếp lên đĩa
-* `shutdown`, `reboot`, `poweroff` — Tắt/khởi động lại hệ thống
-* Fork bomb `:(){ :|:& };:`
-
-#### Ví dụ lỗi
-
-```
-[ERROR] tool: Tool execution failed
-{tool=exec, error=Command blocked by safety guard (path outside working dir)}
-```
-
-```
-[ERROR] tool: Tool execution failed
-{tool=exec, error=Command blocked by safety guard (dangerous pattern detected)}
-```
-
-#### Tắt giới hạn (Rủi ro bảo mật)
-
-Nếu bạn cần agent truy cập đường dẫn ngoài workspace:
-
-**Cách 1: File cấu hình**
-
-```json
-{
- "agents": {
- "defaults": {
- "restrict_to_workspace": false
- }
- }
-}
-```
-
-**Cách 2: Biến môi trường**
-
-```bash
-export PICOCLAW_AGENTS_DEFAULTS_RESTRICT_TO_WORKSPACE=false
-```
-
-> ⚠️ **Cảnh báo**: Tắt giới hạn này cho phép agent truy cập mọi đường dẫn trên hệ thống. Chỉ sử dụng cẩn thận trong môi trường được kiểm soát.
-
-#### Tính nhất quán của ranh giới bảo mật
-
-Cài đặt `restrict_to_workspace` áp dụng nhất quán trên mọi đường thực thi:
-
-| Đường thực thi | Ranh giới bảo mật |
-|----------------|-------------------|
-| Agent chính | `restrict_to_workspace` ✅ |
-| Subagent / Spawn | Kế thừa cùng giới hạn ✅ |
-| Tác vụ Heartbeat | Kế thừa cùng giới hạn ✅ |
-
-Tất cả đường thực thi chia sẻ cùng giới hạn workspace — không có cách nào vượt qua ranh giới bảo mật thông qua subagent hoặc tác vụ định kỳ.
-
-### Heartbeat (Tác vụ định kỳ)
-
-PicoClaw có thể tự động thực hiện các tác vụ định kỳ. Tạo file `HEARTBEAT.md` trong workspace:
-
-```markdown
-# Tác vụ định kỳ
-
-- Kiểm tra email xem có tin nhắn quan trọng không
-- Xem lại lịch cho các sự kiện sắp tới
-- Kiểm tra dự báo thời tiết
-```
-
-Agent sẽ đọc file này mỗi 30 phút (có thể cấu hình) và thực hiện các tác vụ bằng công cụ có sẵn.
-
-#### Tác vụ bất đồng bộ với Spawn
-
-Đối với các tác vụ chạy lâu (tìm kiếm web, gọi API), sử dụng công cụ `spawn` để tạo **subagent**:
-
-```markdown
-# Tác vụ định kỳ
-
-## Tác vụ nhanh (trả lời trực tiếp)
-- Báo cáo thời gian hiện tại
-
-## Tác vụ lâu (dùng spawn cho async)
-- Tìm kiếm tin tức AI trên web và tóm tắt
-- Kiểm tra email và báo cáo tin nhắn quan trọng
-```
-
-**Hành vi chính:**
-
-| Tính năng | Mô tả |
-|-----------|-------|
-| **spawn** | Tạo subagent bất đồng bộ, không chặn heartbeat |
-| **Context độc lập** | Subagent có context riêng, không có lịch sử phiên |
-| **message tool** | Subagent giao tiếp trực tiếp với người dùng qua công cụ message |
-| **Không chặn** | Sau khi spawn, heartbeat tiếp tục tác vụ tiếp theo |
-
-#### Cách Subagent giao tiếp
-
-```
-Heartbeat kích hoạt
- ↓
-Agent đọc HEARTBEAT.md
- ↓
-Tác vụ lâu: spawn subagent
- ↓ ↓
-Tiếp tục tác vụ tiếp theo Subagent làm việc độc lập
- ↓ ↓
-Tất cả tác vụ hoàn thành Subagent dùng công cụ "message"
- ↓ ↓
-Phản hồi HEARTBEAT_OK Người dùng nhận kết quả trực tiếp
-```
-
-Subagent có quyền truy cập các công cụ (message, web_search, v.v.) và có thể giao tiếp với người dùng một cách độc lập mà không cần thông qua agent chính.
-
-**Cấu hình:**
-
-```json
-{
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-| Tùy chọn | Mặc định | Mô tả |
-|----------|---------|-------|
-| `enabled` | `true` | Bật/tắt heartbeat |
-| `interval` | `30` | Khoảng thời gian kiểm tra (phút, tối thiểu: 5) |
-
-**Biến môi trường:**
-
-* `PICOCLAW_HEARTBEAT_ENABLED=false` để tắt
-* `PICOCLAW_HEARTBEAT_INTERVAL=60` để thay đổi khoảng thời gian
-
-### Nhà cung cấp (Providers)
-
-> [!NOTE]
-> Groq cung cấp dịch vụ chuyển giọng nói thành văn bản miễn phí qua Whisper. Nếu đã cấu hình Groq, tin nhắn âm thanh từ bất kỳ kênh nào sẽ được tự động chuyển thành văn bản ở cấp độ agent.
-
-| Nhà cung cấp | Mục đích | Lấy API Key |
-| --- | --- | --- |
-| `gemini` | LLM (Gemini trực tiếp) | [aistudio.google.com](https://aistudio.google.com) |
-| `zhipu` | LLM (Zhipu trực tiếp) | [bigmodel.cn](bigmodel.cn) |
-| `volcengine` | LLM(Volcengine trực tiếp) | [volcengine.com](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) |
-| `openrouter` (Đang thử nghiệm) | LLM (khuyên dùng, truy cập mọi model) | [openrouter.ai](https://openrouter.ai) |
-| `anthropic` (Đang thử nghiệm) | LLM (Claude trực tiếp) | [console.anthropic.com](https://console.anthropic.com) |
-| `openai` (Đang thử nghiệm) | LLM (GPT trực tiếp) | [platform.openai.com](https://platform.openai.com) |
-| `deepseek` (Đang thử nghiệm) | LLM (DeepSeek trực tiếp) | [platform.deepseek.com](https://platform.deepseek.com) |
-| `groq` | LLM + **Chuyển giọng nói** (Whisper) | [console.groq.com](https://console.groq.com) |
-| `qwen` | LLM (Qwen trực tiếp) | [dashscope.console.aliyun.com](https://dashscope.console.aliyun.com) |
-| `cerebras` | LLM (Cerebras trực tiếp) | [cerebras.ai](https://cerebras.ai) |
-
-
-Cấu hình Zhipu
-
-**1. Lấy API key**
-
-* Lấy [API key](https://bigmodel.cn/usercenter/proj-mgmt/apikeys)
-
-**2. Cấu hình**
-
-```json
-{
- "agents": {
- "defaults": {
- "workspace": "~/.picoclaw/workspace",
- "model": "glm-4.7",
- "max_tokens": 8192,
- "temperature": 0.7,
- "max_tool_iterations": 20
- }
- },
- "providers": {
- "zhipu": {
- "api_key": "Your API Key",
- "api_base": "https://open.bigmodel.cn/api/paas/v4"
- }
- }
-}
-```
-
-**3. Chạy**
-
-```bash
-picoclaw agent -m "Xin chào"
-```
-
-
-
-
-Ví dụ cấu hình đầy đủ
-
-```json
-{
- "agents": {
- "defaults": {
- "model": "anthropic/claude-opus-4-5"
- }
- },
- "providers": {
- "openrouter": {
- "api_key": "sk-or-v1-xxx"
- },
- "groq": {
- "api_key": "gsk_xxx"
- }
- },
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "123456:ABC...",
- "allow_from": ["123456789"]
- },
- "discord": {
- "enabled": true,
- "token": "",
- "allow_from": [""]
- },
- "whatsapp": {
- "enabled": false
- },
- "qq": {
- "enabled": false,
- "app_id": "",
- "app_secret": "",
- "allow_from": []
- }
- },
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "BSA...",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- }
- },
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-
-
-### Cấu hình Mô hình (model_list)
-
-> **Tính năng mới!** PicoClaw hiện sử dụng phương pháp cấu hình **đặt mô hình vào trung tâm**. Chỉ cần chỉ định dạng `nhà cung cấp/mô hình` (ví dụ: `zhipu/glm-4.7`) để thêm nhà cung cấp mới—**không cần thay đổi mã!**
-
-Thiết kế này cũng cho phép **hỗ trợ đa tác nhân** với lựa chọn nhà cung cấp linh hoạt:
-
-- **Tác nhân khác nhau, nhà cung cấp khác nhau** : Mỗi tác nhân có thể sử dụng nhà cung cấp LLM riêng
-- **Mô hình dự phòng** : Cấu hình mô hình chính và dự phòng để tăng độ tin cậy
-- **Cân bằng tải** : Phân phối yêu cầu trên nhiều endpoint khác nhau
-- **Cấu hình tập trung** : Quản lý tất cả nhà cung cấp ở một nơi
-
-#### 📋 Tất cả Nhà cung cấp được Hỗ trợ
-
-| Nhà cung cấp | Prefix `model` | API Base Mặc định | Giao thức | Khóa API |
-|-------------|----------------|-------------------|-----------|----------|
-| **OpenAI** | `openai/` | `https://api.openai.com/v1` | OpenAI | [Lấy Khóa](https://platform.openai.com) |
-| **Anthropic** | `anthropic/` | `https://api.anthropic.com/v1` | Anthropic | [Lấy Khóa](https://console.anthropic.com) |
-| **Zhipu AI (GLM)** | `zhipu/` | `https://open.bigmodel.cn/api/paas/v4` | OpenAI | [Lấy Khóa](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) |
-| **DeepSeek** | `deepseek/` | `https://api.deepseek.com/v1` | OpenAI | [Lấy Khóa](https://platform.deepseek.com) |
-| **Google Gemini** | `gemini/` | `https://generativelanguage.googleapis.com/v1beta` | OpenAI | [Lấy Khóa](https://aistudio.google.com/api-keys) |
-| **Groq** | `groq/` | `https://api.groq.com/openai/v1` | OpenAI | [Lấy Khóa](https://console.groq.com) |
-| **Moonshot** | `moonshot/` | `https://api.moonshot.cn/v1` | OpenAI | [Lấy Khóa](https://platform.moonshot.cn) |
-| **Qwen (Alibaba)** | `qwen/` | `https://dashscope.aliyuncs.com/compatible-mode/v1` | OpenAI | [Lấy Khóa](https://dashscope.console.aliyun.com) |
-| **NVIDIA** | `nvidia/` | `https://integrate.api.nvidia.com/v1` | OpenAI | [Lấy Khóa](https://build.nvidia.com) |
-| **Ollama** | `ollama/` | `http://localhost:11434/v1` | OpenAI | Local (không cần khóa) |
-| **OpenRouter** | `openrouter/` | `https://openrouter.ai/api/v1` | OpenAI | [Lấy Khóa](https://openrouter.ai/keys) |
-| **VLLM** | `vllm/` | `http://localhost:8000/v1` | OpenAI | Local |
-| **Cerebras** | `cerebras/` | `https://api.cerebras.ai/v1` | OpenAI | [Lấy Khóa](https://cerebras.ai) |
-| **VolcEngine (Doubao)** | `volcengine/` | `https://ark.cn-beijing.volces.com/api/v3` | OpenAI | [Lấy Khóa](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) |
-| **ShengsuanYun** | `shengsuanyun/` | `https://router.shengsuanyun.com/api/v1` | OpenAI | - |
-| **BytePlus** | `byteplus/` | `https://ark.ap-southeast.bytepluses.com/api/v3` | OpenAI | [Lấy Khóa](https://www.byteplus.com) |
-| **LongCat** | `longcat/` | `https://api.longcat.chat/openai` | OpenAI | [Lấy Key](https://longcat.chat/platform) |
-| **Antigravity** | `antigravity/` | Google Cloud | Tùy chỉnh | Chỉ OAuth |
-| **GitHub Copilot** | `github-copilot/` | `localhost:4321` | gRPC | - |
-
-#### Cấu hình Cơ bản
-
-```json
-{
- "model_list": [
- {
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-your-api-key"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-your-openai-key"
- },
- {
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "api_key": "sk-ant-your-key"
- },
- {
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-zhipu-key"
- }
- ],
- "agents": {
- "defaults": {
- "model": "gpt-5.4"
- }
- }
-}
-```
-
-#### Ví dụ theo Nhà cung cấp
-
-**OpenAI**
-```json
-{
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-..."
-}
-```
-
-**VolcEngine (Doubao)**
-```json
-{
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-..."
-}
-```
-
-**Zhipu AI (GLM)**
-```json
-{
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-key"
-}
-```
-
-**Anthropic (với OAuth)**
-```json
-{
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "auth_method": "oauth"
-}
-```
-> Chạy `picoclaw auth login --provider anthropic` để thiết lập thông tin xác thực OAuth.
-
-**Proxy/API tùy chỉnh**
-```json
-{
- "model_name": "my-custom-model",
- "model": "openai/custom-model",
- "api_base": "https://my-proxy.com/v1",
- "api_key": "sk-...",
- "request_timeout": 300
-}
-```
-
-#### Cân bằng Tải tải
-
-Định cấu hình nhiều endpoint cho cùng một tên mô hình—PicoClaw sẽ tự động phân phối round-robin giữa chúng:
-
-```json
-{
- "model_list": [
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_base": "https://api1.example.com/v1",
- "api_key": "sk-key1"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_base": "https://api2.example.com/v1",
- "api_key": "sk-key2"
- }
- ]
-}
-```
-
-#### Chuyển đổi từ Cấu hình `providers` Cũ
-
-Cấu hình `providers` cũ đã **ngừng sử dụng** nhưng vẫn được hỗ trợ để tương thích ngược.
-
-**Cấu hình Cũ (đã ngừng sử dụng):**
-```json
-{
- "providers": {
- "zhipu": {
- "api_key": "your-key",
- "api_base": "https://open.bigmodel.cn/api/paas/v4"
- }
- },
- "agents": {
- "defaults": {
- "provider": "zhipu",
- "model": "glm-4.7"
- }
- }
-}
-```
-
-**Cấu hình Mới (khuyến nghị):**
-```json
-{
- "model_list": [
- {
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-key"
- }
- ],
- "agents": {
- "defaults": {
- "model": "glm-4.7"
- }
- }
-}
-```
-
-Xem hướng dẫn chuyển đổi chi tiết tại [docs/migration/model-list-migration.md](docs/migration/model-list-migration.md).
-
-## Tham chiếu CLI
-
-| Lệnh | Mô tả |
-| --- | --- |
-| `picoclaw onboard` | Khởi tạo cấu hình & workspace |
-| `picoclaw agent -m "..."` | Trò chuyện với agent |
-| `picoclaw agent` | Chế độ chat tương tác |
-| `picoclaw gateway` | Khởi động gateway (cho bot chat) |
-| `picoclaw status` | Hiển thị trạng thái |
-| `picoclaw cron list` | Liệt kê tất cả tác vụ định kỳ |
-| `picoclaw cron add ...` | Thêm tác vụ định kỳ |
-
-### Tác vụ định kỳ / Nhắc nhở
-
-PicoClaw hỗ trợ nhắc nhở theo lịch và tác vụ lặp lại thông qua công cụ `cron`:
-
-* **Nhắc nhở một lần**: "Remind me in 10 minutes" (Nhắc tôi sau 10 phút) → kích hoạt một lần sau 10 phút
-* **Tác vụ lặp lại**: "Remind me every 2 hours" (Nhắc tôi mỗi 2 giờ) → kích hoạt mỗi 2 giờ
-* **Biểu thức Cron**: "Remind me at 9am daily" (Nhắc tôi lúc 9 giờ sáng mỗi ngày) → sử dụng biểu thức cron
-
-Các tác vụ được lưu trong `~/.picoclaw/workspace/cron/` và được xử lý tự động.
-
-## 🤝 Đóng góp & Lộ trình
-
-Chào đón mọi PR! Mã nguồn được thiết kế nhỏ gọn và dễ đọc. 🤗
-
-Lộ trình sắp được công bố...
-
-Nhóm phát triển đang được xây dựng. Điều kiện tham gia: Ít nhất 1 PR đã được merge.
-
-Nhóm người dùng:
-
-Discord:
-
-
-
-## 🐛 Xử lý sự cố
-
-### Tìm kiếm web hiện "API 配置问题"
-
-Điều này là bình thường nếu bạn chưa cấu hình API key cho tìm kiếm. PicoClaw sẽ cung cấp các liên kết hữu ích để tìm kiếm thủ công.
-
-Để bật tìm kiếm web:
-
-1. **Tùy chọn 1 (Khuyên dùng)**: Lấy API key miễn phí tại [https://brave.com/search/api](https://brave.com/search/api) (2000 truy vấn miễn phí/tháng) để có kết quả tốt nhất.
-2. **Tùy chọn 2 (Không cần thẻ tín dụng)**: Nếu không có key, hệ thống tự động chuyển sang dùng **DuckDuckGo** (không cần key).
-
-Thêm key vào `~/.picoclaw/config.json` nếu dùng Brave:
-
-```json
-{
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "YOUR_BRAVE_API_KEY",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- }
- }
-}
-```
-
-### Gặp lỗi lọc nội dung (Content Filtering)
-
-Một số nhà cung cấp (như Zhipu) có bộ lọc nội dung nghiêm ngặt. Thử diễn đạt lại câu hỏi hoặc sử dụng model khác.
-
-### Telegram bot báo "Conflict: terminated by other getUpdates"
-
-Điều này xảy ra khi có một instance bot khác đang chạy. Đảm bảo chỉ có một tiến trình `picoclaw gateway` chạy tại một thời điểm.
-
----
-
-## 📝 So sánh API Key
-
-| Dịch vụ | Gói miễn phí | Trường hợp sử dụng |
-| --- | --- | --- |
-| **OpenRouter** | 200K tokens/tháng | Đa model (Claude, GPT-4, v.v.) |
-| **Volcengine CodingPlan** | ¥9.9/tháng đầu | Tốt nhất cho người dùng Trung Quốc, nhiều mô hình SOTA (Doubao, DeepSeek, v.v.) |
-| **Zhipu** | 200K tokens/tháng | Phù hợp cho người dùng Trung Quốc |
-| **Brave Search** | 2000 truy vấn/tháng | Chức năng tìm kiếm web |
-| **Groq** | Có gói miễn phí | Suy luận siêu nhanh (Llama, Mixtral) |
-
----
-
-
-

-
diff --git a/README.zh.md b/README.zh.md
deleted file mode 100644
index f6f75d358..000000000
--- a/README.zh.md
+++ /dev/null
@@ -1,899 +0,0 @@
-
-

-
-
PicoClaw: 基于Go语言的超高效 AI 助手
-
-
10$硬件 · 10MB内存 · 1秒启动 · 皮皮虾,我们走!
-
-
-
-
-
-
-
-
-
-
-**中文** | [日本語](README.ja.md) | [Português](README.pt-br.md) | [Tiếng Việt](README.vi.md) | [Français](README.fr.md) | [English](README.md)
-
-
-
----
-
-🦐 **PicoClaw** 是一个受 [nanobot](https://github.com/HKUDS/nanobot) 启发的超轻量级个人 AI 助手。它采用 **Go 语言** 从零重构,经历了一个“自举”过程——即由 AI Agent 自身驱动了整个架构迁移和代码优化。
-
-⚡️ **极致轻量**:可在 **10 美元** 的硬件上运行,内存占用 **<10MB**。这意味着比 OpenClaw 节省 99% 的内存,比 Mac mini 便宜 98%!
-
-
-
-|
-
-
-
- |
-
-
-
-
- |
-
-
-
-注意:人手有限,中文文档可能略有滞后,请优先查看英文文档。
-
-> [!CAUTION]
-> **🚨 SECURITY & OFFICIAL CHANNELS / 安全声明**
->
-> - **无加密货币 (NO CRYPTO):** PicoClaw **没有** 发行任何官方代币、Token 或虚拟货币。所有在 `pump.fun` 或其他交易平台上的相关声称均为 **诈骗**。
-> - **官方域名:** 唯一的官方网站是 **[picoclaw.io](https://picoclaw.io)**,公司官网是 **[sipeed.com](https://sipeed.com)**。
-> - **警惕:** 许多 `.ai/.org/.com/.net/...` 后缀的域名被第三方抢注,请勿轻信。
-> - **注意:** picoclaw正在初期的快速功能开发阶段,可能有尚未修复的网络安全问题,在1.0正式版发布前,请不要将其部署到生产环境中
-> - **注意:** picoclaw最近合并了大量PRs,近期版本可能内存占用较大(10~20MB),我们将在功能较为收敛后进行资源占用优化.
-
-## 📢 新闻 (News)
-
-2026-02-16 🎉 PicoClaw 在一周内突破了12K star! 感谢大家的关注!PicoClaw 的成长速度超乎我们预期. 由于PR数量的快速膨胀,我们亟需社区开发者参与维护. 我们需要的志愿者角色和roadmap已经发布到了[这里](docs/ROADMAP.md), 期待你的参与!
-
-2026-02-13 🎉 **PicoClaw 在 4 天内突破 5000 Stars!** 感谢社区的支持!由于正值中国春节假期,PR 和 Issue 涌入较多,我们正在利用这段时间敲定 **项目路线图 (Roadmap)** 并组建 **开发者群组**,以便加速 PicoClaw 的开发。
-🚀 **行动号召:** 请在 GitHub Discussions 中提交您的功能请求 (Feature Requests)。我们将在接下来的周会上进行审查和优先级排序。
-
-2026-02-09 🎉 **PicoClaw 正式发布!** 仅用 1 天构建,旨在将 AI Agent 带入 10 美元硬件与 <10MB 内存的世界。🦐 PicoClaw(皮皮虾),我们走!
-
-## ✨ 特性
-
-🪶 **超轻量级**: 核心功能内存占用 <10MB — 比 Clawdbot 小 99%。
-
-💰 **极低成本**: 高效到足以在 10 美元的硬件上运行 — 比 Mac mini 便宜 98%。
-
-⚡️ **闪电启动**: 启动速度快 400 倍,即使在 0.6GHz 单核处理器上也能在 1 秒内启动。
-
-🌍 **真正可移植**: 跨 RISC-V、ARM、MIPS 和 x86 架构的单二进制文件,一键运行!
-
-🤖 **AI 自举**: 纯 Go 语言原生实现 — 95% 的核心代码由 Agent 生成,并经由“人机回环 (Human-in-the-loop)”微调。
-
-| | OpenClaw | NanoBot | **PicoClaw** |
-| ------------------------------ | ------------- | ------------------------ | -------------------------------------- |
-| **语言** | TypeScript | Python | **Go** |
-| **RAM** | >1GB | >100MB | **< 10MB** |
-| **启动时间**(0.8GHz core) | >500s | >30s | **<1s** |
-| **成本** | Mac Mini $599 | 大多数 Linux 开发板 ~$50 | **任意 Linux 开发板****低至 $10** |
-
-
-
-## 🦾 演示
-
-### 🛠️ 标准助手工作流
-
-
-
-🧩 全栈工程师模式 |
-🗂️ 日志与规划管理 |
-🔎 网络搜索与学习 |
-
-
-
|
-
|
-
|
-
-
-| 开发 • 部署 • 扩展 |
-日程 • 自动化 • 记忆 |
-发现 • 洞察 • 趋势 |
-
-
-
-### 📱 在手机上轻松运行
-
-picoclaw 可以将你10年前的老旧手机废物利用,变身成为你的AI助理!快速指南:
-
-1. 先去应用商店下载安装Termux
-2. 打开后执行指令
-
-```bash
-# 注意: 下面的v0.1.1 可以换为你实际看到的最新版本
-wget https://github.com/sipeed/picoclaw/releases/download/v0.1.1/picoclaw-linux-arm64
-chmod +x picoclaw-linux-arm64
-pkg install proot
-termux-chroot ./picoclaw-linux-arm64 onboard
-```
-
-然后跟随下面的“快速开始”章节继续配置picoclaw即可使用!
-
-
-### 🐜 创新的低占用部署
-
-PicoClaw 几乎可以部署在任何 Linux 设备上!
-
-- $9.9 [LicheeRV-Nano](https://www.aliexpress.com/item/1005006519668532.html) E(网口) 或 W(WiFi6) 版本,用于极简家庭助手。
-- $30~50 [NanoKVM](https://www.aliexpress.com/item/1005007369816019.html),或 $100 [NanoKVM-Pro](https://www.aliexpress.com/item/1005010048471263.html),用于自动化服务器运维。
-- $50 [MaixCAM](https://www.aliexpress.com/item/1005008053333693.html) 或 $100 [MaixCAM2](https://www.kickstarter.com/projects/zepan/maixcam2-build-your-next-gen-4k-ai-camera),用于智能监控。
-
-[https://private-user-images.githubusercontent.com/83055338/547056448-e7b031ff-d6f5-4468-bcca-5726b6fecb5c.mp4](https://private-user-images.githubusercontent.com/83055338/547056448-e7b031ff-d6f5-4468-bcca-5726b6fecb5c.mp4)
-
-🌟 更多部署案例敬请期待!
-
-## 📦 安装
-
-### 使用预编译二进制文件安装
-
-从 [Release 页面](https://github.com/sipeed/picoclaw/releases) 下载适用于您平台的固件。
-
-### 从源码安装(获取最新特性,开发推荐)
-
-```bash
-git clone https://github.com/sipeed/picoclaw.git
-
-cd picoclaw
-make deps
-
-# 构建(无需安装)
-make build
-
-# 为多平台构建
-make build-all
-
-# 构建并安装
-make install
-
-```
-
-## 🐳 Docker Compose
-
-您也可以使用 Docker Compose 运行 PicoClaw,无需在本地安装任何环境。
-
-```bash
-# 1. 克隆仓库
-git clone https://github.com/sipeed/picoclaw.git
-cd picoclaw
-
-# 2. 首次运行 — 自动生成 docker/data/config.json 后退出
-docker compose -f docker/docker-compose.yml --profile gateway up
-# 容器打印 "First-run setup complete." 后自动停止
-
-# 3. 填写 API Key 等配置
-vim docker/data/config.json # 设置 provider API key、Bot Token 等
-
-# 4. 正式启动
-docker compose -f docker/docker-compose.yml --profile gateway up -d
-```
-
-> [!TIP]
-> **Docker 用户**: 默认情况下, Gateway 监听 `127.0.0.1`,该端口不会暴露到容器外。如果需要通过端口映射访问健康检查接口,请在环境变量中设置 `PICOCLAW_GATEWAY_HOST=0.0.0.0` 或修改 `config.json`。
-
-```bash
-# 5. 查看日志
-docker compose -f docker/docker-compose.yml logs -f picoclaw-gateway
-
-# 6. 停止
-docker compose -f docker/docker-compose.yml --profile gateway down
-```
-
-### Agent 模式 (一次性运行)
-
-```bash
-# 提问
-docker compose -f docker/docker-compose.yml run --rm picoclaw-agent -m "2+2 等于几?"
-
-# 交互模式
-docker compose -f docker/docker-compose.yml run --rm picoclaw-agent
-```
-
-### 更新镜像
-
-```bash
-docker compose -f docker/docker-compose.yml pull
-docker compose -f docker/docker-compose.yml --profile gateway up -d
-```
-
-### 🚀 快速开始
-
-> [!TIP]
-> 在 `~/.picoclaw/config.json` 中设置您的 API Key。获取 API Key: [火山引擎 (CodingPlan)](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) (LLM) · [OpenRouter](https://openrouter.ai/keys) (LLM) · [Zhipu (智谱)](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) (LLM)。网络搜索是 **可选的** — 获取免费的 [Tavily API](https://tavily.com) (每月 1000 次免费查询) 或 [Brave Search API](https://brave.com/search/api) (每月 2000 次免费查询)。
-
-**1. 初始化 (Initialize)**
-
-```bash
-picoclaw onboard
-
-```
-
-**2. 配置 (Configure)** (`~/.picoclaw/config.json`)
-
-```json
-{
- "agents": {
- "defaults": {
- "workspace": "~/.picoclaw/workspace",
- "model_name": "gpt-5.4",
- "max_tokens": 8192,
- "temperature": 0.7,
- "max_tool_iterations": 20
- }
- },
- "model_list": [
- {
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-your-api-key"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "your-api-key",
- "request_timeout": 300
- },
- {
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "api_key": "your-anthropic-key"
- }
- ],
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "YOUR_BRAVE_API_KEY",
- "max_results": 5
- },
- "tavily": {
- "enabled": false,
- "api_key": "YOUR_TAVILY_API_KEY",
- "max_results": 5
- }
- },
- "cron": {
- "exec_timeout_minutes": 5
- }
- }
-}
-```
-
-> **新功能**: `model_list` 配置格式支持零代码添加 provider。详见[模型配置](#模型配置-model_list)章节。
-> `request_timeout` 为可选项,单位为秒。若省略或设置为 `<= 0`,PicoClaw 使用默认超时(120 秒)。
-
-**3. 获取 API Key**
-
-* **LLM 提供商**: [OpenRouter](https://openrouter.ai/keys) · [Zhipu](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) · [Anthropic](https://console.anthropic.com) · [OpenAI](https://platform.openai.com) · [Gemini](https://aistudio.google.com/api-keys)
-* **网络搜索** (可选): [Tavily](https://tavily.com) - 专为 AI Agent 优化 (1000 请求/月) · [Brave Search](https://brave.com/search/api) - 提供免费层级 (2000 请求/月)
-
-> **注意**: 完整的配置模板请参考 `config.example.json`。
-
-**4. 对话 (Chat)**
-
-```bash
-picoclaw agent -m "2+2 等于几?"
-
-```
-
-就是这样!您在 2 分钟内就拥有了一个可工作的 AI 助手。
-
----
-
-## 💬 聊天应用集成 (Chat Apps)
-
-PicoClaw 支持多种聊天平台,使您的 Agent 能够连接到任何地方。
-
-> **注意**: 所有 Webhook 类渠道(LINE、WeCom 等)均挂载在同一个 Gateway HTTP 服务器上(`gateway.host`:`gateway.port`,默认 `127.0.0.1:18790`),无需为每个渠道单独配置端口。
-
-### 核心渠道
-
-| 渠道 | 设置难度 | 特性说明 | 文档链接 |
-| -------------------- | ----------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
-| **Telegram** | ⭐ 简单 | 推荐,支持语音转文字,长轮询无需公网 | [查看文档](docs/channels/telegram/README.zh.md) |
-| **Discord** | ⭐ 简单 | Socket Mode,支持群组/私信,Bot 生态成熟 | [查看文档](docs/channels/discord/README.zh.md) |
-| **Slack** | ⭐ 简单 | **Socket Mode** (无需公网 IP),企业级支持 | [查看文档](docs/channels/slack/README.zh.md) |
-| **Matrix** | ⭐⭐ 中等 | 联邦协议,支持自建 homeserver 与公开服务器 | [查看文档](docs/channels/matrix/README.zh.md) |
-| **QQ** | ⭐⭐ 中等 | 官方机器人 API,适合国内社群 | [查看文档](docs/channels/qq/README.zh.md) |
-| **钉钉 (DingTalk)** | ⭐⭐ 中等 | Stream 模式无需公网,企业办公首选 | [查看文档](docs/channels/dingtalk/README.zh.md) |
-| **Line** | ⭐⭐⭐ 较难 | 需要 HTTPS Webhook | [查看文档](docs/channels/line/README.zh.md) |
-| **OneBot** | ⭐⭐ 中等 | 兼容 NapCat/Go-CQHTTP,社区生态丰富 | [查看文档](docs/channels/onebot/README.zh.md) |
-| **MaixCam** | ⭐ 简单 | 专为 AI 摄像头设计的硬件集成通道 | [查看文档](docs/channels/maixcam/README.zh.md) |
-
-### Telegram 命令注册(启动时自动同步)
-
-PicoClaw 现在使用统一的命令定义来源。启动时会自动将 Telegram 支持的命令(例如 `/start`、`/help`、`/show`、`/list`)注册到 Bot 命令菜单,确保菜单展示与实际行为一致。
-Telegram 侧保留的是命令菜单注册能力;通用命令的实际执行统一走 Agent Loop 中的 commands executor。
-
-如果注册因网络或 API 短暂异常失败,不会阻塞 channel 启动;系统会在后台自动重试。
-
-##
加入 Agent 社交网络
-
-只需通过 CLI 或任何集成的聊天应用发送一条消息,即可将 PicoClaw 连接到 Agent 社交网络。
-
-\*\*阅读 `https://clawdchat.ai/skill.md` 并按照说明加入 [ClawdChat.ai](https://clawdchat.ai)
-
-## ⚙️ 配置详解
-
-配置文件路径: `~/.picoclaw/config.json`
-
-### 环境变量
-
-你可以使用环境变量覆盖默认路径。这对于便携安装、容器化部署或将 picoclaw 作为系统服务运行非常有用。这些变量是独立的,控制不同的路径。
-
-| 变量 | 描述 | 默认路径 |
-|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------|---------------------------|
-| `PICOCLAW_CONFIG` | 覆盖配置文件的路径。这直接告诉 picoclaw 加载哪个 `config.json`,忽略所有其他位置。 | `~/.picoclaw/config.json` |
-| `PICOCLAW_HOME` | 覆盖 picoclaw 数据根目录。这会更改 `workspace` 和其他数据目录的默认位置。 | `~/.picoclaw` |
-
-**示例:**
-
-```bash
-# 使用特定的配置文件运行 picoclaw
-# 工作区路径将从该配置文件中读取
-PICOCLAW_CONFIG=/etc/picoclaw/production.json picoclaw gateway
-
-# 在 /opt/picoclaw 中存储所有数据运行 picoclaw
-# 配置将从默认的 ~/.picoclaw/config.json 加载
-# 工作区将在 /opt/picoclaw/workspace 创建
-PICOCLAW_HOME=/opt/picoclaw picoclaw agent
-
-# 同时使用两者进行完全自定义设置
-PICOCLAW_HOME=/srv/picoclaw PICOCLAW_CONFIG=/srv/picoclaw/main.json picoclaw gateway
-```
-
-### 工作区布局 (Workspace Layout)
-
-PicoClaw 将数据存储在您配置的工作区中(默认:`~/.picoclaw/workspace`):
-
-```
-~/.picoclaw/workspace/
-├── sessions/ # 对话会话和历史
-├── memory/ # 长期记忆 (MEMORY.md)
-├── state/ # 持久化状态 (最后一次频道等)
-├── cron/ # 定时任务数据库
-├── skills/ # 自定义技能
-├── AGENTS.md # Agent 行为指南
-├── HEARTBEAT.md # 周期性任务提示词 (每 30 分钟检查一次)
-├── IDENTITY.md # Agent 身份设定
-├── SOUL.md # Agent 灵魂/性格
-└── USER.md # 用户偏好
-
-```
-
-### 技能来源 (Skill Sources)
-
-默认情况下,技能会按以下顺序加载:
-
-1. `~/.picoclaw/workspace/skills`(工作区)
-2. `~/.picoclaw/skills`(全局)
-3. `/skills`(内置)
-
-在高级/测试场景下,可通过以下环境变量覆盖内置技能目录:
-
-```bash
-export PICOCLAW_BUILTIN_SKILLS=/path/to/skills
-```
-
-### 统一命令执行策略
-
-- 通用斜杠命令通过 `pkg/agent/loop.go` 中的 `commands.Executor` 统一执行。
-- Channel 适配器不再在本地消费通用命令;它们只负责把入站文本转发到 bus/agent 路径。Telegram 仍会在启动时自动注册其支持的命令菜单。
-- 未注册的斜杠命令(例如 `/foo`)会透传给 LLM 按普通输入处理。
-- 已注册但当前 channel 不支持的命令(例如 WhatsApp 上的 `/show`)会返回明确的用户可见错误,并停止后续处理。
-### 心跳 / 周期性任务 (Heartbeat)
-
-PicoClaw 可以自动执行周期性任务。在工作区创建 `HEARTBEAT.md` 文件:
-
-```markdown
-# Periodic Tasks
-
-- Check my email for important messages
-- Review my calendar for upcoming events
-- Check the weather forecast
-```
-
-Agent 将每隔 30 分钟(可配置)读取此文件,并使用可用工具执行任务。
-
-#### 使用 Spawn 的异步任务
-
-对于耗时较长的任务(网络搜索、API 调用),使用 `spawn` 工具创建一个 **子 Agent (subagent)**:
-
-```markdown
-# Periodic Tasks
-
-## Quick Tasks (respond directly)
-
-- Report current time
-
-## Long Tasks (use spawn for async)
-
-- Search the web for AI news and summarize
-- Check email and report important messages
-```
-
-**关键行为:**
-
-| 特性 | 描述 |
-| ---------------- | ---------------------------------------- |
-| **spawn** | 创建异步子 Agent,不阻塞主心跳进程 |
-| **独立上下文** | 子 Agent 拥有独立上下文,无会话历史 |
-| **message tool** | 子 Agent 通过 message 工具直接与用户通信 |
-| **非阻塞** | spawn 后,心跳继续处理下一个任务 |
-
-#### 子 Agent 通信原理
-
-```
-心跳触发 (Heartbeat triggers)
- ↓
-Agent 读取 HEARTBEAT.md
- ↓
-对于长任务: spawn 子 Agent
- ↓ ↓
-继续下一个任务 子 Agent 独立工作
- ↓ ↓
-所有任务完成 子 Agent 使用 "message" 工具
- ↓ ↓
-响应 HEARTBEAT_OK 用户直接收到结果
-
-```
-
-子 Agent 可以访问工具(message, web_search 等),并且无需通过主 Agent 即可独立与用户通信。
-
-**配置:**
-
-```json
-{
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-| 选项 | 默认值 | 描述 |
-| ---------- | ------ | ---------------------------- |
-| `enabled` | `true` | 启用/禁用心跳 |
-| `interval` | `30` | 检查间隔,单位分钟 (最小: 5) |
-
-**环境变量:**
-
-- `PICOCLAW_HEARTBEAT_ENABLED=false` 禁用
-- `PICOCLAW_HEARTBEAT_INTERVAL=60` 更改间隔
-
-### 提供商 (Providers)
-
-> [!NOTE]
-> Groq 通过 Whisper 提供免费的语音转录。如果配置了 Groq,任意渠道的音频消息都将在 Agent 层面自动转录为文字。
-
-| 提供商 | 用途 | 获取 API Key |
-| -------------------- | ---------------------------- | -------------------------------------------------------------------- |
-| `gemini` | LLM (Gemini 直连) | [aistudio.google.com](https://aistudio.google.com) |
-| `zhipu` | LLM (智谱直连) | [bigmodel.cn](bigmodel.cn) |
-| `volcengine` | LLM (火山引擎直连) | [volcengine.com](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) |
-| `openrouter` | LLM (推荐,可访问所有模型) | [openrouter.ai](https://openrouter.ai) |
-| `anthropic` | LLM (Claude 直连) | [console.anthropic.com](https://console.anthropic.com) |
-| `openai` | LLM (GPT 直连) | [platform.openai.com](https://platform.openai.com) |
-| `deepseek` | LLM (DeepSeek 直连) | [platform.deepseek.com](https://platform.deepseek.com) |
-| `qwen` | LLM (通义千问) | [dashscope.console.aliyun.com](https://dashscope.console.aliyun.com) |
-| `groq` | LLM + **语音转录** (Whisper) | [console.groq.com](https://console.groq.com) |
-| `cerebras` | LLM (Cerebras 直连) | [cerebras.ai](https://cerebras.ai) |
-
-### 模型配置 (model_list)
-
-> **新功能!** PicoClaw 现在采用**以模型为中心**的配置方式。只需使用 `厂商/模型` 格式(如 `zhipu/glm-4.7`)即可添加新的 provider——**无需修改任何代码!**
-
-该设计同时支持**多 Agent 场景**,提供灵活的 Provider 选择:
-
-- **不同 Agent 使用不同 Provider**:每个 Agent 可以使用自己的 LLM provider
-- **模型回退(Fallback)**:配置主模型和备用模型,提高可靠性
-- **负载均衡**:在多个 API 端点之间分配请求
-- **集中化配置**:在一个地方管理所有 provider
-
-#### 📋 所有支持的厂商
-
-| 厂商 | `model` 前缀 | 默认 API Base | 协议 | 获取 API Key |
-| ------------------- | ----------------- | --------------------------------------------------- | --------- | ----------------------------------------------------------------- |
-| **OpenAI** | `openai/` | `https://api.openai.com/v1` | OpenAI | [获取密钥](https://platform.openai.com) |
-| **Anthropic** | `anthropic/` | `https://api.anthropic.com/v1` | Anthropic | [获取密钥](https://console.anthropic.com) |
-| **智谱 AI (GLM)** | `zhipu/` | `https://open.bigmodel.cn/api/paas/v4` | OpenAI | [获取密钥](https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys) |
-| **DeepSeek** | `deepseek/` | `https://api.deepseek.com/v1` | OpenAI | [获取密钥](https://platform.deepseek.com) |
-| **Google Gemini** | `gemini/` | `https://generativelanguage.googleapis.com/v1beta` | OpenAI | [获取密钥](https://aistudio.google.com/api-keys) |
-| **Groq** | `groq/` | `https://api.groq.com/openai/v1` | OpenAI | [获取密钥](https://console.groq.com) |
-| **Moonshot** | `moonshot/` | `https://api.moonshot.cn/v1` | OpenAI | [获取密钥](https://platform.moonshot.cn) |
-| **通义千问 (Qwen)** | `qwen/` | `https://dashscope.aliyuncs.com/compatible-mode/v1` | OpenAI | [获取密钥](https://dashscope.console.aliyun.com) |
-| **NVIDIA** | `nvidia/` | `https://integrate.api.nvidia.com/v1` | OpenAI | [获取密钥](https://build.nvidia.com) |
-| **Ollama** | `ollama/` | `http://localhost:11434/v1` | OpenAI | 本地(无需密钥) |
-| **OpenRouter** | `openrouter/` | `https://openrouter.ai/api/v1` | OpenAI | [获取密钥](https://openrouter.ai/keys) |
-| **VLLM** | `vllm/` | `http://localhost:8000/v1` | OpenAI | 本地 |
-| **Cerebras** | `cerebras/` | `https://api.cerebras.ai/v1` | OpenAI | [获取密钥](https://cerebras.ai) |
-| **火山引擎(Doubao)** | `volcengine/` | `https://ark.cn-beijing.volces.com/api/v3` | OpenAI | [获取密钥](https://www.volcengine.com/activity/codingplan?utm_campaign=PicoClaw&utm_content=PicoClaw&utm_medium=devrel&utm_source=OWO&utm_term=PicoClaw) |
-| **神算云** | `shengsuanyun/` | `https://router.shengsuanyun.com/api/v1` | OpenAI | - |
-| **BytePlus** | `byteplus/` | `https://ark.ap-southeast.bytepluses.com/api/v3` | OpenAI | [获取密钥](https://www.byteplus.com) |
-| **LongCat** | `longcat/` | `https://api.longcat.chat/openai` | OpenAI | [获取密钥](https://longcat.chat/platform) |
-| **Antigravity** | `antigravity/` | Google Cloud | 自定义 | 仅 OAuth |
-| **GitHub Copilot** | `github-copilot/` | `localhost:4321` | gRPC | - |
-
-#### 基础配置示例
-
-```json
-{
- "model_list": [
- {
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-your-api-key"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-your-openai-key"
- },
- {
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "api_key": "sk-ant-your-key"
- },
- {
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-zhipu-key"
- }
- ],
- "agents": {
- "defaults": {
- "model": "gpt-5.4"
- }
- }
-}
-```
-
-#### 各厂商配置示例
-
-**OpenAI**
-
-```json
-{
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_key": "sk-..."
-}
-```
-
-**火山引擎(Doubao)**
-
-```json
-{
- "model_name": "ark-code-latest",
- "model": "volcengine/ark-code-latest",
- "api_key": "sk-..."
-}
-```
-
-**智谱 AI (GLM)**
-
-```json
-{
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-key"
-}
-```
-
-**DeepSeek**
-
-```json
-{
- "model_name": "deepseek-chat",
- "model": "deepseek/deepseek-chat",
- "api_key": "sk-..."
-}
-```
-
-**Anthropic (使用 OAuth)**
-
-```json
-{
- "model_name": "claude-sonnet-4.6",
- "model": "anthropic/claude-sonnet-4.6",
- "auth_method": "oauth"
-}
-```
-
-> 运行 `picoclaw auth login --provider anthropic` 来设置 OAuth 凭证。
-
-**Ollama (本地)**
-
-```json
-{
- "model_name": "llama3",
- "model": "ollama/llama3"
-}
-```
-
-**自定义代理/API**
-
-```json
-{
- "model_name": "my-custom-model",
- "model": "openai/custom-model",
- "api_base": "https://my-proxy.com/v1",
- "api_key": "sk-...",
- "request_timeout": 300
-}
-```
-
-#### 负载均衡
-
-为同一个模型名称配置多个端点——PicoClaw 会自动在它们之间轮询:
-
-```json
-{
- "model_list": [
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_base": "https://api1.example.com/v1",
- "api_key": "sk-key1"
- },
- {
- "model_name": "gpt-5.4",
- "model": "openai/gpt-5.4",
- "api_base": "https://api2.example.com/v1",
- "api_key": "sk-key2"
- }
- ]
-}
-```
-
-#### 从旧的 `providers` 配置迁移
-
-旧的 `providers` 配置格式**已弃用**,但为向后兼容仍支持。
-
-**旧配置(已弃用):**
-
-```json
-{
- "providers": {
- "zhipu": {
- "api_key": "your-key",
- "api_base": "https://open.bigmodel.cn/api/paas/v4"
- }
- },
- "agents": {
- "defaults": {
- "provider": "zhipu",
- "model": "glm-4.7"
- }
- }
-}
-```
-
-**新配置(推荐):**
-
-```json
-{
- "model_list": [
- {
- "model_name": "glm-4.7",
- "model": "zhipu/glm-4.7",
- "api_key": "your-key"
- }
- ],
- "agents": {
- "defaults": {
- "model": "glm-4.7"
- }
- }
-}
-```
-
-详细的迁移指南请参考 [docs/migration/model-list-migration.md](docs/migration/model-list-migration.md)。
-
-
-智谱 (Zhipu) 配置示例
-
-**1. 获取 API key 和 base URL**
-
-- 获取 [API key](https://bigmodel.cn/usercenter/proj-mgmt/apikeys)
-
-**2. 配置**
-
-```json
-{
- "agents": {
- "defaults": {
- "workspace": "~/.picoclaw/workspace",
- "model": "glm-4.7",
- "max_tokens": 8192,
- "temperature": 0.7,
- "max_tool_iterations": 20
- }
- },
- "providers": {
- "zhipu": {
- "api_key": "Your API Key",
- "api_base": "https://open.bigmodel.cn/api/paas/v4"
- }
- }
-}
-```
-
-**3. 运行**
-
-```bash
-picoclaw agent -m "你好"
-
-```
-
-
-
-
-完整配置示例
-
-```json
-{
- "agents": {
- "defaults": {
- "model": "anthropic/claude-opus-4-5"
- }
- },
- "session": {
- "dm_scope": "per-channel-peer",
- "backlog_limit": 20
- },
- "providers": {
- "openrouter": {
- "api_key": "sk-or-v1-xxx"
- },
- "groq": {
- "api_key": "gsk_xxx"
- }
- },
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "123456:ABC...",
- "allow_from": ["123456789"]
- },
- "discord": {
- "enabled": true,
- "token": "",
- "allow_from": [""]
- },
- "whatsapp": {
- "enabled": false
- },
- "qq": {
- "enabled": false,
- "app_id": "",
- "app_secret": "",
- "allow_from": []
- }
- },
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "YOUR_BRAVE_API_KEY",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- },
- "cron": {
- "exec_timeout_minutes": 5
- }
- },
- "heartbeat": {
- "enabled": true,
- "interval": 30
- }
-}
-```
-
-
-
-## CLI 命令行参考
-
-| 命令 | 描述 |
-| ------------------------- | ------------------ |
-| `picoclaw onboard` | 初始化配置和工作区 |
-| `picoclaw agent -m "..."` | 与 Agent 对话 |
-| `picoclaw agent` | 交互式聊天模式 |
-| `picoclaw gateway` | 启动网关 (Gateway) |
-| `picoclaw status` | 显示状态 |
-| `picoclaw cron list` | 列出所有定时任务 |
-| `picoclaw cron add ...` | 添加定时任务 |
-
-### 定时任务 / 提醒 (Scheduled Tasks)
-
-PicoClaw 通过 `cron` 工具支持定时提醒和重复任务:
-
-- **一次性提醒**: "Remind me in 10 minutes" (10分钟后提醒我) → 10分钟后触发一次
-- **重复任务**: "Remind me every 2 hours" (每2小时提醒我) → 每2小时触发
-- **Cron 表达式**: "Remind me at 9am daily" (每天上午9点提醒我) → 使用 cron 表达式
-
-任务存储在 `~/.picoclaw/workspace/cron/` 中并自动处理。
-
-## 🤝 贡献与路线图 (Roadmap)
-
-欢迎提交 PR!代码库刻意保持小巧和可读。🤗
-
-路线图即将发布...
-
-开发者群组正在组建中,入群门槛:至少合并过 1 个 PR。
-
-用户群组:
-
-Discord: [https://discord.gg/V4sAZ9XWpN](https://discord.gg/V4sAZ9XWpN)
-
-
-
-## 🐛 疑难解答 (Troubleshooting)
-
-### 网络搜索提示 "API 配置问题"
-
-如果您尚未配置搜索 API Key,这是正常的。PicoClaw 会提供手动搜索的帮助链接。
-
-启用网络搜索:
-
-1. 在 [https://tavily.com](https://tavily.com) (1000 次免费) 或 [https://brave.com/search/api](https://brave.com/search/api) 获取免费 API Key (2000 次免费)
-2. 添加到 `~/.picoclaw/config.json`:
-
-```json
-{
- "tools": {
- "web": {
- "brave": {
- "enabled": false,
- "api_key": "YOUR_BRAVE_API_KEY",
- "max_results": 5
- },
- "duckduckgo": {
- "enabled": true,
- "max_results": 5
- }
- }
- }
-}
-```
-
-### 遇到内容过滤错误 (Content Filtering Errors)
-
-某些提供商(如智谱)有严格的内容过滤。尝试改写您的问题或使用其他模型。
-
-### Telegram bot 提示 "Conflict: terminated by other getUpdates"
-
-这表示有另一个机器人实例正在运行。请确保同一时间只有一个 `picoclaw gateway` 进程在运行。
-
----
-
-## 📝 API Key 对比
-
-| 服务 | 免费层级 | 适用场景 |
-| --- | --- | --- |
-| **OpenRouter** | 200K tokens/月 | 多模型聚合 (Claude, GPT-4 等) |
-| **火山引擎 CodingPlan** | 9.9 元/首月 | 最适合国内用户,多种 SOTA 模型(豆包、DeepSeek 等) |
-| **智谱 (Zhipu)** | 200K tokens/月 | 适合中国用户 |
-| **Brave Search** | 2000 次查询/月 | 网络搜索功能 |
-| **Tavily** | 1000 次查询/月 | AI Agent 搜索优化 |
-| **Groq** | 提供免费层级 | 极速推理 (Llama, Mixtral) |
-| **LongCat** | 最多 5M tokens/天 | 推理速度快 (免费额度) |
-
----
-
-
-

-
diff --git a/docs/channels/dingtalk/README.md b/docs/channels/dingtalk/README.md
new file mode 100644
index 000000000..efbedd908
--- /dev/null
+++ b/docs/channels/dingtalk/README.md
@@ -0,0 +1,33 @@
+# DingTalk
+
+DingTalk is an enterprise communication platform by Alibaba, widely popular in Chinese workplaces. It uses a streaming SDK to maintain persistent connections.
+
+## Configuration
+
+```json
+{
+ "channels": {
+ "dingtalk": {
+ "enabled": true,
+ "client_id": "YOUR_CLIENT_ID",
+ "client_secret": "YOUR_CLIENT_SECRET",
+ "allow_from": []
+ }
+ }
+}
+```
+
+| Field | Type | Required | Description |
+| ------------- | ------ | -------- | ----------------------------------------- |
+| enabled | bool | Yes | Whether to enable the DingTalk channel |
+| client_id | string | Yes | Client ID of the DingTalk application |
+| client_secret | string | Yes | Client Secret of the DingTalk application |
+| allow_from | array | No | User ID allowlist, empty means allow all |
+
+## Setup Process
+
+1. Go to the [DingTalk Open Platform](https://open.dingtalk.com/)
+2. Create an internal enterprise application
+3. Obtain the Client ID and Client Secret from the application settings
+4. Configure OAuth and event subscriptions (if needed)
+5. Fill in the Client ID and Client Secret in the configuration file
diff --git a/docs/channels/dingtalk/README.zh.md b/docs/channels/dingtalk/README.zh.md
deleted file mode 100644
index 1e445d0b0..000000000
--- a/docs/channels/dingtalk/README.zh.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# 钉钉
-
-钉钉是阿里巴巴的企业通讯平台,在中国职场中广受欢迎。它采用流式 SDK 来维持持久连接。
-
-## 配置
-
-```json
-{
- "channels": {
- "dingtalk": {
- "enabled": true,
- "client_id": "YOUR_CLIENT_ID",
- "client_secret": "YOUR_CLIENT_SECRET",
- "allow_from": []
- }
- }
-}
-```
-
-| 字段 | 类型 | 必填 | 描述 |
-| ------------- | ------ | ---- | -------------------------------- |
-| enabled | bool | 是 | 是否启用钉钉频道 |
-| client_id | string | 是 | 钉钉应用的 Client ID |
-| client_secret | string | 是 | 钉钉应用的 Client Secret |
-| allow_from | array | 否 | 用户ID白名单,空表示允许所有用户 |
-
-## 设置流程
-
-1. 前往 [钉钉开放平台](https://open.dingtalk.com/)
-2. 创建一个企业内部应用
-3. 从应用设置中获取 Client ID 和 Client Secret
-4. 配置OAuth和事件订阅(如需要)
-5. 将 Client ID 和 Client Secret 填入配置文件中
diff --git a/docs/channels/discord/README.md b/docs/channels/discord/README.md
new file mode 100644
index 000000000..4b089f078
--- /dev/null
+++ b/docs/channels/discord/README.md
@@ -0,0 +1,37 @@
+# Discord
+
+Discord is a free voice, video, and text chat application designed for communities. PicoClaw connects to Discord servers via the Discord Bot API, supporting both receiving and sending messages.
+
+## Configuration
+
+```json
+{
+ "channels": {
+ "discord": {
+ "enabled": true,
+ "token": "YOUR_BOT_TOKEN",
+ "allow_from": ["YOUR_USER_ID"],
+ "group_trigger": {
+ "mention_only": false
+ }
+ }
+ }
+}
+```
+
+| Field | Type | Required | Description |
+| ------------- | ------ | -------- | ----------------------------------------------- |
+| enabled | bool | Yes | Whether to enable the Discord channel |
+| token | string | Yes | Discord Bot Token |
+| allow_from | array | No | User ID allowlist, empty means allow all |
+| group_trigger | object | No | Group trigger settings (e.g., { "mention_only": false }) |
+
+## Setup Process
+
+1. Go to the [Discord Developer Portal](https://discord.com/developers/applications) and create a new application.
+2. Enable Intents:
+ - Message Content Intent
+ - Server Members Intent
+3. Obtain the Bot Token.
+4. Fill in the Bot Token in the configuration file.
+5. Invite the bot to your server and grant necessary permissions (e.g., Send Messages, Read Message History).
diff --git a/docs/channels/discord/README.zh.md b/docs/channels/discord/README.zh.md
deleted file mode 100644
index 6d3c502cf..000000000
--- a/docs/channels/discord/README.zh.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Discord
-
-Discord 是一个专为社区设计的免费语音、视频和文本聊天应用。PicoClaw 通过 Discord Bot API 连接到 Discord 服务器,支持接收和发送消息。
-
-## 配置
-
-```json
-{
- "channels": {
- "discord": {
- "enabled": true,
- "token": "YOUR_BOT_TOKEN",
- "allow_from": ["YOUR_USER_ID"],
- "group_trigger": {
- "mention_only": false
- }
- }
- }
-}
-```
-
-| 字段 | 类型 | 必填 | 描述 |
-| ------------ | ------ | ---- | -------------------------------- |
-| enabled | bool | 是 | 是否启用 Discord 频道 |
-| token | string | 是 | Discord 机器人 Token |
-| allow_from | array | 否 | 用户ID白名单,空表示允许所有用户 |
-| group_trigger | object | 否 | 群组触发设置(示例: { "mention_only": false }) |
-
-## 设置流程
-
-1. 前往 [Discord 开发者门户](https://discord.com/developers/applications) 创建一个新的应用
-2. 启用 Intents:
- - Message Content Intent
- - Server Members Intent
-3. 获取 Bot Token
-4. 将 Bot Token 填入配置文件中
-5. 邀请机器人加入服务器并授予必要权限(例如发送消息、读取消息历史等)
diff --git a/docs/channels/line/README.md b/docs/channels/line/README.md
new file mode 100644
index 000000000..6ac29906b
--- /dev/null
+++ b/docs/channels/line/README.md
@@ -0,0 +1,38 @@
+# LINE
+
+PicoClaw supports LINE through the LINE Messaging API and Webhook callbacks.
+
+## Configuration
+
+```json
+{
+ "channels": {
+ "line": {
+ "enabled": true,
+ "channel_secret": "YOUR_CHANNEL_SECRET",
+ "channel_access_token": "YOUR_CHANNEL_ACCESS_TOKEN",
+ "webhook_path": "/webhook/line",
+ "allow_from": []
+ }
+ }
+}
+```
+
+| Field | Type | Required | Description |
+| -------------------- | ------ | -------- | ------------------------------------------ |
+| enabled | bool | Yes | Whether to enable the LINE channel |
+| channel_secret | string | Yes | Channel Secret for LINE Messaging API |
+| channel_access_token | string | Yes | Channel Access Token for LINE Messaging API|
+| webhook_path | string | No | Webhook path (default: /webhook/line) |
+| allow_from | array | No | User ID allowlist, empty means allow all |
+
+## Setup Process
+
+1. Go to the [LINE Developers Console](https://developers.line.biz/console/) and create a provider and a Messaging API Channel.
+2. Obtain the Channel Secret and Channel Access Token.
+3. Configure Webhook:
+ - LINE requires Webhooks to use the HTTPS protocol. You will need to deploy an HTTPS-enabled server or use a reverse proxy tool like ngrok to expose your local server to the public internet.
+ - PicoClaw now uses a shared Gateway HTTP server to receive webhook callbacks for all channels, listening by default at 127.0.0.1:18790.
+ - Set the Webhook URL to `https://your-domain.com/webhook/line`, and then reverse proxy your external domain to the local Gateway (default port 18790).
+ - Enable the Webhook and verify the URL.
+4. Fill in the Channel Secret and Channel Access Token in the configuration file.
diff --git a/docs/channels/line/README.zh.md b/docs/channels/line/README.zh.md
deleted file mode 100644
index a36f622c2..000000000
--- a/docs/channels/line/README.zh.md
+++ /dev/null
@@ -1,38 +0,0 @@
-# Line
-
-PicoClaw 通过 LINE Messaging API 配合 Webhook 回调功能实现对 LINE 的支持。
-
-## 配置
-
-```json
-{
- "channels": {
- "line": {
- "enabled": true,
- "channel_secret": "YOUR_CHANNEL_SECRET",
- "channel_access_token": "YOUR_CHANNEL_ACCESS_TOKEN",
- "webhook_path": "/webhook/line",
- "allow_from": []
- }
- }
-}
-```
-
-| 字段 | 类型 | 必填 | 描述 |
-| -------------------- | ------ | ---- | ------------------------------------------ |
-| enabled | bool | 是 | 是否启用 LINE Channel |
-| channel_secret | string | 是 | LINE Messaging API 的 Channel Secret |
-| channel_access_token | string | 是 | LINE Messaging API 的 Channel Access Token |
-| webhook_path | string | 否 | Webhook 的路径 (默认为 /webhook/line) |
-| allow_from | array | 否 | 用户ID白名单,空表示允许所有用户 |
-
-## 设置流程
-
-1. 前往 [LINE Developers Console](https://developers.line.biz/console/) 创建一个服务提供商和一个 Messaging API Channel
-2. 获取 Channel Secret 和 Channel Access Token
-3. 配置Webhook:
- - LINE 要求 Webhook 必须使用 HTTPS 协议,因此需要部署一个支持 HTTPS 的服务器,或者使用反向代理工具如 ngrok 将本地服务器暴露到公网
- - PicoClaw 现在使用共享的 Gateway HTTP 服务器来接收所有渠道的 webhook 回调,默认监听地址为 127.0.0.1:18790
- - 将 Webhook URL 设置为 `https://your-domain.com/webhook/line`,然后将外部域名反向代理到本机的 Gateway(默认端口 18790)
- - 启用 Webhook 并验证 URL
-4. 将 Channel Secret 和 Channel Access Token 填入配置文件中
diff --git a/docs/channels/maixcam/README.md b/docs/channels/maixcam/README.md
new file mode 100644
index 000000000..58dac711b
--- /dev/null
+++ b/docs/channels/maixcam/README.md
@@ -0,0 +1,31 @@
+# MaixCam
+
+MaixCam is a channel dedicated to connecting Sipeed MaixCAM and MaixCAM2 AI camera devices. It uses TCP sockets for bidirectional communication, supporting edge AI deployment scenarios.
+
+## Configuration
+
+```json
+{
+ "channels": {
+ "maixcam": {
+ "enabled": true,
+ "server_address": "0.0.0.0:8899",
+ "allow_from": []
+ }
+ }
+}
+```
+
+| Field | Type | Required | Description |
+| -------------- | ------ | -------- | ----------------------------------------- |
+| enabled | bool | Yes | Whether to enable the MaixCam channel |
+| server_address | string | Yes | TCP server listening address and port |
+| allow_from | array | No | Device ID allowlist, empty means allow all|
+
+## Use Cases
+
+The MaixCam channel enables PicoClaw to run as an AI backend for edge devices:
+
+- **Smart Monitoring**: MaixCAM sends image frames, and PicoClaw analyzes them using vision models.
+- **IoT Control**: Devices send sensor data, and PicoClaw coordinates responses.
+- **Offline AI**: Deploy PicoClaw on a local network for low-latency inference.
diff --git a/docs/channels/maixcam/README.zh.md b/docs/channels/maixcam/README.zh.md
deleted file mode 100644
index 8d53d4bef..000000000
--- a/docs/channels/maixcam/README.zh.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# MaixCam
-
-MaixCam 是专用于连接矽速科技 MaixCAM 与 MaixCAM2 AI 摄像设备的通道。它采用 TCP 套接字实现双向通信,支持边缘 AI 部署场景。
-
-## 配置
-
-```json
-{
- "channels": {
- "maixcam": {
- "enabled": true,
- "server_address": "0.0.0.0:8899",
- "allow_from": []
- }
- }
-}
-```
-
-| 字段 | 类型 | 必填 | 描述 |
-| -------------- | ------ | ---- | -------------------------------- |
-| enabled | bool | 是 | 是否启用 MaixCam 频道 |
-| server_address | string | 是 | TCP 服务器监听地址和端口 |
-| allow_from | array | 否 | 设备ID白名单,空表示允许所有设备 |
-
-## 使用场景
-
-MaixCam 通道使 PicoClaw 能够作为边缘设备的 AI 后端运行:
-
-- **智能监控** :MaixCAM 发送图像帧,PicoClaw 通过视觉模型进行分析
-- **物联网控制** :设备发送传感器数据,PicoClaw 协调响应
-- **离线AI** :在本地网络部署 PicoClaw 实现低延迟推理
diff --git a/docs/channels/matrix/README.zh.md b/docs/channels/matrix/README.zh.md
deleted file mode 100644
index efbc13093..000000000
--- a/docs/channels/matrix/README.zh.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# Matrix 通道配置指南
-
-## 1. 配置示例
-
-在 `config.json` 中添加:
-
-```json
-{
- "channels": {
- "matrix": {
- "enabled": true,
- "homeserver": "https://matrix.org",
- "user_id": "@your-bot:matrix.org",
- "access_token": "YOUR_MATRIX_ACCESS_TOKEN",
- "device_id": "",
- "join_on_invite": true,
- "allow_from": [],
- "group_trigger": {
- "mention_only": true
- },
- "placeholder": {
- "enabled": true,
- "text": "Thinking... 💭"
- },
- "reasoning_channel_id": ""
- }
- }
-}
-```
-
-## 2. 参数说明
-
-| 字段 | 类型 | 必填 | 说明 |
-|----------------------|----------|------|------|
-| enabled | bool | 是 | 是否启用 Matrix 通道 |
-| homeserver | string | 是 | Matrix 服务器地址(例如 `https://matrix.org`) |
-| user_id | string | 是 | 机器人 Matrix 用户 ID(例如 `@bot:matrix.org`) |
-| access_token | string | 是 | 机器人 access token |
-| device_id | string | 否 | 设备 ID(可选) |
-| join_on_invite | bool | 否 | 是否自动加入邀请房间 |
-| allow_from | []string | 否 | 白名单用户(Matrix 用户 ID) |
-| group_trigger | object | 否 | 群聊触发策略(支持 `mention_only` / `prefixes`) |
-| placeholder | object | 否 | 占位消息配置 |
-| reasoning_channel_id | string | 否 | 思维链输出目标通道 |
-
-## 3. 当前支持
-
-- 文本消息收发
-- 图片/音频/视频/文件消息入站下载(写入 MediaStore / 本地路径回退)
-- 音频消息按统一标记进入现有转写流程(`[audio: ...]`)
-- 图片/音频/视频/文件消息出站发送(上传到 Matrix 媒体库后发送)
-- 群聊触发规则(支持仅 @ 提及时响应)
-- Typing 状态(`m.typing`)
-- 占位消息(`Thinking... 💭`)+ 最终回复替换
-- 自动加入邀请房间(可关闭)
-
-## 4. TODO
-
-- 富媒体细节增强(如 image/video 的尺寸、缩略图等 metadata)
diff --git a/docs/channels/onebot/README.md b/docs/channels/onebot/README.md
new file mode 100644
index 000000000..3e3a70cba
--- /dev/null
+++ b/docs/channels/onebot/README.md
@@ -0,0 +1,31 @@
+# OneBot
+
+OneBot is an open protocol standard for QQ bots, providing a unified interface for various QQ bot implementations (e.g., go-cqhttp, Mirai). It uses WebSockets for communication.
+
+## Configuration
+
+```json
+{
+ "channels": {
+ "onebot": {
+ "enabled": true,
+ "ws_url": "ws://localhost:8080",
+ "access_token": "",
+ "allow_from": []
+ }
+ }
+}
+```
+
+| Field | Type | Required | Description |
+| ------------ | ------ | -------- | ----------------------------------------- |
+| enabled | bool | Yes | Whether to enable the OneBot channel |
+| ws_url | string | Yes | WebSocket URL of the OneBot server |
+| access_token | string | No | Access token for the OneBot server |
+| allow_from | array | No | User ID allowlist, empty means allow all |
+
+## Setup Process
+
+1. Deploy a OneBot-compatible implementation (e.g., NapCat).
+2. Configure the OneBot implementation to enable WebSocket services and set an access token (if required).
+3. Fill in the WebSocket URL and access token in the configuration file.
diff --git a/docs/channels/onebot/README.zh.md b/docs/channels/onebot/README.zh.md
deleted file mode 100644
index 6195f1c98..000000000
--- a/docs/channels/onebot/README.zh.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# OneBot
-
-OneBot 是一个面向 QQ 机器人的开放协议标准,为多种 QQ 机器人实现(例如 go-cqhttp、Mirai)提供了统一的接口。它使用 WebSocket 进行通信。
-
-## 配置
-
-```json
-{
- "channels": {
- "onebot": {
- "enabled": true,
- "ws_url": "ws://localhost:8080",
- "access_token": "",
- "allow_from": []
- }
- }
-}
-```
-
-| 字段 | 类型 | 必填 | 描述 |
-| ------------ | ------ | ---- | -------------------------------- |
-| enabled | bool | 是 | 是否启用 OneBot 频道 |
-| ws_url | string | 是 | OneBot 服务器的 WebSocket URL |
-| access_token | string | 否 | 连接 OneBot 服务器的访问令牌 |
-| allow_from | array | 否 | 用户ID白名单,空表示允许所有用户 |
-
-## 设置流程
-
-1. 部署一个 OneBot 兼容的实现(例如napcat)
-2. 配置 OneBot 实现以启用 WebSocket 服务并设置访问令牌(如果需要)
-3. 将 WebSocket URL 和访问令牌填入配置文件中
diff --git a/docs/channels/qq/README.md b/docs/channels/qq/README.md
new file mode 100644
index 000000000..0c552feb7
--- /dev/null
+++ b/docs/channels/qq/README.md
@@ -0,0 +1,32 @@
+# QQ
+
+PicoClaw supports QQ via the official bot API of the QQ Open Platform.
+
+## Configuration
+
+```json
+{
+ "channels": {
+ "qq": {
+ "enabled": true,
+ "app_id": "YOUR_APP_ID",
+ "app_secret": "YOUR_APP_SECRET",
+ "allow_from": []
+ }
+ }
+}
+```
+
+| Field | Type | Required | Description |
+| ---------- | ------ | -------- | ---------------------------------------- |
+| enabled | bool | Yes | Whether to enable the QQ channel |
+| app_id | string | Yes | App ID of the QQ bot application |
+| app_secret | string | Yes | App Secret of the QQ bot application |
+| allow_from | array | No | User ID allowlist, empty means allow all |
+
+## Setup Process
+
+1. Go to the [QQ Open Platform](https://q.qq.com/) and create a bot.
+2. Obtain the App ID and App Secret from the dashboard.
+3. Enable bot sandbox mode and add users and groups to the sandbox.
+4. Fill in the App ID and App Secret in the configuration file.
diff --git a/docs/channels/qq/README.zh.md b/docs/channels/qq/README.zh.md
deleted file mode 100644
index bd774960f..000000000
--- a/docs/channels/qq/README.zh.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# QQ
-
-PicoClaw 通过 QQ 开放平台的官方机器人 API 提供对 QQ 的支持。
-
-## 配置
-
-```json
-{
- "channels": {
- "qq": {
- "enabled": true,
- "app_id": "YOUR_APP_ID",
- "app_secret": "YOUR_APP_SECRET",
- "allow_from": []
- }
- }
-}
-```
-
-| 字段 | 类型 | 必填 | 描述 |
-| ---------- | ------ | ---- | -------------------------------- |
-| enabled | bool | 是 | 是否启用 QQ Channel |
-| app_id | string | 是 | QQ 机器人应用的 App ID |
-| app_secret | string | 是 | QQ 机器人应用的 App Secret |
-| allow_from | array | 否 | 用户ID白名单,空表示允许所有用户 |
-
-## 设置流程
-
-1. 前往 [QQ 开放平台](https://q.qq.com/) 创建一个机器人
-2. 通过仪表盘获取 App ID 和 App Secret
-3. 开启机器人沙箱模式, 将用户和群添加到沙箱中
-4. 将 App ID 和 App Secret 填入配置文件中
diff --git a/docs/channels/slack/README.md b/docs/channels/slack/README.md
new file mode 100644
index 000000000..f950f35c9
--- /dev/null
+++ b/docs/channels/slack/README.md
@@ -0,0 +1,33 @@
+# Slack
+
+Slack is a leading enterprise-grade instant messaging platform. PicoClaw uses Slack's Socket Mode for real-time bidirectional communication, eliminating the need to configure public Webhook endpoints.
+
+## Configuration
+
+```json
+{
+ "channels": {
+ "slack": {
+ "enabled": true,
+ "bot_token": "xoxb-...",
+ "app_token": "xapp-...",
+ "allow_from": []
+ }
+ }
+}
+```
+
+| Field | Type | Required | Description |
+| ---------- | ------ | -------- | --------------------------------------------------------- |
+| enabled | bool | Yes | Whether to enable the Slack channel |
+| bot_token | string | Yes | Bot User OAuth Token for the Slack bot (starts with xoxb-)|
+| app_token | string | Yes | Socket Mode App Level Token for the Slack app (starts with xapp-)|
+| allow_from | array | No | User ID allowlist, empty means allow all |
+
+## Setup Process
+
+1. Go to the [Slack API](https://api.slack.com/) and create a new Slack application.
+2. Enable Socket Mode and obtain an App Level Token.
+3. Add Bot Token Scopes (e.g., `chat:write`, `im:history`, etc.).
+4. Install the application to your workspace and obtain the Bot User OAuth Token.
+5. Fill in the Bot Token and App Token in the configuration file.
diff --git a/docs/channels/slack/README.zh.md b/docs/channels/slack/README.zh.md
deleted file mode 100644
index 58ebcb566..000000000
--- a/docs/channels/slack/README.zh.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Slack
-
-Slack 是全球领先的企业级即时通讯平台。PicoClaw 采用 Slack 的 Socket Mode 实现实时双向通信,无需配置公开的 Webhook 端点。
-
-## 配置
-
-```json
-{
- "channels": {
- "slack": {
- "enabled": true,
- "bot_token": "xoxb-...",
- "app_token": "xapp-...",
- "allow_from": []
- }
- }
-}
-```
-
-| 字段 | 类型 | 必填 | 描述 |
-| ---------- | ------ | ---- | -------------------------------------------------------- |
-| enabled | bool | 是 | 是否启用 Slack 频道 |
-| bot_token | string | 是 | Slack 机器人的 Bot User OAuth Token (以 xoxb- 开头) |
-| app_token | string | 是 | Slack 应用的 Socket Mode App Level Token (以 xapp- 开头) |
-| allow_from | array | 否 | 用户ID白名单,空表示允许所有用户 |
-
-## 设置流程
-
-1. 前往 [Slack API](https://api.slack.com/) 创建一个新的 Slack 应用
-2. 启用 Socket Mode 并获取 App Level Token
-3. 添加 Bot Token Scopes(例如`chat:write`、`im:history`等)
-4. 安装应用到工作区并获取 Bot User OAuth Token
-5. 将 Bot Token 和 App Token 填入配置文件中
diff --git a/docs/channels/telegram/README.md b/docs/channels/telegram/README.md
new file mode 100644
index 000000000..96ae0969f
--- /dev/null
+++ b/docs/channels/telegram/README.md
@@ -0,0 +1,33 @@
+# Telegram
+
+The Telegram Channel uses the Telegram Bot API with long polling to enable bot-based communication. It supports text messages, media attachments (photos, voice, audio, documents), voice transcription via Groq Whisper, and a built-in command processor.
+
+## Configuration
+
+```json
+{
+ "channels": {
+ "telegram": {
+ "enabled": true,
+ "token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
+ "allow_from": ["123456789"],
+ "proxy": ""
+ }
+ }
+}
+```
+
+| Field | Type | Required | Description |
+| ---------- | ------ | -------- | --------------------------------------------------------- |
+| enabled | bool | Yes | Whether to enable the Telegram channel |
+| token | string | Yes | Telegram Bot API Token |
+| allow_from | array | No | User ID allowlist, empty means allow all |
+| proxy | string | No | Proxy URL for connecting to Telegram API (e.g., http://127.0.0.1:7890)|
+
+## Setup Process
+
+1. Search for `@BotFather` on Telegram.
+2. Send the `/newbot` command and follow the prompts to create a new bot.
+3. Obtain the HTTP API Token.
+4. Fill in the Token in the configuration file.
+5. (Optional) Configure `allow_from` to restrict the user IDs allowed to interact (obtain IDs via `@userinfobot`).
diff --git a/docs/channels/telegram/README.zh.md b/docs/channels/telegram/README.zh.md
deleted file mode 100644
index d453c68fa..000000000
--- a/docs/channels/telegram/README.zh.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Telegram
-
-Telegram Channel 通过 Telegram 机器人 API 使用长轮询实现基于机器人的通信。它支持文本消息、媒体附件(照片、语音、音频、文档)、通过 Groq Whisper 进行语音转录以及内置命令处理器。
-
-## 配置
-
-```json
-{
- "channels": {
- "telegram": {
- "enabled": true,
- "token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
- "allow_from": ["123456789"],
- "proxy": ""
- }
- }
-}
-```
-
-| 字段 | 类型 | 必填 | 描述 |
-| ---------- | ------ | ---- | --------------------------------------------------------- |
-| enabled | bool | 是 | 是否启用 Telegram 频道 |
-| token | string | 是 | Telegram 机器人 API Token |
-| allow_from | array | 否 | 用户ID白名单,空表示允许所有用户 |
-| proxy | string | 否 | 连接 Telegram API 的代理 URL (例如 http://127.0.0.1:7890) |
-
-## 设置流程
-
-1. 在 Telegram 中搜索 `@BotFather`
-2. 发送 `/newbot` 命令并按照提示创建新机器人
-3. 获取 HTTP API Token
-4. 将 Token 填入配置文件中
-5. (可选) 配置 `allow_from` 以限制允许互动的用户 ID (可通过 `@userinfobot` 获取 ID)
diff --git a/docs/design/issue-783-investigation-and-fix-plan.md b/docs/design/issue-783-investigation-and-fix-plan.md
new file mode 100644
index 000000000..dd7fce872
--- /dev/null
+++ b/docs/design/issue-783-investigation-and-fix-plan.md
@@ -0,0 +1,61 @@
+# Issue #783 Investigation and Fix Implementation Document
+
+## 1. Problem Clarification (Confirmed)
+
+- Phenomenon: When `agents.*.model.primary/fallbacks` use `model_name` aliases (e.g., `step-3.5-flash`), the fallback chain parses the alias as a real `provider/model`, resulting in a potentially empty `provider` and an incorrect `model`.
+- Root Cause: `ResolveCandidates` only performs `ParseModelRef` on strings without first mapping aliases to real `model` fields via `model_list`.
+- Impact:
+ - Fallback execution might send the alias directly to an OpenAI-compatible provider, triggering an `Unknown Model` error.
+ - When `defaults.provider` is empty, the logs show an empty `provider=` value.
+
+## 2. Objectives
+
+- Fix fallback candidate resolution: Prioritize resolving aliases through `model_list`.
+- Maintain backward compatibility: If no match is found in `model_list`, fall back to the existing `ParseModelRef` logic.
+- Add supplementary tests: Cover aliases, nested path models (e.g., `openrouter/stepfun/...`), and empty default providers.
+- Verify code style: Ensure consistency with the current repository's style (naming, error handling, test structure).
+
+## 3. Online Best Practices Research Conclusions (Completed)
+
+- [x] Researched recommended handling of the `model` field by OpenAI-compatible gateways (e.g., OpenRouter).
+- [x] Researched best practices for multi-provider/fallback design (candidate resolution, log observability).
+- [x] Mapped external recommendations to actionable constraints for this repository.
+
+External Reference Key Points (from official documentation of OpenRouter/LiteLLM/Cloudflare AI Gateway, etc.):
+
+- Prefer explicit configuration; do not rely on string splitting to infer the provider.
+- Model identifiers for gateways should retain full path semantics to avoid truncation causing "Unknown Model" errors.
+- Fallback and primary paths should share the same resolution strategy to avoid cases where the main path works but the fallback path fails.
+
+Reference Links:
+
+- OpenRouter Provider Routing: https://openrouter.ai/docs/guides/routing/provider-selection
+- OpenRouter Model Fallbacks: https://openrouter.ai/docs/guides/routing/model-fallbacks
+- OpenRouter Chat Completion API: https://openrouter.ai/docs/api-reference/chat-completion
+- LiteLLM Router Architecture: https://docs.litellm.ai/docs/router_architecture
+- Cloudflare AI Gateway Chat Completion: https://developers.cloudflare.com/ai-gateway/usage/chat-completion/
+
+Actionable Constraints for This Repository:
+
+- Map `model_name -> model_list.model` during the fallback candidate construction phase.
+- Retain legacy parsing behavior when no mapping is found to ensure compatibility.
+- Use new tests to lock down scenarios involving "aliases + nested model paths + empty default providers."
+
+## 4. Implementation Steps (Executed Sequentially)
+
+- [x] Step 1: Align with existing code patterns and locate minimal change points (`pkg/agent` + `pkg/providers`).
+- [x] Step 2: Implement "model_list-based fallback candidate resolution."
+- [x] Step 3: Add/update unit tests to cover the issue scenarios.
+- [x] Step 4: Perform code style consistency review (against existing file styles).
+- [x] Step 5: Run quality gates (LSP + `make check`).
+
+## 5. Execution Record
+
+- Status: Completed
+- Changes implemented:
+ - `pkg/providers/fallback.go`: Added `ResolveCandidatesWithLookup` while keeping `ResolveCandidates` for backward compatibility.
+ - `pkg/agent/instance.go`: Prioritized resolving aliases via `model_list` before building fallback candidates; complemented models without protocols with the default `openai/` prefix before parsing.
+ - `pkg/providers/fallback_test.go`: Added tests for alias resolution and deduplication.
+ - `pkg/agent/instance_test.go`: Added tests for agent-side alias resolution to nested model paths and models without protocols.
+- Style alignment check (Completed): Consistent with existing patterns in `pkg/providers/fallback_test.go` and `pkg/providers/model_ref_test.go`.
+- Quality verification (Completed): All checks passed after running `make generate` followed by `make check`.
diff --git a/docs/design/issue-783-investigation-and-fix-plan.zh.md b/docs/design/issue-783-investigation-and-fix-plan.zh.md
deleted file mode 100644
index 1c9fc1e70..000000000
--- a/docs/design/issue-783-investigation-and-fix-plan.zh.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# Issue #783 调研与修复执行文档
-
-## 1. 问题澄清(已确认)
-
-- 现象:当 `agents.*.model.primary/fallbacks` 使用 `model_name` 别名(如 `step-3.5-flash`)时,fallback 链路将别名当作真实 `provider/model` 解析,导致 `provider` 可能为空、`model` 可能错误。
-- 根因:`ResolveCandidates` 仅对字符串做 `ParseModelRef`,未先通过 `model_list` 将别名映射到真实 `model` 字段。
-- 影响:
- - fallback 执行可能把别名直接发给 OpenAI-compatible provider,触发 `Unknown Model`。
- - `defaults.provider` 为空时,日志出现 `provider=` 空值。
-
-## 2. 本次目标
-
-- 修复 fallback 候选解析:优先通过 `model_list` 解析别名。
-- 兼容旧行为:若未命中 `model_list`,继续走原有 `ParseModelRef` 兜底。
-- 补充测试:覆盖别名、嵌套路径模型(如 `openrouter/stepfun/...`)、空默认 provider。
-- 验证代码风格:与当前仓库风格保持一致(命名、错误处理、测试结构)。
-
-## 3. 联网最佳实践调研结论(已完成)
-
-- [x] 查阅 OpenAI-compatible 网关(如 OpenRouter)对 `model` 字段的推荐处理。
-- [x] 查阅多 provider/fallback 设计最佳实践(候选解析、日志可观测性)。
-- [x] 将外部建议映射为本仓库可执行约束。
-
-外部参考要点(来自 OpenRouter/LiteLLM/Cloudflare AI Gateway 等官方文档):
-
-- 优先显式配置,不依赖字符串切分推断 provider。
-- 对网关模型标识应保留完整路径语义,避免截断导致 Unknown Model。
-- fallback 与 primary 应复用同一解析策略,避免“主路径正确、降级路径错误”。
-
-参考链接:
-
-- OpenRouter Provider Routing: https://openrouter.ai/docs/guides/routing/provider-selection
-- OpenRouter Model Fallbacks: https://openrouter.ai/docs/guides/routing/model-fallbacks
-- OpenRouter Chat Completion API: https://openrouter.ai/docs/api-reference/chat-completion
-- LiteLLM Router Architecture: https://docs.litellm.ai/docs/router_architecture
-- Cloudflare AI Gateway Chat Completion: https://developers.cloudflare.com/ai-gateway/usage/chat-completion/
-
-与本仓库对应的可执行约束:
-
-- 在 fallback candidate 构建阶段先做 `model_name -> model_list.model` 映射。
-- 未命中映射时保留旧解析行为,保证兼容性。
-- 用新增测试锁定“别名 + 嵌套模型路径 + 空默认 provider”场景。
-
-## 4. 实施步骤(顺序执行)
-
-- [x] Step 1: 对齐现有代码模式,定位最小改动点(`pkg/agent` + `pkg/providers`)。
-- [x] Step 2: 实现“基于 model_list 的 fallback 候选解析”。
-- [x] Step 3: 增加/更新单元测试,覆盖 issue 场景。
-- [x] Step 4: 代码风格一致性复核(与现有文件风格对照)。
-- [x] Step 5: 运行质量门禁(LSP + `make check`)。
-
-## 5. 执行记录
-
-- 状态:已完成
-- 已完成改动:
- - `pkg/providers/fallback.go`:新增 `ResolveCandidatesWithLookup`,并保持 `ResolveCandidates` 向后兼容。
- - `pkg/agent/instance.go`:在构建 fallback candidates 前,优先通过 `model_list` 解析别名,并对无协议模型补齐默认 `openai/` 前缀后再解析。
- - `pkg/providers/fallback_test.go`:新增别名解析与去重测试。
- - `pkg/agent/instance_test.go`:新增 agent 侧别名解析到嵌套模型路径、无协议模型解析测试。
-- 风格对齐检查(完成):与 `pkg/providers/fallback_test.go`、`pkg/providers/model_ref_test.go` 现有模式一致。
-- 质量验证(完成):先 `make generate`,后 `make check` 全量通过。
diff --git a/pkg/channels/README.zh.md b/pkg/channels/README.zh.md
deleted file mode 100644
index bc914fcc9..000000000
--- a/pkg/channels/README.zh.md
+++ /dev/null
@@ -1,1378 +0,0 @@
-# PicoClaw Channel System:完整开发指南
-
-> **影响范围**: `pkg/channels/`, `pkg/bus/`, `pkg/media/`, `pkg/identity/`, `cmd/picoclaw/internal/gateway/`
-
----
-
-## 目录
-
-- [第一部分:架构总览](#第一部分架构总览)
-- [第二部分:迁移指南——从 main 分支迁移到重构分支](#第二部分迁移指南从-main-分支迁移到重构分支)
-- [第三部分:新 Channel 开发指南——从零实现一个新 Channel](#第三部分新-channel-开发指南从零实现一个新-channel)
-- [第四部分:核心子系统详解](#第四部分核心子系统详解)
-- [第五部分:关键设计决策与约定](#第五部分关键设计决策与约定)
-- [附录:完整文件清单与接口速查表](#附录完整文件清单与接口速查表)
-
----
-
-## 第一部分:架构总览
-
-### 1.1 重构前后对比
-
-**重构前(main 分支)**:
-
-```
-pkg/channels/
-├── telegram.go # 每个 channel 直接放在 channels 包内
-├── discord.go
-├── slack.go
-├── manager.go # Manager 直接引用各 channel 类型
-├── ...
-```
-
-- Channel 实现全部在 `pkg/channels/` 包的顶层
-- Manager 通过 `switch` 或 `if-else` 链条直接构造各 channel
-- Peer、MessageID 等路由信息埋在 `Metadata map[string]string` 中
-- 消息发送没有速率限制和重试
-- 没有统一的媒体文件生命周期管理
-- 各 channel 各自启动 HTTP 服务器
-- 群聊触发过滤逻辑分散在各 channel 中
-
-**重构后(refactor/channel-system 分支)**:
-
-```
-pkg/channels/
-├── base.go # BaseChannel 共享抽象层
-├── interfaces.go # 可选能力接口(TypingCapable, MessageEditor, ReactionCapable, PlaceholderCapable, PlaceholderRecorder)
-├── README.md # 英文文档
-├── README.zh.md # 中文文档
-├── media.go # MediaSender 可选接口
-├── webhook.go # WebhookHandler, HealthChecker 可选接口
-├── errors.go # 错误哨兵值(ErrNotRunning, ErrRateLimit, ErrTemporary, ErrSendFailed)
-├── errutil.go # 错误分类帮助函数
-├── registry.go # 工厂注册表(RegisterFactory / getFactory)
-├── manager.go # 统一编排:Worker 队列、速率限制、重试、Typing/Placeholder、共享 HTTP
-├── split.go # 长消息智能分割(保留代码块完整性)
-├── telegram/ # 每个 channel 独立子包
-│ ├── init.go # 工厂注册
-│ ├── telegram.go # 实现
-│ └── telegram_commands.go
-├── discord/
-│ ├── init.go
-│ └── discord.go
-├── slack/ line/ onebot/ dingtalk/ qq/ whatsapp/ whatsapp_native/ maixcam/ pico/
-│ └── ...
-
-pkg/bus/
-├── bus.go # MessageBus(缓冲区 64,安全关闭+排水)
-├── types.go # 结构化消息类型(Peer, SenderInfo, MediaPart, InboundMessage, OutboundMessage, OutboundMediaMessage)
-
-pkg/media/
-├── store.go # MediaStore 接口 + FileMediaStore 实现(两阶段释放,TTL 清理)
-
-pkg/identity/
-├── identity.go # 统一用户身份:规范 "platform:id" 格式 + 向后兼容匹配
-```
-
-### 1.2 消息流转全景图
-
-```
-┌────────────┐ InboundMessage ┌───────────┐ LLM + Tools ┌────────────┐
-│ Telegram │──┐ │ │ │ │
-│ Discord │──┤ PublishInbound() │ │ PublishOutbound() │ │
-│ Slack │──┼──────────────────────▶ │ MessageBus │ ◀─────────────────── │ AgentLoop │
-│ LINE │──┤ (buffered chan, 64) │ │ (buffered chan, 64) │ │
-│ ... │──┘ │ │ │ │
-└────────────┘ └─────┬─────┘ └────────────┘
- │
- SubscribeOutbound() │ SubscribeOutboundMedia()
- ▼
- ┌───────────────────┐
- │ Manager │
- │ ├── dispatchOutbound() 路由到 Worker 队列
- │ ├── dispatchOutboundMedia()
- │ ├── runWorker() 消息分割 + sendWithRetry()
- │ ├── runMediaWorker() sendMediaWithRetry()
- │ ├── preSend() 停止 Typing + 撤销 Reaction + 编辑 Placeholder
- │ └── runTTLJanitor() 清理过期 Typing/Placeholder
- └────────┬──────────┘
- │
- channel.Send() / SendMedia()
- │
- ▼
- ┌────────────────┐
- │ 各平台 API/SDK │
- └────────────────┘
-```
-
-### 1.3 关键设计原则
-
-| 原则 | 说明 |
-|------|------|
-| **子包隔离** | 每个 channel 一个独立 Go 子包,依赖 `channels` 父包提供的 `BaseChannel` 和接口 |
-| **工厂注册** | 各子包通过 `init()` 自注册,Manager 通过名字查找工厂,消除 import 耦合 |
-| **能力发现** | 可选能力通过接口(`MediaSender`, `TypingCapable`, `ReactionCapable`, `PlaceholderCapable`, `MessageEditor`, `WebhookHandler`, `HealthChecker`)声明,Manager 运行时类型断言发现 |
-| **结构化消息** | Peer、MessageID、SenderInfo 从 Metadata 提升为 InboundMessage 的一等字段 |
-| **错误分类** | Channel 返回哨兵错误(`ErrRateLimit`, `ErrTemporary` 等),Manager 据此决定重试策略 |
-| **集中编排** | 速率限制、消息分割、重试、Typing/Reaction/Placeholder 全部由 Manager 和 BaseChannel 统一处理,Channel 只负责 Send |
-
----
-
-## 第二部分:迁移指南——从 main 分支迁移到重构分支
-
-### 2.1 如果你有未合并的 Channel 修改
-
-#### 步骤 1:确认你修改了哪些文件
-
-在 main 分支上,Channel 文件直接位于 `pkg/channels/` 顶层,例如:
-- `pkg/channels/telegram.go`
-- `pkg/channels/discord.go`
-
-重构后,这些文件已被删除,代码移动到了对应子包:
-- `pkg/channels/telegram/telegram.go`
-- `pkg/channels/discord/discord.go`
-
-#### 步骤 2:理解结构变化映射
-
-| main 分支文件 | 重构分支位置 | 变化 |
-|---|---|---|
-| `pkg/channels/telegram.go` | `pkg/channels/telegram/telegram.go` + `init.go` | 包名从 `channels` 变为 `telegram` |
-| `pkg/channels/discord.go` | `pkg/channels/discord/discord.go` + `init.go` | 同上 |
-| `pkg/channels/manager.go` | `pkg/channels/manager.go` | 大幅重写 |
-| _(不存在)_ | `pkg/channels/base.go` | 新增共享抽象层 |
-| _(不存在)_ | `pkg/channels/registry.go` | 新增工厂注册表 |
-| _(不存在)_ | `pkg/channels/errors.go` + `errutil.go` | 新增错误分类体系 |
-| _(不存在)_ | `pkg/channels/interfaces.go` | 新增可选能力接口 |
-| _(不存在)_ | `pkg/channels/media.go` | 新增 MediaSender 接口 |
-| _(不存在)_ | `pkg/channels/webhook.go` | 新增 WebhookHandler/HealthChecker |
-| _(不存在)_ | `pkg/channels/whatsapp_native/` | 新增 WhatsApp 原生模式(whatsmeow) |
-| _(不存在)_ | `pkg/channels/split.go` | 新增消息分割(从 utils 迁入) |
-| _(不存在)_ | `pkg/bus/types.go` | 新增结构化消息类型 |
-| _(不存在)_ | `pkg/media/store.go` | 新增媒体文件生命周期管理 |
-| _(不存在)_ | `pkg/identity/identity.go` | 新增统一用户身份 |
-
-#### 步骤 3:迁移你的 Channel 代码
-
-以 Telegram 为例,主要改动项:
-
-**3a. 包声明和导入**
-
-```go
-// 旧代码(main 分支)
-package channels
-
-import (
- "github.com/sipeed/picoclaw/pkg/bus"
- "github.com/sipeed/picoclaw/pkg/config"
-)
-
-// 新代码(重构分支)
-package telegram
-
-import (
- "github.com/sipeed/picoclaw/pkg/bus"
- "github.com/sipeed/picoclaw/pkg/channels" // 引用父包
- "github.com/sipeed/picoclaw/pkg/config"
- "github.com/sipeed/picoclaw/pkg/identity" // 新增
- "github.com/sipeed/picoclaw/pkg/media" // 新增(如需媒体)
-)
-```
-
-**3b. 结构体嵌入 BaseChannel**
-
-```go
-// 旧代码:直接持有 bus、config 等字段
-type TelegramChannel struct {
- bus *bus.MessageBus
- config *config.Config
- running bool
- allowList []string
- // ...
-}
-
-// 新代码:嵌入 BaseChannel,它提供 bus、running、allowList 等
-type TelegramChannel struct {
- *channels.BaseChannel // 嵌入共享抽象
- bot *telego.Bot
- config *config.Config
- // ... 只保留 channel 特有字段
-}
-```
-
-**3c. 构造函数**
-
-```go
-// 旧代码:直接赋值
-func NewTelegramChannel(cfg *config.Config, bus *bus.MessageBus) (*TelegramChannel, error) {
- return &TelegramChannel{
- bus: bus,
- config: cfg,
- allowList: cfg.Channels.Telegram.AllowFrom,
- // ...
- }, nil
-}
-
-// 新代码:使用 NewBaseChannel + 功能选项
-func NewTelegramChannel(cfg *config.Config, bus *bus.MessageBus) (*TelegramChannel, error) {
- base := channels.NewBaseChannel(
- "telegram", // 名称
- cfg.Channels.Telegram, // 原始配置(any 类型)
- bus, // 消息总线
- cfg.Channels.Telegram.AllowFrom, // 允许列表
- channels.WithMaxMessageLength(4096), // 平台消息长度上限
- channels.WithGroupTrigger(cfg.Channels.Telegram.GroupTrigger), // 群聊触发配置
- channels.WithReasoningChannelID(cfg.Channels.Telegram.ReasoningChannelID), // 思维链路由
- )
- return &TelegramChannel{
- BaseChannel: base,
- bot: bot,
- config: cfg,
- }, nil
-}
-```
-
-**3d. Start/Stop 生命周期**
-
-```go
-// 新代码:使用 SetRunning 原子操作
-func (c *TelegramChannel) Start(ctx context.Context) error {
- // ... 初始化 bot、webhook 等
- c.SetRunning(true) // 必须在就绪后调用
- go bh.Start()
- return nil
-}
-
-func (c *TelegramChannel) Stop(ctx context.Context) error {
- c.SetRunning(false) // 必须在清理前调用
- // ... 停止 bot handler、取消 context
- return nil
-}
-```
-
-**3e. Send 方法的错误返回**
-
-```go
-// 旧代码:返回普通 error
-func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) error {
- if !c.running { return fmt.Errorf("not running") }
- // ...
- if err != nil { return err }
-}
-
-// 新代码:必须返回哨兵错误,供 Manager 判断重试策略
-func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) error {
- if !c.IsRunning() {
- return channels.ErrNotRunning // ← Manager 不会重试
- }
- // ...
- if err != nil {
- // 使用 ClassifySendError 根据 HTTP 状态码包装错误
- return channels.ClassifySendError(statusCode, err)
- // 或手动包装:
- // return fmt.Errorf("%w: %v", channels.ErrTemporary, err)
- // return fmt.Errorf("%w: %v", channels.ErrRateLimit, err)
- // return fmt.Errorf("%w: %v", channels.ErrSendFailed, err)
- }
- return nil
-}
-```
-
-**3f. 消息接收(Inbound)**
-
-```go
-// 旧代码:直接构造 InboundMessage 并发布
-msg := bus.InboundMessage{
- Channel: "telegram",
- SenderID: senderID,
- ChatID: chatID,
- Content: content,
- Metadata: map[string]string{
- "peer_kind": "group", // 路由信息埋在 metadata
- "peer_id": chatID,
- "message_id": msgID,
- },
-}
-c.bus.PublishInbound(ctx, msg)
-
-// 新代码:使用 BaseChannel.HandleMessage,传入结构化字段
-sender := bus.SenderInfo{
- Platform: "telegram",
- PlatformID: strconv.FormatInt(from.ID, 10),
- CanonicalID: identity.BuildCanonicalID("telegram", strconv.FormatInt(from.ID, 10)),
- Username: from.Username,
- DisplayName: from.FirstName,
-}
-
-peer := bus.Peer{
- Kind: "group", // 或 "direct"
- ID: chatID,
-}
-
-// HandleMessage 内部调用 IsAllowedSender 检查权限,构建 MediaScope,发布到 bus
-c.HandleMessage(ctx, peer, messageID, senderID, chatID, content, mediaRefs, metadata, sender)
-```
-
-**3g. 添加工厂注册(必需)**
-
-为你的 channel 创建 `init.go`:
-
-```go
-// pkg/channels/telegram/init.go
-package telegram
-
-import (
- "github.com/sipeed/picoclaw/pkg/bus"
- "github.com/sipeed/picoclaw/pkg/channels"
- "github.com/sipeed/picoclaw/pkg/config"
-)
-
-func init() {
- channels.RegisterFactory("telegram", func(cfg *config.Config, b *bus.MessageBus) (channels.Channel, error) {
- return NewTelegramChannel(cfg, b)
- })
-}
-```
-
-**3h. 在 Gateway 中导入子包**
-
-```go
-// cmd/picoclaw/internal/gateway/helpers.go
-import (
- _ "github.com/sipeed/picoclaw/pkg/channels/telegram" // 触发 init() 注册
- _ "github.com/sipeed/picoclaw/pkg/channels/discord"
- _ "github.com/sipeed/picoclaw/pkg/channels/your_new_channel" // 新增
-)
-```
-
-#### 步骤 4:迁移 Bus 消息使用方式
-
-如果你的代码直接读取 `InboundMessage.Metadata` 中的路由字段:
-
-```go
-// 旧代码
-peerKind := msg.Metadata["peer_kind"]
-peerID := msg.Metadata["peer_id"]
-msgID := msg.Metadata["message_id"]
-
-// 新代码
-peerKind := msg.Peer.Kind // 一等字段
-peerID := msg.Peer.ID // 一等字段
-msgID := msg.MessageID // 一等字段
-sender := msg.Sender // bus.SenderInfo 结构体
-scope := msg.MediaScope // 媒体生命周期作用域
-```
-
-#### 步骤 5:迁移允许列表检查
-
-```go
-// 旧代码
-if !c.isAllowed(senderID) { return }
-
-// 新代码:优先使用结构化检查
-if !c.IsAllowedSender(sender) { return }
-// 或回退到字符串检查:
-if !c.IsAllowed(senderID) { return }
-```
-
-`BaseChannel.HandleMessage` 方法内部已经处理了这个逻辑,无需在 channel 中重复检查。
-
-### 2.2 如果你有 Manager 的修改
-
-Manager 已被完全重写。你的修改需要理解新架构:
-
-| 旧 Manager 职责 | 新 Manager 职责 |
-|---|---|
-| 直接构造 channel(switch/if-else) | 通过工厂注册表查找并构造 |
-| 直接调用 channel.Send | 通过 per-channel Worker 队列 + 速率限制 + 重试 |
-| 无消息分割 | 自动根据 MaxMessageLength 分割长消息 |
-| 各 channel 自建 HTTP 服务器 | 统一共享 HTTP 服务器 |
-| 无 Typing/Placeholder 管理 | 统一 preSend 处理 Typing 停止 + Reaction 撤销 + Placeholder 编辑;入站侧 BaseChannel.HandleMessage 自动编排 Typing/Reaction/Placeholder |
-| 无 TTL 清理 | runTTLJanitor 定期清理过期 Typing/Reaction/Placeholder 条目 |
-
-### 2.3 如果你有 Agent Loop 的修改
-
-Agent Loop 的主要变化:
-
-1. **MediaStore 注入**:`agentLoop.SetMediaStore(mediaStore)` — Agent 通过 MediaStore 解析工具产生的媒体引用
-2. **ChannelManager 注入**:`agentLoop.SetChannelManager(channelManager)` — Agent 可查询 channel 状态
-3. **OutboundMediaMessage**:Agent 现在通过 `bus.PublishOutboundMedia()` 发送媒体消息,而非嵌入文本回复
-4. **extractPeer**:路由使用 `msg.Peer` 结构化字段而非 Metadata 查找
-
----
-
-## 第三部分:新 Channel 开发指南——从零实现一个新 Channel
-
-### 3.1 最小实现清单
-
-要添加一个新的聊天平台(例如 `matrix`),你需要:
-
-1. ✅ 创建子包目录 `pkg/channels/matrix/`
-2. ✅ 创建 `init.go` — 工厂注册
-3. ✅ 创建 `matrix.go` — Channel 实现
-4. ✅ 在 Gateway helpers 中添加 blank import
-5. ✅ 在 Manager.initChannels() 中添加配置检查
-6. ✅ 在 `pkg/config/` 中添加配置结构体
-
-### 3.2 完整模板
-
-#### `pkg/channels/matrix/init.go`
-
-```go
-package matrix
-
-import (
- "github.com/sipeed/picoclaw/pkg/bus"
- "github.com/sipeed/picoclaw/pkg/channels"
- "github.com/sipeed/picoclaw/pkg/config"
-)
-
-func init() {
- channels.RegisterFactory("matrix", func(cfg *config.Config, b *bus.MessageBus) (channels.Channel, error) {
- return NewMatrixChannel(cfg, b)
- })
-}
-```
-
-#### `pkg/channels/matrix/matrix.go`
-
-```go
-package matrix
-
-import (
- "context"
- "fmt"
-
- "github.com/sipeed/picoclaw/pkg/bus"
- "github.com/sipeed/picoclaw/pkg/channels"
- "github.com/sipeed/picoclaw/pkg/config"
- "github.com/sipeed/picoclaw/pkg/identity"
- "github.com/sipeed/picoclaw/pkg/logger"
-)
-
-// MatrixChannel implements channels.Channel for the Matrix protocol.
-type MatrixChannel struct {
- *channels.BaseChannel // 必须嵌入
- config *config.Config
- ctx context.Context
- cancel context.CancelFunc
- // ... Matrix SDK 客户端等
-}
-
-func NewMatrixChannel(cfg *config.Config, msgBus *bus.MessageBus) (*MatrixChannel, error) {
- matrixCfg := cfg.Channels.Matrix // 假设配置中有此字段
-
- base := channels.NewBaseChannel(
- "matrix", // channel 名称(全局唯一)
- matrixCfg, // 原始配置
- msgBus, // 消息总线
- matrixCfg.AllowFrom, // 允许列表
- channels.WithMaxMessageLength(65536), // Matrix 消息长度限制
- channels.WithGroupTrigger(matrixCfg.GroupTrigger),
- channels.WithReasoningChannelID(matrixCfg.ReasoningChannelID), // 思维链路由(可选)
- )
-
- return &MatrixChannel{
- BaseChannel: base,
- config: cfg,
- }, nil
-}
-
-// ========== 必须实现的 Channel 接口方法 ==========
-
-func (c *MatrixChannel) Start(ctx context.Context) error {
- c.ctx, c.cancel = context.WithCancel(ctx)
-
- // 1. 初始化 Matrix 客户端
- // 2. 开始监听消息
- // 3. 标记为运行中
- c.SetRunning(true)
-
- logger.InfoC("matrix", "Matrix channel started")
- return nil
-}
-
-func (c *MatrixChannel) Stop(ctx context.Context) error {
- c.SetRunning(false)
-
- if c.cancel != nil {
- c.cancel()
- }
-
- logger.InfoC("matrix", "Matrix channel stopped")
- return nil
-}
-
-func (c *MatrixChannel) Send(ctx context.Context, msg bus.OutboundMessage) error {
- // 1. 检查运行状态
- if !c.IsRunning() {
- return channels.ErrNotRunning
- }
-
- // 2. 发送消息到 Matrix
- err := c.sendToMatrix(ctx, msg.ChatID, msg.Content)
- if err != nil {
- // 3. 必须使用错误分类包装
- // 如果你有 HTTP 状态码:
- // return channels.ClassifySendError(statusCode, err)
- // 如果是网络错误:
- // return channels.ClassifyNetError(err)
- // 如果需要手动分类:
- return fmt.Errorf("%w: %v", channels.ErrTemporary, err)
- }
-
- return nil
-}
-
-// ========== 消息接收处理 ==========
-
-func (c *MatrixChannel) handleIncoming(roomID, senderID, displayName, content string, msgID string) {
- // 1. 构造结构化发送者身份
- sender := bus.SenderInfo{
- Platform: "matrix",
- PlatformID: senderID,
- CanonicalID: identity.BuildCanonicalID("matrix", senderID),
- Username: senderID,
- DisplayName: displayName,
- }
-
- // 2. 确定 Peer 类型(直聊 vs 群聊)
- peer := bus.Peer{
- Kind: "group", // 或 "direct"
- ID: roomID,
- }
-
- // 3. 群聊过滤(如适用)
- isGroup := peer.Kind == "group"
- if isGroup {
- isMentioned := false // 根据平台特性检测 @提及
- shouldRespond, cleanContent := c.ShouldRespondInGroup(isMentioned, content)
- if !shouldRespond {
- return
- }
- content = cleanContent
- }
-
- // 4. 处理媒体附件(如有)
- var mediaRefs []string
- store := c.GetMediaStore()
- if store != nil {
- // 下载附件到本地 → store.Store() → 获取 ref
- // mediaRefs = append(mediaRefs, ref)
- }
-
- // 5. 调用 HandleMessage 发布到 bus
- // HandleMessage 内部会:
- // - 检查 IsAllowedSender/IsAllowed
- // - 构建 MediaScope
- // - 发布 InboundMessage
- c.HandleMessage(
- c.ctx,
- peer,
- msgID, // 平台消息 ID
- senderID, // 原始发送者 ID
- roomID, // 聊天/房间 ID
- content, // 消息内容
- mediaRefs, // 媒体引用列表
- nil, // 额外 metadata(通常 nil)
- sender, // SenderInfo(variadic 参数)
- )
-}
-
-// ========== 内部方法 ==========
-
-func (c *MatrixChannel) sendToMatrix(ctx context.Context, roomID, content string) error {
- // 实际的 Matrix SDK 调用
- return nil
-}
-```
-
-### 3.3 可选能力接口
-
-根据平台能力,你的 Channel 可以选择性实现以下接口:
-
-#### MediaSender — 发送媒体附件
-
-```go
-// 如果平台支持发送图片/文件/音频/视频
-func (c *MatrixChannel) SendMedia(ctx context.Context, msg bus.OutboundMediaMessage) error {
- if !c.IsRunning() {
- return channels.ErrNotRunning
- }
-
- store := c.GetMediaStore()
- if store == nil {
- return fmt.Errorf("no media store: %w", channels.ErrSendFailed)
- }
-
- for _, part := range msg.Parts {
- localPath, err := store.Resolve(part.Ref)
- if err != nil {
- logger.ErrorCF("matrix", "Failed to resolve media", map[string]any{
- "ref": part.Ref, "error": err.Error(),
- })
- continue
- }
-
- // 根据 part.Type ("image"|"audio"|"video"|"file") 调用对应 API
- switch part.Type {
- case "image":
- // 上传图片到 Matrix
- default:
- // 上传文件到 Matrix
- }
- }
- return nil
-}
-```
-
-#### TypingCapable — Typing 指示器
-
-```go
-// 如果平台支持 "正在输入..." 提示
-func (c *MatrixChannel) StartTyping(ctx context.Context, chatID string) (stop func(), err error) {
- // 调用 Matrix API 发送 typing 指示器
- // 返回的 stop 函数必须是幂等的
- stopped := false
- return func() {
- if !stopped {
- stopped = true
- // 调用 Matrix API 停止 typing
- }
- }, nil
-}
-```
-
-#### ReactionCapable — 消息反应指示器
-
-```go
-// 如果平台支持对入站消息添加 emoji 反应(如 Slack 的 👀、OneBot 的表情 289)
-func (c *MatrixChannel) ReactToMessage(ctx context.Context, chatID, messageID string) (undo func(), err error) {
- // 调用 Matrix API 添加反应到消息
- // 返回的 undo 函数移除反应,必须是幂等的
- err = c.addReaction(chatID, messageID, "eyes")
- if err != nil {
- return func() {}, err
- }
- return func() {
- c.removeReaction(chatID, messageID, "eyes")
- }, nil
-}
-```
-
-#### MessageEditor — 消息编辑
-
-```go
-// 如果平台支持编辑已发送的消息(用于 Placeholder 替换)
-func (c *MatrixChannel) EditMessage(ctx context.Context, chatID, messageID, content string) error {
- // 调用 Matrix API 编辑消息
- return nil
-}
-```
-
-#### PlaceholderCapable — 占位消息
-
-```go
-// 如果平台支持发送占位消息(如 "Thinking... 💭"),并且实现了 MessageEditor,
-// 则 Manager 的 preSend 会在出站时自动将占位消息编辑为最终回复。
-// SendPlaceholder 内部根据 PlaceholderConfig.Enabled 决定是否发送;
-// 返回 ("", nil) 表示跳过。
-func (c *MatrixChannel) SendPlaceholder(ctx context.Context, chatID string) (string, error) {
- cfg := c.config.Channels.Matrix.Placeholder
- if !cfg.Enabled {
- return "", nil
- }
- text := cfg.Text
- if text == "" {
- text = "Thinking... 💭"
- }
- // 调用 Matrix API 发送占位消息
- msg, err := c.sendText(ctx, chatID, text)
- if err != nil {
- return "", err
- }
- return msg.ID, nil
-}
-```
-
-#### WebhookHandler — HTTP Webhook 接收
-
-```go
-// 如果 channel 通过 webhook 接收消息(而非长轮询/WebSocket)
-func (c *MatrixChannel) WebhookPath() string {
- return "/webhook/matrix" // 路径会被注册到共享 HTTP 服务器
-}
-
-func (c *MatrixChannel) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- // 处理 webhook 请求
-}
-```
-
-#### HealthChecker — 健康检查端点
-
-```go
-func (c *MatrixChannel) HealthPath() string {
- return "/health/matrix"
-}
-
-func (c *MatrixChannel) HealthHandler(w http.ResponseWriter, r *http.Request) {
- if c.IsRunning() {
- w.WriteHeader(http.StatusOK)
- w.Write([]byte("OK"))
- } else {
- w.WriteHeader(http.StatusServiceUnavailable)
- }
-}
-```
-
-### 3.4 入站侧 Typing/Reaction/Placeholder 自动编排
-
-`BaseChannel.HandleMessage` 在发布入站消息**之前**,自动检测 channel 是否实现了 `TypingCapable`、`ReactionCapable` 和/或 `PlaceholderCapable`,并触发相应的指示器。三条管道完全独立,互不干扰:
-
-```go
-// BaseChannel.HandleMessage 内部自动执行(无需 channel 手动调用):
-if c.owner != nil && c.placeholderRecorder != nil {
- // Typing — 独立管道
- if tc, ok := c.owner.(TypingCapable); ok {
- if stop, err := tc.StartTyping(ctx, chatID); err == nil {
- c.placeholderRecorder.RecordTypingStop(c.name, chatID, stop)
- }
- }
- // Reaction — 独立管道
- if rc, ok := c.owner.(ReactionCapable); ok && messageID != "" {
- if undo, err := rc.ReactToMessage(ctx, chatID, messageID); err == nil {
- c.placeholderRecorder.RecordReactionUndo(c.name, chatID, undo)
- }
- }
- // Placeholder — 独立管道
- if pc, ok := c.owner.(PlaceholderCapable); ok {
- if phID, err := pc.SendPlaceholder(ctx, chatID); err == nil && phID != "" {
- c.placeholderRecorder.RecordPlaceholder(c.name, chatID, phID)
- }
- }
-}
-```
-
-**这意味着**:
-- 实现 `TypingCapable` 的 channel(Telegram、Discord、LINE、Pico)无需在 `handleMessage` 中手动调用 `StartTyping` + `RecordTypingStop`
-- 实现 `ReactionCapable` 的 channel(Slack、OneBot)无需在 `handleMessage` 中手动调用 `AddReaction` + `RecordTypingStop`
-- 实现 `PlaceholderCapable` 的 channel(Telegram、Discord、Pico)无需在 `handleMessage` 中手动发送占位消息并调用 `RecordPlaceholder`
-- Channel 只需实现对应接口,`HandleMessage` 会自动完成编排
-- 不实现这些接口的 channel 不受影响(类型断言会失败,跳过)
-- `PlaceholderCapable` 的 `SendPlaceholder` 方法内部根据配置的 `PlaceholderConfig.Enabled` 决定是否发送;返回 `("", nil)` 时跳过注册
-
-**Owner 注入**:Manager 在 `initChannel` 中自动调用 `SetOwner(ch)` 将具体 channel 注入 BaseChannel,无需开发者手动设置。
-
-当 Agent 处理完消息后,Manager 的 `preSend` 会自动:
-1. 调用已记录的 `stop()` 停止 Typing
-2. 调用已记录的 `undo()` 撤销 Reaction
-3. 如果有 Placeholder,且 channel 实现了 `MessageEditor`,尝试编辑 Placeholder 为最终回复(跳过 Send)
-
-### 3.5 注册配置和 Gateway 接入
-
-#### 在 `pkg/config/config.go` 中添加配置
-
-```go
-type ChannelsConfig struct {
- // ... 现有 channels
- Matrix MatrixChannelConfig `json:"matrix"`
-}
-
-type MatrixChannelConfig struct {
- Enabled bool `json:"enabled"`
- HomeServer string `json:"home_server"`
- Token string `json:"token"`
- AllowFrom []string `json:"allow_from"`
- GroupTrigger GroupTriggerConfig `json:"group_trigger"`
- Placeholder PlaceholderConfig `json:"placeholder"`
- ReasoningChannelID string `json:"reasoning_channel_id"`
-}
-```
-
-#### 在 Manager.initChannels() 中添加入口
-
-```go
-// pkg/channels/manager.go 的 initChannels() 方法中
-if m.config.Channels.Matrix.Enabled && m.config.Channels.Matrix.Token != "" {
- m.initChannel("matrix", "Matrix")
-}
-```
-
-> **注意**:如果你的 channel 有多种模式(如 WhatsApp Bridge vs Native),需要在 initChannels 中根据配置分支:
-> ```go
-> if cfg.UseNative {
-> m.initChannel("whatsapp_native", "WhatsApp Native")
-> } else {
-> m.initChannel("whatsapp", "WhatsApp")
-> }
-> ```
-
-#### 在 Gateway 中添加 blank import
-
-```go
-// cmd/picoclaw/internal/gateway/helpers.go
-import (
- _ "github.com/sipeed/picoclaw/pkg/channels/matrix"
-)
-```
-
----
-
-## 第四部分:核心子系统详解
-
-### 4.1 MessageBus
-
-**文件**:`pkg/bus/bus.go`、`pkg/bus/types.go`
-
-```go
-type MessageBus struct {
- inbound chan InboundMessage // 缓冲区 = 64
- outbound chan OutboundMessage // 缓冲区 = 64
- outboundMedia chan OutboundMediaMessage // 缓冲区 = 64
- done chan struct{} // 关闭信号
- closed atomic.Bool // 防止重复关闭
-}
-```
-
-**关键行为**:
-
-| 方法 | 行为 |
-|------|------|
-| `PublishInbound(ctx, msg)` | 检查 closed → 发送到 inbound channel → 阻塞/超时/关闭 |
-| `ConsumeInbound(ctx)` | 从 inbound 读取 → 阻塞/关闭/取消 |
-| `PublishOutbound(ctx, msg)` | 发送到 outbound channel |
-| `SubscribeOutbound(ctx)` | 从 outbound 读取(Manager dispatcher 调用) |
-| `PublishOutboundMedia(ctx, msg)` | 发送到 outboundMedia channel |
-| `SubscribeOutboundMedia(ctx)` | 从 outboundMedia 读取(Manager media dispatcher 调用) |
-| `Close()` | CAS 关闭 → close(done) → 排水所有 channel(**不关闭 channel 本身**,避免并发 send-on-closed panic) |
-
-**设计要点**:
-- 缓冲区从 16 增至 64,减少突发负载下的阻塞
-- `Close()` 不关闭底层 channel(只关闭 `done` 信号通道),因为可能有正在并发 `Publish` 的 goroutine
-- 排水循环确保 buffered 消息不被静默丢弃
-
-### 4.2 结构化消息类型
-
-**文件**:`pkg/bus/types.go`
-
-```go
-// 路由对等体
-type Peer struct {
- Kind string `json:"kind"` // "direct" | "group" | "channel" | ""
- ID string `json:"id"`
-}
-
-// 发送者身份信息
-type SenderInfo struct {
- Platform string `json:"platform,omitempty"` // "telegram", "discord", ...
- PlatformID string `json:"platform_id,omitempty"` // 平台原始 ID
- CanonicalID string `json:"canonical_id,omitempty"` // "platform:id" 规范格式
- Username string `json:"username,omitempty"`
- DisplayName string `json:"display_name,omitempty"`
-}
-
-// 入站消息
-type InboundMessage struct {
- Channel string // 来源 channel 名称
- SenderID string // 发送者 ID(优先使用 CanonicalID)
- Sender SenderInfo // 结构化发送者信息
- ChatID string // 聊天/房间 ID
- Content string // 消息文本
- Media []string // 媒体引用列表(media://...)
- Peer Peer // 路由对等体(一等字段)
- MessageID string // 平台消息 ID(一等字段)
- MediaScope string // 媒体生命周期作用域
- SessionKey string // 会话键
- Metadata map[string]string // 仅用于 channel 特有扩展
-}
-
-// 出站文本消息
-type OutboundMessage struct {
- Channel string
- ChatID string
- Content string
-}
-
-// 出站媒体消息
-type OutboundMediaMessage struct {
- Channel string
- ChatID string
- Parts []MediaPart
-}
-
-// 媒体片段
-type MediaPart struct {
- Type string // "image" | "audio" | "video" | "file"
- Ref string // "media://uuid"
- Caption string
- Filename string
- ContentType string
-}
-```
-
-### 4.3 BaseChannel
-
-**文件**:`pkg/channels/base.go`
-
-BaseChannel 是所有 channel 的共享抽象层,提供以下能力:
-
-| 方法/特性 | 说明 |
-|---|---|
-| `Name() string` | Channel 名称 |
-| `IsRunning() bool` | 原子读取运行状态 |
-| `SetRunning(bool)` | 原子设置运行状态 |
-| `MaxMessageLength() int` | 消息长度限制(rune 计数),0 = 无限制 |
-| `ReasoningChannelID() string` | 思维链路由目标 channel ID(空 = 不路由) |
-| `IsAllowed(senderID string) bool` | 旧格式允许列表检查(支持 `"id\|username"` 和 `"@username"` 格式) |
-| `IsAllowedSender(sender SenderInfo) bool` | 新格式允许列表检查(委托给 `identity.MatchAllowed`) |
-| `ShouldRespondInGroup(isMentioned, content) (bool, string)` | 统一群聊触发过滤逻辑 |
-| `HandleMessage(...)` | 统一入站消息处理:权限检查 → 构建 MediaScope → 自动触发 Typing/Reaction/Placeholder → 发布到 Bus |
-| `SetMediaStore(s) / GetMediaStore()` | Manager 注入的媒体存储 |
-| `SetPlaceholderRecorder(r) / GetPlaceholderRecorder()` | Manager 注入的占位符记录器 |
-| `SetOwner(ch) ` | Manager 注入的具体 channel 引用(用于 HandleMessage 内部的 Typing/Reaction/Placeholder 类型断言) |
-
-**功能选项**:
-
-```go
-channels.WithMaxMessageLength(4096) // 设置平台消息长度限制
-channels.WithGroupTrigger(groupTriggerCfg) // 设置群聊触发配置
-channels.WithReasoningChannelID(id) // 设置思维链路由目标 channel
-```
-
-### 4.4 工厂注册表
-
-**文件**:`pkg/channels/registry.go`
-
-```go
-type ChannelFactory func(cfg *config.Config, bus *bus.MessageBus) (Channel, error)
-
-func RegisterFactory(name string, f ChannelFactory) // 子包 init() 中调用
-func getFactory(name string) (ChannelFactory, bool) // Manager 内部调用
-```
-
-工厂注册表使用 `sync.RWMutex` 保护,在 `init()` 阶段注册(进程启动时完成)。Manager 在 `initChannel()` 中通过名字查找工厂并调用它。
-
-### 4.5 错误分类与重试
-
-**文件**:`pkg/channels/errors.go`、`pkg/channels/errutil.go`
-
-#### 哨兵错误
-
-```go
-var (
- ErrNotRunning = errors.New("channel not running") // 永久:不重试
- ErrRateLimit = errors.New("rate limited") // 固定延迟:1s 后重试
- ErrTemporary = errors.New("temporary failure") // 指数退避:500ms * 2^attempt,最大 8s
- ErrSendFailed = errors.New("send failed") // 永久:不重试
-)
-```
-
-#### 错误分类帮助函数
-
-```go
-// 根据 HTTP 状态码自动分类
-func ClassifySendError(statusCode int, rawErr error) error {
- // 429 → ErrRateLimit
- // 5xx → ErrTemporary
- // 4xx → ErrSendFailed
-}
-
-// 网络错误统一包装为临时错误
-func ClassifyNetError(err error) error {
- // → ErrTemporary
-}
-```
-
-#### Manager 重试策略(`sendWithRetry`)
-
-```
-最大重试次数: 3
-速率限制延迟: 1 秒
-基础退避: 500 毫秒
-最大退避: 8 秒
-
-重试逻辑:
- ErrNotRunning → 立即失败,不重试
- ErrSendFailed → 立即失败,不重试
- ErrRateLimit → 等待 1s → 重试
- ErrTemporary → 等待 500ms * 2^attempt(最大 8s) → 重试
- 其他未知错误 → 等待 500ms * 2^attempt(最大 8s) → 重试
-```
-
-### 4.6 Manager 编排
-
-**文件**:`pkg/channels/manager.go`
-
-#### Per-channel Worker 架构
-
-```go
-type channelWorker struct {
- ch Channel // channel 实例
- queue chan bus.OutboundMessage // 出站文本队列(缓冲 16)
- mediaQueue chan bus.OutboundMediaMessage // 出站媒体队列(缓冲 16)
- done chan struct{} // 文本 worker 完成信号
- mediaDone chan struct{} // 媒体 worker 完成信号
- limiter *rate.Limiter // per-channel 速率限制器
-}
-```
-
-#### Per-channel 速率限制配置
-
-```go
-var channelRateConfig = map[string]float64{
- "telegram": 20, // 20 msg/s
- "discord": 1, // 1 msg/s
- "slack": 1, // 1 msg/s
- "line": 10, // 10 msg/s
-}
-// 默认: 10 msg/s
-// burst = max(1, ceil(rate/2))
-```
-
-#### 生命周期管理
-
-```
-StartAll:
- 1. 遍历已注册 channels → channel.Start(ctx)
- 2. 为每个启动成功的 channel 创建 channelWorker
- 3. 启动 goroutines:
- - runWorker (per-channel 出站文本)
- - runMediaWorker (per-channel 出站媒体)
- - dispatchOutbound (从 bus 路由到 worker 队列)
- - dispatchOutboundMedia (从 bus 路由到 media worker 队列)
- - runTTLJanitor (每 10s 清理过期 typing/reaction/placeholder)
- 4. 启动共享 HTTP 服务器(如已配置)
-
-StopAll:
- 1. 关闭共享 HTTP 服务器(5s 超时)
- 2. 取消 dispatcher context
- 3. 关闭 text worker 队列 → 等待排水完成
- 4. 关闭 media worker 队列 → 等待排水完成
- 5. 停止每个 channel(channel.Stop)
-```
-
-#### Typing/Reaction/Placeholder 管理
-
-```go
-// Manager 实现 PlaceholderRecorder 接口
-func (m *Manager) RecordPlaceholder(channel, chatID, placeholderID string)
-func (m *Manager) RecordTypingStop(channel, chatID string, stop func())
-func (m *Manager) RecordReactionUndo(channel, chatID string, undo func())
-
-// 入站侧:BaseChannel.HandleMessage 自动编排
-// BaseChannel.HandleMessage 在 PublishInbound 之前,通过 owner 类型断言自动触发:
-// - TypingCapable.StartTyping → RecordTypingStop
-// - ReactionCapable.ReactToMessage → RecordReactionUndo
-// - PlaceholderCapable.SendPlaceholder → RecordPlaceholder
-// 三者独立,互不干扰。Channel 无需手动调用。
-
-// 出站侧:发送前处理
-func (m *Manager) preSend(ctx, name, msg, ch) bool {
- key := name + ":" + msg.ChatID
- // 1. 停止 Typing(调用存储的 stop 函数)
- // 2. 撤销 Reaction(调用存储的 undo 函数)
- // 3. 尝试编辑 Placeholder(如果 channel 实现了 MessageEditor)
- // 成功 → return true(跳过 Send)
- // 失败 → return false(继续 Send)
-}
-```
-
-Manager 存储完全分离,三条管道互不干扰:
-
-```go
-Manager {
- typingStops sync.Map // "channel:chatID" → typingEntry ← 管 TypingCapable
- reactionUndos sync.Map // "channel:chatID" → reactionEntry ← 管 ReactionCapable
- placeholders sync.Map // "channel:chatID" → placeholderEntry
-}
-```
-
-TTL 清理:
-- Typing 停止函数:5 分钟 TTL(到期后自动调用 stop 并删除)
-- Reaction 撤销函数:5 分钟 TTL(到期后自动调用 undo 并删除)
-- Placeholder ID:10 分钟 TTL(到期后删除)
-- 清理间隔:10 秒
-
-### 4.7 消息分割
-
-**文件**:`pkg/channels/split.go`
-
-`SplitMessage(content string, maxLen int) []string`
-
-智能分割策略:
-1. 计算有效分割点 = maxLen - 10% 缓冲区(为代码块闭合留空间)
-2. 优先在换行符处分割
-3. 其次在空格/制表符处分割
-4. 检测未闭合的代码块(` ``` `)
-5. 如果代码块未闭合:
- - 尝试扩展到 maxLen 以包含闭合围栏
- - 如果代码块太长,注入闭合/重开围栏(`\n```\n` + header)
- - 最后手段:在代码块开始前分割
-
-### 4.8 MediaStore
-
-**文件**:`pkg/media/store.go`
-
-```go
-type MediaStore interface {
- Store(localPath string, meta MediaMeta, scope string) (ref string, err error)
- Resolve(ref string) (localPath string, err error)
- ResolveWithMeta(ref string) (localPath string, meta MediaMeta, err error)
- ReleaseAll(scope string) error
-}
-```
-
-**FileMediaStore 实现**:
-- 纯内存映射,不复制/移动文件
-- 引用格式:`media://`
-- Scope 格式:`channel:chatID:messageID`(由 `BuildMediaScope` 生成)
-- **两阶段操作**:
- - Phase 1(持锁):从 map 中收集并删除条目
- - Phase 2(无锁):从磁盘删除文件
- - 目的:最小化锁争用
-- **TTL 清理**:`NewFileMediaStoreWithCleanup` → `Start()` 启动后台清理协程
-- 清理间隔和最大存活时间由配置控制
-
-### 4.9 Identity
-
-**文件**:`pkg/identity/identity.go`
-
-```go
-// 构建规范 ID
-func BuildCanonicalID(platform, platformID string) string
-// → "telegram:123456"
-
-// 解析规范 ID
-func ParseCanonicalID(canonical string) (platform, id string, ok bool)
-
-// 匹配允许列表(向后兼容)
-func MatchAllowed(sender bus.SenderInfo, allowed string) bool
-```
-
-`MatchAllowed` 支持的允许列表格式:
-| 格式 | 匹配方式 |
-|------|----------|
-| `"123456"` | 匹配 `sender.PlatformID` |
-| `"@alice"` | 匹配 `sender.Username` |
-| `"123456\|alice"` | 匹配 PlatformID 或 Username(旧格式兼容) |
-| `"telegram:123456"` | 精确匹配 `sender.CanonicalID`(新格式) |
-
-### 4.10 共享 HTTP 服务器
-
-**文件**:`pkg/channels/manager.go` 的 `SetupHTTPServer`
-
-Manager 创建单一 `http.Server`,自动发现和注册:
-- 实现 `WebhookHandler` 的 channel → 挂载到 `wh.WebhookPath()`
-- 实现 `HealthChecker` 的 channel → 挂载到 `hc.HealthPath()`
-- Health 全局端点由 `health.Server.RegisterOnMux` 注册
-
-超时配置:ReadTimeout = 30s, WriteTimeout = 30s
-
----
-
-## 第五部分:关键设计决策与约定
-
-### 5.1 必须遵守的约定
-
-1. **错误分类是合约**:Channel 的 `Send` 方法**必须**返回哨兵错误(或包装它们)。Manager 的重试策略完全依赖 `errors.Is` 检查。如果返回未分类的错误,Manager 会按"未知错误"处理(指数退避重试)。
-
-2. **SetRunning 是生命周期信号**:`Start` 成功后**必须**调用 `c.SetRunning(true)`,`Stop` 开始时**必须**调用 `c.SetRunning(false)`。`Send` 中**必须**检查 `c.IsRunning()` 并返回 `ErrNotRunning`。
-
-3. **HandleMessage 包含权限检查**:不要在调用 `HandleMessage` 之前自行进行权限检查(除非你需要在检查前做平台特定的预处理)。`HandleMessage` 内部已经调用 `IsAllowedSender`/`IsAllowed`。
-
-4. **消息分割由 Manager 处理**:Channel 的 `Send` 方法不需要处理长消息分割。Manager 会在调用 `Send` 之前根据 `MaxMessageLength()` 自动分割。Channel 只需通过 `WithMaxMessageLength` 声明限制。
-
-5. **Typing/Reaction/Placeholder 由 BaseChannel + Manager 自动处理**:Channel 的 `Send` 方法不需要管理 Typing 停止、Reaction 撤销或 Placeholder 编辑。`BaseChannel.HandleMessage` 在入站侧自动触发 `TypingCapable`、`ReactionCapable` 和 `PlaceholderCapable`(通过 `owner` 类型断言);Manager 的 `preSend` 在出站侧自动停止 Typing、撤销 Reaction、编辑 Placeholder。Channel 只需实现对应接口即可。
-
-6. **工厂注册在 init() 中**:每个子包必须有 `init.go` 文件调用 `channels.RegisterFactory`。Gateway 必须通过 blank import(`_ "pkg/channels/xxx"`)触发注册。
-
-### 5.2 Metadata 字段使用约定
-
-**不要再把以下信息放入 Metadata**:
-- `peer_kind` / `peer_id` → 使用 `InboundMessage.Peer`
-- `message_id` → 使用 `InboundMessage.MessageID`
-- `sender_platform` / `sender_username` → 使用 `InboundMessage.Sender`
-
-**Metadata 仅用于**:
-- Channel 特有的扩展信息(如 Telegram 的 `reply_to_message_id`)
-- 不适合放入结构化字段的临时信息
-
-### 5.3 并发安全约定
-
-- `BaseChannel.running`:使用 `atomic.Bool`,线程安全
-- `Manager.channels` / `Manager.workers`:使用 `sync.RWMutex` 保护
-- `Manager.placeholders` / `Manager.typingStops` / `Manager.reactionUndos`:使用 `sync.Map`
-- `MessageBus.closed`:使用 `atomic.Bool`
-- `FileMediaStore`:使用 `sync.RWMutex`,两阶段操作减少持锁时间
-- Channel Worker queue:Go channel,天然并发安全
-
-### 5.4 测试约定
-
-已有测试文件:
-- `pkg/channels/base_test.go` — BaseChannel 单元测试
-- `pkg/channels/manager_test.go` — Manager 单元测试
-- `pkg/channels/split_test.go` — 消息分割测试
-- `pkg/channels/errors_test.go` — 错误类型测试
-- `pkg/channels/errutil_test.go` — 错误分类测试
-
-为新 channel 添加测试时:
-```bash
-go test ./pkg/channels/matrix/ -v # 子包测试
-go test ./pkg/channels/ -run TestSpecific -v # 框架测试
-make test # 全量测试
-```
-
----
-
-## 附录:完整文件清单与接口速查表
-
-### A.1 框架层文件
-
-| 文件 | 职责 |
-|------|------|
-| `pkg/channels/base.go` | BaseChannel 结构体、Channel 接口、MessageLengthProvider、BaseChannelOption、HandleMessage |
-| `pkg/channels/interfaces.go` | TypingCapable、MessageEditor、ReactionCapable、PlaceholderCapable、PlaceholderRecorder 接口 |
-| `pkg/channels/media.go` | MediaSender 接口 |
-| `pkg/channels/webhook.go` | WebhookHandler、HealthChecker 接口 |
-| `pkg/channels/errors.go` | ErrNotRunning、ErrRateLimit、ErrTemporary、ErrSendFailed 哨兵 |
-| `pkg/channels/errutil.go` | ClassifySendError、ClassifyNetError 帮助函数 |
-| `pkg/channels/registry.go` | RegisterFactory、getFactory 工厂注册表 |
-| `pkg/channels/manager.go` | Manager:Worker 队列、速率限制、重试、preSend、共享 HTTP、TTL janitor |
-| `pkg/channels/split.go` | SplitMessage 长消息分割 |
-| `pkg/bus/bus.go` | MessageBus 实现 |
-| `pkg/bus/types.go` | Peer、SenderInfo、InboundMessage、OutboundMessage、OutboundMediaMessage、MediaPart |
-| `pkg/media/store.go` | MediaStore 接口、FileMediaStore 实现 |
-| `pkg/identity/identity.go` | BuildCanonicalID、ParseCanonicalID、MatchAllowed |
-
-### A.2 Channel 子包
-
-| 子包 | 注册名 | 可选接口 |
-|------|--------|----------|
-| `pkg/channels/telegram/` | `"telegram"` | TypingCapable, PlaceholderCapable, MessageEditor, MediaSender |
-| `pkg/channels/discord/` | `"discord"` | TypingCapable, PlaceholderCapable, MessageEditor, MediaSender |
-| `pkg/channels/slack/` | `"slack"` | ReactionCapable, MediaSender |
-| `pkg/channels/line/` | `"line"` | TypingCapable, MediaSender, WebhookHandler |
-| `pkg/channels/onebot/` | `"onebot"` | ReactionCapable, MediaSender |
-| `pkg/channels/dingtalk/` | `"dingtalk"` | — |
-| `pkg/channels/qq/` | `"qq"` | — |
-| `pkg/channels/whatsapp/` | `"whatsapp"` | — (Bridge 模式) |
-| `pkg/channels/whatsapp_native/` | `"whatsapp_native"` | — (原生 whatsmeow 模式) |
-| `pkg/channels/maixcam/` | `"maixcam"` | — |
-| `pkg/channels/pico/` | `"pico"` | TypingCapable, PlaceholderCapable, MessageEditor, WebhookHandler |
-
-### A.3 接口速查表
-
-```go
-// ===== 必须实现 =====
-type Channel interface {
- Name() string
- Start(ctx context.Context) error
- Stop(ctx context.Context) error
- Send(ctx context.Context, msg bus.OutboundMessage) error
- IsRunning() bool
- IsAllowed(senderID string) bool
- IsAllowedSender(sender bus.SenderInfo) bool
- ReasoningChannelID() string
-}
-
-// ===== 可选实现 =====
-type MediaSender interface {
- SendMedia(ctx context.Context, msg bus.OutboundMediaMessage) error
-}
-
-type TypingCapable interface {
- StartTyping(ctx context.Context, chatID string) (stop func(), err error)
-}
-
-type ReactionCapable interface {
- ReactToMessage(ctx context.Context, chatID, messageID string) (undo func(), err error)
-}
-
-type PlaceholderCapable interface {
- SendPlaceholder(ctx context.Context, chatID string) (messageID string, err error)
-}
-
-type MessageEditor interface {
- EditMessage(ctx context.Context, chatID, messageID, content string) error
-}
-
-type WebhookHandler interface {
- WebhookPath() string
- http.Handler
-}
-
-type HealthChecker interface {
- HealthPath() string
- HealthHandler(w http.ResponseWriter, r *http.Request)
-}
-
-type MessageLengthProvider interface {
- MaxMessageLength() int
-}
-
-// ===== 由 Manager 注入 =====
-type PlaceholderRecorder interface {
- RecordPlaceholder(channel, chatID, placeholderID string)
- RecordTypingStop(channel, chatID string, stop func())
- RecordReactionUndo(channel, chatID string, undo func())
-}
-```
-
-### A.4 Gateway 启动序列(完整引导流程)
-
-```go
-// 1. 创建核心组件
-msgBus := bus.NewMessageBus()
-provider := providers.CreateProvider(cfg)
-agentLoop := agent.NewAgentLoop(cfg, msgBus, provider)
-
-// 2. 创建媒体存储(带 TTL 清理)
-mediaStore := media.NewFileMediaStoreWithCleanup(cleanerConfig)
-mediaStore.Start()
-
-// 3. 创建 Channel Manager(触发 initChannels → 工厂查找 → 构造 → 注入 MediaStore/PlaceholderRecorder/Owner)
-channelManager := channels.NewManager(cfg, msgBus, mediaStore)
-
-// 4. 注入引用
-agentLoop.SetChannelManager(channelManager)
-agentLoop.SetMediaStore(mediaStore)
-
-// 5. 配置共享 HTTP 服务器
-channelManager.SetupHTTPServer(addr, healthServer)
-
-// 6. 启动
-channelManager.StartAll(ctx) // 启动 channels + workers + dispatchers + HTTP server
-go agentLoop.Run(ctx) // 启动 Agent 消息循环
-
-// 7. 关闭(信号触发)
-cancel() // 取消 context
-msgBus.Close() // 信号关闭 + 排水
-channelManager.StopAll(shutdownCtx) // 停止 HTTP + workers + channels
-mediaStore.Stop() // 停止 TTL 清理
-agentLoop.Stop() // 停止 Agent
-```
-
-### A.5 Per-channel 速率限制参考
-
-| Channel | 速率 (msg/s) | Burst |
-|---------|-------------|-------|
-| telegram | 20 | 10 |
-| discord | 1 | 1 |
-| slack | 1 | 1 |
-| line | 10 | 5 |
-| _其他_ | 10 (默认) | 5 |
-
-### A.6 已知限制和注意事项
-
-1. **媒体清理暂时禁用**:Agent loop 中的 `ReleaseAll` 调用被注释掉了(`refactor(loop): disable media cleanup to prevent premature file deletion`),因为会话边界尚未明确定义。TTL 清理仍然有效。
-
-
-
-4. **Pico Protocol**:`pkg/channels/pico/` 实现了一个自定义的 PicoClaw 原生协议 channel,通过 WebSocket webhook (`/pico/ws`) 接收消息。
-
-5. **WhatsApp 有两种模式**:`"whatsapp"`(Bridge 模式,通过外部 bridge URL 通信)和 `"whatsapp_native"`(原生 whatsmeow 模式,直接连接 WhatsApp)。Manager 根据 `WhatsAppConfig.UseNative` 决定初始化哪个。
-
-6. **DingTalk 使用 Stream 模式**:DingTalk 使用 SDK 的 Stream/WebSocket 模式(非 HTTP webhook),因此不实现 `WebhookHandler`。
-
-7. **PlaceholderConfig 的配置与实现**:`PlaceholderConfig` 出现在 6 个 channel config 中(Telegram、Discord、Slack、LINE、OneBot、Pico),但只有实现了 `PlaceholderCapable` + `MessageEditor` 的 channel(Telegram、Discord、Pico)能真正使用占位消息编辑功能。其余 channel 的 `PlaceholderConfig` 为预留字段。
-
-8. **ReasoningChannelID**:大多数 channel config 都包含 `reasoning_channel_id` 字段,用于将 LLM 的思维链(reasoning/thinking)路由到指定 channel(WhatsApp、Telegram、Discord、MaixCam、QQ、DingTalk、Slack、LINE、OneBot)。注意:`PicoConfig` 目前不包含该字段。`BaseChannel` 通过 `WithReasoningChannelID` 选项和 `ReasoningChannelID()` 方法暴露此配置。