Repository navigation
Noise sections of a document rank below close hits and stay out of a context pack - #293
Merged
Merged
Conversation
zlareb1
force-pushed
the
feat/knowledge-section-value
branch
from
November 6, 2026 15:57
5809dcb to
a11fdcf
Compare
zlareb1
force-pushed
the
feat/knowledge-section-value
branch
10 times, most recently
from
November 7, 2026 06:51
48f5ced to
be11623
Compare
…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]>
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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/knowledge-section-value
branch
from
November 7, 2026 08:41
4ce771c to
99d8fd5
Compare
This was referenced Nov 7, 2026
Merged
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):
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.packandmemory.stack; a decision written in meeting notes is still served.LOOM_KNOWLEDGE_NOISE_FILTER=falseturns 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:
handle_knowledge_search:knowledge.search,loom_search's knowledge section (merged with repository docs inrepo_docs.merge_hits),context.pack's knowledge section andmemory.ask.memory.stack's knowledge section, which readshybrid_searchitself.context.packserves it too.context.packandmemory.stackhand knowledge to an agent unasked; both now leave noise out.memory.for_fileandcode.review_briefread no knowledge.The design:
section_value.is_noise(title, section_path, text)runs at ingest inbuild_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:
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_TITLEholds 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:
No measured result depended on those rules.
The label sits in the chunk's existing
chunk_metadataJSON ("noise": trueon a noise section's chunks, nothing on content), so there is no new column, table or migration.knowledge_noise_filteron (the default):top_kwithcollapse_sections,top_kwithout, 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.packandmemory.stackdrop 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.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 embeddertext-embedding-3-large, with 4 queries × 3 passes each, paced under the rate limit.top_k5 took 49 ms p50, andtop_k20 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, againstcontext.pack's 600 ms p99 budget.knowledge.getreturns the whole document. Each hit reportsnoise;loom_search's lean MCP answer carries it only when it is true.Measurement, on the design-rationale bench's private task set:
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.
build_chunk_rows. Their labels at this head are the ones the shown run read: the bench namespaces were relabelled withloom rechunkbefore 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
knowledge.upsert,add,bulk_add, the ingest job);context.packandmemory.stack.noisefield, so it lists noise lower with no mark. Showing the label is a follow-up.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.Compatibility, rollout and rollback
noise(bool, default false).knowledge_noise_filter, default true.chunk_metadatafields.knowledge.update_metadatawithoutreindex=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.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.knowledge.ingestof its original.chunk_metadata, and an earlier build ignores it.Tests
tests/unit/test_section_value.pycovers:noise_lastwith the filter on and off;context.packwith the filter on and off.tests/integration/test_knowledge_noise_sections.pyruns against a server and its own ClickHouse:noise.knowledge.addand throughknowledge.bulk_add, and checks the labels each path stored.handle_knowledge_search, with the filter on and off) and the pack and stack filters are covered by unit tests.title=job["title"]) is covered at unit level only: an ingest needs the extractor service and the ingest worker. A unit test feedsStructuralChunks throughbuild_chunk_rows, and the job'stitleis the key its chunk contexts already read.make format-check lint typecheckpass; the fulltests/unitsuite 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 typecheckandmake test-unitpass; 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)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