@team-agent/installer 0.5.119 → 0.5.120

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 (59) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/README.md +46 -1
  4. package/README.zh.md +46 -1
  5. package/crates/team-agent/src/cli/adapters.rs +11 -0
  6. package/crates/team-agent/src/cli/arguments.rs +401 -0
  7. package/crates/team-agent/src/cli/emit.rs +241 -142
  8. package/crates/team-agent/src/cli/intent/runtime.rs +1139 -0
  9. package/crates/team-agent/src/cli/intent/runtime_tests.rs +584 -0
  10. package/crates/team-agent/src/cli/intent/tests.rs +654 -0
  11. package/crates/team-agent/src/cli/intent.rs +642 -0
  12. package/crates/team-agent/src/cli/mod.rs +49 -5
  13. package/crates/team-agent/src/cli/named_address.rs +10 -1
  14. package/crates/team-agent/src/cli/spec.rs +22 -10
  15. package/crates/team-agent/src/cli/status_port/brief.rs +117 -16
  16. package/crates/team-agent/src/cli/tests/base.rs +6 -1
  17. package/crates/team-agent/src/cli/tests/parser_safety.rs +383 -0
  18. package/crates/team-agent/src/cli/tests/run_delegation.rs +63 -19
  19. package/crates/team-agent/src/cli/tests/verb_install_skill.rs +3 -2
  20. package/crates/team-agent/src/cli/tests/verb_profile.rs +3 -1
  21. package/crates/team-agent/src/contract_runtime/backend.rs +1 -1
  22. package/crates/team-agent/src/lifecycle/launch/quick_start.rs +166 -77
  23. package/crates/team-agent/src/lifecycle/launch.rs +28 -0
  24. package/crates/team-agent/src/lifecycle/restart.rs +17 -0
  25. package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +1 -3
  26. package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +5 -15
  27. package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +2 -3
  28. package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +2 -3
  29. package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +10 -2
  30. package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +8 -1
  31. package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +3 -2
  32. package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +6 -9
  33. package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +7 -5
  34. package/crates/team-agent/src/lifecycle/tests/cursor_mcp_overlay.rs +4 -2
  35. package/crates/team-agent/src/lifecycle/tests/cursor_require_explicit_model_red.rs +5 -2
  36. package/crates/team-agent/src/lifecycle/tests/cursor_restart_resume_red.rs +4 -3
  37. package/crates/team-agent/src/lifecycle/tests/grok_effort_argv_red.rs +2 -4
  38. package/crates/team-agent/src/lifecycle/tests/grok_mcp_overlay_red.rs +3 -4
  39. package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +5 -4
  40. package/crates/team-agent/src/lifecycle/tests/grok_restart_resume_red.rs +2 -4
  41. package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +78 -36
  42. package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +8 -4
  43. package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +6 -12
  44. package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +4 -0
  45. package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +1 -3
  46. package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +7 -0
  47. package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +1 -3
  48. package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +2 -1
  49. package/crates/team-agent/src/lifecycle/types.rs +10 -0
  50. package/crates/team-agent/src/tmux_backend/tests.rs +37 -0
  51. package/crates/team-agent/src/tmux_backend.rs +8 -1
  52. package/package.json +4 -4
  53. package/skills/team-agent/SKILL.md +71 -54
  54. package/skills/team-agent/command-coverage.json +283 -13
  55. package/skills/team-agent/docs/reference/team-agent-operator.md +220 -0
  56. package/skills/team-agent/references/bug-as-artifact-flow.md +1 -1
  57. package/skills/team-agent/references/recovery-runbook.md +61 -212
  58. package/skills/team-agent/references/team-agent-operator.md +181 -48
  59. package/skills/team-agent/references/team-in-team.md +47 -80
@@ -1,262 +1,111 @@
1
- # Team Agent Recovery Reference
1
+ # Team Agent recovery reference
2
2
 
3
- This reference is for the Rust Team Agent runtime. This reference is a live document.
3
+ Recover the selected team through public CLI evidence, not guessed bindings or old creation habits. Check that the chosen binary exposes `start`, `stop`, `team` and `agent` help. A reused candidate version string alone does not establish feature support. If missing, ask for an authorized supporting installation; do not switch binaries or rewrite state automatically.
4
4
 
5
- When a Team Agent framework problem appears, check this reference first. After the problem is resolved, update this reference before closing the work, whether or not the final fix used an existing entry here. New recovery advice may be added only after RS validation on a real Team Agent environment; unverified Python-only procedures stay out of this external reference.
5
+ ## Authority and non-destructive order
6
6
 
7
- ## Validation Gate
7
+ | Level | Who | Scope |
8
+ |---|---|---|
9
+ | L1 | Any agent | Read-only status/doctor/inbox, evidence and current-payload handoff |
10
+ | L2 | Authorized Leader | Context-preserving team/agent lifecycle repair |
11
+ | L3 | Explicitly authorized user/operator | Claim/takeover, intentional context discard, exceptional state/coordinator surgery |
8
12
 
