Skip to content

[Feature] Cost/time estimator before a large semantic extraction run #3179

Description

@Ashfaqbs

Problem

Right now the only way to know what a semantic `extract` run will cost — in time or API spend — is to run it and watch. For a large corpus on a slow backend (e.g. `claude-cli`, where every call spawns a nested agent session) that can mean committing to a run that takes hours before finding out it was too big, too slow, or too expensive for the moment. #3142 (the timeout re-pay cascade, now fixed) made this worse in one specific way, but the general problem — no upfront cost signal — is separate from that bug.

Proposal

A `--estimate` (or standalone `graphify estimate`) mode that, without calling any backend, reports:

  • number of chunks the corpus will pack into (reusing `_pack_chunks_by_tokens` / the plain chunk_size path already in `extract.py`)
  • estimated total input/output tokens per chunk (rough, from file sizes — doesn't need to be exact)
  • estimated wall-clock time, scaled by backend (an HTTP backend vs. `claude-cli`'s per-call nested session should carry very different per-chunk time assumptions)
  • estimated dollar cost where a backend has known per-token pricing, clearly marked as approximate

This only needs read access to the corpus and the existing chunking logic — no new dependency, no network call.

Why this fits now

It's a natural complement to the semantic cache (`cache.py`) and the timeout-budget work in #3142 — all three are about making a large run's cost legible and boundable before/while it runs, instead of discovering it live.

Note

This is a proposal, not a commitment to implement — happy to discuss shape/scope here first, and would only pick up a PR if the direction is one you'd actually want to carry.

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