# Repository Briefing: VictorTaelin/OptMem
> Source: https://repoforai.com/repo/VictorTaelin/OptMem (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/VictorTaelin/OptMem
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: Python
- **License**: See repository
- **Engineering Health**: C (39/100 · Maintenance 12/35 · Adoption 15/25 · Releases 6/20 · License 6/20)
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Self-Hosted, CLI
- **Momentum**: 2,499 ★ total (+3 24h / +26 7d) · 157 forks
- **When to Use**: Best for: A developer or small team with shell-enabled agents that need to carry decisions, preferences, and prior attempts across sessions, and can maintain short notes and summaries. Skip if: You need semantic retrieval, built-in deletion of raw notes, a managed multi-user memory service, or an integration that does not depend on the agent following a prompt.

## Overview
```text
### Architecture & Core Mechanics
OptMem pairs a dependency-free, single-file Python 3 CLI at `~/.optmem/memo` with an instruction block in the agent's configuration. The intended loop is to load existing memory with `memo wake`, append durable observations with `memo note`, and have the agent supply summaries as merges come due. `note` surfaces merges one at a time, and `memo nap` handles pending merges. There is no background worker.

The source of truth is `LOG.txt`, an append-only log of fixed-width records. Record position doubles as identity, so a known record can be located with one seek. `TREE/` is a rebuildable cache of one-line summaries over adjacent ranges. The CLI organizes the tree while the host agent generates the summaries. The integration boundary is shell calls and text, not a documented server API, plugin system, or model backend.

### Key Capabilities & Differentiators
`memo note` accepts one line of up to 280 bytes, not 280 characters; that matters for multibyte text. `memo wake` emits a bounded startup view, with 96 lines estimated at roughly 8,000 tokens. `memo config WAKE_LINES=300` raises the output budget without changing storage or recomputing summaries. That makes context use tunable independently of history size, although actual token counts depend on the text and tokenizer.

`memo recall <regex>` searches the full raw history by text, while `memo zoom <a-b>` splits a summary range into halves that can be opened down to raw notes. `memo forget` invalidates a summary for rebuilding on the next `nap`; it is not raw-note deletion. A reported data point puts `wake` at 0.03 seconds with one million notes occupying 608 MB. With no hardware or test method specified, treat that as illustrative, not a deployment target or a measure of regex search speed.

### Trade-offs & Limitations
Compared with an embedding-backed memory store, OptMem avoids an embedding pipeline and vector index. It is a good fit when an agent mostly needs a compact startup briefing, known-term lookup, or navigation through prior decisions. Regex recall does not match paraphrases by meaning and searches the entire history. Tree navigation depends on the agent preserving useful details in its summaries. The documented workflow also asks subagents not to write, which limits automatic capture from delegated work.

The append-only log and rebuildable cache make the storage model simple to reason about, but they do not solve retention, permissions, or synchronization. Raw-note erasure is not part of the documented workflow. Because the startup prompt encourages acting on memory output, treat stored text as untrusted data and restrict what may be written, shared, or sent to a model. With no specified license, clarify usage and redistribution rights before commercial rollout.

### Hardware & Deployment Guide
The documented installation path pipes a remote `install.sh` into `sh`, installs the CLI at `~/.optmem/memo`, and prints an instruction block for `AGENTS.md` or `CLAUDE.md`. It requires Python 3 and a shell for the documented workflow; adding `~/.optmem` to `PATH` is optional. For managed hosts, inspect the installer and pin a reviewed revision instead of running a moving `main` branch directly. A `WINDOWS.md` file exists, but its presence alone does not establish native Windows compatibility.

The CLI manages local files without a required database service or model API. Once installed, local file operations do not require network access, but agent-generated summaries inherit the host model's connectivity and cost. `$MEMORY_DIR` relocates the store, including to a synced folder or Git repository; validate concurrent access and recovery before using either as a shared store. No published release milestone is listed; the documented update path reruns the installer.
```

## Key Capabilities
```text
- Runtime: One Python 3 CLI file, with no extra dependencies or background worker.
- Storage: An append-only `LOG.txt` uses fixed-width records whose positions serve as IDs.
- Summarization: Agents supply merge summaries for a rebuildable binary tree under `TREE/`.
- Retrieval: `recall` searches the full history with regex; `zoom` opens a summary range into two halves.
- Context budget: `WAKE_LINES` changes startup output without rewriting stored records or recomputing summaries.
- Integration: An instruction block in `AGENTS.md` or `CLAUDE.md` coordinates shell calls and agent-written summaries.
```

## Quick Start / Clone
```bash
curl -fsSL https://raw.githubusercontent.com/VictorTaelin/OptMem/main/install.sh | sh
```
