@team-agent/installer 0.5.103 → 0.5.105

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 (40) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/crates/team-agent/src/cli/adapters.rs +2 -0
  4. package/crates/team-agent/src/cli/emit.rs +102 -5
  5. package/crates/team-agent/src/cli/mod.rs +8 -14
  6. package/crates/team-agent/src/cli/spec.rs +3 -3
  7. package/crates/team-agent/src/cli/tests/run_delegation.rs +1 -0
  8. package/crates/team-agent/src/cli/types.rs +3 -1
  9. package/crates/team-agent/src/compiler/tests.rs +19 -27
  10. package/crates/team-agent/src/compiler.rs +11 -105
  11. package/crates/team-agent/src/lifecycle/launch/add_agent.rs +6 -2
  12. package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +10 -6
  13. package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +2 -5
  14. package/crates/team-agent/src/lifecycle/launch/identity.rs +9 -13
  15. package/crates/team-agent/src/lifecycle/launch/role_source.rs +2 -26
  16. package/crates/team-agent/src/lifecycle/launch/spawn.rs +1 -0
  17. package/crates/team-agent/src/lifecycle/launch/spec_state.rs +7 -2
  18. package/crates/team-agent/src/lifecycle/launch.rs +4 -1
  19. package/crates/team-agent/src/lifecycle/mod.rs +1 -0
  20. package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -12
  21. package/crates/team-agent/src/lifecycle/restart/agent.rs +31 -0
  22. package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1
  23. package/crates/team-agent/src/lifecycle/restart/common.rs +1 -1
  24. package/crates/team-agent/src/lifecycle/restart.rs +1 -1
  25. package/crates/team-agent/src/lifecycle/role_config.rs +1123 -0
  26. package/crates/team-agent/src/lifecycle/tests/cursor_require_explicit_model_red.rs +7 -19
  27. package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +8 -41
  28. package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +14 -8
  29. package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +8 -4
  30. package/crates/team-agent/src/lifecycle/worker_command_context.rs +4 -4
  31. package/crates/team-agent/src/model/enums.rs +0 -9
  32. package/crates/team-agent/src/model/spec.rs +2 -2
  33. package/crates/team-agent/src/provider/adapters/cursor_agent.rs +7 -8
  34. package/crates/team-agent/src/provider/adapters/grok.rs +5 -18
  35. package/crates/team-agent/src/provider/tests/adapter.rs +15 -24
  36. package/crates/team-agent/src/provider/wire.rs +2 -29
  37. package/crates/team-agent/src/state/repository.rs +2 -1
  38. package/package.json +4 -4
  39. package/skills/team-agent/SKILL.md +83 -33
  40. package/skills/team-agent/references/team-agent-operator.md +54 -523
@@ -1,556 +1,87 @@
1
- # Team Agent operator handbook
1
+ # Team Agent operator reference
2
2
 
3
- This is the long-form operator reference. The sealed CLI face is `skills/team-agent/SKILL.md` (≤60 lines). Do not drop the r13-corrected 0.5.66 facts below.
3
+ The assistant you are using is the team **leader**. Workers are described by Markdown files in a team directory; use the CLI for lifecycle operations.
4
4
 
5
+ ## Plain-text team
5
6
 
6
- # Team Agent
7
-
8
- Use this skill only for Team Agent operation. The leader is the current user-facing agent; do not create a `leader` worker. Worker role docs live in `<workspace>/agents/`; `TEAM.md` lives at `<workspace>/TEAM.md`.
9
-
10
- If `team-agent --version` does not match `last_verified_against` in the frontmatter, **do not copy examples from this file as current truth**. Learn from the live CLI first:
11
-
12
- ```bash
13
- team-agent --version
14
- team-agent --help
15
- team-agent doctor --help
16
- ```
17
-
18
- Observed on the writing gauge: `team-agent 0.5.66` (exit 0); `doctor --help` prints `usage: team-agent doctor [SPEC] [--workspace WORKSPACE] [--team TEAM] [--gate orphans|comms] [--comms] [--fix] [--fix-schema] [--cleanup-orphans] [--confirm] [--json]` (exit 0).
19
-
20
- This page documents **installed CLI 0.5.66**. Claims below are paired with a command you can re-run; do not fill gaps by `strings` on the binary. **Never rewrite a user-supplied model id.** Only verify and report.
21
-
22
- Gauge used while writing (re-check on your machine):
23
-
24
- ```text
25
- /Users/alauda/.team-agent/runtime/0.5.66/bin/team-agent
26
- md5=5dfc5fc770eb91d8104ab503704112ec
27
- mtime=2026-08-20T03:06:49
28
- team-agent 0.5.66
29
- ```
30
-
31
- ```bash
32
- team-agent --version
33
- ```
34
-
35
- Observed: `team-agent 0.5.66` (exit 0).
36
-
37
- ## Leader Requirement
38
-
39
- Real Team Agent teams require the current leader to run inside a tmux-managed pane. Prefer the short launchers:
40
-
41
- ```bash
42
- team-agent codex
43
- team-agent claude
44
- ```
45
-
46
- Pass provider flags after the provider name, for example `team-agent codex --dangerously-bypass-approvals-and-sandbox`. Run `team-agent quick-start` from the leader's current tmux pane. Do not start a real team from a naked terminal that Team Agent cannot address through tmux.
47
-
48
- Leader `--dangerously-*` flags do not determine worker bypass. Worker bypass defaults to enabled in compiled role specs; no bypass field needs to be written (see Document Format and Permissions).
49
-
50
- ## Leader Role
51
-
52
- Invoking this skill turns the current agent into the team leader. The leader **orchestrates**: read reports, set direction, decompose work, dispatch tasks to teammates, review results, and decide. The leader does **not** execute hands-on work — no `cargo test`, no product-code edits, no `git push`, no build/verify cycles. Those belong to teammates. If the leader catches themselves running tests, editing source files, or pushing commits, they have stepped out of role; stop and re-dispatch.
53
-
54
- When the user has been communicating in Chinese throughout the conversation, all leader↔teammate messaging (`send`, `report_result`, MCP messages, task descriptions) must also be in Chinese. The leader dispatches in Chinese, the worker reports back in Chinese. Switch back to the user's language only at the user-facing boundary.
55
-
56
- ## Minimal Copy-Paste Team
57
-
58
- `TEAM.md` and `agents/*.md` are plain text/Markdown; YAML frontmatter is optional. The whole `TEAM.md` body becomes the team objective, and the whole role body becomes the worker prompt. A default role uses its filename stem as its id, provider `pi`, model `openai-codex/gpt-6-luna`, effort `max`, and bypass enabled. Valid optional frontmatter may still override supported metadata.
59
-
60
- ```bash
61
- mkdir -p .team/current/agents
62
- cat > .team/current/TEAM.md <<'EOF'
63
- A small team for bounded implementation tasks. Workers report progress to the leader and return a concise result.
64
- EOF
65
- cat > .team/current/agents/coder.md <<'EOF'
66
- # Implementation Worker
67
-
68
- Handle one bounded task at a time. Send progress or blockers to the leader with `send_message`, and report completion exactly once with `report_result`.
69
- EOF
70
- team-agent quick-start .team/current
71
- ```
72
-
73
- The MCP surface is exactly `send_message`, `report_result`, and `get_team_status`; status is optional, not a prerequisite. Agent/team lifecycle management remains on the separately authorized native CLI.
74
-
75
- Workers always run headlessly in independent windows on the per-workspace tmux server. No GUI display backend is configured in `TEAM.md`.
76
-
77
- ## Private Tmux Socket
78
-
79
- Worker windows live on a private per-workspace tmux server, not the user's default socket. `tmux list-sessions` (no `-L`/`-S`) will not show them; that is expected, not a failure.
80
-
81
- To attach manually, read `attach_commands` (or the `tmux` action printed near `ready:`) from `team-agent quick-start` / `team-agent restart` / `team-agent status --json` output. It is the canonical `tmux -L <socket-name> attach -t <session>` (or `-S <socket-path>`) line for the current team.
82
-
83
- Use `team-agent attach-leader` / `team-agent claim-leader` to bind the leader pane to a team. Do not invent socket paths by hand.
84
-
85
- ```bash
86
- team-agent claim-leader --help
87
- ```
88
-
89
- Observed (exit 0):
90
-
91
- ```text
92
- usage: team-agent claim-leader [--workspace WORKSPACE] [--team TEAM] [--confirm] [--json]
93
- ```
94
-
95
- Run `claim-leader` only from the **leader** pane. From a worker pane it refuses and prints a structured `action` (see Failure Rules).
96
-
97
- ## Provider Capability Matrix
98
-
99
- | Provider | Resume | Turn-state detection | Per-worker model override | Team Agent fork |
100
- |---|---|---|---|---|
101
- | `claude` / `claude_code` | yes (`--resume <id>`, transcript-verified) | yes (JSONL stream) | yes (role `model` overrides `provider_models`) | yes (snapshot copy + only `--resume <snapshot-id>`) |
102
- | `codex` | yes (`codex resume <id>`, session-store-verified) | yes (turn JSONL) | yes (role `model`) | yes (`codex fork`) |
103
- | `copilot` | yes (`copilot --resume <id|name>`, sqlite `sessions` row) | not yet (phase 1: `provider.classify.unsupported` event) | yes (role `model`) | yes (isolated `COPILOT_HOME` store fork) |
104
- | `pi` | yes (exact `--session <backing-path>`, not selector/continue) | Unknown (no JSONL turn-state reader) | yes (role `model` / `effort`, catalog-validated) | yes (full snapshot into separate seat/session; exact backing resume) |
105
- | `gemini_cli` | no | no | yes | no |
106
- | `fake` (testing only) | no | no | n/a | no |
107
-
108
- Notes:
109
- - A plain-text/default role uses Pi with `openai-codex/gpt-6-luna` and `max` effort; valid optional role frontmatter can select a provider and override supported model settings. For provider paths using `provider_models`, an explicit role `model:` takes precedence.
110
- - Copilot fork copies the source session into an isolated `COPILOT_HOME` and rekeys its SQLite session references atomically. Missing or incomplete backing fails closed; it never falls back to a fresh spawn.
111
- - Copilot phase-1 idle/turn detection is intentionally Unknown; tick emits a single explicit `provider.classify.unsupported` event per state change (P4 dedup), never a silent default.
112
- - `pi` `fork-agent SOURCE --as TARGET` requires a captured Pi subscription source. It copies the complete JSONL history into a distinct target session with a new id and exact `--session <path>` resume; it does not alter the source file or fall back to a fresh session.
113
-
114
- ## Provider Prep
115
-
116
- ### Subscription auth (Codex / Claude account login)
117
-
118
- To opt a worker into Codex or Claude subscription providers, create a named subscription profile in the workspace and reference it from optional role frontmatter:
119
-
120
- ```bash
121
- team-agent profile init codex-default --auth-mode subscription --workspace .
122
- team-agent profile init claude-default --auth-mode subscription --workspace .
123
- ```
124
-
125
- Then in `agents/<role>.md` frontmatter, set `auth_mode: subscription` and `profile: codex-default` (or `claude-default`). The demo above uses `profile: codex-default`; that name only works after `profile init` has created it in the same workspace.
126
-
127
- Common errors:
128
-
129
- - `profile already exists`: a profile by that name is already in `.team/current/profiles/`. Either reuse it (skip `init`) or pick a new name.
130
- - `profile not found` during quick-start: the role doc references a profile that was never `profile init`-ed in this workspace. Run `team-agent profile init <name> --auth-mode subscription --workspace .` and retry.
131
-
132
- ### Codex provider notes
133
-
134
- Codex: run `codex login` first. Optional `~/.codex/config.toml` profile:
135
-
136
- ```toml
137
- [profiles.team-agent]
138
- model = "gpt-5.5"
139
- approval_policy = "on-request"
140
- sandbox_mode = "workspace-write"
141
- ```
142
-
143
- Use exact provider model ids, not display names. **Codex slug lookup is Codex-only** — do not apply it to `compatible_api` workers.
144
-
145
- ```bash
146
- codex debug models
147
- ```
148
-
149
- That command is the Codex catalog. This skill does **not** keep a model id list. If `codex` is not on PATH, the lookup is unavailable; do not invent slugs.
150
-
151
- A plain-text/default role compiles as provider `pi` with model `openai-codex/gpt-6-luna` and effort `max`. If valid optional frontmatter selects another provider, its established provider-specific model/profile resolution applies; Grok and Cursor roles retain their explicit model requirements. **Do not treat provider/team fill-ins as a validity catalog.**
152
-
153
- Claude: run `claude auth status`; if missing, run `claude auth login`. Team Agent stores Claude worker sessions by passing `--session-id` and resumes with `--resume`.
154
- Use `provider: claude` or `provider: claude_code` for Claude workers.
155
-
156
- Role `profile` values are secret-safe references. Do not put API keys in role docs or `TEAM.md`.
157
- Never read raw provider profile files into model context. Do not use `Read`, `cat`, `sed`, `grep`, editors, or screenshots on `.team/current/profiles/*.env` or `.team/runtime/provider-env/*.env`. Those files may contain live API keys. Use only `team-agent profile show <name> --workspace . --json` or `team-agent profile doctor <name> --workspace . --json` for redacted diagnostics; if a value is missing, ask the human user to edit the local profile file.
158
-
159
- ## compatible_api model rules
160
-
161
- **Only verify. Only report. Never rewrite a user-explicit model id** (role `model` or profile `MODEL`). Do not keep a catalog of legal ids in this skill. Compatible-API ids are whatever the endpoint serves.
162
-
163
- When the user asks for a third-party API, do not ask them to paste keys into the chat. Generate a local blank profile:
164
-
165
- ```bash
166
- team-agent profile init deepseek --auth-mode compatible_api --workspace .
167
- ```
168
-
169
- Tell the user to fill `.team/current/profiles/deepseek.env` locally (`AUTH_MODE`, `PROFILE_NAME`, `BASE_URL`, `API_KEY`, `MODEL`). Then reference `auth_mode: compatible_api` and `profile: deepseek` in the role doc.
170
-
171
- Inspect without opening the `.env`:
172
-
173
- ```bash
174
- team-agent profile show deepseek --workspace . --json
175
- ```
176
-
177
- Observed on a freshly inited profile (exit 0): `ok: true`, `auth_mode: "compatible_api"`, `keys_present` includes `MODEL` and `BASE_URL`, `secret_values_printed: false`.
178
-
179
- How to see whether the **endpoint** accepts the id (ask the human to run these with their `BASE_URL`; do not read the `.env` yourself):
180
-
181
- ```bash
182
- # 1) live catalog (OpenAI-shaped). Replace BASE_URL. Do not treat HTTP errors as "illegal id".
183
- curl -sS --max-time 5 -H "Authorization: Bearer $API_KEY" "$BASE_URL/v1/models"
184
- ```
185
-
186
- Writing-gauge shape check without a real endpoint. `--noproxy '*'` pins a direct connect so ambient HTTP(S)_PROXY cannot rewrite the process exit. This is a **liveness probe of the lookup command**, not a model list:
187
-
188
- ```bash
189
- curl --noproxy '*' -sS --max-time 5 http://127.0.0.1:1/v1/models
190
- ```
191
-
192
- Observed (exit 7): stderr contains `Couldn't connect to server` / `Failed to connect to 127.0.0.1 port 1`. Gauge `/usr/bin/curl` (md5 `10a716a5b63881997d819ef693d4a802`). Port 1 is not a service.
193
-
194
- Dropping `--noproxy` is a different environment: an intercepting proxy may return an HTML error page (a prior writing seat saw Squid `ERR_CONNECT_FAIL`) and the process exit can be 0. This turn did not re-measure that intercept. Do not record 0 as this `--noproxy` fence's expected exit.
195
-
196
- If the endpoint has no `/v1/models`, probe with a 1-token completion (human runs this; this writing turn did **not** hit a live chat endpoint):
197
-
198
- ```text
199
- POST {BASE_URL}/v1/chat/completions
200
- {"model":"<the user-supplied id>","messages":[{"role":"user","content":"ping"}],"max_tokens":1}
201
- ```
202
-
203
- Fail = report the HTTP/body. Success = leave the id alone. **Do not substitute a different id.**
204
-
205
- How role `model` and profile `MODEL` are resolved (not a validity list):
206
-
207
- The internal compiler preserves a role `model:` when present. If it is omitted, provider/team defaults may fill it; a profile-deferred role may remain `null`. A profile's `MODEL` does not override an explicit role model, and the compiler does not compare the two. Actual profile/provider readiness is checked during launch and preflight, not by a public export command.
208
-
209
- For an existing spec file or team directory at `$d`, run the retained validation:
210
-
211
- ```bash
212
- team-agent validate "$d" --json
213
- ```
214
-
215
- A file input runs schema structural validation. A team-directory input internally compiles `TEAM.md` and `agents/*.md` and validates role-document completeness. Neither input writes or exports a spec file.
216
-
217
- How to check `--auth-mode` literals (the CLI does not print an allow-list on this gauge):
218
-
219
- ```bash
220
- team-agent profile init x --auth-mode not-a-mode --workspace /tmp/ta-skill-no-runtime --json
221
- ```
222
-
223
- Observed (exit 1): `usage error: invalid --auth-mode: not-a-mode`. That is the lookup: try the value, read the error. Do not maintain a mode table here.
224
-
225
- Team Agent loads the profile during quick-start, launch, restart, and start-agent. Compatible API workers inherit the current shell proxy/CA environment by default. Claude compatible API workers use Team Agent managed `CLAUDE_CONFIG_DIR` so user-level Claude subscription settings cannot re-inject Anthropic proxy variables into third-party API sessions. If quick-start reports an ambient proxy blocker, do not silently unset proxy for the whole team; tell the user to choose one path: fix that proxy for `BASE_URL`, put `HTTPS_PROXY=`/`HTTP_PROXY=` in the profile, or put `PROXY_MODE=direct` in the profile to bypass proxy only for that worker. Subscription workers keep their native provider settings and environment. Startup runs a redacted smoke check for compatible API profiles before worker windows are created, so a bad URL/key/model or proxy/base URL connectivity failure is reported to the leader command instead of producing idle workers.
226
-
227
- ## How role documents become live
228
-
229
- ```bash
230
- team-agent restart --help
231
- team-agent add-agent --help
232
- team-agent shutdown --help
233
- ```
234
-
235
- Observed (all exit 0):
7
+ Create a directory with `TEAM.md` and at least one `agents/*.md` file:
236
8
 
