# WO-06 — Temporal Hybrid Retrieval

**Status:** in progress  
**Primary modules:** `packages/memory/src/hybridMemoryRetriever.ts`,
`pprRetrieval.ts`, `temporalGraph.ts`, `memoryGraph.ts`  
**Depends on:** WO-02, WO-03, WO-05

## Problem

Vector-only retrieval misses exact code locations and versions; lexical-only
retrieval misses associations; timeless retrieval resurrects obsolete evidence.

## Contract

Retrieve from a union of exact path/hash/range lookup, lexical search, semantic
search, graph traversal, and temporal validity filtering. Rerank only records
allowed by authority and task epoch. Return evidence IDs and abstain where the
support threshold is not met.

## Todos

- [x] Add a retrieval query model containing task epoch, active action, claim
  IDs, artifact revision constraints, authority boundary, and token budget.
- [x] Implement exact-artifact and lexical candidates before vector/graph
  expansion.
- [x] Add temporal supersession filtering and contradiction surfacing.
- [x] Use dependency-graph traversal for multi-hop candidates.
- [x] Add a deterministic reranker with diversity and body-once constraints.
- [x] Return `abstain` with a specific missing-evidence request instead of
  generating unsupported orientation.

The implemented slice is deliberately bounded in `ContextMemoryLedger`: it
uses exact path/revision/range constraints, optional host semantic scores, a
six-hop/128-node active-work graph walk, a 32-record/48k-character materialized
body ceiling, and an explicit `graphTruncated` signal. It is not yet the full
cross-store/vector retriever or replay-trace quality evaluation required by the
definition of done.

## Acceptance tests

- A changed file revision outranks and supersedes its older body.
- Exact cited ranges outrank semantically similar but unrelated code.
- A two-hop task-to-claim-to-evidence query returns all required support.
- Missing support returns abstention rather than fabricated facts.

## Definition of done

Retrieval tests pass on synthetic temporal graphs and on redacted Omnius trace
fixtures with measured next-action evidence recall and precision.
