context-budget-analysis
Prices retrieval in tokens, latency, and money — computes per-query context budget, models cost and latency at target and 10x scale, names which stage degrades first, and produces the honest curated-context baseline that any retrieval topology must beat.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-27
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- context-budget-analysis
- description
- Prices retrieval in tokens, latency, and money — computes per-query context budget, models cost and latency at target and 10x scale, names which stage degrades first, and produces the honest curated-context baseline that any retrieval topology must beat.
03 SKILL.md 正文
Context Budget Analysis
Purpose
Retrieval decisions are usually argued in quality terms and paid for in tokens, milliseconds, and dollars. This skill makes the payment explicit and produces the baseline every retrieval topology must actually beat: the curated context that needs no infrastructure.
When to use
When cost, latency, or context window is contested; when the critic raises scale; and whenever a retrieval topology is proposed for a corpus small enough that curation is plausible.
Step 1 — Enumerate the budget
Everything competing for the context window, counted:
| Consumer | Typical share | Notes |
|---|---|---|
| System instructions | Fixed | Grows quietly over a project's life |
| Tool or schema definitions | Fixed | Often the largest unnoticed consumer |
| Conversation history | Growing | Needs a truncation or summarization policy |
| Retrieved context | Variable | The part under design |
| Output reservation | Fixed | Must be held back, not discovered at generation time |
Compute what is actually left for retrieval. Teams routinely design a topology assuming a full window that the system prompt already consumed a third of.
Step 2 — Price the retrieved unit
- Tokens per chunk, measured on real corpus samples rather than assumed.
- Chunks per query (k after reranking, not the candidate k).
- Metadata, provenance, and separator overhead per chunk — usually underestimated by half.
- Total retrieved tokens per query, against the budget from Step 1.
If retrieved tokens exceed the remaining budget, the topology is already broken. Fix k, chunk size, or compression before proceeding.
Step 3 — Latency path
Walk the query path and attribute time to each hop:
- Query embedding
- Index search (dense)
- Index search (sparse), if present
- Graph traversal, if present — including depth-dependent fan-out
- Fusion
- Reranking
- Assembly
- Generation time-to-first-token
Report p50, p95, and p99. p50 flatters every retrieval system; p99 is where the graph traversal fan-out and the cold index shard show up.
Mark which hops are parallelizable and which are strictly sequential. Sequential hops set the floor.
Step 4 — Cost model
Per query: embedding, index query, rerank, and generation input tokens. Then multiply by realistic query volume — daily, monthly, peak.
Separately: index build and rebuild cost, storage cost at target corpus size, and full re-embed cost when the embedding model changes. That last one is the number nobody budgets for and everyone eventually pays.
Step 5 — Scale projection
At 10x corpus, name what happens to each of:
| Dimension | Scaling behavior | First threshold |
|---|---|---|
| Index size and memory | Usually linear | When it exceeds host memory |
| Query latency | Sub-linear for ANN, worse with filters | When p99 breaks the budget |
| Recall at fixed k | Degrades — more near-neighbors compete | When recall@k drops below the gate |
| Rerank cost | Linear in candidate k | When k must shrink, costing recall |
| Reindex window | Linear, often superlinear with compute limits | When it exceeds the maintenance window |
State the degradation order explicitly. Which stage breaks first, at what corpus size, and what the mitigation is. Deliver this before the critic asks — it is the single question they will always ask.
Step 6 — The curated-context baseline
Build the honest alternative. For the same problem, assume no retrieval:
- What is the total corpus in tokens, and does a curated subset fit the budget?
- What would that curated context cost to assemble once, and to maintain per change?
- What accuracy does it deliver on the golden set query classes?
- What does it cost per query — usually just input tokens, with zero infrastructure?
The baseline is not rhetorical. On bounded, stable corpora it frequently wins on accuracy, latency, cost, and operational burden simultaneously. Report it fairly; if it wins, say so.
Step 7 — Compression options, in order of preference
When the budget is tight, work these before adding infrastructure:
- Reduce k — cheapest, costs recall, measure it.
- Shrink chunks — costs context coherence.
- Extractive compression — cheap, lossy at boundaries.
- Abstractive summarization of retrieved chunks — adds a model call and a new failure mode.
- Hierarchical retrieval, summaries then detail — adds a round trip.
Each option trades a measurable quantity. Name the trade rather than asserting the option.
Output
A budget statement containing: remaining context after fixed consumers, tokens per query, latency at p50/p95/p99 with per-hop attribution, cost per query and per month, the 10x degradation order with first-failing stage and threshold, and the curated-context baseline with an honest verdict on whether retrieval beats it.
04 同仓库更多 Skills
twenty-year-land-plan
Apply the Bren discipline of evaluating every land and development decision on a twenty-year horizon, with a comprehensive plan for how the land, the community, and the surrounding public infrastructure evolve together. Deals optimized for a five-year exit are structurally different from deals that compound across generations; insist on knowing which kind you are making. Use when evaluating land, entitlements, master-planned development, or phasing decisions, and when separating five-year exit deals from generational holds.
thematic-gut-check
Apply the Gray discipline of identifying the structural theme behind every real estate deal, testing where that theme sits in its capital-flow lifecycle, and insisting that deals without a named theme — or deals late in a crowded theme — clear a higher bar. A mediocre deal in a strong theme usually beats a clever deal in a weak one. Use when naming the structural thesis behind a deal, judging whether that theme is early or crowded, and setting the bar the deal must clear.
supply-pipeline-gut-check
Apply the Zell discipline of grounding every real estate thesis in the local supply pipeline. Demand counts over adjectives — units under construction, units permitted, units proposed — and convert them into a forward absorption schedule. A deal that ignores the pipeline is a bet on a market you have not actually studied. Use when validating a market thesis, forecasting absorption and rent growth, or counting units under construction, permitted, and proposed.
ruin-scenario-mapping
Apply the Taleb discipline of identifying, for every real estate deal, the specific chain of events that produces ruin — permanent, unrecoverable capital loss — and verifying that no single such chain has non-trivial probability. Deals with any plausible ruin path must be restructured or abandoned. Use when sizing leverage, testing refinancing, covenant, and liquidity risk, or checking whether any single failure chain can permanently wipe out the position.
revenue-cost-architecture
Design a venture's revenue streams, pricing logic, cost structure, and unit economics so the business model has a coherent theory of value capture, not just value creation. Use after the value proposition and customer segment are set and before financial projections, when choosing a pricing model, calculating contribution margin or CAC payback, or checking whether the unit economics hold at scale.
replacement-cost-stress-test
Apply the Buffett discipline of pricing every real estate asset against the cost to rebuild it from scratch. The ratio of purchase price to replacement cost sets a ceiling on long-run downside: below replacement cost, new supply cannot profitably undercut you; at or above it, you are buying a liability disguised as an asset. Use when setting a purchase price, judging downside protection, or testing how exposed an asset is to newly built competing supply.