特性亮点
轻量化设计
单 Bun 进程 + 内嵌 SQLite,可在 0.5c 512MB内存的 服务器流畅运行
安全优先
三层安全策略,破坏性操作默认阻断
交互式对话
pi 风格 TUI 对话框,无需手写 YAML
可插拔扩展
自定义 collector/notifier,支持热加载
技术栈
三层安全模型
阻断 rm -rf、mkfs、find -delete、| sh、eval、base64|sh、解释器删除;保护 /etc/shadow、~/.ssh、/proc 等路径
取严合并,LLM 只能升级不能降级;异常时升级为人工确认
哈希链 = sha256(prev_hash || 字段),任何篡改都可检出;通过 /audit list 和 /audit verify 查询
日常运维能力
系统检查
磁盘/内存/CPU/网络/服务/进程/日志
监控
定时采集、条件评估、可插拔 collector
报警
飞书/钉钉/webhook/邮件…,自带加签
执行
bash 受控、run_script 语法检查 + dry-run
脚本生成
bash/python,语法检查 + 预览
使用说明
快速开始
使用前请先安装 Bun,并建议使用 Node.js 22+ 环境。Bun 是 OpAgent 的运行依赖,Node.js 22+ 可确保更稳定的兼容性与工具链体验。
# 前置要求
# 1) 安装 Bun
# 2) 建议使用 Node.js 22+ 以上版本
# 安装 Bun(推荐)
curl -fsSL https://bun.sh/install | bash
# 或者:npm install -g bun
# 安装 OpAgent
npm install -g @xianzongwendao/op-agent
# 配置
mkdir -p ~/.op_agent
echo 'DEEPSEEK_API_KEY=sk-xxxxxxxx' > ~/.op_agent/.env
chmod 600 ~/.op_agent/.env
# 启动
opagent常用命令
# 交互式 TUI
opagent
# 开启写操作
opagent --allow-write
# 开启破坏性操作
opagent --allow-destructive
# LLM 语义审计
opagent --llm_audit
# 启动监控守护进程
opagent monitor
# 生成自定义插件模板
opagent monitor new-collector my-collector
opagent monitor new-notifier my-notifier设计说明
核心架构
OpAgent 不重造内核,而是在 pi 之上增加运维层:
pi: agent loop、工具、会话、技能、TUI、provider
safety 扩展: 三层策略、阻断/确认
audit 扩展: 哈希链、/audit 命令
ops 工具: inspect/script/destructive
monitor: 可插拔 collector/notifier + daemon
可插拔监控系统
两套扩展系统,正交独立:
Collector (采集)
内置: system.cpu/mem/disk/net、file.tail、sql、command.read
支持自定义插件、热加载、paramsSchema 驱动交互式设置
Notifier (通知)
内置: log、webhook、feishu、dingtalk
secret 自动脱敏、test() 测试通知
