first build nexus
This commit is contained in:
BIN
AI/openclaw/@eaDir/OpenClaw 多 Agent 系统设计.md@SynoEAStream
Normal file
BIN
AI/openclaw/@eaDir/OpenClaw 多 Agent 系统设计.md@SynoEAStream
Normal file
Binary file not shown.
BIN
AI/openclaw/@eaDir/OpenClaw-Agent管理指南.md@SynoEAStream
Normal file
BIN
AI/openclaw/@eaDir/OpenClaw-Agent管理指南.md@SynoEAStream
Normal file
Binary file not shown.
212
AI/openclaw/GOG-CLI-安装配置指南.md
Normal file
212
AI/openclaw/GOG-CLI-安装配置指南.md
Normal file
@@ -0,0 +1,212 @@
|
||||
#gog #gog-cli #macos
|
||||
|
||||
本文档记录在 macOS 系统上安装和配置 gog CLI 的完整步骤,以便通过命令行管理 Google Workspace(Gmail、Google Calendar、Google Drive、Google Contacts、Google Docs、Google Sheets)。
|
||||
|
||||
## 目录
|
||||
|
||||
- [前置条件](#前置条件)
|
||||
- [安装步骤](#安装步骤)
|
||||
- [配置 OAuth 凭证](#配置-oauth-凭证)
|
||||
- [解除 Google 安全限制](#解除-google-安全限制)
|
||||
- [验证配置](#验证配置)
|
||||
- [常用命令](#常用命令)
|
||||
- [故障排除](#故障排除)
|
||||
|
||||
---
|
||||
|
||||
## 前置条件
|
||||
|
||||
- macOS 系统
|
||||
- Homebrew 已安装
|
||||
- Google 账号
|
||||
|
||||
---
|
||||
|
||||
## 安装步骤
|
||||
|
||||
### 1. 安装 gog CLI
|
||||
|
||||
使用 Homebrew 安装 gog CLI:
|
||||
|
||||
```bash
|
||||
brew install steipete/tap/gogcli
|
||||
```
|
||||
|
||||
验证安装:
|
||||
|
||||
```bash
|
||||
which gog
|
||||
# 输出: /opt/homebrew/bin/gog
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 配置 OAuth 凭证
|
||||
|
||||
### 1. 在 Google Cloud Console 创建 OAuth 凭证
|
||||
|
||||
1. 打开 [Google Cloud Console - Credentials](https://console.cloud.google.com/apis/credentials)
|
||||
2. 点击 **「创建凭证」** → 选择 **「OAuth 客户端 ID」**
|
||||
3. 应用类型选择 **「桌面应用」**
|
||||
4. 命名(例如:`gogcli`)
|
||||
5. 点击 **「创建」**
|
||||
6. 点击 **「下载 JSON」**,得到 `credentials.json` 文件
|
||||
|
||||
### 2. 移动凭证文件到 gogcli 配置目录
|
||||
|
||||
创建 gogcli 配置目录(如果不存在):
|
||||
|
||||
```bash
|
||||
mkdir -p "/Users/weishen/Library/Application Support/gogcli"
|
||||
```
|
||||
|
||||
移动下载的凭证文件:
|
||||
|
||||
```bash
|
||||
mv ~/Downloads/credentials.json "/Users/weishen/Library/Application Support/gogcli/credentials.json"
|
||||
```
|
||||
|
||||
或者使用命令指定凭证路径:
|
||||
|
||||
```bash
|
||||
gog auth credentials /path/to/credentials.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 解除 Google 安全限制
|
||||
|
||||
### 问题描述
|
||||
|
||||
首次授权时,Google 会显示以下错误:
|
||||
|
||||
> 此应用未经 Google 验证
|
||||
> 此应用请求访问您 Google 账号中的敏感信息。在开发者让该应用通过 Google 验证之前,请勿使用该应用。
|
||||
|
||||
### 解决方法:添加测试用户
|
||||
|
||||
1. 打开 [Google Cloud Console - Credentials](https://console.cloud.google.com/apis/credentials)
|
||||
2. 找到你创建的 OAuth 客户端ID,点击进入详情
|
||||
3. 找到 **「测试用户」** 部分
|
||||
4. 点击 **「添加用户」**
|
||||
5. 输入你的 Google 邮箱:`ishenwei@gmail.com`
|
||||
6. 保存
|
||||
|
||||
添加测试用户后,重新运行授权命令即可:
|
||||
|
||||
```bash
|
||||
gog auth add ishenwei@gmail.com --services gmail,calendar,drive,contacts,docs,sheets
|
||||
```
|
||||
|
||||
这会打开浏览器让你登录 Google 账号并授权。
|
||||
|
||||
---
|
||||
|
||||
## 验证配置
|
||||
|
||||
### 1. 查看已授权的账号
|
||||
|
||||
```bash
|
||||
gog auth list
|
||||
```
|
||||
|
||||
### 2. 测试 Gmail
|
||||
|
||||
```bash
|
||||
gog gmail search "newer_than:1d" --max 5
|
||||
```
|
||||
|
||||
### 3. 测试 Calendar
|
||||
|
||||
```bash
|
||||
gog calendar events primary --from 2026-01-01 --to 2026-12-31
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 常用命令
|
||||
|
||||
### Gmail
|
||||
|
||||
| 功能 | 命令 |
|
||||
|------|------|
|
||||
| 搜索邮件 | `gog gmail search 'newer_than:7d' --max 10` |
|
||||
| 发送邮件 | `gog gmail send --to a@b.com --subject "Hi" --body "Hello"` |
|
||||
| 发送邮件(多行) | `gog gmail send --to a@b.com --subject "Hi" --body-file ./message.txt` |
|
||||
| 创建草稿 | `gog gmail drafts create --to a@b.com --subject "Hi" --body-file ./message.txt` |
|
||||
| 发送草稿 | `gog gmail drafts send <draftId>` |
|
||||
|
||||
### Calendar
|
||||
|
||||
| 功能 | 命令 |
|
||||
|------|------|
|
||||
| 查看事件 | `gog calendar events <calendarId> --from <iso> --to <iso>` |
|
||||
| 创建事件 | `gog calendar create <calendarId> --summary "Title" --from <iso> --to <iso>` |
|
||||
| 查看颜色 | `gog calendar colors` |
|
||||
|
||||
### Drive
|
||||
|
||||
| 功能 | 命令 |
|
||||
|------|------|
|
||||
| 搜索文件 | `gog drive search "query" --max 10` |
|
||||
|
||||
### Contacts
|
||||
|
||||
| 功能 | 命令 |
|
||||
|------|------|
|
||||
| 列出联系人 | `gog contacts list --max 20` |
|
||||
|
||||
### Sheets
|
||||
|
||||
| 功能 | 命令 |
|
||||
|------|------|
|
||||
| 获取数据 | `gog sheets get <sheetId> "Tab!A1:D10" --json` |
|
||||
| 更新数据 | `gog sheets update <sheetId> "Tab!A1:B2" --values-json '[["A","B"],["1","2"]]' --input USER_ENTERED` |
|
||||
|
||||
### Docs
|
||||
|
||||
| 功能 | 命令 |
|
||||
|------|------|
|
||||
| 导出文档 | `gog docs export <docId> --format txt --out /tmp/doc.txt` |
|
||||
| 查看内容 | `gog docs cat <docId>` |
|
||||
|
||||
---
|
||||
|
||||
## 故障排除
|
||||
|
||||
### 凭证文件路径错误
|
||||
|
||||
确保凭证文件在以下位置:
|
||||
```
|
||||
/Users/weishen/Library/Application Support/gogcli/credentials.json
|
||||
```
|
||||
|
||||
### 需要重新授权
|
||||
|
||||
删除现有授权并重新授权:
|
||||
|
||||
```bash
|
||||
gog auth remove ishenwei@gmail.com
|
||||
gog auth add ishenwei@gmail.com --services gmail,calendar,drive,contacts,docs,sheets
|
||||
```
|
||||
|
||||
### 设置默认账号
|
||||
|
||||
避免每次重复指定账号:
|
||||
|
||||
```bash
|
||||
export GOG_ACCOUNT=ishenwei@gmail.com
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 参考链接
|
||||
|
||||
- gog 官网: https://gogcli.sh
|
||||
- gog GitHub: https://github.com/steipete/gogcli
|
||||
- Google Cloud Console: https://console.cloud.google.com/
|
||||
|
||||
---
|
||||
|
||||
*文档创建日期: 2026-03-15*
|
||||
*最后更新: 2026-03-15*
|
||||
326
AI/openclaw/OpenClaw Agent 命名与架构设计参考文档.md
Normal file
326
AI/openclaw/OpenClaw Agent 命名与架构设计参考文档.md
Normal file
@@ -0,0 +1,326 @@
|
||||
#openclaw #agent
|
||||
|
||||
```table-of-contents
|
||||
```
|
||||
|
||||
# 1. 架构设计目标
|
||||
|
||||
该 Agent 架构基于 **OpenClaw 多节点智能体系统**,通过不同服务器部署不同职责的 Agent,并通过统一命名体系构建一个清晰、可扩展的 AI Agent 生态。
|
||||
|
||||
整体设计目标:
|
||||
|
||||
- 形成 **清晰的职责分层**
|
||||
- 建立 **统一的命名体系**
|
||||
- 支持 **未来扩展更多 Agent**
|
||||
- 便于 **星枢统一调度**
|
||||
|
||||
设计采用 **三层体系结构**:
|
||||
|
||||
| 层级 | 系列 | 含义 | 主要职责 |
|
||||
| --- | --- | ---- | ------------ |
|
||||
| 控制层 | 星系 | 星辰统御 | 调度、管理、智能决策 |
|
||||
| 技术层 | 云系 | 云海算力 | 开发、架构、监控 |
|
||||
| 执行层 | 风系 | 风行万里 | 测试、业务执行、流程处理 |
|
||||
|
||||
这种结构类似于 **AI Agent 操作系统**:
|
||||
```
|
||||
控制层(星)
|
||||
↓
|
||||
技术层(云)
|
||||
↓
|
||||
执行层(风)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 2. 当前 Agent 架构
|
||||
|
||||
## 2.1 Mac Mini(中央控制节点)
|
||||
|
||||
定位:
|
||||
|
||||
- AI Agent 中枢
|
||||
- 调度中心
|
||||
- 个人与 IT 管理
|
||||
|
||||
|Agent|名字|角色|职责|
|
||||
|---|---|---|---|
|
||||
|星枢|Master Orchestrator|总调度|统一调度所有 Agent|
|
||||
|星曜|IT 管家|IT 管理|服务器、环境、运维|
|
||||
|星辉|个人助理|Assistant|日常任务与个人事务|
|
||||
|
||||
架构示意:
|
||||
|
||||
```
|
||||
Mac Mini
|
||||
├─ 星枢(总调度)
|
||||
├─ 星曜(IT管家)
|
||||
└─ 星辉(个人助理)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 3. Ubuntu2(开发服务器)
|
||||
|
||||
定位:
|
||||
|
||||
- 技术研发
|
||||
- 架构设计
|
||||
- 自动化构建
|
||||
- 系统监控
|
||||
|
||||
Agent 命名统一以 **“云”开头**。
|
||||
|
||||
## 3.1 已有 Agent
|
||||
|
||||
| Agent | 职责 | |
|
||||
| ----- | ----------------------------------- | ---------------- |
|
||||
| 云瀚 | 监控系统 | 云海浩瀚,象征监控全局系统状态。 |
|
||||
| 云策 | - 架构设计<br>- 技术方案<br>- 系统规划 | 云中筹策,技术谋略。 |
|
||||
| 云匠 | - 代码开发<br>- 构建<br>- 工程实现 | 云端工匠 |
|
||||
| 云织 | - CI/CD<br>- 自动化流程<br>- pipeline 编排 | 织云为网 |
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 3.3 Ubuntu2 最终推荐结构
|
||||
|
||||
```
|
||||
Ubuntu2(开发服务器)
|
||||
|
||||
云瀚 监控
|
||||
云策 架构设计
|
||||
云匠 开发实现
|
||||
云织 CI/CD自动化
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 4. Ubuntu1(准生产服务器)
|
||||
|
||||
定位:
|
||||
|
||||
- QA 测试
|
||||
- 业务执行
|
||||
- 自动任务
|
||||
- 审计规则
|
||||
|
||||
Agent 统一使用 **“风”系列命名**。
|
||||
|
||||
原因:
|
||||
|
||||
> 风代表执行、速度、行动。
|
||||
|
||||
| Agent | 职责 | |
|
||||
| ----- | ---------------------------- | ----- |
|
||||
| 风衡 | - QA 测试<br>- 自动测试<br>- 质量控制 | 风中权衡。 |
|
||||
| 风驰 | - 自动任务<br>- Job 执行<br>- 业务流程 | 风驰电掣。 |
|
||||
| 风纪 | - 规则执行<br>- 审计<br>- 合规 | 风纪法度 |
|
||||
|
||||
---
|
||||
|
||||
## 4.2 Ubuntu1 推荐结构
|
||||
|
||||
```
|
||||
Ubuntu1(准生产服务器)
|
||||
|
||||
风衡 QA测试
|
||||
风驰 自动执行
|
||||
风纪 规则审计
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 5. 完整 Agent 架构
|
||||
|
||||
最终整体结构:
|
||||
|
||||
```
|
||||
星枢
|
||||
(总调度 Agent)
|
||||
│
|
||||
┌────────────┼────────────┐
|
||||
│ │ │
|
||||
星曜 星辉 服务器集群
|
||||
(IT管家) (个人助理) │
|
||||
│
|
||||
┌────────────┴────────────┐
|
||||
│ │
|
||||
Ubuntu2 Ubuntu1
|
||||
(开发服务器) (准生产)
|
||||
│ │
|
||||
┌───────┼───────┐ ┌───────┼───────┐
|
||||
│ │ │ │ │ │
|
||||
云瀚 云策 云匠 风衡 风驰 风纪
|
||||
监控 架构 开发 QA 执行 审计
|
||||
│
|
||||
云织
|
||||
CI/CD
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 6. Agent 体系总结
|
||||
|
||||
|系列|含义|角色类型|
|
||||
|---|---|---|
|
||||
|星|星辰|调度 / 管理|
|
||||
|云|云海|技术 / 开发|
|
||||
|风|风行|执行 / 流程|
|
||||
|
||||
---
|
||||
|
||||
## 星系 Agent
|
||||
|
||||
|Agent|职责|
|
||||
|---|---|
|
||||
|星枢|总调度|
|
||||
|星曜|IT 管理|
|
||||
|星辉|助手|
|
||||
|
||||
未来可扩展:
|
||||
|
||||
|Agent|角色|
|
||||
|---|---|
|
||||
|星策|战略规划|
|
||||
|星典|知识管理|
|
||||
|
||||
---
|
||||
|
||||
## 云系 Agent
|
||||
|
||||
|Agent|职责|
|
||||
|---|---|
|
||||
|云瀚|监控|
|
||||
|云策|架构|
|
||||
|云匠|开发|
|
||||
|云织|CI/CD|
|
||||
|
||||
---
|
||||
|
||||
## 风系 Agent
|
||||
|
||||
|Agent|职责|
|
||||
|---|---|
|
||||
|风衡|QA|
|
||||
|风驰|自动执行|
|
||||
|风纪|审计|
|
||||
|
||||
---
|
||||
|
||||
# 7. 设计优势
|
||||
|
||||
该 Agent 命名体系具有以下优点:
|
||||
|
||||
### 1. 语义清晰
|
||||
|
||||
看到名字即可理解职责。
|
||||
|
||||
例如:
|
||||
|
||||
- 云匠 → 开发
|
||||
|
||||
- 风衡 → QA
|
||||
|
||||
- 星枢 → 调度
|
||||
|
||||
|
||||
---
|
||||
|
||||
### 2. 层级清晰
|
||||
|
||||
```
|
||||
星(控制)
|
||||
↓
|
||||
云(技术)
|
||||
↓
|
||||
风(执行)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 3. 易于扩展
|
||||
|
||||
未来可以继续增加:
|
||||
|
||||
云系:
|
||||
|
||||
- 云图(数据)
|
||||
|
||||
- 云阵(基础设施)
|
||||
|
||||
- 云算(AI计算)
|
||||
|
||||
|
||||
风系:
|
||||
|
||||
- 风策(业务策略)
|
||||
|
||||
- 风行(业务执行)
|
||||
|
||||
- 风巡(巡检)
|
||||
|
||||
|
||||
---
|
||||
|
||||
### 4. 非常适合 Agent 调度
|
||||
|
||||
星枢可以统一调度:
|
||||
|
||||
```
|
||||
星枢 → 云系 → 风系
|
||||
```
|
||||
|
||||
示例:
|
||||
|
||||
```
|
||||
星枢
|
||||
↓
|
||||
云策(制定方案)
|
||||
↓
|
||||
云匠(开发)
|
||||
↓
|
||||
云织(部署)
|
||||
↓
|
||||
风衡(测试)
|
||||
↓
|
||||
风驰(执行)
|
||||
```
|
||||
|
||||
形成完整 **AI 自动化流水线**。
|
||||
|
||||
---
|
||||
|
||||
# 8. 最终推荐部署
|
||||
|
||||
### Mac Mini
|
||||
|
||||
```
|
||||
星枢
|
||||
星曜
|
||||
星辉
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Ubuntu2(开发)
|
||||
|
||||
```
|
||||
云瀚
|
||||
云策
|
||||
云匠
|
||||
云织
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Ubuntu1(准生产)
|
||||
|
||||
```
|
||||
风衡
|
||||
风驰
|
||||
风纪
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
574
AI/openclaw/OpenClaw 多 Agent 系统设计.md
Normal file
574
AI/openclaw/OpenClaw 多 Agent 系统设计.md
Normal file
@@ -0,0 +1,574 @@
|
||||
|
||||
#openclaw #agent #telegram
|
||||
```table-of-contents
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# OpenClaw 多 Agent 自动化系统架构笔记 (Advanced)
|
||||
|
||||
Author: Billy
|
||||
Purpose: 构建基于 OpenClaw + Telegram + n8n 的 AI 自动化控制系统
|
||||
|
||||
---
|
||||
|
||||
# 1 系统总体架构
|
||||
|
||||
**目标:**
|
||||
|
||||
构建一个 **AI Automation Control Center**
|
||||
|
||||
**核心组件:**
|
||||
|
||||
- OpenClaw Gateway
|
||||
- 多 Agent
|
||||
- Telegram Interface
|
||||
- n8n Workflow Engine
|
||||
|
||||
**系统架构:**
|
||||
|
||||
```
|
||||
Telegram
|
||||
│
|
||||
▼
|
||||
Telegram Bot
|
||||
│
|
||||
▼
|
||||
n8n
|
||||
(Command Router)
|
||||
│
|
||||
▼
|
||||
OpenClaw Gateway
|
||||
│
|
||||
▼
|
||||
┌────────┬────────┬────────┐
|
||||
▼ ▼ ▼ ▼
|
||||
Router Dev Research Ops
|
||||
Agent Agent Agent Agent
|
||||
```
|
||||
|
||||
**系统功能:**
|
||||
|
||||
| 组件 | 作用 |
|
||||
|------|------|
|
||||
| Telegram | 用户交互 |
|
||||
| n8n | 任务路由 |
|
||||
| OpenClaw | AI Agent Runtime |
|
||||
| Agents | 任务执行 |
|
||||
|
||||
---
|
||||
|
||||
# 2 OpenClaw 基础目录结构
|
||||
|
||||
**默认路径:** `~/.openclaw/`
|
||||
|
||||
**结构:**
|
||||
|
||||
```
|
||||
.openclaw/
|
||||
│
|
||||
├── agents/
|
||||
│ │
|
||||
│ ├── main/
|
||||
│ │ └── agent/
|
||||
│ │ ├── authprofile.json
|
||||
│ │ └── models.json
|
||||
│ │
|
||||
│ └── research/
|
||||
│ └── agent/
|
||||
│ ├── authprofile.json
|
||||
│ └── models.json
|
||||
│
|
||||
└── workspace/
|
||||
│
|
||||
├── skills/
|
||||
├── memory/
|
||||
├── identity/
|
||||
│ └── Identity.md
|
||||
├── logs/
|
||||
├── devices/
|
||||
├── completions/
|
||||
└── canvas/
|
||||
```
|
||||
|
||||
**说明:**
|
||||
|
||||
| 目录 | 作用 |
|
||||
|------|------|
|
||||
| agents | Agent Profile |
|
||||
| workspace | 运行数据 |
|
||||
| skills | 技能插件 |
|
||||
| memory | AI记忆 |
|
||||
| identity | System Prompt |
|
||||
| logs | 日志 |
|
||||
|
||||
---
|
||||
|
||||
# 3 多 Agent 设计
|
||||
|
||||
**创建 Agent:**
|
||||
|
||||
```bash
|
||||
openclaw agent create dev
|
||||
openclaw agent create research
|
||||
openclaw agent create ops
|
||||
openclaw agent create orchestrator
|
||||
```
|
||||
|
||||
**推荐 Agent 列表:**
|
||||
|
||||
| Agent | 职责 |
|
||||
|-------|------|
|
||||
| orchestrator | 任务调度 |
|
||||
| dev | 编程 |
|
||||
| research | 搜索分析 |
|
||||
| ops | 服务器运维 |
|
||||
| data | 数据处理 |
|
||||
|
||||
**推荐结构:**
|
||||
|
||||
```
|
||||
agents/
|
||||
│
|
||||
├── orchestrator/
|
||||
├── dev/
|
||||
├── research/
|
||||
├── ops/
|
||||
└── data/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 4 Agent Identity 设计
|
||||
|
||||
Identity 代表:System Prompt
|
||||
|
||||
**建议放在:** `agents/dev/agent/identity.md`
|
||||
|
||||
**示例:**
|
||||
|
||||
```
|
||||
You are DevAgent.
|
||||
|
||||
Responsibilities:
|
||||
- write code
|
||||
- debug programs
|
||||
- generate scripts
|
||||
- create docker configurations
|
||||
```
|
||||
|
||||
**Research Agent:**
|
||||
|
||||
```
|
||||
You are ResearchAgent.
|
||||
|
||||
Responsibilities:
|
||||
- research information
|
||||
- summarize technical topics
|
||||
- analyze documents
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 5 Skills 机制
|
||||
|
||||
**Skills 目录:** `workspace/skills`
|
||||
|
||||
**示例:**
|
||||
|
||||
```
|
||||
skills/
|
||||
├── browser
|
||||
├── filesystem
|
||||
├── python
|
||||
├── telegram
|
||||
└── self-improving-agent
|
||||
```
|
||||
|
||||
**特点:**
|
||||
|
||||
- 所有 Agent 共享
|
||||
- 类似插件
|
||||
|
||||
---
|
||||
|
||||
# 6 Memory 设计
|
||||
|
||||
**默认 memory:** `workspace/memory`
|
||||
|
||||
默认共享。
|
||||
|
||||
**memory 类型:**
|
||||
|
||||
```
|
||||
memory/
|
||||
├── episodic
|
||||
├── semantic
|
||||
└── vector
|
||||
```
|
||||
|
||||
**推荐 Memory 分层:**
|
||||
|
||||
```
|
||||
memory/
|
||||
├── system
|
||||
├── dev
|
||||
├── research
|
||||
└── ops
|
||||
```
|
||||
|
||||
这样避免:memory pollution
|
||||
|
||||
**Agent 指定 namespace:**
|
||||
|
||||
```json
|
||||
{
|
||||
"memoryNamespace": "dev"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 7 模型配置
|
||||
|
||||
每个 Agent 独立:`agents/<agent>/agent/models.json`
|
||||
|
||||
**示例:**
|
||||
|
||||
```json
|
||||
{
|
||||
"default": "gpt-4o-mini",
|
||||
"models": {
|
||||
"gpt-4o-mini": {
|
||||
"provider": "openai",
|
||||
"model": "gpt-4o-mini"
|
||||
},
|
||||
"deepseek-coder": {
|
||||
"provider": "openai-compatible",
|
||||
"base_url": "https://api.deepseek.com/v1",
|
||||
"model": "deepseek-coder"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**推荐模型分配:**
|
||||
|
||||
| Agent | Model |
|
||||
|-------|-------|
|
||||
| orchestrator | gpt-4o-mini |
|
||||
| dev | deepseek-coder |
|
||||
| research | gpt-4o |
|
||||
| ops | claude-sonnet |
|
||||
|
||||
**优点:**
|
||||
|
||||
- 降低成本
|
||||
- 提升能力
|
||||
|
||||
---
|
||||
|
||||
# 8 Agent 切换
|
||||
|
||||
**切换 active agent:**
|
||||
|
||||
```bash
|
||||
openclaw agent use research
|
||||
```
|
||||
|
||||
**行为:**
|
||||
|
||||
```
|
||||
current_agent = research
|
||||
```
|
||||
|
||||
下一条消息:
|
||||
|
||||
```
|
||||
Telegram → research agent
|
||||
```
|
||||
|
||||
不需要重启 Gateway。
|
||||
|
||||
---
|
||||
|
||||
# 9 Telegram 集成
|
||||
|
||||
OpenClaw 支持:Telegram Bot
|
||||
|
||||
**结构:**
|
||||
|
||||
```
|
||||
Telegram
|
||||
│
|
||||
▼
|
||||
OpenClaw Gateway
|
||||
```
|
||||
|
||||
**默认:** 所有消息 → active agent
|
||||
|
||||
---
|
||||
|
||||
# 10 Telegram 指令体系
|
||||
|
||||
**推荐命令:**
|
||||
|
||||
```
|
||||
/dev
|
||||
/research
|
||||
/ops
|
||||
/data
|
||||
/help
|
||||
```
|
||||
|
||||
**示例:**
|
||||
|
||||
```
|
||||
/dev 写一个python脚本
|
||||
/research 查一下OpenClaw架构
|
||||
/ops restart docker
|
||||
```
|
||||
|
||||
在 BotFather 设置:`/setcommands`
|
||||
|
||||
**示例:**
|
||||
|
||||
```
|
||||
dev - coding tasks
|
||||
research - research tasks
|
||||
ops - server tasks
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 11 n8n Command Router
|
||||
|
||||
推荐使用:n8n 进行任务路由。
|
||||
|
||||
**架构:**
|
||||
|
||||
```
|
||||
Telegram
|
||||
│
|
||||
▼
|
||||
n8n
|
||||
│
|
||||
▼
|
||||
OpenClaw
|
||||
```
|
||||
|
||||
**Workflow:**
|
||||
|
||||
```
|
||||
Telegram Trigger
|
||||
│
|
||||
▼
|
||||
Parse Command
|
||||
│
|
||||
▼
|
||||
Agent Router
|
||||
│
|
||||
▼
|
||||
HTTP → OpenClaw
|
||||
```
|
||||
|
||||
**解析示例:**
|
||||
|
||||
```javascript
|
||||
const msg = $json.message.text
|
||||
|
||||
if(msg.startsWith("/dev")){
|
||||
return {agent:"dev"}
|
||||
}
|
||||
|
||||
if(msg.startsWith("/research")){
|
||||
return {agent:"research"}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 12 Router Agent
|
||||
|
||||
Router Agent 负责:Task Distribution
|
||||
|
||||
**Prompt 示例:**
|
||||
|
||||
```
|
||||
You are a routing agent.
|
||||
|
||||
Rules:
|
||||
/dev → DevAgent
|
||||
/research → ResearchAgent
|
||||
/ops → OpsAgent
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 13 推荐系统架构
|
||||
|
||||
Mac Mini AI Control Center:
|
||||
|
||||
```
|
||||
Mac Mini
|
||||
│
|
||||
├─ OpenClaw Gateway
|
||||
├─ n8n
|
||||
└─ Telegram Bot
|
||||
|
||||
Agents
|
||||
│
|
||||
├─ orchestrator
|
||||
├─ dev
|
||||
├─ research
|
||||
├─ ops
|
||||
└─ data
|
||||
```
|
||||
|
||||
**数据流:**
|
||||
|
||||
```
|
||||
Telegram
|
||||
↓
|
||||
n8n Router
|
||||
↓
|
||||
OpenClaw
|
||||
↓
|
||||
Agents
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 14 高级玩法
|
||||
|
||||
**支持:**
|
||||
|
||||
### 多服务器 Agent
|
||||
|
||||
```
|
||||
Mac Mini
|
||||
orchestrator
|
||||
|
||||
Ubuntu Server
|
||||
dev agent
|
||||
|
||||
NAS
|
||||
data agent
|
||||
```
|
||||
|
||||
**通信:**
|
||||
|
||||
```
|
||||
HTTP
|
||||
Redis
|
||||
MQ
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 15 最佳实践
|
||||
|
||||
### 1 Agent 专业化
|
||||
|
||||
**正确:**
|
||||
|
||||
```
|
||||
dev-agent
|
||||
ops-agent
|
||||
research-agent
|
||||
```
|
||||
|
||||
**错误:**
|
||||
|
||||
```
|
||||
python-agent
|
||||
browser-agent
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 2 模型分工
|
||||
|
||||
不要所有 agent 使用同一个模型。
|
||||
|
||||
**否则:**
|
||||
|
||||
```
|
||||
multi-agent ≈ single-agent
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 3 Memory 分层
|
||||
|
||||
**推荐:**
|
||||
|
||||
```
|
||||
memory/
|
||||
├── system
|
||||
├── dev
|
||||
├── research
|
||||
└── ops
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 4 Router 统一入口
|
||||
|
||||
**不要:**
|
||||
|
||||
```
|
||||
Telegram → 各 agent
|
||||
```
|
||||
|
||||
**应该:**
|
||||
|
||||
```
|
||||
Telegram → Router → Agents
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 16 最终架构总结
|
||||
|
||||
**最终系统:**
|
||||
|
||||
```
|
||||
Telegram
|
||||
│
|
||||
▼
|
||||
n8n Router
|
||||
│
|
||||
▼
|
||||
OpenClaw Gateway
|
||||
│
|
||||
▼
|
||||
┌──────────────┬──────────────┬──────────────┐
|
||||
DevAgent ResearchAgent OpsAgent
|
||||
```
|
||||
|
||||
**系统特点:**
|
||||
|
||||
- 多 Agent
|
||||
- 多模型
|
||||
- 自动任务分发
|
||||
- Telegram 控制
|
||||
- 自动化工作流
|
||||
|
||||
---
|
||||
|
||||
# 17 未来扩展
|
||||
|
||||
**未来可扩展:**
|
||||
|
||||
- AI 自动任务
|
||||
- 自动服务器运维
|
||||
- 自动代码生成
|
||||
- 自动数据分析
|
||||
- 自动监控告警
|
||||
|
||||
**目标:** 构建 Personal AI Operations Center
|
||||
|
||||
|
||||
|
||||
|
||||
194
AI/openclaw/OpenClaw-Agent管理指南.md
Normal file
194
AI/openclaw/OpenClaw-Agent管理指南.md
Normal file
@@ -0,0 +1,194 @@
|
||||
# OpenClaw Agent 管理指南
|
||||
|
||||
> 创建日期: 2026-03-15
|
||||
> 作者: 星曜
|
||||
|
||||
---
|
||||
|
||||
## 1. 创建新 Agent
|
||||
|
||||
### 基本命令
|
||||
|
||||
```bash
|
||||
openclaw agents add <agent-name> --non-interactive --workspace <workspace-path>
|
||||
```
|
||||
|
||||
### 参数说明
|
||||
|
||||
| 参数 | 说明 |
|
||||
| ------------------- | ----------------- |
|
||||
| `<agent-name>` | Agent 名称(唯一标识) |
|
||||
| `--non-interactive` | 跳过交互式提示,自动创建 |
|
||||
| `--workspace` | 指定 workspace 目录路径 |
|
||||
|
||||
### 示例
|
||||
|
||||
```bash
|
||||
# 创建名为 xinghui 的 agent
|
||||
openclaw agents add xinghui --non-interactive --workspace ~/.openclaw/workspace-agent-xinghui
|
||||
|
||||
# 创建名为 xingyao 的 agent(复制现有workspace)
|
||||
openclaw agents add xingyao --non-interactive --workspace ~/.openclaw/workspace-agent-xingyao
|
||||
```
|
||||
|
||||
### Workspace 路径规范
|
||||
|
||||
- 格式: `~/.openclaw/workspace-agent-<agent-name>`
|
||||
- 示例: `~/.openclaw/workspace-agent-xinghui`
|
||||
|
||||
---
|
||||
|
||||
## 2. 复制 Workspace 到新 Agent
|
||||
|
||||
### 场景
|
||||
创建一个与现有 agent(通常是 main)拥有相同内容的 workspace
|
||||
|
||||
### 方法一:rsync 复制(推荐)
|
||||
|
||||
```bash
|
||||
rsync -av --exclude='.git' /Users/weishen/.openclaw/workspace/ /Users/weishen/.openclaw/workspace-agent-xingyao/
|
||||
```
|
||||
|
||||
### 方法二:软链接共享记忆
|
||||
|
||||
如果想让多个 agent 共享记忆(MEMORY.md 和 memory/ 目录):
|
||||
|
||||
```bash
|
||||
# 为新 agent 创建软链接
|
||||
ln -sf /Users/weishen/.openclaw/workspace/memory /Users/weishen/.openclaw/workspace-agent-<agent-name>/memory
|
||||
ln -sf /Users/weishen/.openclaw/workspace/MEMORY.md /Users/weishen/.openclaw/workspace-agent-<agent-name>/MEMORY.md
|
||||
```
|
||||
|
||||
**注意**: 共用 workspace 可能导致配置冲突,建议独立 workspace + 软链接共享 memory 目录
|
||||
|
||||
---
|
||||
|
||||
## 3. 绑定 Agent 到 Channel
|
||||
|
||||
### 查看当前绑定
|
||||
|
||||
```bash
|
||||
openclaw agents bindings
|
||||
```
|
||||
|
||||
### 绑定命令
|
||||
|
||||
```bash
|
||||
openclaw agents bind --agent <agent-name> --bind <channel>:<accountId>
|
||||
```
|
||||
|
||||
### 参数说明
|
||||
|
||||
| 参数 | 说明 |
|
||||
| -------------- | ----------------------------------- |
|
||||
| `<agent-name>` | 要绑定的 agent 名称 |
|
||||
| `<channel>` | 频道类型(telegram, discord, whatsapp 等) |
|
||||
| `<accountId>` | 账号 ID(数字形式) |
|
||||
|
||||
### 示例[[How to get Youtube Channel ID]]
|
||||
|
||||
```bash
|
||||
# 绑定 xinghui 到 Telegram
|
||||
openclaw agents bind --agent xinghui --bind telegram:5038825565
|
||||
|
||||
# 绑定 xingyao 到 Telegram
|
||||
openclaw agents bind --agent xingyao --bind telegram:5038825565
|
||||
```
|
||||
|
||||
### 解绑
|
||||
|
||||
```bash
|
||||
# 解绑指定 channel
|
||||
openclaw agents unbind --bind telegram:5038825565
|
||||
|
||||
# 解绑指定 agent 的 channel
|
||||
openclaw agents unbind --agent xinghui --bind telegram:5038825565
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 删除 Agent
|
||||
|
||||
### 命令
|
||||
|
||||
```bash
|
||||
openclaw agents delete <agent-name>
|
||||
```
|
||||
|
||||
### 示例
|
||||
|
||||
```bash
|
||||
# 需要确认
|
||||
openclaw agents delete agent-macmini-001
|
||||
|
||||
# 强制删除(非交互模式)
|
||||
openclaw agents delete agent-macmini-001 --force
|
||||
```
|
||||
|
||||
### 删除效果
|
||||
- Workspace 目录移至废纸篓
|
||||
- Sessions 目录删除
|
||||
- 从配置文件移除
|
||||
|
||||
---
|
||||
|
||||
## 5. 查看 Agent 列表
|
||||
|
||||
```bash
|
||||
openclaw agents list
|
||||
```
|
||||
|
||||
### 输出示例
|
||||
|
||||
```
|
||||
Agents:
|
||||
- main (default)
|
||||
Workspace: ~/.openclaw/workspace
|
||||
Agent dir: ~/.openclaw/agents/main/agent
|
||||
Model: minimax-portal/MiniMax-M2.5
|
||||
Routing rules: 0
|
||||
Routing: default (no explicit rules)
|
||||
- xinghui
|
||||
Workspace: ~/.openclaw/workspace-agent-xinghui
|
||||
Agent dir: ~/.openclaw/agents/xinghui/agent
|
||||
Model: minimax-portal/MiniMax-M2.5
|
||||
Routing rules: 0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Agent 配置说明
|
||||
|
||||
### 默认模型
|
||||
所有新创建的 agent 默认使用: `minimax-portal/MiniMax-M2.5`
|
||||
|
||||
### 配置文件位置
|
||||
- 主配置: `~/.openclaw/openclaw.json`
|
||||
- Agent 状态: `~/.openclaw/agents/<agent-name>/agent/`
|
||||
|
||||
---
|
||||
|
||||
## 7. 常用命令速查
|
||||
|
||||
| 操作 | 命令 |
|
||||
|------|------|
|
||||
| 创建 agent | `openclaw agents add <name> --non-interactive --workspace ~/.openclaw/workspace-agent-<name>` |
|
||||
| 查看列表 | `openclaw agents list` |
|
||||
| 查看绑定 | `openclaw agents bindings` |
|
||||
| 绑定 channel | `openclaw agents bind --agent <name> --bind telegram:<id>` |
|
||||
| 解绑 channel | `openclaw agents unbind --bind telegram:<id>` |
|
||||
| 删除 agent | `openclaw agents delete <name> --force` |
|
||||
|
||||
---
|
||||
|
||||
## 8. 当前已创建的 Agent
|
||||
|
||||
| Agent 名称 | Workspace | 状态 |
|
||||
|------------|-----------|------|
|
||||
| main | ~/.openclaw/workspace | 默认 |
|
||||
| xinghui | ~/.openclaw/workspace-agent-xinghui | 独立(无共享记忆) |
|
||||
| xingyao | ~/.openclaw/workspace-agent-xingyao | 完整复制 main workspace |
|
||||
|
||||
---
|
||||
|
||||
*最后更新: 2026-03-15 14:33*
|
||||
368
AI/openclaw/Ubuntu 下 OpenClaw 安装与管理指南.md
Normal file
368
AI/openclaw/Ubuntu 下 OpenClaw 安装与管理指南.md
Normal file
@@ -0,0 +1,368 @@
|
||||
|
||||
#ubuntu #openclaw #install #uninstall
|
||||
|
||||
```table-of-contents
|
||||
```
|
||||
|
||||
## 环境概述
|
||||
|
||||
- 系统:Ubuntu 20.04 / 22.04
|
||||
- OpenClaw 安装方式:npm 用户本地全局安装openclaw & clawhub (注意不要用root user安装)
|
||||
```
|
||||
npm install -g openclaw clawhub
|
||||
```
|
||||
- 用户路径示例:
|
||||
|
||||
```bash
|
||||
/home/shenwei/.npm-global/bin/openclaw
|
||||
```
|
||||
|
||||
- 默认配置目录:
|
||||
```bash
|
||||
/home/shenwei/.openclaw
|
||||
```
|
||||
|
||||
- 用户级 systemd 服务目录:
|
||||
```bash
|
||||
/home/shenwei/.config/systemd/user/openclaw-gateway.service
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 卸载旧版本 OpenClaw
|
||||
|
||||
1. **停止正在运行的进程 / 服务**
|
||||
```bash
|
||||
# 查找进程
|
||||
ps aux | grep openclaw
|
||||
|
||||
# 如果有 systemd 用户服务
|
||||
systemctl --user stop openclaw
|
||||
systemctl --user disable openclaw
|
||||
```
|
||||
|
||||
2. **卸载 npm 安装的 OpenClaw**
|
||||
```bash
|
||||
# 全局卸载
|
||||
sudo npm uninstall -g openclaw clawhub
|
||||
|
||||
# 或者局部卸载
|
||||
npm uninstall openclaw clawhub
|
||||
```
|
||||
|
||||
3. **删除用户配置目录**
|
||||
```bash
|
||||
rm -rf /home/shenwei/.openclaw # 普通用户
|
||||
sudo rm -rf /root/.openclaw # root 用户(如果曾用 sudo 运行)
|
||||
sudo rm -rf /opt/openclaw # 如果之前手动统一过目录
|
||||
```
|
||||
|
||||
4. **清理残留 npm 包**
|
||||
```bash
|
||||
npm list -g --depth=0 | grep openclaw
|
||||
npm list -g --depth=0 | grep clawhub
|
||||
```
|
||||
如有残留再执行 `npm uninstall -g <package>`。
|
||||
|
||||
---
|
||||
|
||||
## 安装 OpenClaw
|
||||
|
||||
### 方法 A:通过 npm 安装(推荐)
|
||||
|
||||
```bash
|
||||
# 确保 npm 更新
|
||||
npm install -g npm
|
||||
|
||||
# 全局安装 OpenClaw
|
||||
npm install -g openclaw clawhub
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 配置 PATH,让 OpenClaw 在任意位置可执行
|
||||
|
||||
1. 临时生效(仅当前终端):
|
||||
```bash
|
||||
export PATH=$HOME/.npm-global/bin:$PATH
|
||||
```
|
||||
|
||||
2. 永久生效(推荐):
|
||||
- 编辑 shell 配置文件 `~/.bashrc` 或 `~/.zshrc`,添加:
|
||||
```bash
|
||||
export PATH=$HOME/.npm-global/bin:$PATH
|
||||
```
|
||||
|
||||
- 刷新配置:
|
||||
```bash
|
||||
source ~/.bashrc # bash
|
||||
source ~/.zshrc # zsh
|
||||
```
|
||||
|
||||
- 验证:
|
||||
```bash
|
||||
which openclaw
|
||||
openclaw --version
|
||||
```
|
||||
---
|
||||
|
||||
## 用户级 systemd 服务管理(OpenClaw Gateway)
|
||||
|
||||
安装 Gateway 后会生成服务文件:
|
||||
```bash
|
||||
/home/shenwei/.config/systemd/user/openclaw-gateway.service
|
||||
```
|
||||
|
||||
``` bash
|
||||
[Unit]
|
||||
Description=OpenClaw Gateway (v2026.3.13)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/node /home/shenwei/.npm-global/lib/node_modules/openclaw/dist/index.js gateway --port 18789
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
TimeoutStopSec=30
|
||||
TimeoutStartSec=30
|
||||
SuccessExitStatus=0 143
|
||||
KillMode=control-group
|
||||
Environment=HOME=/home/shenwei
|
||||
Environment=TMPDIR=/tmp
|
||||
Environment=HTTP_PROXY=http://127.0.0.1:10808
|
||||
Environment=HTTPS_PROXY=http://127.0.0.1:10808
|
||||
Environment=PATH=/home/shenwei/.local/bin:/home/shenwei/.npm-global/bin:/home/shenwei/bin:/home/shenwei/.volta/bin:/home/shenwei/.asdf/shims:/home/shenwei/.bun/bin:/>
|
||||
Environment=OPENCLAW_GATEWAY_PORT=18789
|
||||
Environment=OPENCLAW_SYSTEMD_UNIT=openclaw-gateway.service
|
||||
Environment="OPENCLAW_WINDOWS_TASK_NAME=OpenClaw Gateway"
|
||||
Environment=OPENCLAW_SERVICE_MARKER=openclaw
|
||||
Environment=OPENCLAW_SERVICE_KIND=gateway
|
||||
Environment=OPENCLAW_SERVICE_VERSION=2026.3.13
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
```
|
||||
|
||||
查看日志
|
||||
```
|
||||
|
||||
# 查看最近 50 行
|
||||
journalctl --user -u openclaw-gateway -n 50 --no-pager
|
||||
|
||||
# 实时跟踪日志
|
||||
journalctl --user -u openclaw-gateway -f
|
||||
|
||||
# 查看今天的所有日志
|
||||
journalctl --user -u openclaw-gateway --since today
|
||||
```
|
||||
|
||||
|
||||
### 常用管理命令
|
||||
|
||||
| 操作 | 命令 |
|
||||
| --------------------------- | ------------------------------------------- |
|
||||
| 启动 Gateway | `systemctl --user start openclaw-gateway` |
|
||||
| 停止 Gateway | `systemctl --user stop openclaw-gateway` |
|
||||
| 重启 Gateway | `systemctl --user restart openclaw-gateway` |
|
||||
| 查看状态 | `systemctl --user status openclaw-gateway` |
|
||||
| 开机自启 | `systemctl --user enable openclaw-gateway` |
|
||||
| 取消开机自启 | `systemctl --user disable openclaw-gateway` |
|
||||
| 刷新 systemd 配置(修改 service 后) | `systemctl --user daemon-reload` |
|
||||
|
||||
|
||||
> ⚠️ 用户级服务不需要 sudo,安全且方便。
|
||||
|
||||
---
|
||||
|
||||
## 多用户环境与避免重复环境
|
||||
|
||||
- OpenClaw 配置目录默认跟随 `$HOME`:
|
||||
|
||||
|用户|配置目录|
|
||||
|---|---|
|
||||
|shenwei|`/home/shenwei/.openclaw`|
|
||||
|root|`/root/.openclaw`|
|
||||
|
||||
- **原因**:Linux 用户隔离机制,不同用户运行 OpenClaw 会生成独立目录。
|
||||
- **注意**:
|
||||
|
||||
- 不要用 root 启动 OpenClaw,避免权限混乱
|
||||
- 统一使用普通用户安装和运行
|
||||
- 可通过 `--workdir /opt/openclaw` 指定统一目录
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 常用命令总结
|
||||
|
||||
| 命令 | 功能 |
|
||||
| --------------------------------------------------------------------- | ------------- |
|
||||
| `openclaw onboard` | 初始化新环境、设置工作目录 |
|
||||
| `openclaw --version` | 查看版本 |
|
||||
| `openclaw agent list` | 列出所有 agent |
|
||||
| `openclaw agent create --name <agent_name> --message "<description>"` | 创建新的 agent |
|
||||
| `openclaw agent delete <agent_name>` | 删除 agent |
|
||||
| `openclaw skill install <skill_name>` | 安装技能 |
|
||||
| `openclaw skill update <skill_name>` | 更新技能 |
|
||||
| `openclaw skill list` | 查看已安装技能 |
|
||||
| `openclaw memory list` | 查看记忆数据 |
|
||||
| `openclaw workspace list` | 查看工作空间 |
|
||||
| | |
|
||||
| | |
|
||||
|
||||
---
|
||||
|
||||
## 创建 Agent 与绑定 Telegram Bot
|
||||
|
||||
1. **创建 agent**
|
||||
```
|
||||
openclaw agents add <agentname> --non-interactive --workspace /home/shenwei/.openclaw/workspace-agent-<agentname> --model MiniMax-M2.5
|
||||
|
||||
```
|
||||
举例:
|
||||
```bash
|
||||
openclaw agents add yunce --non-interactive --workspace /home/shenwei/.openclaw/workspace-agent-yunce --model MiniMax-M2.5
|
||||
```
|
||||
|
||||
2. **添加Telegram 账号**
|
||||
```
|
||||
# 添加 Telegram 账号
|
||||
openclaw channels add --channel telegram --account <账号名> --token <BotToken>
|
||||
```
|
||||
举例
|
||||
```
|
||||
openclaw channels add --channel telegram --account yunhan --token 8588117769:AAFxswhHgCdBor2EOa-2oChDpI-DADRt0tQ
|
||||
```
|
||||
3. **查看 agent 列表**
|
||||
```bash
|
||||
openclaw agents list
|
||||
```
|
||||
|
||||
3. **绑定 Bot**
|
||||
```
|
||||
# 绑定 agent 到 Telegram 账号
|
||||
openclaw agents bind --agent <agent_id> --bind telegram:<account_name>
|
||||
|
||||
```
|
||||
举例
|
||||
```
|
||||
openclaw agents bind --agent yunhan --bind telegram:yunhan
|
||||
```
|
||||
|
||||
- 配置完成后重启 Gateway:
|
||||
```bash
|
||||
systemctl --user restart openclaw-gateway
|
||||
```
|
||||
|
||||
- Telegram 多 Agent 建议:
|
||||
|
||||
- 一个 bot → n8n 路由 → 多 agent
|
||||
- 避免每个 agent 都创建独立 bot(每个账号最多 20 个 bot)
|
||||
- 用命令或路径路由区分不同 agent 功能
|
||||
|
||||
---
|
||||
|
||||
## 删除Agent
|
||||
1. **删除 agent**
|
||||
```
|
||||
openclaw agents delete <agent_name> --force
|
||||
```
|
||||
2. **删除bot**
|
||||
```
|
||||
# 删除 Telegram 账号
|
||||
openclaw channels remove --channel telegram --account <account_name> --delete
|
||||
```
|
||||
|
||||
## 注意事项与避免的坑
|
||||
|
||||
1. **避免使用 root 运行**
|
||||
- root 会生成 `/root/.openclaw`,和普通用户环境冲突
|
||||
- 权限问题可能导致 agent 无法访问工作空间
|
||||
2. **避免重复 PATH 或多版本冲突**
|
||||
- 如果 npm 本地 bin 不在 PATH,会导致命令找不到
|
||||
- 如果 PATH 里还有旧版本系统全局安装路径,可能会调用错误版本
|
||||
3. **用户级 systemd 服务管理**
|
||||
- 修改 service 后必须执行 `systemctl --user daemon-reload`
|
||||
- 避免 sudo 启动服务,保证文件权限正确
|
||||
4. **Telegram Bot 限制**
|
||||
- 每个账号最多创建 20 个 bot(Premium 账号可能 40 个)
|
||||
- 多 agent 架构建议一个 bot → n8n → 多 agent 路由
|
||||
5. **统一工作目录**
|
||||
- 推荐 `/home/shenwei/.openclaw` 或 `/opt/openclaw`
|
||||
- 方便多服务器或多 agent 管理
|
||||
6. **升级和维护**
|
||||
- 升级前先备份 `.openclaw` 下的 workspace、skills、memory
|
||||
- 使用 npm 全局安装可直接 `npm install -g openclaw@latest`
|
||||
|
||||
---
|
||||
|
||||
### 参考架构示意
|
||||
|
||||
```
|
||||
Telegram Bot
|
||||
↓
|
||||
n8n Router
|
||||
↓
|
||||
OpenClaw Agents
|
||||
├─ 星枢(调度)
|
||||
├─ 星曜(IT管家)
|
||||
├─ 星辉(个人助理)
|
||||
└─ 云瀚(监控)
|
||||
```
|
||||
|
||||
|
||||
### Bot & Agent 命名
|
||||
|
||||
#### 星
|
||||
|
||||
```
|
||||
openclaw channels add --channel telegram --account xingshu --token 8787024183:AAG1M5tfSHj6Z0gMv3vvCZel2FOIX-0x8ZI
|
||||
|
||||
openclaw channels add --channel telegram --account xingyao --token 8414432613:AAG9hvKfILGSsbc1EMEZW1QVym9Quc5aHWk
|
||||
|
||||
openclaw channels add --channel telegram --account xinghui --token 8709222939:AAEfvZrvvU5vZFsmacsR5nmpkJ2Jb5JgfRg
|
||||
|
||||
```
|
||||
|
||||
| 服务器 | 角色 | Bot Name | Bot Key | Agent Id | Telegram User ID |
|
||||
| ------- | --- | ---------------------------- | ---------------------------------------------- | -------- | ---------------- |
|
||||
| macmini | 星枢 | @shenwei_macmini_xingshu_bot | 8787024183:AAG1M5tfSHj6Z0gMv3vvCZel2FOIX-0x8ZI | main | 5038825565 |
|
||||
| macmini | 星曜 | @shenwei_macmini_xingyao_bot | 8414432613:AAG9hvKfILGSsbc1EMEZW1QVym9Quc5aHWk | xingyao | 5038825565 |
|
||||
| macmini | 星辉 | @shenwei_macmini_xinghui_bot | 8709222939:AAEfvZrvvU5vZFsmacsR5nmpkJ2Jb5JgfRg | xinghui | 5038825565 |
|
||||
| | | | | | |
|
||||
#### 云
|
||||
|
||||
```
|
||||
openclaw channels add --channel telegram --account yunhan --token 8588117769:AAFxswhHgCdBor2EOa-2oChDpI-DADRt0tQ
|
||||
|
||||
openclaw channels add --channel telegram --account yunce --token 8791231082:AAFKPfTPy3LshybWUJ0joBkz3Th3mwYQOnc
|
||||
|
||||
openclaw channels add --channel telegram --account yunjiang --token 8727937702:AAGw3WGPI1j5rSD97wap6h9EGqVpDEMdjLU
|
||||
|
||||
openclaw channels add --channel telegram --account yunzhi --token 8639619464:AAEI35Dnt-9PQ8y4Du_ToxVhwUBUa5kpLjU
|
||||
```
|
||||
|
||||
| 服务器 | 角色 | Bot Name | Bot Key | Agent 名称 | Telegram User ID |
|
||||
| ------- | --- | ----------------------------- | ---------------------------------------------- | -------- | ---------------- |
|
||||
| ubuntu2 | 云瀚 | @shenwei_ubuntu2_yunhan_bot | 8588117769:AAFxswhHgCdBor2EOa-2oChDpI-DADRt0tQ | yunhan | 5038825565 |
|
||||
| ubuntu2 | 云策 | @shenwei_ubuntu2_yunce_bot | 8791231082:AAFKPfTPy3LshybWUJ0joBkz3Th3mwYQOnc | yunce | 5038825565 |
|
||||
| ubuntu2 | 云匠 | @shenwei_ubuntu2_yunjiang_bot | 8727937702:AAGw3WGPI1j5rSD97wap6h9EGqVpDEMdjLU | yunjiang | 5038825565 |
|
||||
| ubuntu2 | 云织 | @shenwei_ubuntu2_yunzhi_bot | 8639619464:AAEI35Dnt-9PQ8y4Du_ToxVhwUBUa5kpLjU | yunzhi | 5038825565 |
|
||||
|
||||
|
||||
#### 风
|
||||
|
||||
```
|
||||
openclaw channels add --channel telegram --account fengheng --token
|
||||
|
||||
openclaw channels add --channel telegram --account fengchi --token
|
||||
|
||||
openclaw channels add --channel telegram --account fengji --token
|
||||
```
|
||||
|
||||
| 服务器 | 角色 | Bot Name | Bot Key | Agent 名称 | Telegram User ID |
|
||||
| ------- | --- | ----------------------------- | ------- | -------- | ---------------- |
|
||||
| ubuntu1 | 风衡 | @shenwei_ubuntu1_fengheng_bot | | fengheng | 5038825565 |
|
||||
| ubuntu1 | 风驰 | @shenwei_ubuntu1_fengchi_bot | | fengchi | 5038825565 |
|
||||
| ubuntu1 | 风纪 | @shenwei_ubuntu1_fengji_bot | | fengji | 5038825565 |
|
||||
Reference in New Issue
Block a user