Skip to content

A search excerpt serves a decision or constraint row as stored - #276

Merged
zlareb1 merged 12 commits into
mainfrom
fix/search-excerpt-decisions-whole
Nov 5, 2026
Merged

zlareb1 merged 12 commits into
mainfrom
fix/search-excerpt-decisions-whole

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

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 search that serves excerpts (bodies="excerpt", the loom_search default) now shows a decision or constraint row as stored (the write-time clip: 1,200 characters, more for an extracted answer) instead of its first 200 characters.

Why

A decision row's statement opens with its scenario and outcome; its reasons and the options it rejects come after. With bodies="excerpt" every memory hit was cut at memory_search_excerpt_chars (200), so an agent that searched for why something is built a certain way read the outcome at best and never the rejected options or their reasons. On the design-rationale bench (bench/design_rationale/), the extracted decisions reached the agent through search only (they carry fewer files than hand-written rows, so the pre-edit block served few of them), and the excerpt cut most of each row.

Two other surfaces already serve decisions in full: the pre-edit block prints them whole (memory.for_file, up to memory_for_file_whole_tokens), and the repository decision leg of loom_search serves them as stored (server/memory/app/loom_search/repo_decisions.py, which pins bodies="full"). This brings the home namespace's search in line with them. The stored excerpt is already bounded at write time (EXCERPT_LIMIT, 1,200 characters, server/memory/domain/excerpt.py), so a decision or constraint row skips the excerpt clip and needs no cap of its own.

Scope and risk

  • _apply_bodies (server/memory/app/search/payload.py) leaves the stored excerpt of a decision or constraint row (is_whole_row, new beside is_decision in server/memory/domain/decision_schema.py, and now also what memory.for_file reads to print a row whole) unclipped; every other row is clipped as before. bodies="none", "full", "unit" and "source" are unchanged.
  • More tokens per decision or constraint hit in loom_search and memory.search with bodies="excerpt", at most the stored excerpt each (1,200 characters; an extracted fact that carries a structured answer can hold up to memory_structured_answer_excerpt_limit, 4,096). Rows tagged constraint include conversation facts the extraction tags so (a diet, an allergy), not only design decisions; they are served whole too. This includes the large-k excerpt default (memory_search_excerpt_bodies_k, a request above it that pinned no bodies): a decision-heavy response at bodies="excerpt" can carry several times the bytes the 200-character clip gave (six for a 1,200-character excerpt, about twenty for a 4,096-character answer), never more than bodies="full" would.
  • The anchor_first / recent_first tier hits now carry their row tags (stamp_row_tags), so a constraint served from a tier is kept as stored like one from a search leg.
  • The bodies descriptions of loom_search (the MCP tool schema and the op model) and memory.search say so (docs/reference/operations/search.md regenerated).
  • CONSTRAINT_TAG moves from server/memory/app/decision_extract.py to server/memory/domain/decision_schema.py beside DECISION_TAG; for_file's _WHOLE_ROW and _ORDER SQL and code_plane_reads read it instead of the literal (no behaviour change).
  • No stored data, auth or tenant path changes.

Compatibility, rollout and rollback

  • Wire: no op or field changes; bodies="excerpt" returns longer bodies for decision and constraint rows.
  • Operator steps: none. No new setting.
  • Rollback: revert; nothing is stored.

Tests

  • tests/unit/test_search_bodies_floor_mode.py: from a stored excerpt built by build_excerpt over a decision.record statement, a decision by type or row tags and a constraint by row tags are served as stored with their rejected option; a constraint from the recent_first tier keeps its excerpt; a plain row is cut at memory_search_excerpt_chars; bodies="none" still blanks a decision.
  • make format lint typecheck pass. Full unit suite on the rebased head: everything passes except four cases of test_the_delimiter_is_sniffed_in_bounded_time, a timing test that fails the same way on main on the machine that ran it.
  • Measured on the design-rationale bench, private task set of five design documents (10 why-questions, 15 change tasks, 10 supersession and abstention tasks), K = 3, one judge, gold rows (arm 3) against extracted rows (arm 4) on main's extractor, before and after this change on one server build each:
Arm 4 A precision A recall B avoids C states current
before (excerpt 200) 66.7 45.6 60.0 20.0
after 79.6 43.7 67.8 50.0

The "after" row ran with decisions served as stored (up to 1,200 characters for a decision), which is what this change serves. The "before" row is the earlier full run on the same set; the arm 3 reference stayed within 80-86 on B and 96-98 on A precision in both. At K = 3 over five documents the B difference is inside its interval (MDE about 46 points), so this is direction, not proof; the mechanism (whole reasons and rejected options reach the reader) is what the change rests on. Reproduce: python -m bench.design_rationale run <taskset> --arms 3,4 --k 3 ... then score.

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 clip rule against memory.for_file's whole-row rule and the repository decision leg, and ran the tests and the bench 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 typecheck and make test-unit pass; the integration suite passes if server behaviour changed. (format, lint and typecheck pass; the unit suite as stated under Tests; no integration run: the change is in hit shaping, which the unit tests drive.)
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/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).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

@zlareb1 zlareb1 changed the title A search excerpt shows a decision or constraint whole up to its own cap A search excerpt serves a decision or constraint row as stored Nov 5, 2026
@zlareb1
zlareb1 force-pushed the fix/search-excerpt-decisions-whole branch 3 times, most recently from e648ad2 to 3a50f20 Compare November 5, 2026 14:02
zlareb1 and others added 12 commits November 5, 2026 14:29
bodies="excerpt" cut every memory hit to memory_search_excerpt_chars (200),
so a decision row's reasons and rejected options, which follow its outcome,
never reached an agent through loom_search. A decision or constraint row now
keeps up to memory_search_decision_excerpt_chars (6000, LIVE), as the
repository decision leg and the pre-edit block already serve them whole.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… cap

The stored excerpt is already clipped at write time, so the cap never applied.
One predicate, is_whole_row, now decides for the pre-edit block and search.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…eeps its stored clip

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]>
…le_row reads

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…t with no read

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… CONSTRAINT_TAG

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…T_TAG in the pre-edit markers

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
zlareb1 force-pushed the fix/search-excerpt-decisions-whole branch from 3a50f20 to ed97b90 Compare November 5, 2026 14:31
@zlareb1
zlareb1 merged commit 5fd3bbb into main Nov 5, 2026
22 of 24 checks passed
@zlareb1
zlareb1 deleted the fix/search-excerpt-decisions-whole branch November 5, 2026 15:00
@zlareb1 zlareb1 mentioned this pull request Nov 12, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant