# StaleGate

- **Event:** [The Persistent Context Sprint Hackathon | Live at MongoDB .Local Build Fest](https://cerebralvalley.ai/e/persistent-context-sprint-hackathon)
- **When:** Thu, Aug 13 at 12:30 – 8:00 PM (PDT)
- **Where:** Pier 48, San Francisco, CA
- **Team:** [Sudharsana Rajasekaran](https://cerebralvalley.ai/u/sudhan30)
- **GitHub:** https://github.com/Sudhan30/stalegate
- **Demo video:** https://youtu.be/A5bOXDtSHlU
- **Gallery:** https://cerebralvalley.ai/e/persistent-context-sprint-hackathon/hackathon/gallery
- **Page:** https://cerebralvalley.ai/e/persistent-context-sprint-hackathon/hackathon/gallery/75

Agents don't only hallucinate — they confidently act on facts that stopped being true. Ask an on-call agent who's on call for payments and it pages Marcus Webb, who rotated off six days ago. The stale memory wasn't a marginal retrieval hit: it outscored every fresh result, 0.94 to 0.92. Relevance and truth are different axes, and vector search only measures one of them.

StaleGate is a runtime freshness gate between an agent and its memory. Freshness is enforced inside the MongoDB Atlas Vector Search pre-filter, so expired memories never enter the ANN candidate set. Every read returns FRESH, STALE or UNKNOWN. When the expected cost of acting on a stale fact exceeds the cost of checking, StaleGate re-queries an authoritative record, rewrites the memory, and learns that source's real lifetime from the outcome — four sources sharing one 3-day prior learned lifetimes ranging from 18 hours to 36 days.

MongoDB Atlas stores four kinds of state: agent memories with embeddings and provenance, learned per-source decay statistics, the records revalidation queries, and LangGraph checkpoints. Fireworks supplies both embeddings and chat inference. LangGraph orchestrates plan → recall → revalidate → act, checkpointed to MongoDB so an interrupted run resumes instead of starting cold.

Across 16 changed-fact queries, wrong answers fell from 100% to 0%, with 94% corrected and 100% recall on immutable controls. The sources of truth are mocked MongoDB collections rather than live PagerDuty/GitHub integrations, and the evaluation set is synthetic.

---

Markdown version of https://cerebralvalley.ai/e/persistent-context-sprint-hackathon/hackathon/gallery/75. Site index for agents: https://cerebralvalley.ai/llms.txt · full text: https://cerebralvalley.ai/llms-full.txt