237
9
  ```text
238
- usage: team-agent restart [WORKSPACE] [--team TEAM] [--allow-fresh] [--session-converge-deadline SECONDS] [--json]
239
- usage: team-agent add-agent AGENT --role-file FILE [--force] [--workspace WORKSPACE] [--team TEAM] [--json]
240
- usage: team-agent shutdown [--workspace WORKSPACE] [--team TEAM] [--keep-logs] [--json]
10
+ my-team/
11
+ TEAM.md
12
+ agents/reviewer.md
241
13
  ```
242
14
 
243
- Top-level help names `add-agent` as **add or force-recreate a worker**. `restart` does **not** take `--role-file`. Editing `agents/*.md` then running `restart` is therefore not a documented reread path.
244
-
245
- To apply a changed role file to an **existing** worker name, use `add-agent --force --role-file <file>` (the `--role-file` flag is the reread).
246
-
247
- `shutdown` stops the selected team. `restart` restarts it. This pair was **not** live-verified as a frontmatter reread; do not assume it recompiles `agents/*.md`. Prefer `add-agent --force --role-file` when the help surface names `--role-file`.
248
-
249
- `restart --force` is **not** listed in `--help`. Passing it to a workspace with no team is a team-select error, not a usage error — so the flag is accepted. Its live-team meaning is **unverified** on this gauge; do not invent it.
15
+ `TEAM.md` contains the team goal. Each role file's body contains that worker's instructions. The filename stem (`reviewer`) is the default worker id. YAML frontmatter is optional; a role can be plain Markdown.
250
16
 
251
- Do **not** shutdown/restart the whole team just to add a **new** worker (that drops other workers' resumable sessions). Use `add-agent` without `--force` for a new name.
252
-
253
- ## Document Format and Permissions
254
-
255
- `TEAM.md` and `agents/*.md` accept ordinary text/Markdown without required YAML frontmatter. A valid optional frontmatter map may set supported metadata; absent, malformed, unterminated, or non-object frontmatter is treated as part of the document body, not a compile error. The entire TEAM body becomes `objective`; the role body is injected as the prompt.
256
-
257
- For a role with no overrides, the filename stem supplies its id, and defaults are provider `pi`, model `openai-codex/gpt-6-luna`, effort `max`, and `dangerously_skip_permissions: true`. A valid `agent_id` (or legacy `name`) may override the filename-derived id. Supported valid frontmatter overrides remain available for existing roles; no permission field needs to be written. TEAM defaults are the workspace directory name, a 2-second tick, `leader_centric` communication, and `team-<workspace-name>` session.
258
-
259
- The generated spec still carries a boolean bypass value. Missing or malformed role metadata defaults to `true`; an explicit valid boolean is preserved. Provider adapters translate that value using the provider's own mechanism. Do not copy a Codex-only bypass flag into Pi or another provider's launch command.
260
-
261
- `permission_mode`, `dangerous_auto_approve`, and leader environment switches are not required document fields. Keep provider-native bypass behavior inside the adapter; do not ask users to add a bypass toggle to `TEAM.md` or a plain-text role.
262
- ## Ignore vs handle (status / alerts)
263
-
264
- ```bash
265
- team-agent status --help
266
- ```
267
-
268
- Observed (exit 0):
269
-
270
- ```text
271
- usage: team-agent status [AGENT] [--workspace WORKSPACE] [--team TEAM] [--summary|--json] [--detail]
272
- 默认输出: worker,空闲|工作|错误;错误细分走 status --summary
273
- ```
17
+ From a tmux-addressable terminal or supported agent pane, run commands in the workspace root (the parent of `my-team`):
274
18
 
275
- ```bash
276
- team-agent status --json --workspace /tmp/ta-skill-no-runtime
19
+ ```sh
20
+ team-agent quick-start my-team
21
+ team-agent send reviewer "Review the current change and report the main risk."
22
+ team-agent inbox reviewer -n 3
23
+ # The role file already records the user's provider and bypass choices.
24
+ team-agent add-agent analyst --role-file /absolute/path/to/analyst.md
25
+ team-agent shutdown --workspace .
277
26
  ```
278
27
 
279
- On a directory with **no** running team, observed (exit 0): `"ok": true`, `"ready": false`, `not_ready.reasons` included `coordinator_not_running`, `tmux_session_missing`, `workers_not_spawned`, `leader_receiver_unbound`, `next_action: claim-leader`. Create the dir if needed: `mkdir -p /tmp/ta-skill-no-runtime`.
28
+ A successful `send` can mean only accepted or queued. Wait for the worker's actual reply/result; acceptance is not completion. Use `team-agent status --json` to inspect readiness. `ok: true` with `ready: false` means the command succeeded but the team is not ready; follow the reported action.
280
29
 
281
- That combination is **not** a crash. `ok: true` with `ready: false` means the command ran and the team is not ready.
30
+ ## User decisions and legacy compatibility
282
31
 
283
- | Signal | Treat as | What to do |
284
- |---|---|---|
285
- | `ok: true` + `ready: true` | normal | continue |
286
- | `ok: true` + `ready: false` + `tmux_session_missing` / `coordinator_not_running` on a workspace you did not start | expected empty workspace | start the team, or pick the right `--workspace` / `--team` |
287
- | `coordinator.session_missing` then `status --json` shows `ready: true` or workers still `running` | self-healing transient | do **not** shutdown; wait and re-check `ready` |
288
- | `auto_attach_leader` / `leader pane validation failed` while the command still reports `ok: true` | info for external-leader setups (report §3.6) | ignore the word `failed`; look at `ok`. **This exact stderr string was not reproduced on this gauge.** |
289
- | `result_success_without_executed_tests` on a non-coding task | advisory | ignore |
290
- | structured `ok: false` with `action` | handle | run the `action` (see Failure Rules) |
291
- | `caller_not_leader_shaped` from `claim-leader` | handle | run `claim-leader` from the leader pane, not a worker pane |
32
+ For a new team plan, explicitly record each user's provider and bypass decisions; do not silently select either. Existing file-based compilation remains compatible, including minimal documents. The following table describes legacy interpretation, not defaults to choose on the user's behalf:
292
33
 
293
- ## coordinator.session_missing
34
+ | Setting | Default behavior |
35
+ |---|---|
36
+ | `provider` | `pi` |
37
+ | `model` | Unset by Team Agent; leave model selection to the provider |
38
+ | `effort` | Unset by Team Agent; leave effort selection to the provider |
39
+ | `dangerously_skip_permissions` | `false`; preserve native permissions |
294
40
 
295
- `status --json` can list `tmux_session_missing` while `ok` is still true (observed on an empty workspace). For a **running** team, re-check:
41
+ Do not invent `model: null` or `effort: max`. Record the user's bypass decision explicitly in a new role, even when it is false. The absence of a model or effort override is not a promise about what the provider's own UI eventually displays. Team Agent does not fill role model from TEAM-level defaults. An unspecified role effort defaults to None (native); for non-Pi roles, a legacy explicit TEAM provider_effort remains supported for compatibility.
296
42
 
297
- ```bash
298
- team-agent status --json
299
- ```
300
-
301
- If `ready` is true, or agents show `"status": "running"`, continue. Do not stop the team and wait for the user solely because a coordinator line said session missing.
302
-
303
- Live-team sample on this writer seat (exit 0): agents including `developer-d108` with `"status": "running"`. That is the "still alive" side of the check.
43
+ Optional supported role metadata:
304
44
 
305
- ## `--watch-result` is deprecated
45
+ - `agent_id` (or legacy `name`) and `role` for identity.
46
+ - `provider`, `model`, and `effort` to explicitly choose supported provider settings.
47
+ - `auth_mode` and `profile` to use a provider profile.
48
+ - `dangerously_skip_permissions: true` or `false` records the user's explicit permission choice. False preserves native permissions; it is not a read-only or sandbox guarantee.
49
+ - `communication_mode` to select a supported worker communication contract.
306
50
 
307
- ```bash
308
- team-agent send --help
309
- ```
51
+ Unknown and historical role keys are ignored, not used as a way to restrict tools or permissions. In particular, `tools`, `permission_mode`, and `label` do not configure a worker through role frontmatter.
310
52
 
311
- Observed (exit 0):
53
+ ## Add and start
312
54
 
313
- ```text
314
- usage: team-agent send TO MESSAGE... [--workspace WORKSPACE] [--team TEAM] [--mailbox] [--json]
55
+ `add-agent ID --provider NAME --bypass true|false` creates and starts a new seat without a prepared file. A traditional `add-agent ID --role-file FILE` needs no repeated flags when the file already defines provider and boolean bypass. Missing decisions may be supplied by CLI; equal file/CLI values are accepted, but conflicting definitions (including model, effort, prompt and profile) are rejected before writing or startup. Model, effort, prompt and profile remain optional. External role-file inputs are imported into the selected team's `agents/ID.md`; the original stays untouched. A file already there is used in place. Ordinary add rejects occupied IDs. Explicit `--force` is restricted to disaster recovery: the registered old pane must be positively confirmed dead and the target must have no live cohort. Live or unknown targets remain refused; the existing force-recreate transaction is reused, not a general update/implicit-restart path.
315
56
 
316
- TO is a logical recipient; send returns after the message is persisted. --mailbox stores durably without live injection; omitted sends to the live conversation.
317
- ```
57
+ `start-agent ID` starts an existing stopped seat; it refuses a running seat, so use `stop-agent ID` first. Optional model, effort, bypass, prompt and profile update that same role document. Omitted fields and body are preserved; prompt replaces the body. A matching provider is allowed; any engine change, including manual file edits, is refused. Startup failure restores role and runtime spec bytes, and reports failure. File edits followed by start use the same compiler reload path.
318
58
 
319
- `--watch-result` is **not** in that usage. Passing it still warns:
59
+ ## Profiles and custom models
320
60
 
321
- ```bash
322
- mkdir -p /tmp/ta-skill-no-runtime
323
- team-agent send --watch-result coder hello --workspace /tmp/ta-skill-no-runtime --json
324
- ```
61
+ A profile keeps provider credentials, endpoint settings, and optional model settings outside role text. This supports subscription profiles and custom/third-party API models, including Claude Code-compatible providers. Once an external role is imported, profile lookup uses the current team's/workspace's `profiles`, not the external source directory. Prepare the profile locally through public commands; do not discover or copy external credentials.
325
62
 
326
- Observed stderr (exit is the send result, here 1 because the probe dir had no runtime state):
63
+ Create a local profile, then edit its generated file on the user's machine:
327
64
 
328
- ```text
329
- warning: --watch-result is deprecated; sunset: next compatibility release; action: use positional logical TO and the returned message id
65
+ ```sh
66
+ team-agent profile init my-api --auth-mode compatible_api --workspace .
330
67
  ```
331
68
 
332
- **New write:** positional logical TO, then use the returned `message_id` (and `team-agent results --case` / coordinator notify). Do not poll `sleep` / `status` / `inbox` after a successful send unless the user asked for diagnosis.
333
-
334
- ```text
335
- team-agent send coder "Do the bounded task"
336
- team-agent send reviewer "Review this change"
337
- team-agent send /full/path/to/workspace::team-name/agent-id "cross-workspace note"
338
- ```
69
+ Reference it without copying secrets into Markdown:
339
70
 
340
- ```bash
341
- team-agent results --help
71
+ ```yaml
72
+ ---
73
+ provider: claude_code
74
+ dangerously_skip_permissions: false
75
+ auth_mode: compatible_api
76
+ profile: my-api
77
+ ---
78
+ Use the configured provider to complete the assigned task.
342
79
  ```
343
80
 
344
- `results --help` observed (exit 0): `usage: team-agent results --case CASE_ID [--workspace WORKSPACE] [--team TEAM] [--json]`.
345
-
346
- On success, `send --json` includes `message_id`. The deprecation warning itself does **not** print a full example (product backlog).
347
-
348
- ## Commands
349
-
350
- - `team-agent codex ...` starts or attaches a tmux-managed Codex leader in the current directory; arguments after `codex` pass through to Codex.
351
- - `team-agent claude ...` starts or attaches a tmux-managed Claude leader in the current directory; arguments after `claude` pass through to Claude.
352
- - `team-agent quick-start .team/current` starts workers from `TEAM.md` and `agents/*.md`. When it prints `ready:` and `ready_signal`, startup is complete; do not run sleep/status/wait loops afterward unless diagnosing a failure.
353
- - For real workers, `quick-start` requires a current tmux leader pane. If it says the leader must run inside tmux, restart the leader with `team-agent codex`/`team-agent claude` or use an existing tmux-managed layout, then run quick-start again.
354
- - Quick-start generated files stay inside the selected team directory, for example `.team/current/` or `.team/alpha/`; do not create or expect root `team.spec.yaml` or `team_state.md`.
355
- - Use `team-agent quick-start ./roles --team-id alpha` to create a second generated team under `.team/alpha/`, or pass an existing team directory directly such as `team-agent quick-start .team/alpha`.
356
- - `quick-start` is only for first-time team creation from role docs. If that team already has runtime state, use `team-agent restart . --team <session_name_or_team_name>` to resume it. If restart cannot recover context, explain the loss and wait for explicit user consent before using `team-agent restart . --allow-fresh`; never reset context through quick-start.
357
- - If the user explicitly asks a worker to create or operate a nested child team, first read `references/team-in-team.md`. Child teams must use an independent child workspace, never the parent `.team/current`.
358
- - `team-agent send coder "Do the bounded task"` persists a message for positional logical TO and returns. Prefer this over `--watch-result`.
359
- - Positional `TO` has two co-equal forms: an in-team short name, for example `team-agent send reviewer "Review this change"`, and a fully-qualified logical name, `<workspace>::<team>/<agent>`. Use the fully-qualified form across workspaces or when the local team scope is ambiguous.
360
- - Advanced orchestration callers may add `--presentation-sink leader|casefile|silent --message-class CLASS [--case-id CASE]`. All sinks remain durable and pullable; `casefile`/`silent` suppress only live leader injection. Missing presentation metadata preserves the normal leader-visible behavior.
361
- - After `send` succeeds, do not run `sleep`, `status`, or `inbox` polling loops unless the user explicitly asks for diagnosis; results finalize automatically and the coordinator notifies the leader when a result arrives.
362
- - `team-agent send --task task_initial "Start"` still parses but `--task` is a deprecated delivery flag (same warning family as `--watch-result`).
363
- - `team-agent status` shows team, worker health, result-store counts, `session_id`, `captured_via`, and attribution confidence. `team-agent status --json` is compact and context-safe by default; use `team-agent status --detail --json` only for raw runtime-state diagnostics.
364
- - `team-agent status coder` shows one worker.
365
- - `team-agent approvals [coder]` shows structured pending approval prompts without copying worker terminal pages.
366
- - `team-agent inbox coder -n 3` shows only compact message summaries. Final results are not in inbox.
367
- - `team-agent shutdown --workspace . --keep-logs` stops the tmux session after a final session capture attempt.
368
- - `team-agent restart .` restarts a stopped team from stored worker sessions. If one workspace has multiple restartable teams, use `team-agent restart . --team <session_name_or_team_name>`.
369
- - `team-agent start-agent coder --workspace .` repairs one missing worker window without interrupting other workers.
370
- - `team-agent doctor` checks local dependencies and provider auth hints.
371
- - `team-agent results --case CASE_ID` reads reported results for a case.
372
- - `team-agent validate` is hidden from top-level `--help` but `--help` on the verb works; use it to check an existing spec without launching.
373
-
374
- <!-- command-coverage:normative-start -->
375
- ### Normative command inventory
376
-
377
- This inventory is the handbook authority for command coverage. Only the command
378
- lines between the two `command-coverage:normative-*` markers are canonical
379
- argv forms. Examples elsewhere in this handbook may be diagnostics, negative
380
- probes, historical observations, or prose and are not part of the inventory.
381
-
382
- ```text
383
- team-agent add-agent <agent> --role-file <file>
384
- team-agent add-agent reviewer --role-file .team/current/agents/reviewer.md --workspace .
385
- team-agent approvals
386
- team-agent approvals <agent_id>
387
- team-agent approvals [coder]
388
- team-agent attach-leader
389
- team-agent claim-leader
390
- team-agent claude
391
- team-agent clone-agent <source> --as <new>
392
- team-agent codex
393
- team-agent codex --dangerously-bypass-approvals-and-sandbox
394
- team-agent doctor
395
- team-agent fork-agent <source> --as <new>
396
- team-agent inbox <agent_id> -n 3
397
- team-agent inbox coder -n 3
398
- team-agent profile doctor <name> --workspace . --json
399
- team-agent profile init <name> --auth-mode subscription --workspace .
400
- team-agent profile init claude-default --auth-mode subscription --workspace .
401
- team-agent profile init codex-default --auth-mode subscription --workspace .
402
- team-agent profile init deepseek --auth-mode compatible_api --workspace .
403
- team-agent profile show <name> --workspace . --json
404
- team-agent profile show deepseek --workspace . --json
405
- team-agent quick-start
406
- team-agent quick-start ./roles --team-id alpha
407
- team-agent quick-start .team/alpha
408
- team-agent quick-start .team/current
409
- team-agent quick-start <dir>
410
- team-agent remove-agent <agent> --workspace . --confirm
411
- team-agent reset-agent <agent> --discard-session
412
- team-agent restart
413
- team-agent restart .
414
- team-agent restart . --allow-fresh
415
- team-agent restart . --team <session_name_or_team_name>
416
- team-agent send --task task_initial "Start"
417
- team-agent send --watch-result
418
- team-agent send --watch-result coder "Do the bounded task"
419
- team-agent send TO MESSAGE
420
- team-agent send reviewer "..."
421
- team-agent send reviewer "Review this change"
422
- team-agent shutdown --workspace . --keep-logs
423
- team-agent start-agent <agent>
424
- team-agent start-agent <agent_id> --workspace .
425
- team-agent start-agent coder --workspace .
426
- team-agent status
427
- team-agent status --detail --json
428
- team-agent status --json
429
- team-agent status coder
430
- ```
431
-
432
- The exact frozen CLI root help is a complementary public-surface authority:
433
- `team-agent --help` must expose the root verb for every canonical command that
434
- is not otherwise documented as a compatibility or provider form. The command
435
- coverage gate parses this output from the exact test binary; it never invokes a
436
- provider or treats a diagnostic example as a command approval.
437
-
438
- <!-- command-coverage:normative-end -->
439
-
440
- ## Restart Semantics
441
-
442
- `restart` takes one workspace argument. It preserves each worker's original provider. If a verified provider session exists, the worker resumes (`codex resume <id>` or `claude --resume <id>`). Claude sessions are considered resumable only after the provider has written a project transcript for that session; a freshly opened blank Claude window is not recorded as recovered context. If the stored id is stale, the runtime first tries to repair it from verified transcript history. If a stored session cannot be verified or repaired, restart fails closed instead of silently losing context; use `team-agent restart . --allow-fresh` only when the user explicitly accepts a fresh worker context. If multiple stopped teams in the same workspace have restart context, plain `team-agent restart .` fails and lists candidates; rerun with `--team <session_name_or_team_name>`. If no prior session id exists, that worker starts fresh and the event log records `restart.fresh_spawn`. Claude resume must run from the original cwd and the same provider transcript root; Team Agent stores `spawn_cwd` and compatible-API `claude_projects_root` for that.
443
-
444
- `restart` `--help` does not mention rereading `agents/*.md`. See **How role documents become live**.
445
-
446
- Startup trust prompts are handled by the runtime/coordinator with bounded probes; do not wait on raw worker screens or manually press Enter for routine startup trust prompts.
447
-
448
- Use `team-agent start-agent <agent_id> --workspace .` only as a narrow repair when one worker window is missing after launch/restart/display failure. It preserves the worker provider, resumes from `session_id` when available, starts fresh when there is no prior session id, and does not restart the rest of the team. If an existing session id cannot resume, it fails closed unless the user explicitly passes `--allow-fresh`.
449
-
450
- ## Adding A New Worker At Runtime
451
-
452
- To add a new worker to a running team, write the role doc and run **one command** — do not shutdown/restart, do not regenerate the compiled spec, and do not quick-start an existing team:
453
-
454
- ```bash
455
- cat > .team/current/agents/reviewer.md <<'EOF'
456
- # Code Reviewer
457
-
458
- Review changed files and report findings to the leader. Use `send_message` for progress and `report_result` exactly once for completion.
459
- EOF
460
- team-agent add-agent reviewer --role-file .team/current/agents/reviewer.md --workspace .
461
- ```
462
-
463
- `add-agent` registers the new worker into the running team's state, launches its window on the existing tmux socket, and leaves every other worker untouched. **Do not shutdown/restart for adding a worker** — it loses every other worker's resumable session. If `add-agent` fails, surface the structured error to the user; do not fall back to shutdown.
464
-
465
- To **recreate** an existing worker from an updated role file:
466
-
467
- ```bash
468
- team-agent add-agent reviewer --role-file .team/current/agents/reviewer.md --force --workspace .
469
- ```
470
-
471
- Missing `--role-file` observed (exit 1): `usage error: missing --role-file` plus a structured `action`.
472
-
473
- Semantic distinction:
474
-
475
- - `team-agent add-agent <agent> --role-file <file>` — add a **new** worker not yet in team state.
476
- - `team-agent add-agent <agent> --role-file <file> --force` — force-recreate that worker from the role file.
477
- - `team-agent clone-agent <source> --as <new>` — reread the source worker's latest role file and start a fresh provider seat. It never copies conversation context. Success is initially honest `capture_state: pending_first_turn` with `session_id`, `new_session_id`, and `backing_path` all null; after the first turn, canonical capture changes the state to `captured` and fills the backing tuple.
478
- - `team-agent fork-agent <source> --as <new>` — reread the source's latest role file and create a distinct provider session carrying its context. Pi subscription forks a verified full snapshot into a separate target seat/backing and reports source id, target id, and backing path; supported non-Pi providers keep their existing fork behavior. Unverified backing fails closed instead of silently cloning fresh.
479
- - `team-agent start-agent <agent>` — (re)launch a worker that **already exists** in team state but whose window is missing.
480
- - `team-agent reset-agent <agent> --discard-session` — keep the same seat and deliberately start it with fresh context.
481
- - `team-agent restart .` — resume a fully **stopped** team from stored worker sessions.
482
- - `team-agent quick-start <dir>` — first-time team creation from role docs; for existing teams use `restart`, and use `restart --allow-fresh` only after explicit user consent to discard context.
483
-
484
- Clone/fork names are always explicit: run concurrent calls with a different `--as` value for each new seat. Fork success includes a verified new `session_id` and independent backing; a tmux window alone is not fork success. Clone success uses the honest `pending_first_turn` state above until first-turn capture, never a fabricated verified tuple. Updating the source role file affects the next clone/fork without requiring a full-team rebuild. Automatic knowledge write-back from a clone/fork into the source role file is not provided.
485
-
486
- Removing a worker at runtime is the symmetric `team-agent remove-agent <agent> --workspace . --confirm`.
487
-
488
- ## Worker Protocol
489
-
490
- The Team Agent MCP surface is exactly `send_message`, `report_result`, and optional `get_team_status`. Status is self-inspection only, never a prerequisite; lifecycle management remains on the authorized native CLI.
491
-
492
- Workers normally do not run nested Team Agent teams. When the user or leader explicitly asks for a child team, follow `references/team-in-team.md`; otherwise workers only provide the target and content for progress, and a short completion summary at the end:
493
-
494
- ```text
495
- team_orchestrator.send_message(to="leader", content="short progress or blocker")
496
- # to another teammate:
497
- team_orchestrator.send_message(to="<agent_id>", content="short coordination note")
498
- # to every other team member:
499
- team_orchestrator.send_message(to="*", content="short broadcast")
500
- team_orchestrator.report_result(summary="short completion", status="success", tests=[{"command":"command","status":"passed"}])
501
- ```
502
-
503
- For typed orchestration traffic, both `send_message` and `report_result` accept `presentation={"sink":"leader|casefile|silent","class":"message|progress|stage_result|stage_pass|bounce|blocking|final_review|timeout","case_id":"optional-case"}`. If the object is present, `sink` and `class` are required and unknown values fail closed. `casefile` and `silent` are durable-only, not deletion. The fixed critical classes `stage_pass`, `bounce`, `blocking`, `final_review`, and `timeout` always appear on the leader screen even when another sink is requested. Routing uses the typed class, never words in the content or summary.
504
-
505
- Do not pass `sender`, `task_id`, `schema_version`, or `agent_id` unless doing a low-level compatibility diagnostic. The MCP runtime fills those fields and keeps delivery metadata in runtime state and event logs. If provider env loses the worker id, MCP infers it from active task/message state and falls back to an explicit `unknown` sender instead of treating the worker as leader.
506
-
507
- Message targets are team-scoped. Use `leader`, another teammate agent id, or `*` for all other team members. The runtime excludes the sender from `*` broadcasts and never scans unrelated terminal windows for recipients.
508
-
509
- `report_result` stores and finalizes completion atomically: the result row is closed, the task is marked done with its accepted result id, and the `collect.result` event is recorded. It does not create a LeaderNotification message; use `team-agent results --case` for final results and `team-agent inbox AGENT -n 3` only as a compact transport fallback. `acknowledged_count` only means prior task messages were acknowledged by the worker; it is not a missing-result signal.
510
-
511
- For normal leader dispatch, prefer positional `team-agent send <TO> "..."` and the returned message id; do not use `--watch-result`.
512
-
513
- For long processes, workers must write logs, keep a pid, provide a health check, and stop after a bounded number of retries. QA/reviewer roles must stay within their authorized files and stop on service unavailable, approval prompts, or repeated startup failure.
514
-
515
- ## Failure Rules
516
-
517
- For any non-zero `team-agent` exit, report the command, exit code, last about 20 stderr lines, and affected task or agent when known.
518
-
519
- **If the error JSON/text includes a structured `action` field, run that `action` first.** This rule does not expire with skill versions.
520
-
521
- For an existing spec file or team directory, use the retained validation:
522
-
523
- ```bash
524
- team-agent validate "$d" --json
525
- ```
526
-
527
- A validation failure may include a structured `action`; prefer that action over guessing flags.
528
-
529
- `coordinator.session_missing` is a self-healing transient: run `team-agent status --json`, if `ready` is true (or workers show `running`) continue; do not shutdown and wait.
530
-
531
- `result_success_without_executed_tests` on a **non-coding** task (plain hello / status ping) is an advisory you may ignore. It is not a failed delivery.
532
-
533
- Examples of `action` observed on this gauge:
534
-
535
- - add-agent usage failure: `"action": "run \`team-agent doctor\` or inspect the log path shown here"`
536
- - send with no runtime: `"action": "Run team-agent quick-start/restart in the target workspace, or choose a workspace that has .team/runtime/state.json"`
537
- - `claim-leader` from a worker pane: `"action": "pane %21 is registered as worker developer-d108; run claim-leader from the leader's own pane, not a worker pane"` (exit 1, `ok: false`, `reason: caller_not_leader_shaped`)
538
-
539
- Do not retry with changed flags. Do not inspect source code or private runtime state. Do not operate tmux directly except when the user asks for a manual diagnostic. Do not answer provider approval prompts for the user.
540
-
541
- If `quick-start` reports `tmux session already exists`, treat it as a team-name collision. The existing session may be an active team; do not terminate it and do not suggest `shutdown` as the normal fix. Choose a distinct workspace folder name or set an optional `name:` override in valid `TEAM.md` frontmatter, then retry `team-agent quick-start .team/current`.
542
-
543
- Known Team Agent control-plane MCP prompts such as `team_orchestrator.report_result` and `team_orchestrator.send_message` are handled by the coordinator. It uses session-scoped approval, verifies the prompt cleared, retries boundedly, and logs the result. Do not ask the user to approve those routine internal prompts.
544
-
545
- When `status` still shows `AWAITING_APPROVAL`, run `team-agent approvals <agent_id>`, show the structured prompt summary and choices, ask the user to decide, and wait.
546
-
547
- Do not inspect raw worker terminal output during normal operation. Use `team-agent status`, `team-agent approvals`, `team-agent inbox AGENT -n 3`, `team-agent results --case`, and event logs instead. Raw-screen diagnostics are outside this skill's normal workflow, require explicit user authorization, and are guarded by the CLI; use them only as a one-shot bounded diagnostic, never as a routine workflow step.
81
+ The profile can supply its model when the role has no explicit `model`; an explicit role model remains an override. Use `team-agent models --provider <provider>` to discover provider model IDs when choosing one explicitly. Never print or paste profile secrets into chat or role files.
548
82
 
549
- Then stop and wait for the user **after** you have executed a provided `action` (or reported that it cannot be run from this pane).
83
+ ## Help and worker communication
550
84
 
551
- For "worker reported but leader cannot see completion":
85
+ Use `team-agent --help` or a command's `--help` for the installed CLI syntax. Worker MCP exposes `send_message`, `report_result`, and `get_team_status`; workers use `report_result` to return completion. Nested-team guidance is in [team-in-team.md](team-in-team.md).
552
86
 
553
- 1. Inspect `team-agent status --json` and `team-agent results --case` for the finalized result.
554
- 2. If the result is absent, check `.team/logs/events.jsonl` for `mcp.report_result` and `collect.result` before sending another prompt to the worker.
555
- 3. Use `team-agent inbox AGENT -n 3` only to inspect transport messages; it does not consume result rows.
556
- 4. Do not loop on `team-agent inbox <agent_id> -n 3` or ack/status counts; that burns context and cannot consume final results.
87
+ Keep role instructions in Markdown. Record explicit provider/bypass decisions for new plans, and add other metadata only for intentional settings; do not copy internal state fields into roles.