# Memory

> What zelk remembers across conversations, how to see and correct it, and how project instructions differ.

zelk keeps two kinds of standing guidance: **memory**, short notes it
saves across conversations, and **project instructions**, the `AGENTS.md`
files people write for a repository. Memory is private and advisory;
instructions belong to the project.

## What zelk remembers

A note is a small markdown file with a name, a one-line description and a
type that says how it is used:

| Type | Holds |
|---|---|
| `user` | who you are: your role, your expertise, how you like answers |
| `feedback` | how you want work done: corrections, and approaches you confirmed |
| `project` | what the code and history don't show: goals, decisions, constraints |
| `reference` | where to look: a dashboard, a tracker, a runbook |

Notes live in one of two scopes. **Project** notes belong to the workspace,
named by its absolute path, so a moved checkout starts as a new project.
**User** notes hold in every project.

The agent saves notes itself, when you correct it or tell it something
worth keeping, and reads them at the start of every session: how-to-work
notes first, in full, then the rest while they fit, then one line for each
note left over, which it can look up when it needs. A note never grants
permission and never outranks you, the host or the project's instructions.
A save whose text looks like a credential is refused.

## Save a note yourself

In the terminal UI, **Remember…** in the palette (`/remember`) asks what
to remember, then whether it is for **This project** or **Every project**.
The note is saved as yours, and the agent hears of it before its next
message.

## See and correct what zelk remembers

**Memory…** in the palette (`/memory`) lists the notes of both scopes, shows
one and forgets the one you choose. From a shell:

```sh
zelk memory list                     # the notes of both scopes
zelk memory show table-tests         # one of this project's notes, in full
zelk memory forget table-tests       # delete it
zelk memory -user show prefers-go    # -user: a note for every project
zelk memory where                    # the directories notes are kept in
```

`zelk memory` alone lists, as `list` does. A note that has an expiry shows it
after its description: `(expires 2026-12-01)`, then `(expired 2026-12-01)`.
An expired note is no longer retrieved, but it stays listed until you renew
or forget it. The terminal UI's list marks it the same way. Expiries are in
UTC, as notes store them: the date alone at midnight, otherwise with the
time, such as `(expires 2026-12-02 07:30 UTC)`. An expiry with fractional
seconds keeps them when saved and shows them as in
`(expires 2026-12-01 09:15:30.5 UTC)`. `-dir` names
another workspace, and `-state` another state directory. A git worktree zelk made under
`.zelk/worktrees/` shares its main checkout's notes.

Notes are plain files under the state directory's `memory/`
(`~/.local/state/zelk/memory/` by default), one per note, so you can also
read and edit them in an editor. A note you change by hand is a new
revision: a session that read the old one can't overwrite your change.

## Turn memory off

`-no-memory` runs without it, or `"memory": false` in
`~/.config/zelk/config.json` for every run. Settings in the terminal UI has
the same switch.

## Project instructions

Instructions for a repository go in an `AGENTS.md`, the file other coding
agents read too. In each directory zelk reads the first of
`AGENTS.override.md`, `AGENTS.md` and `CLAUDE.md`. The one at the workspace
root loads before the first model call; those in subdirectories load when a
file tool first reaches the directory, and apply to the files below it,
the closest last. Commands run with Bash don't load them.

Instructions are guidance written into the repository, so they can't grant
permissions or change the mode. Together they are bounded at 32 KiB.

To write one, run **Set up AGENTS.md** in the palette, or `/init`. zelk
surveys the project (build files, CI, linters, the README, other agents'
instructions such as `CLAUDE.md`) and writes a short `AGENTS.md` at the
workspace root, or corrects an existing one where it is missing something
or wrong. The write asks for approval as any edit does. Outside the
terminal UI:

```sh
zelk -p /init
```

## Where to go deeper

- [The memory contract](/internals/memory/): the note format, the view's
  budget, conflicts and trust
- [Settings](/reference/settings/) and [the command palette](/reference/palette/)
