Repository navigation
feat: print setup instructions for agents - #25
Merged
Merged
Conversation
webern
commented
Sep 24, 2026
Comment on lines
13
to
14
| # The published crate holds what a consumer needs to build it and nothing else. A list of what to | ||
| # keep, rather than what to drop, so a new file (the test corpus above all) cannot slip in. |
Owner
Author
There was a problem hiding this comment.
Garbage from a previous agent.
Suggested change
| # The published crate holds what a consumer needs to build it and nothing else. A list of what to | |
| # keep, rather than what to drop, so a new file (the test corpus above all) cannot slip in. |
Comment on lines
+2
to
+3
| # it. It covers the files an agent reads: AGENTS.md, the skills, and the guide `deslag instructions` | ||
| # prints. |
Owner
Author
There was a problem hiding this comment.
For the love of God, stop listing things (#16, which unfortunately can't cover code/config comments for yet)
Suggested change
| # it. It covers the files an agent reads: AGENTS.md, the skills, and the guide `deslag instructions` | |
| # prints. | |
| # it. |
Comment on lines
+96
to
+101
| Add this to AGENTS.md, or whichever file agents in this repository read first: | ||
|
|
||
| ```markdown | ||
| Run `deslag check` after editing Markdown, and fix what it reports. Do not change the deslag config | ||
| or a `max_size_bytes` in frontmatter unless a human asks you to. | ||
| ``` |
Owner
Author
There was a problem hiding this comment.
If appropriate in this project, make a note in AGENTS.md regarding the deslag check. Check with the user!
Add `deslag instructions`, which prints a guide for an agent setting deslag up in a repository: where the config goes, which files to lint, an example config that turns on every lint, how to measure and propose limits to the human, and how to wire deslag into CI and tell future agents about it. The config paths, extensions, schema version and deslag version are filled in from the code. Add `deslag instructions config-schema`, which prints the JSON schema of the config. schemars derives it from the types the config is read into, so a new setting shows up without a change here. The schema carries the real defaults and the ranges deslag checks. Tests hold the guide to every lint, the example config to every lint, every config deslag accepts in the cases to the schema, and a set of configs deslag refuses to the schema refusing them too. Lint the guide with this repo's own config, under a 5000 byte budget.
Drop the comment on Cargo.toml's include and the list of covered files from .agents/deslag.toml's header. The guide's last step no longer hands the agent a note to paste into AGENTS.md. It asks the agent to add one only if it suits the project, and to check with the human first.
webern
force-pushed
the
m/instructions
branch
from
September 24, 2026 17:26
4b32574 to
ecf4619
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human Summary
The idea here is that the agent itself can use the
deslag instructionscommand to understand how to set up a repo with deslag.Summary
Adds
deslag instructions, a command whose output is written for an agent rather than a person. Onboarding becomes:cargo install deslag, then tell your agent to rundeslag instructionsand follow them. The README says so in two lines.This one is a command, not a lint, so there is nothing to configure. The configurability work here is in the schema.
The guide
deslag instructionsprints a Markdown guide to standard output. It walks the agent through:deslag check, then proposing limits to the human with what each would fail;deslag checkinto CI;deslag checkto AGENTS.md.The rule running through it: the human owns the limits. The agent proposes them and never raises one, or adds an override or a frontmatter budget, just to get past a check.
The guide lives in
src/instructions/guide.mdand is compiled in withinclude_str!, soCargo.toml'sincludenow takes/src/**/*.mdtoo. The config paths, extensions, schema version and deslag version are filled in from the code. This repo's own deslag config lints the guide, with a 5000 byte budget, so it cannot bloat.The schema
deslag instructions config-schemaprints the JSON schema of the config, draft 7. It comes fromschemars(a new dependency, 1.2.2, which brings in 5 small crates) derivingJsonSchemaon the same types the config is read into, so a new lint or setting shows up in the schema without anyone remembering to add it. It serves TOML and YAML configs too, and editors can use it: taplo for TOML, yaml-language-server for YAML.What the derive does not know, I added by hand:
density, therepo_layoutdefaults,["*.md"]forglobs), instead of thenullthat#[serde(default)]produces;banned_charsgroup's default, which a test ties to theGROUPStable;max_percent0 to 100,densitylimits at least 1,schema_versionat most the version this build reads.Doc comments on the config types become the schema's descriptions, so I removed the rustdoc links and the "On by default" wording that the
defaultkeyword now carries.Room for #17
instructionstakes an optional topic as a subcommand. #17'sdeslag instructions --from 2 --to 6can be added as flags oninstructionswithout changing what exists. I have not built any of it.A small fix along the way
deslag instructions | headpanicked on the closed pipe. The command now writes to stdout and treats a broken pipe as success, since agents pipe output intoheadall the time.This PR is stacked on #23.
Testing
make ci: exit 0make check-publish: exit 0, and the package listssrc/instructions/guide.mdtests/instructions.rs, 9 tests:config-schemaprints the schema;deslag check, and fits the schema;tests/casesthat deslag accepts fits the schema;GROUPS.max_percent;References