openclaw
A personal AI assistant that runs on your own computer and answers through messaging channels such as Slack, Telegram and WhatsApp. Its skills cover browser automation, canvas panels, app previews and shareable diffs.
A lightweight multi-channel assistant that connects to Feishu, DingTalk, QQ and WeCom, with skills for searching and installing ClawdHub skills and giving time-aware greetings.
Claude Code
$ npx -y skills add oujingzhou/openmozi --agent claude-code
Codex
$ npx skills add oujingzhou/openmozi -a codex
Cursor
$ npx skills add oujingzhou/openmozi -a cursor
Gemini CLI
$ npx skills add oujingzhou/openmozi -a gemini-cli
GitHub Copilot
$ npx skills add oujingzhou/openmozi -a github-copilot
OpenCode
$ npx skills add oujingzhou/openmozi -a opencode
Windsurf
$ npx skills add oujingzhou/openmozi -a windsurf



English | 中文
支持国产大模型和国产通讯软件的智能助手框架
OpenMozi 是一个轻量级的 AI 助手框架,专注于国产生态。基于 pi-coding-agent 构建 Agent 运行时(内置会话管理、上下文压缩、工具执行),使用 pi-ai 作为统一的多模型调用层(支持 25+ 提供商),原生支持 Function Calling,并支持 QQ、飞书、钉钉、企业微信等通讯平台。
| 模块 | 目录 | 职责 |
|---|---|---|
| Agent | src/agents/ | 核心消息循环、会话管理(基于 pi-coding-agent) |
| Providers | src/providers/ | 模型解析与映射层(基于 pi-ai,支持 25+ 提供商) |
| Tools | src/tools/ | 工具注册、参数校验、执行引擎,支持自定义扩展 |
| Skills | src/skills/ | 技能系统,通过 SKILL.md 注入专业知识和自定义行为 |
| Channels | src/channels/ | 通道适配器,统一消息格式,支持长连接 |
| Sessions | src/sessions/ | 会话持久化,支持内存/文件存储,Transcript 记录 |
| Durable | src/durable/ | 追加日志、崩溃恢复、回合/工具调用投影(durable execution) |
| TUI | src/tui/ | 终端界面(宽度感知折行、整帧重绘、无第三方 TUI 依赖) |
| Gateway | src/gateway/ | HTTP/WebSocket 服务,路由分发 |
基于 pi-coding-agent 内置的智能压缩系统:
OpenMozi 的架构设计参考了 Moltbot,但专注于不同的使用场景:
| 特性 | OpenMozi | Moltbot |
|---|---|---|
| 定位 | 国产生态优先的轻量框架 | 全功能个人 AI 助手 |
| 代码量 | ~16,000 行 (64 文件) | ~516,000 行 (3,137 文件) |
| 国产通讯 | QQ、飞书、钉钉、企业微信原生支持 | WhatsApp、Telegram、Slack 等 |
| Node.js 版本 | >= 18 | >= 22 |
| 适用场景 | 企业内部机器人、国内团队协作 | 个人多设备助手、海外平台集成 |
| 学习 Agent 原理 | 代码简洁清晰,适合学习 | 代码庞大复杂,学习门槛高 |
OpenMozi 用 3% 的代码量实现了核心功能,专注简洁高效,易于理解和二次开发。 适合 学习 Agent 原理,深入了解 AI 助手的架构设计。
# 全局安装(推荐)
npm install -g mozi-bot
# 或者克隆项目开发
git clone https://github.com/King-Chau/mozi.git
cd mozi && npm install && npm run build
运行配置向导(推荐):
mozi onboard
向导会引导你完成以下配置:
配置文件将保存到 ~/.mozi/config.local.json5。
也可以直接使用环境变量(快速体验):
export DEEPSEEK_API_KEY=sk-your-key
# 终端界面(默认进入 TUI)
mozi
# Web 界面 + 控制台(同时启动已配置的通讯通道)
mozi web
# 只对外提供 Web 服务,不连接飞书/钉钉/QQ(配置保持原样)
mozi web --web-only
# 不自动打开浏览器(CI、容器、远程机器)
mozi web --no-open
mozi 直接在终端里对话:Enter 发送、Ctrl+J 换行、Ctrl+N 新会话、Esc 取消、Ctrl+C 退出。mozi web 启动服务后访问 http://localhost:3000(对话)与 /control(设置)。mozi web 启动后会用系统默认浏览器打开 Web 界面;--no-open 或环境变量 MOZI_NO_OPEN=1 可关闭。
mozi start 与 mozi web 行为一致,保留它是为了兼容 Dockerfile / docker-compose 里的部署命令。
需要指定配置文件时:mozi web --config ./my.json5;TUI 模式使用环境变量 MOZI_CONFIG=/path/to/config.json5 mozi。
底层基于 pi-ai,支持 25+ 模型提供商。以下为预配置的提供商,也可通过自定义接口接入任意 OpenAI/Anthropic 兼容服务。
| 提供商 | 环境变量 | 内置模型(2026-11 核对) |
|---|---|---|
| DeepSeek | DEEPSEEK_API_KEY | deepseek-flash(V4.1 Flash,1M 上下文,原生多模态)、deepseek-v4-pro |
| DashScope | DASHSCOPE_API_KEY | qwen4-max、qwen3.7-plus、qwen3.8-flash(均 1M 上下文) |
| 智谱 AI | ZHIPU_API_KEY | glm-5.3、glm-5.3-flash(多模态)、glm-4.7、glm-4.7-flash(免费) |
| ModelScope | MODELSCOPE_API_KEY | DeepSeek-V4.1-Flash-1017、Qwen3.5-397B-A17B、Kimi-K3.1-Pro、MiniMax-M3、GLM-5.2,免费额度 |
| Kimi | KIMI_API_KEY | kimi-k3.1-pro、kimi-k3.1-pro-highspeed、kimi-k3(1M 上下文) |
| 阶跃星辰 | STEPFUN_API_KEY | step-5-preview、step-3.7-flash(多模态)、step-3.5-flash、step-1o-turbo-vision |
| MiniMax | MINIMAX_API_KEY | MiniMax-M3.1-Flash、MiniMax-M3(1M 上下文,多模态) |
内置表已按各家 2026-11 官方文档核对:上下文/输出上限、是否支持视觉与
reasoning_effort。请求层差异(store、developer角色、max_tokensvsmax_completion_tokens、各家的思考档位取值)在src/providers/model-resolver.ts的CHINA_PROVIDER_COMPAT里逐家钉死;需要覆盖时在配置的 provider 上写baseUrl,模型级差异仍可走自定义 provider 的compat。
| 提供商 | 环境变量 | 说明 |
|---|---|---|
| OpenAI | OPENAI_API_KEY | GPT-4o、o1、o3 系列 |
| Anthropic | ANTHROPIC_API_KEY | Claude 4 系列(通过 pi-ai 内置支持) |
| OpenRouter | OPENROUTER_API_KEY | 聚合多家模型,统一 API |
| Together AI | TOGETHER_API_KEY | 开源模型托管,Llama、Mixtral 等 |
| Groq | GROQ_API_KEY | 超快推理速度 |
GOOGLE_API_KEY | Gemini 系列(通过 pi-ai 内置支持) |
| 提供商 | 环境变量 | 说明 |
|---|---|---|
| Ollama | OLLAMA_BASE_URL | 本地运行开源模型 |
| vLLM | VLLM_BASE_URL | 高性能本地推理服务 |
配置约定与 pi 保持一致:密钥可以写成 $ENV_VAR,加载时展开;模型级 compat 原样透传给 pi-ai。
{
providers: {
"custom-openai": {
id: "gateway",
name: "Model Gateway",
baseUrl: "https://your-gateway.example.com/v1",
apiKey: "$MODEL_GATEWAY_TOKEN", // 加载配置时展开
headers: {
// 需要自定义鉴权头的网关这样写;用标准 Bearer 时可省略
"X-Auth-Token": "$MODEL_GATEWAY_TOKEN"
},
models: [
{
id: "your-model-id",
name: "Your Model",
contextWindow: 1000000,
maxTokens: 128000,
supportsVision: true,
supportsReasoning: true,
compat: {
// 部分网关只接受 low/high/xhigh/max 或 1-100 的整数;
// 不映射的话默认的 medium 会被 400 拒绝
reasoningEffortMap: {
off: "none", minimal: "low", low: "low",
medium: "high", high: "high", xhigh: "xhigh"
}
}
}
]
}
},
agent: {
defaultProvider: "custom-openai",
defaultModel: "your-model-id",
maxTokens: 8192,
thinkingLevel: "high" // 对应 reasoning_effort
}
}
agent.thinkingLevel 可选 off | minimal | low | medium | high | xhigh,默认 medium。
两点需要注意(都是实测踩到的):
reasoning_effort 取值受限:走 compat.reasoningEffortMap 映射,否则 medium 可能被网关拒绝。tools 数组:某些 OpenAI 兼容网关会拒绝 "tools": []。mozi 在没有工具时不再发送该字段。支持配置任意 OpenAI 或 Anthropic 兼容的 API 接口。通过 mozi onboard 向导配置,或手动添加到配置文件:
{
providers: {
// 自定义 OpenAI 兼容接口(如 vLLM、LiteLLM 等)
"custom-openai": {
id: "my-provider",
name: "My Provider",
baseUrl: "https://api.example.com/v1",
apiKey: "xxx",
models: [
{
id: "model-id",
name: "Model Name",
contextWindow: 32768,
maxTokens: 4096,
supportsVision: false,
supportsTools: true
}
]
},
// 自定义 Anthropic 兼容接口
"custom-anthropic": {
id: "my-anthropic",
name: "My Anthropic",
baseUrl: "https://api.example.com",
apiKey: "xxx",
apiVersion: "2023-06-01",
models: [
{
id: "claude-3-5-sonnet",
name: "Claude 3.5 Sonnet",
contextWindow: 200000,
maxTokens: 8192
}
]
}
}
}
QQ、飞书和钉钉都支持长连接模式,企业微信使用 Webhook 回调模式:
| 平台 | 连接模式 | 公网 IP | 接入文档 |
|---|---|---|---|
| 飞书 | WebSocket 长连接 | 不需要 | 飞书接入指南 |
| 钉钉 | Stream 长连接 | 不需要 | 钉钉接入指南 |
| WebSocket 长连接 | 不需要 | QQ 接入指南 | |
| 企业微信 | Webhook 回调 | 需要 | 企业微信接入指南 |
长连接模式:无需公网 IP,无需配置回调地址,启动即可接收消息。
配置文件支持 config.local.json5、config.json5、config.yaml 等格式,优先级从高到低。存放在 ~/.mozi/ 目录下。
完整配置示例
{
// 模型提供商
providers: {
deepseek: {
apiKey: "sk-xxx"
},
dashscope: {
apiKey: "sk-xxx",
// 可选:自定义模型列表(覆盖预设)
models: [
{
id: "qwen-max-latest",
name: "通义千问 Max",
contextWindow: 32768,
maxTokens: 8192
}
]
},
zhipu: {
apiKey: "xxx"
},
modelscope: {
apiKey: "ms-xxx"
}
},
// 通讯平台(长连接模式,无需公网)
channels: {
feishu: {
appId: "cli_xxx",
appSecret: "xxx"
},
dingtalk: {
appKey: "xxx",
appSecret: "xxx"
},
qq: {
appId: "xxx",
clientSecret: "xxx",
sandbox: false // 沙箱环境设为 true
},
wecom: {
corpId: "xxx",
corpSecret: "xxx",
agentId: "xxx",
token: "xxx",
encodingAESKey: "xxx"
}
},
// Agent 配置
agent: {
defaultProvider: "deepseek",
defaultModel: "deepseek-flash",
temperature: 0.7,
maxTokens: 4096,
systemPrompt: "你是墨子,一个智能助手。"
},
// 服务器配置
server: {
port: 3000,
host: "0.0.0.0"
},
// 日志级别
logging: {
level: "info" // debug | info | warn | error
},
// Skills 配置(可选)
skills: {
enabled: true, // 是否启用技能系统(默认 true)
userDir: "~/.mozi/skills", // 用户级技能目录
workspaceDir: "./.mozi/skills", // 工作区级技能目录
disabled: ["skill-name"], // 禁用指定技能
only: ["skill-name"] // 仅启用指定技能
},
// 记忆系统配置(可选)
memory: {
enabled: true, // 是否启用(默认 true)
storageDir: "~/.mozi/memory" // 存储目录(默认 ~/.mozi/memory)
}
}
Skills 是 OpenMozi 的可扩展知识注入系统,通过编写 SKILL.md 文件,可以为 Agent 添加专业知识、自定义行为规则或领域能力,无需修改代码。
Skills 通过 YAML frontmatter + Markdown 内容的方式定义,启动时自动加载并注入到 Agent 的系统提示词中。
| 优先级 | 来源 | 目录 | 说明 |
|---|---|---|---|
| 1 | 内置 | skills/ | 项目自带的技能 |
| 2 | 用户级 | ~/.mozi/skills/ | 用户自定义技能,所有项目共享 |
| 3 | 工作区级 | ./.mozi/skills/ | 项目级技能,仅当前项目生效 |
同名技能按优先级覆盖,工作区级 > 用户级 > 内置。
每个技能是一个目录,包含一个 SKILL.md 文件:
skills/
└── greeting/
└── SKILL.md
SKILL.md 格式:
---
name: greeting
title: 智能问候
description: 根据时间和场景提供个性化问候
version: "1.0"
tags:
- greeting
- chat
priority: 10
---
当用户向你打招呼或问候时,请遵循以下规则:
1. **根据时间问候**: 根据当前时间使用合适的问候语
- 早上 (6:00-11:00): 早上好
- 下午 (13:00-18:00): 下午好
- 晚上 (18:00-22:00): 晚上好
2. **友好热情**: 保持友好和积极的态度
3. **简洁明了**: 问候语简短有力
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 是 | 技能唯一标识 |
title | string | 否 | 显示名称 |
description | string | 否 | 技能描述 |
version | string | 否 | 版本号 |
tags | string[] | 否 | 标签,用于分类 |
priority | number | 否 | 优先级,数值越大越靠前(默认 0) |
enabled | boolean | 否 | 是否启用(默认 true) |
eligibility.os | string[] | 否 | 限制操作系统(darwin/linux/win32) |
eligibility.binaries | string[] | 否 | 需要的命令行工具 |
eligibility.env | string[] | 否 | 需要的环境变量 |
{
skills: {
enabled: true, // 是否启用(默认 true)
userDir: "~/.mozi/skills", // 用户级技能目录
workspaceDir: "./.mozi/skills", // 工作区级技能目录
disabled: ["greeting"], // 禁用指定技能
only: ["coding"] // 仅启用指定技能(白名单模式)
}
}
A personal AI assistant that runs on your own computer and answers through messaging channels such as Slack, Telegram and WhatsApp. Its skills cover browser automation, canvas panels, app previews and shareable diffs.
Gives your AI agent a learning loop: it turns past work into reusable skills, keeps notes across sessions, and searches its own earlier conversations. It can also run on a cheap server and be reached from chat apps like Telegram.
A single CLAUDE.md file with behavioral guidelines to reduce common LLM coding mistakes, such as overcomplication and unstated assumptions. It is derived from Andrej Karpathy's observations on coding pitfalls and helps Claude Code write, review, and refactor code more carefully.
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by running routine tasks, explaining complex code, and handling git workflows through natural language commands.
A lightweight multi-channel assistant that connects to Feishu, DingTalk, QQ and WeCom, with skills for searching and installing ClawdHub skills and giving time-aware greetings. Install it with the command on its page. It includes clawhub, greeting. Its skills do not fire on their own yet. Free and open source.
Is this plugin yours?
Claim it with GitHubSubmit a pluginPromote it