docs/TOOL_SURFACE.md carried four claims the runtime's own tests contradict:
1. "The default-active policy contains exactly these ten names" listing
`update_plan`. `DEFAULT_ACTIVE_NATIVE_TOOLS`
(crates/tui/src/core/engine/tool_catalog.rs:44-58) has eight entries and
`update_plan` is not among them — it appears nowhere in tool_catalog.rs. The
policy is nine (those eight plus synthetic `tool_search`), eight with memory
disabled. `update_plan` is registered (crates/tui/src/tools/plan.rs:401) but
reachable only through `tool_search`; the tool table now says so.
2. "A memory-disabled or Moraine-fallback runtime". There is no Moraine
fallback — docs/MEMORY.md:11-13 records the removal, and
crates/tui/src/prompts.rs:2445-2449 is a test asserting MEMORY_GUIDANCE must
not contain the word.
3. A "Replay-only aliases" table promising "saved transcripts, sessions, and
recorded automation replay without migration" for 23 names, 16 of which are
asserted REMOVED at crates/tui/src/tools/registry.rs:2066-2088 ("{retired}
must stay removed") and 6 more at :2290-2304 ("{alias} must be removed").
Split into a "Removed spellings" section (with the registry.rs:313-316 note
that resolve has no fuzzy step, so those calls fail rather than dispatch) and
a "Replay-only aliases" section holding only what is still registered:
apply_patch, task_*, github_*, automation_*, rlm_*, checklist_*/todo_*.
4. A "Release verification" block whose three cargo filters name tests that do
not exist (`rg` finds those three strings only in that doc). `cargo test`
exits 0 with "0 passed; N filtered out" on a filter that matches nothing, so
a release engineer following it got three green checkmarks having verified
nothing. Replaced with the real names —
`shell_surface_contains_only_the_canonical_bash_tool` (registry.rs:2290) and
`runtime_task_families_expose_only_canonical_tools` (registry.rs:2333) — plus
the receipt test, and a warning about the silent-pass failure mode.
docs/RUNTIME_SIMPLIFICATION_DESIGN.md repeats errors 1 and 3 and is designated
authoritative by docs/TOOL_LIFECYCLE.md:3-7, but carries no status marker. Given
a status banner naming both divergences and pointing at TOOL_SURFACE.md; the
"Rejected alternatives" provenance is worth keeping, so not deleted.
docs/SUBAGENTS.md:
- "a bounded queue of up to 200 running plus queued sub-agents by default" —
`MAX_SUBAGENT_ADMISSION` is 1024 (crates/tui/src/config/subagent_limits.rs:21),
which is what docs/TOOL_SURFACE.md:182 already said. The 64/128 concurrency
figures on the same page were correct and are untouched.
- The memory section described a `memory.md` that does not exist and omitted the
`scope` parameter. crates/tui/src/tools/remember.rs:165 states the legacy
single-file path was removed in v0.9.4; writes go through
`NativeMemoryStore::remember(scope, workspace_id, note)` (remember.rs:77-108).
config.example.toml documented two key sets that do not exist. Neither struct has
`deny_unknown_fields`, so both were silently discarded rather than rejected:
- `[advisor] max_tool_pairs` / `system_prompt`. `AdvisorConfigToml`
(crates/config/src/lib.rs:2369-2394) has enabled, max_tool_calls (default 10,
clamped 1-50 — the doc said 8, max 32), rate_limit_secs, dedup_window_secs,
and model. `model` was undocumented; now it is.
- `[fleet.profiles.*.permissions] allow_tools` / `deny_tools`.
`FleetProfilePermissions` (lib.rs:1966-1977) has allow_shell, trust,
approval_required. `rg 'allow_tools|deny_tools' crates/` finds nothing. The
example value was `"exec_shell"`, itself a removed tool name.
docs/CONFIGURATION.md: deleted the "Parsed but currently unused" section. Its one
entry, `tools_file`, is not parsed by anything — the field was removed in
346bfe3b6 and the doc bullet was orphaned. Repo-wide `rg` finds the string only
in that section, and nothing links a #parsed-but-currently-unused anchor.
docs/TTC_DESIGN.md said implementation "is deferred beyond v0.9.0". The `verify`
tool shipped and is default-on (crates/tui/src/tools/verify.rs,
features.rs:262, registry.rs:1040-1041 with verify_tool_enabled defaulted true).
Retitled as landed-in-part; capability (B) is still genuinely deferred, so the
doc stays. Its interface line said `with_verify(critic)`; the real signature is
`with_verify_tool(client, model)` (registry.rs:886).
docs/skills/README.md advertised `gh-plan-issues`, deleted in 18de2ebc0, and
credited these skills to "the v0.8.61 release" at a 0.9.4 release.
docs/architecture/provider-model-settings-v091.md pinned
`provider_is_configured` to config.rs:8625-8669; it is at :10160 and that region
is now unrelated code. Replaced with the symbol name, since config.rs is under
active edit.
docs/architecture/command-dispatch.md:133 claimed EPIC-002 was "ready for PR".
The PR (#3706) merged and #2870 closed 2026-08-01. Line 145 was an empty
"Current Evidence (Draft)" heading with no content; removed.
.gitignore: `git check-ignore -v` attributes .claude/settings.json,
scheduled_tasks.lock, worktrees/, and *.local.* to the blanket `.claude/` at
line 126, not to the specific rules above them. Dropped the redundant ones and
annotated why the HANDOFF_/CODEMAP_ patterns are deliberately kept.
5.8 KiB
Codewhale Runtime Simplification Design
Status: Pre-implementation design record for the v0.9.1 cutover, kept for its "Rejected alternatives" provenance. It is not current runtime documentation and it shipped differently in two ways:
- Goal 3 below ("keeping every legacy tool name registered but hidden") was
reversed. The per-action file/git/run/web and
exec_shell*names were removed, not hidden —crates/tui/src/tools/registry.rs:2066-2088and:2290-2304assert they must stay unregistered. Onlyapply_patchand thetask_*/github_*/automation_*/rlm_*/checklist_*families survive as hidden aliases. - The default-active policy is nine names, not ten.
update_planandWebare not inDEFAULT_ACTIVE_NATIVE_TOOLS(crates/tui/src/core/engine/tool_catalog.rs:44-58).
For the current contract see TOOL_SURFACE.md.
Goal
Make the model-facing runtime smaller, calmer, and easier for models to use by:
- Collapsing the long tail of single-purpose file, git, run, and web tools into a few canonical action-based tools.
- Shrinking the system prompt to durable behavioral invariants and per-turn permission deltas.
- Keeping every legacy tool name registered but hidden so old transcripts, saved sessions, and recorded automation replay without migration.
Target model-facing surface (default active)
| Tool | Actions / Niche |
|---|---|
Bash |
run, wait, interact, cancel (existing) |
File |
read, list, search_name, search_content, write, edit, patch |
Git |
status, diff, log, show, blame |
Run |
tests, verifiers |
Web |
search, fetch, wait (deferred unless network is enabled; hidden aliases for legacy names) |
tasks |
durable task family (existing action-based surface) |
github |
durable GitHub family (existing; deferred by default) |
automation |
durable automation family (existing; deferred by default) |
rlm |
durable RLM family (existing; deferred by default) |
agent |
sub-agent dispatch |
remember |
opt-in durable user-memory capture; eager whenever registered |
work_update |
progress / plan-of-work updates |
update_plan |
plan artifact updates |
tool_search |
on-demand discovery of deferred tools |
Default-active policy: 10 names (vs. ~18 before the simplification), with
remember registered only for built-in-memory users and the durable families
and Web discoverable via tool_search when needed. tool_search itself is a
synthetic always-active catalog entry.
Rejected alternatives
- Keep every tool but defer the rare ones. This only changes what is advertised, not how many distinct schemas the model must learn. It also leaves duplicated guidance in the prompt.
- Route search and git through
Bash.grep_files,file_search, and the git tools return structured, workspace-aware output and respect sandbox,.gitignore, and network policy. Shell would force the model to re-parse free-form text and lose those guarantees, so dedicated tools win. - One mega
Filetool plus a separateEdittool. A singleFiletool is only slightly larger than a read/edit pair and keeps the boundary the model already understands (readis cheap,editrequires prior read). Splitting would re-introduce a two-tool alias for the same underlying operations. - Delete legacy tools. Saved transcripts and replay tests rely on the old names. Removing them would require a config migration and break reproducibility. Hidden aliases avoid both.
Compatibility
- Legacy names (
read_file,write_file,edit_file,list_dir,file_search,grep_files,apply_patch,git_status,git_diff,git_log,git_show,git_blame,run_tests,run_verifiers,web_search,fetch_url,wait_for_dev_server) stay registered withmodel_visible = false. - The engine resolves calls by name, so old transcripts replay without changes.
DEFAULT_ACTIVE_NATIVE_TOOLSis updated to list the new canonical names only; hidden legacy tools are ignored by catalog construction.
Prompt simplification
- Replace the tool-calling recipe sections in
AGENT_MODEandSUBAGENT_OUTPUT_FORMATwith short references to the canonical tools. - Reduce mode deltas to permission statements (Act = write requires approval, Plan = no writes or shell, Full Access = auto-approved, Operate = coordinate from ordinary messages).
- Keep the
BASE_PROMPTbehavioral invariants,LANGUAGE_PROMPT, andOUTPUT_PROMPTintact. - Move detailed templates (
COMPACT_TEMPLATE, sub-agent brief format, planning artifact template) out of the stable prefix and into tool schemas or conditional blocks.
Validation
- Provider-free:
scripts/measure-runtime-contract.pyreports active tool count and prompt bytes before and after. - Behavior-preserving: targeted unit tests for
File,Git,Run, andWebdispatch against legacy inputs. - Regression:
cargo fmt,cargo clippy --workspace --all-targets --locked,cargo test -p codewhale-tui --bin codewhale-tui --locked, andcargo test --workspace.
v0.9.1 receipt
The source contract and provider-free metric now exercise the complete policy,
including opt-in remember:
| Contract | Before | After |
|---|---|---|
| Default active tools | 18 | 10 |
| Agent-mode instruction bytes | 4,064 | 663 |
| Full system-prompt bytes | 15,842 | 15,368 |
The final active names are Bash, File, Git, Run, agent, remember,
tasks, update_plan, work_update, and tool_search. remember is present
only when built-in memory is enabled; it is eager whenever registered. File
advertises only read actions in Plan mode, and its patch action appears only
when the existing apply-patch feature is enabled. Hidden aliases remain
executable for transcript replay but are absent from the model catalog.