Repository navigation
Token-usage visibility and MCP tool-schema deferral - #438
Merged
Merged
Conversation
Adds an on-demand /context command breaking down token usage by category (system prompt, tool schemas, messages by role), an enabled_tools/disabled_tools allowlist for MCP servers, and automatic tool-search deferral: once MCP tool schemas exceed 10% of the active model's usable context window, deferred tools drop off the wire behind a search_tools meta-tool, restoring full visibility for any tool the model has already called. Claude-Session: https://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
Adds an on-demand /context command breaking down token usage by category (system prompt, tool schemas, messages by role), an enabled_tools/disabled_tools allowlist for MCP servers, and automatic tool-search deferral: once MCP tool schemas exceed 10% of the active model's usable context window, deferred tools drop off the wire behind a search_tools meta-tool, restoring full visibility for any tool the model has already called. Claude-Session: https://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
Adds an on-demand /context command breaking down token usage by category (system prompt, tool schemas, messages by role), an enabled_tools/disabled_tools allowlist for MCP servers, and automatic tool-search deferral: once MCP tool schemas exceed 10% of the active model's usable context window, deferred tools drop off the wire behind a search_tools meta-tool, restoring full visibility for any tool the model has already called. Claude-Session: https://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs
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.
Summary
/context(and/ctx) — an on-demand TUI report breaking token usage down by category (system prompt, tool schemas, user/assistant/tool messages, thinking), reusing the existing/statusoverlay machinery. The footer stays unchanged.enabled_tools/disabled_toolstoMcpServerConfig— an opt-in per-server allowlist so a bloated MCP server can be trimmed to the tools actually used, filtered before registration so unused schemas never reach the model.CompactionPolicy::tool_schema_budget), uncalled MCP tools drop off the model's tool list behind a newsearch_toolsmeta-tool. Any tool the model has already called stays fully declared (derived from the transcript's owntool_calls, not extra session state).Test plan
cargo fmt --allcleancargo clippy --workspace --all-targetscleancargo test --workspacegreen (full suite, exit 0)forge-context(tool_schema_budget),forge-core(/contextreport, deferral trigger/promotion),forge-mcp(ToolFilter,search_toolsmatching + registration),forge-config(TOML round-trip forenabled_tools/disabled_tools)https://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs