Skip to content

checks: AGENTS.md is held to a ceiling of bytes - #52

Merged
lneto merged 1 commit into
masterfrom
context-budget
Nov 27, 2026
Merged

lneto merged 1 commit into
masterfrom
context-budget

Conversation

@lneto

@lneto lneto commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Every session and every workflow agent that loads CLAUDE.md loads harness/AGENTS.md and the project's AGENTS.md before its first turn, and nothing stops either from growing: the one file the two replaced weighed 42268 bytes on 2026-10-09, and the two weighed 66014 on 2026-11-22.

tools/checks/context-budget.sh fails a commit that takes the AGENTS.md at the top of a checkout past its ceiling of bytes, and the mount's pre-commit runs it, so the Checks run of this repository, of Lunatik and of luaebpf fails such a pull request with no change to their workflows. A lesson that needs room moves an older passage to the check, the skill or the rule that holds its subject, or its pull request moves the ceiling and says why:

$ printf x >> AGENTS.md && git add AGENTS.md && bash tools/checks/pre-commit
AGENTS.md: 40558 bytes, past its ceiling of 40557; a lesson that needs room moves an older passage to the check, the skill or the path rule that holds its subject

The harness's ceiling, 40557 bytes, is this file's size today, written as a line of the check. A project states its own as budget=<bytes> in its .agents/harness.conf, and one that states none is not read: Lunatik and luaebpf pass until the bump of the mount that brings this check sets theirs, Lunatik's once its own file is trimmed to fit.

#6, which it does not close

Every session and every workflow agent that loads CLAUDE.md loads
harness/AGENTS.md and the project's AGENTS.md before its first turn, and
the one file the two replaced grew from 42268 bytes on 2026-10-09 to the
66014 they weighed on 2026-11-22. context-budget.sh fails a commit that
takes the AGENTS.md at the top of the checkout, as the index holds it,
past its ceiling, and pre-commit runs it, so the Checks run of the
harness, of Lunatik and of luaebpf, each of which runs the mount's gate
over a pull request's staged diff, fails one too.

The harness's ceiling, 40557, is its size here: of the seven sentence
pairs harness/AGENTS.md and Lunatik's AGENTS.md share, every sentence on
the harness's side speaks of both projects, so the first trim D172 D asks
for takes nothing from this file. A project states its own in the budget
key of its .agents/harness.conf, and one that states none is not read,
as a key left out gives nothing elsewhere.

#6, D172 D.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lneto lneto added complexity: medium Several call sites, a new test, or a core path to audit workflow-reviewed reviewed end to end by a review workflow labels Nov 27, 2026
@lneto

lneto commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Note

This comment was written by an LLM, not a human.

