Skip to content

Cut Leaf's agent instructions to direction, invariants, and ownership - #1230

Merged
max-sixty merged 9 commits into
mainfrom
agent-guidance-review
Sep 26, 2026
Merged

max-sixty merged 9 commits into
mainfrom
agent-guidance-review

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Every AGENTS.md and repo skill had accumulated per-change notes: incident stories, one-off measurements, named-test citations, module-level detail the code already carries, and rules any agent follows unprompted. The maintainer's directions sat among them. This cuts the ten instruction files from about 3,040 lines to about 1,650, keeping what an agent needs before changing an area: goals, invariants spanning modules, who owns what, and the gates to run. No code behavior changes.

Root AGENTS.md. Leaf's role, Stage, Fix the underlying issue, and the cross-runtime invariants are unchanged. A new "Where guidance lives" marks the sections above the repository map as the maintainer's direction and says where other notes go: a module's contract in its header, a helper's in its docstring, and how a rule was found in the commit message. The red-gate landing procedure and the installed-cache note move to /developing-leaf.

skills/leaf/assets/AGENTS.md (642 → about 300 lines) leads with "Layout and motion", now the one home for presentation principles; desktop focus and /ui-sweep's visual grammar join it. A concern map and a short fact-authority table replace the function-level ownership table.

tests/AGENTS.md (771 → about 280) opens with Stage's position that an overfit test gets rewritten or deleted, and with the rule to prove a contract at the lowest boundary that preserves it, which moves here from running-tend. Helper contracts move into their docstrings.

The rest. examples/, scripts/, skills/leaf/scripts/, and the keyboard AGENTS.md, plus /developing-leaf, running-tend, and /ui-sweep, are cut the same way. Contracts found only in an AGENTS.md move to docstrings in scripts/*.py, tests/*.py, and render_gate/readings.py. Code comments citing a heading that no longer exists, several of which already pointed at nothing, are repointed or dropped.

An independent review compared old against new for dropped rules and changed meanings; its findings are applied. The everyday suite and npm run test:runtime pass locally.

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

🤖 Generated with Claude Code

max-sixty and others added 9 commits September 26, 2026 08:04
- assets/AGENTS.md: remove the boot-time "Cannot access X before
  initialization" warning. Its rule left with the import cycle in #429,
  and dependency-cruiser's no-cycle rule now rejects the shape at lint.
- tests/AGENTS.md: stop citing a test #336 deleted.
- running-tend: replace the restated underlying-issue rule, still in the
  wording AGENTS.md dropped on 09-25, with a pointer to that section.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Every AGENTS.md and the repo skills had accreted per-change notes:
incident stories, measurements, named-test citations, and module-level
detail that the code or its header already carries. The files now keep
what an agent needs before changing an area (goals, invariants that span
modules, who owns what, gates) and move one-module contracts into the
module or helper docstring that owns them.

- Root AGENTS.md keeps Leaf's role, Stage, Fix the underlying issue, and
  the cross-runtime invariants unchanged, adds "Where guidance lives" (the
  sections above the map are the maintainer's direction; where a note
  about one module goes), and moves the red-gate landing procedure to
  /developing-leaf.
- skills/leaf/assets/AGENTS.md leads with "Layout and motion", now the one
  home for presentation principles (desktop focus and ui-sweep's visual
  grammar join it), and keeps a concern map and a short fact-authority
  table in place of the function-level one.
- tests/AGENTS.md opens with Stage's stance on tests and the rule to prove
  a contract at the lowest boundary that preserves it, which moves here
  from running-tend. Helper contracts now live in their docstrings.
- examples/, scripts/, skills/leaf/scripts/, and keyboard AGENTS.md, and
  the developing-leaf, running-tend, and ui-sweep skills are cut the same
  way. Contracts found only in AGENTS.md move to docstrings in
  scripts/*.py, tests/*.py, and render_gate/readings.py.
- Code comments citing a heading that no longer exists are repointed or
  dropped.

The ten instruction files go from about 3,040 lines to 1,700; no code
behavior changes. The everyday suite and the runtime tests pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	examples/AGENTS.md
#	scripts/AGENTS.md
#	scripts/page_fixtures.py
#	skills/leaf/assets/AGENTS.md
# Conflicts:
#	skills/leaf/assets/AGENTS.md
Root AGENTS.md already states it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/AGENTS.md
Drops lines any competent agent does unprompted: keep code, tests and
docs aligned; update docs; read module headers; stop a preview when
done; remove a temporary worktree; run the suite after a rebuild; wait
for authorization before landing; prefer a test's public route; name the
distinguishing values in an assertion message. Also removes a duplicated
re-vendor rule, the Previewing section examples/AGENTS.md repeated from
scripts/AGENTS.md, and a restatement of root's validate-once invariant in
skills/leaf/scripts/AGENTS.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/AGENTS.md

@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 landing instructions drop the requirement for user authorization. The new /developing-leaf landing section gives a route through a red gate, but neither it nor this root section tells an agent to wait for the user's go-ahead on user-directed work. That changes a decision boundary, rather than merely shortening the guidance.

Comment thread AGENTS.md Resolved
@max-sixty
max-sixty merged commit ecb089e into main Sep 26, 2026
7 checks passed
@max-sixty
max-sixty deleted the agent-guidance-review branch September 26, 2026 17:45
max-sixty added a commit that referenced this pull request Oct 11, 2026
…it from regrowing (#2318)

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. #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_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Co-authored-by: Maximilian Roos <[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