OpenMemBrain

OpenMemBrain

OpenMemBrain is the intelligent membrane for AI coding memory. It autonomously reads and learns from your coding sessions — you never have to tell it what to save. It selectively absorbs project knowledge, blocks secrets, filters noise, resolves conflicts, and persists only what matters.

Category
访问服务器

README

OpenMemBrain

OpenMemBrain is the intelligent membrane for AI coding memory. It autonomously reads and learns from your coding sessions — you never have to tell it what to save. It selectively absorbs project knowledge, blocks secrets, filters noise, resolves conflicts, and persists only what matters.

No manual effort. No data leaves your machine unless you choose it. Safe, private, and trustworthy by design.

  • Zero-effort — learns from sessions automatically, no commands or prompts needed
  • Secure by default — secrets are detected and rejected before they ever reach storage
  • Self-managing — deduplicates, resolves conflicts, and filters noise on its own
  • Local-first — all memory stays on your machine; optional EU/CH-hosted cloud sync
  • Tool-agnostic — works with any AI coding tool via MCP (Claude, Copilot, Cursor, OpenCode, and more)

Installation

Install and run the MCP server with npx (requires Node.js >= 18):

npx openmembrain

Or install globally:

npm install -g openmembrain
openmembrain

No cloud accounts required. All memory is stored locally.

Configuring Your AI Tool

OpenMemBrain runs as an MCP server over stdio. Add it to your AI tool's MCP configuration:

Claude Desktop

Edit claude_desktop_config.json:

{
  "mcpServers": {
    "openmembrain": {
      "command": "npx",
      "args": ["openmembrain"]
    }
  }
}

Claude Code

claude mcp add openmembrain -- npx openmembrain

VS Code / GitHub Copilot

Add to .vscode/mcp.json in your project:

