Polaris
面向 2026+ 的开源自托管 AI Agent 系统。严格遵循 Polaris Engineering 六条架构不变量构建。单机 8GB 内存可运行,支持 Telegram / Discord / Slack / 飞书等主流第三方接入,终端用户无需修改源码即可通过 Shell Script Hooks 自定义生命周期行为。
定位与约束
| 维度 | 内容 |
|---|---|
| 定位 | 开源自托管 AI Agent(2026+) |
| 运行环境 | 单机可运行,消费级笔记本,8GB+ 内存 |
| 底座语言 | Go(编排/服务)+ Rust(性能关键路径) |
| 存储 | 多引擎并存:关系型 + 向量 + 图 + KV + 全文检索 + 事件流 |
| 形态 | 多 Agent 协同:黑板模式 + CAS 原子认领 + supervisor tree |
| 核心能力 | 自学习 / 自进化 / 自增强(无梯度主线 + 条件梯度训练) |
| LLM 池 | Provider-agnostic:支持 Flash-class 和 Reasoning-class。Adapter 已实现 OpenAI / Anthropic / DeepSeek 等主流协议。 |
默认推荐:开箱即用配置使用 DeepSeek V4 系列,已在 Tier-0 基线长程测试。
Polaris Engineering 六条不变量
- 1. 可观测优先: 从第 0 行代码起全链路可追溯,Token_Burn_Rate + Surprise_Index 一等公民指标。
- 2. 可验证执行: 禁止概率过滤充当安全边界,安全决策物理/密码学可验证。
- 3. 可组合原语: 最小可复用单元,模块间热路径同步接口 + 冷路径结构化事件通信。
- 4. 数据驱动迭代: Eval Harness 驱动自进化,所有变更通过 CI 门控。
- 5. 状态机持有控制流: Go 确定性状态机持有控制流,LLM 仅做概率性填空。
- 6. State-in-DB: 所有状态持久化落盘,异步事件解耦跨存储状态变更,崩溃恢复从 EventLog 回放。
架构设计
四层架构 / 13 模块 / 6 代码包,分为基础设施层 (L0)、认知核心层 (L1)、协同与学习层 (L2)、治理与接口层 (L3)。
┌──────────────────────────────────────────────────────┐
│ L3 Interface & Scheduler (M13) │ Eval Harness (M12) │
├──────────────────────────────────────────────────────┤
│ L2 Orchestrator (M8) │ Self-Improve (M9) │ RAG (M10)│
├──────────────────────────────────────────────────────┤
│ L1 Agent Kernel (M4) │ Memory (M5) │ Skill (M6) │ │
│ Tool & Action (M7) │
├──────────────────────────────────────────────────────┤
│ L0 Inference (M1) │ Storage (M2) │ Observability │
│ (M3) │ Policy & Safety (M11) │
└──────────────────────────────────────────────────────┘
项目结构
polaris/
├── cmd/polaris/ # 入口
├── pkg/ # 核心模块
├── internal/ # 私有共享: protocol, config, errors
├── rust/substrate/ # Rust FFI 性能路径
├── skills/ # 内置技能
├── policies/ # Cedar 策略
├── configs/ # 默认配置
├── docs/arch/ # 架构设计文档
└── Makefile
快速安装与卸载
macOS / Linux 安装
默认安装:
curl -sSL https://raw.githubusercontent.com/polarisagi/polaris/main/scripts/install.sh | bash
中国地区 (代理加速):
curl -sSL https://mirror.ghproxy.com/https://raw.githubusercontent.com/polarisagi/polaris/main/scripts/install.sh | bash
macOS / Linux 卸载
默认卸载:
curl -sSL https://raw.githubusercontent.com/polarisagi/polaris/main/scripts/uninstall.sh | bash
中国地区 (代理加速):
curl -sSL https://mirror.ghproxy.com/https://raw.githubusercontent.com/polarisagi/polaris/main/scripts/uninstall.sh | bash
运行与测试
前置条件: Go 1.26+, Rust 1.94+
项目的全局工作目录位于用户根目录下的 ~/.polarisagi/polaris/。系统运行时的所有状态数据(包括数据库 polaris.db)、日志文件、运行时缓存等均持久化保存在该目录下。
# 构建
make build
# 运行
make run
# 测试
make test