Skip to content

refactor(assets): put the rules on a line budget - #16

Merged
protonspy merged 1 commit into
mainfrom
refactor/rules-line-budget
Aug 4, 2026
Merged

refactor(assets): put the rules on a line budget#16
protonspy merged 1 commit into
mainfrom
refactor/rules-line-budget

Conversation

@protonspy

Copy link
Copy Markdown
Owner

Follow-up to #15, which merged while this was being written.

Every rule is preloaded into every request of the session on a harness that reads rules/ — so a line here is not paid once, it is paid continuously.

651 lines / 28.6 KB → 554 / 25.6 KB. No rule and no reason was removed; what went was repetition, ceremony, and prose that restated the table above it.

Where it landed

Rule Before After
specs.md 104 82
knowledge-base.md 104 81
delivery.md 88 62
methodology.md 73 54
tasks.md 56 49
routing.md · autonomy.md · code-search.md · project.md · verification.md unchanged, already ≤55

Seven of ten now sit at or under 55 lines.

Why three do not, and what the test does about it

specs.md and knowledge-base.md are roughly half table and fenced example. Measured:

specs.md            82 total = 45 structure + 37 prose
knowledge-base.md   81 total = 46 structure + 35 prose

Structure here is blank lines, headings, the EARS pattern table, the design table, the delta example, the ADR and glossary blocks — none of it compressible without losing the thing it shows. Cutting either to 55 would leave under ten lines of prose across six sections: enough to state a rule, not enough to say why. A rule whose reason was deleted is one an agent quietly deviates from, which costs more than the bytes save.

delivery.md is at 62 with only 20 structural lines — its prose is simply dense now, and further edits re-wrap to the same line count rather than removing content.

So TestRulesStayShortEnoughToBePreloaded enforces 55 for any new rule and grandfathers those three at their current size, in both directions: a grandfathered file that grows fails, and one that shrinks below its cap also fails, with a message telling you to lower the cap. The gain gets locked in instead of drifting back.

Whether those three are worth cutting further is a judgment about the methodology rather than about bytes, and it is yours — say the word and I will take them to 55.

Verification

gofmt -l, go vet ./..., go test ./... green. A scaffolded workspace validates clean, so no rule trips a validator after the rewrite:

✓ validate: no findings

🤖 Generated with Claude Code

https://claude.ai/code/session_01J54qbk8RpC2tZH8LBz6T2b

Every rule is preloaded into every request of the session on a harness that
reads `rules/`, so a line here is not paid once — it is paid continuously. The
set was 651 lines / 28.6 KB and is now 554 / 25.6 KB, with no rule and no reason
removed: what went was repetition, ceremony, and prose that restated the table
above it.

Seven of ten files now sit at or under 55 lines. Three do not, and the test
grandfathers them at their current size rather than pretending otherwise:
specs.md and knowledge-base.md are roughly half table and fenced example — 45
and 46 lines of structure — so cutting them to 55 would leave under ten lines of
prose across six sections. That is enough to state a rule and not enough to say
why, and a rule whose reason was deleted is one an agent quietly deviates from.
delivery.md is at 62 with dense prose and no structure to blame.

The test enforces the budget in both directions: a new rule over 55 fails, and a
grandfathered file that shrinks below its cap fails too, so the gain gets locked
in instead of drifting back.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J54qbk8RpC2tZH8LBz6T2b
@protonspy
protonspy merged commit 4f5849d into main Aug 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant