Skip to content

feat: add deslag-corpus, which measures the corpus - #55

Merged
webern merged 7 commits into
mainfrom
m/deslag-analyze
Sep 27, 2026
Merged

webern merged 7 commits into
mainfrom
m/deslag-analyze

Conversation

@webern

@webern webern commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Summary

This adds a second crate to the repository, deslag-corpus in tools/corpus/, and makes the repository a cargo workspace. It is never published: deslag takes it as a path-only dev-dependency, which cargo drops from the package, so make check-publish still packages deslag alone. The corpus loaders move into it from tests/common/, which now calls them, so the tests and the new tool read the corpus through the same code.

deslag has chosen its thresholds and banned phrases by ear. The corpus now holds the evidence to choose them, and the crate's binary measures it: which characters and phrases set llm files apart from human ones, and how often each lint fails each label. Every statistic counts the tokens deslag's Document gives, so a phrase it names is one banned_phrases can ban as it stands. A test bans each one on the tree and checks that it matches exactly the files the tool claimed.

The commands, each over one tier, --tier tree (the default) or --tier blobs:

  • summary: files and repositories by label, kind, language, batch, quarter, register and tool.
  • chars: the characters outside ASCII in English prose, by banned_chars group and one by one, llm against human.
  • ngrams: runs of prose tokens, as banned_phrases matches them, ranked by the lower bound of their ratio's interval.
  • candidates: the view of ngrams that could become banned phrases, with a funnel of each step of its sieve, word counts, masked examples, and the catalog gate.
  • lints: what a config's lints fail, per label and per tool. Each file is checked through check_file at its path in the repository it came from, so overrides apply. repo_layout is left out, and so is each lint whose reads_change() is true, such as list_growth: it is taken out of the config, since a corpus file has no base.
  • report: the four above as one Markdown page, for a pull request that grows the corpus to carry. Its lints run at tools/corpus/report.toml, which selects every fixture and holds the lint settings of .agents/deslag.toml with no budget; the page's header names the config.

Each prints tables, or JSON with --json, which opens with the image digest or the tree's commit and the filters. Two runs print the same bytes. deslag-corpus --help lists the flags; the filters are --kind, --batch, --repo, --language, --quarter, --single-tool and --register, and --tool compares one tool's files with the other tools'.

How the numbers are made, in short (docs/design/analysis.md has the reasons):

  • The repository is the unit. A harvest keeps up to 50 files of a label from one repository, so every floor counts repositories, every rate is per million prose tokens with each repository weighing once, and no one repository may hold more than 25% of a candidate's files.
  • A ratio is ranked by the lower bound of a 95% interval from resampling repositories, so a phrase that few repositories carry does not rank high however large its ratio.
  • Words are flagged, not guarded. The human side predates 2022, so era and topic words such as mcp look like tells; a word fewer than 20 human files hold is flagged rare, and a person decides.

