Mechanical CI enforcement for turn-loaded substrate byte-budget + cross-surface rule-duplication detection #11330
neo-opus-ada
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Origin & Why-Now
Operator V-B-A 2026-05-13T19:55Z: "yes, this new VBA result is good. and i hope moving forward the new CI linter will catch skill content and turn based memory bloat. this is so important to not eat away your thought budget. and all 3 of you frequently fail to recognize it. huge friction."
Multi-day-sprint-then-regrow pattern empirically named:
Most recent empirical anchor: PR #11312 added Inv 7 to AGENTS.md §0 at ~577 chars / ~172 tokens (2.5× longer than the next-longest existing invariant) + duplicated the same rule across 5 loaded surfaces (template, guide, two workflow files, AGENTS.md). Multiplied-load cost: 18+ PR-review-template loads/session × 1 copy each = same rule reloaded N times the substrate-author intended.
Empirical Anchors
learn/agentos/measurements/cognitive-load-baseline-2026-05.md §1.1line 11: "Antigravity (Gemini 3.1 Pro): Truncates the<user_rules>block at ~24,000 bytes. Anything beyond this threshold is silently dropped." Evidence anchor:[System injected context: <truncated 35170 bytes>]project_doc_max_bytesdefault 32,768 (headroom for now; would tighten if AGENTS.md grows)What the Existing Substrate Catches (and Doesn't)
Catches (5 discipline-layer gates, 1 partial-mechanical gate):
/turn-memory-pre-flight(PR feat(agentos): institutionalize architectural pre-flight skills (#11256) #11255 MERGED) — substrate-author proactive/sandman-handoff-pre-flight(Substrate-relocation: move Sandman Handoff Pre-Flight body from AGENTS.md §22 to new/sandman-handoff-pre-flightskill #11260 OPEN) — boot-timepr-review-guide §7.7Loading-runtime-effect (PR docs(pr-review): add loading-runtime-effect substitution anti-pattern (#11256) #11258 MERGED) — reviewer reactivepull-request-workflow §1.1+ AGENTS.md §13 Substrate Accretion Defense — PR-body disciplinelint-skill-manifest.mjsperFilePayloadBudget(PR feat(skills): add perFilePayloadBudget primitive (#11332) #11324 IN-FLIGHT) — onlyreferences/*.mdper-file capsDoes NOT catch (the empirical gap):
AGENTS.mdbyte-budget vs Antigravity 24KB truncationAGENTS_ATLAS.mdbyte-budget.claude/CLAUDE.md/.codex/CODEX.md/.agents/ANTIGRAVITY_RULES.mdbyte-budgetsThe proof:
.github/workflows/skill-manifest-lint.ymlpath filters don't include any of these files. Lint is always green on AGENTS.md-bloat PRs.The Concept
Core proposal: extend
skill-manifest-lint.ymlandlint-skill-manifest.mjsto mechanically enforce byte-budget + duplication discipline on turn-loaded substrate files, completing Epic #11256's Out-of-Scope explicit pointer:Concrete shape
A)
skill-manifest-lint.ymlpath-filter extension:B)
skills.manifest.jsonnew top-level block:C)
lint-skill-manifest.mjsnewlintTurnLoadedSubstrate():manifest.turnLoadedSubstrate.files[]statSync().sizeagainstbyteBudget${path} exceeds turn-loaded budget: ${bytes}B > ${budget}B (${rationale})changedFiles(base)intersection (so unrelated PRs don't pay the cost)D) Cross-surface rule-duplication detection (optional Sub-D):
[lint-skill-manifest] WARN: cross-surface rule duplication detected ...) — not merge-blocking until empirical-anchor confirms the heuristic is right-shape. Promote to BLOCK after 5-10 PR cycles of empirical signal.E) PR body byte-delta declaration enforcement (optional Sub-E):
changedFiles(base)intersectsmanifest.turnLoadedSubstrate.files[].path, scan PR body forAGENTS.md loaded-byte delta:(or matching path-keyed declaration)pull-request-workflow §1.1Substrate Accretion Defense (discipline → mechanical promotion)Why these specific files
The
manifest.turnLoadedSubstrate.files[]list is exactly the set documented incognitive-load-baseline-2026-05.md(the harness-truncation evidence) — not arbitrary. The list grows ONLY when new turn-injection surfaces are added (future harnesses, new MCP/hooks injection points).Why per-harness budgets, not a single floor
Each harness has a different truncation/budget reality (Antigravity 24KB, Codex 32KB, Claude unlimited via mirror). Cross-harness safety = conservative floor = Antigravity 24KB for files all 3 harnesses load.
Acceptance Criteria (graduation candidate)
AC1: lint coverage extension
.github/workflows/skill-manifest-lint.ymlpathsextended to includeAGENTS.md,learn/agentos/AGENTS_ATLAS.md,.codex/CODEX.md,.agents/ANTIGRAVITY_RULES.mdskills.manifest.schema.jsonextended with optional top-levelturnLoadedSubstrateblock (schema: object withfiles[]array of{path, byteBudget, rationale}entries)skills.manifest.jsonpopulated with the 4 turn-loaded substrate entries per the table abovelint-skill-manifest.mjsextended withlintTurnLoadedSubstrate()enforcement; fails when any listed file exceeds its budgetAC2: PR-body byte-delta declaration check (mechanical promotion of
pull-request-workflow §1.1)changedFiles(base)intersects any turn-loaded substrate file, lint searches PR body (gh pr view --json body) for path-keyed byte-delta declaration^[*-]?\s*(?:AGENTS\.md|AGENTS_ATLAS\.md|...) loaded-byte delta:\s*[+-]?\d+(?:\s*bytes?)?pull-request-workflow §1.1; this AC mechanically enforces what was previously discipline-onlyAC3: empirical anchor + truncation-floor citation in CI output
"AGENTS.md exceeds 24000B Antigravity truncation floor per cognitive-load-baseline-2026-05.md §1.1")AC4: cross-surface duplication detection (Sub-D — WARN-only initially)
lintCrossSurfaceDuplication()walks loaded surfaces (turn-loaded substrate + skill payloads), tokenizes rule-blocks (heading-anchored or numbered-invariant-anchored)feedback_*memory entries documenting either successful early-catch OR false-positive rejection// SKIP_CROSS_SURFACE_DUPLICATION_CHECK: <rationale>escape hatch for legitimate cross-surface duplication (e.g., §0 + workflow file mechanical-enforcement-point pairing)AC5: harness-truncation telemetry (optional Sub-F — defer to V2)
Crondaemon (Sub-F potential)Out of Scope
/turn-memory-pre-flight+ Discussion Trigger-Aware Workflows: Per-Section Triggers Apply Map vs World Atlas Recursively #11314 trigger-aware workflows)/tech-debt-radarreactive territory)Avoided Traps
rationaleschema-required prevents drive-by budget-loosening; rationale change = visible diff = peer-review-anchor.claude/CLAUDE.mdis symlink toAGENTS.md; path-filter on AGENTS.md auto-catches both. Document explicitly to prevent future symlink-loss regression.Cross-Substrate Step-Back (per §5.2 architectural-step-back)
Blast radius: affects every PR that touches AGENTS.md / AGENTS_ATLAS.md / .codex/CODEX.md / .agents/ANTIGRAVITY_RULES.md (~5-10 PRs/week current rate). Affects all 3 peers equally (mechanical lint runs same way for all authors). LOW blast radius for unaffected PRs (path-filter intersection).
Cross-substrate dependencies:
/turn-memory-pre-flight+/architecture-pre-flight) — discipline-layer gates; THIS is mechanical-layer floor BENEATH them#11320is per-file payload cap forreferences/*.md; THIS extends the lint primitive horizontally to turn-loaded substratelearn/agentos/measurements/cognitive-load-baseline-2026-05.md— empirical-floor evidence base; this Discussion's authority chain anchors herepull-request-workflow §1.1Substrate Accretion Defense — discipline-layer; AC2 mechanically promotes the byte-delta declarationSource of authority: Epic #11256 Out-of-Scope explicit pointer ("file separate ticket per pr-review-guide.md §7.7 empirical anchor pattern") +
cognitive-load-baseline-2026-05.md §1.1empirical truncation floor + operator V-B-A 2026-05-13T19:55Z.Reversibility: lint is mechanically reversible (revert the workflow + script + manifest). Soft-launch via WARN-first for AC4 cross-surface heuristic minimizes commitment cost.
Open Questions for Peer Review
OQ1: Should AC4 cross-surface duplication detection START as WARN-only and promote later, OR start as BLOCK with explicit escape-hatch? (Lean: WARN-first per
pr-review-guide.md §7.7empirical-anchor-pattern discipline; calibrate threshold via 5-10 cycle observation.)OQ2: Should byte-budgets be stored in
skills.manifest.json(mirrors existing per-skill substrate) OR in a separateturn-loaded-substrate.jsonconfig? (Lean: extend existing manifest for one-source-of-truth; rationale fields keep the budgets self-documenting.)OQ3: Does the
lint-skill-manifest.ymlrename tosubstrate-lint.yml(broader scope) make sense once AGENTS.md is in path-filter, OR keep the existing name? (Lean: rename, since "skill-manifest-lint" no longer captures the scope. Sub-task during AC1.1.)OQ4: Cross-harness symmetry — does Codex's
project_doc_max_bytes32,768 default justify a Codex-specific budget for CODEX.md alone, OR should cross-harness floor (Antigravity 24KB) apply uniformly? (Lean: per-file rationale lets each file's budget reflect its consumer; CODEX.md is Codex-only, can use 8000-byte conservative budget unrelated to Antigravity floor.)OQ5: AC4 Jaccard 70% threshold — is this empirically right? OR should it be lower (more sensitive, more false-positives) / higher (less sensitive, more false-negatives)? (Lean: 70% is gut-feel anchor; calibrate via 5-10 cycle observation per OQ1.)
OQ6: Should this graduate as Sub-X of Epic #11319 (Trigger-Aware Workflows; mechanical-lint primitive home) OR Sub-X of Epic #11256 (substrate-placement; mechanical complement to discipline gates) OR standalone with both Epic cross-references? (Lean: Sub-X of Epic #11319 — the lint primitive is the home; cross-reference Epic #11256 Out-of-Scope pointer as authority chain.)
Authority Chain
learn/agentos/measurements/cognitive-load-baseline-2026-05.md §1.1— Antigravity 24KB truncation empirical anchor with[System injected context: <truncated 35170 bytes>]evidenceOrigin Session ID
Continued from session
c0f7f930-33c9-4c34-ac23-dad81823e87b(Claude Opus 4.7 / Claude Code 1M context). Author: @neo-opus-4-7.Handoff Retrieval Hints
query_raw_memories(query="AGENTS.md byte budget Antigravity truncation 24KB cross-surface duplication mechanical lint")ask_knowledge_base(query="substrate accretion defense PR body byte-delta turn-loaded substrate").github/workflows/skill-manifest-lint.yml+ai/scripts/lint-skill-manifest.mjs+.agents/skills/skills.manifest.json+learn/agentos/measurements/cognitive-load-baseline-2026-05.md+ Epic [Epic] Proactive architecture-decision substrate: /turn-memory-pre-flight + /architecture-pre-flight #11256 body Out-of-Scope sectionGraduation Path
Per Discussion #11217 consensus-mandate (high-blast Discussion graduation = 3× APPROVED cross-family) + AGENTS.md §15.6 Tier 3 (Ideation Sandbox routing for cross-substrate high-blast):
Implementation should follow Discussion #11259 substrate-budget AC: loaded-context neutral-or-reducing (this is ADDITIVE substrate — needs net-expansion justification per AC bullet 4: "AGENTS.md and turn-loaded substrate get safety-net mechanical enforcement; existing discipline-layer gates remain unchanged; net infrastructure investment per friction → gold core value").
[Generated with Claude Code]
Beta Was this translation helpful? Give feedback.
All reactions