What #6 requires, as the review read the change meeting it:

  • Met: D172 D (Update of 2026-11-26 on harness: workflows, context and memory cost fewer tokens #6): "tools/checks/context-budget.sh fails a pull request that takes harness/AGENTS.md or a project's AGENTS.md past a ceiling of bytes" tools/checks/context-budget.sh:22-26 compares git show :AGENTS.md | wc -c with the ceiling and exits 1 past it. tools/checks/pre-commit:80 runs the check, and the Checks workflows of the harness, Lunatik and luaebpf stage the PR diff and run that pre-commit. A project's ceiling is the budget key (context-budget.sh:18, project.sh:26). Case: printf x >> AGENTS.md && git add AGENTS.md && bash tools/checks/pre-commit prints 'AGENTS.md: 40558 bytes, past its ceiling of 40557; ...' and exits 1. In a project with budget=10 and an 11-byte AGENTS.md it prints 'AGENTS.md: 11 bytes, past its ceiling of 10; ...'.
  • Met: D172 D: the ceiling is "set after a first trim that removes only what the two files say twice: the 2.3 KB in which Lunatik's AGENTS.md describes the mount again, and the sentences each file holds in other words of the other"; the round adds: "a sentence of harness/AGENTS.md that one of those pairs shows speaks of Lunatik alone is this run's to trim, and harness/AGENTS.md's ceiling is its size after that" I read the seven pairs in measure.md section h against harness/AGENTS.md at the base: the openings, the Lunatik/luaebpf sentence, 'A mistake in the kernel...', 'Verify, do not assume', 'Code another project wrote is reused', ### Checks and the opening of 'Before opening a pull request'. Each of them speaks of both projects, so the trim here is empty, and context-budget.sh:16 sets 40557, the size at the base and at master a8826ba. The trim of Lunatik's file and its ceiling are the second pull request, as the round says. Case: git show <tip>:AGENTS.md | wc -c is 40557, and pre-commit passes at it and fails one byte past it. A trim owed but missing has no mechanical case; this cell rests on the reading of the seven pairs.
  • Met: D172 D: "The incidents stay" The diff does not touch AGENTS.md. Case: No case can fail: nothing is removed. git diff 1a1d3e4 <tip> -- AGENTS.md is empty.
  • Met: Round: "the way a project states the ceiling of its own AGENTS.md, wired where the shared checks run on a pull request"; "What the check does with a project that states no ceiling yet is the implementer's call, the smallest shape" project.sh:26 documents budget. context-budget.sh:18-20 reads it with project_conf and exits 0 when it is absent. Lunatik and luaebpf run the mount's pre-commit in CI, so their bump only adds the key. Case: Project with no key: exit 0. Project with budget=11 and an 11-byte AGENTS.md: exit 0. Budget=10: exit 1.
  • Met: Round: "The body says #6, which it does not close" The last line of the body. Case: pr-body.sh body.md is silent; a body that names harness: workflows, context and memory cost fewer tokens #6 in no way closing.sh accepts would fail it.

The matrix the change is held to:

The matrix, every cell run by hand in the review worktree and in a throwaway git repo under scratch (removed afterwards):

  • Harness checkout, AGENTS.md staged at 40557 bytes: pre-commit passes.
  • Harness checkout, AGENTS.md staged at 40558 bytes: pre-commit fails with exactly the line the body shows.
  • Harness checkout, growth left unstaged: passes, because the check reads the index.
  • Project with no budget key: passes and reads nothing.
  • Project with budget equal to the size: passes.
  • Project with budget one byte under the size: fails.
  • Project with no AGENTS.md in the index: passes (size 0).
  • Project with budget=abc: fails with a test error line (out of contract).

CI wiring, read and not run:

  • The harness's checks.yml:26-31 stages the pull request's diff and runs tools/checks/pre-commit.
  • Lunatik's checks.yml:29-34 runs tools/checks/pre-commit, which runs harness/tools/checks/pre-commit first.
  • luaebpf's checks.yml:29-33 runs harness/tools/checks/pre-commit.
    So all three fail a PR past the ceiling without a workflow change, Lunatik and luaebpf once their bump sets budget.

Not covered:

  • No CI run of this branch has happened yet.
  • The case of a commit inside a project's mount (toplevel = mount = harness_root) was read and not run. Its logic is the -ef idiom harness-mixed.sh already relies on.
  • No local hook is installed in the mount's .git/modules/harness/hooks on this host, so the local-commit gate inside the mount goes unexercised here; that predates the change.
  • Like the other file checks, it has no cases file: only command guards keep one (checks.md:439-445). The proof is the run above and the body's example.
  • This changes nothing the host builds or runs, so no build or suite applies.

@lneto
lneto merged commit e373af1 into master Nov 27, 2026
2 checks passed
@lneto
lneto deleted the context-budget branch November 27, 2026 02:20
lneto added a commit to luainkernel/luaebpf that referenced this pull request Nov 27, 2026
The `harness/` mount moves to luainkernel/harness@e373af1, which carries
luainkernel/harness#52: tools/checks/context-budget.sh, which the
mount's pre-commit runs here and in the Checks workflow, fails a commit
that takes the AGENTS.md at the top of a checkout past the ceiling the
budget key of .agents/harness.conf names. D172 D on luainkernel/harness#6
trims only what harness/AGENTS.md and Lunatik's say twice, so this file
loses nothing and its ceiling is its size, 3647 bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lneto added a commit to luainkernel/lunatik that referenced this pull request Nov 27, 2026
The harness/ mount moves to luainkernel/harness@e373af1, which carries
luainkernel/harness#52: context-budget.sh, which the mount's pre-commit
runs, fails a commit that takes the AGENTS.md at the top of the checkout
past the ceiling the budget key of .agents/harness.conf names. The key
is set to the file's size after the trim D172 D asked for first, 22803
bytes, so a lesson that needs room past it moves an older passage to the
check, the skill or the path rule that holds its subject.

Closes #2749.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lneto added a commit to luainkernel/lunatik that referenced this pull request Nov 27, 2026
The harness/ mount moves to luainkernel/harness@e373af1, which carries
luainkernel/harness#52: context-budget.sh, which the mount's pre-commit
runs, fails a commit that takes the AGENTS.md at the top of the checkout
past the ceiling the budget key of .agents/harness.conf names. The key
is set to the file's size after the trim D172 D asked for first, 22801
bytes, so a lesson that needs room past it moves an older passage to the
check, the skill or the path rule that holds its subject.

Closes #2749.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

complexity: medium Several call sites, a new test, or a core path to audit workflow-reviewed reviewed end to end by a review workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant