Skip to content

design(atlas): embedding cost ledger — per-batch token/$ accounting with a delta reuse-ratio alert #6058

Open

Description

@dezren39

Parent: #6019 (semi-automated ingestion operations). Research source: prior-art doc ~/workspace/scratch/atlas-ingestion-brief-2026-11-04/prior-art-research.md (2026-11-04). Follow-up 40 (Cluster 7).

Finding (research, in substance)

Published prices (verified Sept–Oct 2026 by comparison sources): OpenAI text-embedding-3-small $0.02/1M tokens ($0.01 batch), 3-large $0.13/1M; self-hosted BGE-M3 ≈ $0.001/1M at high GPU utilization. Corpus scale: ~107,639 chunks ≈ 27–54M tokens → a full re-embed is only $0.27–$7.00 depending on route. So the cost risk is not the corpus — it's churn: re-embedding the unchanged 95% on every version of every log, forever, plus 5–20× corpus growth from comments/docs expansion. Against the standing plan cap (Turso scaler $24.92/mo), embedding spend is a rounding error if deltas work; storage and DB-count quotas bind first. (https://embeddingcost.com/compare)

Scope — the ledger

Per batch, log: (chunks_new, chunks_reused, tokens_embedded, model, $). The headline metric is the delta reuse ratio: if reuse is <90% on an append-mostly source, the delta protocol is broken — not the budget — and the ledger says so as an alert, not a line item. The ledger complements #6019's plan-headroom accounting (Turso storage/writes) with the embedding side, per source class.

Done looks like

A ledger schema + per-source reuse-ratio baselines + the alert rule.

Activity

  1. added
    area/infraInfrastructure, deployment, and operations
    kind/designA design proposal (design-architect): multi-step, phased, decision-bearing
    on Nov 5, 2026
  2. developing-today commented on Nov 5, 2026

    @developing-today
    Contributor
  3. added
    queue/queuedHas a queued task in the Supabase agent queue
    task/triageQueue packet kind: verify, reproduce, and route this item
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 5, 2026
  4. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (triaged)

    Triage findings (task 10424, 2026-11-05)

    Still live, not already handled. Issue #6058 is OPEN (fresh gh check this run) with no hard-stop labels. Code search against current main finds no ledger implementation: reuse_ratio, chunks_reused, and embedding_cost all return zero hits in developing-today/code; the only "cost ledger" hits are unrelated spend-rollup docs. Nothing to close or dedupe — the sibling search shows no other issue covering a per-batch embedding ledger (nearest neighbours are issue #6061 storage growth model and issue #6069 Modal credits for embedding batch work, both OPEN and distinct).

    Dependencies and ordering (recorded per the packet acceptance criteria):

    Scoped next step (when worked): a design pass producing (1) the ledger schema (batch_id, source_class, chunks_new, chunks_reused, tokens_embedded, model, usd), (2) the reuse-ratio alert rule above, (3) per-source-class baseline slots to be filled from the first real batches. No decision from Drew is needed for that pass; implementation waits on issue #6028's batch semantics.

  5. added
    status/triagedTriaged and routed (see agent note)
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/infraInfrastructure, deployment, and operationskind/designA design proposal (design-architect): multi-step, phased, decision-bearingstatus/triagedTriaged and routed (see agent note)task/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions