@minasoft/mina-ai-router 0.1.5 → 0.2.1

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 (31) hide show
  1. package/README.md +69 -16
  2. package/dist/apps/cli/src/index.js +1251 -46
  3. package/dist/apps/http-server/src/index.js +559 -43
  4. package/dist/apps/http-server/src/public/assets/index-Bl059Jd0.js +9 -0
  5. package/dist/apps/http-server/src/public/assets/index-CaPxN_Ez.css +1 -0
  6. package/dist/apps/http-server/src/public/index.html +2 -2
  7. package/dist/apps/mcp-server/src/index.js +55 -9
  8. package/dist/packages/core/src/capability-profile.js +145 -0
  9. package/dist/packages/core/src/index.js +4 -0
  10. package/dist/packages/core/src/mcp-preflight.js +80 -0
  11. package/dist/packages/core/src/registry.js +128 -3
  12. package/dist/packages/core/src/request-store.js +158 -0
  13. package/dist/packages/core/src/response-parser.js +76 -8
  14. package/dist/packages/core/src/router.js +408 -13
  15. package/dist/packages/core/src/runtime-paths.js +16 -0
  16. package/dist/packages/core/src/version.js +57 -0
  17. package/dist/packages/mcp/src/provider.js +57 -6
  18. package/dist/packages/transports/src/headless/headless-transport.js +13 -8
  19. package/dist/packages/transports/src/tmux/tmux-client.js +334 -0
  20. package/dist/packages/transports/src/tmux/tmux-transport.js +10 -0
  21. package/docs/DEVELOPER-START-GUIDE.md +9 -1
  22. package/docs/GETTING-STARTED.md +10 -5
  23. package/docs/HTTP-UI-MCP.md +39 -13
  24. package/docs/MCP-CLIENT-SETUP.md +56 -3
  25. package/docs/SKILL-INSTALL-GUIDE.md +21 -3
  26. package/docs/TROUBLESHOOTING.md +51 -2
  27. package/docs/USER-START-GUIDE.md +157 -26
  28. package/docs/assets/mina-ai-router-overview.svg +109 -0
  29. package/package.json +8 -2
  30. package/dist/apps/http-server/src/public/assets/index-Be0tne90.js +0 -9
  31. package/dist/apps/http-server/src/public/assets/index-CEhd8YGG.css +0 -1
@@ -1,6 +1,8 @@
1
1
  # HTTP UI and MCP Server
2
2
 
3
- Mina AI Router now runs as a local HTTP server.
3
+ Mina AI Router runs as a local HTTP server. It gives local Codex and Claude CLI agents a shared MCP router and a browser operations console.
4
+
5
+ ![Mina AI Router overview](./assets/mina-ai-router-overview.svg)
4
6
 
5
7
  It serves both:
6
8
 
@@ -32,21 +34,33 @@ mair server start --port 3333
32
34
  mair server status
33
35
  ```
34
36
 
37
+ When this long-running server is active, it is the live owner for the matching router state file. Compatible CLI reads and writes proxy to the server instead of using a separate one-shot snapshot, which keeps `/api/state`, the Web UI, MCP calls, and the persisted state file consistent.
38
+
39
+ `mair server start` waits for `/api/health` before reporting success. Bind failures such as `EADDRINUSE` and stale pid files that point at non-Mina servers are surfaced as operator diagnostics rather than raw parser errors.
40
+
35
41
  Stop:
36
42
 
37
43
  ```sh
38
44
  mair server stop
39
45
  ```
40
46
 
41
- ## Connect Codex CLI
47
+ ## Connect Codex or Claude CLI
42
48
 
43
49
  ```sh
44
- codex mcp remove mina-ai-router
45
- codex mcp add mina-ai-router --url http://127.0.0.1:3333/mcp
46
- codex mcp get mina-ai-router
50
+ # Codex users
51
+ mair setup codex --project /path/to/project
52
+ mair doctor --client codex --project /path/to/project
53
+
54
+ # Claude users
55
+ mair setup claude --project /path/to/project
56
+ mair doctor --client claude --project /path/to/project
47
57
  ```
48
58
 
49
- Expected transport:
59
+ Use `mair doctor --client all --project /path/to/project` only when you use both clients.
60
+
61
+ The Connect Agent guide in the UI shows the same setup commands with the live MCP URL for the current server. Manual repair commands are still available in the inspector when a selected agent is stuck in `mcp-configuring`.
62
+
63
+ Expected MCP URL after setup:
50
64
 
51
65
  ```text
52
66
  transport: streamable_http
@@ -63,15 +77,17 @@ http://127.0.0.1:3333/
63
77
 
64
78
  The page shows:
65
79
 
66
- - a router-centered agent flow diagram
67
- - registered agents as clickable nodes around the router
80
+ - a router-centered live flow diagram
81
+ - registered Codex or Claude agents as clickable nodes around the router
68
82
  - each agent's short capability notice on the node
69
- - agent status, project root, capability details, and tmux metadata in a modal
70
- - per-agent request history in a modal opened from the agent context menu
71
- - agent controls in the context menu: details, history, ask, attach commands, copy attach command, restart session, delete agent
83
+ - a floating agent inspector with status, project root, tmux metadata, attach command, capabilities, and recent requests
84
+ - an agent-filtered activity panel for routed request history
85
+ - agent controls in the context menu: open terminal, ask, attach commands, copy attach command, restart session, delete agent
86
+ - zoom, reset, draggable agent positions, and draggable flow canvas positioning
72
87
  - right-click flow background menu for creating a tmux-backed Codex or Claude agent from a project directory
73
88
  - a `Connect Agent` guide instead of manual UI registration
74
- - hidden `Developer Tools` for diagnostics such as the two-Codex demo and stale request cleanup
89
+
90
+ The UI is intentionally local-operations focused: it helps you see which local agent is available, what each agent can do, and which requests are moving between them.
75
91
 
76
92
  ## Health
77
93
 
@@ -89,6 +105,15 @@ mair version
89
105
  mair verify
90
106
  ```
91
107
 
108
+ For repository development, use `npm run verify` to run the full checkout test
109
+ suite. A linked checkout may make `mair verify` run that same suite from the Mina
110
+ package root. In an installed package, `mair verify` checks the packaged CLI,
111
+ MCP server, HTTP server, Web UI assets, docs, and registration skill.
112
+
113
+ Default verification does not require real Codex or Claude accounts. For local release readiness of the real CLI flow, run `MINA_REAL_CLI_SMOKE=1 npm run smoke:real-cli-contract` after `npm run verify`; it proves the installed client context can see `mina-ai-router` in the client MCP list.
114
+
115
+ `mair health`, `mair agents`, and `mair agent <id>` prefer live status from a running server whose recorded state path matches the current CLI state path. This keeps health output correct when the server was started with a non-default port and when an agent is actively busy inside the server process.
116
+
92
117
  ## Visible Agent Commands
93
118
 
94
119
  Start a visible Codex agent in the current directory:
@@ -130,7 +155,8 @@ npm run smoke:http
130
155
  3. Click `Connect Agent` for the registration command guide.
131
156
  4. Start an agent from its project directory with `mair codex` or `mair claude`.
132
157
  5. Confirm the agent appears in the flow diagram.
133
- 6. Click the agent node and use the context menu to inspect details, view history, or delete it.
158
+ 6. Click the agent node to open the inspector and filter the bottom activity panel to that agent.
159
+ 7. Use the agent context menu for terminal, ask, attach, restart, or delete actions.
134
160
 
135
161
  Alternative UI-created agent flow:
136
162
 
@@ -12,14 +12,35 @@ Start the router first:
12
12
  mair server start --port 3333
13
13
  ```
14
14
 
15
+ ## Recommended Setup
16
+
17
+ Use the MAIR setup command from the project you want the agent to work in:
18
+
19
+ ```sh
20
+ # Codex users
21
+ mair setup codex --project /path/to/project
22
+ mair doctor --client codex --project /path/to/project
23
+
24
+ # Claude users
25
+ mair setup claude --project /path/to/project
26
+ mair doctor --client claude --project /path/to/project
27
+ ```
28
+
29
+ If you use both clients, run both setup commands and then `mair doctor --client all --project /path/to/project`.
30
+
31
+ `mair setup` discovers the matching running server's MCP URL, configures the selected CLI, links the `mina-ai-router-agent` registration skill, and verifies that the client reports the same MCP URL. Verification must pass both the named entry check and the visible client list check, because a real session may fail to see Mina even when `mcp get` prints an entry. `mair doctor` prints a pass/fail matrix for the server, CLI binary, MCP config, skill install, and current blocked agents.
32
+
33
+ Use the manual commands below only for unusual client profiles or repair work.
34
+
15
35
  ## Codex
16
36
 
17
- Register the MAIR MCP server with Codex:
37
+ Manual Codex MCP repair:
18
38
 
19
39
  ```sh
20
40
  codex mcp remove mina-ai-router
21
41
  codex mcp add mina-ai-router --url http://127.0.0.1:3333/mcp
22
42
  codex mcp get mina-ai-router
43
+ codex mcp list
23
44
  ```
24
45
 
25
46
  Expected result:
@@ -36,14 +57,17 @@ cd /path/to/project
36
57
  mair codex
37
58
  ```
38
59
 
60
+ When a Codex session is created from the Web UI or `mair codex`, Mina runs an MCP preflight for that session profile. If the profile is missing or stale, the agent enters `mcp-configuring` and the inspector shows the setup, verify, and remove commands to run before self-registration continues.
61
+
39
62
  ## Claude
40
63
 
41
- Register the MAIR MCP server with Claude Code:
64
+ Manual Claude Code MCP repair:
42
65
 
43
66
  ```sh
44
67
  claude mcp remove mina-ai-router
45
68
  claude mcp add --transport http mina-ai-router http://127.0.0.1:3333/mcp
46
69
  claude mcp get mina-ai-router
70
+ claude mcp list
47
71
  ```
48
72
 
49
73
  Then start Claude inside a project with MAIR:
@@ -53,6 +77,8 @@ cd /path/to/project
53
77
  mair claude
54
78
  ```
55
79
 
80
+ Claude Code can keep MCP configuration per profile or project/session context. If a newly created Claude agent cannot see Mina MCP, keep it in `mcp-configuring`, run `mair setup claude --project /path/to/project` or the setup command shown by Mina, then verify with `mair doctor --client claude --project /path/to/project` before routing work to that session. The repaired session should show `mina-ai-router` in `claude mcp list`.
81
+
56
82
  ## Verify From the AI CLI
57
83
 
58
84
  In Codex or Claude, ask:
@@ -63,9 +89,36 @@ Use Mina AI Router MCP list_agents and summarize the registered agents.
63
89
 
64
90
  If the MCP setup is working, the agent should call `list_agents`.
65
91
 
92
+ ## Collaboration Prompt Example
93
+
94
+ After two or more agents are registered, ask one of them:
95
+
96
+ ```text
97
+ Use Mina AI Router to ask docs:
98
+ Review the README changes and summarize what a first-time user should understand.
99
+ ```
100
+
101
+ The source agent should call `list_agents` with its `callerSessionFingerprint` or `callerAgentId`, choose a target where `isSelf` is not true, send the work with `call_agent`, and check progress with `get_request_status`.
102
+
103
+ For a stronger first test, ask for both the routed answer and the request id:
104
+
105
+ ```text
106
+ Use Mina AI Router to ask api_server:
107
+ Which endpoint should the frontend call for user lookup?
108
+ Return the routed answer and the Mina request id you used.
109
+ ```
110
+
111
+ Then open the browser console and inspect that request in the activity panel. The request detail should show lifecycle status, request lease state, parsed answer or error, parser diagnostics, prompt evidence, raw terminal evidence, and recovery history.
112
+
113
+ If the target is stale, missing, or needs attention, ask the source agent to call `list_agents` again and select another available target or tell you which session needs repair.
114
+
115
+ If the request times out but the target terminal is still running, Mina keeps the lease as `orphaned`. Use `Interrupt Terminal` only when you want to send Ctrl-C to that tmux session. Use `Mark Recovered` after you have confirmed the session is idle or repaired. These are separate from `Cancel`, which only cancels an open router request.
116
+
66
117
  ## Available MCP Tools
67
118
 
68
119
  - `list_agents`: list known agents and their statuses
69
120
  - `register_agent`: register or update the current visible agent
70
- - `call_agent`: send a task to another registered agent
121
+ - `call_agent`: send a task to another registered agent. Provide `callerAgentId` or `callerSessionFingerprint` so Mina can reject accidental self-calls. Use `allowSelfCall: true` only for diagnostics.
71
122
  - `get_request_status`: check a routed request
123
+
124
+ `list_agents` returns `isSelf` for the caller when identity is supplied. A source agent should avoid targets where `isSelf` is true unless the user explicitly asked for a self-diagnostic.
@@ -8,9 +8,27 @@ skills/mina-ai-router-agent/SKILL.md
8
8
 
9
9
  The skill lets Codex or Claude register the current visible tmux-backed CLI session with MAIR without requiring the user to write a full registration payload.
10
10
 
11
+ ## Recommended
12
+
13
+ Use first-run setup instead of linking the skill by hand:
14
+
15
+ ```sh
16
+ # Codex users
17
+ mair setup codex --project /path/to/project
18
+ mair doctor --client codex --project /path/to/project
19
+
20
+ # Claude users
21
+ mair setup claude --project /path/to/project
22
+ mair doctor --client claude --project /path/to/project
23
+ ```
24
+
25
+ If you use both clients, run both setup commands and then `mair doctor --client all --project /path/to/project`.
26
+
27
+ `mair setup` links this skill into the right client location and verifies MCP config for the running router URL. Use the manual steps below only for custom profiles or repair.
28
+
11
29
  ## Codex
12
30
 
13
- Install the skill into your Codex skills directory:
31
+ Manual Codex skill install:
14
32
 
