Remanence

I built a personal AI agent that keeps a single chat going instead of starting over every session. After each reply it decides what to remember, and when the conversation gets too long it summarizes the oldest part and archives it where the agent can still search it. It started as Memori, a Python memory library, which I rebuilt as a full TypeScript app.
One chat that never resets
After every reply, a separate model call decides what to save, update, or forget. Each memory covers one subject, with absolute dates and a dated history when something changes. Before the next turn, every memory is ranked against the latest exchange, 70% on meaning and 20% on importance, plus recency, usage, and a boost for facts that always apply. The top 50 the chat hasn't seen yet go into the prompt.
When the context passes 100,000 tokens, the oldest half is summarized into a past conversation of at most 300 words: goals, decisions, failed attempts, open items. The exchanges themselves are archived in SQLite and indexed both by meaning and by keyword, and a recall tool lets the agent search them, merging the two rankings and keeping the five best matches.
An assistant that writes first
The agent works on the machine running the server. It can run shell commands, read files, images, and PDFs, edit files, search the web, and stop to ask me to choose or confirm something.
It can also schedule its own messages. When I mention an appointment, a trip, or a deadline, it plans a moment to remind me or ask how it went. After six quiet hours it checks in, and stays silent unless it has something worth saying.
A research tool for agent memory
Each reply has an info icon that opens the full trace of the turn: the memories retrieved with their scores, the exact prompt, the model's reasoning, and every change curation made. When the agent remembers or forgets something, I can see why instead of guessing.
Embeddings run locally with EmbeddingGemma, so indexing memories doesn't call any external service. Model calls go through the same endpoint as the Codex CLI, with responses not stored on OpenAI's side. The start of the prompt stays identical from turn to turn, so the prompt cache keeps working even as memories change.
- Year
- 2026
- Duration
- May to October 2026
- Built with
- TanStack StartAI SDKSQLiteEmbeddingGemma