Repository navigation
A decision's statement opens with its scenario, without a category slug or Scenario label - #180
Merged
Merged
Conversation
… field labels memory_value built "Category: <slug>. Scenario: <scenario>. Decided ...". The statement is what search embeds and what memory.for_file prints before an edit; a category slug and the "Category:" and "Scenario:" labels are noise to both. The statement is now "<scenario>. Decided <outcome> because <reasoning>. Rejected: <alternatives>. Realized: <result>.", every other part, cap and rule unchanged. The category stays on the record, in the key and in the decision:category:<slug> tag that decision.precedents filters on. The category cap and the slug cut points go with it, and _clip cuts at a space only. The other caps are left as they are: the statement is shorter, so the pre-edit line now reaches further into the reasoning. The integration test of decisions that read alike uses a longer shared reason, so the test embedder's closeness is decided by the statement rather than by the key each embedded text ends with. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ads from the statement tests Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…t filed under another category Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…reason's start in the pre-edit line Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…edundant assert Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ment form Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ent_fields to label_fields Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/decision-statement-plain
branch
from
November 2, 2026 18:43
65e3782 to
6f7396d
Compare
…other category Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
8 of 9 tasks
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):
A decision's memory row now reads
<scenario>. Decided <outcome> because <reasoning>. …, without theCategory:sentence or theScenario:label; the category stays on the record, in the key and in thedecision:category:<category>tag.Why
The statement
decision.recordwrites to the memory row is what search embeds and excerpts and whatmemory.for_fileprints before an edit. It opened withCategory: <slug>. Scenario: <scenario>.: a slug and two field labels that say nothing about the decision and take the first characters of the pre-edit line. The scenario's own words are what a question about the decision shares with it, so the statement now opens with them.Scope and risk
server/memory/domain/decision_statement.py::memory_valuedrops the category sentence and theScenario:label; the scenario is its own first sentence. The outcome, reasoning, no-reason form,Rejected:andRealized:parts, their caps and their endings are unchanged.STATEMENT_CATEGORY_CHARSand the slug cut points (_SLUG_BOUNDARIES) had no other use and are deleted;_clipno longer cuts at a slug separator; it cuts at a space or between two wide characters.memory.for_file's 220-character line and the embedded excerpt; the statement is simply shorter, so that line now reaches further into the reasoning.decision_key(category, scenario)) and in thedecision:category:<slug>tag thatdecision.precedentsfilters on. File detection reads the stored fields, never the statement, so it is unchanged.tests/unit/test_decision_ops.py::test_decisions_under_other_keys_only_ever_conflict).loom decisions extractsearches the namespace with the candidate's statement for a confirmed (pinned or attested) decision under another key. A candidate whose scenario, outcome and reasoning match a confirmed decision filed under another category now reads the same and is skipped asalready_recorded, nothing written (tests/unit/test_decision_extract.py::test_a_confirmed_decision_in_another_category_is_a_restatement); the category no longer goes into that query.decision.outcomerebuilds the statement too); nothing else rewrites them. Old and new statements sit side by side in search, which reads both as plain text. Re-recording such a row, or repeating its outcome, is not a restatement (see the break below).loom decisions extractsearches with the new statement form, while a confirmed decision stored in the old form still embeds itsCategory: … Scenario:prefix, so its similarity to a candidate for the same decision can be lower: a reworded copy may then be recorded instead of reported asalready_recorded, until that decision is recorded again or given an outcome.memory.setcompares the statement's bytes, so N-1 re-recording a row that N wrote, or N one that N-1 wrote, is a revision, with the effects in the break below. Either build'sloom decisions extractcan likewise miss a confirmed row stored in the other form and record a reworded copy, until that decision is recorded again or given an outcome.Compatibility, rollout and rollback
decision.recordordecision.outcomewrites changes shape.memory.settreats a write as a restatement only when the value's hash equals the stored row's (server/memory/app/write.py), anddecision.recordpasses nopinned. Recording again, word for word, a decision whose row holds the old statement form is therefore no longer a restatement: a pinned row refuses it with 409PINNED_CONFLICTuntil an admin runsmemory.unpin(thenmemory.pinrestores the pin); a row whose value is locked refuses it with 423LOCKEDuntil the lock ends or is released (the value lock is checked only for a write that is not a restatement); an attested row is revised and its attestation reads stale; an unpinned row gets a new version, a new embedding and the conflict check instead of a reinforcement. The same holds fordecision.outcome, the statement's second writer: a word-for-word repeat of an outcome on an old-form row is a revision, refused with 423LOCKEDon a locked row and leaving an attested row's attestation stale; it passes the row's ownpinned, so a pinned row takes it (no 409). No shim is added; each row moves to the new form the first time its decision is recorded again or given an outcome.PINNED_CONFLICTon a pinned row (decision.recordonly), 423LOCKEDon a locked row, and a stale attestation on an attested row. The reverted build'sloom decisions extractcan also miss a confirmed new-form row and record a reworded copy, until that decision is recorded again or given an outcome.Tests
pytest tests/unit -p no:randomlyon this branch rebased onto main: 25044 passed, 20 skipped, 1 xfailed.make format lint typecheck: clean.pytest tests/integration/test_memory_for_file_decisions.py tests/integration/test_decision_record_source.py: 5 passed (run before the rebase onto main; the rebase changed none of the code these tests reach).test_decisions_that_read_alike_each_keep_a_live_rownow uses a longer shared reason: with the short one, the test embedder's closeness between two such statements was decided by the key each embedded text ends with, and no pair reached the conflict threshold once the sharedCategory: … Scenario:prefix was gone. The test still asserts that every decision keeps a live row and that the conflict rule fired.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 unit and integration runs above were checked.
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; the integration suite passes if server behaviour changed. (The two touched integration files pass locally; the full integration suite runs in CI.)main; no merged migration is edited. (No migration.)frontend/changed. (Unchanged.)docs/describe the system as it now is, and this description names any operator steps and wire changes.git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code