Building agent memory with scope and recency as hard retrieval constraints

gentleforest325 · reddit · 2026-11-23

A developer recounts how a coding agent misdiagnosed an auth failure by citing a valid-looking OAuth doc that belonged to a different service — pure vector retrieval optimizes for semantic proximity, not ownership or validity. Their fix treats scope and recency as hard constraints at the retrieval layer: a scalar filter pins the service under investigation, keyword matching catches protocol/library names embeddings blur, and vector similarity handles loose semantics, all in one query plan via seekdb so scalar pruning happens before vector ranking. Decision changes are marked superseded and filtered to current records, keeping old entries queryable for audits. They now track wrong-service evidence and obsolete decisions as separate failure modes, arguing boundaries belong in the retrieval layer, not post-hoc application code.

Original post →

More from coding & agent

coding & agent channel →