Digital One Foundation The First Layer
Paper 003 · Method

A budget binds where it is checked.

The protocol beneath these notes declares three limits and installs a hook that checks them at session start, printing nothing when they hold. On 21 September 2026 the files the budgets name were measured in one workspace folder of the thirteen that install the hook, and in the two product repositories, which do not. Where the hook runs, every budget measured holds; in the repositories, both memory indexes and both root instruction files are over budget, unflagged. A budget binds where it is checked, at the moment the cost is incurred — declared anywhere else, it is a preference.

§1Three declared limits, and a fourth in the code

The protocol file that governs every session on the machine declares "Three limits, checked at session start by .claude/hooks/context-budget.sh, which is silent when they hold and prints only what is over": the memory index under 80 lines, the root instruction file under 8 KB, the live transcript under 60 MB. The installed script checks four. The thresholds are not derived; they are scars. Above them sits the script's own provenance comment: "budgets — each one is a line that was crossed in longevity before this existed". Each budget's line has a crossing in this series' record.

BudgetThreshold in the scriptThe line that was crossed
Memory indexMEM_LINES=80Indexes crossed again at 539 and 978 lines on 2026-09-21 (§2)
Root instruction fileCLAUDE_KB=8Instruction files crossed again at 11,175 and 9,387 bytes on 2026-09-21 (§2)
Live transcriptTRANSCRIPT_MB=60The 224 MB seventeen-day session of Paper 001
Agent worktreesWORKTREE_MB=100Four agent checkouts holding 1.7 GB inside one repository

The fourth budget exists only in the script; the prose says three. That discrepancy is recorded rather than resolved, because it is the paper's thesis in miniature: what runs is the script, and a description that drifts from its script misleads exactly the reader who trusts prose. The worktree line was crossed hard enough to earn its own hook: each agent worktree is a full second checkout, and four of them once held 1.7 GB inside a repository, breaking lint and git fetch before anyone noticed.

The script is engineered to cost nothing when healthy: "SILENT WHEN HEALTHY. It prints only what is over budget, so a well-kept project pays nothing for this check. Always exits 0." It measures the right thing: only the newest transcript counts — older ones "sit on disk but are never re-sent, so counting them would keep warning after the fix was applied". When the live transcript is over, the warning ends with the protocol's whole theory: "Finish with /handoff, then /clear. The memory files are the continuity, not the transcript." The instruction-file check divides bytes by 1,024 and warns above 8, so it first fires at 9,216 bytes — a check's real threshold is what its arithmetic computes, not what its name says. None of this precision is the finding. The finding is where the script is, and is not.

§2The check and the defect sit in different directories

The budgets police files that load on every conversation, a cost the vendor documents in its own words: "CLAUDE.md files are loaded into the context window at the start of every session, consuming tokens alongside your conversation", with the auto-memory load bounded to the "first 200 lines or 25KB" of its index.[1] So the cost the budgets exist for is incurred wherever a session starts. The check does not run wherever a session starts.

Defect · found by measuring every file the budgets name, 21 September 2026

Where the check runs, the folder measured holds every budget; where four budgets are broken, it is not installed

The budget hook is installed at thirteen top-level workspace folders, wired into each folder's SessionStart. Neither product repository has it, and neither repository's settings call it: their hook chains carry only Paper 002's session-start and stop hooks. The check and the defect are in different directories, and the commands below are the audit, re-runnable in shape on any estate:

# where the check is installed — 13 workspace folders
find ~/Documents/claude -name context-budget.sh | wc -l    13
ls <workspace>/.claude/hooks/          # the one folder measured, of the 13
context-budget.sh  prune-worktrees.sh  session-start.sh  stop.sh  …
                                       every budget measured here holds

# where the budgets are broken — the two product repositories
ls <repo>/.claude/hooks/
session-start.sh  stop-handoff.sh      no context-budget.sh anywhere

wc -l  repo-1/memory/MEMORY.md   539     # budget 80 lines — 6.7x over
wc -l  repo-2/memory/MEMORY.md   978     # budget 80 lines — 12.2x over
wc -c  repo-1/CLAUDE.md          11175   # budget 8 KB
wc -c  repo-2/CLAUDE.md          9387    # budget 8 KB

Four live violations, none warned about, on the day of measurement. A session started inside either repository gets no budget check at all; a session at the parent workspace gets the check against the parent's own healthy files. The silence is identical in both cases, and only one of them means health.

The violations are not static. The first index grew from 527 lines at the morning measurement of 21 September 2026 to 539 at the same day's publish-time run, about half an hour later — twelve lines of accumulation between two readings, in a file whose budget is 80. Stripped of the session-history comments Paper 002 measured, the two indexes still hold 249 and 345 lines, 3.1 and 4.3 times the budget. The index did not merely exceed its line count; it changed kind: the consolidation command's Phase 4 orders "a pointer file, not a content dump", and the index became a store, in the two repositories where no check could say so.

