Auny in a hood
On this page

Overview

CI
npm
Node
License: MIT

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

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 and AGENTS.md. Run setup headless with npx shared-agent-memory --yes.

Watch the pipeline · How it works · Open an issue

Green section divider

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

  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"
  1. Point an MCP host at the shared-agent-memory command with arguments mcp --ai <profile tool>, for example mcp --ai codex-cli.
  2. 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

  • 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.

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

  • 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

  • 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

  • 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

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.

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

  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

Green section divider

See CONTRIBUTING.md for profiles, adapters and docs fixes. Run npm test and npm run typecheck before opening a pull request.

Green section divider

Full list: CREDITS.md.

Green section divider

MIT. Auny LLC and contributors.