Skip to content

optimize: low-worth sessions with zero edits claim the full session as recoverable savings #640

Closed

Description

@avs-io

Problem

estimateLowWorthRecoverableTokens returns the entire session token total when editTurns === 0 (src/optimize.ts:1971). That per-session number feeds tokensSaved, the headline "Potential savings: X tokens ($Y, ~Z% of spend)" (src/optimize.ts:2557-2563), and the JSON potentialSavingsCostUSD / per-finding estimatedSavingsUSD. The finding text hedges (review candidate, not proof of waste), but the number asserts the whole session cost is savable. An exploration-heavy user sees an upper bound presented as a point estimate, and it inflates the setup-health picture.

The retry path already does this right: it applies a bounded recovery fraction. Only the no-edit branch claims 100%.

Evidence

  • src/optimize.ts:1967-1978, specifically :1971 if (editTurns === 0) return tokens
  • Headline roll-up: src/optimize.ts:2557-2563; JSON: :2619-2650
  • Verified on main at 1a75484.

Proposed fix

Either apply a conservative recovery fraction to the no-edit case (mirroring the retry branch), or exclude low-worth candidates from the summed dollar headline entirely and present them as a review list without a claimed dollar figure. Realized-savings measurement (act report) makes honesty here cheap to keep.

Activity

  1. avs-io commented on Jul 16, 2026

    @avs-io
    CollaboratorAuthor

    Working on this. Approach: stop claiming 100% of a zero-edit session as recoverable; apply a bounded recovery fraction to the no-edit branch (mirroring the retry branch's approach), update the doc comment that framed full-session as intentional, and adjust the two tests that pin the old ceiling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions