Repository navigation
loom decisions extract mines a document into decision records - #174
Merged
Merged
Conversation
zlareb1
force-pushed
the
feat/decisions-extract
branch
from
November 2, 2026 03:18
23db44a to
9972c18
Compare
One model call per window of a knowledge document's sections; a candidate is kept only when its quote, reasoning and each rejected option's reason sit inside one chunk. Kept candidates are reconciled against the key's active record by their verbatim fields and against pinned decision rows, written through decision.record as loom-decisions, and a re-run revises or retires the extractor's own rows and tags a contradicted pinned row, or one with a recorded outcome, source-changed. memory.for_file marks a decision row (unconfirmed) and (source changed ...). 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]>
…it block reads it The extractor and memory.for_file share one rule, trust.confirmed: pinned, or attested in its current form. An attested extractor row the document contradicts is tagged source-changed rather than re-recorded, and one whose reasoning left is tagged rather than deleted; its printed body says to attest the new decision again. A cleared tag's note is appended to the outcome note. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…under 12 characters are dropped The restatement check reads every identity's row of a close hit's key exactly (actors_by_key, then memory_rows_by_identity_keys) and skips the candidate when one is confirmed, pinned or attested. A quote, reasoning or rejected reason shorter than 12 characters is dropped: it is in every document, so its row would never retire. The help, comments and docs say confirmed where they said pinned. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…leaves its row The source-changed tag write passes the value's hash read, so a decision.outcome or re-record since then is refused instead of overwritten, and reconcile reads the row with sequential consistency. Each decision.record and memory.delete_version call leaves the audit row the transport writes for that op, actor process:cli:decisions, as memory.import does for its in-process writes. An exact rejected reason is matched before a cut one. The row listing reads previews. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…it and delete helpers decision.record takes no precondition, so a decision.outcome landing between the run's read and its re-record is replaced; the code and docs say so beside the tag write's value-only precondition. The audit helper writes the op name, the CLI actor and the input, as the transport does for these two ops. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ther decision tags _candidates checks a candidate against decision.record's field limits; reconcile builds the input without a None path. SOURCE_CHANGED_TAG lives in decision_schema with FAILURE_TAG and the other decision tags. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…eger cap says why Of two cut rejected options sharing a prefix, the one with the longer stored reason is matched first, so the shorter cannot take its candidate. A non-integer --max-per-section or --window-chars is refused as not an integer. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…h, not as a setting The symbol lookup returns the definitions, so a backticked snake_case name the index defines in several files adds no file and is printed unresolved as several definitions; only a name with no definition is reported as a setting. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…t path is a file A LoomServerError from a write (a busy key, a store timeout) is reported like a refusal and the run goes on. A repository path the quote or reasoning writes out joins the resolved files, since the explicit list turns off decision.record's own detection. An unchanged decision is held by its stored outcome for the retire step. The docs say the tag write is a full revision that can mark a decision conflicted. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…go to stderr Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…the threshold Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…or; list fields read safely row_content_sha256 moves to trust: memory.get and the extractor read a row's live hash through it, falling back to the value's hash when the column is unset, so an attestation binding the value confirms the row. A reply whose alternatives or mentions is not a list reads them as empty. The confirmed rule's docstrings name a person or a service account. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…call, exit 2 on refusals A keyed provider with no key set refuses the run before any model call: the client would fall back to the fake model, whose decisions pass the verbatim check by construction. A provider configured as fake still runs. A model call that fails loses its window only. The command exits 2 when the server refused a write. The docs split the reconcile rules by row state and give the tag write and the races their own bullets. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…hing, and count races apart With no provider configured the client resolves to the fake model; the run now refuses that as it refuses a keyless keyed provider, and runs on fake only when LOOM_LLM_PROVIDER names it. A run whose every model call failed or came back unreadable reports an error and retires nothing. A write that finds its row deleted or rewritten since the read is a race, reported apart from server refusals and not counted in the exit code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
A source-changed tag write whose value hash no longer matches answers 409 with the live hash; it is now reported as rewritten since the run read it, beside a row deleted since, and does not count in the exit code. A busy key's PRECONDITION_FAILED, which carries no hash, stays a refusal. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… refusals A reply whose provider is fake, as a keyless fallback model answers, is a lost window unless LOOM_LLM_PROVIDER chose fake. A refused reconcile write is listed in refused as a retire refusal is, and the exit code reads that list alone; the printed report shows it once, as its dropped line. The window read moves to its own function. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… scope Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/decisions-extract
branch
from
November 2, 2026 06:00
7199f50 to
4ec5751
Compare
…, not raised memory.set and memory.search embed in-process and let an httpx error or a timeout through as raised; the per-candidate and retire catches take them too, reported as failed with the error's name and counted in the exit code. The help, the report comment and the docs name the four ways a run reads nothing, and the docs say loom_search shows no source-changed note. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ke on purpose Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ed, in a dry run too Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…eads report cleanly A candidate whose reconcile raised is marked handled, so the retire step neither deletes nor tags the row it just failed on. The retire step's record read sits inside its catch, and a failed read of the extractor's own rows before any model call stops the run with an error, exit 1. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…fake-chosen check 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]>
… candidate's refusal lives on its dropped line The restatement memory.search asks for 20 decision rows, cosine only, so a confirmed restatement ranked below closer unconfirmed hits still blocks the write. A refused or failed candidate is a dropped line marked refused; ExtractReport.refused holds the retire step's alone, and the exit code reads both. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…r row A window that failed, came back unreadable or was answered by the fake model is a read the run needed, so a document read only in part exits 2. A race while clearing a tag is reported once, in races. The extractor's records are read once beside its rows and shared by the prompt's list and the retire step. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… docstrings reflowed Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ped actions 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]>
…comments 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]>
…a stale test 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.
Related: #163
Related: #164
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):
loom decisions extract --org O --namespace NS --source-uri URI [--apply]reads a knowledge document and records the decisions it states throughdecision.record, keeping only candidates whose quote, reasoning and rejected options' reasons are the document's own words.memory.for_filemarks a decision row whose source document no longer says it(source changed since confirmation), or(source changed)while it is unconfirmed.Why
A design document is where the reasons behind code live, and an agent about to edit that code never reads it. Decision rows with
filesreach the edit throughmemory.for_file. Nobody writes those rows by hand for every document, so this command extracts them. A model's reading of a document is wrong often enough that it must not reach an agent as fact. So the command keeps only spans copied from the document, marks every extracted row unconfirmed until a maintainer pins it, and never writes over a pinned row.Scope and risk
What the command does, in order (
server/memory/app/decision_extract.py, pure parts inserver/memory/domain/decision_extract.py):document_chunkshelper inserver/knowledge/app/document_reads.pythatknowledge.synthesizenow shares, grouped bycorpus_synthesis.windows(--window-chars, default 6000). A chunk with no words (an image under its heading) is not sent. With no chunks for a live document the command prints theloom rechunkline and writes nothing. With no live document it exits 1.completeper window throughget_llm_client()(the default extraction model), stagedecision_extract, JSON object reply{"decisions": [{category, scenario, outcome, reasoning, alternatives: [{option, reason}], quote, is_constraint, mentions}]}. The section is taken from the chunk holding the quote, not from the model. The system prompt lists the category, scenario and outcome of up to 30 decisions the extractor already holds for the document, and asks the model to reuse that wording for a decision the text still states, so keys stay put across runs. Category and scenario are shown whole (the key is built from them); only an outcome over 160 characters is shortened, ending in….quote,reasoningand every alternative'sreasonmust each be an exact substring of one chunk, and at least 12 characters long (a shorter span is in every document, so its row would never retire). A span across the join of two chunks fails, because that join is not in the document.--max-per-section(default 3) caps kept candidates per section. A candidate that does not fitdecision.record's field limits is dropped before it takes a section slot, a key or a code lookup. A repeated key is dropped, and so is a repeated (outcome, reasoning) pair, which overlapping chunks give two windows when the model words the scenario apart; as is a candidate whose category or scenario holds no letter or digit from a-z, 0-9, because the decision key has nothing to build from. Every drop is reported with its reason; a reply cut at the token limit says so and advises a lower--window-charsor--max-per-section. Each leaf section with no words gets animage-only, rationale not extractedline.live_writer_record. The document says otherwise only when a verbatim field differs: the reasoning, or the set of rejected options' reasons. The candidate's alternatives pass through the same dedup and 10-item cap asdecision.record, and a stored reason whose alternative was cut at 300 characters matches as a prefix, because the cut point moves with the option's wording; one cut before its reason matches any one remaining reason. The category, scenario, outcome and option wording are the model's own, and a real model words them anew on each run; comparing them would tag pinned rows and revise ours on every re-run of an unchanged document. Same verbatim fields, and the extractor's row carries the samefiles,source_resource_idandconstrainttag: no write. A verbatim field differs, or only those row fields (a file that resolves once the code is indexed, a renamed heading), on the extractor's unpinned row from this document: re-recorded (Revise). A verbatim field differs and the row is pinned and cites this document: no write. The fulldecision.recordbody is printed with the pinned row's identity tuple; to accept it, a maintainer unpins the row withmemory.unpinfirst, becausedecision.recordon a pinned writer row answers 409PINNED_CONFLICT. The row is taggedsource-changedbymemory.update_by_idon itsmemory_id(tags only, so the pin and value stay;memory.updatereads a-user or session as any and would answerAMBIGUOUS_KEYfor a key two identities hold), unless it already carries the tag. The tag write is a new version by the extractor: pin and value stay, and the row'sactorand age move to it, so a pinned team line readsby cli:decisions, just nowuntil a maintainer acts. A pinned row citing this document is tagged whoever wrote it. A row from another document, or another identity's unpinned row, is neither revised nor tagged; its body is printed. Nor is a decision whose record carries arealized_outcome:decision.recordrebuilds the record and thedecision:outcome-known/success/failuretags from its body, so a revise would erase whatdecision.outcomewrote. Re-applying the outcome afterwards would credit the run's memories a second time, so the extractor reports it (outcome_known) instead; when a verbatim field of such a decision differs, its row is taggedsource-changedand reportedflagged, as a pinned row is. The retire step likewise keeps a reworded row that has an outcome, and tags rather than deletes a row with an outcome whose reasoning left the document. A tag write that finds the row deleted since the read (updated=False) is reported as a race (deleted since the run read it), not a refusal.memory.update_by_idhas no precondition on tags (if_match_sha256covers the value only), so a tag written between the read and the tag write is lost; the code says so. When a run's candidate for a tagged row's key has the row's verbatim fields again, reconcile drops itssource-changedtag, pinned or not, as long as the row cites this document. The retire step never drops it, because it reads the reasoning alone and the tag may stand for a rejected option's reason the document still contradicts, or a tag a maintainer set (a maintainer can also drop it by hand withmemory.update_by_id). A refused write (HTTPException, or aLoomServerErrorsuch as a busy key'sPRECONDITION_FAILEDor a store timeout) is reported with its code, as a candidate's dropped line markedrefusedor in the retire step'srefusedlist, and the run goes on; so is one the embedding provider's error stops (memory.setandmemory.searchembed in-process and let anhttpx.HTTPErroror aTimeoutErrorthrough), asfailed: <error>. A tag write whoseif_match_sha256no longer matches (409 with the livecurrent_sha256) is a race, reported asrewritten since the run read it, not a refusal. With no record under the key: an in-processmemory.search(namespace_scope="this",memory_type="decision",search_mode="semantic",rerank="none",hyde=False,retrieval_budget="fast",top_k=20: cosine only and no model call, since the score is compared to the conflict threshold, a cosine; the 20 closest decision rows are checked) on the rendered statement. If the top hit under another key is at or above the namespace's conflict threshold (resolve_conflict_floor) and any identity's row of that key is confirmed, pinned or attested (the most similar such hit wins; every identity's rows of the key are read exactly throughactors_by_keyandmemory_rows_by_identity_keys, so a row with no recorded actor is not seen), the candidate is skipped asalready recorded by <agent> under <key>.qualified) or a bare CamelCase name (signalcamelcase) that the document text contains goes tocode.symbolin-process. When the definitions name one file, preferring the class over its constructor (DB::Foo::Foo), that file goes intofiles. Several files or none add nothing. The signal line for each name is printed. PR numbers and snake_case setting names are printed as unresolved in a dry run only; a backticked snake_case name is looked up first and counts as a setting only when the index does not define it. A name defined in several files adds no file and is printed as unresolved (several definitions). A repository path the quote or reasoning writes out (detect_value_files, asmemory.setuses) joins the files, since passingfilesturns offdecision.record's own detection. Acode.symbolfailure never fails the record: a decision already recorded keeps the files its row has for that run, and a new one is written with the files that did resolve.decision.record, agentloom-decisions, user/session-, confidence 0.5,source_class="derived",source_resource_id="knowledge:<ns>/<source_uri>#<section breadcrumb>"(breadcrumb of the chunk holding the quote), tagssource-kind:design_docplusconstraintwhenis_constraint. Actorprocess:cli:decisionscomes from the CLI runner'spipeline_actor. The query tag iscli.decisions.extract.a -> bin the output): the key comes from the model's own wording of the scenario, and a re-run that words it anew would otherwise leave a second unconfirmed row. I chose this over treating a close unconfirmed row as the row to revise, because exact matching on the verbatim reasoning needs no similarity read. The match takes the outcome as well as the reasoning, because two distinct decisions can rest on one reasoning span. Category is left out: it is as freely worded as the scenario, and an outcome on the same verbatim reasoning already names one decision. Besides that, the extractor's rows are bulk-read (get_many_by_keys) and filtered by document before any record read. It retires aloom-decisionsrow that cites this document, that this run did not reconcile, whose live record is the extractor's own (a key another identity recorded since is skipped), and whose recordreasoningis no longer in the document text. Unconfirmed:memory.delete_versionunder the extractor identity, which also tombstones the record. Confirmed (pinned or attested), or with a recorded outcome: taggedsource-changed. A delete or tag is reported only once written; a refused write, or a delete that finds the row rewritten since the read, is reported as such.source_resource_idcites<uri>when it starts withknowledge:<ns>/<uri>#, unless a longer document<uri>#<part>it also starts with was ever ingested (knowledge.getwithinclude_superseded). So a heading holding#(C# bindings) stays this document's, anddoc#v2#Introcitesdoc#v2once that document exists. The extra reads happen only for a citation with a#past the prefix.server/memory/domain/trust.py::confirmed, used by the extractor and bymemory.for_file's(unconfirmed). Wherever the steps above say pinned for the extractor's own rows (tag instead of revise, tag instead of delete, never replaced), an attested row is treated the same; its printed body says to attest the new decision again withmemory.verifyafter sending it. The tag write (memory.update_by_id, tags only) re-emits the row with its attestation columns, andcontent_sha256is the value's hash, unchanged by a tags-only write, so the attestation still binds.Design calls:
reasoningis itself checked to be verbatim, so the retire step tests it against the live text.--applywrites and--dry-runis accepted, as for every other write command (server/cli/_apply.py). A dry run still calls the model.memory.delete_version, notmemory.delete: it deletes only the exact identity and version that were read, never another agent's row of the key, and it retires the record the same way.server/llm/fake.pyanswers the candidate prompt with one decision per section resting on its first sentence, so a local or CI run on the fake provider goes end to end.memory.for_file's decision line (from the pre-edit block change on main:Decision (by …)head,— source: …,(unconfirmed)for a decision neither pinned nor attested) gains one note in_status_notes: a decision taggedsource-changedreads(source changed since confirmation)when pinned or attested and(source changed)when not, placed after(pinned)/(unconfirmed)and before(outcome: failed)and the code notes. An unpinned row with a recorded outcome is tagged rather than deleted, so the unconfirmed form is reachable.docs/concepts/memory.md, the plugin README and the decisions page name it.Left alone: prompt tuning on real documents, the sync worker leg, a model validator call. No new op, setting, table or column.
Risk: the run refuses before any model call when it would read the document with the fake model, whose decisions pass the verbatim check by construction: a keyed provider (
openai,anthropic) with no key set, or no provider configured at all (llm_provider_inferred());LOOM_LLM_PROVIDER=fakeset explicitly runs. Every fallback path is covered too: a window whose reply came from the fake model (LLMResult.provider == "fake", as a keylessLOOM_LLM_FALLBACK_MODELanswers throughserver/llm/fallback.py) is dropped as unread unless fake was chosen explicitly. A failed model call (a provider error, a timeout, a refused call) loses its window only and makes the exit code 2, and a run in which no window was read reports an error and retires nothing. A write that finds its row deleted or rewritten since the read is a race, reported apart. The command exits 1 when it could not read the document (no document, no chunks, no usable model, the extractor's own rows unreadable before any model call, no window read), 2 when a write, or a read it needed, was refused or failed (in a dry run too, and for a partly read document, where a window failed, came back unreadable or was answered by the fake model; races do not count), else 0. The command runs in-process with no token, likeloom rechunk, so only an operator can run it. Its records and deletes go under its own identity. Its writes to another identity's row are tags only, throughmemory.update_by_idconditional on the value read, on a row citing this document: thesource-changedtag on a confirmed row the document contradicts, and dropping that tag from a row, confirmed or not, the document says again. The tag write is a fullmemory.update_by_idrevision: the row is embedded again and meets the conflict check, so a decision with a close peer is markedconflicted(memory.for_filelists conflicted rows by default) and a stale conflict mark is cleared. Two races remain and are documented:decision.recordtakes no precondition (no wire field is added here), so adecision.outcomethat lands between the run's read and its re-record is replaced; and the tag write's precondition covers the value, so a tags-only change in the gap is overwritten. It never writes over a confirmed row. It deletes only its own unconfirmed rows on this document: when their verbatim reasoning is gone from the document, or when this run recorded the same outcome and reasoning under a reworded key. Eachdecision.recordandmemory.delete_versioncall leaves the audit row the transport would write for it (actorprocess:cli:decisions), asmemory.importwrites its own in-process audit rows;memory.update_by_iddeclares none over HTTP either.Compatibility, rollout and rollback
server/memory/app/decisions.py::clean_alternativesgains a keywordcut(defaultTrue, the existing behaviour).memory.for_file'srenderedtext gains the two markers on decision rows.decision.recordrows under agentloom-decisions, andsource-changedtags on pinned rows.Tests
tests/unit/test_decision_extract.py(fake model, stubbed planes; with the review round's cases: a refuseddecision.record, a refused tag (AMBIGUOUS_KEY), the tag sent bymemory_idwhen two identities hold the key, retire with another identity's active record, asource_uriholding#, a file resolving only on a later run, a moved section, a dropped constraint, a row from another document, a pinned row beside a newer unpinned one, a pinned row of another document, a#in a heading on reconcile and retire, a longer<uri>#<part>document, clearingsource-changedon reconcile, a tag kept on a run that does not emit the key, the most similar close hit with a pin, record reads only for this document's rows, a delete that finds the row rewritten, CLI floors for the caps, a re-run that words the scenario anew leaving one live row, a pinned row with a re-recorded reasoning kept, two decisions on one reasoning both kept when one is emitted, an unreadable code index keeping a row's files, a CJK scenario dropped without ending the run, a blank or padded rejected-option reason, a recorded outcome meeting a files-only change, a reworded row with an outcome kept, the unpin note on a pinned body, a reworded outcome or option leaving both a pinned and an unpinned row untouched, a changed rejected reason revising, the document's decisions in the prompt, an outcome row tagged not deleted, a tag write on a deleted row, a long reason cut at the cap with a reworded option, alternatives in another order, an unpinned tagged row cleared, an unchanged key held by another identity replacing nothing, the restatement search's options, a changed decision with an outcome flagged, a files-only change on one left, an alternative cut before its reason, a reply cut at the token limit, backticked snake_case names, eleven alternatives kept to ten, one scan of the extractor's rows per run, one decision worded twice across overlapping windows written once, an outcome row with stale fields cleared, an unfit candidate taking no slot, a long scenario keeping its key across runs, a long outcome shortened in the prompt,clean_alternatives(cut=False), attested rows in reconcile and retire, an attested restatement, spans under 12 characters, a tag write refused on a moved value, an exact reason matched before a cut one, one audit row per audited write and none in a dry run): the verbatim check (a pass, a paraphrased quote, a blank quote, a paraphrased reasoning, an alternative's reason, a span across two chunks); reply parsing; image-only sections and chunks; section breadcrumbs; mention sorting and class-over-constructor resolution. Each reconcile branch: new write with every written field, dry run output, identical, revise, pinned (tag throughmemory.update_by_idon the row'smemory_id, with itschar_limitpassed back, body with the pinned identity), already tagged, another writer, pinned restatement, a close unpinned peer and a distant pinned peer. Also the section cap and repeated key, and retire (deleted, flagged, other document, other identity, already tagged, dry run). Missing document and no chunks write nothing. An unreadable reply. The fake model's answer passes the check. Dry-run-by-default flags. Theprocess:cli:decisionsactor.tests/unit/test_memory_for_file.py: the source-changed note on a pinned team decision and an unconfirmed own one, none on a tagged fact, and throughhandle_memory_for_file.tests/unit/test_cli_hygiene.py: thecli.decisions.extractquery tag.tests/integration/test_memory_for_file_decisions.pypasses against a private server on this branch.--apply(rows with agentloom-decisions, actorprocess:cli:decisions,source_class=derived, confidence 0.5, thesource_resource_idabove, active records), re-run (bothunchanged). Then pin one row, re-ingest without the other section, re-run: the unpinned row is deleted and its record istombstoned. Then change the pinned section's text and re-run: no write, the body is printed, the row is taggedsource-changed, and pin and value are unchanged.system.query_logshowslog_comment = cli.decisions.extract. After the review round: a row seeded with the same text but otherfilesandsource_resource_idis revised to the document's breadcrumb, then readsunchanged; thesource-changedtag bymemory_idkeeps the pin; restoring the document's text clears the tag on the next run, and a retired row is recorded again when its section returns.make format lint typecheck, the CLI snapshot (LOOM_UPDATE_CLI_SNAPSHOT=1, additive diff only),docs_reference,test_package_contracts,test_llm_stage_registry,test_doc_links,test_public_copy,test_corpus_synthesis,test_decision_ops,test_file_rules_shared: pass.--apply,unchangedre-run, then a pinned row whose section changed was tagged and an unpinned row whose section left was deleted (recordtombstoned), then restoring the text cleared the tag and recorded the row again. The restatement search ran in-process (log_comment = cli.decisions.extracton itsmemory_embeddingsreads).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. Checked: every reconcile and retire branch against a real ClickHouse as listed above.
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. (format, lint and typecheck pass locally, with the unit files of every touched module; the full unit suite runs in CI)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.Eval 1
Eval 1 is a manual spot check: one sample per task per arm, run from an uncommitted script against a private Loom (this build, auth off, workers off) and its own ClickHouse. The answering model, the judge and the embedder are the server's configured providers. The task set is private: 10 why-questions (A1-A10) and 15 change tasks (B1-B15) over five design decks (
spilling-distinct-in,in-to-join-rewrite,outer-to-inner-join,hypothetical-indexes,reclaimable-memory-spilling).memory.for_file, 300-token budget) and theloom_searchmemory section under a code scope.loom decisions extract --applywrote from the five decks.Every task in every arm got the same prompt. Scoring ran the deterministic detectors first, then one judge call per task per arm.
Verdict: FAIL. Per the shipping bar, extraction quality comes next, before any sync infrastructure.
spilling-distinct-in7/19 = 0.37,hypothetical-indexes2/9 = 0.22B, task by task. Rejected-option avoidance was 3/15 for arm 0, 13/15 for arm 3 and 10/15 for arm 4:
Design satisfaction (no gold constraint broken) was 2/15, 12/15 and 11/15.
On a second read of the transcripts, three verdicts look different. B5 and B7 in arm 0 look like re-proposals that the judge and detectors missed, because the diff changed an unrelated setting or file. B14 in arm 4 endorses the rejected option in its plan, though it gives no diff. With those three counted, no gate result changes.
A, rationale correctness:
Citations:
Injected tokens, pre-edit block, arm 3: median 197 and max 323 per call over 29 distinct paths. The
loom_searchmemory section had a median of 761 tokens (max 1,006) in arm 3 and 382 (max 676) in arm 4. Only 3 of the 29 paths return a pre-edit block in arm 4, because 12 of the 40 extracted rows carryfiles.Two delivery defects:
render_block(server/memory/app/for_file.py) adds the "… N more" line after the budget check without reserving room for it, so a truncated block reaches 323 tokens against a budget of 300._SOURCE_CHARS). A long document URI therefore loses its#section. Agents cite the clipped string, and it never resolves.With
explain=true, no arm 3 gold row was withheld fromloom_search. In arm 4, all five decision hits for A7 were withheld as too weak to be an answer. That comes from the calibration floor, not from the foreign-memory rule.Extraction (arm 4). Each of the 40 rows was judged by hand against its deck: 11 correct, 24 partly correct, 2 wrong, 3 misleading.
The next extraction work this points to:
Image-only share of gold rows, per deck, was 0.0, 0.4, 0.67, 0.0 and 0.0 (in the deck order above). It costs A5 (partly), A7, B10 and B11. The extractor reports only slides with no text beyond the heading as image-only, so it misses diagram slides that have a one-line caption.
Code links: the private Loom has no code index. The script therefore patched the extractor's symbol lookup in-process to call
code.symbolon a separate read-only index of the target repository. It made read-only calls only and wrote nothing to that index. Without that patch, arm 4's rows would carry nofilesand reach agents through search only.Spend: 414 LLM calls in all, 367,061 input and 70,667 output tokens, $0.072. That includes discarded prompt drafts and judge passes. The reported protocol alone is 163 calls, 144,194 input and 28,840 output tokens, $0.029. Embeddings came to about $0.004.
Eval 1, run 2
Run 2 repeats Eval 1 on a build that includes #175 and #176:
Everything else matches run 1:
The protocol has three changes:
Sharpened gold rows. In run 1, arm 3 failed B6 and B11 because the served gold row left out the invariant the change breaks. In run 2, the gold rows for those two tasks state that invariant, using only what the deck says. Arm 3 ran twice:
The arm-3 gate items use 3s; the original rows are reported beside it.
Fresh extraction. Extraction ran from scratch into a fresh namespace.
Extraction precision by hand. I judged every extracted row against its deck again.
Verdict: FAIL. Per the shipping bar, extraction quality is still the next work.
What the fixes changed. #175 fixed the two delivery failures. All 20 document citations in the gold arms now resolve, and no pre-edit block goes over its budget. Sharpening the two rows turned B6 and B11 from re-proposals into push-backs.
B2 now fails in both gold arms. The agent quotes the served row, then removes the component anyway because the task asks it to. Run 1 pushed back on B2; with one sample, a compliance failure cannot be told apart from run-to-run variation.
The new A failure is noise. A6 in arm 3s misstates one reason. Its surfaces are identical to arm 3's, so this comes from sampling, not from the sharpened rows.
B, rejected-option avoidance:
Arm 4 re-proposes on B8–B12 and B15. On a second read of arm 0's transcripts, B1, B5 and B7 are also re-proposals that the judge and the detectors missed. That makes 14 for arm 0, of which arm 3s avoids 13. No gate result changes.
A, rationale correctness:
Citation precision: arm 3 46/47, arm 3s 48/49, arm 4 27/28.
Injected tokens:
loom_searchmemory section: median 761 tokens (arm 3) and 424 (arm 4).explain=true, no gold row was withheld.Extraction (arm 4). Extraction wrote 24 rows. By deck:
spilling-distinct-in: 16 rows (19 in run 1);hypothetical-indexes: 6 (9);reclaimable-memory-spilling: 2 (5);in-to-join-rewrite: 0 (4);outer-to-inner-join: 0 (3).My hand judgement of the 24 rows: 17 correct, 5 partly correct, 1 wrong and 1 misleading. That gives a precision of 0.75 on
spilling-distinct-inand 0.67 onhypothetical-indexes. Compared with run 1:The two small decks get one window each, and the model proposed no candidate in either, so tasks over those decks (A5–A7, B7–B11) saw no extracted row. The restatement filter also dropped the decision B15 depends on. What remains for extraction:
Image-only slides. The extractor reported only two heading-only divider slides as image-only. The eval decks mark diagram slides with a text placeholder rather than image markup, so the captioned-image rule from #176 cannot fire on them. That is a property of the eval input. The image-only share of gold rows per deck is unchanged from run 1: 0.0, 0.4, 0.67, 0.0 and 0.0.
Code links. As in run 1, the extractor's symbol lookup made read-only calls to a separate index of the target repository. 9 of the 24 rows got linked files.
Spend.
Eval 1, run 3
Run 3 repeats the run 2 protocol on a build that includes #177. That PR changes how extraction reads a document:
The protocol is unchanged from run 2:
Verdict: FAIL. Extraction precision now passes on both text-rich decks. The extraction-versus-gold items still fail, and most of the remaining arm-4 gap comes from content that exists only in diagrams.
The gold ceiling. Arm 3s fails only B11. The agent quotes the served row, says the requested change contradicts it, then implements the change because the task asks for it explicitly. This is the same compliance pattern as B2 in run 2, which passed in this run. With one sample per run, this is variance in agent compliance with a complete row, not a gap in the row.
The arm 3s misleading answer (A5) opens with a partial "no recorded decision", then gives the recorded reasons correctly. One judge call returned an empty grade for a substantive arm 3s answer (A3). Re-running that call once gave the same result. It adds no claims, so precision is unaffected; recall for arm 3s is understated.
B, rejected-option avoidance:
A, rationale correctness:
Citations. Every citation resolves in every arm. Resolve-and-support was 46/48 (arm 3), 53/58 (arm 3s) and 21/26 (arm 4).
Injected tokens. The pre-edit block reached a max of 249 in the gold arms. The
loom_searchmemory section had a median of 763 tokens in arm 3 and 375 in arm 4.Extraction. 13 windows plus 5 re-reads produced 25 rows:
spilling-distinct-inhypothetical-indexesin-to-join-rewritereclaimable-memory-spillingouter-to-inner-joinThat makes 19 correct, 5 partly correct, 0 wrong and 1 misleading.
outer-to-inner-join: still 0 rows after the empty-window re-read. Its decisions are one-line captions over diagrams, with no stated reason.Arm-4 failures by cause (B6–B8, B10, B11, B14, B15 and the A gaps):
loom_searchas too weakCaptioning image-only slides would plausibly recover up to the 6 image-only tasks. That can't be measured on this eval, because its deck files carry text placeholders instead of images, and B11 may still fail on compliance. The serving cause points at the calibration floor dropping short decision rows from the scoped repository.
Spend.
Eval 1, run 4
Run 4 measures the build that includes #180 and #181:
The setup was:
Verdict: FAIL. Arm 4 scores lower than in the previous K=4 run. The cause is this run's extraction, not the statement form:
The bracketed ranges are 95% intervals from a bootstrap over tasks.
Arm 3s misleading answers. The 0.75 per sample comes from one answer in each of A2, A5 and A9, each adding one uncited claim beside correct cited reasons. The previous K=4 run had none.
Means per arm (run 4):
Arm 4 versus 3s on B, passes out of 4 per task:
Arm 4 fails for these reasons:
Arm 4 A precision, pooled per task:
Arm 3s ranged from 0.84 to 1.00 across the A tasks.
Extraction, hand-judged. 23 rows: 14 correct, 8 partly correct, 0 wrong and 1 misleading.
spilling-distinct-inhypothetical-indexesreclaimable-memory-spillingin-to-join-rewriteouter-to-inner-joinThe misleading row is a rule from an earlier release's protocol. The reason-less-ban rule admits it because its quote contains a ban marker and its section heading carries a release tag, not a recap word.
Statement form against the 0.447 search floor. Embeddings only: the cosine of each task query against each row's embedded text as the server builds it.
The last two rows are whole-corpus counts, which differ mostly because the two extractions hold different rows. On B15, the reason-less ban row stays below the floor.
Spend.
🤖 Generated with Claude Code