15
33
  ```sh
16
34
  mkdir -p ~/.codex/skills
@@ -45,7 +63,7 @@ Expected behavior:
45
63
 
46
64
  Claude Code project skills live under `.claude/skills/*/SKILL.md`.
47
65
 
48
- For a single project, copy or link the MAIR skill into that project:
66
+ Manual Claude project skill install:
49
67
 
50
68
  ```sh
51
69
  cd /path/to/project
@@ -91,6 +109,6 @@ Open the MAIR UI:
91
109
  http://127.0.0.1:3333/
92
110
  ```
93
111
 
94
- Click the agent node and choose `Status & Details`.
112
+ Click the agent node and open `Edit Capabilities` from the inspector.
95
113
 
96
114
  The capability summary should describe the target project, and the capability sources should mention files such as `CLAUDE.md`, `AGENTS.md`, `README.md`, or package metadata.
@@ -11,7 +11,9 @@ export MINA_TMUX_BIN=/opt/homebrew/bin/tmux
11
11
 
12
12
  ## MCP and CLI See Different Agents
13
13
 
14
- They are probably using different state files.
14
+ By default, Mina uses `~/.mair/router-state.json` and `~/.mair/mair-server.json` so commands run from different directories share one local server.
15
+
16
+ If MCP and CLI still see different agents, they are probably using explicit custom state files.
15
17
 
16
18
  Set the same `MINA_ROUTER_STATE` for both processes:
17
19
 
@@ -19,6 +21,53 @@ Set the same `MINA_ROUTER_STATE` for both processes:
19
21
  export MINA_ROUTER_STATE=/absolute/path/to/router-state.json
20
22
  ```
21
23
 
24
+ ## Agent Created But Not Ready
25
+
26
+ Visible Codex or Claude sessions can be reachable in tmux while still blocked by first-run prompts. Mina reports those sessions as `needs-attention` instead of `available`.
27
+
28
+ Common blockers:
29
+
30
+ - `permission-required`: approve the trust or permission prompt with the guided Mina action when available, or attach to the terminal and approve it directly.
31
+ - `client-update-required`: Codex is stopped at an update prompt. Use the Web UI's `Skip Codex Update` guided action for the known skip choice, or attach to tmux and choose an update option manually, then retry registration.
32
+ - `mcp-configuring`: run the setup command shown in the inspector, then confirm `codex mcp list` or `claude mcp list` contains `mina-ai-router`.
33
+ - `registration-pending`: the prompt was sent and Mina is waiting for the CLI agent to call the registration skill.
34
+
35
+ ## `mair server start` Fails on an Occupied Port
36
+
37
+ `mair server start` waits for the Mina `/api/health` endpoint before it reports success. If the port is already occupied, the command should fail with a bind diagnostic such as `EADDRINUSE` and point at the server log.
38
+
39
+ Useful checks:
40
+
41
+ ```sh
42
+ mair server status
43
+ lsof -nP -iTCP:3333 -sTCP:LISTEN
44
+ cat ~/.mair/mair-server.log
45
+ ```
46
+
47
+ Stop the process that owns the port, or start Mina on another port:
48
+
49
+ ```sh
50
+ mair server start --port 34333
51
+ ```
52
+
53
+ ## Stale or Non-Mina Pid File
54
+
55
+ If `MINA_SERVER_PID` points at a live process that is not Mina, CLI live reads and writes stop with a stale/non-Mina pid-file diagnostic. This prevents split-brain writes against the local state file.
56
+
57
+ Safe recovery:
58
+
59
+ ```sh
60
+ mair server status
61
+ rm ~/.mair/mair-server.json
62
+ mair server start --port 3333
63
+ ```
64
+
65
+ Use the custom pid path if you set one:
66
+
67
+ ```sh
68
+ rm "$MINA_SERVER_PID"
69
+ ```
70
+
22
71
  ## `call_agent` Times Out
23
72
 
24
73
  Common causes:
@@ -69,7 +118,7 @@ mair register payment --agent gemini --transport tmux --session payment --target
69
118
  Runtime JSON state is ignored by git.
70
119
 
71
120
  ```sh
72
- rm data/router-state.json
121
+ rm ~/.mair/router-state.json
73
122
  ```
74
123
 
75
124
  Use this carefully; it deletes local registrations and request history.
@@ -2,26 +2,34 @@
2
2
 
3
3
  This guide is for someone who wants to use Mina AI Router, not develop it.
4
4
 
5
+ Mina AI Router is for running several local Codex or Claude CLI agents and letting them collaborate through one local MCP router.
6
+
7
+ ![Mina AI Router overview](./assets/mina-ai-router-overview.svg)
8
+
5
9
  ## What You Will Set Up
6
10
 
7
11
  You will:
8
12
 
9
13
  1. Install the `mair` command.
10
14
  2. Start the local router and Web UI.
11
- 3. Connect Codex or Claude to the local MCP server.
12
- 4. Install the agent registration skill.
15
+ 3. Run first-run setup for Codex or Claude.
16
+ 4. Check readiness with `mair doctor`.
13
17
  5. Create visible tmux-backed agents.
14
- 6. Inspect and control agents from the browser.
18
+ 6. Route tasks between agents and watch the activity from the browser.
15
19
 
16
20
  ## 1. Install the `mair` Command
17
21
 
18
- Install the published package:
22
+ Use the GitHub checkout:
19
23
 
20
24
  ```sh
21
- npm install -g @minasoft/mina-ai-router
25
+ git clone https://github.com/stevennana/mina-ai-router.git
26
+ cd mina-ai-router
27
+ npm install
28
+ npm run build
29
+ npm link
22
30
  ```
23
31
 
24
- Verify:
32
+ Verify the linked command:
25
33
 
26
34
  ```sh
27
35
  mair version
@@ -32,10 +40,29 @@ Expected output:
32
40
  ```json
33
41
  {
34
42
  "name": "@minasoft/mina-ai-router",
35
- "version": "0.1.0"
43
+ "version": "0.1.5"
36
44
  }
37
45
  ```
38
46
 
47
+ For a GitHub checkout, the full test suite is:
48
+
49
+ ```sh
50
+ npm run verify
51
+ ```
52
+
53
+ Before claiming a real Codex or Claude out-of-box flow is ready on your machine, also run:
54
+
55
+ ```sh
56
+ MINA_REAL_CLI_SMOKE=1 npm run smoke:real-cli-contract
57
+ ```
58
+
59
+ Default `npm run verify` is account-free and deterministic. The opt-in real CLI contract smoke checks the installed client context and can fail when a local Codex or Claude profile cannot see Mina MCP.
60
+
61
+ When Mina is installed as a packaged CLI instead of linked from this checkout,
62
+ `mair verify` runs an installed-package self-check. It validates Mina's packaged
63
+ CLI, MCP server, HTTP server, Web UI assets, docs, and registration skill without
64
+ running any npm script from your current project.
65
+
39
66
  ## 2. Start the Router
40
67
 
41
68
  ```sh
@@ -49,16 +76,31 @@ Open:
49
76
  http://127.0.0.1:3333/
50
77
  ```
51
78
 
52
- The center node is the local MCP router. The surrounding nodes are registered agents.
79
+ The center node is the local MCP router. The surrounding nodes are visible Codex or Claude agents running in local tmux sessions.
53
80
 
54
81
  ![Live agent flow](./assets/mair-live-flow.jpg)
55
82
 
83
+ While the router server is running, it owns the live state for that `MINA_ROUTER_STATE` file. Normal CLI reads and writes talk to the matching server when possible, so `mair health`, `mair agents`, `mair agent <id>`, the Web UI, and MCP calls stay aligned during active routes.
84
+
85
+ By default, those runtime files live in `~/.mair`. You can run `mair server status` from your home directory or any project directory and it will check the same local server. Use `MINA_RUNTIME_DIR`, `MINA_ROUTER_STATE`, or `MINA_SERVER_PID` only when you intentionally want an isolated test/runtime.
86
+
56
87
  ## 3. Connect Your AI CLI to MCP
57
88
 
58
- Pick the guide for the CLI you use:
89
+ Run setup from the project directory you want the agent to work in:
59
90
 
60
- - Codex: [Codex MCP Setup](./MCP-CLIENT-SETUP.md#codex)
61
- - Claude: [Claude MCP Setup](./MCP-CLIENT-SETUP.md#claude)
91
+ ```sh
92
+ # Codex users
93
+ mair setup codex --project /path/to/project
94
+ mair doctor --client codex --project /path/to/project
95
+
96
+ # Claude users
97
+ mair setup claude --project /path/to/project
98
+ mair doctor --client claude --project /path/to/project
99
+ ```
100
+
101
+ If you use both clients, run both setup commands and then `mair doctor --client all --project /path/to/project`.
102
+
103
+ `mair setup` discovers the matching running server's MCP URL, registers that URL with the chosen CLI, installs the registration skill, and verifies the client config. If your CLI uses a special profile, use the manual commands in [MCP Client Setup](./MCP-CLIENT-SETUP.md).
62
104
 
63
105
  This gives the AI CLI access to these MAIR MCP tools:
64
106
 
@@ -67,16 +109,9 @@ This gives the AI CLI access to these MAIR MCP tools:
67
109
  - `call_agent`
68
110
  - `get_request_status`
69
111
 
70
- ## 4. Install the Registration Skill
71
-
72
- Pick the guide for the CLI you use:
73
-
74
- - Codex: [Codex Skill Install](./SKILL-INSTALL-GUIDE.md#codex)
75
- - Claude: [Claude Skill Install](./SKILL-INSTALL-GUIDE.md#claude)
112
+ ## 4. Registration Skill
76
113
 
77
- The skill lets the agent register itself without asking you to type a long JSON payload.
78
-
79
- It automatically infers:
114
+ `mair setup` installs the registration skill automatically. The skill lets the agent register itself without asking you to type a long JSON payload. It automatically infers:
80
115
 
81
116
  - project root
82
117
  - tmux session id
@@ -85,6 +120,10 @@ It automatically infers:
85
120
  - capability summary
86
121
  - capability sources
87
122
 
123
+ Registration is idempotent. If the Web UI already created the agent placeholder, the skill should confirm and enrich that same agent instead of registering a second copy for the same tmux session.
124
+
125
+ For manual skill installation or unusual profiles, see [Skill Install Guide](./SKILL-INSTALL-GUIDE.md).
126
+
88
127
  ## 5. Create an Agent From the Web UI
89
128
 
90
129
  This is the easiest path for most users.
@@ -95,9 +134,19 @@ This is the easiest path for most users.
95
134
  4. Select a project directory.
96
135
  5. Click `Create Agent`.
97
136
 
98
- Mina creates or reuses a tmux session and registers the agent in the router.
137
+ Mina creates or reuses a tmux session and registers the agent in the router. If the same tmux session later self-registers from the agent CLI, Mina updates the existing agent record instead of creating a duplicate.
138
+
139
+ Watch the readiness state after creation:
99
140
 
100
- If Codex or Claude needs trust approval, the Web UI shows the terminal so you can respond.
141
+ - `created`: Mina created or reused the tmux session.
142
+ - `permission-required`: Codex or Claude is waiting for trust or permission approval. Use the guided action in Mina when one is available, or open the terminal and approve the prompt directly.
143
+ - `client-update-required`: Codex is waiting at an update prompt. Skip or resolve the prompt in the terminal, then retry registration.
144
+ - `mcp-configuring`: the session does not yet have the Mina MCP server configured. Run the setup command shown in the inspector.
145
+ - `registration-pending`: Mina is waiting for the agent to confirm self-registration.
146
+ - `ready`: the session is reachable, registered, and safe to route work to.
147
+ - `failed`: creation or preflight hit a blocker that needs operator repair.
148
+
149
+ If Codex or Claude needs trust approval, the Web UI shows the terminal so you can respond. If MCP setup is missing, the inspector shows the exact setup, verify, and remove commands for the CLI profile. A newly created blocked agent may show `needs-attention` until you complete the inspector's permission, MCP setup, or registration action; this is expected and prevents accidental routing.
101
150
 
102
151
  ## 6. Alternative: Create an Agent From a Terminal
103
152
 
@@ -132,12 +181,17 @@ If you created the agent from the Web UI, this step is still useful but not alwa
132
181
 
133
182
  ## 8. Inspect or Edit Capabilities
134
183
 
135
- Click an agent node and choose `Status & Details`.
184
+ Click an agent node. The floating inspector opens on the right, and the bottom activity panel filters to that agent.
185
+
186
+ Use `Edit Capabilities` when you want to update what the agent is good at.
136
187
 
137
188
  You can view and edit:
138
189
 
139
190
  - capability summary
140
191
  - capability sources
192
+ - structured capability quality
193
+ - answerable domains
194
+ - evidence sources
141
195
  - project root
142
196
  - tmux session
143
197
  - attach commands
@@ -146,7 +200,7 @@ You can view and edit:
146
200
 
147
201
  ## 9. Open the Agent Terminal
148
202
 
149
- Click an agent node and choose `Open Terminal`.
203
+ Click an agent node and choose `Open Terminal` from the context menu or the inspector.
150
204
 
151
205
  The browser shows the current tmux screen. Type into the input field and press `Enter`, or click `Send`.
152
206
 
@@ -174,13 +228,90 @@ Summarize method, endpoint, parameters, and source files.
174
228
  Expected flow:
175
229
 
176
230
  1. The source agent calls `list_agents`.
177
- 2. It chooses the target agent.
231
+ 2. It chooses a target agent where `isSelf` is not true.
178
232
  3. It calls `call_agent`.
179
233
  4. MAIR sends the task into the target tmux session.
180
234
  5. The target agent answers with Mina response markers.
181
235
  6. MAIR returns the parsed answer to the source agent.
182
236
 
183
- ## 11. Stop the Router
237
+ You can watch the routed request in the bottom activity panel. Selecting the target agent filters that panel to only that agent's work.
238
+
239
+ ## 11. Inspect the Routed Request
240
+
241
+ After the request appears in the activity panel, click the row to open the request detail view.
242
+
243
+ Use this view to check:
244
+
245
+ - source and target agent
246
+ - current lifecycle status
247
+ - request lease state
248
+ - parsed answer or error
249
+ - parser diagnostics for missing or malformed response markers
250
+ - prompt evidence sent to the target
251
+ - raw terminal evidence captured from the target agent
252
+ - recovery history for operator actions
253
+ - retry lineage when a request was retried
254
+
255
+ The detail view is the fastest way to understand whether a collaboration failed because the target timed out, the terminal transport failed, or the answer did not include Mina response markers.
256
+
257
+ ## 12. Recover From a Bad Request
258
+
259
+ Use the activity panel actions when a collaboration needs operator help:
260
+
261
+ - `Retry` sends the same task again and links the new request back to the original.
262
+ - `Cancel` stops an open created, sent, or waiting request from being updated by a late terminal response.
263
+ - `Interrupt Terminal` sends Ctrl-C to the target tmux session for an orphaned timed-out request.
264
+ - `Mark Recovered` releases an orphaned request lease after you confirm the target session is idle or repaired.
265
+ - `Archive` hides old terminal noise without deleting the request history.
266
+ - `Unarchive` restores a request when you need to inspect it again.
267
+
268
+ These controls are intentionally local and explicit. Cancel request, interrupt terminal, and mark recovered are separate actions. They do not hide the original request; they preserve enough lineage and recovery history to explain what happened.
269
+
270
+ ## 13. Refresh Capabilities
271
+
272
+ Each agent has a capability card that helps you decide where to route work.
273
+
274
+ Capability states mean:
275
+
276
+ - `Missing`: the agent has not registered a useful capability summary.
277
+ - `Fresh`: generated capability metadata was refreshed recently.
278
+ - `Stale`: generated capability metadata is old or missing a refresh timestamp.
279
+ - `Manual`: you edited the capability card yourself.
280
+ - `Strong`: the profile explains what the project does, what the agent can answer, and what evidence supports that claim.
281
+ - `Thin`: the profile exists but is too generic to trust for routing decisions.
282
+
283
+ From the inspector, use `Edit Capabilities` for manual corrections or `Copy Refresh Command` to copy:
284
+
285
+ ```sh
286
+ mair agent refresh-capabilities <agent-id>
287
+ ```
288
+
289
+ Run the command when an agent's project changed and you want it to inspect local docs again.
290
+
291
+ ## 14. Read Health States
292
+
293
+ The UI and CLI use the same health states:
294
+
295
+ - `available`: the session is reachable and can receive routed work.
296
+ - `busy`: Mina is already routing a request to that agent.
297
+ - `stale`: Mina has not recently confirmed reachability.
298
+ - `missing`: the tmux session or transport target is gone.
299
+ - `needs-attention`: the agent needs an operator action before normal routing. This can mean the last routed request failed or timed out, or the agent is blocked on first-run readiness such as trust approval, MCP setup, or pending self-registration.
300
+ - `unknown`: this transport does not expose a live health check.
301
+
302
+ Useful CLI checks:
303
+
304
+ ```sh
305
+ mair health
306
+ mair agents
307
+ mair agent <agent-id>
308
+ ```
309
+
310
+ Use these before routing important work, especially after restarting terminals or deleting tmux sessions.
311
+
312
+ If you started the server on a non-default port, `mair health` uses the matching running server record and reports that MCP URL instead of the default `3333` URL. During a server-routed request, the same command should show the target agent as `busy`, matching the browser.
313
+
314
+ ## 15. Stop the Router
184
315
 
185
316
  ```sh
186
317
  mair server stop