Sentence length (#33) is an ignored test in tests/corpus.rs, not a command. Structural patterns such as <verb>s no <noun> wait for a matcher in the library.

Measurements on v2

All on ghcr.io/webern/deslag-blobs:v2@sha256:33d0d99e2d588f31d7d69563d62599486bcd1e89fe8efcfed6fcdf047d6fca00, 21,891 live fixtures, from a release build. The machine was busy with other work (load average 5 to 7), so the times may be high.

command time peak memory
summary 8.4 s 637 MB
chars 7.4 s 640 MB
ngrams 10.3 s 742 MB
candidates --top 50 11.5 s 794 MB
lints 7.8 s 640 MB
report 12.6 s 764 MB

About 8 s of each is reading the tier: checking every fixture against its sidecar, then tokenizing it. On the tree every command takes under a second.

summary

labels (counts, unweighted)

label files repos en files en repos MB prose tokens words sentences tokens/file q1 med q3 twins
human 11873 1247 10200 1192 65.5 7206096 5872513 711687 86 236 595 0
llm 9199 862 7709 805 73.3 9479847 7459177 856653 219 529 1139 0
mixed 819 440 693 410 10.4 1156974 933515 118794 323 727 1628 474

tools: files (repos); a tool is compared when it alone marked llm files in 25 repositories

tool llm alone llm any mixed any compared
aider 49 (2) 49 (2) 0 (0) no
amp 303 (36) 353 (40) 4 (4) yes
claude-code 4970 (538) 5414 (575) 582 (317) yes
codex 465 (57) 624 (71) 22 (16) yes
copilot 1464 (136) 1533 (146) 187 (123) yes
cursor 683 (86) 767 (89) 87 (49) yes
devin 261 (35) 332 (39) 5 (3) yes
gemini 0 (0) 0 (0) 1 (1) no
generic-agent 0 (0) 17 (17) 18 (18) no
jules 189 (27) 205 (30) 5 (4) yes
kiro 57 (4) 77 (4) 0 (0) no
opencode 97 (15) 136 (18) 0 (0) no
openhands 188 (21) 190 (22) 0 (0) no
The whole of summary
labels (counts, unweighted)
label  files  repos  en files  en repos    MB  prose tokens    words  sentences  tokens/file q1 med q3  twins
human  11873   1247     10200      1192  65.5       7206096  5872513     711687             86 236 595      0
llm     9199    862      7709       805  73.3       9479847  7459177     856653           219 529 1139      0
mixed    819    440       693       410  10.4       1156974   933515     118794           323 727 1628    474

kinds: files (repos)
value                    human         llm      mixed
agent-instructions       1 (1)   221 (154)      1 (1)
agent-skill              0 (0)  1297 (247)      0 (0)
blog                  300 (33)    107 (20)     14 (2)
changelog            685 (328)     86 (61)    84 (65)
contributing         361 (335)     62 (53)    58 (58)
design                 80 (25)    393 (71)      5 (2)
docs                3853 (321)  2524 (368)   154 (65)
other               2482 (419)  3061 (443)   151 (56)
planning             183 (114)   591 (190)      7 (6)
project-policy         97 (83)     58 (54)      4 (4)
readme              3831 (949)   799 (295)  341 (265)

languages: files (repos)
value         human         llm      mixed
en     10200 (1192)  7709 (805)  693 (410)
none       122 (46)      12 (8)      2 (2)
other    1551 (288)  1478 (271)   124 (43)

batches: files (repos)
value                human         llm      mixed
2026-09-27-01    400 (400)   196 (196)  220 (220)
2026-09-27-02  11473 (873)  9003 (677)  599 (238)

quarters of the commit quoted: files (repos)
value         human         llm      mixed
2014Q4        3 (2)       0 (0)      0 (0)
2015Q2        1 (1)       0 (0)      0 (0)
2015Q4        1 (1)       0 (0)      0 (0)
2016Q3        1 (1)       0 (0)      0 (0)
2017Q1        5 (3)       0 (0)      0 (0)
2017Q2        4 (1)       0 (0)      0 (0)
2017Q3        2 (1)       0 (0)      0 (0)
2017Q4       51 (2)       0 (0)      0 (0)
2018Q1        6 (2)       0 (0)      0 (0)
2018Q2       12 (6)       0 (0)      0 (0)
2018Q3        5 (5)       0 (0)      0 (0)
2018Q4        4 (4)       0 (0)      0 (0)
2019Q1        5 (5)       0 (0)      0 (0)
2019Q2       11 (6)       0 (0)      0 (0)
2019Q3        9 (8)       0 (0)      0 (0)
2019Q4        8 (6)       0 (0)      0 (0)
2020Q1       15 (5)       0 (0)      0 (0)
2020Q2      53 (12)       0 (0)      0 (0)
2020Q3      96 (21)       0 (0)      0 (0)
2020Q4      44 (20)       0 (0)      0 (0)
2021Q1     101 (36)       0 (0)      0 (0)
2021Q2     150 (46)       0 (0)      0 (0)
2021Q3    482 (103)       0 (0)      0 (0)
2021Q4  10781 (939)       0 (0)      0 (0)
2022Q1       21 (9)       0 (0)      0 (0)
2022Q4        2 (2)       0 (0)      0 (0)
2025Q2        0 (0)       2 (1)      0 (0)
2025Q3        0 (0)      31 (4)      2 (2)
2025Q4        0 (0)      23 (6)      2 (2)
2026Q1        0 (0)    298 (31)     12 (9)
2026Q2        0 (0)    720 (80)    44 (31)
2026Q3        0 (0)  8125 (740)  759 (396)

registers: files (repos)
value            human         llm      mixed
outside     1546 (122)    970 (70)    85 (22)
software  10327 (1125)  8229 (792)  734 (418)

tools: files (repos); a tool is compared when it alone marked llm files in 25 repositories
tool            llm alone     llm any  mixed any  compared
aider              49 (2)      49 (2)      0 (0)        no
amp              303 (36)    353 (40)      4 (4)       yes
claude-code    4970 (538)  5414 (575)  582 (317)       yes
codex            465 (57)    624 (71)    22 (16)       yes
copilot        1464 (136)  1533 (146)  187 (123)       yes
cursor           683 (86)    767 (89)    87 (49)       yes
devin            261 (35)    332 (39)      5 (3)       yes
gemini              0 (0)       0 (0)      1 (1)        no
generic-agent       0 (0)     17 (17)    18 (18)        no
jules            189 (27)    205 (30)      5 (4)       yes
kiro               57 (4)      77 (4)      0 (0)        no
opencode          97 (15)    136 (18)      0 (0)        no
openhands        188 (21)    190 (22)      0 (0)        no

chars

the English llm files, against the English human files; rates per million prose tokens, each repository weighing once.

banned_chars groups

group focus files (repos) focus rate reference files (repos) reference rate ratio 95% low 95% high
dashes 4114 (560) 7105.6 427 (188) 700.0 10.1 4.2 38.9
arrows 2228 (418) 1739.7 106 (52) 80.4 21.6 11.9 56.0
ellipsis 515 (164) 112.4 60 (39) 10.6 10.6 6.5 19.9
bullets 368 (112) 252.2 33 (28) 48.0 5.2 2.5 15.5
math 858 (230) 264.8 33 (19) 6.7 39.2 18.7 149.5
checks 590 (179) 653.2 109 (56) 470.9 1.4 0.7 3.5
section 485 (109) 174.4 4 (4) 0.5 287.9 124.9 1460.6
box_drawing 7 (7) 9.4 3 (3) 4.3 2.2 0.2 116.2
spaces 6 (5) 2.3 100 (66) 114.9 0.0 0.0 0.1
invisible 2 (2) 0.4 21 (15) 9.3 0.1 0.0 0.6
quotes 206 (84) 169.3 722 (263) 621.0 0.3 0.2 0.4
emoji 558 (158) 463.7 517 (214) 1629.1 0.3 0.2 0.5
none 720 (193) 2001.4 402 (225) 2536.2 0.8 0.4 2.0

characters, most frequent in the focus side first

char code group focus files (repos) focus rate reference files (repos) reference rate ratio 95% low 95% high
— U+2014 dashes 4005 (550) 6741.0 249 (117) 507.2 13.3 4.7 107.4
→ U+2192 arrows 2162 (406) 1685.1 64 (37) 52.1 32.3 15.8 102.9
✅ U+2705 checks 463 (154) 441.8 74 (31) 266.2 1.7 0.7 5.6
– U+2013 dashes 921 (235) 340.4 201 (109) 190.9 1.8 0.9 4.2
· U+00B7 bullets 348 (103) 243.7 15 (12) 25.6 9.5 4.5 32.5
§ U+00A7 section 485 (109) 174.4 4 (4) 0.5 287.9 124.9 1460.6
× U+00D7 math 472 (156) 141.6 6 (3) 1.1 117.9 39.7 1586.7
❌ U+274C checks 232 (104) 132.1 54 (16) 50.3 2.6 1.0 15.9
… U+2026 ellipsis 511 (164) 111.7 60 (39) 10.6 10.5 6.4 19.7
️ U+FE0F emoji 286 (104) 67.5 158 (95) 151.9 0.4 0.3 0.8
” U+201D quotes 147 (60) 66.8 231 (126) 145.9 0.5 0.2 0.9
“ U+201C quotes 144 (60) 66.6 228 (124) 142.9 0.5 0.2 0.9
✓ U+2713 checks 98 (54) 59.9 7 (7) 97.8 0.6 0.2 26.0
⚠ U+26A0 emoji 236 (93) 49.2 75 (46) 51.1 1.0 0.5 2.0
≥ U+2265 math 305 (116) 43.9 8 (3) 2.3 18.6 6.3 464.1
≤ U+2264 math 194 (90) 41.8 11 (3) 2.0 20.5 6.1 495.2
’ U+2019 quotes 123 (48) 35.5 652 (244) 307.8 0.1 0.1 0.2
é U+00E9 - 54 (25) 33.3 44 (37) 19.9 1.7 0.4 4.5
、 U+3001 - 15 (7) 28.1 13 (12) 24.5 1.1 0.1 7.0
↔ U+2194 arrows 156 (78) 28.1 1 (1) 0.1 199.3 91.0 447.4

candidates

the English llm files, against the English human files; rates per million prose tokens, each repository weighing once. Ranked by the lower bound of a 95% interval from resampling repositories. Compared tools: amp, claude-code, codex, copilot, cursor, devin, jules.

funnel

step left
n-grams of 1 to 4 tokens in at least 10 focus repositories 57304
no one repository holds more than 25% of its focus files 51403
no human file in the tree holds it 29133
the interval's lower bound is at least 4 6895
focus files of at least 3 compared tools hold it 6074
after merging each n-gram into a shorter one it holds 4935

The catalog gate, n-grams through the sieve that no reference file holds, in any language, and at least 40 focus repositories do, merged among themselves: 104, of which 53 hold no rare word.

mcp, claude code, llm, copilot, worktree, this skill, agents.md, claude.md, 2026-09, 2026-07, 2026-08, ai agent, anthropic, date: 2026, subagent, to claude, 2026-06, system prompt, seam, ai agents, 2026-03, skill's, agentic, guardrails, skill.md, skill is, load-bearing, success criteria, on 2026, byte-identical, subagents, for claude, needs no, 2026-04, 2026-05, coding agents, nothing here, do not invent, dedup, the committed, is refused, deliberately not, no per, context window, why it matters, coding agent, ships a, restate, follow-ups, fail-closed, falls back to the, collapses, the stale, reads it, exit 0, proves the, lands on, says so, per-session, verdicts, the 2026, not silently, stays a, reviewable, handed to, folds, not hand, or explicit, row per, not merely, evidence and, human review, no second, explicit user, carries its, substitutes, an unrelated, 2–3, per run, exits 0, 1–2, need no, survived, all six, not evidence, why this matters, absent from the, never silently, is untouched, cites, all five, gap is, only — no, of 2026, it carries, wired into, supplies the, no live, carry no, already carries, is authoritative, gains a, it lands, state, not

candidates

phrase focus files (repos) focus rate reference files (repos) reference rate ratio 95% low 95% high top repo tools rare words
claude 748 (225) 490.0 0 (0) 0.0 5751.5 4169.9 7521.6 5% 7 claude
mcp 630 (174) 484.5 0 (0) 0.0 5687.1 4111.9 7394.3 4% 7 mcp
llm 331 (146) 192.0 0 (0) 0.0 2253.7 1655.4 2973.6 6% 7 llm
copilot 291 (96) 156.4 0 (0) 0.0 1837.0 1083.9 2726.4 6% 7 copilot
worktree 296 (94) 151.5 0 (0) 0.0 1778.8 881.3 3122.0 6% 6 worktree
agents.md 160 (91) 138.0 0 (0) 0.0 1620.2 691.8 3046.8 11% 6 agents.md
verdict 460 (128) 80.0 1 (1) 0.0 876.3 520.7 1340.5 4% 5 verdict
claude.md 147 (78) 83.4 0 (0) 0.0 979.5 513.8 1641.6 10% 5 claude.md
codex 300 (98) 109.9 1 (1) 0.0 967.4 508.5 1688.4 6% 6 codex
2026-09 276 (75) 59.8 0 (0) 0.0 703.2 414.4 1022.7 9% 7 2026
2026-07 307 (76) 50.1 0 (0) 0.0 588.7 386.6 801.1 8% 6 2026
2026-08 296 (83) 52.8 0 (0) 0.0 620.6 377.2 960.8 8% 7 2026
ai agent 114 (70) 74.0 0 (0) 0.0 869.8 375.1 1599.5 7% 5 -
anthropic 133 (69) 67.8 0 (0) 0.0 797.2 369.3 1442.7 7% 6 anthropic
date: 2026 413 (104) 43.4 0 (0) 0.0 510.2 349.1 710.8 8% 6 2026
subagent 156 (62) 58.9 0 (0) 0.0 692.2 346.7 1068.7 12% 6 subagent
2026-06 222 (70) 49.8 0 (0) 0.0 586.0 291.2 998.1 7% 6 2026
system prompt 91 (55) 41.1 0 (0) 0.0 483.5 244.7 775.7 13% 7 -
seam 213 (76) 29.1 0 (0) 0.0 342.4 217.7 499.2 7% 6 seam
ai agents 127 (66) 40.6 0 (0) 0.0 477.9 214.2 789.6 23% 7 -
2026-03 87 (42) 46.5 0 (0) 0.0 546.2 210.7 956.3 10% 7 2026
skill's 124 (70) 30.4 0 (0) 0.0 357.4 210.6 518.1 6% 6 skill's
agentic 194 (66) 31.3 0 (0) 0.0 368.2 194.4 601.8 7% 6 agentic
guardrails 139 (70) 24.8 0 (0) 0.0 292.6 182.0 430.0 8% 6 guardrails
phase 2 288 (128) 64.8 3 (3) 0.1 325.5 164.5 764.1 4% 7 -
skill.md 77 (49) 45.1 0 (0) 0.0 530.4 163.8 1056.0 8% 5 skill.md
implementation plan 240 (75) 27.1 1 (1) 0.0 277.0 162.5 439.7 7% 6 -
open a public 30 (26) 32.7 0 (0) 0.0 385.3 158.8 658.7 7% 5 -
success criteria 144 (60) 21.9 0 (0) 0.0 258.5 145.5 406.1 10% 6 -
on 2026 173 (78) 19.8 0 (0) 0.0 233.1 142.8 358.6 6% 6 2026
byte-identical 184 (71) 22.8 0 (0) 0.0 268.4 137.2 471.1 6% 6 -
bun 72 (32) 34.6 0 (0) 0.0 406.7 135.9 802.2 22% 5 bun
subagents 92 (43) 29.1 0 (0) 0.0 342.5 135.7 661.4 9% 5 subagents
2025 185 (85) 74.8 5 (5) 0.2 303.9 135.2 735.9 8% 5 2025
tool calls 124 (62) 24.0 1 (1) 0.0 239.0 131.6 386.5 7% 6 -
an ai 143 (82) 47.1 1 (1) 0.0 401.7 131.4 975.2 16% 7 -
tool call 117 (59) 47.6 1 (1) 0.0 368.2 127.2 885.9 14% 6 -
needs no 154 (79) 16.2 0 (0) 0.0 190.8 123.5 264.0 5% 5 -
2026-04 125 (46) 23.6 0 (0) 0.0 278.3 122.9 492.6 7% 6 2026
2026-05 159 (49) 18.0 0 (0) 0.0 211.8 122.1 307.2 14% 7 2026
coding agents 65 (46) 18.4 0 (0) 0.0 216.6 117.7 346.1 6% 5 -
nothing here 104 (54) 26.0 0 (0) 0.0 306.1 117.5 530.2 14% 5 -
agent skills 41 (26) 31.4 0 (0) 0.0 369.3 115.1 672.1 10% 6 -
preservation 100 (72) 23.0 1 (1) 0.0 227.1 113.9 373.5 7% 7 preservation
dedup 83 (48) 35.2 0 (0) 0.0 414.1 111.4 909.1 10% 5 dedup
multi-turn 24 (19) 42.0 0 (0) 0.0 494.0 110.4 1059.2 12% 4 -
the committed 98 (59) 15.4 0 (0) 0.0 181.7 102.5 278.6 8% 6 -
1: write 73 (23) 16.5 0 (0) 0.0 194.1 98.0 305.7 14% 3 -
is refused 151 (45) 20.0 0 (0) 0.0 235.3 95.6 450.9 15% 5 refused
deliberately not 97 (58) 17.4 0 (0) 0.0 205.3 94.1 364.4 9% 4 -

The catalog gate counts 104 phrases, 53 of them with no rare word; every one of those 53 is two tokens or more. At 50 repositories it would count 52, 27 with no rare word. The flag misses topic phrases of common words, such as system prompt and context window, so fewer than 53 are tells of prose.

The gate runs on each n-gram through the first five steps of the sieve, then merges only among the phrases it keeps, so a longer phrase it keeps never hides under a shorter one it drops. Merging first, as the candidate list does, hid 21 of the 104: load-bearing (0 human files) under bearing (4 human files), and claude code, this skill, why it matters, do not invent, wired into and 15 more. 7 of the 21 hold no rare word, which takes that count from 46 to 53.

Sentence length (#33)

The median coefficient of variation of sentence length in a file, over files of 10 sentences or more:

sentences of tier human llm mixed
all prose tree 0.795 0.751 0.775
all prose v2 0.741 0.768 0.761
paragraphs tree 0.548 0.578 0.544
paragraphs v2 0.511 0.606 0.540

Over all prose the claim that llm sentences are more even holds on the tree and reverses on v2. Over paragraphs, llm prose varies more on both tiers. No lint follows; the full tables and the recommendation are in a comment on #33.

lints

At tools/corpus/report.toml, the config report uses: every fixture, each at its path in the repository it came from, under the lint settings of .agents/deslag.toml with no budget. repo_layout and list_growth are left out.

failing files by label: failing/checked, file share (repository-weighted share)

lint human llm mixed
max_emphasis 2612/11873 22.0% (23.0% of repos) 5654/9199 61.5% (59.7% of repos) 354/819 43.2% (45.2% of repos)
banned_chars 2026/11873 17.1% (18.7% of repos) 5804/9199 63.1% (62.3% of repos) 435/819 53.1% (54.9% of repos)
density 1881/11873 15.8% (16.5% of repos) 2833/9199 30.8% (26.9% of repos) 282/819 34.4% (38.1% of repos)
any 4843/11873 40.8% (42.2% of repos) 7364/9199 80.1% (79.4% of repos) 596/819 72.8% (75.5% of repos)

Under .agents/deslag.toml itself, lints checks only the fixtures its globs select, at those paths, and runs without list_growth, which that config sets for AGENTS.md and the skills.

Testing

  • make ci: exit 0 in 134 s with the build warm, against 94.6 s measured before the first change of this branch; 179 s just after the rebase onto main, when it rebuilt everything. The machine was busy (load average 5 to 7). The new crate's tests add about 17 s: tools/corpus/tests/tree.rs 14.4 s and golden.rs 2.8 s; tests/corpus.rs, which this branch does not change, took 44 s.
  • make check-publish: exit 0; it packages deslag alone, 40 files
  • Each commit passes clippy over the workspace and deslag check --base origin/main
  • lints runs under .agents/deslag.toml, which sets list_growth on paths the tree's fixtures hold, and leaves it out
  • make fix-golden rewrites tests/golden/ and tools/corpus/tests/golden/
  • Every command on the tree and on v2
  • The round trip: 500 n-grams and every candidate on the tree, each banned with banned_phrases, match exactly the files the tool names
  • sentence_lengths_by_label on the tree and v2

References

Make the repository a cargo workspace with one new member,
tools/corpus, the crate deslag-corpus. It is never published.

The sidecar types and the loaders of both corpus tiers move there from
tests/common/, which now calls them. The loaders return the first
broken rule as a Problem instead of panicking, so the analysis tool
that follows reads the corpus through the same code the tests use. The
rules and their messages are unchanged.

deslag takes the crate as a path-only dev-dependency, which cargo drops
from the package, so check-publish still packages deslag alone. The
lints and rust-version move to the workspace. Every cargo call in the
Makefile covers the workspace but check-publish, which names deslag.
cargo metadata now lists two packages, so the release workflow picks
the one that publishes instead of the first.

AGENTS.md's layout merges tests/corpus/ into tests/ to make room for
tools/corpus/ within its 12 entries.

deslag.asbuilt.md is reworded to fit its budget with the new layout
entry, dropping text that its frontmatter or another doc states.
deslag-corpus becomes a binary as well as a library. Each command
reads one tier of the corpus, the tree or the big tier, and prints
tables or, with --json, JSON that opens with what was measured: the
image digest or the tree's commit, and the filters.

summary counts files and repositories by label, kind, language,
batch, quarter, register and tool. chars counts the characters
outside ASCII in English prose, as banned_chars finds them, and
compares the llm files with the human ones.

A comparison weighs each repository once: a rate is per million
prose tokens, averaged over repositories, and a ratio's interval
comes from resampling repositories. Files are read and tokenized
once, over every thread, with the same result as on one.
ngrams counts runs of prose tokens as banned_phrases matches them:
within one block and one sentence, starting and ending with a word
or a number. It keeps a run found in at least 10 llm repositories
and ranks it by the lower bound of its ratio's interval, so a phrase
that few repositories carry does not rank high.

candidates is the view of ngrams that could become banned phrases.
It keeps a phrase no one repository owns, no human file of the tree
holds, whose interval's lower bound is at least 4 and that the files
of at least three tools hold, and merges each phrase into a shorter
one it holds. Each candidate shows its human file counts by word,
with words few human files hold flagged, and masked examples.

It also counts the catalog gate: the phrases through the first five
steps that no human file holds, in any language, found in at least 40
llm repositories. The gate runs before the merge and merges only the
phrases it keeps, so load-bearing does not hide under bearing, which
four human files hold.
lints runs a config's lints over the corpus and prints, for each
lint, how many files of each label and of each tool it fails, by
file and weighed by repository, with the paths. Each file is checked
through check_file at its path in the repository it was quoted from,
so the config's overrides apply as they would there. repo_layout is
left out, since the corpus does not hold the files around a file. So
is each lint that judges a change, such as list_growth: it is taken
out of the config, since a corpus file has no base. The config is the
one deslag finds, or --config; --every-file checks the files its
globs do not select too.

report prints summary, chars, candidates with the catalog gate, and
lints as one Markdown page, for a pull request that grows the corpus
to carry. Its lints run at tools/corpus/report.toml, which selects
every file and holds the repository config's lint settings, so the
human files are measured too. The page names the config.
golden.rs writes a small corpus to a temporary directory, a big tier
of one batch with a ledger and a tree beside it, runs every command
of the binary on it and compares the output with a file under
tools/corpus/tests/golden/. A second run must print the same bytes.
make fix-golden now rewrites these files too.

tree.rs runs every command on the tree. Its round trip bans each of
500 n-grams and every candidate with banned_phrases, and requires
each to match in exactly the files deslag-corpus says hold it. It
also checks that the sieve keeps what it says, that no human file of
the tree holds a candidate, that the summary adds up, that lints run
under the repository's config though it sets list_growth, and that
report checks every file.
sentence_lengths_by_label is ignored, and prints rather than checks.
For each file of 10 sentences or more it takes the coefficient of
variation of sentence length, in words and numbers, and prints its
quartiles by label: over all prose, over paragraphs alone, and with
each sentence that ends in an abbreviation joined to the next. It
prints the one threshold that best parts llm files from human ones.

It runs on the tree, and on the big tier when make fetch-blobs has
unpacked it. Run it by name with --ignored and --nocapture.
analysis.asbuilt.md describes deslag-corpus's commands and modules,
and analysis.md gives the reasons behind its numbers: the repository
as the unit, the ranking by an interval's lower bound, words flagged
rather than guarded, the sieve and the catalog gate, and what #33's
measurement found. analysis.md has its own budget in the config.

AGENTS.md and deslag.asbuilt.md now point to the analysis.
ACKNOWLEDGEMENTS.md credits slop-lint, slop-forensics and
llm-excess-vocab for methods, not code.
@webern webern added enhancement New feature or request ai Primarily authored by AI (whether PR, Issue, Whatever) area/build Deals with deslag build, scripts, ci, cd. labels Sep 27, 2026
@webern
webern merged commit e12b6d5 into main Sep 27, 2026
2 checks passed
@webern
webern deleted the m/deslag-analyze branch September 27, 2026 11:00
@webern webern mentioned this pull request Sep 27, 2026
4 tasks done
webern added a commit that referenced this pull request Sep 27, 2026
## Summary

`banned_phrases` until now banned nothing by default: an adopter who
wanted phrase lints wrote a list from memory, with nothing behind any
entry. This PR gives it groups, like `banned_chars` has: `signposts`,
`insistence`, `metaphors` and `precision`, each on by default and
switched under `[md.lints.banned_phrases.groups]`. The report names the
group beside the phrase so a user can switch one off by name.

Every entry carries the evidence that put it in. It was measured on the
corpus image `measured_on` names: zero `human` files out of 11,873 (a
rule-of-three upper bound of about 0.03%), and `llm` files in at least
40 repositories. CI no longer takes those numbers on faith: `make
test-blobs` re-derives every count against the pinned image and fails on
drift, and `make fix-catalog` rewrites the file when the image moves. A
phrase whose evidence decays is removed and joins the refused list.

The matcher keeps its old semantics: a user's `ban` beats the
catalogue's advice and never turns a load error, `allow` of a catalogue
phrase stays legal (that is how a human switches one entry off), and no
token is reported twice. Group checks apply only where the phrase
matcher already applied.

Candidates considered and refused are recorded in
`tools/corpus/rejected.toml` with reasons — words people write in 2026,
prompt text rather than prose, rare words, and common English that sits
at zero only because the corpus's human tier is older prose. The
`candidates` tool skips both the catalogue and the refused list.

## Testing

- [x] `make ci`: exit 0
- [x] `make test-blobs`: every recorded count re-derived on the pinned
image, exact match
- [x] tree corpus: each group matches zero human fixtures and at least
five llm fixtures
- [x] case tests: group hit, group off, ban beating the catalogue, allow
of a catalogue phrase, overlap

## References

- Progresses #17: each entry ships a `since`, the first piece of not
opting an updating user into new checks unknowingly
- Builds on the phrase matcher from #41 and the corpus analysis from #55
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) area/build Deals with deslag build, scripts, ci, cd. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Measure whether sentence length tells LLM text from human text

1 participant