Repository navigation
Decisions are extracted from the whole document as claims cited by quotes and checked against them - #277
Merged
Conversation
zlareb1
force-pushed
the
feat/decision-extract-whole-document
branch
2 times, most recently
from
November 5, 2026 15:05
5f11f84 to
d808f42
Compare
…otes and checked against them Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…cal extraction output fits a whole read Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…environment variable Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…; the docstring limits the stored-words re-record to unfrozen rows 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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…) cannot read names nothing Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…the reconcile read 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]>
…e source-changed clearing Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…nd counts Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…s now Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…t reads as one phrase Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…tractor and harness 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/decision-extract-whole-document
branch
from
November 5, 2026 16:46
15e849c to
85356f3
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):
loom decisions extractand the document-source sync read a design document whole and write each decision as a maintainer would, its outcome, reasons and rejected options in plain words, each claim cited by quotes of the document and checked against them before it is recorded.Why
The extractor read a document in 6,000-character windows and kept a decision only when its reasoning and each rejected option's reason were one verbatim span of one chunk, a reasoning that said more than the outcome. A design document rarely writes a decision that way: the reason sits in another section than the choice (a problem slide, a list of missing cases, a measurement), the former approach a new design replaces is described rather than rejected in so many words, and some decisions are stated with no reason at all. On the design-rationale bench those decisions were never proposed, dropped by the span check, or kept with a fragment of the text as their "reason"; re-runs on a revised document also kept the old outcome, because the prompt showed it for reuse.
Design
memory_decision_extract_window_chars(new, LIVE, 24,000 characters), one window whatever its sections, otherwise windows of whole sections, as before. For each decision the model writes the outcome, the reasons the document gives and the options it rejects, in its own concise words; each claim cites one to three quotes. A decision with no reason is written with none. The known-decision list in the prompt shows category and scenario only (the key), never the old outcome.find_span(whitespace, letter case and label lines aside); a reason or rejected option with no found quote is left out, a decision with no found outcome quote is dropped, and an outcome quote in a recap, summary or background section locates nothing.decision_supportoutput cap 8000): every kept claim is read with its quotes and kept only when the quotes state or directly imply it; adding a reason, cause, number, name or rejected option fails. It does not judge the stage. The same call reads the extractor's stored rows on the document: still stated, and which candidate restates it. This keeps the invariant that no reason reaches an agent that the document does not give, without the single-span rule.source-changedtag); an unfrozen one is revised as the read words it only when the read gives its key in other words, and in its stored words and stage when only its files, source or tags changed. A restatement is named by a window that states the stored row when one does. A document with no window read (only image-only sections) judges nothing. The check reads a stored decision as its scenario, outcome, reasons and rejected options, without the stage verb or a realized outcome, and ignores a verdict on a key it was not asked about. A still-stated duplicate is never deleted. Another writer's row under a key is left alone, neither revised nor tagged: the check reads only the extractor's rows (before, such a row was taggedsource-changedwhen its text differed).Alternatives measured first, offline, with the same model: relaxing the span check with more text rules (tried before; unsafe for ordinary prose), and a union of several windowed reads (raises recall but keeps the fragment reasons). A whole-document read with cited claims raised recall the most without raising the invented-reason rate.
Scope and risk
server/memory/app/decision_extract.py,server/memory/domain/decision_extract.py, the fake model's answers to both prompts, the CLI help, thedecision_supportLLM stage besidedecision_extract(server/observability/genai.py), the bench harness's extraction estimate, docs.decision_extractcap. A reply cut at the cap loses its window, and the dropped line names the cap,--window-charsand the setting the sync reads. Every measured document is under 14,000 characters, so the measurements read each one whole, as the default does.knowledge_source_sync_max_pass_secondsof 600, 112 s at the 180 s floor) is given up astoo_large_for_pass, and one started later in a pass waits for the next pass. A 24,000-character document fits well inside either.decision.recordas before.Compatibility, rollout and rollback
loom decisions extract --window-charsdefaults to the new setting instead of 6000.memory_decision_extract_window_chars(24,000);decision_extractoutput cap 4000 → 12000 and a newdecision_supportcap (8000), both overridable throughLOOM_LLM_MAX_TOKENS_OVERRIDES.source-changed, then writes its own. The rows are the extractor's own and the next run by N writes them again; written down as rule 30 ofdocs/architecture/rolling-upgrades.md. No gate holds the rollout.Tests
tests/unit/test_decision_extract.pyrewritten for the contract: grounding (found, left out, stored as the document's words, across labels and case), the support check (unsupported outcome and claims, a lost, unreadable or cut check and the cap it names, reply parsing), the confirmation read before a retire and a second check that overturns the first, verdicts over two windows (one window stating, one leaving the row out, a second check leaving it out), a verdict that is not true or false read as none, a restatement naming a dropped duplicate, a pinned row with no verdict gaining the repository tag, an unjudged row recorded again in its stored words and stage, a long rejected option read as the same words once cut, a window without a row's text naming no heir for it, a lost second check on a flagged pinned row, a missing verdict on a frozen or acted-on row, a document under the window read as one window across its sections, a still-stated row keeping its words when a revision adds a reason, a restatement under a gone or unjudged row's key, restatements and duplicates, another writer's pinned row, the stage note, and every reconcile, retire, repository, refusal and race path the old suite covered. The fake support check in the test world judges a stored row stated when its reasoning is in the text or restated by a candidate.tests/unit/test_bench_design_rationale.py: the extraction estimate counts the support check and the second check (an estimate, not a bound: the extraction leg can spend past--max-usd); the stored-statement bound readsdecision.record's field limits.make format lint typecheckpass. Full unit suite on the merge head: everything passes except four cases oftest_the_delimiter_is_sniffed_in_bounded_time, a timing test that fails the same way onmainon the machine that ran it.Measured on the design-rationale bench (
bench/design_rationale/), K = 3, one judge, the default model for extraction, answers and judging; arm 3 is hand-written gold rows, arm 4 the extracted rows, both served through the pre-edit block andloom_search. Two task sets: a private development set (five design documents, 10 why-questions, 15 change tasks, 10 supersession and abstention tasks), and a held-out set of five public design proposals of a public repository (10 why-questions, 12 change tasks, 6 supersession and abstention tasks, three revised documents), with gold rows written once from each text before this change was tuned. Both runs serve decision rows whole in search excerpts (the change in A search excerpt serves a decision or constraint row as stored #276), so the delta here is the extractor's.Held-out, arm 4 minus arm 3:
Development set, arm 4 minus arm 3: main's extractor A precision -18.3, A recall -45.6, B avoids -13.0, C states current 50 / 100; this change -17.5, -30.9, -30.9, 63.3 / 100 (A recall and B avoids both measure -30.9; B is worse than main's). The development set's change tasks depend on the pre-edit block (arm 3 is served it on 27 of the 30 tasks with gold rows, both arm 4 builds on 1-5): its gold rows name files of features not yet on the indexed branch, which no extractor can link, and the B difference is inside its interval (MDE about 30 points at this size). Extraction-only scores against the gold rows (a stronger model judging each gold decision found, and each extracted row correct), development set: main's rows cover 20% of gold decisions in full and 40% of their reasons, this change 57% and 75%, invented reasons 0-6% of rows in both.
The change itself, arm 4 on this branch minus arm 4 on main with A search excerpt serves a decision or constraint row as stored #276, per task, bootstrapped over documents (95% interval; the harness's paired bootstrap):
Held-out A recall is the one delta whose lower bound clears zero. On the development set A misleading rises (its lower bound is zero) and B avoids falls with an interval that spans zero: five documents and the 14 change tasks scored in both runs cannot decide B.
Reproduce:
python -m bench.design_rationale run <taskset> --arms 3,4 --k 3 --code-index <url> --code-index-org <org> --code-index-namespace <ns> ..., thenscore.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; I checked the grounding and verdict paths against the reconcile and retire rules, ran the tests, and measured on both task sets.
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, typecheck and the touched unit tests pass; the full unit suite runs before merge;tests/integration/test_decision_extract_repo.pypasses (2) against a private ClickHouse with the fake model.)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