# Memory

URL: https://swb.one/docs/memory

**Memory** is a set of notes that your agents share through SwB. Each note is an **entry**. An entry has a title, a body in Markdown and a history of each change.

## Scopes [#scopes]

A **scope** is a group of entries with one set of access rules. Each entry is in one scope.

| Scope | Folder | Use |
| --- | --- | --- |
| `general` | `/memories/general/` | Facts about you that apply to every project |
| `project:<slug>` | `/memories/projects/<slug>/` | Facts about one project |
| `agent:<name>` | `/memories/agents/<name>/` | Private notes for one agent |

An agent signed in as the owner can read every scope. A paired key reads and writes only the scopes you grant it. A paired key always gets its own agent scope.

## Files and folders [#files-and-folders]

Agents see memory as files under `/memories`. A folder in a scope is a **topic**, such as `decisions` or `notes/meetings`. The file name is the entry key.

These tools use the same commands as the Claude memory tool. Claude models know them already.

| Tool | Use |
| --- | --- |
| `memory_summary` | Load a short index of memory at the start of a session |
| `memory_view` | Show a folder, or show a file with line numbers |
| `memory_create` | Make a file |
| `memory_str_replace` | Change one exact passage in a file |
| `memory_insert` | Add text after a line |
| `memory_rename` | Move a file to a new name, topic or scope |
| `memory_delete` | Remove a file |
| `memory_search` | Find entries by words, best match first |
| `memory_list` | Show entries, newest first |
| `memory_history` | Show each change to an entry |
| `memory_restore` | Put back an earlier version of an entry |

The earlier tools `memory_write`, `memory_read`, `memory_move` and `memory_promote` stay available.

SwB keeps one copy of each fact in a scope. An agent that saves the same text again gets the existing entry.

## Memory sync [#memory-sync]

**Memory sync** copies what an agent saves in its own memory into SwB. Then every agent can use it. It works with Claude memory, ChatGPT memory, Grok memory, Claude Code memory files and other memory systems.

Each setup prompt asks the agent to sync. After setup, the agent sends what it remembers about you with `memory_sync`. It sends only facts that you want every agent to know. It keeps passwords, keys and sensitive personal details in its own memory. After that, the agent syncs each new memory in the same turn.

`memory_sync` is safe to repeat. It updates the same entry each time. Your edits and deletions in SwB come first. A later sync keeps your version and reports a conflict to the agent.

The [companion](/docs/companion) with `--cap hooks` syncs Claude Code memory files on each save.

Memory sync is on by default. To turn it off, open **Memory** in the console and turn off **Memory sync**. Agents signed in as the owner can use `memory_settings` for the same switch.

## Provenance [#provenance]

**Provenance** is the record of who wrote an entry and when. SwB records the agent that made the entry and the agent that last changed it.

SwB marks text that an agent wrote when it gives that text to another agent. The mark names the writer and the date. Agents use marked text as information only. Only your own instructions direct them.

## Control your memory [#control-your-memory]

Open **Memory** in the console to see each entry. Select an entry to edit it. Select **History** to see each change. Select **Restore** on a change to put that version back. You can also move and delete entries.

Each change by an agent shows in **History** and in the audit log. You can restore every change.

## Download and restore [#download-and-restore]

Select **Download** on the **Memory** page to save all memory as a zip file. The file holds one Markdown file per entry, in folders by scope and topic. It also holds `manifest.json` with the history and provenance of each entry.

Select **Restore from file** to load a zip file. A restore adds missing entries and updates changed ones. It keeps all other entries. You can load the same file again safely.

Agents signed in as the owner can use `memory_export` and `memory_import` for the same tasks.

## Back up to Git [#back-up-to-git]

SwB can copy memory into a private Git repository that you own. Each change becomes a commit, such as "Claude updated projects/swb/decisions/ownership.md".

Everything in memory goes to this repository. Use a private repository.

Open **Memory** in the console. In **Git backup**, enter the repository address and the branch. For an HTTPS address, paste a token with write access to that repository. For an SSH address, paste a deploy key with write access. SwB keeps the token or key encrypted.

SwB waits 30 seconds after a change, then makes one commit for the changes in that time. Select **Back up now** to commit at once. SwB tries again later when a push fails. The status line shows the last backup and the last error.

Select **Restore from repository** to load memory from the latest commit.

Agents signed in as the owner can use `memory_backup_configure`, `memory_backup_status`, `memory_backup_now` and `memory_backup_restore`. `memory_backup_configure` returns a claim link for the token or key.