9
- Every prescription below must carry an RS verification record. A command copied from Python 0.2.11 or from an incident note is not valid until it has been verified against the RS runtime. If RS behavior differs, document the RS behavior, not the Python behavior.
13
+ A worker must not run L2/L3 because it can read this reference. Explicit child-team delegation still requires original caller admission and parent protection. Follow [nested teams](team-in-team.md).
10
14
 
11
- Use placeholders only:
15
+ 1. Diagnose at L1 in the exact workspace/team.
16
+ 2. Prefer proven resume with `--session preserve`.
17
+ 3. Stop on unknown, partial or capability refusal; do not reset, retry or adopt a replacement blindly.
18
+ 4. Only explicit user/operator authorization can permit context loss or binding surgery. Never broadly kill shared servers or edit another workspace.
12
19
 
13
- - `$WORKSPACE` for the team workspace
14
- - `$TEAM` for the active team key when a command needs one
15
- - `$AGENT_ID` for a worker id
16
- - `$TASK_ID` for a task id
20
+ Use placeholders, not private paths: `$WORKSPACE`, `$TEAM`, `$AGENT_ID`, `$TASK_ID`.
17
21
 
18
- Do not write recipes that depend on a user's private absolute paths, private specification fields, or unverified local state.
22
+ ## 1. L1 read-only triage
19
23
 
20
- ## Recovery Levels
21
-
22
- | Level | Who may run it | Scope | Misuse consequence |
23
- | --- | --- | --- | --- |
24
- | L1 | Any agent, including a worker | Read-only diagnosis, file report handoff, status/log/result inspection, current-payload E23 fallback only | Low risk, but must not mutate bindings or lifecycle state |
25
- | L2 | Leader only | Resume-oriented lifecycle repair such as restart of an existing team or worker | A worker running L2 must be treated as `worker.privilege_escalation_attempt` |
26
- | L3 | User/operator only | Claiming/taking over leader ownership, state surgery, coordinator respawn, fresh/reset | E19/#232 class risk: wrong workspace or pane can steal ownership or destroy context |
27
-
28
- Spine for every incident:
29
-
30
- 1. Diagnose with L1 read-only commands.
31
- 2. Prefer resume or repair that preserves context.
32
- 3. Use L3 surgery only when the user/operator explicitly approves and the coordinator/write owner is controlled.
33
- 4. Use fresh/reset only as the last resort.
34
-
35
- Fresh/reset red line:
36
-
37
- > WARNING: context will be lost. Run this only after diagnostics, resume, and repair have all failed and the user has explicitly typed approval. Do not make it the default. Each use must emit `recovery.context_reset` with source and approval timestamp.
38
-
39
- ## Symptom Index
40
-
41
- | Symptom | Root cause family | Prescription |
42
- | --- | --- | --- |
43
- | Status is confusing, messages/results may be pending, or a worker says it cannot report | Need a safe read-only picture first | §1 L1 Read-Only Triage |
44
- | Leader pane exists but messages say `leader_not_attached`, `rebind_required`, `team_owner_mismatch`, or leader 被抢 | Leader ownership or receiver binding drift | §2 L3 Claim Or Rebind Leader |
45
- | A live team must be recovered without losing worker context | Resume/restart path needed | §3 L2 Restart With Resume First |
46
- | Shutdown/restart cleanup status is ambiguous | Need residue-based truth, not a single `ok` field | §4 L1/L2 Cleanup Verification |
47
- | MCP tool call fails with `Transport closed` while the worker still has the payload | Provider-owned MCP stdio child died | §5 MCP Transport-Dead Payload Handoff |
48
-
49
- ## 1. L1 Read-Only Triage
50
-
51
- [contextual: preserved] [level: L1] Any agent may run this. It reads state only and does not mutate the team.
52
-
53
- Diagnosis:
54
-
55
- ```bash
56
- team-agent status --workspace "$WORKSPACE" --json --detail
24
+ ```sh
25
+ team-agent team status --workspace "$WORKSPACE" --team "$TEAM" --json
26
+ team-agent doctor --workspace "$WORKSPACE" --team "$TEAM" --json
57
27
  team-agent inbox "$AGENT_ID" --workspace "$WORKSPACE" --team "$TEAM" -n 3 --json
58
28
  ```
59
29
 
60
- What to look for:
61
-
62
- - `leader_receiver.status`
63
- - `coordinator.status`
64
- - agent `status`
65
- - uncollected results
66
- - messages stuck in `accepted`, `failed`, or `rebind_required`
67
-
68
- Resume/repair:
69
-
70
- - If the answer identifies an L2/L3 condition, do not run the elevated command from a worker pane. Send the evidence to the leader/user.
71
- - If MCP reporting is broken, write a handoff artifact under the team's artifacts directory and tell the leader the relative path.
72
-
73
- Last resort:
74
-
75
- - None. This entry is read-only. Do not turn triage into fresh/reset.
76
-
77
- RS verification record:
30
+ Status is the concise node projection: use `runtime_status`, `activity`, `health` and the reported attach target without inferring absent internals. An uncertain node also carries `observation_reason` and an explicitly scoped `next_action`; healthy nodes retain the compact existing fields. `--detail` is not a full historical dump. Follow doctor's actual owner/receiver/coordinator findings and recovery actions. Installed is not authenticated; unknown is not proven dead, stopped or unavailable.
78
31
 
79
- - `#249 Python 0.2.11 -> Rust 0.3.2 upgrade compatibility`: Rust `status`, `collect`, and `read` succeeded against an upgraded live team; restart resumed and post-restart MCP delivery worked. Evidence ledger: `dogfood-execution-ledger-T2.md`, case `#249`.
80
- - Mac mini LOOP/G1-G4 evidence also captured status and command outputs after restart/shutdown flows; see `g1g4-macmini-confirm-report.md`.
32
+ Accepted/queued messages are not replies. Keep task/result/receiver evidence separate from transport acceptance. If the worker already has a report but MCP is broken, use the payload handoff contingency below rather than guessing it was delivered.
81
33
 
82
- Python 0.2.11 compatibility note:
34
+ ## 2. L3 claim or rebind only when diagnosed
83
35
 
84
- - Python teams used equivalent `status`/`collect` verbs. Python-specific wrapper paths are deprecated and are intentionally not listed here.
36
+ Use only when diagnosis identifies owner/receiver binding drift and the intended Leader pane/workspace/team are verified. Do not use this to bypass a failed creation, resume or caller check:
85
37
 
86
- ## 2. L3 Claim Or Rebind Leader
87
-
88
- [contextual: preserved] [level: L3] User/operator only. A worker must not run this. Misuse can steal the leader binding or recreate E19/#232 style ownership damage.
89
-
90
- Use this when L1 triage shows the leader pane is live but leader-bound delivery is blocked by ownership or receiver drift.
91
-
92
- Diagnosis:
93
-
94
- ```bash
95
- team-agent status --workspace "$WORKSPACE" --json --detail
96
- ```
97
-
98
- Confirm:
99
-
100
- - The current pane is the intended leader/operator pane.
101
- - The workspace is the intended team workspace.
102
- - The target team is the intended `$TEAM` when multiple teams share a workspace.
103
-
104
- Resume/repair:
105
-
106
- ```bash
38
+ ```sh
107
39
  team-agent claim-leader --workspace "$WORKSPACE" --team "$TEAM" --json
108
40
  ```
109
41
 
110
- If the previous owner is live and the user explicitly approves stealing ownership, add the product's confirmation flag:
42
+ If the previous owner is live, taking ownership additionally needs explicit user approval and the public confirmation flag:
111
43
 
112
- ```bash
44
+ ```sh
113
45
  team-agent claim-leader --workspace "$WORKSPACE" --team "$TEAM" --confirm --json
114
46
  ```
115
47
 
116
- Validate:
117
-
118
- ```bash
119
- team-agent status --workspace "$WORKSPACE" --json --detail
120
- ```
121
-
122
- The receiver should be attached and new leader-bound delivery should no longer report `leader_not_attached`.
123
-
124
- Extreme surgery:
125
-
126
- - Do not edit binding fields by hand unless a user/operator has approved the exact state repair and the coordinator/write owner is stopped or otherwise controlled.
127
-
128
- Last resort:
129
-
130
- - Fresh/reset is not a leader claim repair. Do not use it here.
131
-
132
- RS verification record:
133
-
134
- - Dogfood T2 R2: old live team restart/claim/takeover passed from the persistent leader pane. Evidence ledger: `dogfood-execution-ledger-T2.md`, case `R2`.
135
- - RS #235 bug3 Mac mini run: `claim-leader` and `takeover` claimed live panes and persisted `leader_receiver.status="attached"` with `claimed_via="claim-leader"`. Evidence root id: `7b146ce-bug3-20260606T023011Z`.
136
- - G1-G4 report: help path for `claim-leader` exited 0 and did not trigger action validation. Evidence: `g1g4-macmini-confirm-report.md`, CR-063.
137
-
138
- Python 0.2.11 compatibility note:
139
-
140
- - Python had analogous claim/takeover verbs. Use RS commands above for RS teams.
141
-
142
- ## 3. L2 Restart With Resume First
143
-
144
- [contextual: partial] [level: L2] Leader only. A worker must not run this. The goal is to preserve session context; resume is always before fresh.
145
-
146
- Use this when L1 triage shows a team or worker needs lifecycle repair but the state still carries enough runtime/session context to resume.
147
-
148
- Diagnosis:
149
-
150
- ```bash
151
- team-agent status --workspace "$WORKSPACE" --json --detail
152
- ```
153
-
154
- Resume/repair:
155
-
156
- ```bash
157
- team-agent restart "$WORKSPACE" --team "$TEAM" --json
158
- ```
159
-
160
- A single-worker clean-context reset is not a resume operation. Only after the user explicitly approves discarding that worker's session, use:
161
-
162
- ```bash
163
- team-agent reset-agent "$AGENT_ID" --workspace "$WORKSPACE" --team "$TEAM" --discard-session --json
164
- ```
48
+ Recheck status/doctor and real Leader-bound delivery afterward. A command receipt alone is not actual client consumption. Do not clear CALLER/Leader identity or manually patch binding fields. State/coordinator surgery requires its own exact authorization and controlled write owner; it is not a normal recovery recipe.
165
49
 
