# Overview

Source: https://aunysillyme.dev/projects/shared-agent-memory/docs/overview/

[!\[CI\](https://camo.githubusercontent.com/0c5686a2744da713ec3d213803453c146c30da8736def654e20fa58996bcacae/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61756e7973696c6c796d652d6465762f7368617265642d6167656e742d6d656d6f72792f63692e796d6c3f6c6162656c3d4349267374796c653d666c61742d737175617265266c6f676f3d676974687562266c6f676f436f6c6f723d334446303741266c6162656c436f6c6f723d30453137313226636f6c6f723d304531373132)](https://github.com/aunysillyme-dev/shared-agent-memory/actions/workflows/ci.yml) [!\[npm\](https://camo.githubusercontent.com/3bf57c637f580aba23b2d3b52cb02c110710d896d55cccb201490cf989e14fa3/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f7368617265642d6167656e742d6d656d6f72793f7374796c653d666c61742d737175617265266c6f676f3d6e706d266c6f676f436f6c6f723d334446303741266c6162656c436f6c6f723d30453137313226636f6c6f723d304531373132)](https://www.npmjs.com/package/shared-agent-memory) [!\[Node\](https://camo.githubusercontent.com/196447a0c3a7e609efbf9101b84fc2044b83047710278e59330f02cb1fefdf4d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6f64652d25334525334432322d3045313731323f7374796c653d666c61742d737175617265266c6f676f3d6e6f6465646f746a73266c6f676f436f6c6f723d334446303741266c6162656c436f6c6f723d304531373132)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/package.json) [!\[License: MIT\](https://camo.githubusercontent.com/f1d32dcb8c037c4d2cdc34f65a0b1dcef800b80f097cd72164bd4b0aa39df8fd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3045313731323f7374796c653d666c61742d737175617265266c6f676f3d6f70656e736f75726365696e6974696174697665266c6f676f436f6c6f723d334446303741266c6162656c436f6c6f723d304531373132)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/LICENSE)

**Shared memory for AI coding agents: installs a collector, a local SQLite vector store and one MCP search tool so Claude Code, Codex and Gemini CLI share memory**

[!\[shared-agent-memory trailer: memory files from Claude Code, Codex CLI and Gemini CLI are collected, scanned and searched over MCP\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/shared-agent-memory-trailer.gif)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/shared-agent-memory-trailer.gif)

**Without:** your tools keep separate memory files, and useful context stays in the tool that learned it.

**With:** the memory files you choose are collected into one SQLite store, scanned before storing, and searchable from every AI through one MCP tool, `memory_search`. Add a YAML profile to support another tool.

```
npx shared-agent-memory
```

Requires Node >=22 with `node:sqlite`. Setup shows detected sources and asks for confirmation or edits. It prints companion install commands when needed. It never installs companions or edits an AI tool's configuration.

**For agents:** read [llms.txt](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/llms.txt) and [AGENTS.md](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/AGENTS.md). Run setup headless with `npx shared-agent-memory --yes`.

[Watch the pipeline](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/explainer.html) · [How it works](https://aunysillyme.dev/projects/shared-agent-memory/docs/how-it-works/) · [Open an issue](https://github.com/aunysillyme-dev/shared-agent-memory/issues)

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

| Item | Location | Purpose |
| --- | --- | --- |
| Source config | `~/.config/shared-agent-memory/sources.yaml` | Selected paths and kinds |
| Settings | `~/.config/shared-agent-memory/config.json` | Server address and device |
| State and database | `~/.local/state/shared-agent-memory/` | Acknowledged fingerprints and SQLite |
| Scheduler | Tool-owned launchd or systemd user entry | Collect every 3 hours with catch-up |
| Manifest | Config folder | Hashes of files setup wrote |

`XDG_CONFIG_HOME` and `XDG_STATE_HOME` override those roots. Other platforms print a cron line.

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

1. Supply distinct `SAM_WRITE_KEY` and `SAM_READ_KEY` through your environment. Keys stay out of files, logs and URLs.
2. Let the scheduler inherit the write key from your environment manager. Setup never persists it.
3. Use the same device identity on every collection from this machine.
4. Check the install, start the server, collect and search:

```
shared-agent-memory doctor
shared-agent-memory serve
shared-agent-memory collect
shared-agent-memory search "project conventions"
```

5. Point an MCP host at the `shared-agent-memory` command with arguments `mcp --ai <profile tool>`, for example `mcp --ai codex-cli`.
6. Supply `SAM_READ_KEY` in that host's environment.

The stdio transport exposes only `memory_search(query, scope, k, device)`. `scope` defaults to `own`.

- Configure separate server processes and keys if AI identities need a security boundary.
- A client holding the shared read key can choose its AI identity.

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

- Claude Code, Codex CLI and Gemini CLI profiles collect documented instruction paths.
- Claude Code also collects documented auto memory.
- ChatGPT accepts an extracted export in the tool's `inbox/` folder when enabled.
- Transcripts default off. Undocumented paths are omitted. [See every path](https://aunysillyme.dev/projects/shared-agent-memory/docs/where-is-my-memory/).

Detection checks documented folders and explicit project paths, without running the AI tools. Overrides in `sources.yaml` win. Files are read without following symlinks. Unreadable inputs abort collection, preserving the last inventory. Binary and oversize files are excluded.

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

- SQLite with sqlite-vec holds text, vectors, provenance and tags.
- Ollama supplies `nomic-embed-text` embeddings with 768 dimensions.
- The deterministic hash embedder is for tests and explicit `--embedder hash` runs. It is useful for exercising the pipeline, with weaker semantic ranking.

The server binds to `127.0.0.1` by default. `--host` can bind a private-network address. Use an encrypted private network for remote HTTP transport. Requests use bearer headers. Keep the server off the public Internet.

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

- The default scanner runs your installed gitleaks.
- An absent or failed scanner refuses the whole batch.
- Explicit `--scanner builtin` selects a weaker regex scanner for common token shapes. It cannot detect every secret. Review sources before opting in.

Put rules in `privacy-tags.yaml` in the config folder:

```
rules:
  - tag: private
    path: "*private*"
    pattern: "personal"
    allow: ["claude-code"]
```

- A rule matches its path or a literal content substring. In privacy paths, `*` spans directories.
- Every matched tag must allow the querying AI. Unlisted tags deny access.
- Privacy filtering happens before ranking.
- Returned hits are framed as stored data, never instructions.

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

- A lock prevents overlapping collectors.
- Full inventories travel with each batch.
- Fingerprints advance only for acknowledged files.
- An empty inventory is refused.
- Removing more than half and more than 20 stored file rows is refused.
- Use `rebuild --dry` to inspect counts and `rebuild --confirm` to replace a store through the same scanner and embedding pipeline. Rebuild preserves the old store if any batch fails.

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

### Can every AI tool use this memory?

- Any host that supports MCP stdio can search it.
- Source collection needs a profile. Add one for a tool whose files are documented.

### Where does my memory go?

- It stays in the configured SQLite database and your existing source files.
- Embedding requests go to local Ollama by default. [Follow the pipeline](https://aunysillyme.dev/projects/shared-agent-memory/docs/how-it-works/).

### How do I enable transcripts?

- Edit a source entry in `sources.yaml` and set `enabled: true`.
- Only documented transcript kinds are offered. ChatGPT exports are opt-in transcripts.

### Why did collection refuse a batch?

- Run `doctor`. Check scanner availability, distinct keys, source readability and deletion counts.
- Refused files do not advance local fingerprints.

### How do I use a private network?

1. Bind `serve --host` to its private address.
2. Set `server` in `config.json`.
3. Keep transport inside an encrypted private network. The read key and the write key must differ.

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

1. Preview with `shared-agent-memory uninstall --dry`.
2. Remove with `shared-agent-memory uninstall`.

- Preview and removal print identical action rows when files stay unchanged. Edited files are kept.
- The database is kept unless you pass `--purge`. Purge encrypts a verified backup with the write key and writes a receipt before removal.
- `shared-agent-memory restore` decrypts that backup into a new tool-owned directory. Keep the write key to recover it.
- Stop the server before purging.
- Missing manifests exit 2 with their path. Re-run setup to restore tool-owned setup files.
- Uninstall never removes an AI's source files.

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

- [Interactive explainer](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/explainer.html): watch a memory travel the pipeline. Open the file in a browser.
- [How it works](https://aunysillyme.dev/projects/shared-agent-memory/docs/how-it-works/).
- [Where memory lives](https://aunysillyme.dev/projects/shared-agent-memory/docs/where-is-my-memory/).
- [Write a profile](https://aunysillyme.dev/projects/shared-agent-memory/docs/writing-a-profile/).
- [Build brief](https://aunysillyme.dev/projects/shared-agent-memory/docs/ai-brief/).
- [Stack and budgets](https://aunysillyme.dev/projects/shared-agent-memory/docs/stack/).

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

See [CONTRIBUTING.md](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/CONTRIBUTING.md) for profiles, adapters and docs fixes. Run `npm test` and `npm run typecheck` before opening a pull request.

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

- [sqlite-vec](https://github.com/asg017/sqlite-vec), by Alex Garcia. MIT or Apache-2.0.
- [gitleaks](https://github.com/gitleaks/gitleaks). MIT.
- [Ollama](https://github.com/ollama/ollama). MIT.
- [nomic-embed-text](https://huggingface.co/nomic-ai/nomic-embed-text-v1.5). Apache-2.0.
- [Model Context Protocol specification](https://github.com/modelcontextprotocol/modelcontextprotocol). MIT.
- [Departure Mono](https://departuremono.com/), by Helena Zhang, for the README headings. SIL Open Font License 1.1.

Full list: [CREDITS.md](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/CREDITS.md).

[!\[Green section divider\](https://raw.githubusercontent.com/aunysillyme-dev/shared-agent-memory/v0.1.0/docs/readme/divider.svg)](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/docs/readme/divider.svg)

[MIT](https://github.com/aunysillyme-dev/shared-agent-memory/blob/v0.1.0/LICENSE). Auny LLC and contributors.