WHERE THE CHECK RUNS 13 folders install the hook · the parent measured context-budget.sh at session start CLAUDE.md 656 B · budget 8 KB live transcript 21.5 MB · budget 60 MB no memory index, no worktrees to measure every budget measured holds — the hook prints nothing WHERE THE COST IS INCURRED two product repositories · sessions start here context-budget.sh — absent MEMORY.md 539 lines · budget 80 MEMORY.md 978 lines · budget 80 CLAUDE.md 11,175 B · budget 8 KB CLAUDE.md 9,387 B · budget 8 KB four budgets broken — no warning exists here a budget binds in the directory where it is checked, not in the file where it is declared
Figure 1 A check binds only the directory it runs in. Every budget the hook could see at the folder measured, it kept; every breach in the record sits one directory below, where sessions also start and the same files also load, and the silence there is indistinguishable from health.

§3Where the check was measured, every budget holds

The converse is the evidence that the check works. At the parent workspace, where the hook runs before every first turn, the instruction file is 656 bytes against the 8 KB budget, there is no memory index or worktree directory to breach, and the live transcript — the session measuring these notes — stood at 21,494,076 bytes against the 60 MB budget. Every budget holds, so the hook printed nothing: the correct silence, and the wrong comfort — it says nothing about the two repositories a floor below.

The operative constraint

The hook runs before the first turn on purpose. Its wiring comment: the scripts "cost NO tool call and no turn: whatever they print is already in context when the session opens. That is the point — a context problem is invisible from inside the session that has it." The protocol adds a duty: "Say a budget warning to the user in one line before the first answer." A check whose output waits to be asked for is a check that fires after the cost.

That is the whole positive case, and it is deliberately thin: one folder of the thirteen, measured on one day. It is also a lightly used folder — a 656-byte instruction file, no index at all — so its health is as consistent with light use as with the check. The discipline would be proved by a warning firing somewhere expensive, and the expensive places are precisely where the hook is missing. The seam is not a bug in the script. It is a property of where the script was installed.

§4The same system, patched on one side only

The two repositories share an explicit coherence policy: "the SAME Claude context/memory system (this file + .claude/ + memory/ + hooks) — ported deliberately to keep both repos coherent", in the second repository's own instructions. On the morning these notes were measured, that stopped being byte-true. At 07:54 on 21 September 2026, the second repository's SessionStart hook was patched to strip the index's comment history before injecting it, the author's justification in the file: "The file opens with ~640 lines of <!-- Session NN … --> history. Injected whole it was ~25.8k tokens at every start, /clear and compaction; the index below them is ~10k." Those token figures are the hook author's estimates, not a measurement, and are quoted as such.

The first repository's hook, unchanged since 25 June 2026, still injects its whole 539-line, 97,257-byte index at every session start. The mitigation landed where the pain was largest — the 978-line index — and only there, the same morning a measurement happened to be looking. A system held identical by written intention diverges the day one side hurts, because intention has no check either. And the patch spends nothing of the budget it answers to: the index is still 978 lines on disk, still 12.2 times its rule; the injection cost moved, the breach did not.

§5A budget binds at the moment the cost is incurred

A budget is not the number written in the prose; it is a check that runs where the cost is incurred, and installation is part of its definition. The record above contains three failures of that geometry, not one. A rule lived in prose while its check lived in a script; the prose undercounts the limits to this day. A check lived in the parent directories while the cost was incurred in the repositories; four breaches ran unflagged. A fix lived in one repository while the rule claimed both; the "same" system diverged in a morning. In each case the words were fine and the geometry was wrong.

These are the estate's own flagship repositories; the protocol's authors broke the protocol's budgets, the strongest evidence that the check must be mechanical. A rule its authors drift from, silently, is not a rule anyone will hold by discipline. The order inverts: write the check before the line is crossed, install it where the crossing would happen.

Three decisions are open in the record, and these notes settle none of them: whether the budget pair will be installed inside the two repositories' own hook chains, recorded nowhere as intended or rejected; whether the over-budget index is stripped at injection, as its sibling now is, or rewritten down to the 80-line index its own Phase 4 demands; and whether the fourth budget is protocol or omission — the prose and the script have not been reconciled.

One boundary on the claim. Nothing here argues the thresholds are right: 80 lines, 8 KB, 60 MB and 100 MB are each "a line that was crossed" once — scars, not science. What the measurement supports is narrower and harder: wherever one of those lines had a check standing on it — at the folder measured — the line held; wherever it had only prose, it did not. A budget binds where it is checked. What the first layer cannot fix even when every check runs is the subject of Paper 004.

On the provenance of this material

Every script, threshold and file size here was read or measured on one practitioner's workstation, a Digital One machine, on 21 September 2026; the hooks and repositories are not public, so the figures are the operator's account, and the commands are printed so the shape of each check can be reproduced against a reader's own machine. The script itself, paths removed, is public at memory-context-protocol and runs in a page beside these papers. The one vendor quoted is quoted from public documentation with the date read; no vendor is compared with another here, and none should be inferred. Deliberately absent: prices, plans and tiers, and deployment internals.

References

  1. Anthropic, Claude Code — How Claude remembers your project, sections on CLAUDE.md loading and the auto-memory comparison table. code.claude.com/docs/en/memory, read 21 September 2026.