Parent issue: Part of #89
Problem
The current query pipeline in cortex/Query.ts performs a simple hotpath→warm/cold flat ranking and does not implement the dialectical retrieval described in the design docs:
- It does not build or use a Metroid
{ m1, m2, c } probe for dialectical reasoning.
- It does not explore thesis/antithesis/synthesis zones.
- It does not perform bounded semantic neighbor subgraph expansion with Williams-derived limits.
- It does not compute a coherent ordering (TSP) of the returned pages.
Goal
Implement the full dialectical retrieval pipeline as described in docs/wiki/Retrieval.md:
- Use
MetroidBuilder to compute m1, m2, and frozen centroid c.
- Use the metroid to guide retrieval through thesis/antithesis/synthesis zones.
- Expand the result set via the semantic neighbor graph with Williams-derived bounds.
- Compute a coherent path ordering of returned nodes (Open TSP or heuristic) for narrative coherence.
Acceptance Criteria
- Query results include a
coherencePath and metroid in QueryResult.
- Subgraph expansion obeys
HotpathPolicy.computeSubgraphBounds(...) and does not scan the full corpus unnecessarily.
- A unit test verifies that a query returns a
metroid with m1 and m2 (when enough data exists) and that the returned path is ordered.
- No regression in existing hotpath ranking behavior.
Notes
This issue is a prerequisite for Knowledge Gap detection, curiosity probes, and a reliable retrieval experience.
Parent issue: Part of #89
Problem
The current query pipeline in
cortex/Query.tsperforms a simple hotpath→warm/cold flat ranking and does not implement the dialectical retrieval described in the design docs:{ m1, m2, c }probe for dialectical reasoning.Goal
Implement the full dialectical retrieval pipeline as described in
docs/wiki/Retrieval.md:MetroidBuilderto computem1,m2, and frozen centroidc.Acceptance Criteria
coherencePathandmetroidinQueryResult.HotpathPolicy.computeSubgraphBounds(...)and does not scan the full corpus unnecessarily.metroidwithm1andm2(when enough data exists) and that the returned path is ordered.Notes
This issue is a prerequisite for Knowledge Gap detection, curiosity probes, and a reliable retrieval experience.