Skip to content

feat: add deslag instructions lints - #56

Merged
webern merged 5 commits into
mainfrom
m/deslag-room
Sep 27, 2026
Merged

webern merged 5 commits into
mainfrom
m/deslag-room

Conversation

@webern

@webern webern commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Summary

Every Markdown file deslag lints in its own repository has a byte budget, and the files that hold text per lint were full: the setup guide at 4996 of 5000 bytes, lints.asbuilt.md at 7496 of 7500, deslag.asbuilt.md at 8163 of 8192 (measured on main, e12b6d5). A new lint needed about 200 bytes of guide text, because tests/instructions.rs made the guide name every lint and turn every lint on in its example, and a section in lints.asbuilt.md. #54 paid for list_growth by cutting guidance from the guide. Raising a budget is not the fix, so this moves the per-lint text to homes that grow by a file per lint instead of by bytes in a full file.

No budget is raised. A new lint now needs no bytes in the guide, lints.asbuilt.md (beyond its line in the module tree) or deslag.asbuilt.md.

deslag instructions lints

A new instructions topic. It prints a short intro, then a section per lint, headed by its id, in the order the lints run: what the lint fails, and one TOML table that turns it on.

  • Each section is its own file, src/instructions/lints/<id>.md. instructions::lints includes them through an exhaustive match on Lint, so a new lint does not compile until it has one. The heading comes from Lint::id, so it cannot drift from the config's table name.
  • .agents/deslag.toml now lints src/instructions/**/*.md and holds the intro and each lint's file to 800 bytes. The largest is 279.
  • The guide's step 3 now opens with "Run deslag instructions lints" and keeps a short example ([md], one lint, one override) and the message and config-schema text. The guide stays the one entry point: step 3 cannot be done without the topic, as values already cannot be set without config-schema.

What an agent reads: deslag instructions was 5057 bytes (120 lines) and is now 4124 (97 lines); deslag instructions lints is 1817 bytes (75 lines).

Two homes were considered and not taken:

  • deslag explain <lint>. explain exits 2 when there is no config, which is the state of a repository being onboarded, and its PATH argument would clash with a lint id.
  • Printing the topic at the end of deslag instructions, to keep one command. That is raising the guide's budget by another name.

What moved where

Text was moved, not rewritten, except where noted.

  • The guide's seven lint bullets (guide.md:64-77 on main) moved word for word, one to each src/instructions/lints/<id>.md.
  • The guide example's tables moved to the file of the lint they turn on: max_emphasis, banned_chars, banned_phrases and density under [md.lints], and repo_layout and list_growth in an AGENTS.md override. max_size_bytes keeps its table in the guide and gets the same one in its file.
  • The check that the guide's example turns on every lint is now a check that the lint tables, joined, turn on every lint and run clean.
  • The --diff guidance feat: add list_growth and --base #54 cut from step 6 is back, near its old words: --diff misses some failures, such as a path deleted from under an untouched layout, and a pull_request job may run --diff HEAD^1 with fetch-depth: 2. This makes README.md's "deslag instructions says how to run it in CI and what it misses" true again. "In its place" became "in place of --base origin/main", since a sentence now comes between them.
  • lints.asbuilt.md's seven per-lint sections (3359 bytes) are gone. Most of it repeated the module doc comments. What only they held moved into the module docs:
    • banned_chars.rs: the byte order mark that scan skips, that allow beats ban and ban the groups, and that only emoji is off by default.
    • repo_layout.rs: the root is one word; a blank line ends a description; the width ignores trailing whitespace; Malformed; and the defaults, named by RepoLayout's DEFAULT_ constants rather than by value.
    • density.rs: a block of only whitespace is dropped, and the defaults, by Density's constants.
    • max_emphasis.rs: an unset field counts as 0, and a table setting neither checks nothing. The doc said a run of capitals is split by spaces; the code splits on any whitespace, and the doc now says so.
    • list_growth.rs: a file the change did not edit is not judged.
    • max_size_bytes.rs: a file with no budget still counts in the tally.
  • lints.asbuilt.md's Checking section says a lint's module doc is its as-built description, and a new test in tests/asbuilt.rs holds each lint's //! to 2000 bytes. The largest is 1788 (repo_layout.rs).
  • deslag.asbuilt.md's Tests section and tests/ tree moved to a new tests.asbuilt.md (subsystems: [tests]), indexed from deslag.asbuilt.md. Build stays in deslag.asbuilt.md: it covers the repo as a whole and does not grow per lint.
  • The proofs of one lint on the corpus moved to that lint: the default groups flagging four times as many llm/ fixtures as human/ ones to banned_chars.rs; the layouts read under real headings, and core/rt-agents.md with no malformed line, to repo_layout.rs; fix over the corpus to the Fixing section of lints.asbuilt.md.
  • deslag.asbuilt.md names the new topic and its files in the module tree and the command line section, and says instructions reads Lint.

Budgets

