Skip to content

[Feature Request] Support dynamic/configurable prompt overhead in cost estimation for reasoning & large-system-prompt models #1538

Description

@chauvuusvn

Background & Current State

In internal/agent/estimate.go and internal/scan/estimate.go, the pre-run cost projection uses hard-coded estimation constants:

  • promptOverheadTokens = 2000
  • avgMainRoundsPerFile = 7
  • avgOutputTokensPerRound = 700

As stated in the code comments, these heuristics are meant to provide users with an order-of-magnitude projection before a large review run.

Motivation

With the growing adoption of reasoning-oriented models (such as GPT-5, o-series, and Claude with extended thinking capabilities) or custom setups with extensive custom rules and long system prompts, the fixed 2000 token overhead and 700 output token heuristic can substantially underestimate the pre-run cost projection for large diff change sets.

Proposed Improvement

Consider making the estimation heuristics slightly more adaptive or configurable:

  1. Model-aware defaults: Apply higher baseline overhead estimates when a reasoning/extended-context model is resolved.
  2. Template-derived scaffolding: Optionally derive the base overhead from the actual rendered template lengths rather than a static 2000 constant.
  3. User override in config: Allow power users to optionally configure estimation_overhead_tokens in config.yaml if they use heavily customized rule sets.

Code References

  • internal/agent/estimate.go:25-37
  • internal/scan/estimate.go

Activity

  1. chauvuusvn commented on Sep 22, 2026

    @chauvuusvn
    Author

    Closed by author.

  2. chauvuusvn commented on Sep 22, 2026

    @chauvuusvn
    Author

    Reopened for maintainers consideration.

  3. Qiyuanqiii commented on Sep 22, 2026

    @Qiyuanqiii
    Contributor

    Thank you for your feedback. I’m working on this issue.

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