September 30, 2026
An AI agent compresses chat history: Victor Taelin gives OptMem 64,000 tokens
Victor Taelin replaced chat history with OptMem-based memory to leave the rest of the agent's context available for work.

Taelin
@victortaelin
I just replaced my agent's chat history with OptMem. Every message I send, every tool call and every agent response becomes a separate entry in this chat. Entries are compressed using a binary tree structure, as explained in the video. So I can talk to the agent for years, and the history will never take up more than roughly 64,000 tokens of context. The rest of the context is available for useful work. When the agent finishes a turn and I send the next message, the history is back to 64,000 tokens. In other words, I reserve 64,000 tokens for chat history, compressed using the OptMem approach, and the agent uses the rest of its context for useful work on every turn. If the agent needs more precise details from an old message, it can navigate the chat history with the zoom() tool. The agent never calls a "memo" tool itself, because there is no such tool. OptMem is the chat itself. Everything happens automatically as I talk to the agent: the entire history is compressed. Everything that happens stays in it forever, taking up just 64,000 tokens of working context. I could send 10,000 messages a day for 50 years, and the latest messages would still remain uncompressed within an 8,000-token budget. That is more than enough. Also, keep in mind: the main agent cannot read or write files; it delegates all of that to a subagent. To read a file, it calls a subagent and receives only the relevant excerpts. The main agent's job is to manage subagents and keep the big picture, rather than do the hands-on work. So memory will never be a problem again. I am ending up with a "chief assistant" that knows the full context of my life and everything I do. I will never have to type "/compact" or open multiple Claude Code chats again. If I want, I can talk to it and work from my phone, because all of this runs on my local machine. I do not even need a MacBook anymore. I just talk to the main agent, which knows the full context of my life. It can read email, clone repositories, remind me of every meeting and do all of it in the best possible way. Everything works because context management is no longer a problem. For a human life of any length, 64,000 tokens of chat history using OptMem is enough.
· 3.8K views
On Sep 30, Taelin described a setup that brings chat history back to a budget of roughly 64,000 tokens after each turn.
Every user message, tool call and agent response becomes a memory entry. Older entries are compressed using a binary tree structure: the agent receives summaries and uses `zoom()` to retrieve details. The latest messages remain uncompressed within an 8,000-token budget.
Memory without a command. In the OptMem integration published on Jul 29, the agent runs `memo wake` at the start of a session and records important information through `memo note`. In Taelin's new setup, history is updated automatically, with no separate note-taking tool. The main agent keeps the big picture and delegates work to subagents, including reading files: only the relevant excerpts come back.
Published version. For Claude Code, you can install OptMem with `curl -fsSL https://raw.githubusercontent.com/VictorTaelin/OptMem/main/install.sh | sh` and paste the printed `## Memory` block at the beginning of `CLAUDE.md`. For other agents, the README suggests `AGENTS.md`. Python 3 is required, with no additional dependencies.
This version records notes as single lines of up to 280 bytes and requests compression through `memo note`. The `memo zoom <a-b>` command expands a summary into the original entries, while `memo recall <regex>` searches those entries. Original entries are preserved in `LOG.txt`, and summaries are stored in the rebuildable `TREE/`.
On Jul 29, the author reduced the default memory budget from roughly 16,000 to 8,000 tokens. You can adjust how much is read with `memo config WAKE_LINES=300` and relocate the memory folder using the `MEMORY_DIR` variable. Running the installer again updates the tool; `memo init` preserves existing entries.
Taelin describes this setup as the foundation for a personal assistant that maintains a single conversation and manages tasks through subagents.
