{"id":48899957,"url":"https://github.com/deepleaper/deepbrain","last_synced_at":"2026-04-19T17:01:19.190Z","repository":{"id":350956397,"uuid":"1208939471","full_name":"Deepleaper/deepbrain","owner":"Deepleaper","description":"🧠 Personal AI brain — 21 importers, hybrid search, knowledge graph, Web UI, MCP server, export. Import from Notion, Obsidian, Evernote, Roam, Flomo, Yuque, Feishu, and more.","archived":false,"fork":false,"pushed_at":"2026-04-16T12:58:21.000Z","size":311,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-16T14:32:21.755Z","etag":null,"topics":["agent","ai","brain","chinese","deepseek","embedding","evernote","knowledge","mcp","memory","notion","obsidian","ollama","pglite","pgvector","search","second-brain","typescript","vector"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Deepleaper.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-12T23:53:46.000Z","updated_at":"2026-04-16T12:58:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"2ba5ed23-2474-456a-b221-a9d17ba06938","html_url":"https://github.com/Deepleaper/deepbrain","commit_stats":null,"previous_names":["magicray1217/deepbrain","deepleaper/deepbrain"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Deepleaper/deepbrain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepleaper%2Fdeepbrain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepleaper%2Fdeepbrain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepleaper%2Fdeepbrain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepleaper%2Fdeepbrain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Deepleaper","download_url":"https://codeload.github.com/Deepleaper/deepbrain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepleaper%2Fdeepbrain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31974954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai","brain","chinese","deepseek","embedding","evernote","knowledge","mcp","memory","notion","obsidian","ollama","pglite","pgvector","search","second-brain","typescript","vector"],"created_at":"2026-04-16T14:20:54.217Z","updated_at":"2026-04-18T16:00:53.531Z","avatar_url":"https://github.com/Deepleaper.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# 🧠 DeepBrain\n\n**Agent 记忆引擎 — 让 AI 越用越聪明**\n\n[![npm](https://img.shields.io/npm/v/deepbrain)](https://www.npmjs.com/package/deepbrain)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue)](https://www.typescriptlang.org/)\n\n[快速开始](#快速开始) · [核心概念](#核心概念) · [API 文档](#api-文档) · [English](#english)\n\n\u003c/div\u003e\n\n---\n\n## 💡 一句话介绍\n\n\u003e **不是 RAG，不是知识库。DeepBrain 是 Agent 的大脑 — 会学习、会记忆、会进化。**\n\n现有 Agent 框架的痛点：**每次对话都从零开始**。Agent 不记得昨天学到的，不记得上周犯的错，换个人接手一切归零。\n\nDeepBrain 用三个 API 解决：\n\n```\nbrain.learn()   → 把经验写入记忆\nbrain.recall()  → 需要时检索相关记忆  \nbrain.evolve()  → 定期提炼，知识越来越精而不是越来越多\n```\n\n## 🎯 和竞品的区别\n\n| | Mem0 | LangChain Memory | Letta | **DeepBrain** |\n|---|---|---|---|---|\n| 定位 | 记忆存储 | 对话历史 | 有状态 Agent | **Agent 记忆引擎** |\n| 核心能力 | CRUD | 窗口管理 | 状态机 | **learn/recall/evolve** |\n| 知识提炼 | ❌ | ❌ | ❌ | ✅ **自动进化** |\n| 记忆分层 | ❌ | ❌ | ✅ 3层 | ✅ **Core/Working/Archival** |\n| 框架绑定 | 独立 | LangChain | Letta | **任意框架** |\n| 本地运行 | 需要服务 | 内存 | 需要服务 | ✅ **PGLite 零依赖** |\n\n**一句话：别人管存，DeepBrain 管\"炼\"。**\n\n## 快速开始\n\n```bash\nnpm install deepbrain\n```\n\n```typescript\nimport { Brain, AgentBrain } from 'deepbrain';\n\n// 1. 初始化大脑\nconst brain = new Brain({ embedding_provider: 'openai' });\nawait brain.connect();\nconst agent = new AgentBrain(brain, 'my-sales-agent');\n\n// 2. 学习 — Agent 每次交互后自动存储\nawait agent.learn({\n  action: '客户问了退货政策',\n  result: '7天无理由退货，需保留包装',\n  context: { customer: 'VIP', channel: 'wechat' }\n});\n\n// 3. 回忆 — 需要时自动检索\nconst memories = await agent.recall('这个客户之前问过什么？');\n// → [{ text: '客户问了退货政策...', score: 0.92 }]\n\n// 4. 进化 — 定期运行，提炼知识\nconst report = await agent.evolve();\n// → 把 50 条零散经验提炼成 3 条知识\n```\n\n## 核心概念\n\n### 三个 API\n\n| API | 做什么 | 什么时候调 |\n|-----|-------|----------|\n| `learn()` | 存储经验/知识 | 每次 Agent 完成任务后 |\n| `recall()` | 语义检索记忆 | 每次 Agent 需要上下文时 |\n| `evolve()` | 提炼+升级记忆 | 定时任务（如每天凌晨） |\n\n### 记忆分层\n\n```\nCore     (≤20条)   — 始终在上下文中，最重要的知识\nWorking  (≤50条)   — 当前活跃，频繁访问的记忆\nArchival (无限)    — 长期存储，按需检索\n```\n\n访问频率高 → 自动升级。长期不用 → 自动降级。\n\n### 知识进化 (evolve)\n\n这是 DeepBrain 最核心的差异化：\n\n```\nDay 1: 50条零散的客户对话记录\nDay 7: evolve() → 提炼为 5 条客户偏好知识\nDay 30: evolve() → 进一步精炼为 2 条核心洞察\n```\n\n**知识越来越精，而不是越来越多。**\n\n### Memory Adapters\n\nDeepBrain 不绑定任何框架。通过适配层对接：\n\n```typescript\nimport { adapters } from 'deepbrain';\n\n// OpenClaw 适配\nconst openclaw = adapters.openclaw;\n\n// 原生适配（任何框架）\nconst native = adapters.native;\n\n// 更多适配层开发中：LangChain, CrewAI, AutoGen...\n```\n\n## 全部特性\n\n| 类别 | 特性 |\n|------|------|\n| 🧠 **记忆** | learn/recall/evolve 三件套、Memory Tiers 自动升降级 |\n| 🔍 **搜索** | 向量语义搜索 + 全文检索、混合排序 |\n| 🔄 **维护** | evolve 知识提炼、dream 自动维护周期 |\n| 🔌 **适配** | OpenClaw / Native 适配层、可扩展接口 |\n| 📥 **导入** | 24+ importers（Markdown/Notion/Obsidian/Logseq/Readwise...） |\n| 🤖 **AI** | 7 providers（OpenAI/Gemini/DeepSeek/通义千问/智谱/Moonshot/Ollama） |\n| 🛠️ **集成** | MCP Server、REST API、Web UI |\n| 💾 **存储** | PGLite 本地零依赖、向量索引 |\n\n## CLI 命令\n\n```bash\ndeepbrain learn \"客户偏好：周一上午开会\"    # 学习\ndeepbrain recall \"客户什么时候开会？\"        # 检索\ndeepbrain evolve                            # 知识进化\ndeepbrain query \"退货政策\"                  # 语义搜索\ndeepbrain serve                             # Web UI + API\ndeepbrain import notion ./export            # 导入 Notion\ndeepbrain dream                             # 维护周期\ndeepbrain stats                             # 查看统计\n```\n\n## 架构\n\n```\n┌─────────────────────────────────────────┐\n│         你的 Agent 框架                   │\n│   (OpenClaw / LangChain / 自研 / ...)    │\n├─────────────────────────────────────────┤\n│         Memory Adapters                  │\n│   (openclaw / langchain / native)        │\n├─────────────────────────────────────────┤\n│         AgentBrain API                   │\n│   learn() · recall() · evolve()          │\n├─────────────────────────────────────────┤\n│         Brain Engine                     │\n│   向量搜索 · FTS · 知识图谱 · 分层        │\n├─────────────────────────────────────────┤\n│         PGLite + Embeddings              │\n│   本地存储 · 零依赖 · 零成本              │\n└─────────────────────────────────────────┘\n```\n\n## 🔗 生态\n\nDeepBrain 是跃盟开源四件套之一：\n\n| 项目 | 定位 | 关系 |\n|------|------|------|\n| **DeepBrain** | Agent 记忆引擎 | ← 你在这里 |\n| [opc-agent](https://github.com/Deepleaper/opc-agent) | Agent OS | Traces → learn() |\n| [agentkits](https://github.com/Deepleaper/agentkits) | 带记忆的 OpenRouter | 自动 recall + learn |\n| [agent-workstation](https://github.com/Deepleaper/agent-workstation) | 虚拟工位模板 | brain-seed.md → L1 |\n\n```\nopc-agent 收集 Traces → DeepBrain 学习 → agentkits 调用时自动 recall → Agent 越来越聪明\n```\n\n## License\n\nApache-2.0 — 免费商用，欢迎贡献。\n\n---\n\n\u003ca name=\"english\"\u003e\u003c/a\u003e\n\n## English\n\n## 💡 What Is DeepBrain?\n\n\u003e **Not RAG. Not a knowledge base. DeepBrain is the brain for your AI Agent — it learns, remembers, and evolves.**\n\nThe pain point with existing Agent frameworks: **every conversation starts from scratch**. The agent doesn't remember what it learned yesterday, doesn't remember last week's mistakes, and when someone else takes over, everything resets to zero.\n\nDeepBrain solves this with three APIs:\n\n```\nbrain.learn()   → Write experience into memory\nbrain.recall()  → Retrieve relevant memories when needed\nbrain.evolve()  → Periodically refine — knowledge gets sharper, not bigger\n```\n\n## 🎯 Competitive Comparison\n\n| | Mem0 | LangChain Memory | Letta | **DeepBrain** |\n|---|---|---|---|---|\n| Positioning | Memory storage | Conversation history | Stateful Agent | **Agent Memory Engine** |\n| Core capability | CRUD | Window management | State machine | **learn/recall/evolve** |\n| Knowledge refinement | ❌ | ❌ | ❌ | ✅ **Auto-evolve** |\n| Memory tiers | ❌ | ❌ | ✅ 3 tiers | ✅ **Core/Working/Archival** |\n| Framework lock-in | Standalone | LangChain | Letta | **Any framework** |\n| Local-first | Requires service | In-memory | Requires service | ✅ **PGLite, zero dependencies** |\n\n**In one line: others store memories; DeepBrain *refines* them.**\n\n## Quick Start\n\n```bash\nnpm install deepbrain\n```\n\n```typescript\nimport { Brain, AgentBrain } from 'deepbrain';\n\n// 1. Initialize the brain\nconst brain = new Brain({ embedding_provider: 'openai' });\nawait brain.connect();\nconst agent = new AgentBrain(brain, 'my-sales-agent');\n\n// 2. Learn — automatically store after each interaction\nawait agent.learn({\n  action: 'Customer asked about return policy',\n  result: '7-day no-questions-asked return, original packaging required',\n  context: { customer: 'VIP', channel: 'wechat' }\n});\n\n// 3. Recall — retrieve when needed\nconst memories = await agent.recall('What did this customer ask before?');\n// → [{ text: 'Customer asked about return policy...', score: 0.92 }]\n\n// 4. Evolve — run periodically to refine knowledge\nconst report = await agent.evolve();\n// → Distills 50 scattered experiences into 3 pieces of knowledge\n```\n\n## Core Concepts\n\n### Three APIs\n\n| API | What it does | When to call |\n|-----|-------------|-------------|\n| `learn()` | Store experience/knowledge | After each Agent task completion |\n| `recall()` | Semantic memory retrieval | When the Agent needs context |\n| `evolve()` | Refine + upgrade memories | Scheduled task (e.g., daily at midnight) |\n\n### Memory Tiers\n\n```\nCore     (≤20 items)  — Always in context, most important knowledge\nWorking  (≤50 items)  — Currently active, frequently accessed memories\nArchival (unlimited)  — Long-term storage, retrieved on demand\n```\n\nHigh access frequency → auto-promoted. Long unused → auto-demoted.\n\n### Knowledge Evolution (evolve)\n\nThis is DeepBrain's core differentiator:\n\n```\nDay 1:  50 scattered customer conversation records\nDay 7:  evolve() → Refined into 5 customer preference insights\nDay 30: evolve() → Further distilled into 2 core insights\n```\n\n**Knowledge gets sharper, not bigger.**\n\n### Memory Adapters\n\nDeepBrain is framework-agnostic. Connect via adapters:\n\n```typescript\nimport { adapters } from 'deepbrain';\n\n// OpenClaw adapter\nconst openclaw = adapters.openclaw;\n\n// Native adapter (any framework)\nconst native = adapters.native;\n\n// More adapters in development: LangChain, CrewAI, AutoGen...\n```\n\n## Full Feature Set\n\n| Category | Features |\n|----------|----------|\n| 🧠 **Memory** | learn/recall/evolve trio, Memory Tiers with auto-promotion/demotion |\n| 🔍 **Search** | Vector semantic search + full-text search, hybrid ranking |\n| 🔄 **Maintenance** | evolve knowledge refinement, dream auto-maintenance cycle |\n| 🔌 **Adapters** | OpenClaw / Native adapter layer, extensible interface |\n| 📥 **Import** | 24+ importers (Markdown/Notion/Obsidian/Logseq/Readwise...) |\n| 🤖 **AI** | 7 providers (OpenAI/Gemini/DeepSeek/Qwen/GLM/Moonshot/Ollama) |\n| 🛠️ **Integration** | MCP Server, REST API, Web UI |\n| 💾 **Storage** | PGLite local zero-dependency, vector indexing |\n\n## CLI Commands\n\n```bash\ndeepbrain learn \"Customer prefers Monday morning meetings\"  # Learn\ndeepbrain recall \"When does the customer have meetings?\"     # Recall\ndeepbrain evolve                                             # Knowledge evolution\ndeepbrain query \"return policy\"                              # Semantic search\ndeepbrain serve                                              # Web UI + API\ndeepbrain import notion ./export                             # Import from Notion\ndeepbrain dream                                              # Maintenance cycle\ndeepbrain stats                                              # View statistics\n```\n\n## Architecture\n\n```\n┌─────────────────────────────────────────┐\n│         Your Agent Framework             │\n│   (OpenClaw / LangChain / Custom / ...) │\n├─────────────────────────────────────────┤\n│         Memory Adapters                  │\n│   (openclaw / langchain / native)        │\n├─────────────────────────────────────────┤\n│         AgentBrain API                   │\n│   learn() · recall() · evolve()          │\n├─────────────────────────────────────────┤\n│         Brain Engine                     │\n│   Vector Search · FTS · Knowledge Graph  │\n├─────────────────────────────────────────┤\n│         PGLite + Embeddings              │\n│   Local Storage · Zero Deps · Zero Cost  │\n└─────────────────────────────────────────┘\n```\n\n## 🔗 Ecosystem\n\nDeepBrain is part of Deepleaper's open-source suite of four:\n\n| Project | Role | Relationship |\n|---------|------|-------------|\n| **DeepBrain** | Agent Memory Engine | ← You are here |\n| [opc-agent](https://github.com/Deepleaper/opc-agent) | Agent OS | Traces → learn() |\n| [agentkits](https://github.com/Deepleaper/agentkits) | OpenRouter with Memory | Auto recall + learn |\n| [agent-workstation](https://github.com/Deepleaper/agent-workstation) | Virtual Role Templates | brain-seed.md → L1 |\n\n```\nopc-agent collects Traces → DeepBrain learns → agentkits auto-recalls during calls → Agents get smarter over time\n```\n\n## License\n\nApache-2.0 — Free for commercial use. Contributions welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepleaper%2Fdeepbrain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepleaper%2Fdeepbrain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepleaper%2Fdeepbrain/lists"}