2026-02-13 12:20:33 +00:00
|
|
|
|
<div align="center">
|
2026-03-12 08:10:29 +00:00
|
|
|
|
<img src="assets/logo.webp" alt="PicoClaw" width="512">
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
<h1>PicoClaw: 基于Go语言的超高效 AI 助手</h1>
|
|
|
|
|
|
|
|
|
|
|
|
<h3>10$硬件 · 10MB内存 · 1秒启动 · 皮皮虾,我们走!</h3>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
<img src="https://img.shields.io/badge/Go-1.21+-00ADD8?style=flat&logo=go&logoColor=white" alt="Go">
|
2026-03-06 11:54:56 +00:00
|
|
|
|
<img src="https://img.shields.io/badge/Arch-x86__64%2C%20ARM64%2C%20MIPS%2C%20RISC--V-blue" alt="Hardware">
|
2026-02-13 12:20:33 +00:00
|
|
|
|
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
|
|
|
|
|
|
<br>
|
|
|
|
|
|
<a href="https://picoclaw.io"><img src="https://img.shields.io/badge/Website-picoclaw.io-blue?style=flat&logo=google-chrome&logoColor=white" alt="Website"></a>
|
2026-03-14 09:20:49 +00:00
|
|
|
|
<a href="https://docs.picoclaw.io/"><img src="https://img.shields.io/badge/Docs-Official-007acc?style=flat&logo=read-the-docs&logoColor=white" alt="Docs"></a>
|
|
|
|
|
|
<a href="https://deepwiki.com/sipeed/picoclaw"><img src="https://img.shields.io/badge/Wiki-DeepWiki-FFA500?style=flat&logo=wikipedia&logoColor=white" alt="Wiki"></a>
|
|
|
|
|
|
<br>
|
2026-02-13 12:20:33 +00:00
|
|
|
|
<a href="https://x.com/SipeedIO"><img src="https://img.shields.io/badge/X_(Twitter)-SipeedIO-black?style=flat&logo=x&logoColor=white" alt="Twitter"></a>
|
2026-03-14 09:20:49 +00:00
|
|
|
|
<a href="./assets/wechat.png"><img src="https://img.shields.io/badge/WeChat-Group-41d56b?style=flat&logo=wechat&logoColor=white"></a>
|
|
|
|
|
|
<a href="https://discord.gg/V4sAZ9XWpN"><img src="https://img.shields.io/badge/Discord-Community-4c60eb?style=flat&logo=discord&logoColor=white" alt="Discord"></a>
|
2026-02-13 12:20:33 +00:00
|
|
|
|
</p>
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
**中文** | [日本語](README.ja.md) | [Português](README.pt-br.md) | [Tiếng Việt](README.vi.md) | [Français](README.fr.md) | [English](README.md)
|
|
|
|
|
|
|
2026-02-13 12:20:33 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
🦐 **PicoClaw** 是一个受 [nanobot](https://github.com/HKUDS/nanobot) 启发的超轻量级个人 AI 助手。它采用 **Go 语言** 从零重构,经历了一个“自举”过程——即由 AI Agent 自身驱动了整个架构迁移和代码优化。
|
|
|
|
|
|
|
|
|
|
|
|
⚡️ **极致轻量**:可在 **10 美元** 的硬件上运行,内存占用 **<10MB**。这意味着比 OpenClaw 节省 99% 的内存,比 Mac mini 便宜 98%!
|
|
|
|
|
|
|
|
|
|
|
|
<table align="center">
|
|
|
|
|
|
<tr align="center">
|
|
|
|
|
|
<td align="center" valign="top">
|
|
|
|
|
|
<p align="center">
|
|
|
|
|
|
<img src="assets/picoclaw_mem.gif" width="360" height="240">
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td align="center" valign="top">
|
|
|
|
|
|
<p align="center">
|
|
|
|
|
|
<img src="assets/licheervnano.png" width="400" height="240">
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
注意:人手有限,中文文档可能略有滞后,请优先查看英文文档。
|
|
|
|
|
|
|
|
|
|
|
|
> [!CAUTION]
|
|
|
|
|
|
> **🚨 SECURITY & OFFICIAL CHANNELS / 安全声明**
|
2026-02-21 07:33:35 +00:00
|
|
|
|
>
|
|
|
|
|
|
> - **无加密货币 (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),我们将在功能较为收敛后进行资源占用优化.
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
## 📢 新闻 (News)
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-22 22:45:17 +00:00
|
|
|
|
2026-02-16 🎉 PicoClaw 在一周内突破了12K star! 感谢大家的关注!PicoClaw 的成长速度超乎我们预期. 由于PR数量的快速膨胀,我们亟需社区开发者参与维护. 我们需要的志愿者角色和roadmap已经发布到了[这里](docs/ROADMAP.md), 期待你的参与!
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
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 秒内启动。
|
|
|
|
|
|
|
2026-03-06 11:54:56 +00:00
|
|
|
|
🌍 **真正可移植**: 跨 RISC-V、ARM、MIPS 和 x86 架构的单二进制文件,一键运行!
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
🤖 **AI 自举**: 纯 Go 语言原生实现 — 95% 的核心代码由 Agent 生成,并经由“人机回环 (Human-in-the-loop)”微调。
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| | OpenClaw | NanoBot | **PicoClaw** |
|
|
|
|
|
|
| ------------------------------ | ------------- | ------------------------ | -------------------------------------- |
|
|
|
|
|
|
| **语言** | TypeScript | Python | **Go** |
|
|
|
|
|
|
| **RAM** | >1GB | >100MB | **< 10MB** |
|
|
|
|
|
|
| **启动时间**</br>(0.8GHz core) | >500s | >30s | **<1s** |
|
|
|
|
|
|
| **成本** | Mac Mini $599 | 大多数 Linux 开发板 ~$50 | **任意 Linux 开发板**</br>**低至 $10** |
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
<img src="assets/compare.jpg" alt="PicoClaw" width="512">
|
|
|
|
|
|
|
|
|
|
|
|
## 🦾 演示
|
|
|
|
|
|
|
|
|
|
|
|
### 🛠️ 标准助手工作流
|
|
|
|
|
|
|
|
|
|
|
|
<table align="center">
|
|
|
|
|
|
<tr align="center">
|
|
|
|
|
|
<th><p align="center">🧩 全栈工程师模式</p></th>
|
|
|
|
|
|
<th><p align="center">🗂️ 日志与规划管理</p></th>
|
|
|
|
|
|
<th><p align="center">🔎 网络搜索与学习</p></th>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td align="center"><p align="center"><img src="assets/picoclaw_code.gif" width="240" height="180"></p></td>
|
|
|
|
|
|
<td align="center"><p align="center"><img src="assets/picoclaw_memory.gif" width="240" height="180"></p></td>
|
|
|
|
|
|
<td align="center"><p align="center"><img src="assets/picoclaw_search.gif" width="240" height="180"></p></td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td align="center">开发 • 部署 • 扩展</td>
|
|
|
|
|
|
<td align="center">日程 • 自动化 • 记忆</td>
|
|
|
|
|
|
<td align="center">发现 • 洞察 • 趋势</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
2026-02-17 10:01:39 +00:00
|
|
|
|
### 📱 在手机上轻松运行
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-17 10:01:39 +00:00
|
|
|
|
picoclaw 可以将你10年前的老旧手机废物利用,变身成为你的AI助理!快速指南:
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-17 10:01:39 +00:00
|
|
|
|
1. 先去应用商店下载安装Termux
|
|
|
|
|
|
2. 打开后执行指令
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-17 10:01:39 +00:00
|
|
|
|
```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
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-13 03:15:39 +00:00
|
|
|
|
然后跟随下面的“快速开始”章节继续配置picoclaw即可使用!
|
2026-02-21 07:33:35 +00:00
|
|
|
|
<img src="assets/termux.jpg" alt="PicoClaw" width="512">
|
2026-02-17 10:01:39 +00:00
|
|
|
|
|
2026-02-13 12:20:33 +00:00
|
|
|
|
### 🐜 创新的低占用部署
|
|
|
|
|
|
|
|
|
|
|
|
PicoClaw 几乎可以部署在任何 Linux 设备上!
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
- $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),用于智能监控。
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
[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
|
|
|
|
|
|
|
chore(docker): reorganize docker files and add first-run entrypoint (#812)
* chore(docker): move Dockerfile into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(docker): add entrypoint script to goreleaser Dockerfile
- entrypoint.sh: on first run (config and workspace both absent) runs
picoclaw onboard then exits for the user to configure; subsequent
starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
extra_files so it is included in the docker build context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(docker): update docker-compose to use pre-built image and bind mount
- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update Docker Compose section to reflect new docker/ layout
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(docker): use restart: on-failure to prevent restart after first-run setup
unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: sync Docker Compose section across all language READMEs
Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 02:10:17 +00:00
|
|
|
|
# 2. 首次运行 — 自动生成 docker/data/config.json 后退出
|
|
|
|
|
|
docker compose -f docker/docker-compose.yml --profile gateway up
|
|
|
|
|
|
# 容器打印 "First-run setup complete." 后自动停止
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
chore(docker): reorganize docker files and add first-run entrypoint (#812)
* chore(docker): move Dockerfile into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(docker): add entrypoint script to goreleaser Dockerfile
- entrypoint.sh: on first run (config and workspace both absent) runs
picoclaw onboard then exits for the user to configure; subsequent
starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
extra_files so it is included in the docker build context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(docker): update docker-compose to use pre-built image and bind mount
- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update Docker Compose section to reflect new docker/ layout
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(docker): use restart: on-failure to prevent restart after first-run setup
unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: sync Docker Compose section across all language READMEs
Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 02:10:17 +00:00
|
|
|
|
# 3. 填写 API Key 等配置
|
|
|
|
|
|
vim docker/data/config.json # 设置 provider API key、Bot Token 等
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
chore(docker): reorganize docker files and add first-run entrypoint (#812)
* chore(docker): move Dockerfile into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(docker): add entrypoint script to goreleaser Dockerfile
- entrypoint.sh: on first run (config and workspace both absent) runs
picoclaw onboard then exits for the user to configure; subsequent
starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
extra_files so it is included in the docker build context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(docker): update docker-compose to use pre-built image and bind mount
- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update Docker Compose section to reflect new docker/ layout
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(docker): use restart: on-failure to prevent restart after first-run setup
unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: sync Docker Compose section across all language READMEs
Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 02:10:17 +00:00
|
|
|
|
# 4. 正式启动
|
|
|
|
|
|
docker compose -f docker/docker-compose.yml --profile gateway up -d
|
|
|
|
|
|
```
|
2026-02-23 21:54:10 +00:00
|
|
|
|
|
chore(docker): reorganize docker files and add first-run entrypoint (#812)
* chore(docker): move Dockerfile into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(docker): add entrypoint script to goreleaser Dockerfile
- entrypoint.sh: on first run (config and workspace both absent) runs
picoclaw onboard then exits for the user to configure; subsequent
starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
extra_files so it is included in the docker build context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(docker): update docker-compose to use pre-built image and bind mount
- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update Docker Compose section to reflect new docker/ layout
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(docker): use restart: on-failure to prevent restart after first-run setup
unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: sync Docker Compose section across all language READMEs
Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 02:10:17 +00:00
|
|
|
|
> [!TIP]
|
|
|
|
|
|
> **Docker 用户**: 默认情况下, Gateway 监听 `127.0.0.1`,该端口不会暴露到容器外。如果需要通过端口映射访问健康检查接口,请在环境变量中设置 `PICOCLAW_GATEWAY_HOST=0.0.0.0` 或修改 `config.json`。
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
chore(docker): reorganize docker files and add first-run entrypoint (#812)
* chore(docker): move Dockerfile into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(docker): add entrypoint script to goreleaser Dockerfile
- entrypoint.sh: on first run (config and workspace both absent) runs
picoclaw onboard then exits for the user to configure; subsequent
starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
extra_files so it is included in the docker build context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(docker): update docker-compose to use pre-built image and bind mount
- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update Docker Compose section to reflect new docker/ layout
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(docker): use restart: on-failure to prevent restart after first-run setup
unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: sync Docker Compose section across all language READMEs
Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 02:10:17 +00:00
|
|
|
|
```bash
|
|
|
|
|
|
# 5. 查看日志
|
|
|
|
|
|
docker compose -f docker/docker-compose.yml logs -f picoclaw-gateway
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
chore(docker): reorganize docker files and add first-run entrypoint (#812)
* chore(docker): move Dockerfile into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(docker): add entrypoint script to goreleaser Dockerfile
- entrypoint.sh: on first run (config and workspace both absent) runs
picoclaw onboard then exits for the user to configure; subsequent
starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
extra_files so it is included in the docker build context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(docker): update docker-compose to use pre-built image and bind mount
- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update Docker Compose section to reflect new docker/ layout
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(docker): use restart: on-failure to prevent restart after first-run setup
unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: sync Docker Compose section across all language READMEs
Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 02:10:17 +00:00
|
|
|
|
# 6. 停止
|
|
|
|
|
|
docker compose -f docker/docker-compose.yml --profile gateway down
|
2026-02-13 12:20:33 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Agent 模式 (一次性运行)
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# 提问
|
chore(docker): reorganize docker files and add first-run entrypoint (#812)
* chore(docker): move Dockerfile into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(docker): add entrypoint script to goreleaser Dockerfile
- entrypoint.sh: on first run (config and workspace both absent) runs
picoclaw onboard then exits for the user to configure; subsequent
starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
extra_files so it is included in the docker build context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(docker): update docker-compose to use pre-built image and bind mount
- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update Docker Compose section to reflect new docker/ layout
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(docker): use restart: on-failure to prevent restart after first-run setup
unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: sync Docker Compose section across all language READMEs
Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 02:10:17 +00:00
|
|
|
|
docker compose -f docker/docker-compose.yml run --rm picoclaw-agent -m "2+2 等于几?"
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
# 交互模式
|
chore(docker): reorganize docker files and add first-run entrypoint (#812)
* chore(docker): move Dockerfile into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(docker): add entrypoint script to goreleaser Dockerfile
- entrypoint.sh: on first run (config and workspace both absent) runs
picoclaw onboard then exits for the user to configure; subsequent
starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
extra_files so it is included in the docker build context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(docker): update docker-compose to use pre-built image and bind mount
- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update Docker Compose section to reflect new docker/ layout
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(docker): use restart: on-failure to prevent restart after first-run setup
unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: sync Docker Compose section across all language READMEs
Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 02:10:17 +00:00
|
|
|
|
docker compose -f docker/docker-compose.yml run --rm picoclaw-agent
|
2026-02-13 12:20:33 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
chore(docker): reorganize docker files and add first-run entrypoint (#812)
* chore(docker): move Dockerfile into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(docker): add entrypoint script to goreleaser Dockerfile
- entrypoint.sh: on first run (config and workspace both absent) runs
picoclaw onboard then exits for the user to configure; subsequent
starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
extra_files so it is included in the docker build context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(docker): update docker-compose to use pre-built image and bind mount
- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update Docker Compose section to reflect new docker/ layout
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(docker): use restart: on-failure to prevent restart after first-run setup
unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: sync Docker Compose section across all language READMEs
Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 02:10:17 +00:00
|
|
|
|
### 更新镜像
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
chore(docker): reorganize docker files and add first-run entrypoint (#812)
* chore(docker): move Dockerfile into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(docker): add entrypoint script to goreleaser Dockerfile
- entrypoint.sh: on first run (config and workspace both absent) runs
picoclaw onboard then exits for the user to configure; subsequent
starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
extra_files so it is included in the docker build context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(docker): update docker-compose to use pre-built image and bind mount
- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update Docker Compose section to reflect new docker/ layout
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(docker): use restart: on-failure to prevent restart after first-run setup
unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: sync Docker Compose section across all language READMEs
Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 02:10:17 +00:00
|
|
|
|
docker compose -f docker/docker-compose.yml pull
|
|
|
|
|
|
docker compose -f docker/docker-compose.yml --profile gateway up -d
|
2026-02-13 12:20:33 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 🚀 快速开始
|
|
|
|
|
|
|
|
|
|
|
|
> [!TIP]
|
2026-03-13 03:15:39 +00:00
|
|
|
|
> 在 `~/.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 次免费查询)。
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
**1. 初始化 (Initialize)**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
picoclaw onboard
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**2. 配置 (Configure)** (`~/.picoclaw/config.json`)
|
|
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"agents": {
|
|
|
|
|
|
"defaults": {
|
|
|
|
|
|
"workspace": "~/.picoclaw/workspace",
|
2026-03-12 08:10:29 +00:00
|
|
|
|
"model_name": "gpt-5.4",
|
2026-02-13 12:20:33 +00:00
|
|
|
|
"max_tokens": 8192,
|
|
|
|
|
|
"temperature": 0.7,
|
|
|
|
|
|
"max_tool_iterations": 20
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
"model_list": [
|
|
|
|
|
|
{
|
2026-03-12 08:10:29 +00:00
|
|
|
|
"model_name": "ark-code-latest",
|
|
|
|
|
|
"model": "volcengine/ark-code-latest",
|
2026-03-14 01:30:02 +00:00
|
|
|
|
"api_key": "sk-your-api-key",
|
|
|
|
|
|
"api_base":"https://ark.cn-beijing.volces.com/api/coding/v3"
|
2026-03-12 08:10:29 +00:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"model_name": "gpt-5.4",
|
|
|
|
|
|
"model": "openai/gpt-5.4",
|
2026-02-26 08:08:19 +00:00
|
|
|
|
"api_key": "your-api-key",
|
|
|
|
|
|
"request_timeout": 300
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2026-02-20 04:15:04 +00:00
|
|
|
|
"model_name": "claude-sonnet-4.6",
|
|
|
|
|
|
"model": "anthropic/claude-sonnet-4.6",
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
"api_key": "your-anthropic-key"
|
2026-02-13 12:20:33 +00:00
|
|
|
|
}
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
],
|
2026-02-13 12:20:33 +00:00
|
|
|
|
"tools": {
|
|
|
|
|
|
"web": {
|
2026-02-20 15:23:22 +00:00
|
|
|
|
"brave": {
|
|
|
|
|
|
"enabled": false,
|
2026-02-13 12:20:33 +00:00
|
|
|
|
"api_key": "YOUR_BRAVE_API_KEY",
|
|
|
|
|
|
"max_results": 5
|
2026-02-20 15:23:22 +00:00
|
|
|
|
},
|
2026-02-22 16:30:14 +00:00
|
|
|
|
"tavily": {
|
|
|
|
|
|
"enabled": false,
|
|
|
|
|
|
"api_key": "YOUR_TAVILY_API_KEY",
|
2026-02-20 15:23:22 +00:00
|
|
|
|
"max_results": 5
|
2026-02-13 12:20:33 +00:00
|
|
|
|
}
|
2026-02-15 10:41:39 +00:00
|
|
|
|
},
|
|
|
|
|
|
"cron": {
|
|
|
|
|
|
"exec_timeout_minutes": 5
|
2026-02-13 12:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-02-20 19:34:48 +00:00
|
|
|
|
> **新功能**: `model_list` 配置格式支持零代码添加 provider。详见[模型配置](#模型配置-model_list)章节。
|
2026-02-26 08:08:19 +00:00
|
|
|
|
> `request_timeout` 为可选项,单位为秒。若省略或设置为 `<= 0`,PicoClaw 使用默认超时(120 秒)。
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
|
2026-02-13 12:20:33 +00:00
|
|
|
|
**3. 获取 API Key**
|
|
|
|
|
|
|
2026-02-22 16:30:14 +00:00
|
|
|
|
* **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 请求/月)
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
> **注意**: 完整的配置模板请参考 `config.example.json`。
|
|
|
|
|
|
|
|
|
|
|
|
**4. 对话 (Chat)**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
picoclaw agent -m "2+2 等于几?"
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
就是这样!您在 2 分钟内就拥有了一个可工作的 AI 助手。
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 💬 聊天应用集成 (Chat Apps)
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
PicoClaw 支持多种聊天平台,使您的 Agent 能够连接到任何地方。
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
2026-03-01 14:20:57 +00:00
|
|
|
|
> **注意**: 所有 Webhook 类渠道(LINE、WeCom 等)均挂载在同一个 Gateway HTTP 服务器上(`gateway.host`:`gateway.port`,默认 `127.0.0.1:18790`),无需为每个渠道单独配置端口。注意:飞书(Feishu)使用 WebSocket/SDK 模式,不通过该共享 HTTP webhook 服务器接收消息。
|
2026-02-28 14:25:31 +00:00
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
### 核心渠道
|
2026-02-20 12:01:22 +00:00
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| 渠道 | 设置难度 | 特性说明 | 文档链接 |
|
|
|
|
|
|
| -------------------- | ----------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
|
|
|
|
| **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) |
|
2026-03-07 17:44:24 +00:00
|
|
|
|
| **Matrix** | ⭐⭐ 中等 | 联邦协议,支持自建 homeserver 与公开服务器 | [查看文档](docs/channels/matrix/README.zh.md) |
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| **QQ** | ⭐⭐ 中等 | 官方机器人 API,适合国内社群 | [查看文档](docs/channels/qq/README.zh.md) |
|
|
|
|
|
|
| **钉钉 (DingTalk)** | ⭐⭐ 中等 | Stream 模式无需公网,企业办公首选 | [查看文档](docs/channels/dingtalk/README.zh.md) |
|
2026-02-28 06:38:41 +00:00
|
|
|
|
| **企业微信 (WeCom)** | ⭐⭐⭐ 较难 | 支持群机器人(Webhook)、自建应用(API)和智能机器人(AI Bot) | [Bot 文档](docs/channels/wecom/wecom_bot/README.zh.md) / [App 文档](docs/channels/wecom/wecom_app/README.zh.md) / [AI Bot 文档](docs/channels/wecom/wecom_aibot/README.zh.md) |
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| **飞书 (Feishu)** | ⭐⭐⭐ 较难 | 企业级协作,功能丰富 | [查看文档](docs/channels/feishu/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) |
|
2026-02-20 12:01:22 +00:00
|
|
|
|
|
feat(commands): centralized command registry with sub-command routing (#959)
* feat(commands): Session management [Phase 1/2] command centralization and registration
* docs: add design for command registry post-review fixes
Documents the architecture decisions for fixing 5 Important issues
from code review: SubCommand pattern, Deps struct, command-group files,
Executor caching, and Telegram registration dedup.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(commands): add SubCommand type and EffectiveUsage method
Introduce SubCommand struct for declaring sub-commands structurally
within a parent command Definition. The EffectiveUsage() method
auto-generates usage strings from sub-command names and args,
preventing drift between help text and actual handler behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(commands): add Deps struct and secondToken helper, remove dead contains()
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(commands): add sub-command routing to Executor
Uses Registry.Lookup for O(1) command dispatch instead of iterating
all definitions. Definitions with SubCommands are routed to matching
sub-command handlers. Missing or unknown sub-commands reply with
auto-generated usage.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): split into command-group files with Deps injection
Extract show/list/start/help into individual cmd_*.go files.
Replace config.Config parameter with Deps struct for runtime data.
Restore /show agents and /list agents sub-commands.
Use EffectiveUsage for auto-generated help text.
Bridge external callers (agent/loop.go, telegram.go) with Deps wrapper
until Task 5 fully wires the Deps fields.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* perf(commands): cache Executor in AgentLoop, wire Deps with runtime callbacks
Create Executor once in NewAgentLoop instead of per-message. Deps
closures capture AgentLoop pointer for late-bound access to
channelManager and runtime agent model.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(telegram): remove duplicate initBotCommands, keep async startCommandRegistration only
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore(commands): restore Outcome comments and annotate Deps.Config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): consolidate /switch into commands package, fix ! prefix
Move /switch model and /switch channel handling from inline loop.go
logic into cmd_switch.go using the SubCommand + Deps pattern. This
removes the OutcomePassthrough branch in handleCommand entirely.
Also replace the hardcoded "/" prefix check with commands.HasCommandPrefix
so that "!" prefixed commands are correctly routed to the Executor.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: add docs/plans to .gitignore and untrack existing files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): address code review findings
- Remove dead ExecuteResult.Reply field and unused branch in loop.go
- Extract shared agentsHandler for /show agents and /list agents
- Remove redundant firstToken/secondToken (use nthToken instead)
- Simplify Telegram startup: pass BuiltinDefinitions directly
- Centralize req.Reply nil guard in executeDefinition
- Extract unavailableMsg constant (was duplicated 5 times)
- Remove unused MessageID from Request
- Remove stale "reserved for Phase 2" comment on Deps.Config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): replace Deps with per-request Runtime
Separate stateless Registry (cached on AgentLoop) from per-request
Runtime (passed to handlers at execution time). This enables future
session management features to inject per-request context without
modifying the command registry.
- Rename Deps → Runtime, move to runtime.go
- Change Handler signature: func(ctx, req) error → func(ctx, req, rt *Runtime) error
- NewExecutor now takes (registry, runtime) — executor is created per-request
- BuiltinDefinitions() no longer takes parameters (stateless)
- AgentLoop caches cmdRegistry, builds Runtime via buildRuntime()
- Update all cmd_*.go handlers and tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* style: fix gci import grouping and godoc formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(onboard): skip legacy AGENT.md when copying embedded workspace templates
The workspace/ directory contains both AGENT.md (legacy) and AGENTS.md
(current). copyEmbeddedToTarget was copying both, causing the test
TestCopyEmbeddedToTargetUsesAgentsMarkdown to fail. Skip AGENT.md
during the walk to match the expected behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(agent): address self-review comments on loop.go
- Move cmdRegistry init into struct literal (review comment #11)
- Rename buildRuntime → buildCommandsRuntime for clarity (review comment #12)
- Add comment to default switch case explaining passthrough (review comment #13)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): address code review findings on naming and correctness
- Rename dispatcher.go → request.go (no Dispatcher type remains)
- Rename cmd_agents.go → handler_agents.go (shared handler, not a top-level command)
- Add modelMu to protect AgentInstance.Model writes in SwitchModel
- Add ListDefinitions to Runtime so /help uses registry instead of BuiltinDefinitions()
- Fix SwitchChannel message: validation-only callback should not say "Switched"
- Propagate Reply errors in executor instead of discarding with _ =
- Add HasCommandPrefix unit test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(onboard): extract legacy filename to constant
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(agent): handle commands before route error check
Move handleCommand() before the routeErr gate so global commands
(/help, /show, /switch) remain available even when routing fails.
Context-dependent commands that need a routed agent will report
"unavailable" through their nil-Runtime guards.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* revert: remove unnecessary AGENT.md skip in onboard
Reverts 02d0c04 and 74deae1. The test failure was caused by a local
leftover workspace/AGENT.md file (gitignored but embedded by go:embed).
Deleting the local file fixes the root cause; the code-level skip was
never needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: executeDefinition Unknown option
* fix(agent): use routed agent for model commands, restore Telegram command diff
- Remove modelMu: message processing is serial, no concurrent writes
- Pass routed agent to handleCommand/buildCommandsRuntime instead of
always using default agent
- GetModelInfo/SwitchModel are nil when agent is nil (route failed),
handlers reply "unavailable"
- Restore GetMyCommands + slices.Equal check before SetMyCommands to
avoid unnecessary Telegram API calls on restart
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(commands): remove unintended config mutation in SwitchModel
SwitchModel should only update the routed agent's runtime Model field.
Writing to cfg.Agents.Defaults.ModelName was a behavioral change that
corrupts the default agent config when switching a non-default agent.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): move /switch channel to /check channel
/switch channel only validates availability, not actually switching.
Rename to /check channel to match actual behavior. /switch channel
now shows a redirect message pointing users to the new command.
Addresses review feedback from yinwm on PR #959.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:31:40 +00:00
|
|
|
|
### Telegram 命令注册(启动时自动同步)
|
|
|
|
|
|
|
|
|
|
|
|
PicoClaw 现在使用统一的命令定义来源。启动时会自动将 Telegram 支持的命令(例如 `/start`、`/help`、`/show`、`/list`)注册到 Bot 命令菜单,确保菜单展示与实际行为一致。
|
|
|
|
|
|
Telegram 侧保留的是命令菜单注册能力;通用命令的实际执行统一走 Agent Loop 中的 commands executor。
|
|
|
|
|
|
|
|
|
|
|
|
如果注册因网络或 API 短暂异常失败,不会阻塞 channel 启动;系统会在后台自动重试。
|
|
|
|
|
|
|
2026-02-13 12:20:33 +00:00
|
|
|
|
## <img src="assets/clawdchat-icon.png" width="24" height="24" alt="ClawdChat"> 加入 Agent 社交网络
|
|
|
|
|
|
|
|
|
|
|
|
只需通过 CLI 或任何集成的聊天应用发送一条消息,即可将 PicoClaw 连接到 Agent 社交网络。
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
\*\*阅读 `https://clawdchat.ai/skill.md` 并按照说明加入 [ClawdChat.ai](https://clawdchat.ai)
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
## ⚙️ 配置详解
|
|
|
|
|
|
|
|
|
|
|
|
配置文件路径: `~/.picoclaw/config.json`
|
|
|
|
|
|
|
2026-03-01 20:41:12 +00:00
|
|
|
|
### 环境变量
|
|
|
|
|
|
|
|
|
|
|
|
你可以使用环境变量覆盖默认路径。这对于便携安装、容器化部署或将 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
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-02-13 12:20:33 +00:00
|
|
|
|
### 工作区布局 (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 # 用户偏好
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-03 10:25:00 +00:00
|
|
|
|
### 技能来源 (Skill Sources)
|
|
|
|
|
|
|
|
|
|
|
|
默认情况下,技能会按以下顺序加载:
|
|
|
|
|
|
|
|
|
|
|
|
1. `~/.picoclaw/workspace/skills`(工作区)
|
|
|
|
|
|
2. `~/.picoclaw/skills`(全局)
|
|
|
|
|
|
3. `<current-working-directory>/skills`(内置)
|
|
|
|
|
|
|
|
|
|
|
|
在高级/测试场景下,可通过以下环境变量覆盖内置技能目录:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
export PICOCLAW_BUILTIN_SKILLS=/path/to/skills
|
|
|
|
|
|
```
|
|
|
|
|
|
|
feat(commands): centralized command registry with sub-command routing (#959)
* feat(commands): Session management [Phase 1/2] command centralization and registration
* docs: add design for command registry post-review fixes
Documents the architecture decisions for fixing 5 Important issues
from code review: SubCommand pattern, Deps struct, command-group files,
Executor caching, and Telegram registration dedup.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(commands): add SubCommand type and EffectiveUsage method
Introduce SubCommand struct for declaring sub-commands structurally
within a parent command Definition. The EffectiveUsage() method
auto-generates usage strings from sub-command names and args,
preventing drift between help text and actual handler behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(commands): add Deps struct and secondToken helper, remove dead contains()
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(commands): add sub-command routing to Executor
Uses Registry.Lookup for O(1) command dispatch instead of iterating
all definitions. Definitions with SubCommands are routed to matching
sub-command handlers. Missing or unknown sub-commands reply with
auto-generated usage.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): split into command-group files with Deps injection
Extract show/list/start/help into individual cmd_*.go files.
Replace config.Config parameter with Deps struct for runtime data.
Restore /show agents and /list agents sub-commands.
Use EffectiveUsage for auto-generated help text.
Bridge external callers (agent/loop.go, telegram.go) with Deps wrapper
until Task 5 fully wires the Deps fields.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* perf(commands): cache Executor in AgentLoop, wire Deps with runtime callbacks
Create Executor once in NewAgentLoop instead of per-message. Deps
closures capture AgentLoop pointer for late-bound access to
channelManager and runtime agent model.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(telegram): remove duplicate initBotCommands, keep async startCommandRegistration only
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore(commands): restore Outcome comments and annotate Deps.Config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): consolidate /switch into commands package, fix ! prefix
Move /switch model and /switch channel handling from inline loop.go
logic into cmd_switch.go using the SubCommand + Deps pattern. This
removes the OutcomePassthrough branch in handleCommand entirely.
Also replace the hardcoded "/" prefix check with commands.HasCommandPrefix
so that "!" prefixed commands are correctly routed to the Executor.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: add docs/plans to .gitignore and untrack existing files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): address code review findings
- Remove dead ExecuteResult.Reply field and unused branch in loop.go
- Extract shared agentsHandler for /show agents and /list agents
- Remove redundant firstToken/secondToken (use nthToken instead)
- Simplify Telegram startup: pass BuiltinDefinitions directly
- Centralize req.Reply nil guard in executeDefinition
- Extract unavailableMsg constant (was duplicated 5 times)
- Remove unused MessageID from Request
- Remove stale "reserved for Phase 2" comment on Deps.Config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): replace Deps with per-request Runtime
Separate stateless Registry (cached on AgentLoop) from per-request
Runtime (passed to handlers at execution time). This enables future
session management features to inject per-request context without
modifying the command registry.
- Rename Deps → Runtime, move to runtime.go
- Change Handler signature: func(ctx, req) error → func(ctx, req, rt *Runtime) error
- NewExecutor now takes (registry, runtime) — executor is created per-request
- BuiltinDefinitions() no longer takes parameters (stateless)
- AgentLoop caches cmdRegistry, builds Runtime via buildRuntime()
- Update all cmd_*.go handlers and tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* style: fix gci import grouping and godoc formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(onboard): skip legacy AGENT.md when copying embedded workspace templates
The workspace/ directory contains both AGENT.md (legacy) and AGENTS.md
(current). copyEmbeddedToTarget was copying both, causing the test
TestCopyEmbeddedToTargetUsesAgentsMarkdown to fail. Skip AGENT.md
during the walk to match the expected behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(agent): address self-review comments on loop.go
- Move cmdRegistry init into struct literal (review comment #11)
- Rename buildRuntime → buildCommandsRuntime for clarity (review comment #12)
- Add comment to default switch case explaining passthrough (review comment #13)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): address code review findings on naming and correctness
- Rename dispatcher.go → request.go (no Dispatcher type remains)
- Rename cmd_agents.go → handler_agents.go (shared handler, not a top-level command)
- Add modelMu to protect AgentInstance.Model writes in SwitchModel
- Add ListDefinitions to Runtime so /help uses registry instead of BuiltinDefinitions()
- Fix SwitchChannel message: validation-only callback should not say "Switched"
- Propagate Reply errors in executor instead of discarding with _ =
- Add HasCommandPrefix unit test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(onboard): extract legacy filename to constant
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(agent): handle commands before route error check
Move handleCommand() before the routeErr gate so global commands
(/help, /show, /switch) remain available even when routing fails.
Context-dependent commands that need a routed agent will report
"unavailable" through their nil-Runtime guards.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* revert: remove unnecessary AGENT.md skip in onboard
Reverts 02d0c04 and 74deae1. The test failure was caused by a local
leftover workspace/AGENT.md file (gitignored but embedded by go:embed).
Deleting the local file fixes the root cause; the code-level skip was
never needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: executeDefinition Unknown option
* fix(agent): use routed agent for model commands, restore Telegram command diff
- Remove modelMu: message processing is serial, no concurrent writes
- Pass routed agent to handleCommand/buildCommandsRuntime instead of
always using default agent
- GetModelInfo/SwitchModel are nil when agent is nil (route failed),
handlers reply "unavailable"
- Restore GetMyCommands + slices.Equal check before SetMyCommands to
avoid unnecessary Telegram API calls on restart
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(commands): remove unintended config mutation in SwitchModel
SwitchModel should only update the routed agent's runtime Model field.
Writing to cfg.Agents.Defaults.ModelName was a behavioral change that
corrupts the default agent config when switching a non-default agent.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): move /switch channel to /check channel
/switch channel only validates availability, not actually switching.
Rename to /check channel to match actual behavior. /switch channel
now shows a redirect message pointing users to the new command.
Addresses review feedback from yinwm on PR #959.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:31:40 +00:00
|
|
|
|
### 统一命令执行策略
|
|
|
|
|
|
|
|
|
|
|
|
- 通用斜杠命令通过 `pkg/agent/loop.go` 中的 `commands.Executor` 统一执行。
|
|
|
|
|
|
- Channel 适配器不再在本地消费通用命令;它们只负责把入站文本转发到 bus/agent 路径。Telegram 仍会在启动时自动注册其支持的命令菜单。
|
|
|
|
|
|
- 未注册的斜杠命令(例如 `/foo`)会透传给 LLM 按普通输入处理。
|
|
|
|
|
|
- 已注册但当前 channel 不支持的命令(例如 WhatsApp 上的 `/show`)会返回明确的用户可见错误,并停止后续处理。
|
2026-02-13 12:20:33 +00:00
|
|
|
|
### 心跳 / 周期性任务 (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)
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-13 12:20:33 +00:00
|
|
|
|
- Report current time
|
|
|
|
|
|
|
|
|
|
|
|
## Long Tasks (use spawn for async)
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-13 12:20:33 +00:00
|
|
|
|
- Search the web for AI news and summarize
|
|
|
|
|
|
- Check email and report important messages
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**关键行为:**
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| 特性 | 描述 |
|
|
|
|
|
|
| ---------------- | ---------------------------------------- |
|
|
|
|
|
|
| **spawn** | 创建异步子 Agent,不阻塞主心跳进程 |
|
|
|
|
|
|
| **独立上下文** | 子 Agent 拥有独立上下文,无会话历史 |
|
2026-02-13 12:20:33 +00:00
|
|
|
|
| **message tool** | 子 Agent 通过 message 工具直接与用户通信 |
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| **非阻塞** | spawn 后,心跳继续处理下一个任务 |
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
#### 子 Agent 通信原理
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
心跳触发 (Heartbeat triggers)
|
|
|
|
|
|
↓
|
|
|
|
|
|
Agent 读取 HEARTBEAT.md
|
|
|
|
|
|
↓
|
|
|
|
|
|
对于长任务: spawn 子 Agent
|
|
|
|
|
|
↓ ↓
|
|
|
|
|
|
继续下一个任务 子 Agent 独立工作
|
|
|
|
|
|
↓ ↓
|
|
|
|
|
|
所有任务完成 子 Agent 使用 "message" 工具
|
|
|
|
|
|
↓ ↓
|
|
|
|
|
|
响应 HEARTBEAT_OK 用户直接收到结果
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
子 Agent 可以访问工具(message, web_search 等),并且无需通过主 Agent 即可独立与用户通信。
|
|
|
|
|
|
|
|
|
|
|
|
**配置:**
|
|
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"heartbeat": {
|
|
|
|
|
|
"enabled": true,
|
|
|
|
|
|
"interval": 30
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| 选项 | 默认值 | 描述 |
|
|
|
|
|
|
| ---------- | ------ | ---------------------------- |
|
|
|
|
|
|
| `enabled` | `true` | 启用/禁用心跳 |
|
|
|
|
|
|
| `interval` | `30` | 检查间隔,单位分钟 (最小: 5) |
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
**环境变量:**
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
- `PICOCLAW_HEARTBEAT_ENABLED=false` 禁用
|
|
|
|
|
|
- `PICOCLAW_HEARTBEAT_INTERVAL=60` 更改间隔
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
### 提供商 (Providers)
|
|
|
|
|
|
|
|
|
|
|
|
> [!NOTE]
|
2026-03-01 08:31:04 +00:00
|
|
|
|
> Groq 通过 Whisper 提供免费的语音转录。如果配置了 Groq,任意渠道的音频消息都将在 Agent 层面自动转录为文字。
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| 提供商 | 用途 | 获取 API Key |
|
|
|
|
|
|
| -------------------- | ---------------------------- | -------------------------------------------------------------------- |
|
|
|
|
|
|
| `gemini` | LLM (Gemini 直连) | [aistudio.google.com](https://aistudio.google.com) |
|
|
|
|
|
|
| `zhipu` | LLM (智谱直连) | [bigmodel.cn](bigmodel.cn) |
|
2026-03-13 03:15:39 +00:00
|
|
|
|
| `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) |
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| `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) |
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
### 模型配置 (model_list)
|
|
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
> **新功能!** PicoClaw 现在采用**以模型为中心**的配置方式。只需使用 `厂商/模型` 格式(如 `zhipu/glm-4.7`)即可添加新的 provider——**无需修改任何代码!**
|
|
|
|
|
|
|
|
|
|
|
|
该设计同时支持**多 Agent 场景**,提供灵活的 Provider 选择:
|
|
|
|
|
|
|
|
|
|
|
|
- **不同 Agent 使用不同 Provider**:每个 Agent 可以使用自己的 LLM provider
|
|
|
|
|
|
- **模型回退(Fallback)**:配置主模型和备用模型,提高可靠性
|
|
|
|
|
|
- **负载均衡**:在多个 API 端点之间分配请求
|
|
|
|
|
|
- **集中化配置**:在一个地方管理所有 provider
|
|
|
|
|
|
|
|
|
|
|
|
#### 📋 所有支持的厂商
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| 厂商 | `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) |
|
2026-03-13 03:15:39 +00:00
|
|
|
|
| **火山引擎(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) |
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| **神算云** | `shengsuanyun/` | `https://router.shengsuanyun.com/api/v1` | OpenAI | - |
|
2026-03-13 03:15:39 +00:00
|
|
|
|
| **BytePlus** | `byteplus/` | `https://ark.ap-southeast.bytepluses.com/api/v3` | OpenAI | [获取密钥](https://www.byteplus.com) |
|
2026-03-11 18:34:42 +00:00
|
|
|
|
| **LongCat** | `longcat/` | `https://api.longcat.chat/openai` | OpenAI | [获取密钥](https://longcat.chat/platform) |
|
2026-03-13 06:02:23 +00:00
|
|
|
|
| **ModelScope (魔搭)**| `modelscope/` | `https://api-inference.modelscope.cn/v1` | OpenAI | [获取 Token](https://modelscope.cn/my/tokens) |
|
2026-03-14 14:52:34 +00:00
|
|
|
|
| **Azure OpenAI** | `azure/` | `https://{resource}.openai.azure.com` | Azure | [获取密钥](https://portal.azure.com) |
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| **Antigravity** | `antigravity/` | Google Cloud | 自定义 | 仅 OAuth |
|
|
|
|
|
|
| **GitHub Copilot** | `github-copilot/` | `localhost:4321` | gRPC | - |
|
2026-02-19 17:22:06 +00:00
|
|
|
|
|
|
|
|
|
|
#### 基础配置示例
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"model_list": [
|
|
|
|
|
|
{
|
2026-03-12 08:10:29 +00:00
|
|
|
|
"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",
|
2026-02-19 17:22:06 +00:00
|
|
|
|
"api_key": "sk-your-openai-key"
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2026-02-20 04:15:04 +00:00
|
|
|
|
"model_name": "claude-sonnet-4.6",
|
|
|
|
|
|
"model": "anthropic/claude-sonnet-4.6",
|
2026-02-19 17:22:06 +00:00
|
|
|
|
"api_key": "sk-ant-your-key"
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2026-02-19 17:22:06 +00:00
|
|
|
|
"model_name": "glm-4.7",
|
|
|
|
|
|
"model": "zhipu/glm-4.7",
|
|
|
|
|
|
"api_key": "your-zhipu-key"
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
"agents": {
|
|
|
|
|
|
"defaults": {
|
2026-03-12 08:10:29 +00:00
|
|
|
|
"model": "gpt-5.4"
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
#### 各厂商配置示例
|
|
|
|
|
|
|
|
|
|
|
|
**OpenAI**
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
```json
|
|
|
|
|
|
{
|
2026-03-12 08:10:29 +00:00
|
|
|
|
"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",
|
2026-02-19 17:22:06 +00:00
|
|
|
|
"api_key": "sk-..."
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**智谱 AI (GLM)**
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"model_name": "glm-4.7",
|
|
|
|
|
|
"model": "zhipu/glm-4.7",
|
|
|
|
|
|
"api_key": "your-key"
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**DeepSeek**
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"model_name": "deepseek-chat",
|
|
|
|
|
|
"model": "deepseek/deepseek-chat",
|
|
|
|
|
|
"api_key": "sk-..."
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**Anthropic (使用 OAuth)**
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
```json
|
|
|
|
|
|
{
|
2026-02-20 04:15:04 +00:00
|
|
|
|
"model_name": "claude-sonnet-4.6",
|
|
|
|
|
|
"model": "anthropic/claude-sonnet-4.6",
|
2026-02-19 17:22:06 +00:00
|
|
|
|
"auth_method": "oauth"
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
> 运行 `picoclaw auth login --provider anthropic` 来设置 OAuth 凭证。
|
|
|
|
|
|
|
feat: add anthropic-messages protocol for native Anthropic Messages API support Fixes #269 (#1284)
* feat: add anthropic-messages protocol support
Add native Anthropic Messages API format support to enable
compatibility with custom endpoints that only support Anthropic's
native message format (not OpenAI-compatible format).
Changes:
- Add new pkg/providers/anthropic_messages package with HTTP-based provider
- Implement Anthropic Messages API request/response format conversion
- Add anthropic-messages protocol support in factory_provider.go
- Include comprehensive unit tests (64.2% coverage)
Features:
- Support for system, user, assistant, and tool messages
- Support for tool calls (tool_use blocks)
- Proper header handling (x-api-key, anthropic-version)
- Configurable max_tokens and temperature
- Automatic base URL normalization
Configuration example:
model: "anthropic-messages/claude-opus-4-6"
api_base: "https://api.anthropic.com"
api_key: "sk-..."
Tested with actual API endpoint, verified compatibility
with Anthropic Messages API specification.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: add anthropic-messages protocol examples to README and config
Add configuration examples and documentation for the new
anthropic-messages protocol:
- config.example.json: Add claude-opus-4.6 example with anthropic-messages
- README.md: Add "Anthropic Messages API (native format)" section
- README.zh.md: Add Chinese version of the documentation
This helps users understand when to use anthropic-messages vs
anthropic protocol and fixes issue #269.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: format code with gofmt -s
- Align constant definitions in provider.go
- Align struct fields in test cases
- Fix gofmt formatting issues reported in review
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: address linter errors
- Fix HTTP header canonical form: "x-api-key" → "X-API-Key"
- Fix HTTP header canonical form: "anthropic-version" → "Anthropic-Version"
- Format imports with gci (standard, default, localmodule order)
- Format code with golines (max line length 120)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve golangci-lint errors in anthropic-messages provider
- add nolint comment for canonicalheader rule on X-API-Key header (Anthropic API requires exact casing)
- fix golines formatting issues in provider_test.go (split long lines under 120 chars)
- fix long comment line in factory_provider.go (split into two lines)
Resolves CI linter failures for the anthropic-messages protocol implementation.
* fix(providers): address review comments in anthropic-messages provider
- fix normalizeBaseURL edge case that incorrectly appends /v1 to URLs already containing /v1 path (e.g., https://api.example.com/v1/proxy)
- remove dead code for apiBase empty check as normalizeBaseURL() always provides a default value
- update test to use proper constructor instead of direct struct initialization
- add detailed comments explaining the URL normalization logic
Resolves review comments on PR #1284
* fix(providers): remove hardcoded max_tokens in anthropic-messages provider
- remove hardcoded max_tokens value (4096) from buildRequestBody
- read max_tokens directly from options parameter
- add error handling when max_tokens is missing from options
- update test cases to include max_tokens in options
This fix ensures the provider respects the config default value (32768)
or system fallback (8192) instead of always using the hardcoded 4096.
* fix(providers): improve error handling and add edge case tests
- fix ToolCalls nil vs empty slice issue to ensure consistent JSON serialization
- add detailed HTTP error handling for common status codes (401, 429, 400, 404, 500, 503)
- add edge case tests for buildRequestBody and parseResponseBody
- clarify anthropic vs anthropic-messages protocol differences in docs
---------
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-13 06:09:40 +00:00
|
|
|
|
**Anthropic Messages API(原生格式)**
|
|
|
|
|
|
|
|
|
|
|
|
用于直接访问 Anthropic API 或仅支持 Anthropic 原生消息格式的自定义端点:
|
|
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"model_name": "claude-opus-4-6",
|
|
|
|
|
|
"model": "anthropic-messages/claude-opus-4-6",
|
|
|
|
|
|
"api_key": "sk-ant-your-key",
|
|
|
|
|
|
"api_base": "https://api.anthropic.com"
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
> 使用 `anthropic-messages` 协议的场景:
|
|
|
|
|
|
> - 使用仅支持 Anthropic 原生 `/v1/messages` 端点的第三方代理(不支持 OpenAI 兼容的 `/v1/chat/completions`)
|
|
|
|
|
|
> - 连接到 MiniMax、Synthetic 等需要 Anthropic 原生消息格式的服务
|
|
|
|
|
|
> - 现有的 `anthropic` 协议返回 404 错误(说明端点不支持 OpenAI 兼容格式)
|
|
|
|
|
|
>
|
|
|
|
|
|
> **注意:** `anthropic` 协议使用 OpenAI 兼容格式(`/v1/chat/completions`),而 `anthropic-messages` 使用 Anthropic 原生格式(`/v1/messages`)。请根据端点支持的格式选择。
|
|
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
**Ollama (本地)**
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"model_name": "llama3",
|
|
|
|
|
|
"model": "ollama/llama3"
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**自定义代理/API**
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"model_name": "my-custom-model",
|
|
|
|
|
|
"model": "openai/custom-model",
|
|
|
|
|
|
"api_base": "https://my-proxy.com/v1",
|
2026-02-26 08:08:19 +00:00
|
|
|
|
"api_key": "sk-...",
|
|
|
|
|
|
"request_timeout": 300
|
2026-02-19 17:22:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
#### 负载均衡
|
|
|
|
|
|
|
|
|
|
|
|
为同一个模型名称配置多个端点——PicoClaw 会自动在它们之间轮询:
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"model_list": [
|
2026-02-19 17:22:06 +00:00
|
|
|
|
{
|
2026-03-12 08:10:29 +00:00
|
|
|
|
"model_name": "gpt-5.4",
|
|
|
|
|
|
"model": "openai/gpt-5.4",
|
2026-02-19 17:22:06 +00:00
|
|
|
|
"api_base": "https://api1.example.com/v1",
|
|
|
|
|
|
"api_key": "sk-key1"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2026-03-12 08:10:29 +00:00
|
|
|
|
"model_name": "gpt-5.4",
|
|
|
|
|
|
"model": "openai/gpt-5.4",
|
2026-02-19 17:22:06 +00:00
|
|
|
|
"api_base": "https://api2.example.com/v1",
|
|
|
|
|
|
"api_key": "sk-key2"
|
|
|
|
|
|
}
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
#### 从旧的 `providers` 配置迁移
|
|
|
|
|
|
|
|
|
|
|
|
旧的 `providers` 配置格式**已弃用**,但为向后兼容仍支持。
|
|
|
|
|
|
|
|
|
|
|
|
**旧配置(已弃用):**
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"providers": {
|
|
|
|
|
|
"zhipu": {
|
|
|
|
|
|
"api_key": "your-key",
|
|
|
|
|
|
"api_base": "https://open.bigmodel.cn/api/paas/v4"
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"agents": {
|
|
|
|
|
|
"defaults": {
|
|
|
|
|
|
"provider": "zhipu",
|
|
|
|
|
|
"model": "glm-4.7"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**新配置(推荐):**
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-19 17:22:06 +00:00
|
|
|
|
```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)。
|
feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md
Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini
Closes #283
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:26:00 +00:00
|
|
|
|
|
2026-02-13 12:20:33 +00:00
|
|
|
|
<details>
|
|
|
|
|
|
<summary><b>智谱 (Zhipu) 配置示例</b></summary>
|
|
|
|
|
|
|
|
|
|
|
|
**1. 获取 API key 和 base URL**
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
- 获取 [API key](https://bigmodel.cn/usercenter/proj-mgmt/apikeys)
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
**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"
|
2026-02-20 15:23:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-13 12:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**3. 运行**
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
picoclaw agent -m "你好"
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
|
|
<details>
|
|
|
|
|
|
<summary><b>完整配置示例</b></summary>
|
|
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"agents": {
|
|
|
|
|
|
"defaults": {
|
|
|
|
|
|
"model": "anthropic/claude-opus-4-5"
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
feat(commands): centralized command registry with sub-command routing (#959)
* feat(commands): Session management [Phase 1/2] command centralization and registration
* docs: add design for command registry post-review fixes
Documents the architecture decisions for fixing 5 Important issues
from code review: SubCommand pattern, Deps struct, command-group files,
Executor caching, and Telegram registration dedup.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(commands): add SubCommand type and EffectiveUsage method
Introduce SubCommand struct for declaring sub-commands structurally
within a parent command Definition. The EffectiveUsage() method
auto-generates usage strings from sub-command names and args,
preventing drift between help text and actual handler behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(commands): add Deps struct and secondToken helper, remove dead contains()
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(commands): add sub-command routing to Executor
Uses Registry.Lookup for O(1) command dispatch instead of iterating
all definitions. Definitions with SubCommands are routed to matching
sub-command handlers. Missing or unknown sub-commands reply with
auto-generated usage.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): split into command-group files with Deps injection
Extract show/list/start/help into individual cmd_*.go files.
Replace config.Config parameter with Deps struct for runtime data.
Restore /show agents and /list agents sub-commands.
Use EffectiveUsage for auto-generated help text.
Bridge external callers (agent/loop.go, telegram.go) with Deps wrapper
until Task 5 fully wires the Deps fields.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* perf(commands): cache Executor in AgentLoop, wire Deps with runtime callbacks
Create Executor once in NewAgentLoop instead of per-message. Deps
closures capture AgentLoop pointer for late-bound access to
channelManager and runtime agent model.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(telegram): remove duplicate initBotCommands, keep async startCommandRegistration only
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore(commands): restore Outcome comments and annotate Deps.Config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): consolidate /switch into commands package, fix ! prefix
Move /switch model and /switch channel handling from inline loop.go
logic into cmd_switch.go using the SubCommand + Deps pattern. This
removes the OutcomePassthrough branch in handleCommand entirely.
Also replace the hardcoded "/" prefix check with commands.HasCommandPrefix
so that "!" prefixed commands are correctly routed to the Executor.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: add docs/plans to .gitignore and untrack existing files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): address code review findings
- Remove dead ExecuteResult.Reply field and unused branch in loop.go
- Extract shared agentsHandler for /show agents and /list agents
- Remove redundant firstToken/secondToken (use nthToken instead)
- Simplify Telegram startup: pass BuiltinDefinitions directly
- Centralize req.Reply nil guard in executeDefinition
- Extract unavailableMsg constant (was duplicated 5 times)
- Remove unused MessageID from Request
- Remove stale "reserved for Phase 2" comment on Deps.Config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): replace Deps with per-request Runtime
Separate stateless Registry (cached on AgentLoop) from per-request
Runtime (passed to handlers at execution time). This enables future
session management features to inject per-request context without
modifying the command registry.
- Rename Deps → Runtime, move to runtime.go
- Change Handler signature: func(ctx, req) error → func(ctx, req, rt *Runtime) error
- NewExecutor now takes (registry, runtime) — executor is created per-request
- BuiltinDefinitions() no longer takes parameters (stateless)
- AgentLoop caches cmdRegistry, builds Runtime via buildRuntime()
- Update all cmd_*.go handlers and tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* style: fix gci import grouping and godoc formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(onboard): skip legacy AGENT.md when copying embedded workspace templates
The workspace/ directory contains both AGENT.md (legacy) and AGENTS.md
(current). copyEmbeddedToTarget was copying both, causing the test
TestCopyEmbeddedToTargetUsesAgentsMarkdown to fail. Skip AGENT.md
during the walk to match the expected behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(agent): address self-review comments on loop.go
- Move cmdRegistry init into struct literal (review comment #11)
- Rename buildRuntime → buildCommandsRuntime for clarity (review comment #12)
- Add comment to default switch case explaining passthrough (review comment #13)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): address code review findings on naming and correctness
- Rename dispatcher.go → request.go (no Dispatcher type remains)
- Rename cmd_agents.go → handler_agents.go (shared handler, not a top-level command)
- Add modelMu to protect AgentInstance.Model writes in SwitchModel
- Add ListDefinitions to Runtime so /help uses registry instead of BuiltinDefinitions()
- Fix SwitchChannel message: validation-only callback should not say "Switched"
- Propagate Reply errors in executor instead of discarding with _ =
- Add HasCommandPrefix unit test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(onboard): extract legacy filename to constant
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(agent): handle commands before route error check
Move handleCommand() before the routeErr gate so global commands
(/help, /show, /switch) remain available even when routing fails.
Context-dependent commands that need a routed agent will report
"unavailable" through their nil-Runtime guards.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* revert: remove unnecessary AGENT.md skip in onboard
Reverts 02d0c04 and 74deae1. The test failure was caused by a local
leftover workspace/AGENT.md file (gitignored but embedded by go:embed).
Deleting the local file fixes the root cause; the code-level skip was
never needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: executeDefinition Unknown option
* fix(agent): use routed agent for model commands, restore Telegram command diff
- Remove modelMu: message processing is serial, no concurrent writes
- Pass routed agent to handleCommand/buildCommandsRuntime instead of
always using default agent
- GetModelInfo/SwitchModel are nil when agent is nil (route failed),
handlers reply "unavailable"
- Restore GetMyCommands + slices.Equal check before SetMyCommands to
avoid unnecessary Telegram API calls on restart
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(commands): remove unintended config mutation in SwitchModel
SwitchModel should only update the routed agent's runtime Model field.
Writing to cfg.Agents.Defaults.ModelName was a behavioral change that
corrupts the default agent config when switching a non-default agent.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(commands): move /switch channel to /check channel
/switch channel only validates availability, not actually switching.
Rename to /check channel to match actual behavior. /switch channel
now shows a redirect message pointing users to the new command.
Addresses review feedback from yinwm on PR #959.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:31:40 +00:00
|
|
|
|
"session": {
|
|
|
|
|
|
"dm_scope": "per-channel-peer",
|
|
|
|
|
|
"backlog_limit": 20
|
|
|
|
|
|
},
|
2026-02-13 12:20:33 +00:00
|
|
|
|
"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
|
|
|
|
|
|
},
|
|
|
|
|
|
"feishu": {
|
|
|
|
|
|
"enabled": false,
|
|
|
|
|
|
"app_id": "cli_xxx",
|
|
|
|
|
|
"app_secret": "xxx",
|
|
|
|
|
|
"encrypt_key": "",
|
|
|
|
|
|
"verification_token": "",
|
|
|
|
|
|
"allow_from": []
|
|
|
|
|
|
},
|
|
|
|
|
|
"qq": {
|
|
|
|
|
|
"enabled": false,
|
|
|
|
|
|
"app_id": "",
|
|
|
|
|
|
"app_secret": "",
|
|
|
|
|
|
"allow_from": []
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"tools": {
|
|
|
|
|
|
"web": {
|
2026-02-20 15:23:22 +00:00
|
|
|
|
"brave": {
|
|
|
|
|
|
"enabled": false,
|
|
|
|
|
|
"api_key": "YOUR_BRAVE_API_KEY",
|
|
|
|
|
|
"max_results": 5
|
|
|
|
|
|
},
|
|
|
|
|
|
"duckduckgo": {
|
|
|
|
|
|
"enabled": true,
|
|
|
|
|
|
"max_results": 5
|
2026-02-13 12:20:33 +00:00
|
|
|
|
}
|
2026-02-15 10:41:39 +00:00
|
|
|
|
},
|
|
|
|
|
|
"cron": {
|
|
|
|
|
|
"exec_timeout_minutes": 5
|
2026-02-13 12:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"heartbeat": {
|
|
|
|
|
|
"enabled": true,
|
|
|
|
|
|
"interval": 30
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
|
|
## CLI 命令行参考
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
| 命令 | 描述 |
|
|
|
|
|
|
| ------------------------- | ------------------ |
|
|
|
|
|
|
| `picoclaw onboard` | 初始化配置和工作区 |
|
|
|
|
|
|
| `picoclaw agent -m "..."` | 与 Agent 对话 |
|
|
|
|
|
|
| `picoclaw agent` | 交互式聊天模式 |
|
|
|
|
|
|
| `picoclaw gateway` | 启动网关 (Gateway) |
|
|
|
|
|
|
| `picoclaw status` | 显示状态 |
|
|
|
|
|
|
| `picoclaw cron list` | 列出所有定时任务 |
|
|
|
|
|
|
| `picoclaw cron add ...` | 添加定时任务 |
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
### 定时任务 / 提醒 (Scheduled Tasks)
|
|
|
|
|
|
|
|
|
|
|
|
PicoClaw 通过 `cron` 工具支持定时提醒和重复任务:
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
- **一次性提醒**: "Remind me in 10 minutes" (10分钟后提醒我) → 10分钟后触发一次
|
|
|
|
|
|
- **重复任务**: "Remind me every 2 hours" (每2小时提醒我) → 每2小时触发
|
|
|
|
|
|
- **Cron 表达式**: "Remind me at 9am daily" (每天上午9点提醒我) → 使用 cron 表达式
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
任务存储在 `~/.picoclaw/workspace/cron/` 中并自动处理。
|
|
|
|
|
|
|
|
|
|
|
|
## 🤝 贡献与路线图 (Roadmap)
|
|
|
|
|
|
|
|
|
|
|
|
欢迎提交 PR!代码库刻意保持小巧和可读。🤗
|
|
|
|
|
|
|
|
|
|
|
|
路线图即将发布...
|
|
|
|
|
|
|
|
|
|
|
|
开发者群组正在组建中,入群门槛:至少合并过 1 个 PR。
|
|
|
|
|
|
|
|
|
|
|
|
用户群组:
|
|
|
|
|
|
|
2026-02-21 07:33:35 +00:00
|
|
|
|
Discord: [https://discord.gg/V4sAZ9XWpN](https://discord.gg/V4sAZ9XWpN)
|
2026-02-13 12:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
<img src="assets/wechat.png" alt="PicoClaw" width="512">
|
|
|
|
|
|
|
|
|
|
|
|
## 🐛 疑难解答 (Troubleshooting)
|
|
|
|
|
|
|
|
|
|
|
|
### 网络搜索提示 "API 配置问题"
|
|
|
|
|
|
|
|
|
|
|
|
如果您尚未配置搜索 API Key,这是正常的。PicoClaw 会提供手动搜索的帮助链接。
|
|
|
|
|
|
|
|
|
|
|
|
启用网络搜索:
|
|
|
|
|
|
|
2026-02-22 16:30:14 +00:00
|
|
|
|
1. 在 [https://tavily.com](https://tavily.com) (1000 次免费) 或 [https://brave.com/search/api](https://brave.com/search/api) 获取免费 API Key (2000 次免费)
|
2026-02-13 12:20:33 +00:00
|
|
|
|
2. 添加到 `~/.picoclaw/config.json`:
|
2026-02-21 07:33:35 +00:00
|
|
|
|
|
2026-02-13 12:20:33 +00:00
|
|
|
|
```json
|
|
|
|
|
|
{
|
|
|
|
|
|
"tools": {
|
|
|
|
|
|
"web": {
|
2026-02-20 15:23:22 +00:00
|
|
|
|
"brave": {
|
|
|
|
|
|
"enabled": false,
|
2026-02-13 12:20:33 +00:00
|
|
|
|
"api_key": "YOUR_BRAVE_API_KEY",
|
|
|
|
|
|
"max_results": 5
|
2026-02-20 15:23:22 +00:00
|
|
|
|
},
|
|
|
|
|
|
"duckduckgo": {
|
|
|
|
|
|
"enabled": true,
|
|
|
|
|
|
"max_results": 5
|
2026-02-13 12:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 遇到内容过滤错误 (Content Filtering Errors)
|
|
|
|
|
|
|
|
|
|
|
|
某些提供商(如智谱)有严格的内容过滤。尝试改写您的问题或使用其他模型。
|
|
|
|
|
|
|
|
|
|
|
|
### Telegram bot 提示 "Conflict: terminated by other getUpdates"
|
|
|
|
|
|
|
|
|
|
|
|
这表示有另一个机器人实例正在运行。请确保同一时间只有一个 `picoclaw gateway` 进程在运行。
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 📝 API Key 对比
|
|
|
|
|
|
|
2026-02-22 16:30:14 +00:00
|
|
|
|
| 服务 | 免费层级 | 适用场景 |
|
|
|
|
|
|
| --- | --- | --- |
|
|
|
|
|
|
| **OpenRouter** | 200K tokens/月 | 多模型聚合 (Claude, GPT-4 等) |
|
2026-03-12 08:10:29 +00:00
|
|
|
|
| **火山引擎 CodingPlan** | 9.9 元/首月 | 最适合国内用户,多种 SOTA 模型(豆包、DeepSeek 等) |
|
|
|
|
|
|
| **智谱 (Zhipu)** | 200K tokens/月 | 适合中国用户 |
|
2026-02-22 16:30:14 +00:00
|
|
|
|
| **Brave Search** | 2000 次查询/月 | 网络搜索功能 |
|
|
|
|
|
|
| **Tavily** | 1000 次查询/月 | AI Agent 搜索优化 |
|
|
|
|
|
|
| **Groq** | 提供免费层级 | 极速推理 (Llama, Mixtral) |
|
2026-03-11 18:34:42 +00:00
|
|
|
|
| **LongCat** | 最多 5M tokens/天 | 推理速度快 (免费额度) |
|
2026-03-13 06:02:23 +00:00
|
|
|
|
| **ModelScope (魔搭)** | 2000 次请求/天 | 免费推理 (Qwen, GLM, DeepSeek 等) |
|
2026-03-12 08:10:29 +00:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
<div align="center">
|
|
|
|
|
|
<img src="assets/logo.jpg" alt="PicoClaw Meme" width="512">
|
|
|
|
|
|
</div>
|