Repository navigation
perf(loop): budgets, STE, and grounding from the body not the thread - #48
Conversation
Measured before designing, and the measurement moved the target twice.
skills loaded every run (preflight + work-routine + journal + config)
~148,600 tokens/day
every bot comment ever written, in total
~152,000 tokens
The rules cost as much each day as every comment the loop has ever written.
The output was never the largest line. Two more findings reversed assumptions:
bot ticket bodies are SHORTER than the reviewer's (4,854 vs 5,610), and a
journal thread reached 134,000 characters — one returned 97,279 in a single
response and broke the run that read it.
**Reading.** triage-issue always said "comments are conversation, the body is
state"; nothing enforced it. Now preflight does: ground from the body, read
comments only to find feedback inside the window, and never call get_comments
on a journal issue. Grounding a ticket drops from ~27,000 chars to ~8,600, and
it changes nothing already written.
**Budgets.** The old rule — "past roughly fifteen lines outside a <details>, it
is an essay" — failed in both directions. 51% of bytes had migrated inside
<details> where it did not reach, and the visible half still ran to 3,364 chars.
workflow/lib/budget.mjs counts the whole artefact, <details> included, and
returns over or under with no clause permitting an explained overage. That
clause is what the old rule died of. Bodies stay unbudgeted: they are state,
and the grounding rule depends on them.
**Register.** The ~8 ASD-STE100 rules that drive length are vendored into
preflight, ~600 chars. The upstream skill is 16,260 — loading it eleven times a
day would cost more than the brevity it buys, and it is a single-contributor
@main dependency for a plugin holding write access to five repos. ste-lint.py
is vendored (MIT) as a local dev check, never a run step.
**Journal.** One rewritten document per day, no comments at all. Two rewritten
surfaces holding the same accumulated content would be the duplication this
repo exists to avoid. ~33,000 tokens/day to ~2,500 chars. Evidence blocks are
required for failures and friction and banned for merges and CI status, which
GitHub records natively.
**Skills.** One aggressive pass: STE fixes, deduplication, and stories moved to
why.md behind anchors. The three run-loaded skills drop 10,526 chars per run —
about 29,000 tokens a day.
The rule-delta check earned its place. Lint would have passed silently while
"never read the board back" went missing in the journal rewrite; the delta
caught it and it is restored. Of the other apparent removals, all but one are
rewordings. The one real removal is deliberate: the journal's ban on the words
"rung" and "ladder" is gone, because the Ceiling section now names rungs on
purpose and the journal's reader is reflect, not a human reading cold.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
ste-lint.py measures a skill's STYLE. This measures its CONTENT. They are orthogonal, and only the second answers the question that matters when a skill is rewritten: is every rule still there? The case that produced it is in this same PR. The journal rewrite took its violations from 16 to 4 and cut a third of the bytes, and dropped **Never read the board back** — half of docs/why.md#the-board-is-a-lens. Lint scored that rewrite as a clear improvement, because by its measure it was. That matters more here than it would elsewhere: a skill cannot be validated by running it. The edit takes effect next session, merging is the deploy, and a dropped rule surfaces weeks later as a run behaving oddly with nothing to attribute it to. This is the closest thing to a regression test that prose admits. Two implementation details are load-bearing rather than tidy: Whitespace collapses before matching. Markdown wraps a directive across lines, so a line-oriented match misses it — skipping this reported "Never force-push someone else's branch" as deleted when it had never moved. Rewordings are filtered. A raw diff of this PR reported 14 disappearances, 11 of them `Do not X` becoming `Never X`. A reviewer handed 14 items skims, and skimming is how the one real removal gets waved through. Headings count as directives alongside bold. Catching only bold made a promotion to a heading look like a deletion, which it did for "Never write state the state machine owns". It is a tripwire, not a proof, and the docblock says so: it sees bold and heading imperatives only, so a rule in plain prose is invisible, and `Never X` weakened to `Avoid X` fuzzy-matches and passes. Wired into AGENTS.md and reflect/SKILL.md — the two places that edit skills — as a step whose removals must be accounted for in the PR body. Both it and ste-lint.py are development tools, never run steps. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Added:
|
| Flagged | Verdict |
|---|---|
"rung"/"ladder" ban |
Deliberately removed. ⏭️ Ceiling now names rungs on purpose, and the journal's reader is reflect, not a human reading cold |
Do not "fix" it, re-post, file a ticket |
Survives, split into two imperatives in journal/SKILL.md:133 |
Always set Effort. It is never the reviewer's… |
Survives as **Always set Effort.** plus the ownership table |
Three implementation details worth reviewing
- Whitespace collapses before matching. Markdown wraps directives across lines. Skipping this reported
Never force-push someone else's branchas deleted when it had never moved. - Rewordings are filtered. The raw diff reported 14 disappearances, 11 of them
Do not X→Never X. Hand a reviewer 14 items and they skim — which is how the one real removal gets waved through. - Headings count as directives. Catching only bold made a promotion to a heading look like a deletion, which it did for
Never write state the state machine owns.
What it does not prove
Stated in the docblock so nobody over-trusts it: it sees bold and heading imperatives only, so a rule written as plain prose is invisible; Never X weakened to Avoid X fuzzy-matches and passes; and it cannot tell you a surviving rule is still correct. A tripwire, not a proof — but one ste-lint structurally cannot be.
Wired into AGENTS.md and reflect/SKILL.md, the two places that edit skills. Both tools are development-time only, never run steps.
Unit-verified: rewording filtered, genuine removal flagged, heading form caught, line-wrapped form caught.
`main` gained #48, which rewrote `preflight/SKILL.md` in Simplified Technical English, and #49, which made `version` a cache key. The one conflict was the `label:awaiting` paragraph: #48 tightened it, this branch made it plural. Kept #48's register and carried the plural fact into it in three short sentences. Folded into the same commit, because two of the three touch the file the merge had to reconcile: - Rule 4 said "never let a mention pass silently" while the mention query is now issue-scoped. It now says the query is issue-scoped, and that a mention on a PR reaches the loop through rung 2 or not at all. - `docs/why.md` records the two decisions the fix forced. First, the new `is:pr label:awaiting` query is what the survey routine's drift sweep reads, so half of that sweep's PR row becomes enforceable on the first survey after the merge — the sweep doing what its own table specifies, but worth knowing without a bisect. Second, `search_issues` with a hand-written `is:pr` stays the one tool rather than `search_pull_requests`, deliberately. - `version` 0.2.0 -> 0.2.1. #49 landed after this branch did, and this branch changes two skills, so an unchanged version would leave every installed cache serving the old ones. Gate: `claude plugin validate ./workflow --strict` passed. `rule-delta.mjs --base origin/main` reports 57 -> 57 directives and no removal. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_017bAFozAESzffZgcfH3REWX
Summary
Measured before designing anything, and the measurement moved the target twice.
preflight+work-routine+journal+ configThe rules cost as much each day as every comment the loop has ever written. The output was never the largest line. And bodies were never the problem — they are already shorter than yours, which is why the grounding fix below depends on them staying rich.
This had already broken production: a run hit
Error: result (97,279 characters) exceeds maximum allowed tokensreading a journal's comments.Four changes
1. Ground from the body, never the thread.
triage-issuealways said "comments are conversation, the body is state" — nothing enforced it. Nowpreflightdoes. Grounding a ticket: ~27,000 chars → ~8,600. Changes nothing already written, which makes it the cheapest saving available. And no run may callget_commentson a journal issue.2. Budgets, enforced by a script. The old rule — "past roughly fifteen lines outside a
<details>" — failed in both directions: 51% of bytes had migrated inside<details>where it did not reach, and the visible half still ran to 3,364 chars.workflow/lib/budget.mjscounts the whole artefact,<details>included, and returns over/under with no clause permitting an explained overage — that clause is what the old rule died of. Bodies stay unbudgeted, deliberately.3. STE, vendored not installed. The ~8 rules that drive length go into
preflight(~600 chars). The upstream skill is 16,260 chars ≈ 4,065 tokens — loading it 11×/day would cost more than the brevity it buys, and it is a single-contributor@maindependency for a plugin with write access to five repos.ste-lint.pyis vendored (MIT, attributed) as a local dev check, never a run step.4. The journal is one document per day. No comments at all — two rewritten surfaces holding the same accumulated content is the duplication this repo exists to avoid. Evidence blocks required for failures and friction, banned for merges and CI status, which GitHub records natively.
Results
work-routinejournalpreflighttriage-issuefinalize-pr*
preflightabsorbed ~1,500 chars of new rules (STE, budgets, grounding) before shrinking.Per-run load: 47,518 → 36,992 chars. ~29,000 tokens/day saved, on the three skills every run reads.
The rule-delta check earned its place
You chose lint-delta-plus-review as the gate; I ran a rule delta too, as review material. It caught something lint could not:
Never read the board backwent missing in the journal rewrite — a load-bearing piece of the board-is-a-lens doctrine. Restored.Directives: 52 → 54. Of the apparent removals, all but one are rewordings (
Do not add→Never add, etc.), verified newline-safe with fuzzy matching. One deliberate removal: the journal's ban on the words "rung" and "ladder" — the⏭️ Ceilingsection now names rungs on purpose, and the journal's reader isreflect, not a human reading cold at 6am.Test results
claude plugin validate ./workflow --strict· ✓jq -e . loop-config.json· ✓node --check budget.mjs· ✓ everywhy.mdcitation resolvesbudget.mjs, 7 cases: at budget, one under, one over, review-reply over, journal under, unknown kind →UNBUDGETED, and bulk hidden inside<details>→OVER(the loophole, closed by construction)Manual verification
Next scheduled run: the journal is one comment-free document under 2,500 chars, no
get_commentson a journal appears in the transcript, and⚠️ Failedstill carries its evidence block.🤖 Generated with Claude Code