Skip to content

Commit 03e77be

Browse files
committed
docs(weekly-audit): turn rule volume into a compression trigger
A size line alone changed nothing. A rule 20% past its last compressed size is now a Phase 4 item, and the procedure keeps the second review that caught the split's loading gaps after every mechanical check passed.
1 parent d531a0c commit 03e77be

4 files changed

Lines changed: 71 additions & 4 deletions

File tree

‎.claude/skills/weekly-audit/SKILL.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description: >-
99
Not for one reported bug (/hunt), a safety-sensitive diff (bugs), or a PR
1010
review (/check).
1111
metadata:
12-
version: "1.1.0"
12+
version: "1.2.0"
1313
---
1414

1515
# Weekly Audit (CLI)
@@ -99,7 +99,8 @@ scenario and the smallest fix.
9999
test such as `tests/core_performance.bats`.
100100
5. **Not yet codified.** In the commit window: an area fixed twice, a behavior
101101
fix with no test touched, a lesson living only in memory, an issue reply or
102-
one commit message, a rule repeated in several places or grown past use, and
102+
one commit message, a rule repeated in several places or grown more than 20% past the size recorded after
103+
its last compression (`references/rule-compression.md`), and
103104
fixes on one branch that SYNC.md should route to the other (a safety or
104105
correctness contract the other CLI shares) without a row there.
105106

@@ -152,8 +153,10 @@ candidate.
152153
Open, each with the question it waits on.
153154
- Commit identity and push follow the global Git Safety rules; contributor PRs
154155
keep their own review path.
156+
- An approved rule compression or split follows `references/rule-compression.md`; its second-agent meaning
157+
review is part of the fix, since the mechanical gates passed while 73 real losses remained (2026-10-17).
155158
- Prepend the run to `docs/weekly-audit.md` (audited and landed commits per
156-
branch, next window, fixed / decided / open) in the last `main` commit of the
159+
branch, next window, rule volume, fixed / decided / open) in the last `main` commit of the
157160
run.
158161

159162
## Output

