Inspiration
Long conversations expose a fundamental weakness in AI systems: more context does not always produce better memory. Important facts become diluted, irrelevant history consumes tokens, and critical instructions can disappear among hundreds of messages.
Context Decay Window began as a research project exploring a different approach: instead of replaying an entire conversation, construct a bounded context window containing only what matters now.
What it does
Context Decay Window is an experimental memory architecture for long-running AI conversations. It combines:
- similarity-based retrieval for relevant memories;
- time-decay retrieval for recent context;
- persistent rules stored outside ordinary episodic retrieval;
- topic tracking and consolidation;
- selective promotion from short-term to long-term memory; and
- a bounded prompt budget that prevents unlimited context growth.
Memory Observatory is the interactive demonstration layer. It replays a real, accepted 120-turn research run while visualizing the context selected for each response, active topics, pinned rules, token usage, retrieval sources, consolidation events, and long-term-memory writes.
The replay is deterministic and requires no API key or model server. Every message and metric comes from the recorded study artifacts rather than fabricated demo data.
How we built it
The underlying architecture and evaluation framework were developed through three progressively more demanding studies. Study 003 tested memory across 120 turns, four knowledge domains, persistent instructions, topic changes, and delayed recall probes using a locally hosted Qwen3.6 27B model.
The system records structured telemetry for every turn, including retrieval composition, topic state, context size, rule state, model performance, and memory events. A deterministic export pipeline validates the accepted transcript against the canonical research artifacts before producing the frontend dataset.
We then built Memory Observatory as a responsive React and TypeScript application. It presents the research data as a familiar chat interface while exposing the memory system operating behind it. The public demo is deployed through OpenAI Sites.
Codex accelerated repository exploration, implementation, testing, research-artifact verification, visualization design, documentation, and deployment.
Challenges we ran into
The hardest challenge was making an invisible architecture understandable in seconds. Retrieval scores, topic consolidation, and memory promotion are meaningful to researchers, but not immediately legible during a short demonstration. We addressed this by synchronizing the conversation with a live context strip, memory stores, retrieval evidence, topic progression, and architecture events.
Data integrity was equally important. The original transcript was intentionally excluded from version control because of its size, while canonical metrics remained tracked. We recovered the complete accepted run, repaired an encoding issue in the prompts, and verified every canonical metric artifact byte-for-byte before creating the replay.
We also had to balance scientific honesty with presentation clarity. The demo openly displays the study’s final coverage miss instead of hiding it.
Accomplishments that we're proud of
- Completed a reproducible 120-turn long-context memory study.
- Preserved early, middle, and late planted facts across multiple topic shifts.
- Achieved 12 of 13 recall-rubric points.
- Selectively promoted 21 of 90 evaluated episodes to long-term memory.
- Kept peak constructed context to 9,189 estimated tokens.
- Created a public, self-contained visualization using the real study transcript.
- Preserved the unsuccessful final broad-recall result as evidence for future improvement.
- Built deterministic provenance checks connecting the interface to the accepted research artifacts.
What we learned
Effective conversational memory is not simply a larger context window. It is a selection problem.
Similarity retrieval preserves semantically relevant information, decay retrieval maintains conversational continuity, and persistent rules require a separate protected path. Selective long-term-memory promotion can reduce storage growth substantially, but broad queries introduce a coverage problem: the highest-scoring memories may come from only a subset of relevant topics.
We also learned that observability is essential. A memory system becomes much easier to evaluate and trust when people can see why each piece of context was selected.
What's next for Context Decay Window
Next, we will improve broad-query coverage with topic-balanced retrieval and diversity-aware selection. We also plan to activate long-term-memory retrieval, test substantially longer conversations, compare additional models, and evaluate memory quality with human participants.
The larger goal is to turn Context Decay Window into a practical, inspectable memory layer for assistants that must remain useful across weeks, months, or years of interaction.
Built With
- cloudflare-workers
- codex
- cuda
- embeddings
- gguf
- llama.cpp
- next.js
- openai-sites
- pytest
- python
- qwen
- react
- typescript
- vector-search
- vite
Log in or sign up for Devpost to join the conversation.