---
title: "Memory System"
description: "Autohand remembers your preferences, coding patterns, and project conventions across sessions. Each memory is a small JSON entry backed by an append-only event log, kept per project or privately in your user directory."
seo:
  description: "Store and retrieve context across sessions with Autohand's multi-level memory system. Project memories share team conventions via git, while user memories keep."
---

## How memory works

Autohand uses a multi-level memory system that stores information in two locations:

| Level | Location | Shared | Purpose |
| --- | --- | --- | --- |
| **Project memory** | `.autohand/memory/` | With your team if you commit it | Team conventions, project-specific patterns, architecture decisions |
| **User memory** | `~/.autohand/memory/` | No, private (synced across your devices when settings sync is on) | Personal preferences, coding style, working habits |

Memories persist across sessions. When a session starts, Autohand adds a bounded selection of memories from both levels to the agent's context, so the agent already knows how you work and what your team has decided.

### How memories are stored [#storage]

Each memory is a short piece of text with an ID, timestamps, and optional tags. Both levels use the same layout:

```text
.autohand/memory/            # or ~/.autohand/memory/
  events/
    LOG.jsonl                # canonical, append-only event log
  <id>.json                  # one materialized entry per memory
  index.json                 # previews of all entries
  derived/
    summaries/               # cached outline summaries (regenerated as needed)
```

A single entry looks like this:

```json title=".autohand/memory/3f9c2a1b.json"
{
  "id": "3f9c2a1b",
  "content": "Use date-fns instead of moment.js for date handling",
  "createdAt": "2026-09-01T10:12:00.000Z",
  "updatedAt": "2026-09-01T10:12:00.000Z",
  "tags": ["dependencies"]
}
```

`events/LOG.jsonl` is the source of truth. Every create, update, and delete is appended to it, and the `<id>.json` files and `index.json` are a projection rebuilt from that log. Autohand rebuilds the projection when memory initializes and when you run `/memory rebuild`. Stores created before the event log existed are migrated automatically: their existing entries are recorded as snapshot events the first time the log is initialized.

## Storing memories

The simplest way to store a memory is with the `#` trigger during a conversation. Type `#` followed by the information you want Autohand to remember.

```bash
# Store a coding preference
# Always use TypeScript strict mode in this project

# Store an architecture decision
# We use the repository pattern for all database access

# Store a personal preference
# I prefer tabs over spaces, 4-width indentation
```

When you use the `#` trigger, Autohand asks where to store the memory: **Project level** (`.autohand/memory/`, specific to this project) or **User level** (`~/.autohand/memory/`, available in all projects). The text is saved as-is and is never sent to the model as a prompt.

### Similarity detection

Autohand checks new memories against existing ones at the same level using word-overlap similarity. When a new memory is close to one already saved (a similarity score of 0.6 or higher), the `#` trigger shows the existing memory and asks whether to update it instead of creating a duplicate. Memories saved by the agent update the similar entry automatically.

```bash
# First time
# Always use ESLint with the Airbnb config
# -> Saved as new memory

# Later, you refine it
# Always use ESLint with the Airbnb config and Prettier integration
# -> Updates the existing memory instead of creating a duplicate
```

This keeps your memory store clean and avoids conflicting instructions. The similarity threshold is tuned to catch obvious duplicates while allowing genuinely different memories on related topics.

## Automatic memory extraction [#automatic-extraction]

You do not have to manually tag every useful piece of information. When you use `/clear` or `/new` to end a conversation, Autohand reviews the session and automatically extracts memories from it. In interactive sessions, Autohand also reflects on completed turns in the background and saves durable lessons. Set `agent.autoMemory` to `false` to turn this background reflection off; it never runs in `--bare`, ephemeral, or command (`-p`) mode.

The extraction process works like this:

1. **Scan** - The LLM reads through the conversation looking for preferences, decisions, corrections, and patterns
2. **Classify** - Each candidate memory is classified as either project-level or user-level based on context
3. **Deduplicate** - Candidates are compared against existing memories to avoid duplicates
4. **Save** - New memories are written to the appropriate directory

```bash
# During a session, you correct the agent:
> "No, don't use moment.js. We switched to date-fns in this project."

# When you run /clear, Autohand automatically extracts:
[memory] Saved project memory: "Use date-fns instead of moment.js for date handling"

# Next session, the agent already knows
> "Add a date formatter to the utils"
# Agent uses date-fns without being told
```

### What gets extracted

The LLM looks for several categories of useful information:

- **Corrections** - When you tell the agent "don't do X, do Y instead"
- **Preferences** - Coding style, naming conventions, tool choices
- **Architecture decisions** - Database choices, API patterns, folder structure
- **Project facts** - Tech stack, deployment targets, environment details
- **Workflow patterns** - How you like to review code, commit messages, PR descriptions

:::tip
**Privacy:** The extraction prompt instructs the model not to store secrets, raw error text, or transient failures. This is an instruction, not a guarantee, so review your memories with `/memory` and delete anything sensitive.
:::

## Memory injection

When a session starts, Autohand adds memories to the agent's system context before your first message:

