feat(planner): knowledge-aware routing — temporal representation (Whitepaper v4)#3
Merged
Merged
Conversation
…presentation Whitepaper v4 groundwork: the planner routes across knowledge *representations*, not just retrieval algorithms. This adds temporal (bi-temporal) as a first-class routable representation and a representation taxonomy, without a big refactor and fully backward compatible. - types: add `temporal` IntentBucket + a `KnowledgeRepresentation` taxonomy - planner/representations.py (new): retrieval method -> representation map (document / graph / temporal / analytical / community / code / multimodal) - planner/rules: temporal intent cues (as-of / what-changed / superseded / point-in-time), placed before multi_hop; BUCKET_DEFAULTS + BUCKET_TIERS (temporal candidate + hybrid fallback) - store_router: optional `temporal` slot with empty-fallback — routes to the bi-temporal store only when one is bound and matches; otherwise falls back to single-hop, so a new representation never regresses default behavior - costmodel: temporal recall + a temporal-bucket edge so the planner prefers the bi-temporal store for time-dependent questions (mirrors how multi_hop prefers graph) - tests: 8 tests (routing, cost edge, router dispatch + fallback, bi-temporal point-in-time and what-changed semantics, representation taxonomy, end-to-end run) The reference temporal backend is the in-memory TemporalStore already in the tree; a real Graphiti engine binds via the same RetrieverPlugin seam at construction time. HippoRAG (graph) already routes end-to-end; this closes the temporal gap. Full suite green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Knowledge-aware execution planning (v4 groundwork)
Shifts the planner's decision from which retrieval algorithm to which knowledge representation answers the request — and makes temporal (bi-temporal) a first-class routable representation. Fully backward compatible; full suite green.
The idea
The planner already routes
multi_hop → graph(HippoRAG). This generalizes that pattern: a request maps to a knowledge representation (document / graph / temporal / analytical / community / code / multimodal), and the concrete retrieval method is a specialization within it. Retrieval becomes one family of knowledge access, not the whole of it.What's in this PR
types.py—temporalIntentBucket+ aKnowledgeRepresentationtaxonomy.planner/representations.py(new) — retrieval-method → representation map + helpers.planner/rules.py— temporal intent cues (as of/what changed/superseded/point-in-time), placed beforemulti_hop;BUCKET_DEFAULTS/BUCKET_TIERSemit a temporal candidate plus a hybrid fallback (the cost model picks).adapters/store_router.py— optionaltemporalslot with empty-fallback: routes to the bi-temporal store only when one is bound and a fact matches; otherwise falls back to single-hop. The new constructor param defaults toNone, so every existing caller (incl. the control plane) is unchanged.costmodel/estimators.py— temporal recall + a temporal-bucket edge so the planner prefers the bi-temporal store for time-dependent questions (mirrors howmulti_hopprefersgraph).tests/test_temporal_routing.py(new) — 8 tests: intent routing, cost edge, router dispatch + fallback, bi-temporal point-in-time (as_of) & what-changed (changes), taxonomy, end-to-end run.Open-core boundary (deliberate)
This PR ships the abstraction + routing scaffold + the in-memory reference plugins only. The differentiated engines stay optional/enterprise bindings behind the same
RetrieverPluginseam:TemporalStorealready in the tree; a real Graphiti engine + bi-temporal ingestion pipeline bind at construction time.graphslot.Notes
HopRouterRetriever(single_hop, graph, community=None, temporal=None).🤖 Generated with Claude Code