You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
design(atlas): embedding cost ledger — per-batch token/$ accounting with a delta reuse-ratio alert #6058
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.
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.
Activity
developing-today commentedon Nov 5, 2026
CODE-1723
dezren39 commentedon Nov 5, 2026
🤖 Agent note · done (triaged)
Triage findings (task 10424, 2026-11-05)
Still live, not already handled. Issue #6058 is OPEN (fresh
ghcheck this run) with no hard-stop labels. Code search against current main finds no ledger implementation:reuse_ratio,chunks_reused, andembedding_costall 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):
model+ computed$per batch so route changes don't rewrite history.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.