Skip to content

Noise sections of a document rank below close hits and stay out of a context pack - #293

Merged
zlareb1 merged 13 commits into
mainfrom
feat/knowledge-section-value
Nov 7, 2026
Merged

zlareb1 merged 13 commits into
mainfrom
feat/knowledge-section-value

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 6, 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):

Document sections that are meeting notes, status reports or bookkeeping, and record no decision, are labelled noise at ingest. A noise hit ranks below every knowledge hit close to the query and stays out of context.pack and memory.stack; a decision written in meeting notes is still served. LOOM_KNOWLEDGE_NOISE_FILTER=false turns this off.

Why

Synced document sources hold meeting notes and status reports next to design documents. Those name the same components and discuss options the design rejected, so an agent reading them as design context is misled.

Where knowledge reaches an agent:

  • Through handle_knowledge_search: knowledge.search, loom_search's knowledge section (merged with repository docs in repo_docs.merge_hits), context.pack's knowledge section and memory.ask.
  • Through memory.stack's knowledge section, which reads hybrid_search itself. context.pack serves it too.
  • Unasked: context.pack and memory.stack hand knowledge to an agent unasked; both now leave noise out. memory.for_file and code.review_brief read no knowledge.

The design:

  • Label. section_value.is_noise(title, section_path, text) runs at ingest in build_chunk_rows, once per section: the windows of one long section share its verdict, read with their overlap left out. It is pure and deterministic, with no model call, and leaves a section as content when unsure.
    • A section with a line that records a decision is content. Decision words include "agreed", "decided", "approved", "Outcome:", "we opted for", "concluded", and a team's own choice: "we'll go with", "we're going to use", "we'll be using", "we're switching to", "we'll go ahead with", "proceeding with", "we picked", "the team picked", "X was picked", "we rejected", "Option B accepted", "let's use". A technical passive ("nulls are rejected") is not a decision. A proposal ("suggested we keep X") is not a decision, nor, in meeting notes, is a line that says none was reached ("we haven't decided", "not concluded", "Decision: TBD", "Outcome: no decision yet"), nor a question ("Are we going with Redis?"); the check runs per sentence, so "Agreed: drop the cache. Who owns cleanup?" is a decision. A heading counts like a line ("Cache: agreed to drop it", a deck's "Slide 4: Decisions"), except that a heading saying none was reached ("Decision: TBD", "Decisions pending") is no decision in any document. A placeholder word counts only when it ends the label: "Decision: open the replica to reads" is a decision.

    • Otherwise it is noise when one of these holds:

      • it lists unanswered questions under an open-questions heading ("Open questions", "Questions for reviewers"), or is a deck's closing "Questions?". A design section listing the questions a system answers ("Questions it answers") is content.
      • its document is meeting notes or a status report by its title. That needs a meeting or progress word (sync, status, weekly, standup, retro, ...), optionally followed by notes, minutes, update or report, with a date (2026-03-04, 2026/03/04, 3/4/26, March 4, 4 March) or a week after it ("Storage sync 2026-03-04"); or a date first with the meeting word ending the title ("2026-03-04 Meeting notes", but not "2026-03-04 Status page"); or a meeting word in the title with a date as the top heading of each meeting (a dated subheading such as "Rollout > Week 1" does not count). A document with no title is named by its first heading. A design document dated in its title keeps a word between ("Status page 2026-03-04"), and a slash pair with no year is not a date ("Order sync 24/7", "Replication sync 1/2"). Without the date the same words name a topic as often ("Standup reminder bot", "Meeting notes export service", "Upgrade notes from 1.x"), and so does a record word after a topic ("Implementation notes 2026-03-04"). A title that names a design document, a plan, a release, a migration or an incident never counts ("Calendar sync design 2026-01-15", "Release notes 2026-03-04"); _DESIGN_TITLE holds the words. In such a document every section that records no decision is noise, its bookkeeping (attendees, agenda, action items) included.
    • Outside dated notes, templates, chatter, logistics and bookkeeping headings are left as content. Every review round found design text that rules for them hid:

      • "The client will send the token";
      • "Welcome email goes out after the first login";
      • "Problem:" labels and path templates;
      • "Attendees" in a calendar service, "Changelog" in release tooling.

      No measured result depended on those rules.

    • The label sits in the chunk's existing chunk_metadata JSON ("noise": true on a noise section's chunks, nothing on content), so there is no new column, table or migration.

  • Filter. With the LIVE setting knowledge_noise_filter on (the default):
    • Among the hits a search reads (3×top_k with collapse_sections, top_k without, or a reranker's pool), noise hits move below the last hit close to the query. Every hit ranked above that one, close or not, comes before them, and every other hit keeps its order, so a query about the noise itself still finds it when no close hit ranks below it. "Close" means similarity 0.30 or more (the knowledge plane's private-first threshold), or the embedder's calibrated noise floor where that is higher. The bench embedder's floor is 0.22, so the bench ran at 0.30.
    • context.pack and memory.stack drop noise hits in the same served-hits read that drops another bot's rules. One wider read (4×top_k) fills the places either took, and if it fails the first pass answers.
      • Its cost was measured with POST /v1/knowledge.search (namespace_scope: "all_mine", rerank: "none") on a local server against its own ClickHouse. The namespace was the bench's knowledge namespace (19 documents) and the embedder text-embedding-3-large, with 4 queries × 3 passes each, paced under the rate limit. top_k 5 took 49 ms p50, and top_k 20 took 51 ms p50 and 53 ms p90. The wider read embeds the query again; the embedder's own latency is part of those figures. That is about 50 ms more on a turn where noise took a place, against context.pack's 600 ms p99 budget.
    • A noise hit does not end a private-first search before its public pass.
    • Nothing is deleted: knowledge.get returns the whole document. Each hit reports noise; loom_search's lean MCP answer carries it only when it is true.
  • Alternatives not taken:
    • A document-level label would hide decisions recorded inside notes.
    • A model classifier at ingest costs a call per section. The measurement below found no case where the rules lost a decision the agent needed, so it is not built.
    • Deleting noise would break "Loom deletes only what its writer asked to delete".

