Repository navigation
feat: ownership table in CONVENTIONS.md (gen-index, validate, init, upgrade, skill) - #115
Merged
Merged
Conversation
pasrom
force-pushed
the
feat/ownership-table
branch
from
November 27, 2026 18:49
223f1f7 to
94999f4
Compare
…NS.md CONVENTIONS.md may carry an ownership section whose mounted-repositories table sits between two marker lines. km gen-index fills it from .gitmodules alone: one row per submodule whose path the index holds as a gitlink, sorted by path, with its url (user info and .git dropped), its branch and what it holds (the optional submodule.<name>.km-owns key). No pin is listed, so a pin bump leaves the table fresh. Without markers the file is left alone; with broken ones nothing is written and the run exits 1. --check fails on a stale table, and under pre-commit a rewrite fails the commit. A CONVENTIONS.md or .gitmodules that is a symbolic link is neither read nor written through, with a note. Marker lines in fenced code are examples, and a marker line must close its comment. The file is compared with LF and written back in its own line ending. Bytes that do not decode become U+FFFD, and write_text encodes before it opens a file, so nothing can empty it halfway. Cells drop format characters and stop at 200 characters; mount, url and branch are code spans. A url loses user info (scp-style too), query and fragment; two names for one path give one row. The cases live in tests/ownership_smoke.sh, which CI runs on Linux and Windows.
Whole-repo runs read the ownership section of CONVENTIONS.md and warn: ownership-stale (the generated table differs from .gitmodules), ownership-markers (a begin or end line missing, doubled or out of order), ownership-topic (a mount without km-owns), ownership-home (a hand row with no link and no URL) and ownership-duplicate (a topic in two rows). All are warnings; a dead link in a row stays dead-link.
Both templates, personal and team, carry the ownership section: a header-only Topic | Home | Notes table to fill by hand, and the mounted-repositories table with its generated block empty, as km gen-index renders it with no mount. A fresh brain stays at zero warnings and gen-index --check passes.
km upgrade appends the ownership section to CONVENTIONS.md, its mounted-repositories table filled from .gitmodules, once: when the brain moves from a km at or below 1.26.0 to a later one, and only where the file has neither an Ownership heading nor the table's markers. A section of the brain's own gets a note and no change; a brain already past 1.26.0 is left alone. Headings and markers are found outside fenced code; the section is written in the file's line ending, and a 'Mounted repositories' heading of the brain's own gets a note.
…n brain add and remove The review rule looks a fact's home up in the ownership table first (hand rows, then the mounted repositories), names the row in the finding, lists the topics with no row in at most one note and reports an unreadable home as not compared. brain add and brain remove regenerate the table and stage CONVENTIONS.md, and brain add offers to set km-owns. The validate reference lists the five warnings; the setup reference says what the upgrade adds.
review-ownership-table reviews the wiring note in a brain whose ownership table names a second page as the home of the pump controller's ratings: the finding must name that page and line, after reading CONVENTIONS.md. brains-list-remove gets a grader that the regenerated CONVENTIONS.md is staged with the removal, for one commit (committed, or staged where the sandbox refused the commit); its fixture now generates the mount's row in the mount commit, so the table starts fresh, and so does brain_with_two_peers. The new case also checks that the reply names the Ownership row it used.
pasrom
force-pushed
the
feat/ownership-table
branch
from
November 27, 2026 19:29
94999f4 to
f6df992
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An ownership table in a brain's
CONVENTIONS.md: where each kind of fact lives, so a review can name the home of a figure instead of guessing it from search hits.CONVENTIONS.mdgets a## Ownershipsection with two tables: a hand-written one (Topic | Home | Notes) and, under### Mounted repositories, a generated one (Mount | Repository | Branch | Holds) between two marker lines.km gen-indexfills the generated table from.gitmodulesalone (newsrc/km/ownership.py): one row per submodule whose path the git index holds as a gitlink, sorted by path. Nothing is read from inside a mount and no pin is listed, so a pin bump leaves the table fresh. Holds comes from the optional keysubmodule.<name>.km-owns; without it the cell says_not stated_.km gen-index --checkfails on a stale table. Broken markers: nothing is written (no_index.mdeither), exit 1 with a fix line. Without markers the file is left alone (opt-in by marker presence).km validate(whole-repo runs only) warnsownership-stale,ownership-markers,ownership-topic,ownership-home,ownership-duplicate. A dead row link stays the existingdead-link.km inittemplates carry the section with an empty generated block.km upgradeappends the section, its table filled, once, when the brain crosses from a km at or below 1.26.0 (OWNERSHIP_AFTER).brain add/brain removeregenerate the table and stageCONVENTIONS.md, andbrain addoffers to setkm-owns; the validate and setup references list the warnings and the upgrade step.SKILL.mdis untouched (11992 bytes).No release and no version bump in this PR.
Format example
Cells: bytes that do not decode become U+FFFD; format characters (zero-width, bidi) are dropped; whitespace and newlines collapse; control characters and backticks become
?;|is escaped; a cell stops at 200 characters with an ellipsis. Mount, Repository and Branch are code spans (so IPv6 brackets survive); in Holds, plain text,[]become spaces and<is<. A url loses its user info (user:token@, and the user of scp-styleuser@host:path), its query and fragment, and a trailing.git. Branch.reads "this brain's branch", none reads "default". Two submodule names for one path give one row.Marker lines inside fenced code are examples, not markers, and each marker line must close its comment on that line. CONVENTIONS.md is compared with LF and written back in the line ending it has (CRLF where it has any). A CONVENTIONS.md or
.gitmodulesthat is a symbolic link is neither read nor written through; gen-index prints a note.Warnings
ownership-stalekm gen-indexwritesownership-markersownership-stalethen)ownership-topickm-ownsownership-homeownership-duplicateAll warnings, exit code unchanged. Rows in HTML comments or fenced code are ignored.
Upgrade behaviour
## Ownershipheading and no markers: the section is appended at the end ofCONVENTIONS.md, table filled.## Ownershipwithout markers: a note, no diff.Since this PR does not bump the version, the crossing only happens with
--pinto a later km (the tests use the fake remote's v1.99.0); after the 1.27.0 release it happens on a plainkm upgrade.Operational effect: adding, removing or renaming a mount, or changing its url, branch or
km-owns, now needsCONVENTIONS.mdrestaged; the km-gen-index hook and CI fail until it is.CONVENTIONS.mdand.gitmodulesare control files forkm ready, so such a PR needs a person's label, as before.Tests
All suites CI runs, locally on macOS:
KM_TEST_UV=requiresync_smokewithKM_TEST_UV=forbidcannot run on this machine (uv is on the PATH, which that mode rejects: 78/1 on that guard alone); CI runs it. The Latin-1 locale step of team_smoke and the Windows job run in CI only. e2e_smoke caught the seed's mount commit leaving the new table stale; the seed now regenerates it in that commit (folded into the init commit).Mutation checks
Each new case group fails without its change (edit, run, restore). The first ten rows ran when these cases still lived in index_smoke; they moved to ownership_smoke unchanged but for the url cell now being a code span.
rows()renderignores the branchownership.problemsread()follows a symlinkedCONVENTIONS.md_cleandropped)write_textopening the file before encoding.gitmodulesis read## Ownershipcounts / no note on a mounts headingEvals
Run with
claude plugin eval . --scaffold --no-publish --allow-tools Bash Write Edit --case <name>, 3 runs each.names-the-ownership-rowgrader. No baseline run, so it guards the rule rather than measuring a liftbrain_with_two_peersgenerates its tableNot rerun: km-queue, pr, pr-review-comments, fix-in-mounted-brain (its fixture shares
brain_with_peer, which now also generates the table row).The first version of
stages-conventionsrequired the removal to be committed. In two runs (1 of 3 with--ablation none, 3 of 3 in the first with-without run) the eval sandbox refused writes to.gitmodulesand.git/config, so the model rankm gen-index, stagedCONVENTIONS.mdwith the removal and stopped without committing, saying why. The grader now also passes that state (both staged, the reason given); it still fails a run that never regenerates the table or commits the removal without it. The baseline without the plugin never runskm gen-index(0/3 on that grader in both with-without runs).Deviations from the design and what the checks showed
dead-linkto the brain (git lists no file inside a gitlink). No change needed.km-owns: confirmed (git submodule update --initandstatusprint nothing about it). bump-mounted-pins reads only path, url and branch: confirmed by importing the shipped script and checking each entry's keys; the template is unchanged, so noSHIPPEDhash change.CONVENTIONS.md: not in the original design.km gen-index,km validateandkm upgradeneither read nor write through a symlinkedCONVENTIONS.md(it may point outside the repository); gen-index prints a note. Tested and mutation-checked.CONVENTIONS.mdunderPRE_COMMITnow also exits 1, so the failure does not depend on that;_index.mdrewrites keep their behaviour.render(text, root)takes the brain root as a second argument (the design hadrender(text)).Topicin the## Ownershipsection only, also where the section has no markers; the generated-table checks need the markers./simplifyand/code-reviewwere not run, since both fan out to sub-agents; instead a manual pass over the whole diff (code, templates, skill references, tests, evals, e2e seed, hook yaml) for reuse, simplification and correctness. It led to three changes: the stale check reuses the rows it already read instead of reading.gitmodulestwice;brain addnow stages.gitmoduleswithCONVENTIONS.md(thekm-ownsedit comes aftersubmodule addstaged.gitmodules, so stagingCONVENTIONS.mdalone would commit a table ahead of.gitmodules); the section text no longer says CI checks the table, since a personal brain has no CI (it sayskm validatereports it).Second review round
Folded into the commits that introduced each problem:
.gitmodulesthat does not decode raised while writing, after the file was opened. Nowkm.paths.write_textencodes before it opens any file, and values from.gitmodulesturn such bytes into U+FFFD.tests/ownership_smoke.sh, which the smoke and windows jobs both run; the symlink cases skip whereln -smakes no symlink.names-the-ownership-rowchecks that the reply names the row (CONVENTIONS.md with a line, or the ownership table/row/section).brain_with_two_peersalso generates its table in the mount commit..gitmodulesis not read; upgrade finds the heading and markers with the parser (outside fences) and notes aMounted repositoriesheading of the brain's own while still adding the section.