- For each level, up to five of the most recently updated memories are listed under **Project Memories** and **User Preferences**.
- When a level has more memories than that, Autohand injects a bounded hierarchical outline of the whole store instead (the same outline `/memory outline` shows), including a few recent entries verbatim.
- Skills and slash commands you have used successfully in this project are listed as **Learned Project Capabilities**.

Older memories stay available: the agent can search them with `recall_memory` or zoom into the outline with `inspect_memory`.

```text
## Project Memories
- Use date-fns instead of moment.js for date handling
- Follow the repository pattern for database access

## User Preferences
- Prefer functional components over class components
```

## Managing memories

Use the `/memory` command to view, inspect, and delete stored memories.

### View all memories

```bash
/memory

# Output:
# Project Memory (.autohand/memory/)
#   Use date-fns instead of moment.js for date handling
#     ID: 3f9c2a1b | Updated: 9/1/2026 [dependencies]
#
# User Memory (~/.autohand/memory/)
#   Prefer functional components over class components
#     ID: a41e07c9 | Updated: 8/28/2026
#
# Total: 1 project, 1 user memories
```

### Delete a memory

Pass the level and the memory ID shown by `/memory`:

```bash
/memory delete project <memory-id>

# Output:
# Deleted project memory <memory-id>. The canonical deletion event was retained.
```

The deletion is recorded as an event in the memory log, so a later rebuild does not bring the memory back.

### Inspect, zoom, and rebuild [#inspect-memory]

Large memory stores are summarized into a bounded outline. Use these subcommands to explore it:

```bash
/memory outline project
/memory zoom project <snapshot> <node>
/memory forget project [snapshot]
/memory rebuild project
```

- `outline` prints a hierarchical summary with a snapshot ID.
- `zoom` expands one summary node from that snapshot.
- `forget` invalidates derived summaries. The underlying memory events are preserved.
- `rebuild` regenerates the materialized memory files from the canonical event log.

Replace `project` with `user` for your personal memory.

### Memory tools the agent uses [#memory-tools]

The agent manages memory through the same operations:

| Tool | What it does | Approval |
| --- | --- | --- |
| `save_memory` | Saves a fact or preference at `user` or `project` level | None |
| `recall_memory` | Returns stored memories ranked by content, tags, and recency, optionally filtered by a query or level | None |
| `inspect_memory` | Runs `outline`, `zoom`, `forget`, or `rebuild` on a level (default `project`), with optional `max_lines` and `max_chars` limits | None |
| `delete_memory` | Deletes an obsolete memory by ID at a level (default `project`), keeping the deletion as an event | Required |

### What you can inspect and edit [#edit-memories]

- **Read anything.** The `<id>.json` files, `index.json`, and `events/LOG.jsonl` are plain JSON and JSON Lines, so you can open them in any editor or process them with tools such as `jq`.
- **Change memories through Autohand.** To update a memory, store the corrected text with `#` and accept the prompt to update the similar entry, or ask the agent to save it. To remove one, use `/memory delete <level> <id>` or ask the agent.
- **Do not hand-edit the projection.** Editing an `<id>.json` file or adding a new one does not create an event, so the next rebuild from `events/LOG.jsonl` (at startup or with `/memory rebuild`) overwrites the edit and removes files that have no events.
- **Do not rewrite the event log.** `LOG.jsonl` is append-only and versioned. `derived/summaries/` is only a cache: `/memory forget` clears it and it is regenerated when needed.

## Project vs user memory [#project-vs-user]

Choosing the right level for a memory matters. Here is a practical guide for where different types of information belong.

### Project memory

Project memory lives in `.autohand/memory/` inside your repository. If you commit it, teammates running Autohand on the same repository get the same project context. The event log (`events/LOG.jsonl`) is the part that matters; `derived/` and lock files are local caches.

Store these as project memories:

- Tech stack choices (framework, database, ORM)
- Code style rules that apply to the whole team
- Architecture patterns (API structure, folder layout)
- Testing conventions (test runner, coverage requirements)
- Build and deployment commands
- Library preferences (date-fns over moment, etc.)

```bash
# Good project memories
# We use Prisma for database access with PostgreSQL
# All API endpoints return JSON with camelCase keys
# Run "bun run build" to create a production build
# Tests live next to source files with .test.ts extension
```

### User memory

User memory lives in `~/.autohand/memory/` on your machine. It is outside any repository, stays private to you, and applies across all your projects.

Store these as user memories:

- Personal coding style preferences
- Editor and tool preferences
- Commit message format you like
- How verbose you want the agent to be
- Your preferred language for comments
- Code review style

```bash
# Good user memories
# I prefer concise commit messages under 50 characters
# Always explain why, not just what, in code comments
# I like seeing the full diff before committing
# Use British English spelling in documentation
```

:::warning[Important]
Never store secrets, API keys, or passwords as memories. Memories are stored as unencrypted JSON, and deleted memories remain in the event log. Use environment variables or a secrets manager for sensitive values.
:::

## Settings sync

If you work across multiple machines, settings sync keeps your user memory consistent everywhere. When sync is enabled and you are signed in, the contents of `~/.autohand/memory/` sync through your Autohand account. The canonical event logs from each device are merged, and the local entries are rebuilt from the merged log. `derived/` summaries and lock files are never synced.

