Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0d5d1a8
feat(commands): Session management [Phase 1/2] command centralization…
mingmxren Mar 3, 2026
6a6d2c9
docs: add design for command registry post-review fixes
mingmxren Mar 3, 2026
9f61d50
feat(commands): add SubCommand type and EffectiveUsage method
mingmxren Mar 3, 2026
c940133
feat(commands): add Deps struct and secondToken helper, remove dead c…
mingmxren Mar 3, 2026
a3419c6
feat(commands): add sub-command routing to Executor
mingmxren Mar 3, 2026
a100374
refactor(commands): split into command-group files with Deps injection
mingmxren Mar 3, 2026
534f55d
perf(commands): cache Executor in AgentLoop, wire Deps with runtime c…
mingmxren Mar 3, 2026
77a0957
fix(telegram): remove duplicate initBotCommands, keep async startComm…
mingmxren Mar 3, 2026
3f388a0
chore(commands): restore Outcome comments and annotate Deps.Config
mingmxren Mar 3, 2026
ac3b00e
refactor(commands): consolidate /switch into commands package, fix ! …
mingmxren Mar 3, 2026
ef86148
chore: add docs/plans to .gitignore and untrack existing files
mingmxren Mar 3, 2026
c2fc9f3
refactor(commands): address code review findings
mingmxren Mar 3, 2026
58f7b5b
refactor(commands): replace Deps with per-request Runtime
mingmxren Mar 3, 2026
aead637
style: fix gci import grouping and godoc formatting
mingmxren Mar 3, 2026
3c2b6e8
fix(onboard): skip legacy AGENT.md when copying embedded workspace te…
mingmxren Mar 3, 2026
7a43c3e
refactor(agent): address self-review comments on loop.go
mingmxren Mar 3, 2026
ba7ec07
refactor(commands): address code review findings on naming and correc…
mingmxren Mar 4, 2026
9e6c2b2
refactor(onboard): extract legacy filename to constant
mingmxren Mar 4, 2026
c4dfc1b
fix(agent): handle commands before route error check
mingmxren Mar 4, 2026
d898ec7
revert: remove unnecessary AGENT.md skip in onboard
mingmxren Mar 4, 2026
c87533e
fix: executeDefinition Unknown option
mingmxren Mar 4, 2026
75f1b58
fix(agent): use routed agent for model commands, restore Telegram com…
mingmxren Mar 5, 2026
d248c91
fix(commands): remove unintended config mutation in SwitchModel
mingmxren Mar 5, 2026
a963826
refactor(commands): move /switch channel to /check channel
mingmxren Mar 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ ralph/
.ralph/
tasks/

# Plans
docs/plans/

# Editors
.vscode/
.idea/
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,13 @@ Talk to your picoclaw through Telegram, Discord, WhatsApp, DingTalk, LINE, or We
picoclaw gateway
```

**4. Telegram command menu (auto-registered at startup)**

PicoClaw now keeps command definitions in one shared registry. On startup, Telegram will automatically register supported bot commands (for example `/start`, `/help`, `/show`, `/list`) so command menu and runtime behavior stay in sync.
Telegram command menu registration remains channel-local discovery UX; generic command execution is handled centrally in the agent loop via the commands executor.

If command registration fails (network/API transient errors), the channel still starts and PicoClaw retries registration in the background.

</details>

<details>
Expand Down Expand Up @@ -735,6 +742,12 @@ For advanced/test setups, you can override the builtin skills root with:
export PICOCLAW_BUILTIN_SKILLS=/path/to/skills
```

### Unified Command Execution Policy

- Generic slash commands are executed through a single path in `pkg/agent/loop.go` via `commands.Executor`.
- Channel adapters no longer consume generic commands locally; they forward inbound text to the bus/agent path. Telegram still auto-registers supported commands at startup.
- Unknown slash command (for example `/foo`) passes through to normal LLM processing.
- Registered but unsupported command on the current channel (for example `/show` on WhatsApp) returns an explicit user-facing error and stops further processing.
### 🔒 Security Sandbox

PicoClaw runs in a sandboxed environment by default. The agent can only access files and execute commands within the configured workspace.
Expand Down Expand Up @@ -1190,6 +1203,10 @@ picoclaw agent -m "Hello"
"model": "anthropic/claude-opus-4-5"
}
},
"session": {
"dm_scope": "per-channel-peer",
"backlog_limit": 20
},
"providers": {
"openrouter": {
"api_key": "sk-or-v1-xxx"
Expand Down
17 changes: 17 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,13 @@ PicoClaw 支持多种聊天平台,使您的 Agent 能够连接到任何地方
| **OneBot** | ⭐⭐ 中等 | 兼容 NapCat/Go-CQHTTP,社区生态丰富 | [查看文档](docs/channels/onebot/README.zh.md) |
| **MaixCam** | ⭐ 简单 | 专为 AI 摄像头设计的硬件集成通道 | [查看文档](docs/channels/maixcam/README.zh.md) |

### Telegram 命令注册(启动时自动同步)

PicoClaw 现在使用统一的命令定义来源。启动时会自动将 Telegram 支持的命令(例如 `/start`、`/help`、`/show`、`/list`)注册到 Bot 命令菜单,确保菜单展示与实际行为一致。
Telegram 侧保留的是命令菜单注册能力;通用命令的实际执行统一走 Agent Loop 中的 commands executor。

如果注册因网络或 API 短暂异常失败,不会阻塞 channel 启动;系统会在后台自动重试。

## <img src="assets/clawdchat-icon.png" width="24" height="24" alt="ClawdChat"> 加入 Agent 社交网络

只需通过 CLI 或任何集成的聊天应用发送一条消息,即可将 PicoClaw 连接到 Agent 社交网络。
Expand Down Expand Up @@ -376,6 +383,12 @@ PicoClaw 将数据存储在您配置的工作区中(默认:`~/.picoclaw/work
export PICOCLAW_BUILTIN_SKILLS=/path/to/skills
```

### 统一命令执行策略

- 通用斜杠命令通过 `pkg/agent/loop.go` 中的 `commands.Executor` 统一执行。
- Channel 适配器不再在本地消费通用命令;它们只负责把入站文本转发到 bus/agent 路径。Telegram 仍会在启动时自动注册其支持的命令菜单。
- 未注册的斜杠命令(例如 `/foo`)会透传给 LLM 按普通输入处理。
- 已注册但当前 channel 不支持的命令(例如 WhatsApp 上的 `/show`)会返回明确的用户可见错误,并停止后续处理。
### 心跳 / 周期性任务 (Heartbeat)

PicoClaw 可以自动执行周期性任务。在工作区创建 `HEARTBEAT.md` 文件:
Expand Down Expand Up @@ -715,6 +728,10 @@ picoclaw agent -m "你好"
"model": "anthropic/claude-opus-4-5"
}
},
"session": {
"dm_scope": "per-channel-peer",
"backlog_limit": 20
},
"providers": {
"openrouter": {
"api_key": "sk-or-v1-xxx"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/gdamore/tcell/v2 v2.13.8
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
github.com/h2non/filetype v1.1.3
github.com/larksuite/oapi-sdk-go/v3 v3.5.3
github.com/mdp/qrterminal/v3 v3.2.1
github.com/modelcontextprotocol/go-sdk v1.3.0
Expand All @@ -37,7 +38,6 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/elliotchance/orderedmap/v3 v3.1.0 // indirect
github.com/gdamore/encoding v1.0.1 // indirect
github.com/h2non/filetype v1.1.3 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
Expand Down
Loading
Loading