‎.claude/skills/weekly-audit/references/prompts.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ whether it is already cached, pooled or gated (tests/core_performance.bats).
7171
```
7272
Window: git log <WINDOW>..HEAD on each branch. An area fixed twice, a behavior fix with no test touched,
7373
a lesson living only in memory, an issue reply or one commit message, a rule repeated in several places
74-
or grown past use, and fixes on one branch that SYNC.md should route to the other without a row.
74+
or grown more than 20% past the size recorded after its last compression in docs/weekly-audit.md, and fixes on one branch that SYNC.md should route to the other without a row.
7575
Say where each lesson should live.
7676
```
7777

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Rule compression
2+
3+
Read when the Not yet codified dimension flags rule volume, or before compressing or splitting `AGENTS.md`
4+
or a `.claude/rules` file for any reason. Proven on 2026-10-17, when this guide went from 89.7 KB to 30.5 KB by moving area
5+
sections into path rules.
6+
7+
## When
8+
9+
A file is a candidate when it is more than 20% larger than the size recorded after its last compression
10+
in `docs/weekly-audit.md` (record the size the same day you compress). Reporting a size is not enough:
11+
a file reported in two runs without a Phase 4 item stayed as it was. Compression is a Phase 4 item like any other: it needs the maintainer's approval of the batch.
12+
13+
## Contract
14+
15+
The header of `AGENTS.md` is the contract: keep each rule's invariant, scope and why, plus failure
16+
mechanism, measured numbers, counterexamples, locked test names, rejected alternatives, maintainer
17+
decisions with their dates and every failure-recovery step. Remove narration, timelines and repeated
18+
receipts. Per-case detail (one app, one tool, one incident) may move to the matching `.claude/references`
19+
file with a one-line pointer; moving is not deleting. Never delete a rule because a personal global file
20+
says the same: the repo's guides are the complete contract. Keep `paths:` frontmatter byte-identical.
21+
22+
## Steps
23+
24+
1. Save each original to the scratchpad with `git show HEAD:<path>` and record `wc -w` / `wc -c`.
25+
2. One agent per file, each told to touch only its file and the reference file it moves detail to, and to
26+
stop if `git diff --stat -- <file>` is not empty before its final write (other sessions share the tree).
27+
3. Mechanical gates, all from the agents and rerun by the main session:
28+
no lock checker exists here: grep every test name the original names after "Locked by" in `tests/` and `cmd/`;
29+
every backticked token of the original still appears in the file or its reference destination; no
30+
U+2014; the size before and after.
31+
4. Independent meaning review, mandatory: a different agent diffs `git show <commit>^:<path>` against the
32+
new file and reports dropped or changed constraints, each refuted once by searching the file, its
33+
references, `AGENTS.md` and sibling rules. On 2026-10-17 every mechanical gate passed and this review
34+
still found 73 real losses across the four rule sets compressed that day, none dangerous, many medium. The recurring
35+
shapes, to look for first:
36+
- a "why" deleted where it was the only thing stopping a plausible wrong fix;
37+
- a list of conditions cut to its first item;
38+
- scope widened or narrowed;
39+
- the maintainer's name and date removed, so a settled decision reads as reopenable;
40+
- a claim the compressor invented: a rounded number, a generalisation from one incident, or a
41+
narrowing the code does not make (the split here wrote that the installer pins `SCRIPT_DIR=`, which
42+
it rewrites).
43+
5. Restore each surviving loss by putting the original wording back, then rerun the gates.
44+
6. Before syncing a shared checkout, compare the originals with `origin/main`: a session that edited the same
45+
rule while you compressed it leaves a sync conflict. Take its added words with
46+
`git diff --word-diff=plain HEAD origin/main -- <file>`, apply them to the compressed text, restore the file
47+
to HEAD, sync, then write the merged text back.
48+
49+
## Splitting a guide into path rules
50+
51+
- Every glob in `paths:` must match a real file: test each against `git ls-files`. A rule whose globs match
52+
nothing never loads.
53+
- A rule that must apply before any file is edited (triage, PR review, release, announcements, replies) stays
54+
in `AGENTS.md` or gets an explicit "read X before ..." line there naming every trigger; the CLI split first
55+
loaded `github.md` only at reply time, after a fix already existed.
56+
- A contract between two files (an app shape the uninstall inventory accepts must also pass Clean's scan)
57+
goes into the rules of both sides, and a rule follows the file that holds its code, not the feature name.
58+
- The routing table in `AGENTS.md` names every rule file for runtimes that do not load `.claude/rules`.

‎docs/weekly-audit.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
One entry per run of `.claude/skills/weekly-audit`, newest first, covering Mole CLI (macOS) on `main` and Mole CLI (Windows) on `windows`. The next run reads the newest entry for its commit window (`Next window from`), for the items it must not report again (`Decided, do not re-report`), and rechecks `Open` first. Facts here are a run record; lasting invariants live in `AGENTS.md` on each branch.
44

5+
## 2026-10-17 (rule split, not a weekly run)
6+
7+
- Next window from: unchanged, main `e78caf97` and windows `9bbebb89` from the 2026-10-16 entry below.
8+
- `cb32af9f` moved area sections of AGENTS.md (89.7 KB to 30.5 KB) into 12 path rules. A second-agent review found no lost sentence but six loading gaps, fixed in `d531a0c4`: `github.md` was read only at reply time, after a fix already existed, and three rules sat under globs that miss their code.
9+
- Rule volume after the split, the baseline for the 20% trigger in `.claude/skills/weekly-audit/references/rule-compression.md` (bytes): AGENTS.md 30,745, `clean.md` 15,486, `uninstall.md` 10,140, `install-update.md` 7,979; AGENTS.md plus `.claude/rules` 99,723.
10+
511
## 2026-10-16 (first run)
612

713
- Audited: main `eb531ba2`, windows `159657d5`.

0 commit comments

Comments
 (0)