166
- Validate:
50
+ ## 3. L2 restart with strict continuation first
167
51
 
168
- ```bash
169
- team-agent status --workspace "$WORKSPACE" --json --detail
170
- team-agent inbox "$AGENT_ID" --workspace "$WORKSPACE" --team "$TEAM" -n 3 --json
52
+ ```sh
53
+ team-agent team restart --session preserve --workspace "$WORKSPACE" --team "$TEAM" --json
54
+ team-agent agent restart "$AGENT_ID" --session preserve --workspace "$WORKSPACE" --team "$TEAM" --json
171
55
  ```
172
56
 
173
- The expected result is `status="restarted"` or an equivalent running projection without duplicate-session errors. Do not treat a partial failure on one worker as permission to reset the whole team.
57
+ Run the applicable operation, not both automatically. Single-seat restart preflights continuation/capabilities before stop and starts only after confirmed stop. Known missing capture/backing for existing context refuses before destruction. A genuinely never-used seat may still take its original first-fresh path; that is not evidence of remembered-context restoration.
174
58
 
175
- Extreme surgery:
59
+ Team restart leaves explicitly stopped and paused seats alone. To intentionally wake the selected stopped non-paused roster, use:
176
60
 
177
- - If restart reports a resume-integrity refusal, stop and escalate. Do not silently rerun with fresh flags.
178
-
179
- Last resort:
180
-
181
- ```bash
182
- # Last resort only; see red line at top of this reference.
183
- team-agent restart "$WORKSPACE" --team "$TEAM" --allow-fresh --json
61
+ ```sh
62
+ team-agent start --workspace "$WORKSPACE" --team "$TEAM" --json
184
63
  ```
185
64
 
186
- WARNING: context will be lost. Run this only after diagnostics, resume, and repair have all failed and the user has explicitly typed approval. Do not make it the default. Each use must emit `recovery.context_reset` with source and approval timestamp.
187
-
188
- RS verification record:
189
-
190
- - Dogfood T2 R2: restart returned restarted and status after restart showed a running team. Evidence ledger: `dogfood-execution-ledger-T2.md`.
191
- - Dogfood #249: Rust restart resumed session `019e9ffd-c99c-7b60-bff3-9612ab35bcf5`, post-restart MCP delivery worked, and cleanup residue was 0. Evidence ledger: `dogfood-execution-ledger-T2.md`, case `#249`.
192
- - G1-G4 Mac mini reconfirmation: restart recovered the same fake team in CR-007, after acknowledge-idle context in CR-021, and in coordinator recovery context in CR-052. Evidence: `g1g4-macmini-confirm-report.md`.
193
-
194
- Python 0.2.11 compatibility note:
195
-
196
- - Python restart procedures are deprecated compatibility background only. For RS teams, use the RS commands above.
197
-
198
- ## 4. L1/L2 Cleanup Verification
199
-
200
- [contextual: partial] [level: L1 for verification, L2 for shutdown command] A worker may inspect cleanup evidence. Only the leader should run lifecycle cleanup.
65
+ This activation is not a repair fallback and must be authorized for the roster. It neither unpauses seats nor guesses around corrupt/spec-only/unknown state. A live no-op is not changed role-file synchronization or business readiness.
201
66
 
202
- Diagnosis:
67
+ New restart defaults to **auto** when the option is omitted: proven resume or only the original legal fresh fallback. Auto can lose remembered context; it is not synonymous with preserve or reset. If strict continuation refuses, retain the receipt and escalate. Only if the user explicitly authorizes the possible loss may the Leader choose:
203
68
 
204
- ```bash
205
- team-agent status --workspace "$WORKSPACE" --json --detail
69
+ ```sh
70
+ team-agent team restart --session auto --workspace "$WORKSPACE" --team "$TEAM" --json
206
71
  ```
207
72
 
208
- Resume/repair:
73
+ Unsupported native fresh/resume remains a refusal; do not change provider, force legacy fallback or repeatedly retry a partial/unknown generation. Validate actual node identities/session receipts and a natural worker reply before claiming recovery.
209
74
 
210
- - If a leader intentionally stops or shuts down a test team, verify by residue, not by a single top-level `ok` field.
211
- - For cleanup verification, inspect whether the team session is gone and whether residual process/session lists are empty in the command output or status evidence.
75
+ ## 4. L1 verification / L2 scoped stop
212
76
 
213
- Leader command:
77
+ Only an authorized Leader stops the selected team:
214
78
 
215
- ```bash
216
- team-agent shutdown --workspace "$WORKSPACE" --keep-logs --json
79
+ ```sh
80
+ team-agent stop --workspace "$WORKSPACE" --team "$TEAM" --json
217
81
  ```
218
82
 
219
- Validate:
83
+ Verify actual typed results, not just exit0:
84
+ - Intended team session/panes and owned native/helper/coordinator processes have the expected terminal outcome.
85
+ - Returned `residuals.sessions`, `residuals.processes` and `residuals.owned_files` are empty, with no unresolved degraded/unknown verification.
86
+ - Where zero-removable-resource acceptance is required, independently check the frozen owned inventory, including sockets, twice. Keep predeclared native archives/evidence separate from live residuals.
87
+ - Shared coordinator/Leader/sibling resources remain protected. A stopped last-team coordinator can be expected, not automatically a new defect.
220
88
 
