context-window-and-token-economics-architect
Skill4 starsChanged 31 days agoMITView on GitHub
Review LLM context selection, retrieval evidence, prompt cache boundaries, time to first token, and structured output contracts. Use for changes that affect what an LLM sees, reuses, or returns.
In this repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- anti-slop-engineeringSkill
- anti-slop-engineeringSkill
- api-ergonomics-and-contract-governorSkill
- apple-craft-and-frame-budgetSkill
- apple-craft-and-interaction-physicsSkill
- asset-provenance-guardSkill
- backprop-guardSkill
- chaos-and-degradation-choreographerSkill
- chromatic-drift-guardSkill
- cognitive-load-and-attention-governorSkill
- comment-budget-guardSkill
- cryptographic-agility-and-secret-lifecycle-gateSkill
- decision-guardSkill
- demock-guardSkill
- design-system-drift-guardSkill
- deterministic-simulation-and-property-testingSkill
- distributed-consensus-and-concurrency-gateSkill
- finops-and-unit-economics-governorSkill
- future-scale-gateSkill
- grumpy-senior-staff-engineerSkill
- honeypot-trap-guardSkill
- house-tell-guardSkill
- install-anti-slopSkill
- llm-eval-and-prompt-injection-fortressSkill
- mandela-guardSkill
- mechanical-sympathy-and-perf-gateSkill
- mechanical-sympathy-profilerSkill
- motion-runtime-guardSkill
- observability-and-slo-architectSkill
- observability-and-slo-gateSkill
- paranoid-principal-architectSkill
- pr-boundary-guardSkill
- privacy-and-data-lineage-gateSkill
- re0-handoff-guardSkill
- reduction-guardSkill
- repo-memory-and-invariant-stewardSkill
- root-fix-gateSkill
- safe-evolution-and-rollout-choreographerSkill
- scientific-fault-isolationSkill
- styleseed-guardSkill
- supply-chain-and-sbom-sentinelSkill
- tagore-guardSkill
- type-level-and-ast-slop-gateSkill
- ui-and-copy-disciplineSkill
- verification-oracle-architectSkill
- zero-downtime-migration-gateSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Write task-specific thresholds before comparing variants: context cap, minimum evidence recall, maximum p95 time to first token, and …
- Distinctive: line 22
Verify that schema validation and source grounding independently pass.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Window and Token Economics
Define the request budget
- Capture the model and API version, tokenizer or usage source, prompt revision, tool/schema revisions, retrieval index revision, and the target task. Include provider-added or tool/schema overhead when the API reports it; mark unrecoverable overhead unknown.
- Reserve output and reasoning capacity as defined by the selected API. Allocate the remaining input budget to instructions, history, tools, and retrieved evidence. Measure tokens on the rendered request. Reject or narrow requests that exceed the model limit even when some tokens are cached.
- Write task-specific thresholds before comparing variants: context cap, minimum evidence recall, maximum p95 time to first token, and allowed regression in exact task outcomes. If a required document will not fit, return an explicit evidence gap or ask for a narrower scope.
Select evidence
- Retrieve small, answer-bearing passages with source ID, revision, and a section or span. Keep headers, table labels, or adjacent text when removing them changes meaning. Deduplicate overlapping passages by source and span before filling the budget.
- Apply tenant and document authorization before any retrieval intended for the prompt. Preserve provenance through derived summaries. Redact payloads and logs before sending them to a model, cache, analytics endpoint, or reviewer when authorization or retention requirements demand it.
- Verify that schema validation and source grounding independently pass. For each required claim in the evaluation set, check that the chosen context contains its evidence and that the output cites that evidence. If the model must report insufficient evidence, make it a valid structured output.
Inspect cache reuse
| Cache | Evidence for review |
| Provider prefix | Stable rendered prefix and provider-reported cached input. Record model, tool/schema settings, and cache eligibility. Design the prefix around public or otherwise authorized stable inputs. Count cached tokens toward the context limit. |
| Application retrieval or prompt fragments | Include tenant/policy scope, source revision, and rendering/config revisions in cache identity. On document update, deletion, access revocation, or schema change, invalidate or recompute before reuse. Verify the result for an authorized reader and a reader whose access changed. |
| Application responses | Revalidate authorization and evidence freshness before reuse. Include exact task inputs, output schema version, and relevant model settings in cache identity. Disable sharing where the output depends on private context. |
Compare before and after
- Reuse the same labeled task set, model settings, and workload distribution. Compare cold and warm runs separately, including expiry or changed-prefix cases. Record time from request dispatch to first user-visible token for streaming responses and end-to-end time separately. Record sample counts, p50 and p95; leave time to first token unavailable for requests where it cannot be observed.
- Record total input, cached reads, cache writes when exposed, output, and retries per completed task. Cache-read share is cached-read input tokens divided by total input tokens. Track billed cost separately using dated rates and each provider's usage field semantics. With no reliable data, report unknown usage or cost.
- Record expected evidence hits over required evidence, structured parse success, answer correctness, and authorization failures. Compare latency only for cohorts with the same conditions. Ship a change when it meets the task thresholds under both cold and warm runs. Any cross-tenant disclosure or stale authorization reuse blocks the change.
Offline verification
Run python3 examples/refund_workflow.py from the skill directory to reproduce the paired workflow. In a source checkout, contributors can run the fixture tests with python3 -m unittest discover -s tests -p test_context_token_economics.py -v. The scenario verifies evidence coverage and invalidation. For provider token counts and latency, replace synthetic estimates with captured telemetry for the selected API.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

