edgemem
Filesystem-native agent memory for Claude Code, enabling persistent team context across sessions through cloud-synced memory files and MCP tools.
README
edgemem
Team memory for Claude Code — store your conventions, decisions, and context in the cloud so every agent session starts with full project knowledge. No more repeating yourself.
The problem
Claude Code forgets everything when a session ends. Every day, every developer re-explains the same things:
- Which ORM the project uses
- Which patterns are required
- Which architectural decisions were made and why
- What a new dev needs to know on day one
CLAUDE.md helps — but it requires a commit to update, the agent can't write to it, and it grows until it fills the context window.
edgemem fixes this. Memory lives in Supermemory cloud. Every developer shares it. The agent can read and write it. No commits required.
How it works
You write a convention once
↓
Stored in Supermemory cloud
↓
Every Claude Code session → edgemem loads what's relevant automatically
↓
Agent learns something new → writes it back to the cloud
↓
Next session, next developer → Claude already knows
3 ways Claude receives memory:
| Mode | How | Best for |
|---|---|---|
| Mode 1 — File sync | edgemem sync pulls files locally → @import in CLAUDE.md |
Getting started, simplest setup |
| Mode 2 — MCP server | Claude has 5 live tools to read/write memory during the session | Active development |
| Mode 3 — Hook | Memory is injected automatically at session start, no commands needed | Zero-effort, always-on |
All three modes share the same Supermemory container — one source of truth.
Quick start
1. Install and initialize
npm install -g edgemem
export SUPERMEMORY_API_KEY=sm-...
export EDGEMEM_CONTAINER=myproject-team
npx edgemem init
2. Write your first memory
npx edgemem write "memory/stack.md" "
Database: PostgreSQL 16
ORM: Drizzle (not Prisma)
Package manager: pnpm
Framework: Next.js App Router
"
3. Load memory into Claude
npx edgemem sync # pull memory → .claude/memory/
claude # Claude reads it automatically via CLAUDE.md
Every teammate with the same SUPERMEMORY_API_KEY gets the same context immediately.
Setup modes
Mode 1 — File sync
Pull memory down as local files and reference them from CLAUDE.md:
npx edgemem sync --output .claude/memory
Add to CLAUDE.md:
@.claude/memory/stack.md
@.claude/memory/conventions.md
Limitation: requires running sync to pick up new memory. Agent cannot write back.
Mode 2 — MCP server (recommended)
Claude gets 5 tools for reading and writing memory in real time during every session.
Add .mcp.json to your project root:
{
"mcpServers": {
"edgemem": {
"command": "npx",
"args": ["@edgemem/mcp"],
"env": {
"SUPERMEMORY_API_KEY": "${SUPERMEMORY_API_KEY}",
"EDGEMEM_CONTAINER": "myproject-team"
}
}
}
}
Claude now has mem_read, mem_write, mem_append, mem_grep, and mem_list available every session.
Mode 3 — Hook (zero effort)
Memory is injected automatically at session start. No commands, no prompting.
cp -r examples/mode3-hook/.claude .claude
export EDGEMEM_CONTAINER=myproject-team
Built for teams
All developers share the same container. One person writes a convention — everyone's agent knows immediately:
# Developer A — Monday
npx edgemem append "memory/conventions.md" "Use server actions for all mutations" --force
# Developer B — Tuesday, different machine
claude
# → Claude already knows about server actions. No sync. No commit.
Onboarding a new developer:
git clone your-repo
export SUPERMEMORY_API_KEY=sm-... # from team 1Password
claude
# → Claude knows the entire project context from day one
Security
Protected core files
These files are read-only for the agent. Only a human can write to them with --force:
| File | Purpose |
|---|---|
memory/stack.md |
Tech stack and versions |
memory/conventions.md |
Coding conventions |
memory/decisions.md |
Architecture decisions |
memory/onboarding.md |
New developer guide |
# Human override
npx edgemem write "memory/stack.md" "updated stack" --force
# Agent attempt → error before any API call is made
PII scanner
Every write and append scans for credentials and redacts them before reaching the cloud:
| Pattern | Redacted as |
|---|---|
sk_live_*, sk_test_* |
[REDACTED_SECRET] |
AIzaSy* |
[REDACTED_SECRET] |
AKIA* |
[REDACTED_SECRET] |
ghp_*, gho_*, ghs_* |
[REDACTED_SECRET] |
xoxb-* |
[REDACTED_SECRET] |
Bearer <token> |
[REDACTED_SECRET] |
password: <value> |
[REDACTED_SECRET] |
Write signatures
Every write is stamped with author and timestamp:
<!-- edgemem-entry-start | author: alice | timestamp: 2026-06-08T10:33:10Z -->
Use Drizzle ORM. Run migrations with pnpm db:migrate.
<!-- edgemem-entry-end -->
Author is resolved from EDGEMEM_AUTHOR env var, falling back to $USER.
Offline resilience
If Supermemory is unreachable, edgemem falls back to local cache — Claude Code never crashes:
| Operation | Behavior |
|---|---|
read |
Returns latest cached version + warns to stderr |
write / append |
Writes to local cache + warns to stderr |
grep |
Returns empty string + warns to stderr |
list |
Returns empty array |
Cache lives at ~/.edgemem/cache/<container>/.
Smart context chunking
mem_grep runs a semantic search then returns only the relevant sections — so a large memory file never floods the context window:
- Splits document into sections by heading or paragraph
- Scores each section by query relevance (heading match = 3×)
- Returns top sections within a 4,000-token budget
- Prepends a warning when sections are dropped
Audit log
Every operation is appended to .claude/memory/edgemem.log in JSON Lines format:
{"timestamp":"2026-06-08T10:33:10Z","action":"read","file_path":"memory/stack.md","status":"ok","author":"alice"}
{"timestamp":"2026-06-08T10:33:11Z","action":"write","file_path":"memory/auto-saved.md","status":"pii-redacted","detail":"redacted: stripe-live-key","author":"ci-bot"}
{"timestamp":"2026-06-08T10:33:12Z","action":"read","file_path":"memory/stack.md","status":"cache-hit","author":"bob"}
CLI reference
# Setup
npx edgemem init [--container <name>] [--api-key-env <name>]
# Mode 1 — pull memory to local files
npx edgemem sync [--output <dir>] [--container <name>]
# Read / write
npx edgemem read <path> [--container <name>]
npx edgemem write <path> <content> [--container <name>] [--force]
npx edgemem append <path> <content> [--container <name>] [--force]
# Search
npx edgemem grep <query> [--path <path>] [--container <name>]
npx edgemem list [--path <path>] [--container <name>]
# Mode 3 — output memory context for hook injection
npx edgemem inject [--container <name>] [--format context|json]
--force bypasses write protection on core files. Intended for human use only.
MCP tools
| Tool | Description | Core-file safe? |
|---|---|---|
mem_read |
Read a file from team memory | Read-only |
mem_write |
Write or overwrite a memory file | Requires EDGEMEM_ALLOW_CORE_MUTATION=true |
mem_append |
Append to a memory file | Requires EDGEMEM_ALLOW_CORE_MUTATION=true |
mem_grep |
Semantic search with chunked results | Read-only |
mem_list |
List all memory files | Read-only |
Memory file conventions
memory/stack.md — tech stack, versions, tools [protected]
memory/conventions.md — coding conventions and patterns [protected]
memory/decisions.md — architecture decisions and rationale [protected]
memory/onboarding.md — guide for new developers [protected]
memory/auto-saved.md — conventions captured automatically [writable]
memory/<anything>.md — your own custom files [writable]
Configuration
Config is resolved in this order (first match wins):
- Environment variables
.claudercin the project root~/.edgemem/config.json(global default)
| Variable | Purpose |
|---|---|
SUPERMEMORY_API_KEY |
API key for Supermemory |
EDGEMEM_CONTAINER |
Container name shared by the team |
EDGEMEM_AUTHOR |
Identity stamped on every write (falls back to $USER) |
EDGEMEM_ALLOW_CORE_MUTATION |
Set to true to allow agent writes to protected files |
.clauderc:
{
"container": "myproject-team",
"apiKeyEnv": "SUPERMEMORY_API_KEY"
}
Development
pnpm install
pnpm build # compile all packages
pnpm test # run all 167 tests
Package structure
packages/
core/ @edgemem/core — MemClient, guard, cache, audit, chunker
mcp/ @edgemem/mcp — MCP server (5 tools)
cli/ edgemem — CLI (init, sync, read, write, append, grep, list, inject)
examples/
mode1-claudemd/ file sync example
mode2-mcp/ .mcp.json + CLAUDE.md instructions
mode3-hook/ .claude/settings.json + auto-save hook
Test coverage
| Package | Tests |
|---|---|
@edgemem/core |
107 |
@edgemem/mcp |
30 |
edgemem CLI |
30 |
| Total | 167 |
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。