> ## Documentation Index
> Fetch the complete documentation index at: https://docs.entire.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Storage and Sync

> Understand repository and global memories, hosted sync, network controls, and concurrent writes.

## One Store per Repository

Brain stores repository memories in one local store. Searches include memories
recorded on different branches by default. Each memory keeps references to the
branch, session, and sources it came from.

An explicit branch filter selects memories with matching branch references.
It does not create a separate store.

Migration combines records with the same memory ID and keeps their source
references and status. Memories with different IDs remain separate,
even when their text is similar.

For backup, migration, and automatic cleanup, see
[Upgrade and Recover](https://docs.entire.com/guides/brain/upgrade.md).

## Global Memories

Global memories use a separate local store and are available from any repository.
Repository hosted sync does not upload this store.

See [Save a Rule for Every Repository](https://docs.entire.com/guides/brain/quickstart.md#save-a-rule-for-every-repository)
for commands to save, list, and search global memories.

## Connect a Repository

Connect the local repository to its hosted Entire repository:

```bash theme={null}
entire brain connect
```

Connecting requires Entire CLI 0.11.6 or later. It records the target and attempts
a sync immediately. After connection, Brain can sync when memory extraction
finishes, when you commit or push, and during background maintenance.

Memory sync sends repository memory records across branches and receives the
team's shared memories. It does not upload the complete local Brain directory or the
separate global store. [Session and checkpoint storage](https://docs.entire.com/guides/checkpoints/checkpoint-storage.md)
have their own configuration.

To request an immediate sync:

```bash theme={null}
entire brain memories sync
```

To disable automatic hosted sync for this repository:

```bash theme={null}
entire brain disconnect
```

A plain `memories sync` fails when the repository is not connected. Memories
remain local unless you connect or supply an explicit manual target.

### Use an Explicit Target

Scripts can provide `--repo-id`, `--api-url`, and `--token` to
`entire brain memories sync`. Use `--memories-backend=http` for
an unconnected repository.

For a manual sync, explicit flags take precedence over the matching environment
values and the recorded connection. Background sync uses the recorded connection;
these overrides do not redirect it. See the
[security policy](https://github.com/entireio/entire-brain/blob/main/SECURITY.md#egress-controls)
for the full target and credential rules.

## Network Controls

Set `ENTIRE_BRAIN_NO_EGRESS=1` to block Brain-controlled network operations:

```bash theme={null}
export ENTIRE_BRAIN_NO_EGRESS=1
```

This blocks hosted memory sync, webhooks, non-local model calls, and repository
cloning through Brain. It takes precedence over connection state and target flags.
Selecting `--agent none` or a local model alone does not disable hosted memory sync.

A custom `--agent command` runner executes a local program. No-egress mode does
not restrict that program's own network calls.

Memory extraction and automatic category selection can send context to a model
provider and incur token charges. Webhooks stay off until you configure them. See the
[webhook guide](https://docs.entire.com/guides/brain/quickstart.md#notify-another-service-when-memory-changes).

## Concurrent Writes and Background Work

Your commands take priority over queued background writes. Brain finishes the
current write before starting the next one. A large migration can still make
another command wait.

`entire brain stop` pauses background work. Other agents can still run commands
that write memories. Finish active writes and stop other writers before
making a backup. Resume paused background work with `entire brain start`.

## Mixed Client Versions

Brain v0.5.1 can exchange hosted memories with stable v0.2.0, v0.3.0, v0.4.0,
and v0.5.0 clients. Each client must use a separate local store.

Brain v0.2.0 to v0.4.0 cannot read a migrated local store. Do not share the
upgraded directory with those clients.
