u-foo 2.3.15 → 2.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.zh-CN.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  [English](README.md)
4
4
 
5
- 🤖 Agent AI 协作框架,支持 Claude Code、OpenAI Codex 和自定义 AI Agent 的编排协作。
5
+ ufoo 是一个多 Agent 工作区协议,用于在同一个项目运行 Claude Code、OpenAI Codex、ufoo 原生 `ucode`,以及按模板编排的 Agent 小组。
6
6
 
7
- 📦 **npm**: [https://www.npmjs.com/package/u-foo](https://www.npmjs.com/package/u-foo)
7
+ npm 包:[u-foo](https://www.npmjs.com/package/u-foo)
8
8
 
9
9
  [![npm version](https://img.shields.io/npm/v/u-foo.svg)](https://www.npmjs.com/package/u-foo)
10
10
  [![npm downloads](https://img.shields.io/npm/dm/u-foo.svg)](https://www.npmjs.com/package/u-foo)
@@ -12,393 +12,392 @@
12
12
  [![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg)](https://nodejs.org)
13
13
  [![Platform](https://img.shields.io/badge/platform-macOS-blue.svg)](https://www.apple.com/macos)
14
14
 
15
- ## 为什么选择 ufoo?
15
+ ## 功能概览
16
16
 
17
- ufoo 解决多 AI 编程 Agent 协同工作的难题:
17
+ - `ufoo` / `ufoo chat` 打开交互式多 Agent 仪表盘。
18
+ - `uclaude`、`ucodex`、`ucode` 会带着项目 bootstrap、bus 身份和 ufoo 协议上下文启动 Agent。
19
+ - `ufoo daemon` 负责项目运行态、启动/恢复、组编排、报告和 chat bridge 请求。
20
+ - `ufoo bus` 提供项目内 Agent 消息、唤醒、监听、提醒和终端激活。
21
+ - `ufoo ctx`、`ufoo memory`、`ufoo history` 把决策、长期事实和输入时间线写入 `.ufoo/`。
22
+ - `ufoo group` 从 `templates/groups/` 的内置模板启动多 Agent 小组。
23
+ - `ufoo online` 提供远程 relay、频道、房间、token 和 inbox 辅助命令。
18
24
 
19
- - **🔗 统一界面** - 一个聊天 UI 管理所有 AI Agent
20
- - **📬 消息路由** - Agent 之间通过事件总线通信协作
21
- - **🧠 上下文共享** - 跨 Agent 共享决策和知识
22
- - **🚀 自动初始化** - Agent 包装器自动完成配置
23
- - **📝 决策追踪** - 记录架构决策和权衡取舍
24
- - **⚡ 实时更新** - 即时查看 Agent 状态和消息
25
+ ## 环境要求
25
26
 
26
- ## 功能特性
27
-
28
- - **聊天界面** - 交互式多 Agent 聊天 UI (`ufoo chat`)
29
- - 实时 Agent 通信和状态监控
30
- - 仪表盘展示 Agent 列表、在线状态和快捷操作
31
- - 使用 `@agent-name` 向特定 Agent 发送消息
32
- - **事件总线** - Agent 间实时消息通信 (`ufoo bus`)
33
- - **上下文共享** - 共享决策和项目上下文 (`ufoo ctx`)
34
- - **Agent 包装器** - Claude Code (`uclaude`)、Codex (`ucodex`) 和 ucode 助手 (`ucode`) 自动初始化
35
- - **PTY 包装器** - 智能终端模拟与就绪检测
36
- - **智能探针注入** - 等待 Agent 初始化完成后再注入命令
37
- - **统一命名** - 一致的 Agent 命名规范(如 ucode-1、claude-1、codex-1)
38
- - **技能系统** - 可扩展的 Agent 能力 (`ufoo skills`)
27
+ - Node.js 18 或更新版本。
28
+ - macOS,用于 Terminal.app/iTerm2 启动和激活集成。
29
+ - 使用 `uclaude` `ucodex` 时,需要本机已经安装 Claude Code 或 Codex CLI。
39
30
 
40
31
  ## 安装
41
32
 
33
+ 安装 npm 发布包:
34
+
42
35
  ```bash
43
- # 从 npm 全局安装(推荐)
44
36
  npm install -g u-foo
45
37
  ```
46
38
 
47
- 或从源码安装:
39
+ 或从源码链接本仓库:
48
40
 
49
41
  ```bash
50
- git clone https://github.com/Icyoung/ufoo.git ~/.ufoo
51
- cd ~/.ufoo && npm install && npm link
42
+ git clone https://github.com/Icyoung/ufoo.git
43
+ cd ufoo
44
+ npm install
45
+ npm link
52
46
  ```
53
47
 
54
- 安装后可使用以下全局命令:`ufoo`、`uclaude`、`ucodex`、`ucode`。
48
+ 安装后会提供这些命令:`ufoo`、`uclaude`、`ucodex`、`ucode`、`ucode-core`。
55
49
 
56
50
  ## 快速开始
57
51
 
58
52
  ```bash
59
- # 初始化项目
60
53
  cd your-project
61
- ufoo init
62
-
63
- # 启动聊天界面(默认命令)
64
- ufoo chat
65
- # 或直接
54
+ ufoo init --modules context,bus
66
55
  ufoo
56
+ ```
57
+
58
+ 在 chat UI 里启动 Agent:
67
59
 
68
- # 使用 Agent 包装器(自动初始化 + 加入总线)
69
- uclaude # Claude Code 包装器
70
- ucodex # Codex 包装器
71
- ucode # ucode 助手(自研 AI 编程 Agent)
60
+ ```text
61
+ > /launch claude
62
+ > /launch codex
63
+ > /launch ucode
64
+ > @claude-1 read the project structure and summarize the risks
72
65
  ```
73
66
 
74
- ## 示例工作流
67
+ 也可以直接从项目目录启动包装器:
75
68
 
76
69
  ```bash
77
- # 1. 启动聊天界面
78
- $ ufoo
70
+ uclaude
71
+ ucodex
72
+ ucode
73
+ ```
79
74
 
80
- # 2. 从聊天中启动 Agent
81
- > /launch claude
82
- > /launch ucode
75
+ `ufoo chat` 会按需启动项目 daemon。跨项目全局模式:
83
76
 
84
- # 3. 向 Agent 发送任务
85
- > @claude-1 请分析当前代码库结构
86
- > @ucode-1 修复认证模块的 bug
77
+ ```bash
78
+ ufoo -g
79
+ ```
87
80
 
88
- # 4. Agent 通过总线通信
89
- claude-1: 分析完成,发现 3 处需要重构...
90
- ucode-1: Bug 已修复,正在运行测试...
81
+ ## 架构
91
82
 
92
- # 5. 查看已做的决策
93
- > /decisions
83
+ ```text
84
+ ufoo chat / ufoo -g
85
+ |
86
+ v
87
+ +----------------+----------------+
88
+ | project daemon / IPC / reports |
89
+ +----------------+----------------+
90
+ |
91
+ +--------------+--------------+
92
+ | | |
93
+ v v v
94
+ controller group runtime project registry
95
+ gate/router loop orchestration ~/.ufoo/projects
96
+ |
97
+ v
98
+ provider API transports and tools
99
+ codex/claude/ucode, memory, bus, terminal
100
+ |
101
+ v
102
+ uclaude / ucodex / ucode agent sessions
94
103
  ```
95
104
 
96
- 原生自研实现位于 `src/code` 目录。
105
+ Chat UI 通过 `.ufoo/run/ufoo.sock` 和项目 daemon 通信。daemon 负责启动、恢复、recover、group 编排、report、controller 路由和项目注册表更新。Agent 通过项目 bus 通信,并可使用共享决策、memory、report、prompt history 和工具处理器。
106
+
107
+ ## 常用命令
97
108
 
98
- 准备和验证 `ucode` 运行时:
109
+ ### 项目运行态
99
110
 
100
111
  ```bash
101
- ufoo ucode doctor
102
- ufoo ucode prepare
103
- ufoo ucode build
112
+ ufoo init --modules context,bus,resources
113
+ ufoo status
114
+ ufoo doctor
115
+ ufoo daemon --start
116
+ ufoo daemon --status
117
+ ufoo daemon --stop
104
118
  ```
105
119
 
106
- 尝试原生核心队列运行时(开发中):
120
+ `ufoo init` 会创建 `.ufoo/`,向 `AGENTS.md` 和 `CLAUDE.md` 注入 ufoo 协议块,创建 shared memory 存储,并初始化指定模块。默认模块是 `context`;常用多 Agent 项目建议使用 `--modules context,bus`。
121
+
122
+ ### Chat 和 Agent
107
123
 
108
124
  ```bash
109
- ucode-core submit --tool read --args-json '{"path":"README.md"}'
110
- ucode-core run-once --json
111
- ucode-core list --json
125
+ ufoo
126
+ ufoo chat
127
+ ufoo chat -g
128
+ ufoo launch codex reviewer --profile review-critic
129
+ ufoo solo list
130
+ ufoo solo run implementation-lead --agent codex --nickname builder
131
+ ufoo role ufoo-builder implementation-lead
132
+ ufoo resume <ucode|uclaude|ucodex|nickname>
133
+ ufoo recover list
112
134
  ```
113
135
 
114
- ## 全局聊天(`ufoo -g`)
115
-
116
- 使用 `ufoo -g`(或 `ufoo --global`)启动跨项目聊天仪表盘。全局模式不再绑定当前工作目录,而是使用一个基于家目录的控制器上下文,并将自身运行时写入 `~/.ufoo`,然后按需连接各项目的 ufoo 守护进程。
136
+ 常见 chat 命令包括 `/status`、`/bus list`、`/bus status`、`/settings`、`/project list`、`/project switch <index|path>`、`/open <path>`、`/resume list`、`/group status` 和 `@nickname <message>`。
117
137
 
118
- 当全局聊天停留在这个家目录控制器视图时,普通消息会先经过控制器侧的 `ufoo-agent`,由它在当前已注册的 Projects 里选择最合适的项目,再把消息转交给目标项目内的 `ufoo-agent` 继续做 agent 级路由。
138
+ ### 事件总线
119
139
 
120
140
  ```bash
121
- $ ufoo -g
122
-
123
- > /project list # 列出所有运行中的项目守护进程
124
- > /project switch 2 # 切换到第 2 个项目
125
- > /open ~/Code/my-app # 按路径初始化/启动/打开一个项目
126
- > /launch claude scope=inplace # 在当前上下文启动 Agent
127
- > @claude-1 开始审查 auth 模块
141
+ ufoo bus join
142
+ ufoo bus status
143
+ ufoo bus send codex:abc123 "Please implement the approved slice."
144
+ ufoo bus check codex:abc123
145
+ ufoo bus listen codex:abc123 --from-beginning
146
+ ufoo bus alert codex:abc123 --daemon --notify
147
+ ufoo bus wake ufoo-builder --reason follow-up
148
+ ufoo bus activate ufoo-builder
128
149
  ```
129
150
 
130
- | 命令 | 说明 |
131
- |------|------|
132
- | `/project list` | 列出全局运行时注册的项目 |
133
- | `/project switch <序号\|路径>` | 切换活动项目的 daemon 连接 |
134
- | `/open <path>` | 仅在全局模式下可用;按路径初始化、启动并打开项目 daemon |
135
- | `/launch <agent> scope=inplace` | 在当前工作区启动 Agent |
136
- | `/launch <agent> scope=window` | 在独立终端窗口启动 Agent |
151
+ 先用 `ufoo bus status` 查看真实 subscriber ID 或可解析昵称。当前项目会给显式 group 昵称加项目前缀,例如 `ufoo-builder`;裸 `builder` 目标不一定能解析。
137
152
 
138
- 说明:
139
- - 如果你在控制器视图里直接输入普通消息,全局 `ufoo-agent` 会先尝试把它路由到最相关的已注册项目。
140
- - 选中的项目里,项目侧 `ufoo-agent` 会继续完成第二跳路由,选择具体 coding agent。
153
+ ### 上下文、Memory、Report
141
154
 
142
- ## Agent 配置
155
+ ```bash
156
+ ufoo ctx decisions -l
157
+ ufoo ctx decisions -n 1
158
+ ufoo ctx decisions new "Adopt API-backed loop architecture"
143
159
 
144
- 在 `.ufoo/config.json` 中配置 AI 提供商:
160
+ ufoo memory add "Provider contract" --body "Durable fact..." --tags provider,contract
161
+ ufoo memory list --tag provider
162
+ ufoo memory show mem-0001
145
163
 
146
- ### ucode 配置(自研助手)
147
- ```json
148
- {
149
- "ucodeProvider": "openai",
150
- "ucodeModel": "gpt-4-turbo-preview",
151
- "ucodeBaseUrl": "https://api.openai.com/v1",
152
- "ucodeApiKey": "sk-***"
153
- }
154
- ```
164
+ ufoo history build
165
+ ufoo history show 20
166
+ ufoo history prompt 30
155
167
 
156
- ### Claude 配置
157
- ```json
158
- {
159
- "claudeProvider": "claude-cli",
160
- "claudeModel": "claude-3-opus"
161
- }
168
+ ufoo report start "Implement README refresh" --task docs-readme --agent ufoo-builder
169
+ ufoo report done "README updated" --task docs-readme --agent ufoo-builder
170
+ ufoo report list
162
171
  ```
163
172
 
164
- ### Codex 配置
165
- ```json
166
- {
167
- "codexProvider": "codex-cli",
168
- "codexModel": "gpt-4"
169
- }
170
- ```
173
+ 决策只用于计划级约束;长期项目事实应写入 memory。
171
174
 
172
- ### 完整示例
173
- ```json
174
- {
175
- "launchMode": "internal",
176
- "ucodeProvider": "openai",
177
- "ucodeModel": "gpt-4-turbo-preview",
178
- "ucodeBaseUrl": "https://api.openai.com/v1",
179
- "ucodeApiKey": "sk-***",
180
- "claudeProvider": "claude-cli",
181
- "claudeModel": "claude-3-opus",
182
- "codexProvider": "codex-cli",
183
- "codexModel": "gpt-4"
184
- }
175
+ ### Group
176
+
177
+ ```bash
178
+ ufoo group templates
179
+ ufoo group template show build-lane
180
+ ufoo group template validate templates/groups/build-lane.json
181
+ ufoo group run build-lane --dry-run
182
+ ufoo group run build-lane --instance docs-refresh
183
+ ufoo group status
184
+ ufoo group diagram build-lane --mermaid
185
+ ufoo group stop docs-refresh
185
186
  ```
186
187
 
187
- `ucode` 会将配置写入全局目录(`~/.ufoo/agent/ucode/config`),用于原生 planner/engine 调用。配置一次,所有项目通用。项目级 `.ufoo/config.json` 可按需覆盖全局配置。
188
+ 当前内置模板包括 `build-lane`、`build-ultra`、`design-system`、`product-discovery`、`ui-plan-review`、`ui-polish` `verify-ship`。
188
189
 
189
- ## 架构
190
+ ### Online Relay
190
191
 
191
- ```
192
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
193
- │ uclaude │ │ ucodex │ │ ucode │
194
- └──────┬──────┘ └──────┬──────┘ └──────┬──────┘
195
- │ │ │
196
- └───────────────────┼───────────────────┘
197
-
198
- ┌──────▼──────┐
199
- │ ufoo bus │ 事件总线
200
- └──────┬──────┘
201
-
202
- ┌────────────┼────────────┐
203
- │ │ │
204
- ┌──────▼──────┐ ┌───▼───┐ ┌──────▼──────┐
205
- │ .ufoo/bus │ │context│ │ decisions │
206
- └─────────────┘ └───────┘ └─────────────┘
192
+ ```bash
193
+ ufoo online server --host 127.0.0.1 --port 8787
194
+ ufoo online token codex:abc123 --nickname builder
195
+ ufoo online channel list --nickname builder
196
+ ufoo online room create --nickname builder --name review-room --type private --password secret
197
+ ufoo online connect --nickname builder --room <room_id> --room-password secret
198
+ ufoo online send --nickname builder --room <room_id> --text "handoff ready"
199
+ ufoo online inbox builder --unread
207
200
  ```
208
201
 
209
- Bus 状态存放于 `.ufoo/agent/all-agents.json`(元数据)、`.ufoo/bus/*`(队列/事件)以及 `.ufoo/daemon/*`(bus daemon 运行态)。
202
+ `room create` 会返回生成的 room ID,例如 `room_000000`;`connect` 和 `send` 的 `--room` 应使用这个 ID。`--name` 是展示元数据,不是加入/发送时的标识。默认公开服务地址是 `https://online.ufoo.dev`;本地开发可用 `ufoo online server` 启动自己的 relay。
210
203
 
211
- ## 命令列表
204
+ ### 原生 ucode 运行时
212
205
 
213
- ### 核心命令
214
- | 命令 | 说明 |
215
- |------|------|
216
- | `ufoo` | 启动聊天界面(默认) |
217
- | `ufoo chat` | 启动交互式多 Agent 聊天 UI |
218
- | `ufoo -g` | 启动全局聊天模式(跨项目仪表盘) |
219
- | `ufoo init` | 在当前项目初始化 .ufoo |
220
- | `ufoo status` | 显示 banner、未读消息和未处理决策 |
221
- | `ufoo doctor` | 检查安装状态 |
222
-
223
- ### Agent 管理
224
- | 命令 | 说明 |
225
- |------|------|
226
- | `ufoo daemon start` | 启动 ufoo 守护进程 |
227
- | `ufoo daemon stop` | 停止 ufoo 守护进程 |
228
- | `ufoo daemon status` | 查看守护进程状态 |
229
- | `ufoo resume [nickname]` | 恢复 Agent 会话 |
206
+ ```bash
207
+ ufoo ucode doctor
208
+ ufoo ucode prepare
209
+ ufoo ucode build
230
210
 
231
- ### 事件总线
232
- | 命令 | 说明 |
233
- |------|------|
234
- | `ufoo bus join` | 加入事件总线(Agent 包装器自动完成) |
235
- | `ufoo bus send <id> <msg>` | 发送消息给 Agent |
236
- | `ufoo bus check <id>` | 检查待处理消息 |
237
- | `ufoo bus status` | 查看总线状态和在线 Agent |
211
+ ucode-core submit --tool read --args-json '{"path":"README.md"}' --json
212
+ ucode-core run-once --json
213
+ ucode-core list --json
214
+ ```
238
215
 
239
- ### 上下文与决策
240
- | 命令 | 说明 |
241
- |------|------|
242
- | `ufoo ctx decisions -l` | 列出所有决策 |
243
- | `ufoo ctx decisions -n 1` | 显示最新决策 |
244
- | `ufoo ctx decisions new <title>` | 创建新决策 |
216
+ ## 命令参考
245
217
 
246
- ### 技能
247
- | 命令 | 说明 |
218
+ | 范围 | 命令 |
248
219
  |------|------|
249
- | `ufoo skills list` | 列出可用技能 |
250
- | `ufoo skills show <skill>` | 显示技能详情 |
220
+ | 运行态 | `ufoo`, `ufoo chat`, `ufoo -g`, `ufoo init`, `ufoo status`, `ufoo doctor`, `ufoo daemon --start|--status|--stop` |
221
+ | 项目 | `ufoo project list`, `ufoo project current`, `ufoo project switch`(v1 中仅 chat 可切换), chat `/open <path>` |
222
+ | Agent | `ufoo launch`, `ufoo solo list|run`, `ufoo role`, `ufoo resume <target>`, `ufoo recover list|run` |
223
+ | Bus | `ufoo bus join|status|send|check|listen|alert|wake|activate` |
224
+ | Context | `ufoo ctx doctor`, `ufoo ctx decisions`, `ufoo ctx sync` |
225
+ | Memory | `ufoo memory add|list|show|edit|forget|rebuild-index|audit` |
226
+ | Report | `ufoo report start|progress|done|error|list` |
227
+ | Group | `ufoo group templates|template|run|status|diagram|stop` |
228
+ | Online | `ufoo online server|token|room|channel|connect|send|inbox` |
229
+ | History | `ufoo history build|show|prompt` |
230
+ | Skills | `ufoo skills list|install` |
231
+ | Chat 设置 | `/settings`, `/settings agent`, `/settings router`, `/settings ucode` |
251
232
 
252
- 备注:
253
- - Claude CLI 的 headless agent 使用 `--dangerously-skip-permissions`。
233
+ ## 配置
254
234
 
255
- ## 项目结构
235
+ 项目配置文件是 `.ufoo/config.json`。`ucode` provider 凭据写入全局 `~/.ufoo/config.json`,加载项目配置时会合并进来。
256
236
 
237
+ 常见项目配置:
238
+
239
+ ```json
240
+ {
241
+ "launchMode": "auto",
242
+ "agentProvider": "codex-cli",
243
+ "controllerMode": "main",
244
+ "codexInternalThreadMode": "api",
245
+ "codexAuthPath": "",
246
+ "codexOauthRefreshWindowSec": 300,
247
+ "claudeOauthProfile": "",
248
+ "claudeOauthTokenPath": "",
249
+ "claudeOauthRefreshWindowSec": 300,
250
+ "routerProvider": "",
251
+ "routerModel": "",
252
+ "agentModel": "",
253
+ "autoResume": true
254
+ }
257
255
  ```
258
- ufoo/
259
- ├── bin/
260
- │ ├── ufoo # 主 CLI 入口 (bash)
261
- │ ├── ufoo.js # Node 包装器
262
- │ ├── uclaude # Claude Code 包装器
263
- │ ├── ucodex # Codex 包装器
264
- │ └── ucode # ucode 助手包装器
265
- ├── SKILLS/ # 全局技能(uinit, ustatus)
266
- ├── src/
267
- │ ├── bus/ # 事件总线实现(JS)
268
- │ ├── daemon/ # Daemon + chat bridge
269
- │ ├── agent/ # Agent 启动/运行
270
- │ └── code/ # 原生 ucode 核心实现
271
- ├── modules/
272
- │ ├── context/ # 决策/上下文协议
273
- │ ├── bus/ # 总线模块资源
274
- │ └── resources/ # UI/图标(可选)
275
- ├── AGENTS.md # 项目指令(规范文件)
276
- └── CLAUDE.md # 指向 AGENTS.md
256
+
257
+ `launchMode` 支持 `auto`、`internal`、`internal-pty`、`tmux`、`terminal`、`host`。`controllerMode` 支持 `main`、`shadow`、`loop` 和 legacy 兼容值。
258
+
259
+ 全局 `ucode` 配置:
260
+
261
+ ```json
262
+ {
263
+ "ucodeProvider": "openai",
264
+ "ucodeModel": "gpt-4.1",
265
+ "ucodeBaseUrl": "https://api.openai.com/v1",
266
+ "ucodeApiKey": "sk-...",
267
+ "ucodeAgentDir": ""
268
+ }
277
269
  ```
278
270
 
279
- ## 项目初始化后的目录结构
271
+ ## 项目结构
280
272
 
281
- 执行 `ufoo init` 后,你的项目会包含:
273
+ 仓库结构:
282
274
 
275
+ ```text
276
+ ufoo/
277
+ bin/ CLI 入口
278
+ src/ CommonJS 实现
279
+ agent/ Agent 启动、bootstrap、运行时、provider
280
+ bus/ 项目事件总线
281
+ chat/ 终端 dashboard UI
282
+ cli/ 命令适配层
283
+ code/ 原生 ucode core
284
+ controller/ gate router、launch routing、shadow guard
285
+ context/ 决策与上下文检查
286
+ daemon/ 项目 daemon、IPC、编排
287
+ group/ prompt profiles 与 group templates
288
+ memory/ shared memory store
289
+ online/ relay client/server helpers
290
+ projects/ 全局项目注册表
291
+ providerapi/ redaction 与 provider shadow-diff helpers
292
+ report/ Agent report store
293
+ terminal/ Terminal.app、iTerm2、tmux、host adapters
294
+ tools/ controller/tool handler registry
295
+ templates/groups/ 内置多 Agent group 模板
296
+ modules/ init 模板和打包模块文档
297
+ SKILLS/ 打包的 Agent skills
298
+ test/ Jest 单元测试和集成测试
283
299
  ```
300
+
301
+ 执行 `ufoo init --modules context,bus` 后创建:
302
+
303
+ ```text
284
304
  your-project/
285
- ├── .ufoo/
286
- │ ├── bus/
287
- │ │ ├── events/ # 事件日志(只追加)
288
- │ │ ├── queues/ # 每个 Agent 的消息队列
289
- │ │ └── offsets/ # 读取位置跟踪
290
- │ └── context/
291
- │ ├── decisions/ # 决策记录
292
- │ └── decisions.jsonl # 决策索引
293
- ├── AGENTS.md # 注入的协议块
294
- └── CLAUDE.md # → AGENTS.md
305
+ .ufoo/
306
+ memory/ 长期项目事实
307
+ context/
308
+ decisions/ decision 文件
309
+ decisions.jsonl decision 索引
310
+ bus/
311
+ events/ event log files
312
+ queues/ per-agent queues
313
+ logs/ bus logs
314
+ offsets/ read offsets
315
+ agent/
316
+ all-agents.json Agent 元数据注册表
317
+ daemon/
318
+ counts/ bus daemon delivery counts
319
+ docs -> docs/ 当项目存在 docs/ 时创建的可选 symlink
320
+ AGENTS.md 规范 Agent 指令文件
321
+ CLAUDE.md Claude 兼容指令文件
295
322
  ```
296
323
 
297
- ## 聊天界面
298
-
299
- 交互式聊天 UI 提供集中化的 Agent 管理中心:
324
+ 运行时或相关功能使用后创建:
325
+
326
+ ```text
327
+ .ufoo/run/
328
+ ufoo.sock project daemon IPC socket
329
+ ufoo-daemon.pid project daemon pid
330
+ ufoo-daemon.log project daemon log
331
+ .ufoo/daemon/
332
+ daemon.pid bus auto-inject daemon pid
333
+ daemon.log bus auto-inject daemon log
334
+ .ufoo/chat/ chat runtime state
335
+ .ufoo/groups/ group runtime instances
336
+ .ufoo/history/ Agent 输入时间线
337
+ .ufoo/agent/
338
+ reports/ Agent report records
339
+ private-inbox/ private controller inbox
340
+ sessions/ provider/session metadata
341
+ ```
300
342
 
301
- ### 功能
302
- - **实时通信** - 在一个界面查看所有 Agent 消息
303
- - **Agent 仪表盘** - 监控在线状态、会话 ID 和昵称
304
- - **定向消息** - 使用 `@agent-name` 向特定 Agent 发送消息
305
- - **命令补全** - Tab 键补全命令和 Agent 名称
306
- - **鼠标支持** - `Ctrl+M` 切换鼠标模式(滚动 vs 文本选择)
307
- - **会话历史** - 跨会话持久化消息记录
343
+ 全局运行态位于 `~/.ufoo/`,包括 `~/.ufoo/config.json` 的 `ucode` provider 设置,以及 `~/.ufoo/projects/runtime/*.json` 的全局 chat 项目注册记录。
308
344
 
309
- ### 快捷键
310
- | 按键 | 操作 |
311
- |------|------|
312
- | `Tab` | 自动补全命令/Agent |
313
- | `Ctrl+C` | 退出聊天 |
314
- | `Ctrl+M` | 切换鼠标模式 |
315
- | `Ctrl+L` | 清屏 |
316
- | `Ctrl+R` | 刷新 Agent 列表 |
317
- | `↑/↓` | 浏览命令历史 |
318
-
319
- ### 聊天命令
320
- | 命令 | 说明 |
321
- |------|------|
322
- | `/help` | 显示可用命令 |
323
- | `/agents` | 列出在线 Agent |
324
- | `/clear` | 清除聊天记录 |
325
- | `/settings` | 配置聊天偏好 |
326
- | `@agent-name <message>` | 向特定 Agent 发送消息 |
345
+ ## 开发
327
346
 
328
- ## Agent 通信
347
+ ```bash
348
+ npm install
349
+ npm link
350
+ node bin/ufoo.js --help
351
+ npm test
352
+ ```
329
353
 
330
- Agent 通过事件总线通信:
354
+ 常用检查:
331
355
 
332
356
  ```bash
333
- # Agent A 向 Agent B 发送任务
334
- ufoo bus send "codex:abc123" "请分析项目结构"
335
-
336
- # Agent B 检查并执行
337
- ufoo bus check "codex:abc123"
338
- # → 自动执行任务
339
- # → 回复结果
340
- ufoo bus send "claude-code:xyz789" "分析完成:..."
357
+ npm run test:watch
358
+ npm run test:coverage
359
+ npm run bench:global-switch
360
+ node bin/ucode-core.js --help
341
361
  ```
342
362
 
343
- ## 技能(供 Agent 使用)
344
-
345
- 内置技能通过斜杠命令触发:
363
+ 测试框架是 Jest,`testEnvironment` `node`。覆盖率忽略 `node_modules` 和 `src/code/tui.js`。
346
364
 
347
- - `/ubus` - 检查并自动执行待处理消息
348
- - `/uctx` - 快速检查上下文状态
349
- - `/ustatus` - 统一状态视图(横幅、未读消息、未决决策)
350
- - `/uinit` - 手动初始化 .ufoo
365
+ ## 发布
351
366
 
352
- ## 系统要求
367
+ `package.json` 没有专用 release script。请在干净工作区按标准 npm 流程发布:
353
368
 
354
- - **macOS** - 用于 Terminal.app/iTerm2 集成
355
- - **Node.js >= 18** - npm 安装和 JavaScript 运行时
356
- - **Bash 4+** - Shell 脚本和命令执行
357
- - **终端** - iTerm2 Terminal.app 用于启动 Agent
369
+ ```bash
370
+ npm test
371
+ npm pack --dry-run
372
+ npm version patch #minor/major
373
+ npm publish
374
+ git push --follow-tags
375
+ ```
358
376
 
359
- ## Codex CLI 说明
377
+ 发布前用 `npm pack --dry-run` 检查最终 tarball。
360
378
 
361
- `ufoo chat` 会自动启动守护进程(无需单独运行 `ufoo daemon start`)。
379
+ ## 故障排查
362
380
 
363
- 如果 Codex CLI 在 `~/.codex` 下报权限错误(例如 sessions 目录),请设置可写的 `CODEX_HOME`:
381
+ 如果 `ufoo` 不在 `PATH`:
364
382
 
365
383
  ```bash
366
- export CODEX_HOME="$PWD/.ufoo/codex"
367
- ufoo chat # 守护进程自动启动
384
+ node bin/ufoo.js --help
368
385
  ```
369
386
 
370
- ## 开发
387
+ 如果 Codex 默认 home 不可写:
371
388
 
372
- ### 环境搭建
373
389
  ```bash
374
- # 克隆仓库
375
- git clone https://github.com/Icyoung/ufoo.git
376
- cd ufoo
377
-
378
- # 安装依赖
379
- npm install
380
-
381
- # 本地开发链接
382
- npm link
383
-
384
- # 运行测试
385
- npm test
390
+ export CODEX_HOME="$PWD/.ufoo/codex"
391
+ ufoo
386
392
  ```
387
393
 
388
- ### 参与贡献
389
- - Fork 本仓库
390
- - 创建功能分支 (`git checkout -b feature/amazing-feature`)
391
- - 提交更改 (`git commit -m 'Add amazing feature'`)
392
- - 推送分支 (`git push origin feature/amazing-feature`)
393
- - 发起 Pull Request
394
+ Codex 场景下建议使用 bus alert/listen,而不是依赖终端文本注入提醒:
394
395
 
395
- ### 项目结构
396
- - `src/` - 核心 JavaScript 实现
397
- - `bin/` - CLI 入口
398
- - `modules/` - 模块化功能(bus、context 等)
399
- - `test/` - 单元测试和集成测试
400
- - `SKILLS/` - Agent 技能定义
396
+ ```bash
397
+ ufoo bus alert codex:abc123 --daemon
398
+ ufoo bus listen codex:abc123
399
+ ```
401
400
 
402
401
  ## 许可证
403
402
 
404
- UNLICENSED(私有)
403
+ UNLICENSED。详见 [LICENSE](LICENSE)。