```bash
# Open the sync status, settings, and activity view
/sync
```

Project memories are not synced through this mechanism; they live in your repository. Settings sync encrypts sensitive configuration fields, but memory content is not end-to-end encrypted, which is one more reason to keep secrets out of memory.

## Best practices

### Keep memories concise and specific

Short, clear memories work better than long paragraphs. The agent parses them faster and is less likely to misinterpret the intent.

```bash
# Too vague
# We have some conventions around testing

# Specific and actionable
# Use vitest for unit tests. Each test file must have at least one test
# for the error case, not just the happy path.
```

### Use project memory for team conventions

If a coding pattern applies to everyone on your team, put it in project memory and commit it. This saves every team member from having to teach the agent the same thing individually.

```bash
# Add and commit project memories
git add .autohand/memory/events/LOG.jsonl .autohand/memory/*.json
git commit -m "Add team coding conventions to agent memory"
```

### Review memories periodically

Over time, memories can become outdated as your project evolves. Run `/memory` every few weeks to check for memories that no longer apply. A memory that says "use Express" is wrong if you migrated to Fastify.

### Keep one fact per memory

Keep one fact per memory rather than long multi-topic notes. Short, single-purpose memories make similarity matching and updates work better, and the outline groups them for you as the store grows.

### Let the agent learn naturally

You do not need to pre-populate memories before your first session. The automatic extraction system picks up patterns as you work. After a few sessions of correcting the agent ("use bun, not npm" or "we prefer arrow functions here"), those corrections become permanent memories.

The best memories come from real interactions. They capture the specific decisions and preferences that matter for your workflow, and they evolve as your project grows.

## Importing memories from other tools [#importing-memories]

If you are switching from another coding CLI, Autohand can import your existing memories and instructions so you do not have to start from scratch. The `/import` command detects installed tools and pulls in memory data where available.

```bash
# Interactive import wizard
/import

# Import memory from a specific tool
/import claude
/import gemini

# Preview what will be imported without writing anything
/import --dry-run
```

### What can be imported

Not every tool stores memory the same way. Here is what Autohand can pull in from each source:

| Source | Memory data | Where it comes from |
| --- | --- | --- |
| **Claude Code** | CLAUDE.md files and per-project memory directories | `~/.claude/projects/*/` |
| **Codex** | Rules files (detected as memory, not copied in CLI 0.9.8; copy them by hand) | `~/.codex/rules/` |
| **Gemini** | Global GEMINI.md instructions file | `~/.gemini/GEMINI.md` |
| **OpenCode** | Global AGENTS.md rules | `~/.config/opencode/AGENTS.md` |
| **Kimi CLI** | Global AGENTS.md instructions | `~/.kimi/AGENTS.md` |

Cursor, Cline, Continue, Augment, and Grok CLI do not expose memory data in a format Autohand can import, though other categories like settings and MCP servers are supported.

### Where imported memories land

Imported memories are stored in clearly labeled directories so they do not mix with your native Autohand memories:

```bash
# Claude project memories
~/.autohand/projects/{project}/imported-claude/
  CLAUDE.md
  memory/

# Gemini global memory
~/.autohand/memory/imported-gemini/
  GEMINI.md

# OpenCode and Kimi CLI global instructions
~/.autohand/memory/imported-opencode/AGENTS.md
~/.autohand/memory/imported-kimi/AGENTS.md
```

These imported files are copied as-is (Markdown) for you to review. They are not converted into memory entries and are not injected into the agent context automatically. To keep a fact from them, store it with `#` or ask the agent to save it.

:::tip
**Tip:** Run `/import --dry-run` first to see exactly what will be imported before committing. See the [full importing memories guide](/guides/importing-memories) for step-by-step instructions and troubleshooting.
:::

## Frequently asked questions [#faq]

**What is the Autohand memory system?**

The Autohand memory system stores preferences, coding patterns, and project conventions as small JSON entries backed by an append-only event log (events/LOG.jsonl). It operates at two levels: project memory in .autohand/memory/ (shareable via git) and user memory in ~/.autohand/memory/ (private to you).

**How do I store a memory in Autohand?**

Type # followed by the information during a conversation. For example: # always use TypeScript strict mode in this project. Autohand asks whether to save it as project or user memory and records it in that store. Autohand also extracts memories automatically when you end a session with /clear or /new.

**What is the difference between project and user memory?**

Project memory lives in .autohand/memory/ inside your repository and is shared with your team through git. It stores team conventions, architecture decisions, and coding standards. User memory lives in ~/.autohand/memory/ on your machine and stores personal preferences like commit style or verbosity. Both levels are added to the agent context at session start.

**Can I import memories from other coding CLIs?**

Autohand can import memory data from Claude Code (CLAUDE.md files and per-project memory directories), Gemini (GEMINI.md global instructions), OpenCode and Kimi CLI (global AGENTS.md). Codex rules files are detected but not copied in CLI 0.9.8. Run /import to start the interactive wizard, or autohand import claude --categories memory from the command line.
