Skip to content

Fix drifted instruction prose, and add the placement rules that keep it from regrowing - #2318

Merged
max-sixty merged 16 commits into
mainfrom
code-quality-instructions-batch
Oct 11, 2026
Merged

max-sixty merged 16 commits into
mainfrom
code-quality-instructions-batch

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Fixes a batch of instruction and prose defects from the code-quality survey, and adds the placement rules that keep the cuts from regrowing.

Shipped instructions

  • page-authoring.md and packages.md read author instructions with jq -r '.author // empty'. leaf page instructions prints {} when no package declares author text and exits 0, but the documented jq -er '.author' exited 1, so the first lookup in "Read the registry" failed on every default-package page. The sentence above it again says the shared instructions are read when the packages carry any.
  • harness-claude-code.md and harness-pi.md rewrap their "Serve the page" paragraphs. Main has since repaired the garbled pointer sentence beside them in its own words, which this branch keeps.
  • SKILL.md's Operate step 3 is labelled "Quick pages and records", and the four references and the eval comment that cited "step 3" cite the name. The policy's wording is unchanged.

Prose held to the machine

  • events.md's kind table matches $events.kinds. The error row names text, the comment row drops a response field the registry no longer declares, the report row names its fields, and the opening paragraph names attention and points to where agent and session are described. "Authorship and voice" notes that a browser-posted error is stamped author=page. test_the_events_reference_names_the_fields_each_kind_declares checks three things: exactly one row per declared kind, every named field declared, and every required field named. The fields the opening paragraph covers for every kind are exempt.
  • build/AGENTS.md names builder inputs by rule (an entry named after a vendor.py BUILDS key). The root map's hooks/ entry describes the directory by role, which covers watch.ts and the loop guard.
  • Root AGENTS.md, "Where instructions live", asks prose to describe a set by what its members share. Where the prose must list the members, a test holds the list to the machine's copy.

assets/AGENTS.md back to cross-module rules (553 → 508 lines)

  • The render-reading table and its repeated paragraph are gone; render_gate/readings.py is the list.
  • The pin-placement rules, the per-surface reply-box mechanics and the cascade tier order are replaced by pointers to their owners: margin-placement.js and margin-model.js's canFold; thread/held-news.js, thread-card.js's newsMoves and chrome.css; and packages.md with CASCADE_LAYERS. Three fact-table rows shrink to an owner and a line.
  • /developing-leaf, "Land a change", now asks of each addition to an area AGENTS.md whether one module owns it. tests/AGENTS.md puts a new test in the module whose docstring names its subject. Cut Leaf's agent instructions to direction, invariants, and ownership #1230's cut regrew from about 300 to 548 lines in two weeks without such a check.

Headers and TODOs

  • margin-placement.js's header names the right mechanism: annotation-theme.css reads --lf-margin-x/y, and only the carrier is anchor-positioned. readable_claim points at Stage instead of restating it. The history clauses in dev/AGENTS.md, stills.py and assets/AGENTS.md are now present-tense reasons.
  • TODO.md's bundling item covers only what is open: loading the compiled kernel in previews and tests. The leaf.page dispatch durability gap is a TODO.md item with a trigger, and worker/src/index.ts points at it.

No eval run. The shipped-instruction edits fix a broken command, a garbled sentence and citation labels, so each can be read only one way. The new placement rules are maintainer guidance, which evals/ doesn't score.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 12 commits October 10, 2026 17:07
…out any

`leaf page instructions` prints `{}` when no package declares author text,
as packages.md's contract says, and exits 0. The documented
`| jq -er '.author'` then exits 1, so the first command in page-authoring.md's
"Read the registry" failed on every default-package page. The references now
use `jq -r '.author // empty'`, and the sentence above the lookup again says
the shared instructions are read when the packages carry any, the qualifier
#2264 dropped.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…tracts

