u-foo 4.0.10 → 4.1.2

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.
Files changed (71) hide show
  1. package/OPTIONAL_SKILLS/ufoo-bus-poll/SKILL.md +27 -0
  2. package/README.md +279 -789
  3. package/README.zh-CN.md +290 -439
  4. package/SKILLS/ufoo/SKILL.md +7 -0
  5. package/bin/ufoo.js +36 -3
  6. package/dist/tui/darwin-arm64/ufoo-tui +0 -0
  7. package/docs/OBSERVABILITY.md +4 -2
  8. package/docs/README.md +1 -0
  9. package/package.json +6 -2
  10. package/scripts/pack-desktop.js +174 -0
  11. package/src/agents/capabilities/coding/index.js +26 -3
  12. package/src/agents/capabilities/index.js +2 -1
  13. package/src/agents/capabilities/mac/index.js +145 -0
  14. package/src/agents/capabilities/planning/index.js +1 -1
  15. package/src/agents/capabilities/turnRecall/index.js +5 -16
  16. package/src/agents/profiles/coding.js +1 -1
  17. package/src/agents/profiles/main.js +1 -1
  18. package/src/agents/providers/nativeTransport.js +105 -116
  19. package/src/agents/providers/runtimeConfig.js +15 -4
  20. package/src/agents/providers/transports/anthropicCache.js +78 -0
  21. package/src/agents/providers/transports/antigravityTransport.js +3 -2
  22. package/src/agents/providers/transports/openaiResponsesTransport.js +7 -12
  23. package/src/agents/providers/transports/requestCacheObservation.js +61 -0
  24. package/src/agents/providers/transports/responsesProtocol.js +54 -46
  25. package/src/agents/providers/upstreamRuntime.js +2 -2
  26. package/src/agents/runtime/context/contextWindow.js +10 -0
  27. package/src/agents/runtime/context/slidingWindowManager.js +97 -41
  28. package/src/agents/runtime/context/topicSelector.js +4 -2
  29. package/src/agents/runtime/context/turnAnalyzer.js +17 -29
  30. package/src/agents/runtime/core/agentLoop.js +23 -7
  31. package/src/agents/runtime/createAgentRuntime.js +1 -1
  32. package/src/agents/runtime/protocol/auxiliaryModelRequest.js +28 -0
  33. package/src/app/chat/ChatController.js +1 -0
  34. package/src/app/chat/commandExecutor.js +25 -0
  35. package/src/app/chat/commands.js +2 -0
  36. package/src/app/chat/daemonMessageRouter.js +30 -3
  37. package/src/app/cli/appCommands.js +107 -0
  38. package/src/app/cli/features/skills.js +2 -0
  39. package/src/app/cli/macCommands.js +321 -0
  40. package/src/app/cli/metricsCommands.js +6 -1
  41. package/src/app/cli/run.js +26 -0
  42. package/src/app/cli/setupCommands.js +1 -0
  43. package/src/code/agent.js +1 -0
  44. package/src/code/context/assembler.js +8 -6
  45. package/src/code/context/promptLayers.js +3 -1
  46. package/src/code/context/stateCommit.js +2 -2
  47. package/src/code/context/transcript.js +11 -5
  48. package/src/code/nativeRunner.js +25 -5
  49. package/src/code/skills/loader.js +10 -2
  50. package/src/code/skills/render.js +8 -1
  51. package/src/config.js +42 -0
  52. package/src/coordination/bus/activate.js +44 -19
  53. package/src/coordination/history/agentPerformance.js +88 -11
  54. package/src/coordination/history/agentTrace.js +2 -0
  55. package/src/coordination/history/modelInputCost.js +52 -0
  56. package/src/runtime/contracts/uiProtocol.js +26 -0
  57. package/src/runtime/daemon/agentHost.js +35 -12
  58. package/src/runtime/daemon/mcpStdioProxy.js +3 -2
  59. package/src/runtime/mac/helperClient.js +279 -0
  60. package/src/runtime/mac/helperCompiler.js +235 -0
  61. package/src/runtime/mac/macSession.js +866 -0
  62. package/src/runtime/mac/native/ufoo_mac_helper.swift +2493 -0
  63. package/src/runtime/mac/paths.js +63 -0
  64. package/src/ui/agentSettingsController.js +12 -5
  65. package/src/ui/cliHandoff.js +484 -0
  66. package/src/ui/desktopArchive.js +41 -0
  67. package/src/ui/desktopUiHost.js +1601 -0
  68. package/src/ui/desktopUiHostCli.js +66 -0
  69. package/src/ui/format/index.js +17 -0
  70. package/src/ui/rustChatHost.js +45 -6
  71. package/src/ui/workspaceInspector.js +621 -0
package/README.md CHANGED
@@ -1,60 +1,50 @@
1
1
  # ufoo
2
2
 
3
- [中文](README.zh-CN.md)
3
+ [中文文档](README.zh-CN.md) · [Architecture Guide](docs/PROJECT.md) · [Observability](docs/OBSERVABILITY.md) · [Documentation Index](docs/README.md)
4
4
 
5
- ufoo is a project-scoped multi-agent workspace runtime with two ways to work.
6
- Keep using Claude Code, OpenAI Codex, and other supported CLIs through wrappers
7
- and MCP for messages and shared context. Or open the ufoo dashboard to work with
8
- a main agent and internal Codex, Claude, and `ucode` agents in one terminal.
9
- Both share a daemon, event bus, memory, reports, and group orchestration.
5
+ **Multi-Agent Workspace Runtime.** Just add `u` — `claude` → `uclaude`, `codex` → `ucodex`, `agy` → `uagy`, `grok` → `ugrok`, `kimi` → `ukimi` — or open `ufoo` to run a project main agent alongside embedded Codex, Claude, and native `ucode` workers inside a single Rust TUI dashboard.
10
6
 
11
7
  Package: [u-foo on npm](https://www.npmjs.com/package/u-foo)
12
8
 
13
9
  [![npm version](https://img.shields.io/npm/v/u-foo.svg)](https://www.npmjs.com/package/u-foo)
14
10
  [![npm downloads](https://img.shields.io/npm/dm/u-foo.svg)](https://www.npmjs.com/package/u-foo)
15
11
  [![License](https://img.shields.io/badge/license-UNLICENSED-red.svg)](LICENSE)
16
- [![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg)](https://nodejs.org)
17
- [![Platform](https://img.shields.io/badge/platform-macOS-blue.svg)](https://www.apple.com/macos)
18
-
19
- ## Highlights
20
-
21
- - One TUI dashboard for a main agent and internal child agents, with shared input,
22
- live output, status, and three layouts.
23
- - One user-scoped daemon over `~/.ufoo/run/ufoo.sock`, hosting isolated project
24
- runtimes for launch/resume, reports, groups, cron, and controller routing.
25
- - Project-local event bus for agent-to-agent messages, wakeups, queue checks,
26
- and activation.
27
- - Shared context primitives: decisions, durable memory, prompt history, reports,
28
- and agent registry state.
29
- - Wrappers and MCP keep external CLI workflows connected; dashboard child agents
30
- run internally without opening external terminals.
31
- - Built-in group templates for launching and orchestrating multi-agent workflows.
32
- - `ucode`, a native ufoo coding-agent runtime.
33
- - One loopback Streamable HTTP MCP server inside the home-scoped global
34
- controller daemon, plus a disposable `ufoo mcp` stdio compatibility proxy.
35
-
36
- ## Requirements
37
-
38
- - Node.js 18.17 or newer.
39
- - macOS for Terminal.app/iTerm2 integration.
40
- - Claude Code, Codex CLI, Antigravity CLI, Grok Build, or Kimi Code installed
41
- when using the matching wrappers: `uclaude`, `ucodex`, `uagy`, `ugrok`, or
42
- `ukimi`.
43
-
44
- ## Installation
45
-
46
- Install the published package:
12
+ [![Node](https://img.shields.io/badge/node-%3E%3D18.17-brightgreen.svg)](https://nodejs.org)
13
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux-blue.svg)](https://github.com/Icyoung/ufoo)
14
+
15
+ ---
16
+
17
+ ## Why ufoo?
18
+
19
+ ufoo gives every coding agent in your repository a shared control plane without forcing you into a single vendor CLI:
20
+
21
+ - **Unified Rust TUI Dashboard (`ufoo` & `ucode`)**: Work with a project main agent and multiple internal Codex, Claude, and `ucode` workers in one terminal (`main`, `side`, and `multi` split layouts), with independent per-agent input drafts, live streaming thinking/tool trees, pane-local mouse copy, and `/resume` for individual workers or entire agent groups.
22
+ - **Composable Native Agent Runtime & Context Engine V2**: Shared by the `ufoo` main agent, independent background coding tasks (`manage_tasks`), and standalone `ucode`. Includes a KV-cache-stable sliding turn window, automatic `<turn_context>` topic indexing, `recall_turn` off-window transcript search, structured `plan_graph` / Plan Mode, crash-safe journals, workspace write leases, and token-free background command auto-wake.
23
+ - **Everyday Chrome Automation (`browser`)**: Operate your already-open, signed-in Chrome through the optional `ufoo Browser` extension and user-scoped broker with per-tab ownership (`browser_tab_busy` protection) — never launching a blank profile or closing your browser on disconnect.
24
+ - **macOS Desktop Apps & Independent Agent Mouse (`mac_app`)**: Hybrid `AXUIElement` UI tree inspection (`@e1..@eN` refs + direct AX actions), shadowless 1:1 logical-point screenshots (`screenshotId` coordinate mapping), and a window-targeted **Agent Mouse** with a floating HUD that operates Mac apps without hijacking your physical cursor — yielding immediately on mouse shake, target-window click, or `Esc`.
25
+ - **Drop-In CLI Wrappers & Universal MCP**: Keep using external `uclaude`, `ucodex`, `uagy`, `ugrok`, `ukimi`, **Codex App/IDE**, **Cursor**, **Antigravity App**, or HTTP webhooks. One user-scoped daemon (`~/.ufoo/run/ufoo.sock`) hosts isolated project runtimes, a singleton Streamable HTTP MCP server, and a stateless `ufoo mcp` stdio proxy.
26
+ - **Groups, Shared Memory & Evidence-Gated Orchestration**: Launch multi-agent teams from 7 built-in group templates with role-tuned `codex` / `claude` / `agy` model presets, share architectural decisions and durable memory, collaborate remotely via `ufoo online`, and audit every run with `ufoo trace` and `ufoo metrics`.
27
+
28
+ ---
29
+
30
+ ## Installation & Requirements
31
+
32
+ ### Requirements
33
+
34
+ - **Node.js 18.17+** (`ufoo Browser` Playwright MCP runtime requires **Node.js 20+**).
35
+ - **macOS** or **Linux** (prebuilt `ufoo-tui` binaries are bundled for `darwin-arm64`, `darwin-x64`, `linux-x64`, and `linux-arm64`; macOS is required for `mac_app` desktop automation and Terminal.app/iTerm2 adapters).
36
+ - Corresponding vendor CLIs installed when using wrapper binaries (`claude`, `codex`, `agy`, `grok`, `kimi`).
37
+
38
+ ### Install from npm
47
39
 
48
40
  ```bash
49
41
  npm install -g u-foo
50
42
  ufoo setup
51
43
  ```
52
44
 
53
- `ufoo setup` lets you choose whether to install the optional **ufoo Browser**
54
- component (`ufoo setup --browser=install` or `--browser=skip`). Non-interactive
55
- installs skip optional browser components by default.
45
+ `ufoo setup` interactively asks whether to install the optional **ufoo Browser** component (`ufoo setup --browser=install` or `ufoo setup --browser=skip`; non-interactive installs skip optional downloads by default).
56
46
 
57
- Or link this repository for local development:
47
+ ### Build from Source
58
48
 
59
49
  ```bash
60
50
  git clone https://github.com/Icyoung/ufoo.git
@@ -64,50 +54,44 @@ npm run pack:tui
64
54
  npm link
65
55
  ```
66
56
 
67
- Installed binaries:
57
+ ### Installed Binaries
68
58
 
69
- | Binary | Purpose |
59
+ | Binary | Responsibility |
70
60
  |---|---|
71
- | `ufoo` | Main CLI, chat dashboard, daemons, global MCP server/proxy, groups, bus, context, memory, reports, and online helpers. |
72
- | `uclaude` | Claude Code wrapper with ufoo bootstrap and bus identity. |
73
- | `ucodex` | Codex wrapper with ufoo bootstrap and bus identity. |
74
- | `uagy` | Antigravity wrapper with ufoo bootstrap and bus identity. |
75
- | `ugrok` | Grok Build wrapper with ufoo bootstrap and bus identity. |
76
- | `ukimi` | Kimi Code wrapper with ufoo bootstrap and bus identity. |
77
- | `ucode` | Native ufoo coding-agent CLI/TUI. |
78
-
79
- `ucode` has no tool-call count limit by default. Set an optional per-run cap with
80
- `ucode --max-tool-calls 200`, or `UFOO_UCODE_MAX_TOOL_CALLS=200 ucode`.
81
- `ucode --max-tool-calls none` explicitly disables the cap, including an environment
82
- override. The CLI option takes precedence. Limits count individual tool calls,
83
- not model turns; timeouts and the tool-error budget still apply.
84
- Consecutive identical tool batches trigger a model reminder, then stop the run
85
- if repetition continues: read/plan-only batches warn at 4 steps and stop at 8;
86
- other batches warn at 8 and stop at 12. Comparison uses tool names and arguments,
87
- ignoring JSON key order and parallel call order. A different batch resets the
88
- streak; this is not a semantic check of tool results or alternating loops.
61
+ | `ufoo` | Main CLI, multi-agent chat dashboard, global/project daemons, MCP server & stdio proxy, `browser` & `mac` managers, groups, bus, context, memory, reports, trace/metrics, and online relay. |
62
+ | `ucode` | Native ufoo coding-agent CLI/TUI powered by the shared runtime, Context Engine V2, `browser`, and `mac_app`. |
63
+ | `uclaude` | Claude Code wrapper with ufoo bootstrap, bus identity, native stdio MCP message channel, and resume capture. |
64
+ | `ucodex` | OpenAI Codex wrapper with ufoo bootstrap, bus identity, native app-server queue delivery, and resume capture. |
65
+ | `uagy` | Antigravity CLI wrapper with ufoo bootstrap, bus identity, and conversation resume capture. |
66
+ | `ugrok` | Grok Build wrapper with ufoo bootstrap and bus registration. |
67
+ | `ukimi` | Kimi Code wrapper with ufoo bootstrap, bus registration, and resume metadata. |
68
+
69
+ ---
89
70
 
90
71
  ## Quick Start
91
72
 
92
- Initialize a project and open the chat dashboard:
73
+ ### 1. Open the Multi-Agent Dashboard
93
74
 
94
75
  ```bash
95
76
  cd your-project
96
77
  ufoo init --targets context,bus
97
- ufoo
78
+ ufoo # Open current project dashboard
79
+ ufoo -g # Or open global router to switch across registered projects
98
80
  ```
99
81
 
100
- Launch agents from chat:
82
+ Inside chat, work directly with the main agent or spawn internal workers:
101
83
 
102
84
  ```text
103
85
  > /launch codex reviewer
104
86
  > /launch claude builder
105
- > /launch grok explorer
106
87
  > /launch ucode fixer
107
88
  > @reviewer inspect the current diff and list release risks
89
+ > /group run build-lane instance=auth-refactor
108
90
  ```
109
91
 
110
- Or launch wrappers directly inside a project:
92
+ ### 2. Or Use Drop-In CLI Wrappers
93
+
94
+ Run any wrapped CLI in your project terminal — it automatically joins the project event bus and inherits shared context:
111
95
 
112
96
  ```bash
113
97
  uclaude
@@ -118,850 +102,356 @@ ukimi
118
102
  ucode
119
103
  ```
120
104
 
121
- Use global chat mode to switch between registered projects:
105
+ ### 3. Connect External IDE / Desktop Agent Hosts via MCP
106
+
107
+ - **Codex App, Codex CLI & Codex IDE Extension** (direct authenticated Streamable HTTP):
108
+ ```bash
109
+ ufoo -g
110
+ ufoo mcp configure codex # Use --dry-run to preview with redacted credentials
111
+ ```
112
+ Restart the Codex surface after configuring.
113
+
114
+ - **Cursor, Antigravity App & Other MCP Hosts** (stateless stdio proxy supporting both newline JSON and `Content-Length` framing):
115
+ ```json
116
+ {
117
+ "mcpServers": {
118
+ "ufoo": {
119
+ "command": "ufoo",
120
+ "args": ["mcp"]
121
+ }
122
+ }
123
+ }
124
+ ```
125
+ Inspect or restart the singleton MCP listener anytime with `ufoo mcp status` and `ufoo mcp restart`.
122
126
 
123
- ```bash
124
- ufoo -g
125
- ```
127
+ ---
126
128
 
127
- For Codex App, Codex CLI, and the Codex IDE extension, start global mode once
128
- and install the shared direct HTTP configuration:
129
+ ## Dashboard & TUI Guide
129
130
 
130
- ```bash
131
- ufoo -g
132
- ufoo mcp configure codex
133
- ```
131
+ Both `ufoo` and standalone `ucode` render through the Rust `ufoo-tui` process over the `ufoo-ui/1` socket protocol. Long-running tasks live in the daemon — closing the TUI never cancels background runs, and reconnecting replays live transcripts and status.
134
132
 
135
- The configuration points all three Codex surfaces at the same authenticated
136
- loopback endpoint. Existing ufoo authentication fields and headers are retained.
137
- Use `ufoo mcp configure codex --dry-run` to preview the change with credentials
138
- redacted. Restart the Codex surface after configuring it.
133
+ ### Layouts & Navigation
139
134
 
140
- For Cursor and any other host that has not been verified with direct HTTP,
141
- keep the compatible stdio configuration:
135
+ The dashboard provides three window modes (`Ctrl+W` cycles `main → side → multi → main`):
142
136
 
143
- ```bash
144
- ufoo mcp
145
- ```
137
+ - **`/window main`** — Full-width main agent pane.
138
+ - **`/window side`** — Main agent on the left + one active internal worker on the right.
139
+ - **`/window multi`** — Main agent + all active internal Codex, Claude, and `ucode` workers.
146
140
 
147
- This command is a stateless transport proxy into the same global server. It
148
- accepts both newline-delimited JSON and standard `Content-Length` frames, and
149
- answers in the framing that client used. Cursor can keep `command: ufoo` and
150
- `args: ["mcp"]`. The proxy does not own Agent registrations or project state.
151
- Inspect or restart the singleton listener with `ufoo mcp status` and
152
- `ufoo mcp restart`.
141
+ | Shortcut / Action | Behavior |
142
+ |---|---|
143
+ | `Ctrl+W` (in `main` input) | Cycle layouts (`main → side → multi → main`); in a child input, deletes the previous word. |
144
+ | `Ctrl+Q` | Exit split layout back to `main` while keeping workers and drafts alive. |
145
+ | `Tab` | Enter visible child pane in split mode, cycle footer agents in `main` mode, or accept slash completion. |
146
+ | `Esc` | Close open popup/menu, or return focus from an internal child input back to `main` without cancelling work. |
147
+ | `Ctrl+C` | In a child pane: cancel only that child's active turn (keeping worker & queue alive). In `main`: clear draft, cancel turn, or exit. |
148
+ | `Ctrl+O` | Expand/collapse the latest thinking or merged tool-call block in the focused pane. |
149
+ | `Ctrl+X` (on Agents footer) | Close the selected internal worker via the project daemon. |
150
+ | Mouse drag in any pane | Pane-local text selection (excludes borders/adjacent panes); releasing copies via macOS clipboard or OSC 52. |
153
151
 
154
- ## Runtime Model
152
+ ### Essential Slash Commands
155
153
 
156
154
  ```text
157
- ufoo / ufoo chat
158
- -> src/app/chat + src/ui/rustChatHost + crates/ufoo-tui
159
- -> global daemon over ~/.ufoo/run/ufoo.sock
160
- -> isolated ProjectRuntime selected by project_root
161
- -> runtime launch/resume/recover/reports/cron/groups
162
- -> orchestration router, group templates, solo roles
163
- -> agents launch/providers/internal/controller/activity
164
- -> coordination bus/context/memory/history/report/state/status
165
- -> shared controller/worker tools and native ucode tools
166
-
167
- Codex App / CLI / IDE -> Streamable HTTP --+
168
- ufoo mcp stdio proxy ----------------------+
169
- -> home-scoped global controller daemon
170
- (one MCP listener and tool router)
171
- -> ~/.ufoo/projects/runtime
172
- -> managed ProjectRuntimeGateway
173
- -> selected in-process ProjectRuntime for bus/report/activity/wait state
155
+ /status Project, daemon, and active agent summary
156
+ /launch <codex|claude|ucode> Spawn an embedded internal worker
157
+ /resume Resume saved internal workers or whole groups (group:<id>)
158
+ /task list | inspect | cancel Manage independent background coding tasks
159
+ /answer <interaction-id> <text> Reply to a paused ask_user interaction
160
+ /session show | new Inspect or start a fresh main conversation
161
+ /settings Configure provider, custom gateway, model, and thinking effort
162
+ /group templates | run | status Orchestrate multi-agent group workflows
163
+ /ctx status | decisions | doctor Inspect architectural decisions and context health
164
+ /bus status | list | send Inspect bus queues and message registered agents
165
+ /project list | switch <n> Switch workspaces in global/multi-project mode
166
+ /open /path/to/project Open and attach another project directory
167
+ /doctor Diagnose CLI versions, MCP config, and delivery receipts
174
168
  ```
175
169
 
176
- Global topology is the default. `ufoo daemon --topology hybrid` temporarily
177
- enables project compatibility sockets, and `--topology project` selects the
178
- legacy per-project daemon rollback path.
179
-
180
- ### Agent Delivery Modes
181
-
182
- ufoo supports two Agent delivery modes, selected only from the host Agent's
183
- inherited `UFOO_SUBSCRIBER_ID` before any helper terminal is started:
184
-
185
- - Wrapper-managed Agents start through `ucodex`, `uclaude`, `uagy`, `ugrok`, `ukimi`, or
186
- `ucode`. The wrapper provides `UFOO_SUBSCRIBER_ID`; ufoo monitors the shell
187
- activity and injection endpoint, so bus messages can be injected directly.
188
- These Agents reuse the environment identity and do not register through MCP
189
- or run a resident bus poll.
190
- Current wrappers also provide `UFOO_AGENT_HANDLE` so the Agent can use the
191
- shared MCP `dispatch_message`, `ack_bus`, and `report_agent_status` tools.
192
- The CLI remains available when MCP is not configured. Receive, activity,
193
- and shutdown stay with the wrapper.
194
- - Externally hosted Agents have no wrapper-provided subscriber environment.
195
- They register themselves once through MCP `register_agent`, retain the
196
- returned subscriber plus opaque `agent_handle`, and select the host App's
197
- native no-token wait:
198
- Codex App keeps MCP `wait_for_message` pending, while Cursor monitors
199
- `ufoo bus poll --follow` background output with `notify_on_output`.
200
-
201
- Agent type names and subscriber prefixes are routing metadata, not capability
202
- signals. After an external Cursor Agent registers through MCP, its dedicated
203
- listener terminal may export the returned subscriber as
204
- `UFOO_SUBSCRIBER_ID` so CLI operations share one identity. That child-shell
205
- binding does not alter the host Agent's already selected external mode and is
206
- not evidence of wrapper injection.
207
-
208
- Chat is a UI client. The daemon owns project runtime state. Agents communicate
209
- through bus queues, prompt injection, shared memory, reports, and tool handlers
210
- instead of importing chat UI code.
211
-
212
- MCP sends confirm durable queue persistence, not delivery or task completion.
213
- The result reports `delivery_status: "queued"`, `queued: <target count>`, and
214
- `delivered: 0`. Registry reads return up to 100 existing project paths per page;
215
- follow `next_offset` for more, or set `include_missing: true` for diagnostics.
216
- To archive abandoned records for deleted workspaces, preview with
217
- `ufoo project prune`, then run `ufoo project prune --apply`. Original JSON
218
- records remain recoverable under `~/.ufoo/projects/archive/`.
219
-
220
- The stdio proxy reconnects after listener restarts and preserves the Agent's
221
- registration. It automatically replays reads; an uncertain write returns
222
- `UFOO_MCP_OUTCOME_UNKNOWN` so its persisted result can be checked before retrying.
223
- Run `ufoo doctor` to detect outdated Codex MCP configuration, and
224
- `ufoo mcp configure codex` to refresh it with a backup.
225
-
226
- Codex and Claude Code wrappers use native incoming-message transports by
227
- default for interactive launches on macOS/Linux:
170
+ ---
228
171
 
229
- ```bash
230
- ucodex
231
- uclaude
232
- ```
172
+ ## Native Agent Runtime & `ucode`
233
173
 
234
- Codex connects its TUI to a private local app-server. ufoo observes the TUI's
235
- exact thread response, preserves its requests and approvals, and sends bus
236
- work through `thread/queue/add`. Claude uses a launch-local stdio MCP channel
237
- and retains Claude's development-channel confirmation. Its startup probe must
238
- arrive through the native channel before any bus work is sent. Channels are a
239
- [Claude research preview](https://code.claude.com/docs/en/channels); account and
240
- organization availability rules still apply. Existing MCP configuration and
241
- credentials remain intact; these launches do not write global host settings.
242
-
243
- Native receivers admit work while busy. A queue receipt confirms transport
244
- acceptance, not task completion. Stable delivery IDs and project-local native
245
- receipts prevent duplicate retries; uncertain writes retain the bus event for
246
- inspection rather than falling back to keyboard injection. The wrapper still
247
- owns terminal rendering, identity, activity, and shutdown. Use
248
- `--no-native-messages` or `UFOO_NATIVE_MESSAGES=0` to select the existing delivery
249
- path; `--native-messages` explicitly overrides that environment setting.
250
- Headless commands such as `ucodex exec` and `uclaude --print`, help/version,
251
- internal agents, and other providers keep their existing launch behavior.
252
- Launchers check CLI versions against the tested baselines (Codex 0.160.1 and
253
- Claude Code 2.1.204), and check Codex remote support. Older CLIs use legacy
254
- delivery with a diagnostic; explicit `--native-messages` requires compatibility.
255
- `ufoo doctor` shows versions, receiver readiness, and uncertain receipts.
256
-
257
- Inspect or explicitly resolve an uncertain receipt:
174
+ `ufoo`'s project main agent, writable child tasks (`manage_tasks`), and `ucode` share a layered, capability-composed runtime (`src/agents/runtime/`).
258
175
 
259
- ```bash
260
- ufoo bus deliveries <subscriber>
261
- ufoo bus deliveries <subscriber> <receipt-id> accepted
262
- ufoo bus deliveries <subscriber> <receipt-id> retry
263
- ```
176
+ ### Context Engine V2 & `recall_turn`
264
177
 
265
- Use `accepted` after verifying the receiving session got the work. `retry`
266
- allows another submission and can duplicate work if the first submission
267
- succeeded. A live in-flight submission cannot be resolved.
178
+ - **KV-Cache-Stable Sliding Window**: Retains a `Step=2` aligned raw turn window (5 turns by default, expanding up to 10 on active topics within a 45% context budget) so system prefixes and historical turns stay cache-hit friendly.
179
+ - **Ephemeral `<turn_context>` Injection**: Attaches a compact `<topic_map>` and `<relevant_turns>` digest to the current user turn without polluting persisted transcripts.
180
+ - **Optional Background Aux Enrichment**: When `agentAuxModel` or `ucodeAuxModel` is configured, an asynchronous Phase B enricher refines turn summaries and Tier 2 topic selection off the critical path (zero extra model calls when unconfigured).
181
+ - **Deterministic Overflow Eviction & `recall_turn`**: Tight context budgets trigger a deterministic Level 1–3 eviction ladder instead of blocking LLM compaction calls, while the `recall_turn` tool lets the agent search off-window turns or paginate full raw transcripts on demand.
268
182
 
269
- Codex resume pickers and `resume --last` bind the exact session returned by the
270
- TUI after selection.
183
+ ### Plan Mode, Execution Budgets & Workspace Leases
271
184
 
272
- The integration tests use real Unix sockets, WebSockets, and stdio MCP. Optional
273
- vendor CLI smoke tests use isolated homes and a fake local model endpoint:
274
- `node scripts/smoke-native-messages.js codex` and
275
- `node scripts/smoke-native-messages.js claude`. Verified locally with Codex
276
- 0.160.1 and Claude Code 2.1.204.
185
+ - **Plan Mode & `plan_graph`**: Enable with `/plan on` (or automatically when `plan_graph create` runs). Blocks direct mutating calls (`write`, `edit`, `bash`, mutating `browser`/`mac_app` actions) while permitting read/inspection tools and advancing structured `plan_graph` nodes. Leave with `/plan off`.
186
+ - **Execution & Loop Guards**: Model turns and tool calls are unbounded by default within a 12-hour task deadline (configurable via `ucode --max-tool-calls <N|none>`, `UFOO_UCODE_MAX_TOOL_CALLS`, `UFOO_UCODE_MAX_TOOL_ERRORS`, and `UFOO_UCODE_TASK_TIMEOUT_MS`). Consecutive tool failures warn at 3 and stop at 5 (or 12 of the last 20); identical repeated tool batches trigger a reminder and halt runaway loops.
187
+ - **Crash Safety & Directory Leases**: Completed turns commit atomically before the next model request. Interrupted mutations are never blindly replayed. Concurrent managed writers coordinate via directory leases, while verified `git worktree` checkouts execute in parallel.
277
188
 
278
- ## Daily Usage
189
+ ### Token-Free Background Command Auto-Wake
279
190
 
280
- The normal workflow is to enter chat first, then launch agents and run project
281
- commands inside the dashboard:
191
+ Agents can launch background processes (dev servers, builds, watchers) with declarative wake conditions — zero LLM polling while waiting:
282
192
 
283
- ```bash
284
- ufoo
285
- ufoo -g
193
+ ```json
194
+ {
195
+ "command": "npm run dev",
196
+ "background": true,
197
+ "wake": {
198
+ "conditions": [{ "type": "log_contains", "text": "Ready in" }]
199
+ }
200
+ }
286
201
  ```
287
202
 
288
- `ufoo` opens the current project chat. `ufoo -g` opens global chat for switching
289
- between registered projects. The global daemon starts once and project runtimes
290
- activate lazily.
291
-
292
- The project main agent shares a composable runtime with `ucode`. It can read and
293
- edit code, run validation, delegate to internal agents, or start independent
294
- tasks. The global profile selects projects before coding begins. Long tasks run
295
- in the daemon; disconnecting chat does not cancel them, and reconnecting replays
296
- runtime events.
203
+ Supported one-shot conditions: `log_contains`, `file_exists`, `port_open` (`127.0.0.1`), plus process exit (`wake.onExit`, enabled by default). Watches survive host restarts and resume cleanly at turn boundaries.
297
204
 
298
- All main conversations use the shared runtime. Use `/session new` to start a
299
- conversation with current settings; existing provider/model bindings stay pinned.
300
- A crash during an active round marks it interrupted: inspect actual
301
- effects before resubmitting. Writes, shell commands, launches, and uncertain
302
- deliveries are not automatically replayed. Managed writers share directory
303
- leases; verified git worktrees can run independently. These checks are not an OS
304
- sandbox for shell commands. See the [runtime implementation record](docs/archive/AGENT_RUNTIME_REFACTOR.md).
205
+ ### Agent Skills
305
206
 
306
- ### Chat Commands
207
+ Default skills (`ufoo`, `ufoo-bus`, `ufoo-context`, `ufoo-online`) link automatically on `postinstall` without overwriting user-owned files. Manage skills across hosts with:
307
208
 
308
- ```text
309
- /launch codex reviewer
310
- /launch claude builder
311
- /launch grok explorer
312
- /launch ucode fixer
313
- @reviewer inspect the current diff and list release risks
314
-
315
- /status
316
- /task list
317
- /task inspect <run-id>
318
- /task cancel <run-id>
319
- /answer <interaction-id> <reply>
320
- /session show
321
- /session new
322
- /settings
323
- /window main
324
- /window side
325
- /window multi
326
- /resume
327
- /project list
328
- /project switch 2
329
- /open /path/to/project
330
- ```
331
-
332
- The dashboard keeps three layouts: `main` (main agent only), `side` (main plus
333
- one selected internal agent), and `multi` (main plus all internal agents). Active
334
- wrapper and MCP agents appear in the communication directory and `@` completion;
335
- selecting one targets messages without opening a pane. Their detailed output
336
- and process lifecycle stay with their own host. Dashboard child launches use internal mode and never
337
- open an external terminal. A project with no chat or input history shows the
338
- existing compact ufoo banner as its welcome screen.
339
- `Ctrl+W` cycles `main → side → multi → main`.
340
- `/window main`, `/window side` and `/window multi`
341
- select each layout directly. The one-child layout selects the most recently
342
- activated live internal agent, or the first agent when none has been activated.
343
- With no children, split modes remain selected while showing only the full-width
344
- main pane; new children appear automatically when they become available.
345
- When an internal child owns the shared input, editing keys and shortcuts belong
346
- to that child. `Ctrl+C` cancels only its current task, preserving its draft,
347
- process and queued messages. `Esc` returns focus to the main input without
348
- cancelling work; popup menus close before returning focus. `Ctrl+W` edits the
349
- child's previous word and `Tab` inserts indentation. From the main input,
350
- `Ctrl+W` cycles layouts and `Ctrl+Q` closes the split; main-only `Ctrl+C` clears
351
- a nonempty draft before cancelling or exiting. `Esc` at the ufoo root preserves
352
- the application and draft.
353
- Standalone `ucode` uses the same side-pane implementation: clicking a footer
354
- agent selects an `@` message target, and clicking it again opens an internal
355
- agent on the right. Repeated selection of an external agent stays message-only.
356
- Keyboard selection followed by empty Enter uses the same internal activation.
357
- With focus on the Agents footer, `Ctrl+X` closes the selected internal agent
358
- through its project daemon in both ufoo and ucode. External agents cannot be
359
- closed from this menu. This differs from `Ctrl+C` in a child's input, which
360
- cancels its current task while keeping the worker alive.
361
- Restart existing internal workers to enable the per-task cancellation channel.
362
- Drag over visible text in the main or an internal agent pane to select it;
363
- releasing the mouse copies it to the clipboard. Selection stays within that pane,
364
- excluding its border and adjacent agents. Local macOS uses the system clipboard;
365
- other terminals use OSC 52 and require terminal clipboard support.
366
- `/resume` opens a second-level menu of recoverable internal sessions. Independent
367
- agents appear individually; group members appear together as `group:<group-id>`.
368
- Selecting a group resumes its inactive members with saved sessions, skips members
369
- that are already active, and updates the group's member identities. Native
370
- coding agents register as `agent_type: ucode` with `ucode:<session>` identities;
371
- their saved conversations remain under `.ufoo/agent/ucode/`.
372
- From main in a split layout, `Tab` enters a visible child. Once activated, only
373
- `Esc` leaves its input. All agents share one bottom input, which follows the selected agent while
374
- preserving each draft. Each agent's live status sits in its pane's bottom border;
375
- the main agent's input is labelled `main`, and its status stays independent of
376
- child selection, focus changes and child activity.
377
- Internal Codex defaults to full host access without approval prompts, including
378
- local services such as ADB and Gradle. Peer replies contain the final answer;
379
- progress and tool output stay visible in the agent's pane. Reports and handoffs
380
- default to 1-4 short lines with checks and blockers; longer evidence is saved in
381
- a referenced workspace file.
382
- The selected pane's body uses the terminal's default foreground. In the main-only
383
- layout, `Tab` selects the first agent in the bottom bar, then advances through
384
- the agents and wraps to the first. `Esc` returns to
385
- the main input. Command completion keeps its existing `Tab` behavior in the
386
- main-only layout. An open completion menu also owns `Tab` in split layouts.
387
- Layout commands also work from an internal child's input. Switching layouts
388
- keeps unsent child drafts and does not stop running agents.
389
- With a child active, a footer click opens the Agents selector in ufoo;
390
- `Down` remains an editing key in the child input. In the footer selector,
391
- `Down` advances to provider settings and cron controls; `Esc` returns to
392
- the same agent's input. In the selector, `Enter` opens the selected internal
393
- agent. The provider caption in the footer also opens its settings directly.
394
-
395
- Direct wrapper commands such as `uclaude`, `ucodex`, `uagy`, `ugrok`, `ukimi`, and
396
- `ucode` are still available, but the normal ufoo workflow is to work from chat.
397
-
398
- ### Initialization And Maintenance
399
-
400
- These are setup or troubleshooting commands. In chat, use slash commands:
401
-
402
- ```text
403
- /init context bus
404
- /doctor
405
- /status
406
- /daemon status
407
- /daemon restart
408
- /daemon stop
409
- /daemon start
209
+ ```bash
210
+ ufoo skills list --optional
211
+ ufoo skills install all --claude # ~/.claude/skills
212
+ ufoo skills install all --codex # ${CODEX_HOME:-~/.codex}/skills
213
+ ufoo skills install all --agy # ~/.gemini/config/skills
214
+ ufoo skills install all --agents # ~/.agents/skills
215
+ ufoo skills install ufoo-bus-poll --target /path/to/skills
410
216
  ```
411
217
 
412
- `ufoo init` creates `.ufoo/`, ensures `AGENTS.md` and `CLAUDE.md`, initializes
413
- selected workspace state, and prepares shared storage. `CLAUDE.md` may be a
414
- symlink; edit project instructions in `AGENTS.md`.
218
+ ---
415
219
 
416
- Before a project has been initialized, the equivalent CLI form is also useful:
417
- `ufoo init --targets context,bus`.
220
+ ## Browser & macOS Desktop Automation
418
221
 
419
- The default agent skill set is intentionally limited to `ufoo`, `ufoo-bus`,
420
- `ufoo-context`, and `ufoo-online`. They are installed only as skills, not as a
421
- second command catalog. Initialization and unified status are handled by
422
- `ufoo`.
222
+ Both capabilities are available out of the box in the `ufoo` main agent, writable native child tasks, and `ucode`. Multimodal screenshots attach automatically as provider vision blocks and retire cleanly after viewing.
423
223
 
424
- ### Event Bus
224
+ ### 1. Your Everyday Chrome (`browser` / `ufoo browser`)
425
225
 
426
- External HTTP agents can register a wake endpoint, including `grok-bot`:
226
+ Connects to your existing, authenticated Chrome via Playwright MCP (requires **Node.js 20+**) — preserving logins and cookies without ever launching an empty browser or closing Chrome on disconnect.
427
227
 
428
228
  ```bash
429
- ufoo bus join my-session grok-bot --wake-url https://agent.example/wake --wake-key-file /path/to/wake-key
229
+ ufoo setup --browser=install # Install optional Playwright MCP runtime + Native Messaging host
230
+ ufoo browser install --dev # Load unpacked extension from extensions/ufoo-browser/ during preview
231
+ ufoo browser status [--json]
232
+ ufoo browser doctor
233
+ ufoo browser enable | disable | update | uninstall
430
234
  ```
431
235
 
432
- The `bearer-json` adapter sends a bearer-authenticated JSON request containing
433
- `project_root`, `subscriber`, `seq`, `publisher`, and `message`. The endpoint
434
- must return HTTP 200 after accepting the work. The receiver acknowledges its
435
- queue with `ufoo bus ack <subscriber> --through <seq>` after handling it; later
436
- messages wait for that acknowledgement. Failed requests remain queued for retry.
437
- Requests have a ten-second deadline and do not follow redirects. HTTPS is
438
- required except for loopback HTTP. Endpoint keys stay in a mode-600 local file.
439
- Wake registrations have no local PID or terminal ownership.
236
+ - **Per-Tab Ownership via `BrowserBroker`**: The `ufoo Browser` MV3 extension auto-connects over Chrome Native Messaging to a shared local broker (`~/.ufoo/browser/private/broker.sock`). Agents inspect tabs (`browser_tabs` `action=list`) and claim specific `tabId`s; tabs owned by another session return `browser_tab_busy` without preemption. You can pause all control or release tabs anytime from the extension popup.
237
+ - **Compatibility Modes**: Supports the official Playwright Extension (`backend: "playwright-extension"`) and explicit CDP endpoints (`UFOO_BROWSER_CDP_ENDPOINT=chrome` or `http://127.0.0.1:9222`, guarded by a per-OS-user lease).
238
+ - **On-Demand Schema Discovery**: `browser` exposes `status`, `connect`, `tools`, `call`, and `disconnect`, keeping external Playwright schemas out of the base system prompt until needed. Artifacts save under `.ufoo/browser/<session-hash>/`.
440
239
 
441
- ```text
442
- /bus list
443
- /bus status
444
- /bus send codex:abc123 Please implement the approved slice.
445
- /bus activate reviewer
446
- /bus rename codex:abc123 reviewer
447
- ```
240
+ ### 2. macOS Desktop Apps & Independent Agent Mouse (`mac_app` / `ufoo mac`)
448
241
 
449
- Use `/bus status` to find the real subscriber ID or resolvable nickname
450
- before sending. Agents should handle pending work, reply to the sender, and
451
- acknowledge their queue.
242
+ Operates native Cocoa, SwiftUI, Catalyst, and Electron apps on macOS through a cached, zero-dependency Swift helper (`~/.ufoo/mac/bin/`) served over a private Unix socket:
452
243
 
453
- Externally hosted Agents with no `UFOO_SUBSCRIBER_ID` use the opt-in
454
- `ufoo-bus-poll` skill to select their host App's queue-read-only wait and
455
- self-wake mechanism:
244
+ - **Structured Accessibility (`AXUIElement`)**: `list_apps`, `list_windows`, `snapshot` (automatically wakes Chromium/Electron AX trees, assigns `@e1..@eN` refs, supports `includeMenuBar=true` and `query` filtering), `ax_action` (`press`, `focus`, `set_value`, `confirm`, `pick`, `show_menu`, `increment`, `decrement`), `launch_app`, `focus_app`, and `manage_window`.
245
+ - **1:1 Logical-Point Screenshots**: Shadowless window (`-o -l`), region, or full-display capture scaled to 1:1 macOS logical points by default. Passing `screenshotId` maps image `(x, y)` coordinates directly to live window/screen coordinates without Retina `2x` drift. Saved under `.ufoo/mac/<session-hash>/`.
246
+ - **Independent Agent Mouse & Human Yield**:
247
+ - Tracks a per-session virtual pointer and dispatches window-targeted `NSEvent` / `CGEvent.postToPid` events **without moving or warping your physical cursor**.
248
+ - Renders a non-capturable (`sharingType = .none`) floating **Agent Mouse HUD** showing live pointer position, click ripples, and action badges.
249
+ - Windows stay in the background unless `focusApp=true` is explicitly requested (always verify background input effects via `snapshot` or `screenshot`, as app support varies; cross-window drags are rejected and unsupported targets never fall back to hijacking the physical mouse).
250
+ - **Instant Human Takeover**: Ordinary physical mouse movement stays independent; a deliberate mouse shake, a physical click inside the agent's target window, or pressing `Esc` immediately triggers `user_takeover` and yields control.
456
251
 
457
252
  ```bash
458
- ufoo skills list --optional
459
- ufoo skills install ufoo-bus-poll --target /path/to/that/agent/skills
460
- ```
461
-
462
- Register once through MCP `register_agent` and retain its returned subscriber
463
- and `agent_handle`. Include the handle in heartbeat, activity, send, receive,
464
- acknowledgement, report, and unregister calls. The handle is an ownership
465
- capability: do not send it to peers or print it in reports.
466
-
467
- For a new external registration, ufoo assigns both the subscriber's
468
- eight-character session suffix and its automatic `<agent-prefix>-<number>`
469
- nickname on the server, using the same identity generators as wrapper launches.
470
- A Cursor MCP registration with `agent_type: "cursor"`, for example, receives
471
- `cursor:<8-hex>` and `cursor-N`; the model selected inside Cursor does not
472
- replace the Cursor Agent type.
473
- A stable `client_instance_id` recovers that same identity after a transport
474
- restart; even when that value is a UUID, it is not used as the subscriber
475
- suffix. Legacy MCP subscribers whose suffix is the client UUID are superseded
476
- by the short server-assigned identity on their next registration. MCP Agents
477
- cannot self-assign or update these identity fields; an explicit operator rename
478
- remains available through the controller/CLI rename path.
479
-
480
- - **Codex App:** call MCP `wait_for_message` in the foreground with
481
- the registered subscriber and handle, `after_seq: 0`, and
482
- `timeout_seconds: 0`. The tool call stays pending inside the dedicated
483
- `ufoo_wait` MCP connection until a message arrives or the caller cancels it;
484
- idle time produces no periodic model wake or token consumption. A message
485
- returns immediately and wakes the task without shell stdout. After handling
486
- a message response, call MCP `ack_bus` with the same handle and its
487
- `last_seq` as `through_seq`, then re-arm with that `last_seq` when the Agent
488
- is idle again.
489
- - **Cursor:** bind the MCP subscriber and run
490
- `export UFOO_SUBSCRIBER_ID="<subscriber-id>"; exec ufoo bus poll
491
- "$UFOO_SUBSCRIBER_ID" --follow --interval 30` through the monitored
492
- background shell with `block_until_ms: 0`, and configure
493
- `notify_on_output` to match `\[ufoo\]`. Startup and empty intervals are
494
- silent; only ufoo-delivered messages wake the model.
495
-
496
- Both paths keep idle queue checks outside the LLM. A background PTY alone is
497
- not a wake mechanism in Codex App.
498
-
499
- The poll skill is opt-in. Postinstall refreshes only verified ufoo-owned links;
500
- user directories, files, and foreign links are preserved. `skills install all`
501
- refreshes an already-installed optional skill with a backup, but does not
502
- install it for a new host. Explicit skill installs retain previous contents in
503
- a sibling `.backup-*` path.
504
- Wrapper-managed Agents skip MCP registration and external waiting when
505
- `UFOO_SUBSCRIBER_ID` was present in the Agent's inherited launch environment.
506
- A value exported later inside a Cursor listener terminal does not rerun this
507
- classification. Receive-path selection depends on host App capabilities, never
508
- on whether the external Agent calls itself Codex, Claude, Cursor, or another
509
- type.
510
-
511
- ### Context, Memory, History, Reports
512
-
513
- Inside chat:
514
-
515
- ```text
516
- /ctx status
517
- /ctx doctor
518
- /ctx decisions
253
+ ufoo mac status [--json] # Inspect helper state, displays, and TCC permissions
254
+ ufoo mac permissions # Prompt & open macOS Accessibility + Screen Recording settings
255
+ ufoo mac doctor # Verify Swift helper build, daemon socket RPC, and permissions
256
+ ufoo mac hud on | off | toggle # Toggle on-screen Agent Mouse visual indicator
257
+ ufoo mac enable | disable | stop
519
258
  ```
520
259
 
521
- Memory, history, and report management are CLI utilities:
260
+ ---
522
261
 
523
- ```bash
524
- ufoo memory add "Provider contract" --body "Durable fact..." --tags provider,contract
525
- ufoo memory list --tag provider
526
- ufoo memory show mem-0001
262
+ ## Architecture & Agent Delivery Protocol
527
263
 
528
- ufoo history build
529
- ufoo history show 20
530
- ufoo history prompt 30
531
-
532
- ufoo report start "Implement README refresh" --task docs-readme --agent builder
533
- ufoo report done "README updated" --task docs-readme --agent builder
534
- ufoo report list
264
+ ```text
265
+ ufoo / ufoo chat / ucode
266
+ -> src/app/chat + src/ui/ + crates/ufoo-tui (ratatui over ufoo-ui/1)
267
+ -> home-scoped GlobalDaemon (~/.ufoo/run/ufoo.sock)
268
+ -> isolated ProjectRuntime per workspace (~/.ufoo/projects/runtime)
269
+ -> orchestration (router, 7 group templates, solo roles, cron)
270
+ -> shared native agent runtime + SDK internal runners + CLI wrappers
271
+ -> .ufoo/ coordination state (bus, context decisions, memory, history, reports, journals)
535
272
 
536
- ufoo trace <task-id> --json
537
- ufoo trace --agent <id-or-nickname> --follow
538
- ufoo trace --details --limit 2000
273
+ External MCP Clients:
274
+ Codex App / CLI / IDE --(Streamable HTTP)--> GlobalDaemon MCP Listener & Router
275
+ Cursor / agy / others --(ufoo mcp proxy)---> -> ProjectRuntimeGateway -> Project Bus & Tools
539
276
  ```
540
277
 
541
- Use decisions only for plan-level constraints. Durable project facts belong in
542
- memory.
543
-
544
- `trace` links parent/worker model and tool events, reports, queue claims and
545
- context compression without starting a daemon or calling a model. MCP exposes
546
- the same read-only view as `read_agent_trace`. Parameters and results are
547
- redacted; bounded or incomplete source reads are explicitly marked in JSON.
548
-
549
- `ufoo metrics --json` summarizes observed outcomes, latency, tokens, tool
550
- errors/repetition, report size and delegation acceptance. Save a report and use
551
- `ufoo metrics --baseline baseline.json --json` to compare later samples. MCP
552
- provides `read_agent_metrics`; metric definitions and an optimization workflow
553
- are in [OBSERVABILITY.md](docs/OBSERVABILITY.md). Missing evidence stays unknown,
554
- and execution completion is separate from acceptance.
555
-
556
- ### Groups
278
+ ### Two Deterministic Agent Delivery Modes
557
279
 
558
- Built-in group templates live in `templates/groups/`.
280
+ ufoo selects an agent's bus delivery mode strictly from whether `UFOO_SUBSCRIBER_ID` was inherited at launch:
559
281
 
560
- Every member in all seven built-in groups includes three provider defaults plus a
561
- manual override in `model_config`:
282
+ 1. **Wrapper-Managed Agents (`ucodex`, `uclaude`, `uagy`, `ugrok`, `ukimi`, `ucode`)**:
283
+ - Inherit `UFOO_SUBSCRIBER_ID` and `UFOO_AGENT_HANDLE`. The wrapper/daemon owns registration, activity tracking, and direct prompt injection.
284
+ - **Native Incoming Transports**: Interactive `ucodex` (verified baseline `0.160.1+`) binds a launch-local app-server and queues bus work via `thread/queue/add`; interactive `uclaude` (`2.1.204+`) uses a launch-local stdio MCP channel with startup probe verification. Neither mutates global vendor config, and uncertain deliveries are persisted for explicit operator resolution (`ufoo bus deliveries <subscriber> [<receipt-id> accepted|retry]`) rather than falling back to blind keystroke injection. Use `--no-native-messages` (`UFOO_NATIVE_MESSAGES=0`) to opt out.
562
285
 
563
- | Role | Codex model / reasoning effort | Claude model | agy model |
564
- |---|---|---|---|
565
- | Architect | `gpt-6-astra` / `high` | `claude-fable-5-2` | `gemini-4-carbon-high` |
566
- | Builder | `gpt-6.1-sol` / `high` | `claude-opus-5-5` | `gemini-4-hydrogen-high` |
567
- | Reviewer | `gpt-6.1-sol` / `xhigh` | `claude-opus-5-5` | `gemini-4-argon-high` |
568
- | Design consultant, discovery facilitator, debugger | `gpt-6-astra` / `high` | `claude-fable-5-2` | `gemini-4-carbon-high` |
569
- | PMO | `gpt-6-astra` / `high` | `claude-fable-5-2` | `gemini-4-argon-high` |
570
- | Frontend refiner | `gpt-6.1-sol` / `high` | `claude-opus-5-5` | `gemini-4-hydrogen-high` |
571
- | Scope challenger, UI plan critic, design critic, release coordinator | `gpt-6.1-sol` / `xhigh` | `claude-opus-5-5` | `gemini-4-argon-high` |
572
- | QA | `gpt-6.1-sol` / `xhigh` | `claude-opus-5-5` | `gemini-4-hydrogen-high` |
286
+ 2. **Externally Hosted MCP Agents (no inherited `UFOO_SUBSCRIBER_ID`)**:
287
+ - Self-register once via MCP `register_agent` (receiving a server-allocated `<prefix>:<8-hex>` ID, `<prefix>-N` nickname, and opaque `agent_handle`; pass `client_instance_id` for seamless reconnect recovery).
288
+ - Pair with the opt-in `ufoo-bus-poll` skill for **zero-token idle waiting** matched to each host app:
289
+ - **Codex App**: Keeps one foreground MCP `wait_for_message` call pending on a dedicated `ufoo_wait` connection until a message arrives, then acknowledges via `ack_bus`.
290
+ - **Cursor**: Runs `ufoo bus poll "<subscriber-id>" --follow --interval 30` in a monitored background terminal (`notify_on_output` matching `\[ufoo\]`).
291
+ - **Antigravity App (`agy app`)**: Runs a silent background exit-on-message waiter polling `ufoo bus check "<subscriber-id>"` that exits `0` on `[ufoo]` output to trigger reactive wakeup, then acknowledges via MCP `ack_bus` and re-arms.
292
+ - **HTTP Wake Endpoints**: Register remote bots (e.g. `grok-bot`) with `ufoo bus join <session> grok-bot --wake-url https://... --wake-key-file /path/to/key` (`bearer-json` with `ufoo bus ack` queue gating).
573
293
 
574
- Settings follow each member's prompt-profile role, including numbered builders.
575
- Claude reasoning effort is left unset. All 24 built-in members have an empty
576
- manual override ready to customize.
577
- agy's selected model IDs include the thinking tier, so their separate
578
- `reasoning_effort` defaults are empty. Carbon is reserved for architectural and
579
- root-cause work, Argon for coordination and critical review, and Hydrogen for
580
- implementation and verification.
294
+ ---
581
295
 
582
- For example, an architect member contains:
296
+ ## Multi-Agent Groups, Context & Observability
583
297
 
584
- ```json
585
- "model_config": {
586
- "codex": { "model": "gpt-6-astra", "reasoning_effort": "high" },
587
- "claude": { "model": "claude-fable-5-2", "reasoning_effort": "" },
588
- "agy": { "model": "gemini-4-carbon-high", "reasoning_effort": "" },
589
- "override": { "model": "", "reasoning_effort": "" }
590
- }
591
- ```
298
+ ### Built-In Group Templates (`templates/groups/`)
592
299
 
593
- A nonempty `override.model` replaces the entire selected provider configuration;
594
- an empty override effort does not inherit effort from any provider default.
595
- Otherwise the member's provider selects `codex`, `claude` or `agy`. Empty model
596
- settings keep the existing project/provider defaults. Overrides select a model,
597
- not a different provider. Internal auto members under the agy provider run as
598
- native ucode workers with explicit agy provider/model settings; external agy
599
- members use the CLI's `--model` and optional `--effort` flags. Other native
600
- provider settings remain unchanged when no matching model setting exists. Explicit
601
- `type: "ucode"` members select defaults using their effective native provider
602
- (`UFOO_UCODE_PROVIDER`, global `ucodeProvider`, then project `agentProvider`).
603
- Codex maps to `codex`, Anthropic to `claude`, and agy to `agy`; manual overrides
604
- also work with other native providers. Model, provider and effort are carried
605
- through launch and resume. Project/global custom templates remain
606
- authoritative over built-ins.
607
- Dry runs and group state expose the selected model, effort and source. Recovery
608
- preserves the saved selection; edits affect newly launched groups, not live workers.
300
+ Launch coordinated multi-agent pipelines (`build-lane`, `build-ultra`, `design-system`, `product-discovery`, `ui-plan-review`, `ui-polish`, `verify-ship`) directly from chat or CLI:
609
301
 
610
302
  ```text
611
303
  /group templates
612
304
  /group template show build-lane
613
- /group template validate templates/groups/build-lane.json
614
305
  /group run build-lane dry_run=true
615
- /group run build-lane instance=docs-refresh
306
+ /group run build-lane instance=release-v4
616
307
  /group status
617
308
  /group diagram build-lane mermaid
618
- /group stop docs-refresh
309
+ /group stop release-v4
619
310
  ```
620
311
 
621
- ### Online Relay
312
+ Every member across all 7 templates carries role-tuned defaults for `codex`, `claude`, and `agy` plus an optional manual `override`:
622
313
 
623
- ```bash
624
- ufoo online server --host 127.0.0.1 --port 8787
625
- ufoo online token codex:abc123 --nickname builder
626
- ufoo online room create --nickname builder --name review-room --type private --password secret
627
- ufoo online connect --nickname builder --room <room_id> --room-password secret
628
- ufoo online send --nickname builder --room <room_id> --text "handoff ready"
629
- ufoo online inbox builder --unread
630
- ```
631
-
632
- The default public service URL is `https://online.ufoo.dev`. Local development
633
- can run its own relay with `ufoo online server`.
634
-
635
- Internal Codex, Claude Code and ucode panes share the standalone ucode TUI's
636
- transcript renderer and one bottom multiline input. Submitting immediately shows
637
- loading; waiting, thinking, generating, tool execution, user interaction, errors,
638
- elapsed time, context usage and plans follow the selected agent's actual events.
639
- Provider-specific retry, compaction and background task events use the same status
640
- surface. Text, thinking and tool
641
- results update from provider events; Ctrl+O expands the newest thinking/tool
642
- block in the focused pane. Display observations are separate from agent inboxes,
643
- so peer-routed tasks remain visible without waking the main agent. Output and
644
- drafts survive switching between main-only, focused-child and all-child layouts.
314
+ | Role | Codex (`model` / `effort`) | Claude | Antigravity (`agy`) |
315
+ |---|---|---|---|
316
+ | Architect, Debugger, Discovery, Design Consultant | `gpt-6-astra` / `high` | `claude-fable-5-2` | `gemini-4-carbon-high` |
317
+ | Builder, Frontend Refiner | `gpt-6.1-sol` / `high` | `claude-opus-5-5` | `gemini-4-hydrogen-high` |
318
+ | Reviewer, Scope Challenger, Critics, Release Coordinator | `gpt-6.1-sol` / `xhigh` | `claude-opus-5-5` | `gemini-4-argon-high` |
319
+ | PMO | `gpt-6-astra` / `high` | `claude-fable-5-2` | `gemini-4-argon-high` |
320
+ | QA | `gpt-6.1-sol` / `xhigh` | `claude-opus-5-5` | `gemini-4-hydrogen-high` |
645
321
 
646
- ### Native ucode Runtime
322
+ ### Decisions, Shared Memory, Reports & Acceptance
647
323
 
648
324
  ```bash
649
- ufoo ucode doctor
650
- ufoo ucode prepare
651
- ufoo ucode build
325
+ # Durable shared project facts (use /ctx decisions for plan-level architectural constraints)
326
+ ufoo memory add "Auth token contract" --body "Refresh window is 300s..." --tags auth,api
327
+ ufoo memory list --tag auth
328
+ ufoo memory show mem-0001
329
+
330
+ # Unified prompt history & structured task lifecycle reports
331
+ ufoo history build && ufoo history show 20
332
+ ufoo report start "Refactor session store" --task store-v2 --agent builder
333
+ ufoo report done "All unit tests green" --task store-v2 --agent builder
334
+ ufoo report list
652
335
  ```
653
336
 
654
- `ucode` can discover built-in and local `SKILL.md` workflow capabilities. Full
655
- skill bodies are loaded only when explicitly referenced.
337
+ Worker `done` reports record concise 1–4 line handoffs with file references; parent acceptance (`accept_task` / `manage_tasks operation=accept`) is tracked separately and requires post-report validation tool evidence.
656
338
 
657
- ### Background Command Notifications
339
+ ### Tracing & Metrics (`OBSERVABILITY.md`)
658
340
 
659
- Native ufoo and ucode can continue automatically when a background command exits
660
- or a condition is met. For example, the agent can start a development server with:
341
+ Inspect end-to-end parent/child model calls, tool executions, context projections, and delegation latency without invoking a model or starting a daemon:
661
342
 
662
- ```json
663
- {
664
- "command": "npm run dev",
665
- "background": true,
666
- "wake": {
667
- "conditions": [{ "type": "log_contains", "text": "ready" }]
668
- }
669
- }
343
+ ```bash
344
+ ufoo trace <task-id> --json
345
+ ufoo trace --agent <id-or-nickname> --follow
346
+ ufoo metrics --json > baseline.json
347
+ ufoo metrics --baseline baseline.json --json
670
348
  ```
671
349
 
672
- Supported conditions are `log_contains` (literal `text`), `file_exists`
673
- (workspace `path`), and `port_open` (a `port` on `127.0.0.1`). Each fires once;
674
- exit notification is enabled by default and can be disabled with
675
- `wake.onExit: false`. `wake.timeoutMs` bounds the subscription (default and
676
- maximum 12 hours). Expiry sends one notification without stopping the command.
677
-
678
- The host watches without model polling. Notifications continue the same session
679
- after its current turn and any pending user question. Stopping the command or
680
- cancelling its task revokes its watches. Pending watches survive host restart;
681
- ucode must reopen the original session to resume delivery. Interrupted wake
682
- invocations with uncertain effects are not automatically replayed. Inspect
683
- `bash` with `action: "status"` and its `backgroundId` for delivery status.
684
- One-shot command-line runs without a resident host do not provide auto-wake.
350
+ Read-only MCP equivalents: `read_agent_trace` and `read_agent_metrics`. See [docs/OBSERVABILITY.md](docs/OBSERVABILITY.md).
685
351
 
686
- ### Your Everyday Chrome
352
+ ### Online Relay (`ufoo online`)
687
353
 
688
- The native project main agent, writable native child tasks, and `ucode` have a
689
- shared `browser` tool powered by Playwright. It connects to an existing browser
690
- and preserves its signed-in sessions; it never falls back to launching a fresh
691
- profile. SDK-managed Codex/Claude wrappers keep their own tool configuration.
692
-
693
- Browser automation requires Node.js 20 or newer (the ufoo core still supports
694
- Node.js 18.17+).
695
-
696
- ufoo Browser is an optional user-level component managed outside individual
697
- projects (`~/.ufoo/browser/` and `~/.ufoo/config.json`):
354
+ Collaborate across machines over `https://online.ufoo.dev` or a self-hosted WebSocket relay:
698
355
 
699
356
  ```bash
700
- ufoo setup --browser=install # or interactive `ufoo setup`
701
- ufoo browser status --json
702
- ufoo browser doctor
703
- ufoo browser enable | disable
704
- ufoo browser update
705
- ufoo browser uninstall
357
+ ufoo online server --host 127.0.0.1 --port 8787
358
+ ufoo online token codex:abc123 --nickname builder
359
+ ufoo online room create --nickname builder --name review-room --type private --password secret
360
+ ufoo online connect --nickname builder --room <room_id> --room-password secret
361
+ ufoo online send --nickname builder --room <room_id> --text "handoff ready"
362
+ ufoo online inbox builder --unread
706
363
  ```
707
364
 
708
- During developer preview (before the Chrome Web Store listing is published),
709
- register developer mode and load the unpacked extension from
710
- `extensions/ufoo-browser/`:
365
+ ---
711
366
 
712
- ```bash
713
- ufoo browser install --dev
714
- ```
367
+ ## Providers & Configuration
715
368
 
716
- Once installed and enabled, the extension connects automatically via Chrome
717
- Native Messaging to the user-scoped broker (`ufoo` and `ucode` share one
718
- broker). Agents list tabs with `browser_tabs` (`action=list`) and claim tabs by
719
- `tabId`; a tab already in use by another agent returns `browser_tab_busy`
720
- without preemption. You can release individual tabs or pause all control from
721
- the extension popup at any time.
369
+ Project settings live in `.ufoo/config.json`; user-wide `ucode`, daemon, `browser`, and `mac` settings live in `~/.ufoo/config.json`. Use `/settings` in the TUI (or click the footer provider caption) to switch providers, models, custom OpenAI Chat/Responses gateways, and thinking effort (`low`, `medium`, `high`, `xhigh`, `max`).
722
370
 
723
- Compatibility modes remain supported: set `backend: "playwright-extension"`
724
- (with `UFOO_BROWSER_PROFILE` if needed) for the official
725
- [Playwright Extension](https://chromewebstore.google.com/detail/playwright-extension/mmlmfjhmonkocbjadbfplnigmagldckm),
726
- or use Chrome 144+ remote debugging (`chrome://inspect/#remote-debugging`):
371
+ - **Codex & OpenAI**: Defaults to `gpt-6.1-sol` (`medium` effort; `gpt-6-luna` aux model), refreshing local Codex OAuth credentials automatically.
372
+ - **Claude / Anthropic**: Defaults to `claude-opus-5-5` (`claude-haiku-5-5` aux model) with adaptive thinking and streamed thinking summaries.
373
+ - **Antigravity (`agy`)**: Select `/provider agy` in `ufoo` or `ucode --provider agy` (defaults to `gemini-4-carbon-high` and aux `gemini-4-hydrogen-high`). Automatically reuses your `agy` login from macOS Keychain / Linux Secret Service / Cloud Code auth (`UFOO_AGY_AUTH_PATH`, `UFOO_AGY_ACCESS_TOKEN`, `UFOO_AGY_PROJECT_ID` overrides supported).
374
+ - **Grok Build & Kimi Code**: Supported via `ugrok` / `grok-cli` (`grok-4.6`) and `ukimi` / `kimi-cli`.
375
+ - **Custom Gateways**: Set `agentProvider: "custom"` (or global `ucodeProvider` / `ucodeBaseUrl` / `ucodeApiKey`); uses OpenAI Chat Completions by default or OpenAI Responses when the URL ends in `/responses`.
727
376
 
728
- ```bash
729
- UFOO_BROWSER_CDP_ENDPOINT=chrome ucode
730
- ```
731
-
732
- You can also supply an existing `http://127.0.0.1:9222` or WebSocket endpoint.
733
- An already-running daily Chrome does not automatically expose that port.
734
- For the project main agent, set this environment variable when starting the
735
- ufoo daemon; an existing daemon must be restarted to pick up changed settings.
736
- CDP mode grants one ufoo/ucode session exclusive control until it disconnects,
737
- because multiple clients would otherwise manipulate the same tabs. Other
738
- applications and manual browser use are not covered by this lease.
739
-
740
- The agent can list/select tabs, navigate, inspect snapshots, click/type, fill
741
- forms, upload workspace files, handle dialogs, and take screenshots. Tool
742
- operations also include screenshot-guided mouse clicks, dragging and scrolling
743
- for canvas-based pages. Plan mode allows inspection only; browser actions run
744
- through the direct capability, not synchronous `plan_graph` tool nodes. Tool
745
- schemas are discovered on demand behind one stable model-facing tool. Page
746
- content is data, not instructions; external actions stay within the user's
747
- authorized task. Screenshot images are delivered to the model and saved under
748
- `.ufoo/browser/`; long results include an `outputPath` for further reading.
749
-
750
- `browser` supports `status`, `connect`, `tools`, `call`, and `disconnect`.
751
- `tools` with a `tool` name returns its argument schema. A lost connection or
752
- an action with an unknown outcome requires explicit reconnection and inspection,
753
- not an automatic repeated click. Idle connections disconnect after ten minutes.
754
- Disconnect releases control without closing Chrome or its existing tabs.
755
-
756
- Browser setup instructions: [Playwright existing-browser connections](https://playwright.dev/mcp/configuration/browser-extension).
757
- Developers can run the optional real-Chrome fixture with
758
- `UFOO_TEST_BROWSER=1 npm test -- --runTestsByPath test/integration/browser-existing-chrome.test.js`;
759
- it uses a disposable profile and a local test page, never the user's profile.
760
-
761
- ## Configuration
762
-
763
- Project configuration is stored in `.ufoo/config.json`. `ucode` provider
764
- credentials are stored globally in `~/.ufoo/config.json` and merged at load time.
765
-
766
- Common project settings:
377
+ Project `.ufoo/config.json` example:
767
378
 
768
379
  ```json
769
380
  {
770
381
  "launchMode": "auto",
382
+ "daemonTopology": "global",
771
383
  "agentProvider": "codex-cli",
772
- "codexAuthPath": "",
773
- "codexOauthRefreshWindowSec": 300,
774
- "claudeOauthProfile": "",
775
- "claudeOauthTokenPath": "",
776
- "claudeOauthRefreshWindowSec": 300,
777
384
  "agentModel": "",
385
+ "agentAuxModel": "",
386
+ "agentThinking": "medium",
778
387
  "autoResume": false
779
388
  }
780
389
  ```
781
390
 
782
- Internal Codex and Claude always use their SDKs; there is no thread-mode setting.
783
- Internal Codex currently defaults to full host access (`danger-full-access`),
784
- network enabled, and no approval prompts (`approvalPolicy: never`). It can access
785
- simulators, system services and build caches outside the project with the current
786
- OS user's permissions. Granular permissions and approval controls are deferred;
787
- explicit SDK thread options still override these defaults. Relaunch existing
788
- internal Codex workers after updating to apply the new policy.
789
-
790
- Supported `launchMode` values: `auto`, `internal`, `tmux`, `terminal`, and
791
- `host`. Dashboard panes and process management support internal Codex, Claude and ucode workers; provider selections remain independent. The `@` directory and main-agent communication also include active external agents. External agents receive messages through their own host and can return replies/reports, without exposing their terminal or detailed output in ufoo.
792
-
793
- The dashboard always uses internal children and has no `/mode` command;
794
- the binary has no `ufoo mode` command either.
795
- Manual `ucodex` and `uclaude` wrappers detect tmux, host sessions, Terminal.app
796
- and iTerm2 from their environment, then register the actual terminal type, TTY
797
- and delivery channels with the daemon. Their event-bus communication works
798
- without a dashboard. MCP agents communicate through MCP message interfaces
799
- without requiring a terminal adapter.
800
- With the project daemon running, a registered worker can initiate contact with
801
- `ufoo-agent` using `dispatch_message` or `ufoo bus send ufoo-agent "<message>"`
802
- from its project and inherited worker identity. No prior delegation or open
803
- chat window is required: the daemon durably accepts the message and wakes the
804
- main runtime. Use this for substantive results, questions or changed blockers;
805
- assigned task completion still requires a lifecycle report with its task ID.
806
- The main agent uses one runtime for coding and routing, configured by
807
- `agentProvider` and `agentModel`. `/settings agent` manages these settings;
808
- `/settings ucode` manages the independent ucode gateway settings.
809
-
810
- The bottom Settings bar includes `custom`, `model`, and `thinking`. Select
811
- `custom` to enter an API URL and hidden API key, then choose its model and
812
- thinking intensity. `/settings agent custom`, `/settings agent model`, and
813
- `/settings agent thinking` open the same controls. Model menus fetch the current
814
- provider's complete selectable catalog, including paginated results; Codex
815
- menus omit entries marked hidden by the provider. Endpoints without a
816
- models route also allow a manually entered model ID. Changing model or thinking
817
- applies to the next request and keeps the current conversation. Changing provider
818
- starts a new conversation, retaining the old one in runtime storage.
819
- OpenAI thinking choices include separate `xhigh` and `max` values, preserved in
820
- requests. When a provider uses a configured gateway, the model list comes from
821
- that gateway; upgrading an agent SDK does not change the gateway's catalog.
822
-
823
- Custom main-agent settings use `agentProvider: "custom"`, `agentBaseUrl`,
824
- `agentApiKey`, `agentModel`, and `agentThinking` in `.ufoo/config.json`.
825
- Custom APIs use OpenAI Chat Completions by default, or Responses when the URL
826
- ends in `/responses`. There is no Anthropic protocol selector for custom APIs.
827
- Internal Claude retains its native provider transport and credentials.
828
-
829
- #### Antigravity
830
-
831
- Select `/provider agy` for the main agent, or run `ucode --provider agy` for
832
- standalone coding. The default model is `gemini-4-carbon-high` and the
833
- default auxiliary model is `gemini-4-hydrogen-high`. The native provider uses
834
- the Antigravity Cloud Code API for streaming, tool calls, and
835
- the `/model` catalog. Select a text model available to your account with
836
- `/model`. If a session was created with the earlier `agy` setting, start a
837
- fresh session to bind the Antigravity transport.
838
-
839
- Sign in with `agy` once. ufoo reuses the local Antigravity login from the
840
- macOS Keychain, Linux Secret Service, or the CLI's fallback auth file. macOS
841
- may ask for permission to read the existing Keychain item. ufoo discovers
842
- the Cloud Code project and asks `agy` to renew an expiring login.
843
-
844
- To choose credentials explicitly, set `UFOO_AGY_AUTH_PATH` to your Antigravity
845
- auth JSON from CLIProxyAPI, or set `UFOO_AGY_ACCESS_TOKEN`. Set
846
- `UFOO_AGY_PROJECT_ID` to override project discovery. For the main agent, these
847
- variables must be available to the ufoo daemon when it starts.
848
- `UFOO_AGY_BASE_URL` overrides the Cloud Code base URL. `UFOO_AGY_USER_AGENT`
849
- overrides the Antigravity client header if the endpoint requires a newer version.
850
-
851
- Ordinary provider sessions authenticate through their provider-owned adapters;
852
- MCP `agent_handle` is never model authentication. Standalone and internal ucode
853
- use the independent gateway settings below.
854
-
855
- Global `ucode` settings:
391
+ Global `~/.ufoo/config.json` (`ucode`, `browser`, and `mac` sections):
856
392
 
857
393
  ```json
858
394
  {
859
395
  "ucodeProvider": "openai",
860
- "ucodeModel": "gpt-4.1",
396
+ "ucodeModel": "gpt-6.1-sol",
397
+ "ucodeAuxModel": "",
861
398
  "ucodeBaseUrl": "https://api.openai.com/v1",
862
399
  "ucodeApiKey": "sk-...",
863
- "ucodeAgentDir": ""
400
+ "browser": { "enabled": true, "backend": "ufoo-extension" },
401
+ "mac": { "enabled": true, "hud": true, "takeoverGuard": true }
864
402
  }
865
403
  ```
866
404
 
867
- ## Source Layout
405
+ > **Note on Internal Codex Host Access**: Embedded internal Codex SDK threads currently default to `danger-full-access`, network enabled, and `approvalPolicy: never` (bounded by your OS user permissions) so mobile simulators, Gradle/ADB daemons, and build caches work seamlessly. Relaunch existing workers after upgrading to pick up runtime policy updates.
406
+
407
+ ---
408
+
409
+ ## Source Layout & Development
868
410
 
869
411
  ```text
412
+ crates/ufoo-tui/ Rust ratatui terminal renderer (chat & ucode surfaces)
413
+ extensions/ufoo-browser/ Chrome MV3 extension for ufoo Browser
870
414
  src/
871
- app/ chat client state and CLI command entry
872
- ui/ Rust TUI hosts + pure formatting helpers
873
- crates/ufoo-tui Rust ratatui child (required for chat/ucode)
874
- runtime/ daemon, projects, terminal adapters, contracts, privacy, process helpers
875
- coordination/ bus, context, memory, history, reports, state, status
876
- orchestration/ router/controller logic, groups, solo roles
877
- agents/ shared runtime, capabilities, profiles, providers, launchers, prompts
878
- code/ native ucode host, launcher, skills, file/shell tools
879
- tools/ shared controller/worker tool registry and handlers
880
- online/ relay client/server/runner/token helpers
415
+ app/ Chat client controller & CLI command groups (setup, browser, mac, trace, metrics...)
416
+ ui/ Rust TUI socket hosts, multi-pane session manager, and pure formatters
417
+ runtime/ Global daemon, project runtimes, MCP HTTP/stdio, terminal, browser & mac runtimes
418
+ orchestration/ Launch routing, group templates/validation, and solo role policies
419
+ agents/ Shared runtime core, Context Engine V2, capabilities, profiles, providers, prompts
420
+ code/ Native ucode host, file/shell/background tools, Plan Mode, and session codecs
421
+ coordination/ Event bus, decisions, shared memory, history, reports, and file-locked state
422
+ tools/ Shared controller/worker MCP tool schemas and handlers
423
+ online/ WebSocket relay server, client, rooms, and inbox helpers
424
+ SKILLS/ Default skills (ufoo, ufoo-bus, ufoo-context, ufoo-online)
425
+ OPTIONAL_SKILLS/ Opt-in host wake skill (ufoo-bus-poll)
426
+ templates/groups/ Built-in multi-agent workflow templates
881
427
  ```
882
428
 
883
- See [PROJECT.md](docs/PROJECT.md) for the maintainer-facing map and detailed package
884
- ownership.
885
-
886
- Reports share one task ID across lifecycle phases. Pass `--task <id>` to
887
- `ufoo report`, or `task_id` to MCP `report_agent_status`. Without an explicit ID,
888
- CLI progress/done/error attach to the agent's single active task; multiple
889
- active tasks require an ID. Reports are acknowledged after persistence, and
890
- ordinary bus replies do not imply task completion. `autoResume` defaults to
891
- `false` consistently before and after partial configuration updates.
429
+ See [docs/PROJECT.md](docs/PROJECT.md) for full architectural invariants and package boundaries.
892
430
 
893
- ## Development
431
+ ### Development & Testing
894
432
 
895
433
  ```bash
896
434
  npm install
897
- npm run pack:tui
898
- npm link
899
- node bin/ufoo.js --help
900
- npm test
435
+ npm run pack:tui # Build & stage crates/ufoo-tui into dist/tui/<platform>-<arch>/
436
+ cargo test -p ufoo-tui # Rust TUI unit tests
437
+ npm test # Full Jest suite
901
438
  ```
902
439
 
903
- Useful checks:
440
+ Optional live integration suites:
904
441
 
905
442
  ```bash
906
- npm run test:watch
907
- npm run test:coverage
908
- ```
909
-
910
- The repository is CommonJS, targets Node.js 18.17+, and ships a Rust TTY UI
911
- (`crates/ufoo-tui`) as platform binaries under `dist/tui/`.
443
+ # Real Chrome extension/CDP fixture (uses a disposable profile, never your personal profile)
444
+ UFOO_TEST_BROWSER=1 npm test -- --runTestsByPath test/integration/browser-existing-chrome.test.js
912
445
 
913
- ## Release
914
-
915
- Releases are published by GitHub Actions (`.github/workflows/release.yml`).
916
- The workflow builds `ufoo-tui` for `darwin-arm64`, `darwin-x64`, `linux-x64`,
917
- and `linux-arm64`, stages them under `dist/tui/<platform>/`, then runs
918
- `npm publish`.
919
-
920
- 1. Bump the version and push a matching tag:
921
-
922
- ```bash
923
- npm test
924
- npm version patch # commits package.json + creates tag vX.Y.Z
925
- git push --follow-tags
446
+ # macOS independent Agent Mouse pointer verification against a disposable AppKit window
447
+ UFOO_TEST_MAC_POINTER=1 npm test -- --runTestsByPath test/integration/mac-independent-pointer.test.js
926
448
  ```
927
449
 
928
- 2. Ensure the repo secret `NPM_TOKEN` is set (npm automation token with
929
- publish rights for `u-foo`).
930
- 3. The `Release` workflow runs on the `v*` tag. Use **Actions → Release →
931
- Run workflow** for a manual dry-run (`dry_run=true` packs but does not publish).
450
+ ### Release & Troubleshooting
932
451
 
933
- Local one-platform staging (dev only):
934
-
935
- ```bash
936
- npm run pack:tui # cargo build + copy into dist/tui/$PLATFORM
937
- npm pack --dry-run # requires at least one staged binary (prepack check)
938
- ```
939
-
940
- Publishing without the GitHub workflow still requires an npm account/token with
941
- permission for `u-foo`, plus staged `dist/tui/` binaries.
942
- ## Troubleshooting
943
-
944
- Run a local entry directly if the linked binary is not on `PATH`:
945
-
946
- ```bash
947
- node bin/ufoo.js --help
948
- ```
949
-
950
- If Codex cannot write under its default home, point it at a project-local
951
- directory before launching chat or agents:
952
-
953
- ```bash
954
- export CODEX_HOME="$PWD/.ufoo/codex"
955
- ufoo
956
- ```
957
-
958
- For Codex-friendly notifications, prefer bus helpers over raw terminal text
959
- injection:
960
-
961
- ```bash
962
- ufoo bus alert codex:abc123 --daemon
963
- ufoo bus listen codex:abc123
964
- ```
452
+ - **Releases**: GitHub Actions (`.github/workflows/release.yml`) runs full CI verification, builds `ufoo-tui` across `darwin-arm64`, `darwin-x64`, `linux-x64`, and `linux-arm64`, verifies package integrity, and publishes to npm on `v*` tags (`npm version patch && git push --follow-tags`).
453
+ - **Deleted Workspaces**: Preview stale project registry entries with `ufoo project prune`, and archive them to `~/.ufoo/projects/archive/` with `ufoo project prune --apply`.
454
+ - **Restricted Codex Home**: If `~/.codex` is read-only in a sandboxed environment, export `CODEX_HOME="$PWD/.ufoo/codex"` before launching `ufoo`.
965
455
 
966
456
  ## License
967
457