Repository navigation
RAPTOR tree is built for every document and discarded — no loader, no retrieval path, no metric #14969
Copy link
Copy link
Open
Labels
area: kb-retrievalWave 5 · cluster J — Knowledge-base retrieval qualityWave 5 · cluster J — Knowledge-base retrieval qualitybackenddead-codeCode with no call sites — safe to removeCode with no call sites — safe to removeknowledge-basepriority: highrag
Milestone
Description
Problem
The RAPTOR tree is built for every document that has embeddings, at a cost of one LLM
call per cluster per level, and then discarded. Nothing reads it.
Evidence
grep -rn 'raptor_tree' across the repo returns three non-test hits, and they are the
declaration, the assignment, and its own log line:
autobot-backend/knowledge/pipeline/base.py:32—self.raptor_tree: Dict | None = Noneautobot-backend/knowledge/pipeline/cognifiers/summarizer.py:107—
context.raptor_tree = await self.build_raptor_tree(chunks, context.embeddings)summarizer.py:108— the log line reporting how many levels were built
Confirming there is no sink:
- No loader reads it.
autobot-backend/knowledge/pipeline/loaders/contains
chromadb_loader.py,sqlite_loader.py,mesh_seeder.py,redis_graph_loader.py;
none referenceraptor_tree. PipelineResult(base.py:35-53) has no field for it, so it is not even counted in
metrics — the waste is invisible.autobot-backend/knowledge/summary_search.pyretrieves by
levelin {chunk,section,document} — the flat three-tier path produced by
recursive_summarizer.py, not the L0/L1/L2 tree.- No loader serialises the context generically (no
vars(context)/asdict(context)
path exists), so it is not being persisted incidentally either.
Proposed approach
- Persist tree nodes through
chromadb_loader.pywith alevelfield (L0/L1/L2)
and theirsource_chunk_ids, so the existingSummarySearchServicemachinery is
reused rather than a parallel store introduced. - Extend
summary_search.py(search_summaries,drill_down) to traverse tree levels
alongside the existing chunk/section/document levels. - Add a
raptor_nodescounter toPipelineResultso a future regression to
build-and-discard is visible in metrics rather than silent.
Risks / constraints
- Depends on the provenance fix in RAPTOR tree nodes are built with an empty source_chunk_ids, so no tree node can cite its sources #14968 landing first — wiring a tree whose nodes cannot cite
their sources would have to be redone. - Level naming must not collide with the existing
SummaryLevelvalues. - If the tree is judged not worth retrieving against, the correct outcome is still not
to leave it built-and-discarded: either wire it or stop building it, decided
explicitly.
Acceptance criteria
- Tree nodes are persisted and retrievable by level
- A retrieval against an upper level can drill down to L0 chunks via
source_chunk_ids -
PipelineResultreports the node count - A test asserts nodes are readable back from the store, not merely that the loader
was called
Part of #14967
Blocked by: #14968 (provenance must land first)
Blocks: #14972
Implementation order for the whole umbrella is in #14967.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: kb-retrievalWave 5 · cluster J — Knowledge-base retrieval qualityWave 5 · cluster J — Knowledge-base retrieval qualitybackenddead-codeCode with no call sites — safe to removeCode with no call sites — safe to removeknowledge-basepriority: highrag
Activity
mrveiss commentedon Sep 17, 2026
This issue's premise does not hold, and the correction is load-bearing for sizing it. Found while implementing #14968 (PR #16916).
It is not built, so there is nothing to discard and no cost being paid.
_summarize_groupspassedlevel=SummaryLevel.SECTION, butSummaryLevelisLiteral["chunk", "section", "document"]— a type alias with no members.Literal[...].SECTIONraisesAttributeErroron the first call, andprocess()swallows it:So
build_raptor_treehas been throwing before producing a single node, at warning level, for as long as that call has existed. Every level above L0 is absent — not empty, not uncited, absent.Two consequences for this issue:
source_chunk_ids" needs upper levels to exist and to carry provenance. fix(kb): the RAPTOR tree is built at all, and its nodes cite their chunks (#14968) #16916 delivers both — thelevelfix so the tree builds, and the provenance fix so its nodes cite their chunks. Before that, a loader written to this issue's spec would have persisted nothing and passed its own tests against an empty tree.So this issue is now correctly scoped for the first time: the tree really will exist after #16916 merges, and it really will have no sink. The four acceptance criteria stand as written; they just describe work that was previously impossible rather than merely undone.
Recommend it be picked up after #16916, not alongside it. I hold the claim on this issue but am not implementing it — it is a persistence feature (loader, retrieval path,
PipelineResultfield), too large for one honest review pass beside the fix, and it needs #16916's output to test against. Releasing the claim so it is visible as available; happy to take it if nobody else does.mrveiss commentedon Sep 28, 2026
Classification (for work assignment — not a fix proposal)
kb(secondarychromadb): persisting and retrieving the RAPTOR tree.autobot-backend/knowledge/pipeline/base.py(verified on main;raptor_treedeclared at:32)autobot-backend/knowledge/pipeline/cognifiers/summarizer.py(verified on main; assigned at:107)autobot-backend/knowledge/pipeline/loaders/chromadb_loader.py(verified on main)autobot-backend/knowledge/summary_search.py(verified on main)grep raptor_treeon main still finds only the declaration, the assignment and a log line; no loader reads it.Generated by Claude Code