221
- - `session_killed=true` is decisive for a session that was expected to be killed.
222
- - `residuals.sessions=[]` and `residuals.processes=[]` are decisive for cleanup.
223
- - A missing coordinator after a successful cleanup can be expected; do not classify it alone as a product failure.
89
+ Do not manually unlink unknown sockets or kill shared tmux servers to manufacture success. Preserve a failing scene and its ownership/birth evidence.
224
90
 
225
- Extreme surgery:
91
+ ## 5. MCP transport-dead payload handoff
226
92
 
227
- - Do not manually kill shared tmux servers from a worker pane.
93
+ If a worker already owns the current report payload and its MCP stdio transport closes before normal send/report acceptance, preserve the exact payload in a team-scoped handoff artifact and inform the Leader/user through the remaining authorized visible channel. Do not copy credentials or substitute a database write/manual answer for natural Leader consumption.
228
94
 
229
- Last resort:
95
+ This L1 contingency is not a general alternate messaging system or permission for worker lifecycle repair. After an authorized restart/resume, return to the three normal MCP tools. Queued notification, server write and actual Leader receipt remain different evidence layers.
230
96
 
231
- - None. Cleanup verification is not a context reset path.
97
+ ## 6. Intentional clean context is not incident recovery
232
98
 
233
- RS verification record:
99
+ Only after explicit user approval to discard that worker's association:
234
100
 
235
- - Dogfood T2 R3: quick-start with true Codex worker, MCP server live, shutdown returned `ok=true`, `session_killed=true`, endpoint `has-session` rc=1, and post MCP/node/codex/process residue lines were all 0. Evidence ledger: `dogfood-execution-ledger-T2.md`.
236
- - G1-G4 CR-005: stop returned `ok=true`, `status="stopped"`, `session_killed=true`; following shutdown reported missing without treating that alone as failure. Evidence: `g1g4-macmini-confirm-report.md`.
237
-
238
- Python 0.2.11 compatibility note:
239
-
240
- - Python cleanup notes may mention direct tmux commands. They are not listed here as RS recovery prescriptions.
241
-
242
- ## 5. MCP Transport-Dead Payload Handoff
243
-
244
- [contextual: preserved] [level: L1] If the worker already has a leader-bound payload in hand and the MCP transport dies before the normal `send` or `report_result` path can accept it, preserve the payload in a file handoff artifact and ask for leader/user recovery through the visible channel that still works.
245
-
246
- After restart/resume, use the normal MCP tool path again. Do not treat file handoff as a general message path or as permission to run arbitrary L2/L3 recovery operations.
247
-
248
- Python 0.2.11 compatibility note:
249
-
250
- - Python MCP stdio EOF had no durable reconnect. File handoff was the practical fallback.
101
+ ```sh
102
+ team-agent agent reset "$AGENT_ID" --workspace "$WORKSPACE" --team "$TEAM" --discard-session --json
103
+ ```
251
104
 
252
- ## Held Out Of This Reference
105
+ Warn that context will be lost. Each intentional fresh/reset must retain `recovery.context_reset` audit evidence with authorization source and timestamp; missing evidence is not permission to fabricate an event or claim approval. Preserve the actual result and do not claim every native archive was erased. Reset is never an automatic response to preserve refusal, permission prompts or partial replacement.
253
106
 
254
- [contextual: unknown] Python-only procedures from older incident notes are intentionally not included as external RS prescriptions:
107
+ ## Compatibility and validation scope
255
108
 
256
- - legacy roster block cloning
257
- - direct live runtime-state injection
258
- - raw coordinator respawn commands
259
- - direct tmux-server surgery
260
- - hard-coded runtime paths
109
+ The old bare/explicit-path `restart` keeps its preserve default; `quick-start`, `shutdown` and suffixed agent commands remain compatibility bridges for existing scripts, not these daily recovery instructions. Do not mechanically rename scripts or rewrite historical receipts as if they used the new surface.
261
110
 
262
- These may be useful forensic background for maintainers, but each must pass the RS validation gate before becoming a user-facing recipe.
111
+ The short start/stop/restart journey has isolated two-Pi lifecycle verification, including live no-op, held-seat preservation, both-seat activation and scoped cleanup. Automated fixtures cover continuation/backing/partial/native/mixed refusals. This is not a fresh all-provider same-session memory or all-platform acceptance claim. Earlier Rust resume/cleanup records retain their original scope in history; Python-only repair, roster cloning, raw state injection and direct server/coordinator surgery are not promoted into validated public recipes.
@@ -1,10 +1,114 @@
1
1
  # Team Agent operator reference
2
2
 
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.
3
+ Canonical source: `docs/reference/team-agent-operator.md`. The two packaged mirrors under `skills/team-agent/docs/reference/` and `skills/team-agent/references/` are byte-identical; update the source and synchronize both, never maintain divergent operating instructions.
4
4
 
5
- ## Plain-text team
5
+ <!-- command-coverage:normative-start -->
6
+ ## Normative command inventory and compatibility accountability
6
7
 
7
- Create a directory with `TEAM.md` and at least one `agents/*.md` file:
8
+ The current daily forms below are coverage authorities, not permission to execute every command. Provider/permission choices, scope, caller, session and capability guards in this guide still apply. New forms remain honestly `declared_gap` until the strict source/assertion/negative-twin evidence exists; successful Help or a separate finite journey is not automatic promotion. Every compact-Skill command must belong to exactly one coverage bucket.
9
+
10
+ ### Current documented forms
11
+ ```text
12
+ team-agent --version
13
+ team-agent agent clone reviewer --as second-reviewer --workspace . --team project-team
14
+ team-agent agent fork reviewer --as continued-reviewer --workspace . --team project-team
15
+ team-agent agent remove reviewer --confirm --workspace . --team project-team
16
+ team-agent agent reset reviewer --discard-session --workspace . --team project-team
17
+ team-agent agent restart reviewer --session preserve --workspace . --team project-team
18
+ team-agent doctor --workspace . --json
19
+ team-agent inbox leader --workspace . --team project-team -n 3
20
+ team-agent models --provider NAME
21
+ team-agent profile init my-api --auth-mode compatible_api --workspace .
22
+ team-agent restart reviewer --workspace . --team project-team
23
+ team-agent route add pi -- --verbose
24
+ team-agent route clear pi
25
+ team-agent route disable
26
+ team-agent route enable
27
+ team-agent route set pi -- --mode rpc
28
+ team-agent route show pi --json
29
+ team-agent route status --json
30
+ team-agent send reviewer "Review the current change and report the main risk." --workspace . --team project-team
31
+ team-agent send reviewer "Review this change" --workspace . --team project-team
32
+ team-agent start --from ./my-team --workspace . --team project-team
33
+ team-agent start --from .team/current --workspace . --team project-team
34
+ team-agent start --help
35
+ team-agent start --workspace . --team project-team
36
+ team-agent start analyst --provider pi --bypass false --prompt "Analyze the proposed change"
37
+ team-agent start auditor --role-file /absolute/path/to/auditor.md
38
+ team-agent start reviewer --effort high --bypass false
39
+ team-agent start reviewer --effort high --bypass false --workspace . --team project-team
40
+ team-agent start reviewer --workspace . --team project-team
41
+ team-agent status --json
42
+ team-agent stop --workspace . --team project-team --json
43
+ team-agent stop reviewer
44
+ team-agent stop reviewer --workspace . --team project-team
45
+ team-agent team --help
46
+ team-agent team restart --session preserve --workspace . --team project-team
47
+ team-agent team restart --workspace . --team project-team
48
+ team-agent team restart --workspace . --team project-team --json
49
+ ```
50
+
51
+ ### Retained compatibility and negative-probe forms — NOT daily recipes
52
+ The following old argv remain in the closed-world catalog for existing scripts and historical tests. Some intentionally invalid or removed flag combinations are negative probes, not supported operational advice. Existing covered records keep their original evidence and are not renamed to imply new-command coverage.
53
+
54
+ ```text
55
+ team-agent add-agent <agent> --role-file <file>
56
+ team-agent add-agent reviewer --role-file .team/current/agents/reviewer.md --workspace .
57
+ team-agent approvals
58
+ team-agent approvals <agent_id>
59
+ team-agent approvals [coder]
60
+ team-agent attach-leader
61
+ team-agent claim-leader
62
+ team-agent claude
63
+ team-agent clone-agent <source> --as <new>
64
+ team-agent codex
65
+ team-agent codex --dangerously-bypass-approvals-and-sandbox
66
+ team-agent doctor
67
+ team-agent fork-agent <source> --as <new>
68
+ team-agent inbox <agent_id> -n 3
69
+ team-agent inbox coder -n 3
70
+ team-agent profile doctor <name> --workspace . --json
71
+ team-agent profile init <name> --auth-mode subscription --workspace .
72
+ team-agent profile init claude-default --auth-mode subscription --workspace .
73
+ team-agent profile init codex-default --auth-mode subscription --workspace .
74
+ team-agent profile init deepseek --auth-mode compatible_api --workspace .
75
+ team-agent profile show <name> --workspace . --json
76
+ team-agent profile show deepseek --workspace . --json
77
+ team-agent quick-start
78
+ team-agent quick-start ./roles --team-id alpha
79
+ team-agent quick-start .team/alpha
80
+ team-agent quick-start .team/current
81
+ team-agent quick-start <dir>
82
+ team-agent quick-start <plain-text-team-dir>
83
+ team-agent remove-agent <agent> --workspace . --confirm
84
+ team-agent reset-agent <agent> --discard-session
85
+ team-agent restart
86
+ team-agent restart .
87
+ team-agent restart . --allow-fresh
88
+ team-agent restart . --team <session_name_or_team_name>
89
+ team-agent send --task task_initial "Start"
90
+ team-agent send --watch-result
91
+ team-agent send --watch-result coder "Do the bounded task"
92
+ team-agent send TO MESSAGE
93
+ team-agent send reviewer "..."
94
+ team-agent send reviewer "Review this change"
95
+ team-agent shutdown --workspace . --keep-logs
96
+ team-agent start-agent <agent>
97
+ team-agent start-agent <agent_id> --workspace .
98
+ team-agent start-agent coder --workspace .
99
+ team-agent status
100
+ team-agent status --detail --json
101
+ team-agent status coder
102
+ ```
103
+
104
+ The exact test binary's root Help complements this marked inventory; it does not authorize model launches or convert untested forms into covered claims.
105
+ <!-- command-coverage:normative-end -->
106
+
107
+ Only the authorized Leader operates team lifecycle. Check the chosen binary's `start --help` and `team --help`; an old installed CLI or a reused candidate version string is not proof of the intuitive surface. Do not silently install, switch binaries or copy credentials to make an example work.
108
+
109
+ ## Configure once, use start/stop
110
+
111
+ A source directory contains `TEAM.md` and at least one role:
8
112
 