Both harness references told the agent to read a delivery pointer "before
working or replying, since follow its confirmation instruction after the
complete reading", a sentence #2248 garbled. It now says what harness-codex.md
already says: read every part, then follow the confirmation instruction, and
points at event-batches.md "Delivery and acknowledgement", which owns the
rule. Two overlong lines beside it are reflowed. No instruction changes
meaning.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The reference's Fields column had drifted from the schema admission enforces:
the `error` row named none of its fields though the registry requires `text`,
`comment` listed a `response` field the registry no longer declares, and the
opening sentence's list of fields every event carries left out `attention`.
The `report` row now names its fields instead of "as `action`", and the
opening paragraph names `attention` and points to where `agent` and `session`
are described.

A new test in test_interact_contract.py reads the table and holds it to the
registry, as tests/AGENTS.md prescribes for a table: one row per declared kind,
every named field declared, and every required field named unless the opening
paragraph describes it for every kind. The hand-written column stays, since it
carries meaning the schema does not (subject variants, outcomes, CLI-only and
server-stamped fields).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
TODO.md's bundling item predated the compiled kernel installs and the website
now load (#1963, #2143); it now covers only what is open, loading that kernel
in development previews and the browser tests. The leaf.page dispatch
durability gap, recorded only as two dated TODOs in worker/src/index.ts, is a
TODO.md item with its trigger, and the code points at it.

The root map's hooks/ entry describes the directory by role, so watch.ts and
the loop guard the registrations run are covered. build/AGENTS.md names
builder inputs by rule (an entry named after a `BUILDS` key) rather than
listing two of the five, so a new builder needs no edit there. The map's
editable part is below "Repository map".

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The Render gates section listed 18 readings beside validation.md's "Browser
validation", which already names render_gate/readings.py as the list. The
table was six probes short and mixed top-level probes with sub-readings of the
render-check scripts, and a paragraph after it restated the section's opening
rule nearly word for word (left over from #2178). Both go; readings.py and its
docstrings remain the one inventory.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
margin-placement.js's header said the stylesheet places a row by anchor
positioning in theme.css. It is annotation-theme.css, from the
`--lf-margin-x`/`--lf-margin-y` coordinates margin-layout.js writes; only a
row's carrier is anchor-positioned. readable_claim's docstring restated root
AGENTS.md's Stage rule at length and now points at it, keeping the
unknown-harness rule and its single-decision-point contract. dev/AGENTS.md,
stills.py and assets/AGENTS.md drop what the thread snapshots and the
Questions panel replaced, keeping the reasons that still hold.

The rest of the history narration the survey found stays until each module is
next edited.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…and-off

assets/AGENTS.md repeated what single modules already state. The pin
placement and folding rules are margin-placement.js's (`rowPosture`,
`pinSpot`, `seatRows`) and now get one sentence and a pointer. Stability
keeps the browser-wide rule and its owners and drops the per-surface reply-box
mechanics held-news.js and thread-list.js state. The cascade tier order points
at packages.md "Styles and composition" and `CASCADE_LAYERS`, keeping the
rules only this file states. The fact table's comment-placement, pointed-place
and margin-layout rows shrink to an owner and a line, with the default
package's paths.

#1230 cut this file from 642 to about 300 lines on the same principle, and
feature commits grew it back to 548 in two weeks. /developing-leaf's "Land a
change" now asks, of each addition to an area AGENTS.md, whether one module
owns it, so the cut holds.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ject

Hand-written inventories drifted because nothing checked them (the build/
builder inputs, the hooks/ map entry, events.md's Fields column, the
render-reading table). Root AGENTS.md's "Where instructions live" now asks
prose to describe a set by what its members share, and, where a list must
stay, to hold it to the machine's copy with the test tests/AGENTS.md already
prescribes; events.md's check is the first.

Test modules grew by position after their splits (test_interact_session.py
grew 8.7x after its last). tests/AGENTS.md now puts a new test in the module
whose docstring names its subject, or a new module for that subject.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Four references and an eval comment cited the check-and-stamp policy as the
main skill's "Operate", step 3, which a reordering would silently retarget.
Step 3 now leads with the label "Quick pages and records", and the citations
use it. The policy's wording, which record-reply-before-its-stamp scored in
#1884, is unchanged, and the Core principles list stays as #1866 designed it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
events.md's opening points to "Authorship and voice", where `attention`,
`agent` and `session` are described, and says a session's voice appears
only on events posted from a harness session. Its authorship section notes
that the server stamps a browser-posted `error` `author=page`, as
event_contracts.py does. assets/AGENTS.md credits pin folding to `canFold`
in margin-model.js, and reply-box movement to thread-card.js's `newsMoves`
and chrome.css beside held-news.js. Overlong lines from the earlier commits
are rewrapped.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new events table test does not yet enforce its one-row-per-kind guarantee. A duplicate row can overwrite the first entry, leaving the final comparison green.

Comment thread tests/test_interact_contract.py Resolved
max-sixty and others added 2 commits October 11, 2026 03:02
# Conflicts:
#	skills/leaf/assets/AGENTS.md
#	skills/leaf/references/harness-claude-code.md
#	skills/leaf/references/harness-pi.md
#	skills/leaf/scripts/leaf/events.md
The test keyed rows by kind, so a second row for one kind replaced the first
and the kind-set comparison still passed. It now compares the listed kinds,
duplicates included, with `$events.kinds`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit bb0ca6e into main Oct 11, 2026
4 checks passed
@max-sixty
max-sixty deleted the code-quality-instructions-batch branch October 11, 2026 21:05
max-sixty added a commit that referenced this pull request Oct 14, 2026
"Where instructions live" asked prose to describe a set by what its
members share. Its purpose, from #2318, was to stop prose copying lists
the code keeps (they drifted). The general instruction to describe things
by shared properties pushed writers toward rules about kinds of things
with no real case named, the style a prose survey found hardest to read.
The rule now says only: don't copy the code's list, point to it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 14, 2026
…ve stale claims (#2897)

A survey of Leaf's prose found one style hard to read throughout: a rule
stated about a kind of thing ("a reader that never refuses") with the
real case reduced to a paraphrase, Leaf-specific nouns used undefined,
pronoun chains, negative predicates, and rule, mechanism and reason
fused into one sentence. This is the first batch of rewrites, plus three
passages the survey found wrong about the code.

**Rewritten references** (29% shorter than main, rewritten from what the
reader does, with an independent review for accuracy and lost guidance):
`conversation-loop.md`, `event-batches.md`, `threads.md`,
`harness-claude-code.md`. Each commit message lists every cut. The
coined "take in hand" becomes "start", after `leaf task start`,
including in the reply-handling clause in `registry.json`, the
`progress-parent` and `todo-execution` findings, and
`harness-codex-app-server.md`; two snapshots that quote the clause are
regenerated.

**Corrections to claims that were wrong on main:**
- `event-batches.md` said a user-added option's words travel in `detail`
instead of `says`; `GestureWords.says` gives them.
- `/developing-leaf` said root `AGENTS.md`'s "Stage" has readers
tolerate old state-home records; Stage calls them disposable.
- `thread-list-view.js`'s header said focus and the open card never
part; since #1967 a `holdFocus` restore chooses nothing, so they can (as
`keyboard/AGENTS.md` says).
- `threads.md` described a `page check` rule on anchored visual parts
that #2020 removed.
- `conversation-loop.md` described an ask as holding "the kind of answer
it takes"; it holds `prompt`, `answer` and `status`.

**Root `AGENTS.md`**: "Where instructions live" no longer asks prose to
describe a set by what its members share, which pushed writers toward
rules about kinds of things. It keeps the rule's job from #2318: don't
copy a list the code keeps; point to it.

**Kernel:** rebuilt. main's committed kernel already lagged its runtime
sources (`check:browser` fails on main), and this branch's runtime
header and registry edits change the kernel hash.

No behavior changes beyond the reworded finding and handling text and
the rebuilt kernel.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants