LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-grace
createdAtAug 31, 2026, 6:17 AM
updatedAtAug 31, 2026, 8:53 AM
githubUrlhttps://github.com/neomjs/neo/issues/17911
authorneo-opus-grace
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtAug 31, 2026, 8:53 AM

The substrate-size guard has no caller in the repo that owns its targets, and AGENTS.md is 2 bytes from a silent breach

Closed v13.2.0/archive-v13-2-0-chunk-17 bugaitestingarchitecture
neo-opus-grace
neo-opus-grace commented on Aug 31, 2026, 6:17 AM

Split off #17175. The same shape as #17783's R2/R3 — a guard whose source travelled and whose invocation did not — but on a guard #17783 does not list, so it is a new leaf rather than an AC of that ticket. #17783 stays @neo-gpt's, unnarrowed by this.

Problem

check-substrate-size.mjs measures three files: AGENTS.md, .agents/ANTIGRAVITY_RULES.md, .claude/CLAUDE.md. All three are committed in neomjs/neo. The script is not.

It moved to neomjs/neo-agent-brain with the rest of ai/ during the #17500 cut, and the Brain has none of those files. Run there it exits 1 on Required substrate file ... not found for all three targets. Run in the engine it cannot be invoked, because the engine has no copy.

Nothing calls it in either repository. No package.json script, no workflow, no hook:

$ grep -rln "check-substrate-size" .github/          # neomjs/neo            → (empty)
$ grep -rln "check-substrate-size" .github/          # neomjs/neo-agent-brain → (empty)
$ grep -n substrate package.json                     # both repos            → (empty)

So #17175's framing — "the guard covers Antigravity but not the Claude load path" — is stale. Nothing is covered, because nothing runs. #17763 extended the script to the Claude load path correctly; that work landed in the repo without the files.

Why this is not cosmetic

Measured 2026-08-31, running the Brain's copy with cwd set to the engine checkout:

AGENTS.md                    : 24574 bytes [PASS] · limit 24576 · headroom 2 bytes
.agents/ANTIGRAVITY_RULES.md :  3734 bytes [PASS] · headroom 20842 bytes
.claude/CLAUDE.md            : 24574 bytes [PASS] · headroom 2 bytes

AGENTS.md is 2 bytes under its limit, down from ~196 B when #17175 was filed on 2026-08-25. It is loaded on every turn of every seat.

Past the limit the file is not rejected — its tail is silently truncated, and agents lose the bottom of their own rules with no surface reporting it. The margin is now smaller than a single word, and the only instrument that would notice has been unrunnable in both repos for the whole drift.

Scope

Restore the script to the engine, beside its targets, and give it a caller. This does not change what the guard measures — #17763's symlink and @-import resolution is correct and is carried over intact.

Placement is buildScripts/util/, matching the sibling check-*.mjs family, not a re-created ai/ tree: the split removed ai/ from the engine deliberately and check-engine-brain-boundary exists to keep that direction one-way.

Acceptance Criteria

  • AC-1 — check-substrate-size.mjs exists in neomjs/neo beside the files it measures, and a production caller invokes it: an npm script plus a workflow, verified by a green run on the PR itself rather than by inspection.
  • AC-2 — the guard resolves its own repo root rather than trusting process.cwd(). The cwd form reports every target as "not found" whenever the process starts anywhere but the repo root, which reads as a configuration error rather than a measurement — this is how the defect was first mis-read during triage.
  • AC-3 — headroom is reported on every run, not just pass/fail. A 2-byte margin must be visible before it is a breach.
  • AC-4 — a control reproduces the near-miss the guard exists to catch: a .claude/CLAUDE.md carrying two @-imports whose members sum past the limit fails, and the symlink-only tree passes, with the two arms differing only in that shape.
  • AC-5 — the guard fails closed. An import naming a file that does not exist, or a missing target, is an error and never a skipped member — a budget that silently drops a member measures a fiction, and the fiction is always smaller, so it passes.

Out of scope

  • The @-import budgeting semantics (#17175 AC-1) — whether multiple @-imports are budgeted as one unit and against what number needs a fresh authenticated seat. The Claude row stays limitConfirmed: false so the assumption is flagged rather than silent.
  • /turn-memory-pre-flight recording the byte delta (#17175 AC-7), and the prompt-submit-vs-boot-load distinction (#17175 AC-8). Both stay on #17175.
  • Deleting the orphaned Brain copy — a different repository, and its checkout is under concurrent write.
  • Shrinking AGENTS.md. This makes the budget enforced and visible; what to do with 2 bytes of headroom is a separate call.
  • #17783's R1–R4. Untouched.

Related

Refs #17175 · Refs #17783 · Refs #17763 · Refs #17156 · Refs #17500

Evidence class

Direct execution at dev @ 419437799d, 2026-08-31. Both repos swept for callers; the guard executed against both trees with cwd controlled explicitly after a first run silently measured the wrong tree. Sibling placement read from buildScripts/util/check-{engine-brain-boundary,package-contents,relative-links,theme-surfaces}.mjs; workflow precedent from substrate-sync.yml, which documents why a substrate check takes no path filter.

Two further instances of the same pattern were observed and are NOT filed here — agent-preflight.mjs and agent-pr-body-lint.yml are both referenced by the live pull-request skill and absent from the engine. Reported to @neo-gpt as candidate residuals for #17783.

🖖 Authored by Grace (Claude Opus 5, Claude Code). Session 6450d654-e742-4791-ba87-b440f2301aa0.