| 1 | # Historical Tool-Surface Lifecycle Policy (v0.8.53) |
| 2 | |
| 3 | > 阅读简体中文版:[zh_hans/TOOL_LIFECYCLE.md](zh_hans/TOOL_LIFECYCLE.md) |
| 4 | |
| 5 | **Status:** Historical design record, not current runtime documentation. The |
| 6 | v0.9.1 canonical action surface and replay-only alias contract are documented in |
| 7 | [`RUNTIME_SIMPLIFICATION_DESIGN.md`](RUNTIME_SIMPLIFICATION_DESIGN.md) and |
| 8 | [`TOOL_SURFACE.md`](TOOL_SURFACE.md). No catalog code landed in this old cycle — the code |
| 9 | work is **deferred**. This document is the umbrella policy for GitHub **#2681**, |
| 10 | with **#2682** and **#2683** as concrete instances of the planned diet. It |
| 11 | describes *what will be done* and the invariants any future diet PR must hold. |
| 12 | |
| 13 | **Scope of related open work (do not contradict):** |
| 14 | - PR **#2684** — subagent role vocabulary, lifecycle signals, eval ergonomics. |
| 15 | Legacy subagent-name cleanup + guardrail tests in this policy rebase on #2684. |
| 16 | - PR **#2685** — git-history active + RLM/field errors. |
| 17 | |
| 18 | **What actually happened, so you can read the rest as history:** the "hidden |
| 19 | compatibility" plan below was *not* what shipped. `exec_wait` and |
| 20 | `exec_interact` were removed rather than kept dispatchable. `todo_write` is the |
| 21 | only work-progress tool and `speech` the only speech tool: the hidden aliases |
| 22 | `work_update`, `TodoWrite`, `todo`, `checklist_write`, `checklist_update` and |
| 23 | `tts` were deleted later, and `checklist_add`, `checklist_list`, `todo_add`, |
| 24 | `todo_update` and `todo_list` were never registered. Nothing re-executes a |
| 25 | saved tool call, so a deleted name keeps only its display mapping, its policy |
| 26 | alias rows and its place in `RESERVED_TOOL_NAMES`. See |
| 27 | [`TOOL_SURFACE.md`](TOOL_SURFACE.md) for the shipped contract. Read §4 and §8 |
| 28 | as a rejected catalog-diet proposal. |
| 29 | |
| 30 | **All file:line citations here were correct at v0.8.52/0.8.53 and are now |
| 31 | expired.** They have not been rewritten, because renumbering a historical |
| 32 | record makes it look current. Symbols this document cites that no longer exist |
| 33 | at all include `ARCEE_FIRST_TURN_NATIVE_TOOLS` and `apply_provider_tool_policy` |
| 34 | (both removed by `1bfcced43c`, "fix(engine): remove Arcee tool catalog |
| 35 | exception"), and the planned `HIDDEN_COMPATIBILITY_TOOLS` / `DEPRECATED_ALIASES` |
| 36 | sets, which were never written. Resolve any symbol here against the tree before |
| 37 | acting on it. |
| 38 | |
| 39 | --- |
| 40 | |
| 41 | ## 1. Purpose and the weaker-model problem |
| 42 | |
| 43 | Codewhale ships a large native tool surface. The first-turn *active* partition |
| 44 | of that surface is what every model sees before it has run a single |
| 45 | discovery call. Today that active set contains several **near-duplicate |
| 46 | tools** that map to the *same* implementation under different names: |
| 47 | |
| 48 | - `exec_wait` and `exec_shell_wait` are both `ShellWaitTool` |
| 49 | (`crates/engine/src/tools/registry.rs:526,529`). |
| 50 | - `exec_interact` and `exec_shell_interact` are both `ShellInteractTool` |
| 51 | (`registry.rs:527,530`). |
| 52 | - `tts` and `speech` are both `SpeechTool` |
| 53 | (`registry.rs:787-792`, both deferred). |
| 54 | - `todo_write` is the single model-visible `TodoWriteTool` surface; |
| 55 | `todo_write`, `TodoWrite`, `todo`, `checklist_write`, and |
| 56 | `checklist_update` are hidden compat aliases of it. |
| 57 | |
| 58 | For a strong model, redundant names are harmless noise. For **weaker / smaller |
| 59 | models** (the Arcee Trinity lane, `deepseek-v4-flash` child executors, and any |
| 60 | non-thinking executor), every additional near-duplicate in the visible set is a |
| 61 | real cost: |
| 62 | |
| 63 | - It widens the choice space with options that do *nothing distinct*, increasing |
| 64 | wrong-tool selection and oscillation between synonyms. |
| 65 | - It spends scarce first-turn catalog budget (Section 5) on zero-information |
| 66 | entries. |
| 67 | - It dilutes the "one name = one thing" contract that lets a small model reason |
| 68 | about the surface at all. |
| 69 | |
| 70 | The lifecycle policy exists to **shrink and discipline the model-visible |
| 71 | surface** without ever breaking the ability to replay an old transcript that |
| 72 | referenced a now-retired name. |
| 73 | |
| 74 | ### Canonical work-tracking surface for v0.9.1 |
| 75 | |
| 76 | The model-visible progress surface is a single tool: `todo_write` (#4132). |
| 77 | Agents and Fleet workers use it for concrete To-do / Work progress under the |
| 78 | active runtime thread or durable task. |
| 79 | |
| 80 | `task_*` and the Fleet/Workflow ledger remain the durable lifecycle owners. |
| 81 | Checklist metadata is the model-visible projection of progress: |
| 82 | `task_updates.checklist` carries the current items, completion percentage, and |
| 83 | in-progress item. |
| 84 | |
| 85 | **The To-do is the only Work surface.** `update_plan` is conversational |
| 86 | reasoning — strategy, context, and route notes for complex initiatives. It is |
| 87 | not a progress surface, must not duplicate To-do items, and plan-only state is |
| 88 | never rendered as a To-do snapshot. |
| 89 | |
| 90 | **No request re-states the list.** The model learns what is on the To-do the way |
| 91 | it learns anything else: from its own `todo_write` call, whose input is the |
| 92 | whole list, and the short receipt it returned (counts and the item in |
| 93 | progress). Both are ordinary persisted history. Nothing is appended to a parent turn-loop |
| 94 | step or a sub-agent step. The complete list stays visible in the UI, which is a |
| 95 | different surface from the request. |
| 96 | |
| 97 | `crates/engine/src/todo_snapshot.rs` renders the one bounded body — hard-bounded in |
| 98 | both item count and characters, in-progress item preserved preferentially, any |
| 99 | elision marked — for the three seams that show a snapshot *once*, because a |
| 100 | person asked: the `<codewhale:fork_state>` block a newly forked agent is handed, |
| 101 | `/relay`, and the in-transcript agent card. |
| 102 | |
| 103 | Two properties of that renderer are load-bearing: |
| 104 | |
| 105 | - **Authority.** The snapshot is read from the `WorkRuntime` graph projection |
| 106 | when a runtime owns that list, because `todo_write` stages there and only |
| 107 | publishes into the legacy `SharedTodoList` view later. Sessions with no |
| 108 | attached runtime read the list directly. |
| 109 | - **Per-agent isolation.** Every agent reads *its own* list (`#4810`), so a |
| 110 | worker sees its own progress and never a parent's or sibling's. The parent's |
| 111 | list reaches a forked child only as the immutable `<codewhale:fork_state>` |
| 112 | To-do section, resolved at the spawn seam so a same-turn `todo_write` is |
| 113 | included. |
| 114 | |
| 115 | The renderer bounds and frames the snapshot; it does not vet To-do content. It |
| 116 | guarantees that item text cannot close the wrapper early, cannot forge the line |
| 117 | format with control characters, and cannot exceed the item/character bounds — |
| 118 | not that arbitrary item text is safe to follow as instructions. |
| 119 | |
| 120 | `work_update`, `TodoWrite`, `todo`, `checklist_write` and `checklist_update` |
| 121 | are not registered; a live call to one gets the unknown-tool error. Saved |
| 122 | transcripts that contain them still render, because the display and policy |
| 123 | tables map the names without a handler. `checklist_add`, `checklist_list`, |
| 124 | `todo_add`, `todo_update` and `todo_list` were never registered. |
| 125 | |
| 126 | --- |
| 127 | |
| 128 | ## 2. The five lifecycle states |
| 129 | |
| 130 | Every native tool name occupies exactly one lifecycle state. |
| 131 | |
| 132 | | State | Meaning | Visible on first turn? | In discovery? | Executes if called? | When used | |
| 133 | |---|---|---|---|---|---| |
| 134 | | **active** | Canonical, in the first-turn catalog head | **Yes** | n/a (already active) | Yes | The tool a model should reach for by default | |
| 135 | | **deferred** | Registered + discoverable, hydrated on demand | No | **Yes** | Yes | Real, useful tools that don't earn a first-turn slot | |
| 136 | | **hidden-compatibility** | Registered + dispatchable, but removed from active **and** from search | No | **No** | **Yes — identical behavior, silent** | Old synonym kept only so old transcripts replay; no model should newly discover it | |
| 137 | | **deprecated** | Like hidden-compat, but execution **appends a replacement notice to result metadata** | No | **No** | **Yes — works, plus a "use X instead" notice** | A retired name we actively steer callers off of, still safe to replay | |
| 138 | | **removed** | Not registered at all | No | No | **No — hard error** | Only after `planned_removal_version`, once replay support is formally dropped | |
| 139 | |
| 140 | ### hidden-compatibility vs deprecated — be precise |
| 141 | |
| 142 | Both states are **invisible** (not active, not in tool search) and both remain |
| 143 | **dispatchable** (calling them still works). The *only* difference is the |
| 144 | caller-facing signal: |
| 145 | |
| 146 | - **hidden-compatibility:** completely silent. The tool behaves byte-for-byte |
| 147 | like its canonical twin. We use this when there is *no behavioral or naming |
| 148 | lesson to teach* — the name was a pure alias and we simply don't want models |
| 149 | re-learning it. (Example: `exec_wait` is literally `exec_shell_wait`.) |
| 150 | - **deprecated:** behaves identically *and succeeds*, but the tool result's |
| 151 | **metadata** carries an appended notice like |
| 152 | `"deprecated: use <replacement> instead"`. The notice goes **only in the |
| 153 | result metadata returned for that call** — never in the cached tool catalog |
| 154 | prefix (see Section 8). We use this when there is a canonical replacement we |
| 155 | want the caller (and any human reading the transcript) nudged toward. |
| 156 | |
| 157 | Neither state ever changes the *behavior* of the call. Replay always works. |
| 158 | |
| 159 | --- |
| 160 | |
| 161 | ## 3. Representation in code |
| 162 | |
| 163 | The lifecycle is represented as **const name-sets plus an alias/manifest table** |
| 164 | in `crates/engine/src/core/engine/tool_catalog.rs`, alongside the existing |
| 165 | `DEFAULT_ACTIVE_NATIVE_TOOLS` (`tool_catalog.rs:37-64`) and |
| 166 | `ARCEE_FIRST_TURN_NATIVE_TOOLS` (`tool_catalog.rs:106-115`). |
| 167 | |
| 168 | ### 3a. Name-sets and the manifest (sketch) |
| 169 | |
| 170 | ```rust |
| 171 | // crates/engine/src/core/engine/tool_catalog.rs (planned) |
| 172 | |
| 173 | /// Tools removed from the active set AND from tool-search, but still |
| 174 | /// registered and dispatchable with byte-identical behavior. Silent. |
| 175 | pub(super) const HIDDEN_COMPATIBILITY_TOOLS: &[&str] = &[ |
| 176 | "exec_wait", // == exec_shell_wait (ShellWaitTool) |
| 177 | "exec_interact", // == exec_shell_interact (ShellInteractTool) |
| 178 | "tts", // == speech (SpeechTool) |
| 179 | "work_update", // == todo_write (TodoWriteTool) |
| 180 | "TodoWrite", // == todo_write (TodoWriteTool) |
| 181 | "todo", // == todo_write (TodoWriteTool) |
| 182 | "checklist_write", // == todo_write (TodoWriteTool) |
| 183 | "checklist_update", // == todo_write (TodoWriteTool) |
| 184 | ]; |
| 185 | |
| 186 | /// Deprecated aliases: invisible + dispatchable, with a replacement notice |
| 187 | /// appended to RESULT METADATA only (never the cached prefix). |
| 188 | pub(super) struct DeprecatedAlias { |
| 189 | pub name: &'static str, |
| 190 | pub replacement: &'static str, |
| 191 | pub note: &'static str, |
| 192 | } |
| 193 | |
| 194 | pub(super) const DEPRECATED_ALIASES: &[DeprecatedAlias] = &[ |
| 195 | // Empty in the #4132 work-surface cutover: the legacy names above are |
| 196 | // silent hidden-compatibility aliases of todo_write for transcript replay. |
| 197 | ]; |
| 198 | |
| 199 | #[inline] |
| 200 | pub(super) fn is_hidden_or_deprecated(name: &str) -> bool { |
| 201 | HIDDEN_COMPATIBILITY_TOOLS.contains(&name) |
| 202 | || DEPRECATED_ALIASES.iter().any(|d| d.name == name) |
| 203 | } |
| 204 | ``` |
| 205 | |
| 206 | ### 3b. The two filter points |
| 207 | |
| 208 | 1. **Catalog / tool-search exclusion (tool_catalog.rs).** |
| 209 | Deferral is decided by `should_default_defer_tool` (`tool_catalog.rs:66-82`), |
| 210 | and the active set is the head built by `build_model_tool_catalog` |
| 211 | (`tool_catalog.rs:178-196`). Hidden-compat and deprecated tools must be |
| 212 | forced *out of the active head* and *out of the tool-search-discoverable |
| 213 | pool*. Concretely, the deferral predicate gains a short-circuit so these |
| 214 | names are never active, and the tool-search index builder skips any name for |
| 215 | which `is_hidden_or_deprecated(name)` is true. Arcee's narrowed first-turn |
| 216 | path (`apply_provider_tool_policy`, `tool_catalog.rs:134-149`) already |
| 217 | excludes them by construction since they aren't in |
| 218 | `ARCEE_FIRST_TURN_NATIVE_TOOLS`. |
| 219 | |
| 220 | 2. **Result-notice append (tool_routing.rs).** |
| 221 | Dispatch already routes by tool name in |
| 222 | `crates/tui/src/tui/tool_routing.rs` (e.g. the wait/interact unification at |
| 223 | `tool_routing.rs:1139-1140`). After a successful dispatch, if the called name |
| 224 | is in `DEPRECATED_ALIASES`, the router appends the matching `note` to the |
| 225 | **result metadata only**. Hidden-compat names append nothing. |
| 226 | |
| 227 | ### 3c. Why name-sets, not a per-`ToolSpec` enum field |
| 228 | |
| 229 | A per-`ToolSpec` `lifecycle: Lifecycle` field was rejected for three reasons: |
| 230 | |
| 231 | - **Prefix-cache safety.** The tool catalog array is part of DeepSeek's |
| 232 | immutable KV prefix (`tool_catalog.rs:169-177`). A per-spec field invites |
| 233 | serializing lifecycle state *into* each tool's schema, which is exactly the |
| 234 | kind of head mutation that forces a full re-prefill. Name-sets live entirely |
| 235 | in the catalog-build logic and never touch the emitted tool JSON. |
| 236 | - **Single source of truth + diffability.** The diet for a release is one small, |
| 237 | reviewable edit to two or three const arrays in one file, instead of scattered |
| 238 | field flips across many tool modules. |
| 239 | - **Registration stays orthogonal.** Tools remain registered exactly as today |
| 240 | (e.g. `with_shell_tools`, `registry.rs:523-531`). Lifecycle is a *catalog |
| 241 | policy* layered on top of registration, not a property baked into the tool. |
| 242 | |
| 243 | --- |
| 244 | |
| 245 | ## 4. Deprecation manifest (the #2681 acceptance-criteria table) |
| 246 | |
| 247 | This was the proposed manifest. Columns are the #2681 AC columns. No entry was |
| 248 | "removed" in 0.8.53; replay was to be supported for everything listed. |
| 249 | |
| 250 | > **Superseded.** None of these aliases is registered. `exec_wait` and |
| 251 | > `exec_interact` were removed first |
| 252 | > (`shell_surface_exposes_lowercase_bash_and_hides_legacy_handler` in |
| 253 | > `crates/engine/src/tools/registry/tests.rs`). `tts`, `checklist_write`, |
| 254 | > `checklist_update` and the `work_update`/`TodoWrite`/`todo` spellings of |
| 255 | > `todo_write` were deleted later; `checklist_add`, `checklist_list`, |
| 256 | > `todo_add`, `todo_update` and `todo_list` were never registered |
| 257 | > (`model_catalog_exposes_todo_write_as_sole_progress_surface`). The |
| 258 | > `replay_supported` column records the original proposal; it is false for |
| 259 | > every row today. |
| 260 | |
| 261 | | Alias | Replacement (canonical) | Lifecycle state | first_deprecated_version | planned_removal_version | replay_supported | |
| 262 | |---|---|---|---|---|---| |
| 263 | | `exec_wait` | `exec_shell_wait` | hidden-compatibility | 0.8.53 | TBD (≥ 0.9.x) | Yes | |
| 264 | | `exec_interact` | `exec_shell_interact` | hidden-compatibility | 0.8.53 | TBD (≥ 0.9.x) | Yes | |
| 265 | | `tts` | `speech` | hidden-compatibility | 0.8.53 | TBD (≥ 0.9.x) | Yes | |
| 266 | | `checklist_write` | `todo_write` | hidden-compatibility | 0.9.0 | TBD (≥ 0.9.x) | Yes | |
| 267 | | `checklist_add` | `todo_write` | hidden-compatibility | 0.9.0 | TBD (≥ 0.9.x) | Yes | |
| 268 | | `checklist_update` | `todo_write` | hidden-compatibility | 0.9.0 | TBD (≥ 0.9.x) | Yes | |
| 269 | | `checklist_list` | `todo_write` | hidden-compatibility | 0.9.0 | TBD (≥ 0.9.x) | Yes | |
| 270 | | `todo_write` | `todo_write` | hidden-compatibility | 0.8.53 | TBD (≥ 0.9.x) | Yes | |
| 271 | | `todo_add` | `todo_write` | hidden-compatibility | 0.8.53 | TBD (≥ 0.9.x) | Yes | |
| 272 | | `todo_update` | `todo_write` | hidden-compatibility | 0.8.53 | TBD (≥ 0.9.x) | Yes | |
| 273 | | `todo_list` | `todo_write` | hidden-compatibility | 0.8.53 | TBD (≥ 0.9.x) | Yes | |
| 274 | |
| 275 | The `todo_*` aliases first entered hidden compatibility in v0.8.53. v0.9.0 |
| 276 | changes their canonical replacement to `todo_write`; it does not reset their |
| 277 | first-deprecated version. |
| 278 | |
| 279 | **Legacy subagent names — removed, no manifest entry needed.** |
| 280 | The model-visible subagent surface is only `agent`. The old lifecycle names and |
| 281 | the experimental tool-agent lane were removed rather than kept as hidden |
| 282 | compatibility tools. |
| 283 | |
| 284 | `planned_removal_version` is intentionally `TBD`: a name only moves to **removed** |
| 285 | once we formally drop replay for transcripts old enough to contain it, which is a |
| 286 | separate, deliberate decision per name. |
| 287 | |
| 288 | --- |
| 289 | |
| 290 | ## 5. Active-catalog budget (per mode, per provider) |
| 291 | |
| 292 | The active set is the first-turn cost. Do not duplicate the exact |
| 293 | `DEFAULT_ACTIVE_NATIVE_TOOLS` count here: adjacent PRs in the v0.8.53 batch may |
| 294 | add or remove active tools, and the source of truth is always |
| 295 | `tool_catalog.rs`. This document defines the diet policy and invariants, not a |
| 296 | second catalog snapshot. |
| 297 | |
| 298 | ### Per provider |
| 299 | |
| 300 | | Provider | First-turn active source | Budget policy | |
| 301 | |---|---|---| |
| 302 | | Default (DeepSeek et al.) | `DEFAULT_ACTIVE_NATIVE_TOOLS` | Remove duplicate aliases from the active head when their canonical twins stay active; any net growth needs an explicit budget decision. | |
| 303 | | Arcee (Trinity) | `ARCEE_FIRST_TURN_NATIVE_TOOLS` | Provider-specific read-only WAF workaround; unchanged by the default diet unless explicitly reviewed. | |
| 304 | |
| 305 | The default diet removes `exec_wait` and `exec_interact` from the active head |
| 306 | (they become hidden-compat; their canonical twins `exec_shell_wait` / |
| 307 | `exec_shell_interact` stay). `tts` and the legacy `todo_*` aliases remain out |
| 308 | of the active set. The canonical `todo_write` tool became eager in v0.9.6 as an |
| 309 | explicit budget decision so ordinary progress tracking never requires a |
| 310 | discovery turn. |
| 311 | |
| 312 | ### Per mode (Plan / Agent / YOLO) |
| 313 | |
| 314 | The native active head is the **same set across modes** by design — mode does not |
| 315 | add or remove native tools from `DEFAULT_ACTIVE_NATIVE_TOOLS` |
| 316 | (`should_default_defer_tool` ignores `_mode` for native tools, |
| 317 | `tool_catalog.rs:66-68`). Mode affects **MCP** deferral instead: |
| 318 | `apply_mcp_tool_deferral` keeps MCP tools deferred unless `mode == Yolo` |
| 319 | (`tool_catalog.rs:162-167`). |
| 320 | |
| 321 | | Mode | Native active budget | MCP tools active? | |
| 322 | |---|---|---| |
| 323 | | Plan | same native head | No (deferred) | |
| 324 | | Agent | same native head | No (deferred) | |
| 325 | | YOLO | same native head | Yes (a known, intentional widening) | |
| 326 | |
| 327 | **Budget rule:** the native active head must stay byte-identical across Plan ↔ |
| 328 | Agent ↔ YOLO (Section 8). Any growth of the head requires retiring something |
| 329 | else or an explicit budget bump in this doc. |
| 330 | |
| 331 | --- |
| 332 | |
| 333 | ## 6. The canonical-surface rule |
| 334 | |
| 335 | > **Every model-visible (active or deferred-discoverable) tool must have one |
| 336 | > clear niche. If a tool is superseded, it gets a named replacement and moves to |
| 337 | > hidden-compatibility or deprecated — it does not stay visible.** |
| 338 | |
| 339 | ### Canonical vs compatibility summary for the confusing clusters |
| 340 | |
| 341 | | Cluster | Canonical (keep visible) | Compatibility / retired | Notes | |
| 342 | |---|---|---|---| |
| 343 | | **Shell wait** | `exec_shell_wait` | `exec_wait` → hidden-compat | Same `ShellWaitTool` (`registry.rs:526,529`); router already unifies (`tool_routing.rs:1139`) | |
| 344 | | **Shell interact** | `exec_shell_interact` | `exec_interact` → hidden-compat | Same `ShellInteractTool` (`registry.rs:527,530`) | |
| 345 | | **Work progress / checklist / todo** | `todo_write` | not registered: `work_update`, `TodoWrite`, `todo`, `checklist_*`, `todo_add`/`update`/`list` | Display and policy tables still map the old names | |
| 346 | | **Speech / tts** | `speech` | `tts` → not registered | | |
| 347 | | **Subagent lifecycle** | `agent` | old lifecycle names and tool-agent lane removed | Single async launcher. (The "child agents are leaf workers" note here did not ship — see §7.) | |
| 348 | | **Edit family** | `apply_patch`, `edit_file`, `write_file`, `fim_edit` | none — **all distinct niches** | NOT touched (per #2681 non-goals); doc-only canonical guidance | |
| 349 | | **Search family** | `grep_files` (content), `file_search` (filename), `project_map` (structure) | none — **distinct niches** | NOT touched; no FTS5/BM25/semantic index exists today | |
| 350 | |
| 351 | **Non-goals (explicitly NOT diet targets in this cycle, per #2681):** |
| 352 | `apply_patch` / `edit_file` / `write_file` / `fim_edit`; |
| 353 | `grep_files` / `file_search` / `project_map`; |
| 354 | `fetch_url` / `web.run` / `web_search`; |
| 355 | `task_shell_*`; `handle_read` / `retrieve_tool_result`. These have distinct |
| 356 | niches and receive **canonical guidance only** — no lifecycle change. |
| 357 | |
| 358 | The RLM surface (`rlm_open` / `rlm_eval` / `rlm_configure` / `rlm_close` / |
| 359 | `rlm_session_objects`, `crates/engine/src/tools/rlm.rs`) is likewise out of scope; |
| 360 | `handle_read` retrieves var handles, and `finalize` / `FINAL` is an in-kernel |
| 361 | Python function, **not a tool** — so there is nothing to retire there. |
| 362 | |
| 363 | --- |
| 364 | |
| 365 | ## 7. Subagent cutover decision: one visible launcher |
| 366 | |
| 367 | The old lifecycle trio and tool-agent lane are removed, not hidden compatibility |
| 368 | tools. |
| 369 | |
| 370 | **Decision: expose only `agent`.** |
| 371 | |
| 372 | - `agent` starts one focused background child and returns the agent id plus |
| 373 | transcript handle. |
| 374 | - Child results arrive as completion events. The parent should keep working |
| 375 | instead of polling a lifecycle tool. |
| 376 | - Child tool catalogs exclude the removed subagent *lifecycle* tools. |
| 377 | (**Not as shipped:** this bullet originally continued "so children are leaf |
| 378 | workers and cannot recursively summon more agents." That is not what landed. |
| 379 | Children receive `agent` and can recurse to the configured depth — see |
| 380 | `with_full_agent_surface_options` and `can_spawn_child` in |
| 381 | `tools/subagent/mod.rs`, and [`SUBAGENTS.md`](SUBAGENTS.md).) |
| 382 | - Detailed inspection goes through `handle_read` on the returned transcript |
| 383 | handle. |
| 384 | |
| 385 | This is a lifecycle simplification, not a provider gate. |
| 386 | |
| 387 | --- |
| 388 | |
| 389 | ## 8. Prefix-cache safety + replay guarantee |
| 390 | |
| 391 | ### Prefix-cache rules every diet PR MUST follow |
| 392 | |
| 393 | The tools array is part of DeepSeek's immutable KV prefix. The catalog-head |
| 394 | byte-stability invariant (`tool_catalog.rs:169-196`) is binding: |
| 395 | |
| 396 | 1. **Never mutate the active head non-deterministically.** The first-turn active |
| 397 | block must be **byte-identical run-to-run** and across Plan ↔ Agent ↔ YOLO. |
| 398 | 2. **A diet is a one-time deterministic edit.** Removing a name from |
| 399 | `DEFAULT_ACTIVE_NATIVE_TOOLS` shifts the head exactly once; after that it must |
| 400 | be stable. Land such edits as their own focused change. |
| 401 | 3. **Notices live in result metadata, never the prefix.** Deprecated replacement |
| 402 | notes are appended at dispatch time in `tool_routing.rs` to the *call result* |
| 403 | only. **Nothing** about hidden/deprecated state may be serialized into a tool |
| 404 | schema, description, or the catalog array. |
| 405 | 4. **Preserve ordering and partitioning.** `build_model_tool_catalog` sorts each |
| 406 | partition by name and keeps built-ins as a contiguous prefix ahead of MCP |
| 407 | tools (`tool_catalog.rs:186-194`). Diet edits must not break this. |
| 408 | 5. **Hidden/deprecated tools are excluded *before* the head is built**, so their |
| 409 | removal is the only head change — they do not appear in the prefix at all. |
| 410 | |
| 411 | ### Old-transcript replay guarantee (not adopted) |
| 412 | |
| 413 | The blanket guarantee below was proposed, not shipped. Nothing re-executes a |
| 414 | saved tool call: resume only repairs history. `exec_wait`, `exec_interact`, |
| 415 | `tts` and the `work_update`/`TodoWrite`/`todo`/`checklist_*`/`todo_*` names |
| 416 | are not registered and fail as unknown tools when a live model calls them. |
| 417 | `apply_patch` is a separate replay-only edit alias; see |
| 418 | [`TOOL_SURFACE.md`](TOOL_SURFACE.md). |
| 419 | |
| 420 | > For every name in the deprecation manifest with `replay_supported = Yes`, the |
| 421 | > tool stays **registered and dispatchable with identical behavior**. Replaying |
| 422 | > an old transcript that calls `exec_wait`, `exec_interact`, `tts`, or any |
| 423 | > `todo_*` produces the same result it always did. Deprecated names additionally |
| 424 | > attach a result-metadata notice; hidden-compat names are silent. A name is only |
| 425 | > ever made non-dispatchable (**removed**) after a deliberate, per-name decision |
| 426 | > to drop replay support at `planned_removal_version`. |
| 427 | |
| 428 | --- |
| 429 | |
| 430 | ## 9. Required tests |
| 431 | |
| 432 | Any diet PR (and the umbrella #2681 work) must add/keep: |
| 433 | |
| 434 | 1. **Duplicate-active-alias guard.** A test asserting that no name in |
| 435 | `HIDDEN_COMPATIBILITY_TOOLS` or `DEPRECATED_ALIASES` appears in |
| 436 | `DEFAULT_ACTIVE_NATIVE_TOOLS` or `ARCEE_FIRST_TURN_NATIVE_TOOLS`, and that no |
| 437 | two active entries resolve to the same underlying tool implementation. |
| 438 | |
| 439 | 2. **Tool-search exclusion test.** Assert that hidden-compat and deprecated names |
| 440 | are absent from the tool-search-discoverable pool while remaining present in |
| 441 | the registry (dispatchable). |
| 442 | |
| 443 | 3. **Replay / dispatch tests.** For each manifest name, calling it still |
| 444 | executes and returns the same result as its canonical twin. Deprecated names |
| 445 | additionally assert the replacement note is present **in result metadata** and |
| 446 | absent from the catalog/prefix. Hidden-compat names assert **no** added |
| 447 | notice. |
| 448 | |
| 449 | 4. **Golden active-block byte test.** A snapshot test pinning the byte |
| 450 | serialization of the first-turn active tool block, asserting it is identical |
| 451 | across Plan / Agent / YOLO (native head) and stable run-to-run — enforcing the |
| 452 | `tool_catalog.rs:169-196` invariant. The golden updates **only** as a |
| 453 | reviewed, deliberate one-time edit when the diet lands. |
| 454 | |
| 455 | 5. **Subagent guardrail test.** Assert only `agent` is registered as a |
| 456 | model-visible subagent tool and that hidden/legacy names from |
| 457 | `subagent/mod.rs` are not advertised. |
| 458 | |
| 459 | 6. **Leaf-worker test.** Assert subagent tool catalogs exclude `agent` and |
| 460 | retired legacy lifecycle names. |
| 461 |