Measurement, on the design-rationale bench's private task set:

  • Setup. Ten distractor documents were added: per feature, the notes of a team sync and a status report naming its components and discussing rejected options. Three of them record a decision no design document states, and three D tasks ask about those decisions.
  • Design. Arms 2 and 6 read the same namespaces, documents and extracted rows, with the filter on and then off: K=3, one judge order, paired per task, bootstrap over documents.
Arm Kind Metric Filter off Filter on Delta 95% interval
2 A precision 75.7 76.3 +0.7 -9.5 .. +8.9
2 A recall 81.1 77.3 -3.8 -8.1 .. +1.7
2 A misleading 41.7 38.3 -3.3 -16.7 .. +14.3
2 B avoids 35.6 26.7 -8.9 -41.7 .. +19.0
2 D precision 66.8 80.1 +13.3 +5.3 .. +26.7
2 D recall 51.6 50.0 -1.6 -7.2 .. +4.5
2 D misleading 74.4 57.7 -16.7 -50.0 .. -0.8
6 A precision 89.8 85.2 -4.6 -8.9 .. +4.0
6 A recall 86.8 92.6 +5.8 -0.9 .. +21.8
6 A misleading 26.7 45.0 +18.3 -11.9 .. +45.2
6 B avoids 57.1 66.7 +9.5 +0.0 .. +23.1
6 D precision 80.9 84.9 +4.0 -4.4 .. +17.5
6 D recall 59.0 66.8 +7.8 -0.2 .. +18.1
6 D misleading 52.6 16.7 -35.9 -70.8 .. -16.7

Every metric is listed. The filter-on arms were answered three times as the rules were narrowed. The labels the agents read differed only in one design deck's agenda slide: noise in the first two runs, content in the last, which is the run shown.

  • Resolved in all three runs: arm 6's D misleading fell (−26.9, −29.5, −35.9), each interval clear of zero. Arm 2's D misleading and D precision also resolve in this run.

  • Arm 6 D recall: +7.3, +7.8, +7.8, resolved in the first two runs and just inside its interval in this one.

  • Not claimed: arm 6's B avoids moved +11.3, +3.6, +9.5.

  • Leaning against the filter: arm 6's A misleading rose in all three runs (+11.7, +16.7, +18.3), each time inside its interval. It is a consistent lean against the filter on why-questions that this task set cannot resolve, and the first thing to measure on a larger set.

  • Decisions in notes. The three tasks about decisions recorded in notes reach the same D recall with and without the filter in both arms (66.7), with no misleading answer in any arm.

  • Treatment. The knowledge hits agents read from the distractors fell from 47 of 90 to 15 of 65. Every design-document hit served with the filter off was also served with it on. The total falls because, in those tasks, the noise ranked below close design hits and the page's remaining places went to hits under loom_search's floor.

  • Labeller check. A separate writer, who did not see the rules, wrote a synthetic labelled set of 141 sections; it is committed as a fixture.

    Half Noise precision Noise recall Decisions in notes kept
    Dev half, first measurement 1.00 0.97 10/10
    Dev half, this head 1.00 0.19 10/10
    Held-out half, first measurement 0.83 0.80 7/10
    Held-out half, this head 1.00 0.17 10/10
    • Why recall fell. The set over-represents templates, chatter and logistics in documents that are not notes, which the rules now leave as content (see Label).
    • What a missed noise section costs. It ranks higher than it should; it is not pushed.
    • Held-out half at this head: noise precision 1.00, and 10 of 10 decisions in notes kept.
    • The held-out half is not untouched. It was measured first before any rule changed, and the fixes were then checked against it. The test pins both halves' scores exactly, with no floors, so a later rule change has to update them and say why. The fixture README asks for a fresh held-out batch before the rules are tuned again.
    • Measurement matches this head: the bench documents (5 design documents, their revisions, 10 distractors) were checked offline through build_chunk_rows. Their labels at this head are the ones the shown run read: the bench namespaces were relabelled with loom rechunk before it. Labels did not change from the shown run's to this head's. On the five design documents, 1 of 88 sections is noise, a closing "Questions?" slide.

