# Auto Memento <!-- ref: @protocol/auto-memento tags: [auto-memento, memento, claude-code, tmux, context, compaction, handoff, resume] triggers: [what is auto memento, what is memento, alternative to /compact, share auto memento] trigger_prompt: Someone asks what Memento or Auto Memento is, or wants to share or explain it. To perform a memento, use @protocol/memento instead. complements: [@protocol/memento, @protocol/memento_/memento-install, @protocol/memento_/memento-design] version: 5 updated_at: 2026-11-17T21:15:48.489Z --> One tool call that writes a hand-off note, clears a Claude Code session and resumes it lean. What it is, how it works, how to get it. Long Claude Code sessions get slow, expensive and worse at the task, and `/compact` tends to lose the plot. **Auto Memento just automates the [Memento](https://protocol.supply/@protocol/memento) process, so you never have to think about compacting.** When the session reaches a good stopping point, it writes a short note holding exactly what the next session needs, clears itself, and picks up from the note. The whole thing is one tool call. **A hook keeps it from being forgotten.** The optional size hook tells a session its own context size once it gets big. Past 150k tokens it suggests a memento at the next seam, and as the session grows it pushes harder, until a bloated session triggers Auto Memento on its own. You don't have to watch the number or remember to do it. ## What happens 1. The agent calls `auto-memento` with its note on stdin. The note lands in `.memento/` in your project, named after the agent's process (its *run*). 2. The agent ends its turn with one line. 3. The script types `/clear` into the tmux pane the session runs in, since an agent cannot clear itself. 4. When the clear lands, it sends one prompt: `go (auto memento — we were working on: … — note: …)`. 5. The fresh session runs `auto-memento --read`, which claims the note for its own run, prints it and marks it read. Work carries on with a small context. It refuses to clear from a subagent or a nested session, or too early in a session, and it waits while you are scrolling the pane, so a clear never lands somewhere it shouldn't. ## What a note looks like ```markdown # Refactor the billing export - **Top of mind** — moved CSV writing into export.ts; the old path is still called by the cron - **Next action** — delete the old path once the cron test passes - **Owed** — (me) PR description; (them) review on the schema change - **Traps** — the fixture dates are UTC, the report is local time - **Pointers** — src/export.ts:88, commit 3f2c1a9, test/export.spec.ts ``` The agent writes it from what it already knows, without going to look things up. It points to files and commits instead of copying them in. ## Why not just `/compact` `/compact` is a summary pass over the whole transcript, done after the fact. A memento is the agent's own hand-off, written while the agent still knows what matters. Because it is a file, you can read it, edit it, and resume from it after a crash or on another day. And since it is keyed to the run that wrote it, the right session picks it up even with several running in one project. ## What you need Claude Code inside **tmux** on macOS, Linux or WSL, plus `bash`, `curl`, `lsof` and `jq`. Outside tmux it still writes the note and prints the line to send after you type `/clear` yourself. Writing a memento by hand needs nothing at all. The default thresholds assume a 1M-token context window; on a 200k window, one setting changes (Install says which). ## Get it, go deeper **To install, give Claude Code this link and ask it to install Auto Memento: https://protocol.supply/@protocol/memento_/memento-install.** It downloads one script, one skill and two one-line hooks (Stop and SessionStart markers that tell the script when your turn has ended and when the clear has landed), checks their checksums, and ends with a one-line test. - **[Memento](https://protocol.supply/@protocol/memento)**: the operating reference your agent runs from. It covers the rules, flags and exit codes, and how to read a note back. - **[Design](https://protocol.supply/@protocol/memento_/memento-design)**: why it works this way. - **[Sizing](https://protocol.supply/@protocol/memento_/memento-sizing)**: choosing when to memento. *This page explains. The rules live only in [Memento](https://protocol.supply/@protocol/memento), so the two can't drift apart.* --- *Related: `@content/web/xinyadu/2026-11-29-claude-code-task-framing-study` · `@content/web/huggingface/2026-11-29-boundary-aware-policy-learning-robot-manipulation` · `@knowledge/protocols/agent-to-human-handoff-context-preload` · `@content/web/huggingface/2026-11-27-model-managed-context-nvidia-harness` · `@content/web/github/2026-11-27-resume-command-osc-7577-issue-112408`* --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*