{
  "servers": {
    "openmembrain": {
      "command": "npx",
      "args": ["openmembrain"]
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project:

{
  "mcpServers": {
    "openmembrain": {
      "command": "npx",
      "args": ["openmembrain"]
    }
  }
}

OpenCode

Automated (recommended): Tell OpenCode:

Fetch and follow instructions from https://raw.githubusercontent.com/mohamadalhusseinie/openmembrain/refs/heads/main/.opencode/INSTALL.md

Manual: Add to ~/.config/opencode/opencode.json:

{
  "mcp": {
    "openmembrain": {
      "type": "local",
      "command": ["npx", "-y", "openmembrain"]
    }
  }
}

Automatic Memory Capture

Adding the MCP server gives your AI tool access to OpenMemBrain's tools. To ensure the AI uses them automatically — loading project memory at session start and saving durable knowledge as it's discovered — add a global instruction file.

Create ~/.config/openmembrain/instructions.md with instructions for the AI to:

  • Call get_project_rules, get_relevant_context, and list_memory_candidates at the start of each session.
  • Call propose_memory_from_session proactively when durable knowledge is discovered, using prefixes like rule:, architecture:, gotcha:, testing:, security:, forbidden:, remember:, domain: to mark durable knowledge.

Then wire the file into your tool's global configuration:

Platform Global instruction mechanism
OpenCode "instructions": ["~/.config/openmembrain/instructions.md"] in ~/.config/opencode/opencode.json
Claude Code Append to ~/.claude/CLAUDE.md
Cursor Add to Rules for AI in Cursor Settings
VS Code / Copilot Create ~/.copilot/instructions/openmembrain.instructions.md with applyTo: "**"

See the platform-specific setup guides in docs/setup/ for detailed instructions.

Alternatively, run export_static_memory_files in any project to generate per-project instruction files (AGENTS.md, CLAUDE.md, etc.) that include both usage instructions and stored memories.

Environment Variables

By default, local memory is stored in .openmembrain under the current working directory. Override this with:

  • OPENMEMBRAIN_HOME: directory for local JSON memory stores.
  • OPENMEMBRAIN_PROJECT_ID: default project id when a tool call does not pass projectId.

MCP Tools

  • propose_memory_from_session — submit a session transcript or summary for memory extraction. Accepts optional metadata (key-value pairs) for additional context.
  • get_project_rules — retrieve project rules and conventions for the current scope.
  • get_relevant_context — find memories relevant to a natural language query.
  • search_memory — search saved memories by query, scope, type, or tags.
  • list_memory_candidates — list pending memory candidates awaiting approval.
  • approve_memory_candidate — approve a pending candidate to save it as memory.
  • reject_memory_candidate — reject a pending candidate with an optional reason.
  • update_memory — update the content, type, scope, or tags of a saved memory.
  • supersede_memory — mark a memory as superseded, optionally linking a replacement.
  • review_stale_memories — list memories older than a threshold (default: 6 months).
  • export_static_memory_files — generate static instruction files (AGENTS.md, CLAUDE.md, etc.).
  • get_diagnostics — retrieve diagnostic events filtered by severity or code.
  • list_audit_log — retrieve recent audit events.

Architecture

The first implementation is centered on the autonomous memory pipeline, not a CLI workflow.

session transcript or summary
  -> SessionIngestor
  -> SecretDetector redaction (pre-extraction)
  -> MemoryExtractor interface (MockMemoryExtractor for MVP)
  -> MemoryClassifier (+ SecretDetector check)
  -> PolicyEngine (SecretDetector + SafetyFilter + NoiseFilter)
  -> Deduplicator
  -> ConflictDetector
  -> ActionRecommender
  -> MemoryApprovalService (+ SecretDetector safety net)
  -> MemoryStore or PendingCandidateStore

Package responsibilities:

  • packages/core: domain types, extraction interface, policy checks, classification, deduplication, conflict detection, and pipeline orchestration.
  • packages/storage: local JSON persistence for saved memory, pending approvals, and audit events.
  • packages/exporters: static fallback file generation for AI tools that read project instruction files.
  • packages/shared: small runtime helpers for IDs, time, and result types.
  • apps/mcp-server: local MCP server exposing saved memory and approval workflows to AI tools.

Provider-specific LLM calls are intentionally kept out of the core. The boundary is:

interface MemoryExtractor {
  extract(input: SessionInput): Promise<MemoryCandidate[]>;
}

The MVP ships with MockMemoryExtractor so the pipeline can be tested deterministically before adding OpenAI, Anthropic, or local model extractors.

Diagnostics And Errors

OpenMemBrain distinguishes audit history from diagnostics:

  • Audit events describe normal memory activity, such as session ingestion, candidate extraction, saved memory, queued candidates, and rejected candidates.
  • Diagnostics describe operational problems, such as validation errors, missing candidates, invalid local JSON stores, unsafe approval attempts, and export failures.

MCP tools return safe user-facing error payloads with a diagnosticId. The detailed diagnostic can be inspected through get_diagnostics without exposing raw transcripts or secrets.

Static Fallback Files

Static exporters can generate:

  • AGENTS.md
  • CLAUDE.md
  • .github/copilot-instructions.md
  • .cursor/rules/openmembrain.mdc
  • docs/ai/project-memory.md

These files are compatibility fallbacks for tools that cannot retrieve memory through MCP. By default, exporters omit confidential memories because these files may be committed to source control. Callers must explicitly opt in to include confidential memory.

Development

git clone https://github.com/mohamadalhusseinie/openmembrain.git
cd openmembrain
npm install

Run the MCP server locally (from source via tsx):

npm run mcp:stdio

Run tests and type checking:

npm test          # vitest
npm run typecheck # tsc --noEmit
npm run check     # both

Build the publishable bundle:

npm run build

Documentation

  • Architecture — pipeline design, type schemas, MCP tool surface, package dependencies
  • Security and Privacy — secret handling, data storage rules, LLM usage policy
  • Product Vision — product thesis, UX workflow, memory quality criteria
  • Roadmap — phased delivery plan from local MVP to hosted mode
  • Contributing — setup, development workflow, PR guidelines

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选