Repository navigation
Conversation
Record why mid-session tool activation rewrites prompt prefixes and compare five redesigns. Discussion only; no runtime change. Co-authored-by: tt-a1i <tt-a1i@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Mid-session OpenPI tool activation (
setActiveTools/toolsAddedafterbg_start, plus lifecycle andcontext_pivottoggles) changes the tool list at the front of the prompt. Providers that cannot anchor late tools reprocess the cached prefix. The reported Terminal-Bench overlap (about 59% cache hit versus about 90% for opencode) is treated as a discussion input, not a rerun.Value
Gives maintainers a single discussion record: why deferred declaration fights prompt caching, how Pi Code Mode and MCP already avoid that, and five redesigns with cache, first-turn cost, MCP fit, and migration risk. No runtime behavior changes.
Approach
Add
docs/design/tool-discovery-redesign.mdonly. It separates source facts from inferences, compares static declaration, eager group freeze, Pideferred/tool_search, Code Mode discovery, and a search-and-execute gateway, and recommends a direction for discussion rather than a decision. The design index is intentionally not updated.Validation
708a44b.bun run check,bun run test. No code changed.Impact