---
name: earned-context
description: Audit agent-facing text (AGENTS.md, CLAUDE.md, skills, cursor rules, architecture/spec docs), turn every mechanically checkable rule into a lint, type or test, delete prose that restates code, then prove with a pre-registered, blinded ablation which remaining instructions earn their context window. Use when asked to prune, audit, slim down, or measure agent instructions, rules, or skills.
---
# Earned context
Text an agent reads must beat code that enforces the same thing. Default verdict for any instruction is **delete**; it survives only by being an irreducible judgment call *and* winning the ablation.
Scripts live in `scripts/` (run with no args for usage). Subagents come from this plugin's `agents/`. A subagent's output counts only after its gate script exits 0; never accept it on the agent's say-so.
| Phase | Orchestrator | Subagent | Gate |
|---|---|---|---|
| 1 Inventory | you | `claim-auditor` (parallel, one per file batch) | `validate_claims.py` |
| 2 Enforce | you | `enforcer` (one per claim, own worktree) | `prove_check.py` |
| 3 Ablate | `ablate.py` (no LLM) | `task-miner` beforehand | `calibrate_probes.py`, hash lock, leak audit |
| 4 Fix | you | `failure-analyst` → `enforcer` | `prove_check.py` |
## 1. Inventory
`python scripts/inventory.py REPO --out inv.json --md inv.md`, then send each batch of files to a `claim-auditor`. Spot-check its `judgment` verdicts: that is where auditors are lenient. A claim that's false against current code is still `restates` → delete.
## 2. Prune and enforce
1. Each `enforceable` claim goes to an `enforcer`. Merge its worktree only if `prove_check.py` passed; claims it reports as not enforceable become `judgment`.
2. Delete all `restates` claims.
3. Rewrite the remaining judgment claims tersely in the root file.
4. Install the regrowth guard: `agent_text_lint.py` in CI with `.earned-context.json` budgets set to current size.
5. Commit. This is **BASE** for phase 3.
## 3. Blinded ablation
1. Run `task-miner` to get 1–2 tasks with setup patches, hidden probes, rubric and `exercises`. Its gate is `calibrate_probes.py --allow-unlocked`.
2. Fill `ablation/prereg.json` from `templates/prereg.example.json`. Choices that are yours to make:
- B = root + domain docs; C = minimal root. Each must be a strict subset of the next.
- Margin: run 3 replicates of one condition on a non-eval task first, and set the margin at or above the spread you see. Do not tune it after seeing results.
- Agent model = the one your team actually uses. Judge model = a different one.
3. Show the user the plan; their approval is the only human gate before lock. Then `python scripts/prereg.py lock ablation/prereg.json`.
4. `python scripts/ablate.py ablation/prereg.json REPO BASE ablation/w`. Prefer the `ablate` CI workflow, so this session never holds `sealed/key.json`. Don't read the key, `runs/` or `judge.json` before `report/` exists.
<!-- ‹guest · 2026-12-04› -->
`ablate.py` stops on leaks, on judge noise ≥ margin, and on any edit to a finished stage. Fix the cause and start a fresh workdir; never edit outputs or the plan.
## 4. Report and delete
Report from `report/scorecard.md`: scores per condition, the decision, files never opened, judge noise, and where extra text hurt (a larger set scoring lower) or helped.
- Delete exactly `verdict.json` → `delete`. List `untested` files to the user; they were never tested, so the result says nothing about them.
- Run `failure-analyst`; send each proposed check to an `enforcer`. Recurring failures become checks, never prose.
- Ship deletions + new checks as one PR with the scorecard in the description.
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.