# Memory

Claude has no memory between conversations – except what is written in files. Harness Maxxing
organises that memory in plain markdown files that Claude Code loads automatically.

## Three levels

```
/root/maxxing/
  CLAUDE.md  memory.md                         workspace (global)
  projects/acme/
    CLAUDE.md  memory.md                       project acme
    topics/blog/
      CLAUDE.md  memory.md                     topic acme / blog
```

Claude Code loads every `CLAUDE.md` from the session folder up to the workspace root, and each
`CLAUDE.md` contains the line `@memory.md`, which imports its memory file. A session in
`projects/acme/topics/blog/` therefore reads all six files. (Claude Code itself only follows the import of the
session's own folder; Harness passes the memory of the levels above with each turn, so nothing has to be approved.)

```mermaid
---
config:
  look: handDrawn
---
flowchart TB
  W["Workspace<br/>CLAUDE.md + memory.md"] --> S(("Session in<br/>acme / blog"))
  P["Project acme<br/>CLAUDE.md + memory.md"] --> S
  T["Topic blog<br/>CLAUDE.md + memory.md"] --> S
  S -. "memory skill" .-> T
```

| File | Contains | Who writes it |
|---|---|---|
| `CLAUDE.md` | stable instructions: what the project/topic is, how to work on it. The first paragraph under the title is the description shown in the UI. | you (or Claude when you ask) |
| `memory.md` | what was learned: decisions, preferences, state of the work, useful paths and URLs | Claude, through the `memory` skill |

## What goes where

- **Topic memory** (most common): the state of this work stream, its decisions and conventions.
- **Project memory**: what is true for every topic of the project.
- **Global memory**: your preferences and rules valid everywhere (language, tone, "never push
  without asking"...). Keep it short – it is loaded in every session.

Not in memory: chit-chat, one-off questions, step-by-step logs, and **never secrets** (put them in
Settings -> Keys and mention only the key name).

## The memory skills

- **`memory`** – at the end of a significant exchange Claude records durable facts in the right
  file: short dated bullets, replacing outdated facts instead of piling them up. You can also ask
  explicitly: "remember that ...".
- **`memory-compaction`** – keeps files short and consistent. A scheduled job "Memory compaction"
  runs it every day at 05:00 (see Crons; it starts once the onboarding is finished with Claude signed in). It acts on files longer than the **line limit**
  (Settings -> **Memory**, 100 lines by default), heavier than the weight that goes with it (1 KB for 10 lines:
  10 KB by default, so a file of a few very long bullets counts too) or redundant, contradictory or outdated: it merges
  duplicates, summarizes old history and reorders each file (rules and preferences, current
  state, decisions, references, context). It only edits `memory.md` files.

## Second brain cleaner (Settings -> Memory)

- **Maximum length per file**: the line limit above, and its weight (or *No limit*).
- **Clean now**: starts the compaction immediately, in a session at the workspace root that you
  can watch.
- The list shows every `memory.md` with its line count and size; what is over the limit is in red.
- Why size matters: a `memory.md` is part of the instructions of every session of its folder, and Claude Code sends
  it again in full each time it changes. A heavy file (50 KB is about 20,000 tokens) fills the context a little more
  at every edit, until the session is summarized (automatic compaction) - sometimes after almost every message.
- From a shell: `maxxing memory` prints the same list.

## Recall: finding what is not loaded

Memory files stay short on purpose; the detail lives in past sessions and files. When Claude needs a fact that is
not in its context - what was decided, a value, a path, what an earlier session did - it runs
`maxxing search "two or three words"`: the search of the interface (Ctrl K), with the passage around each result.
Every session is told to do so before reading old logs or answering that it does not know.

Nothing is lost when memory is compacted: what the daily compaction takes out of a `memory.md` goes to a
`memory-archive.md` in the same folder. That file is never loaded into a session, but the search finds it.

## Learning by itself: what agents and topics learned

Harness also looks at the work itself, and keeps what is worth keeping. It writes it at once and tells you in
[Notifications](feed.md) (and on Telegram), with an **Undo** button that takes it back.

- **After an agent's run**: at most one line for the agent's own `memory.md` - the way that worked after a failure,
  a faster option a tool pointed to, something not to try again. A run with nothing new writes nothing.
- **Once a day, for the topics you work in**: when you asked for the same procedure in three sessions, a
  [skill](skills.md) written from them into the topic's `.claude/skills/` (its steps say which ones come from your
  corrections); when you gave the same correction twice, a rule in the topic's `memory.md`. A skill of yours with
  the same name is never replaced.

- **Once a day, for the sessions you worked in**: a session with at least three new turns that has been quiet for
  two hours is read once, and what should stay - a decision, a rule you gave, a path, the state of the work - is
  written into the right `memory.md` (two lines at most for one session). Memory no longer depends on Claude
  thinking of it at the end of an exchange.
- **Once a day, the skills nobody uses**: a skill of yours with nothing in it, or that no session started in 30
  days, gets a notification asking whether to remove it. This one is always asked: **Accept** moves the skill to the
  [Trash](settings-and-keys.md) (it can be restored), **Refuse** keeps it and it is never asked again. The skills
  shipped with Harness are never concerned.

A small model reads the conversation (Haiku: a fraction of a cent per look), with no tools and no access to
anything else. What you undo is not written again; at most three things are written in 24 hours for one agent or
topic. The daily look reads the topics that had at least three sessions in the last 14 days, ten topics a day at
most. From a shell: `maxxing memory-review undo ID` takes one back, `maxxing memory-review daily` runs the daily
look now.

**Settings -> Memory**, card **Written by Harness**, lists everything it wrote or proposes: the line, its memory
file, why, a link to the session it comes from, and **Undo** (or **Accept** / **Refuse**). Every line it writes ends
with its date, `(2026-11-28)`, so the newer of two lines is known; the table of memory files shows when each file
last changed.

To decide each one yourself, set `"memory_review": "ask"` in `config.json`: nothing is written, each one arrives
with **Accept** and **Refuse** (`maxxing memory-review list`, `apply ID` or `apply all`, `reject ID`), and while three wait for one
agent or topic, it is not read again. `"memory_review": false` turns it off.

## Editing memory yourself

Memory files are ordinary files: open them in **Files**, edit, save. Changes apply to the next
turn of every session in that scope.

## Backup

Memory is the most valuable thing on the server. Enable the [Backup](backup.md) to push it to a
private GitHub repository every day, with history.
