|
1 | | -<div align="center"> |
2 | | - <img src="https://raw.githubusercontent.com/webkubor/CortexOS/main/docs/public/logo.svg" width="120" height="120" alt="CortexOS Logo"> |
3 | | - <h1>CortexOS</h1> |
4 | | - <p><b>AI Agent 中央大脑操作系统 · 核心中枢 v6.0.0</b></p> |
5 | | - <p> |
6 | | - <img src="https://img.shields.io/badge/Version-v6.0.0-blue.svg?style=flat-square" alt="Version v6.0.0"> |
7 | | - <img src="https://img.shields.io/badge/CLI-cortexos-blue.svg?style=flat-square" alt="CortexOS CLI"> |
8 | | - <img src="https://img.shields.io/badge/License-MIT-111111.svg?style=flat-square" alt="License MIT"> |
9 | | - </p> |
10 | | - <p> |
11 | | - <img src="https://img.shields.io/badge/Codex-supported-111827.svg?style=flat-square&logo=openai&logoColor=white" alt="Codex supported"> |
12 | | - <img src="https://img.shields.io/badge/Gemini_CLI-supported-1a73e8.svg?style=flat-square&logo=google-gemini&logoColor=white" alt="Gemini CLI supported"> |
13 | | - <img src="https://img.shields.io/badge/Claude-supported-b5651d.svg?style=flat-square" alt="Claude supported"> |
14 | | - <img src="https://img.shields.io/badge/Lobster-integrated-7c3aed.svg?style=flat-square" alt="Lobster integrated"> |
15 | | - </p> |
16 | | -</div> |
| 1 | +# CortexOS |
17 | 2 |
|
18 | | -> **【CortexOS · 中央大脑】** |
19 | | -> |
20 | | -> CortexOS 是 `webkubor` 的 AI Agent 中央大脑。它对内以 `MCP` 组织能力,对外通过 `CLI` 与 `HTTP API` 接收信息、分发任务,并与各类 `subagent` 持续互动。 |
| 3 | +> 主人的影子系统 |
21 | 4 |
|
22 | | -## 🪐 关联项目 (Related Projects) |
| 5 | +## 概念 |
23 | 6 |
|
24 | | -- [CortexOS](https://github.com/webkubor/CortexOS): 本地优先的 AI Agent 中央大脑与云端共享记忆入口。 |
25 | | -- [Prompt Lab](https://github.com/webkubor/prompt-lab): AI 影像工作流指南与创意参考库。 |
26 | | -- [nanobanana-plus](https://github.com/webkubor/nanobanana-plus): 强化型 Gemini 绘图扩展,支持逐调用模型切换。 |
27 | | - |
28 | | -## ⚔️ 核心架构:对抗混乱 |
29 | | - |
30 | | -在 AI 协作中,我们面临三大熵增: |
31 | | -1. **上下文易失**:会话结束,规则即刻蒸发。 |
32 | | -2. **多机协作失控**:多模型并行时的状态冲突与重复劳动。 |
33 | | -3. **项目记忆断裂**:AI 对项目全局与历史进度缺乏稳定认知。 |
34 | | - |
35 | | -**CortexOS 通过三层防御体系锁定秩序:** |
36 | | -- `docs/`:**至高协议层**。沉淀法则、SOP 与公开文档。 |
37 | | -- `.memory/`:**运行态核心**。存放助手私有日志、任务池、项目注册表。 |
38 | | -- `~/Documents/memory/`:**永恒知识库**。用户私人资产,通过 Obsidian MCP 实现跨项目语义召回。 |
39 | | - |
40 | | -这三层的边界必须非常清楚: |
41 | | - |
42 | | -- `CortexOS` 是独立助手,有自己的 soul 与运行记忆 |
43 | | -- `~/Documents/memory/` 是用户本人的唯一知识真源 |
44 | | -- `CortexOS/.memory/` 不是用户资产库,只是 CortexOS 自己的私有运行层 |
45 | | - |
46 | | -## 💎 卓越能力 |
47 | | - |
48 | | -### 1. cortexos CLI(中央大脑对外命令入口) |
49 | | -通过 `cortexos` 命令行工具,任何 AI 都能访问大脑: |
50 | | -```bash |
51 | | -cortexos brief # 极简快照(~25行) |
52 | | -cortexos init # 冷启动当前工作区(设计中) |
53 | | -cortexos router # 完整路由 |
54 | | -cortexos status # 状态概览 |
55 | | -cortexos rule <名> # 加载具体规则 |
56 | | -cortexos logs 5 # 最近5天日志 |
57 | | -cortexos search 关键词 # 知识库搜索 |
58 | | -cortexos serve # HTTP API 模式(端口3579) |
59 | 7 | ``` |
60 | | - |
61 | | -> 💡 **设计原则**:对内以 `MCP` 组织能力;对外优先暴露 `CLI` 与 `HTTP API`。任何能跑 shell 或发 HTTP 请求的 AI 工具,都可以接入 CortexOS 主脑。 |
62 | | -
|
63 | | -### 2. Cloud Brain API(中央大脑云端共享入口) |
64 | | - |
65 | | -仓库内已经包含云端大脑接口服务,后续进入项目的 agent 不应忽略这层能力: |
66 | | - |
67 | | -- 本地代码路径:`services/brain-api/` |
68 | | -- Cloud Run 服务名:`brain-api` |
69 | | -- 当前服务地址:[https://brain-api-675793533606.asia-southeast2.run.app](https://brain-api-675793533606.asia-southeast2.run.app) |
70 | | - |
71 | | -当前最小接口: |
72 | | - |
73 | | -- `GET /health` |
74 | | -- `POST /memories` |
75 | | -- `GET /memories` |
76 | | -- `POST /notifications` |
77 | | -- `GET /notifications` |
78 | | -- `POST /notifications/:id/triage` |
79 | | -- `POST /tasks` |
80 | | -- `GET /tasks` |
81 | | - |
82 | | -这层的定位是:让**杭州本地节点**、**雅加达远端节点**与其他 `subagent` 共享同一份云端大脑主库,而不是替代本地 CortexOS 本体。 |
83 | | - |
84 | | -当前数据流已经收口为: |
85 | | - |
86 | | -- `notifications`:远端汇报先进入 inbox |
87 | | -- `memories`:只沉淀重点知识 |
88 | | -- `tasks`:需要后续动作的事项 |
89 | | - |
90 | | -## 📂 目录结构 (Directory Structure) |
91 | | - |
92 | | -```text |
93 | | -CortexOS/ |
94 | | -├── docs/ # 【协议层】宪法、规则、VitePress 站点库 |
95 | | -│ ├── rules/ # 行为约束 (security, coding, habits) |
96 | | -│ ├── sops/ # 标准作业程序 |
97 | | -│ └── ops/ # 运维手册 |
98 | | -├── .memory/ # 【记忆层】助手私有运行态数据 |
99 | | -│ ├── identity/ # 用户习惯与设备画像 (Local-only) |
100 | | -│ └── logs/ # 进化记忆轨迹 |
101 | | -├── services/brain-api # 【云端扩展】Cloud Run 共享记忆服务 |
102 | | -├── bin/cortexos # 【接口层】CLI 工具入口(任何 AI 可调用) |
103 | | -├── scripts/ # 【动力层】维护、检索与通知脚本 |
104 | | -└── package.json # 【基石】项目配置 |
| 8 | +主人 (webkubor) → 影子 (CortexOS) → 任何 AI 工具 |
105 | 9 | ``` |
106 | 10 |
|
107 | | -## 🛠️ 快速冷启动 |
| 11 | +- **主人**:拥有主权、偏好、知识 |
| 12 | +- **影子**:记忆主人偏好、执行指令、沉淀经验 |
| 13 | +- **接入**:任何 AI 工具通过统一 CLI/API 访问影子 |
108 | 14 |
|
109 | | -### 1. 添加 PATH(首次使用) |
110 | | -```bash |
111 | | -export PATH="$PATH:~/Documents/CortexOS/bin" |
112 | | -# 写入 ~/.zshrc 永久生效 |
113 | | -echo 'export PATH="$PATH:~/Documents/CortexOS/bin"' >> ~/.zshrc |
114 | | -``` |
| 15 | +## 使用 |
115 | 16 |
|
116 | | -### 2. 获取大脑快照 |
117 | 17 | ```bash |
118 | | -cortexos brief # 25 行状态快照 |
119 | | -``` |
120 | | - |
121 | | -### 2.5 下一步:工作区冷启动 |
| 18 | +# 获取上下文快照 |
| 19 | +cortexos brief |
122 | 20 |
|
123 | | -如果你希望 AI 在进入任意仓库时自动知道“当前是什么项目、该读哪份项目档案、推荐什么规则”,建议采用新的 `cortexos init` 协议设计: |
124 | | - |
125 | | -- [CortexOS init 协议设计](./docs/guide/init-protocol.md) |
126 | | - |
127 | | -### 3. HTTP API 模式(其他 AI 可调用) |
128 | | -```bash |
129 | | -cortexos serve --port 3579 |
130 | | -# GET http://localhost:3579/api/brief |
| 21 | +# HTTP API 模式 |
| 22 | +cortexos serve |
| 23 | +curl http://localhost:3579/api/brief |
131 | 24 | ``` |
132 | 25 |
|
133 | | ---- |
134 | | - |
135 | | -## 📅 版本与演进 |
136 | | - |
137 | | -- **当前版本**:`v5.8.0`(脑体物理解构 · 知识代谢协议落地) |
138 | | -- **变更日志**:[`CHANGELOG.md`](./CHANGELOG.md) |
139 | | - |
140 | | -*"不战而屈人之兵,善之善者也。CortexOS 让 AI 协作于无形,沉淀于有根。"* |
141 | | - |
142 | | - |
143 | | ---- |
144 | | - |
145 | | -## ⚡️ 技术栈与架构 (Technical Stack & Architecture) |
146 | | - |
147 | | -- **总架构图**:[`docs/ops/architecture.md`](./docs/ops/architecture.md)(只描述 CortexOS 这个 AI Agent 中央大脑本体) |
148 | | - |
149 | | -CortexOS 的设计哲学是"纯本地、高自主、可进化"。整个系统被清晰地划分为三层,每一层都采用最适合其职责的工具链。 |
150 | | - |
151 | | -### 核心分层架构 |
| 26 | +## 结构 |
152 | 27 |
|
153 | 28 | ``` |
154 | | -┌──────────────────────────────────────────────────┐ |
155 | | -│ 大脑层 (Brain) │ |
156 | | -│ - 规则 (Rules): docs/rules/ │ |
157 | | -│ - 知识 (Knowledge): docs/ & ChromaDB │ |
158 | | -│ - 人格身份 (Identity): IDENTITY.md │ |
159 | | -│ - 灵魂协议 (Soul): soul.md │ |
160 | | -│ - 进化蓝图 (Evolution): .memory/persona/evolution.md│ |
161 | | -└──────────────────────────────────────────────────┘ |
162 | | - ▲ │ |
163 | | - │ │ (通过 MCP 工具协议交互) |
164 | | - ▼ │ |
165 | | -┌──────────────────────────────────────────────────┐ |
166 | | -│ 内核层 (Kernel) │ |
167 | | -│ - MCP Server (Python/FastMCP): mcp_server/ │ |
168 | | -│ - 自动化引擎 (Node.js/pm2): scripts/core/ │ |
169 | | -│ - 调度与哨兵 (kernel.mjs/sentinel.js) │ |
170 | | -└──────────────────────────────────────────────────┘ |
171 | | - ▲ │ |
172 | | - │ │ (读写私有数据/记忆) |
173 | | - ▼ │ |
174 | | -┌──────────────────────────────────────────────────┐ |
175 | | -│ 记忆层 (Memory) │ |
176 | | -│ - 私有记忆 (.memory/): 关系、日志、配置 │ |
177 | | -│ - 长期资产 (~/Documents/memory/): 外部知识库 │ |
178 | | -│ - 向量数据 (chroma_db/): 语义搜索索引 │ |
179 | | -└──────────────────────────────────────────────────┘ |
| 29 | +CortexOS/ |
| 30 | +├── docs/ # 文档(规则、指南) |
| 31 | +├── .memory/ # 影子私有记忆(日志、偏好) |
| 32 | +├── bin/cortexos # CLI 入口 |
| 33 | +└── services/ # Cloud Brain 云端接口 |
180 | 34 | ``` |
181 | 35 |
|
182 | | -### 技术栈详解 |
| 36 | +**边界**: |
| 37 | +- 主人知识 → `~/Documents/memory/` |
| 38 | +- 影子记忆 → `.memory/` |
183 | 39 |
|
184 | | -| 模块 | 主要技术 | 职责与目的 | |
185 | | -| :--- | :--- | :--- | |
186 | | -| **cortexos CLI** | `Python`, `http.server` | 提供 Agent 与系统交互的通用接口,支持 CLI 和 HTTP API 两种调用方式。 | |
187 | | -| **自动化引擎** | `Node.js`, `pm2`, `Shell` | 负责 7x24 小时的后台任务,如 Git 自动提交、状态监控、记忆收割、任务调度。 | |
188 | | -| **语义记忆 (RAG)** | `ChromaDB`, `Ollama`, `nomic-embed-text` | 将 `docs/` 和外部知识库向量化,实现高效的自然语言语义搜索。 | |
189 | | -| **结构化记忆** | `SQLite` (规划中) | 用于存储结构化的代码模式、硬约束和决策逻辑,提供比语义搜索更精确的逻辑检索。 | |
190 | | -| **依赖管理** | `pnpm` (workspace), `uv` | 分别管理 `Node.js` 和 `Python` 的依赖,确保环境隔离与可复现性。 | |
191 | | -| **人格与规则** | `Markdown` | 所有的大脑规则、人格协议、进化蓝图都以人类可读的 Markdown 定义,便于理解和修改。 | |
| 40 | +## 版本 |
192 | 41 |
|
193 | | ---- |
| 42 | +v7.0.0 — Harness-First 架构 |
0 commit comments