Repository navigation
The pre-edit block names a decision and its source - #162
Merged
Merged
Conversation
zlareb1
force-pushed
the
feat/for-file-decision-line
branch
from
November 2, 2026 00:15
b0977ad to
800e2cd
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…t block The conflict check links close decisions under different keys as conflicts; each key is its own decision, so _supersede_order pairs no two typed decisions. A rule may still supersede a decision. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
memory.for_file decodes the stored JSON for display (a cut string from its opening quote), and a decision tagged decision:failure carries (outcome: failed). live_sha256 takes the value's JSON text. The footer reads 'a corrected one' for rules and decisions; the docs say what (unconfirmed) counts and that two linked decisions do not supersede. An integration case reads a decision.record row back through memory.for_file. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…hint says decision.record The handler passes each row's cut flag to the renderer, which drops half a surrogate pair a cut leaves. The decision tag names live in decision_schema. A member refused on another's decision is told to record it again. Integration cases read decision.record rows, short and past the 600-byte cut, back through memory.for_file. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… value was cut A code-namespace member cannot call decision.record, so the refusal hint and the footer send them to the decision's author or a maintainer, and the 403 message names the row's kind. Each for_file hit carries value_truncated, as memory.list does, which the renderer reads. A lone surrogate in a whole value prints as '?'. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… decision The hint carries the row's kind, which the 403 message reads, and calls a row tagged decision a decision as the pre-edit block does. The decision step and the footer both say 'record the corrected decision'. A test pins the 403 message; a duplicate cut-value test goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
A value the read cut can decode to fewer characters than the line holds (escaped non-ASCII), so the decoded text ends in '…'. is_decision lives beside DECISION_TAG and both the pre-edit block and the refusal use it; (outcome: failed) applies to decisions only. Tests cover a CJK cut and a refusal on a row only tagged decision. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
A pin is how a team decision reads as confirmed in the pre-edit block, and the member rule already promised members no pin; memory.set now refuses pinned=true for a write the member rule admitted. The fallback and back-off in the value decode say why they are there. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Refusing a member's pinned memory.set is an access change of its own (a maintainer's memory.pin takes over the row, and memory.update keeps a pin over a changed value), so it is left to a change that settles both. The docs say a pinned team row is not on its own proof a maintainer confirmed it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…_file docs Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… is_decision once per line memory.update changes a decision's row and not its record, which the next decision.outcome writes back, so the hint names memory.delete for the author and decision.record for a maintainer. The block computes whether a row is a decision once per line; is_decision takes any collection; the supersede skip trusts the conflict check's one-type links; update.py uses CONFIRMED_STATES. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
A block's removal footer names the rule step for rules and tagged decisions and the maintainer step for typed decisions, and says maintainer as the refusal hint does. The typed-decision test is one spelling (memory_type == decision) in the block and the refusal; the long recorded-decision test asserts the cut happened. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…rd-only A block holding only typed decisions is headed 'A team decision' and its step names the author too, as the refusal hint does. The supersede skip reads KEY_IDENTIFIED_TYPES, the rule the conflict check applies. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…are keyword-only Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/for-file-decision-line
branch
from
November 2, 2026 03:04
87f6f10 to
ed0f481
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
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.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
The pre-edit block from
memory.for_fileheads a decision rowDecision (by <author>, <age>), prints its value as text, ends it with— source: <source_resource_id>, and marks a decision not pinned or attested(unconfirmed)and one whose recorded outcome failed(outcome: failed). Each hit carriessource_resource_id, itsverificationstate (as onmemory.get),value_truncated(as onmemory.list) and, for a superseding hit, the kind (ruleordecision) it supersedes.Why
A design decision in a repository's code namespace reached the pre-edit hook as
Team rule (by …) [decision]: <stored JSON>: an agent about to edit the file could not tell a pinned decision from a draft, see that its outcome failed, or cite the document it came from.Scope and risk
decision(decision_schema.is_decision, which the refusal below uses too);(outcome: failed)applies to decisions only. A team decision is headedDecision; in the caller's own namespace it is marked[decision]. Its source follows the value with its own 120-character cap, so the value's 220-character cut never reaches it, and a line that does not fit the budget is still left out whole.(unconfirmed)means not pinned and not attested against the row's current hash (memory.verify); a stale attestation does not count. Rows that are not decisions get none of these marks (their values are printed as text, below).memory.setstores a value as JSON, which the block used to print as is (quotes,\uXXXXescapes). The block now decodes it for display, for every row: a string value the select cut at 600 bytes (the hit's newvalue_truncated) is decoded from its opening quote up to the cut, without an escape or half a surrogate pair the cut split, and ends in…(escaped non-ASCII decodes to far fewer characters than the line holds), and a lone surrogate a value holds prints as?. The hit'svaluefield stays the stored JSON text.decision.trust.row_verification(shared withmemory.list) derives the state from the stored hash, or from the value's hash when the selected value was not cut.(pinned)shows the row's pin. A code-namespace member can set it on a row they write there (memory.setwithpinned=trueis stored as given), so a pinned team row is not on its own proof a maintainer confirmed it; the docs say so. Refusing a member's pin is left out of this change: it is an access change of its own, since a maintainer'smemory.pinre-records the row under the maintainer (taking it from its author, with the fields the pin passes) andmemory.updatekeeps a pin over a changed value, and both need settling with it.memory.set,memory.updateandmemory.deletethere, and a newer rule is never shown above a typed decision. So a member refused on someone else's typed decision is sent to its author (who can delete it) or a maintainer (who can record the corrected decision withdecision.recordand delete the old row):memory.updatewould change the row and not the decision's record, which the nextdecision.outcomewrites back, and the block's footer names the steps for what it holds: a corrected rule for rules and tagged decisions, and asking a maintainer to record the corrected decision withdecision.recordfor typed decisions (the footer of a block of typed decisions only readsA team decision wrong or outdated?). The hint carries the row'skind(decisionfor a row typed or taggeddecision, as the block calls it), which the 403 message names; a row only taggeddecisionkeeps the rule steps, since a newer rule supersedes it.row_in_scope.Compatibility, rollout and rollback
source_resource_id,supersedes_kind(rule,decisionor empty),verification(as onmemory.get) andvalue_truncated. Therenderedtext changes: decision lines as above, every value printed as text, and the removal footer names the steps for the rows it holds and says maintainer (it said admin). A refused member write'shintgainskind, and on a typed decision has a one-stepnext.Tests
tests/unit/test_memory_for_file.pyandtests/unit/test_file_rules_shared.py(decision and rule fixtures of the new tests in the stored JSON form): the head, source and its cap,(unconfirmed)with pins, attestations and stale ones,(outcome: failed), non-ASCII values printed as text, a value the select cut decoded through the handler (fails without passing the cut flag), cuts inside a surrogate pair (fail without the guard), two linked typed decisions not paired, a rule superseding a tagged decision, the footer, the budget.tests/unit/test_code_member_writes.py: the decision refusal hint names the author and not an op a member cannot call (code_member_may_writerefusesdecision.record), the 403 message names the decision and its one step, and a row only taggeddecisionis named a decision with the rule steps. A CJK value cut by the read ends in…(fails without it); a rule taggeddecision:failuregets no failed-outcome note. A lone surrogate in a whole value prints encodable.tests/integration/test_memory_for_file_decisions.py,test_memory_code_links.pyandtest_decision_record_source.pyagainst a server from source on a private ClickHouse at049f3821: 198 passed, and the long recorded-decision case failed its newvalue_truncatedassertion (its statement was under 600 bytes); with that statement lengthened, the file passes against the same server (3 passed). Since then only the footer wording, helper signatures, comments and unit tests changed. The cases include decisions written throughmemory.pin/memory.setand attested throughmemory.verify, adecision.recordrow whose whole rendered line is compared, and one whose statement is past the 600-byte cut (value_truncatedtrue), printed with no quotes or escapes and ending in….mainc0340084(addsmentor.brief's graded-run report; clean rebase, generated files current): at the headed0f4816, the for-file, member-write, file-rules, mentor, SDK, package-contract and doc tests andtests/analyzer, 826 passed, 2 skipped; the head7a6aa15arewords the footer's decision step, and the for-file, file-rules and member-write tests pass there (80).dadbcecf:test_memory_for_file.py,test_code_member_writes.py,test_file_rules_shared.py, the package-contract, doc and copy checks, 284 passed; the head87f6f102changes one footer condition, andtest_memory_for_file.pywithtest_file_rules_shared.pypass there (59);node --test integrations/claude-code-plugin/tests/file-rules-team.test.mjsandagent_plugin_sync --checkpass. Fulltests/unitatdadbcecf: 24,498 passed, 20 skipped, 1 xfailed.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code; the rendered lines were checked against a live server.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass (see Tests); the integration suite passes if server behaviour changed.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code