Scope and risk

  • Touches:
    • the knowledge write paths (knowledge.upsert, add, bulk_add, the ingest job);
    • knowledge search ordering and the repository-docs merge;
    • the private-first stop;
    • the knowledge sections of context.pack and memory.stack.
  • Leaves alone:
    • The dashboard: its search view reads hits without the new noise field, so it lists noise lower with no mark. Showing the label is a follow-up.
    • Decision extraction (decision_extract.py), which still reads every section. The label is exposed for it to skip noise sections, as separate work.
    • memory.ask's passages, which answer a question the caller asked and see noise last, as search orders it.
  • Risk: a false positive ranks a real section last and keeps it out of a pack. On the held-out set it happens to none of the 10 decisions in notes at this head; earlier, broader rules hid up to 3. The setting turns the filter off live.

Compatibility, rollout and rollback

  • Wire:
    • A search hit gains noise (bool, default false).
    • New LIVE setting knowledge_noise_filter, default true.
  • Rolling upgrade: build N-1 ignores the new chunk_metadata fields.
  • Operator steps:
    • No migration.
    • The label is written with the chunks. A document stored before this build, written through an N-1 replica during the rollout, or retitled by knowledge.update_metadata without reindex=true, keeps its chunks' earlier label (none reads as content) until they are written again. Run the relabel below once the last N-1 replica is gone.
    • Text documents. A text document, a synced one included, is relabelled by loom rechunk --org O --namespace N --apply; a sync rewrites only the files that changed. That command also rewrites every ingested file in the namespace into a text document, so in a namespace that holds ingested files, run it per text document with --source-uri.
    • Ingested files. An ingested file is relabelled by a new knowledge.ingest of its original.
  • Rollback: chunks keep the label in chunk_metadata, and an earlier build ignores it.

Tests

  • Unit: tests/unit/test_section_value.py covers:
    • the labelled set, both halves;
    • bookkeeping and decision cases;
    • the row builder's metadata and a row without the label;
    • noise_last with the filter on and off;
    • context.pack with the filter on and off.
  • Integration: tests/integration/test_knowledge_noise_sections.py runs against a server and its own ClickHouse:
    • It upserts a notes document and reads each stored row back. It compares the request's fields exactly and checks the derived ones (document version, model, vector width, both content hashes, write times), and it checks each search hit's noise.
    • It writes one text under a dated notes title and under a design title, through knowledge.add and through knowledge.bulk_add, and checks the labels each path stored.
    • The reordering (through handle_knowledge_search, with the filter on and off) and the pack and stack filters are covered by unit tests.
    • The ingest job's path (title=job["title"]) is covered at unit level only: an ingest needs the extractor service and the ingest worker. A unit test feeds StructuralChunks through build_chunk_rows, and the job's title is the key its chunk contexts already read.
  • Gates: make format-check lint typecheck pass; the full tests/unit suite runs on the final head before merge.

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 classifier against a labelled set its rules were not tuned on, and the paired bench run with the filter on and off.

  • 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 locally; the unit job and all four integration parts pass in CI)
  • 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 force-pushed the feat/knowledge-section-value branch from 5809dcb to a11fdcf Compare November 6, 2026 15:57
@zlareb1 zlareb1 changed the title Noise sections of a document rank last and stay out of a context pack Noise sections of a document rank below close hits and stay out of a context pack Nov 6, 2026
@zlareb1
zlareb1 force-pushed the feat/knowledge-section-value branch 10 times, most recently from 48f5ced to be11623 Compare November 7, 2026 06:51
zlareb1 and others added 13 commits November 7, 2026 08:36
…context pack

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]>
… content

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… bare by an undecided phrase records none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… an undecided line's label records none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…er before a dash means no decision

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…rd after a placeholder stays a decision

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…object stays a decision

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]>
… underscores included

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 force-pushed the feat/knowledge-section-value branch from 4ce771c to 99d8fd5 Compare November 7, 2026 08:41
@zlareb1
zlareb1 merged commit a1a8202 into main Nov 7, 2026
38 checks passed
@zlareb1
zlareb1 deleted the feat/knowledge-section-value branch November 7, 2026 09:12
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