File Before After Budget
src/instructions/guide.md 4996 4063 5000
src/instructions/lints.md - 302 800
src/instructions/lints/*.md - 146 to 279 800 each
docs/design/lints.asbuilt.md 7496 4570 7500
docs/design/deslag.asbuilt.md 8163 5564 8192
docs/design/tests.asbuilt.md - 3108 4096
lint module //! comments 599 to 1500 651 to 1788 2000 each

AGENTS.md and the skills are unchanged, so list_growth has nothing to judge there.

Where a new lint's text goes: a new src/instructions/lints/<id>.md, its module's doc comment, and one line in lints.asbuilt.md's module tree. None of them is a full file.

Onboarding trial

An agent with no other context was given the release binary built from this branch and an empty repository: a git repository with one commit, holding a README.md, an AGENTS.md and a docs/design.md, with no remote. It was told only to run deslag instructions and do what it says.

  • It ran deslag instructions, then deslag instructions lints, then deslag instructions config-schema, then check.
  • It wrote a deslag.toml covering AGENTS.md and docs/: max_size_bytes for both, banned_chars, and, in an AGENTS.md override, a smaller budget and repo_layout with min_entries = 3 and max_entries = 10. It left README.md out, as the guide says to ask the human before linting a human-written file.
  • It skipped banned_phrases, since the phrases are the human's to choose, and max_emphasis, density and list_growth, as not needed yet.
  • The first check failed on AGENTS.md having no Repository layout section. It added one, and the last check exited 0.
  • check --base origin/main exited 2, because the repository has no remote. It skipped step 6 (CI), as the repository had no CI to add it to.

Testing

  • make ci: exit 0, 156 s (157 s on main e12b6d5; both warm, on the same machine).
  • tests/instructions.rs: deslag instructions lints exits 0 with empty stderr and prints instructions::lints(); it has a section for every lint, in Lint::ALL order, and those are the schema's lints; each section has exactly one TOML table, which fits the schema and turns on its lint alone; the tables joined turn on every lint, fit the schema and run clean; the guide's example fits the schema, runs clean and names deslag instructions lints; neither text has a placeholder left.
  • Checked that a lint file whose table turns on a second lint fails two of those tests.
  • tests/asbuilt.rs: each lint's module doc is at most 2000 bytes; every src/ module is still named in exactly one as-built doc.
  • make check-deslag: every touched Markdown file under its budget and the other lints.

References

lints.asbuilt.md had a section per lint, 3359 bytes of its 7500, and
most of it repeated the lint modules' doc comments. Each new lint added
a section to a doc that was full.

The sections are gone. The facts only they held move into the module
docs: the byte order mark that banned_chars skips, the order of allow,
ban and the groups, the defaults of repo_layout and density (named by
their constants), the empty max_emphasis table, that list_growth skips
a file the change did not edit, and that a file with no budget still
counts in the tally. The emphasis doc said a run of capitals is split
by spaces; the code splits on any whitespace.

A lint's doc comment is now its as-built description, so
tests/asbuilt.rs holds each one to 2000 bytes. The largest is 1703.
deslag.asbuilt.md was 8163 of its 8192 bytes, and its Tests section
grew with every change. The Tests section and the tests/ tree move to a
new tests.asbuilt.md, 2925 of 4096, which deslag.asbuilt.md indexes.
Build stays: it describes the repo as a whole and does not grow per
lint.

The proofs of one lint on the corpus move to the lint they prove: the
ratio of llm to human fixtures the default groups flag to
banned_chars.rs, the layouts read under real headings to
repo_layout.rs, and fix over the corpus to the Fixing section of
lints.asbuilt.md. tests.asbuilt.md keeps the harnesses.
The guide was 4996 of its 5000 bytes, and tests/instructions.rs made
it name every lint in a bullet and turn every lint on in its example.
Each new lint needed about 200 bytes the guide did not have.

`deslag instructions lints` prints a short intro, then a section per
lint in the order they run: what the lint fails, and one TOML table
that turns it on. Each section is its own file under
src/instructions/lints/, which an exhaustive match on Lint includes, so
a new lint does not compile until it has one. The heading is the
lint's id, from Lint::id.

The guide's per-lint bullets move to those files word for word, and
the tables of its example move with them. Step 3 of the guide now opens
with "Run `deslag instructions lints`" and keeps a short example.

tests/instructions.rs now checks that the topic has a section for
every lint, in order; that each section's one table fits the schema and
turns on its lint alone; that the tables together turn on every lint
and run clean; that the guide's example runs clean and names the
topic; and that the topic has no placeholder left.

.agents/deslag.toml lints the new files and holds each to 800 bytes.
#54 cut two things from step 6 of the guide to fit list_growth in its
budget: that --diff misses some failures, such as a path deleted from
under an untouched layout, and the pull_request job that runs
--diff HEAD^1 with fetch-depth: 2. README.md still says the guide
explains what --diff misses.

The guide has room again, so both come back, near their old words.
The guide is 4063 of its 5000 bytes.
@webern webern added the ai Primarily authored by AI (whether PR, Issue, Whatever) label Sep 27, 2026
@webern
webern merged commit 960fb05 into main Sep 27, 2026
2 checks passed
@webern
webern deleted the m/deslag-room branch September 27, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Primarily authored by AI (whether PR, Issue, Whatever)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant