Repository navigation
feat(dash): remove-mcp-and-skills backend: one question, measured savings since removal - #537
Conversation
OsherElhadad
left a comment
There was a problem hiding this comment.
Review: REQUEST CHANGES at e655498. The head moved past 6c113bf. (Posted as a comment: GitHub does not let the author account request changes.)
Verified:
- Built-ins are never listed. Only
mcp_toolandskilldeclarations become items, so every built-in of any agent, Claude Code's and Codex's alike, is excluded by kind. If KindTool is let through, TestAdaptToolsNeverListsBuiltins fails. - The question, payback and new recommendation fields compute as described. No recommendation is made when the rewrite costs at least the window's saving.
gofmtandgo vetare clean, and the dash Adapt/Inventory/Tool/Decl/SelfRemoval tests pass. Both commits are signed off with no AI attribution, and the PR body has no figures. CI build-test was still running when I checked.
Blocking:
-
The total and the per-item rows are priced on different bases, and nothing says so.
saved_so_far.filter.usd(and thereforeto_date.saved_usd) isDeclFilterSavings. It pricesfiltered_decl_tokenswithaccumulateDeclFilterRow, which knows no 1-hour tier: any cache write is 1.25x. The per-item rows come fromcarriedCost(..., onlyFiltered=true), which prices a request that wrote 1h tokens at 2x input. On a 1h-tier account the items therefore sum to more than the total they sit under. There are two more reasons they can differ:- the two token counts come from different paths (the filter's own count vs
tool_declarations.tokens); - an item that was filtered earlier and is no longer on the removal list is in the total but has no row.
The test only covers cache-read rows, so it cannot see this. Fix: either price the 1h tier the same way in
accumulateDeclFilterRow(it needscache_write_1h) and add an explicit "removed earlier / unattributed" row equal to total minus the sum of items, or make the itemized sum the figure and keep the filter's count as a check. Then add a 1h-write case to TestAdaptToolsMeasuresWhatARemovalSaved. - the two token counts come from different paths (the filter's own count vs
-
An inferred credit is summed into a total labelled observed.
SelfRemovalsis an inference: an item stopped appearing, credited per session on the sessions that ran without it, and judged bysessions_after. Its own doc says it is "deliberately NOT netted into the declaration filter's realized savings".adaptToolsSavedaddsClient.USDintoTotalUSD, andto_datelabels that totalclass: "observed". Keepto_dateandsaved_usdto the filter part, which is observed, and report the client part separately as estimated, with itssessions_after. Alternatively, label the total as mixed and stop calling it measured.
Non-blocking:
- Question wording. "Remove 3 items (...), saving about $X a week?" states a hindsight figure as a promise. The weekly rate is what those items would have cost over this window. "would have saved about $X a week over the last N days" is honest without changing the number.
saved_per_week_usdandper_week_usddivide by calendar days in the window, not active days. That is fine, but say so in the field comment.
OsherElhadad
left a comment
There was a problem hiding this comment.
Re-review: APPROVE at 920dc43 (8f6b9f6 and 920dc43 on top of e655498). (Posted as a comment: GitHub does not let the author account approve.)
Both blockers are fixed.
- Total vs items.
accumulateDeclFilterRownow readscache_write_1hand prices a request that wrote any 1h tokens at 2x input, the same rule ascarriedCost. The filter total and the per-item rows are therefore on one basis.- Any remaining difference (items filtered earlier but no longer listed, or the two token counts disagreeing) is shown as its own "unattributed" row instead of being hidden.
- With the 1h branch disabled, or the unattributed row removed, TestAdaptToolsSavedItemsAndTotalAgree fails.
- This also changes
DeclFilterSavingswherever it is shown, which is more accurate on 1h accounts. The PR text could mention it in one line.
- The estimate is kept apart.
- Client-side removals are now priced per request and labelled
class: "estimated", with the Label "estimated (removed in the client)". They are excluded fromtotal_usdandto_date, and theirremovedrows carry the estimated class. - With
TotalUSD = Filter + Clientrestored, TestAdaptToolsEstimatesAClientSideRemovalPerRequest fails.
- Client-side removals are now priced per request and labelled
Also checked:
- Payback. The payback calculation is guarded (
days >= 1 && enoughUSD > 0). Without a payback the question falls back to "would have saved $X since ". - Question wording. It now reads as hindsight: "Over the last N days they would have saved about $X a week".
- Checks.
gofmtandgo vetare clean,go test ./dashpasses in full and the proxyAdapt|ToolFilter|Decltests pass. CI is green, both commits are signed off with no AI attribution, and the PR body has no figures.
Non-blocking:
- The cohort proxy, a later request that still carries any MCP tool or skill, assumes the removed item would still be carried there. That is reasonable, and it is labelled as an estimate.
SessionStartis the first request of the session within the report window, not the session's true start. A session that began beforeLastSeenbut whose first in-window request falls after it is counted. This is minor, and only affects the estimate.docs/plugin/adapt.mdis not in this branch's base, so check the new renderer fields (to_date,removed,items_n,per_week_usd,range_per_week_usd) against it when #526 lands.
This approval covers 920dc43.
d592326 to
4dcef47
Compare
…ed savings since removal The recommendation is one question with the set, the saving per week and to date, and the one-off cache rewrite. saved_so_far measures what removals already saved from the request rows: the filter's removals on exactly the requests it stripped them from (decl_digest plus filtered_decl_tokens), priced per request; client-side removals from the Inventory's self-removal credit. would_add_usd is what the recommended change adds. Built-in tools are never listed; pinned by a test. Signed-off-by: Osher-Elhadad <[email protected]>
…e window; renderer fields payback_weeks is the one-off cache rewrite in weeks of the recommended saving. The question says when it takes more than a week to pay back, and a payback longer than the history window recommends keeping as is. Adds to_date and removed (the measured savings in the shared adapt shape) and items_n, per_week_usd and range_per_week_usd on the recommendation. Signed-off-by: Osher-Elhadad <[email protected]>
…t apart They were priced with the Inventory's older per-session self-removal credit, which overstates. Now each detected removal is priced at its tokens on every request of the later sessions that still carried MCP tools or skills, at that request's model and tier, labelled "estimated (removed in the client)" and never added to the measured filter saving or to to_date. Signed-off-by: Osher-Elhadad <[email protected]>
… show the item gap DeclFilterSavings priced every cache write at 1.25x, while the per-item rows price a one-hour write at 2x input, so on a one-hour account the items summed past their total. Both now use the same rule, and any remaining difference between the filter's own count and the items is an "unattributed" row. The question now speaks in hindsight: what removing the items would have saved a week over the last N days. Signed-off-by: Osher-Elhadad <[email protected]>
Signed-off-by: Osher-Elhadad <[email protected]>
aaf87b6 to
be799a1
Compare
Backend for
/context-guru:remove-mcp-and-skills, which replacesadapt tools. The command and its rendering live in the plugin PR. Stacked on #531.What
recommendation.questionis the best option as a single question. Alongside it: the set it removes (remove), what it would have saved over the window (saved_to_date_usd) and per week (saved_per_week_usd), and the one-off cache rewrite it costs (rewrite_usd). The full option list is unchanged.saved_so_faris what removals already made have saved, measured from the request rows:decl_digest) and the tokens not forwarded (filtered_decl_tokens). Each removed item is priced on exactly the requests it was stripped from, at each request's model and tier. The total is the filter's own count.claude mcp removeorskillOverridescome from the Inventory's existing self-removal credit, and are counted once if the item is also filtered.docs/components/reformat.md.would_add_usd: what the recommended change adds on top, net of its one-off rewrite.carriedCostcan be restricted to filtered requests, or return each priced request (used for the client estimate).DeclFilterSavings, also shown on the Inventory tab) now prices a request that wrote one-hour cache tokens at 2x input instead of 1.25x. It changes only on accounts with one-hour writes.Tests