9
113
  ```text
10
114
  my-team/
@@ -12,76 +116,105 @@ my-team/
12
116
  agents/reviewer.md
13
117
  ```
14
118
 
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.
119
+ The body of `TEAM.md` is the team goal. Each role body contains instructions; the filename stem is the default agent ID. Record the user's provider and boolean bypass decisions for a new plan. From the native Leader tool context in the workspace:
120
+
121
+ ```sh
122
+ team-agent start --from ./my-team --workspace . --team project-team
123
+ team-agent start --workspace . --team project-team
124
+ team-agent send reviewer "Review the current change and report the main risk." --workspace . --team project-team
125
+ team-agent inbox leader --workspace . --team project-team -n 3
126
+ team-agent stop --workspace . --team project-team --json
127
+ ```
128
+
129
+ Creation needs complete configuration; start is not automatic template generation or state repair. Later start starts stopped non-paused members, including explicitly stopped members, and leaves verified live/drift-free instances unchanged. A no-op does not synchronize role bodies, apply new launch settings or prove tool/business readiness. A queued send is not completion; wait for a natural reply/result.
130
+
131
+ ## Scope and deterministic targets
16
132
 
17
- From a tmux-addressable terminal or supported agent pane, run commands in the workspace root (the parent of `my-team`):
133
+ - Pin `--workspace PATH` and `--team KEY` when operating outside the selected team, across workspaces or when several teams exist.
134
+ - `start reviewer.v2` is an agent, even if that directory exists. Team sources use `--from DIR`, `team start DIR` or explicit path syntax such as `./my-team`.
135
+ - `restart ID` selects an agent; a same-named directory causes conservative refusal. `agent restart ID` removes the ambiguity.
136
+ - Explicit missing paths, unknown flags, conflicts and extra arguments refuse; do not try a guessed CWD or takeover instead.
137
+ - `--dry-run` on start/restart has no lifecycle effects. A proposed plan is not final lock-held admission. No eligible targets returns nonzero with the selected scope and skipped seats, not a successful start.
138
+
139
+ ## User decisions and compatibility
140
+
141
+ Do not silently pick provider, model, effort or bypass. False preserves native permissions; it is not a read-only or sandbox guarantee. Use supported `models --provider NAME` discovery and retain exact model IDs.
142
+
143
+ Traditional minimal Markdown remains accepted by the original compiler. Its compatibility interpretation is **not a default for a new user plan**: provider defaults to Pi, bypass to false, and unset model/effort are left to the provider. Team Agent does not infer a role model from TEAM defaults. Legacy explicit TEAM provider_effort remains supported for non-Pi roles; do not invent an effort for unspecified roles.
144
+
145
+ Supported role metadata:
146
+ - `agent_id` (legacy `name`) and `role` identify the seat.
147
+ - `provider`, `model`, `effort`, and boolean `dangerously_skip_permissions` select intentional launch settings.
148
+ - `auth_mode` and `profile` refer to local provider configuration.
149
+ - `communication_mode` selects an admitted communication contract.
150
+ - Historical `tools`, `permission_mode` and `label` do not restrict worker tools or permissions.
151
+
152
+ ## Add or wake with start
153
+
154
+ A RoleOnly seat can be registered from its complete role file. A genuinely absent ID needs a complete file or explicit provider/bypass choices. These Pi/false values are examples of user decisions, not defaults:
18
155
 
19
156
  ```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 .
157
+ team-agent start auditor --role-file /absolute/path/to/auditor.md
158
+ team-agent start analyst --provider pi --bypass false --prompt "Analyze the proposed change"
26
159
  ```
27
160
 
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.
161
+ An imported external role goes into this team's `agents/ID.md`; the original stays untouched. A file already at that destination is used in place. Equal file/CLI definitions are accepted; conflicting provider/model/effort/bypass/prompt/profile values refuse before writes/startup. Omitted model, effort, profile and role body remain unchanged.
162
+
163
+ Use `agent add` when explicitly requesting strict add-only behavior. It creates and starts a new seat but refuses an occupied ID, including stopped seats. Its disaster-recovery `--force` still requires a positively dead registered old pane and no live target cohort; a live or unknown target refuses. Force is not a role-update or routine restart shortcut.
164
+
165
+ ## Change a registered seat
29
166
 
30
- ## User decisions and legacy compatibility
167
+ ```sh
168
+ team-agent stop reviewer --workspace . --team project-team
169
+ team-agent start reviewer --effort high --bypass false --workspace . --team project-team
170
+ ```
31
171
 
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:
172
+ Stop first before applying edited instructions or launch settings. A running seat with requested changes or known drift refuses rather than claiming a successful no-op. `--prompt` replaces permanent role instructions, not a one-time task; send one-time work with `send`. `--bypass` requires explicit true/false. Matching provider is allowed, but changing engines, even by file edits, is refused; use a new ID.
33
173
 
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 |
174
+ The original role/spec transaction and provider admission remain authoritative. A failure is not an applied update; never assume a partial/unknown native replacement was rolled back or is safe to retry. Inspect the exact scoped receipt, status and doctor first.
40
175
 
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.
176
+ ## Restart and session policy
42
177
 
43
- Optional supported role metadata:
178
+ ```sh
179
+ team-agent restart reviewer --workspace . --team project-team
180
+ team-agent team restart --workspace . --team project-team
181
+ # Strict continuation: refuse before stop if known continuation evidence is absent.
182
+ team-agent agent restart reviewer --session preserve --workspace . --team project-team
183
+ team-agent team restart --session preserve --workspace . --team project-team
184
+ ```
44
185
 
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.
186
+ New agent/team restart defaults to **auto**: proven resume when possible, otherwise only the provider's existing legal fresh path. Auto is not a guarantee of saved memory, reset permission or a fallback around native capability refusal. Preserve requests strict continuation. The old bare/explicit-path restart bridge retains its original preserve default and output.
50
187
 
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.
188
+ Single-agent restart checks scope, role/session backing and capabilities before stop; only confirmed stop allows start. On partial failure, report actual completed steps and inspect; do not blindly reset or replay. Team restart does not reactivate explicitly stopped or paused seats. Whole-team start intentionally activates the selected non-paused roster; neither command silently unpauses.
52
189
 
53
- ## Add and start
190
+ ## Explicit agent operations
54
191
 
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.
192
+ ```sh
193
+ team-agent agent remove reviewer --confirm --workspace . --team project-team
194
+ # Only after explicit authorization to discard this worker's context:
195
+ team-agent agent reset reviewer --discard-session --workspace . --team project-team
196
+ team-agent agent clone reviewer --as second-reviewer --workspace . --team project-team
197
+ team-agent agent fork reviewer --as continued-reviewer --workspace . --team project-team
198
+ ```
56
199
 
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.
200
+ Remove/reset/clone/fork retain original confirmation, ownership and provider-capability gates. Clone copies configuration; fork is a new-seat continuation only where admitted. `--in-place` is unsupported. Unsupported native lifecycle is a refusal, never permission to silently use a legacy engine. Reset does not erase every native provider archive and must not be incident recovery's first response.
58
201
 
59
202
  ## Profiles and custom models
60
203
 
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.
62
-
63
- Create a local profile, then edit its generated file on the user's machine:
204
+ Profiles keep authentication/endpoints outside role text. Imported roles use this team's/workspace's profiles, not the external role's original directory. Prepare a named profile locally through public commands; never discover, copy or print external credentials:
64
205
 
65
206
  ```sh
66
207
  team-agent profile init my-api --auth-mode compatible_api --workspace .
67
208
  ```
68
209
 
69
- Reference it without copying secrets into Markdown:
210
+ A role may explicitly reference `auth_mode: compatible_api` and `profile: my-api`, with the user's chosen provider/bypass. Profile model applies only when the role has no explicit override. Subscription and custom-API capabilities differ; follow actual provider admission, not a generic promise.
70
211
 
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.
79
- ```
212
+ ## Observe and finish
80
213
 
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.
214
+ `status` / `team status` expose the concise node projection; `--detail` does not restore historical internal dumps. Use `doctor` for diagnosis. Check actual readiness and returned recovery actions; unknown evidence is not a stopped/live proof. Stop with `stop --workspace PATH --team KEY --json` and verify scoped residual sessions, processes and owned files. Protect parent/sibling/shared resources.
82
215
 
83
- ## Help and worker communication
216
+ Workers have only `send_message`, `report_result` and optional `get_team_status`. Report completion through `report_result`; do not promote a worker to lifecycle operator. See [nested teams](https://github.com/Florious95/team-agent/blob/main/skills/team-agent/references/team-in-team.md) and [recovery](https://github.com/Florious95/team-agent/blob/main/skills/team-agent/references/recovery-runbook.md).
84
217
 
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).
218
+ ## Legacy command bridges
86
219
 
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.
220
+ Existing scripts may retain `quick-start`, `shutdown`, and `add-agent/start-agent/stop-agent/remove-agent/reset-agent/clone-agent/fork-agent`. These are compatibility interfaces, not the daily workflow. Use the short/team/agent forms above for new instructions. Do not mechanically rename scripts: legacy start refuses a live seat, new start can prove a no-op; bare/explicit-path legacy restart preserves its default. Old normal command output and failure evidence remain authoritative.