https://github.com/deepleaper/deepbrain
๐ง 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.
https://github.com/deepleaper/deepbrain
agent ai brain chinese deepseek embedding evernote knowledge mcp memory notion obsidian ollama pglite pgvector search second-brain typescript vector
Last synced: about 1 month ago
JSON representation
๐ง 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.
- Host: GitHub
- URL: https://github.com/deepleaper/deepbrain
- Owner: Deepleaper
- License: apache-2.0
- Created: 2026-04-12T23:53:46.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2026-04-16T12:58:21.000Z (about 1 month ago)
- Last Synced: 2026-04-16T14:32:21.755Z (about 1 month ago)
- Topics: agent, ai, brain, chinese, deepseek, embedding, evernote, knowledge, mcp, memory, notion, obsidian, ollama, pglite, pgvector, search, second-brain, typescript, vector
- Language: TypeScript
- Size: 304 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ง DeepBrain
**Agent ่ฎฐๅฟๅผๆ โ ่ฎฉ AI ่ถ็จ่ถ่ชๆ**
[](https://www.npmjs.com/package/deepbrain)
[](LICENSE)
[](https://www.typescriptlang.org/)
[ๅฟซ้ๅผๅง](#ๅฟซ้ๅผๅง) ยท [ๆ ธๅฟๆฆๅฟต](#ๆ ธๅฟๆฆๅฟต) ยท [API ๆๆกฃ](#api-ๆๆกฃ) ยท [English](#english)
---
## ๐ก ไธๅฅ่ฏไป็ป
> **ไธๆฏ RAG๏ผไธๆฏ็ฅ่ฏๅบใDeepBrain ๆฏ Agent ็ๅคง่ โ ไผๅญฆไน ใไผ่ฎฐๅฟใไผ่ฟๅใ**
็ฐๆ Agent ๆกๆถ็็็น๏ผ**ๆฏๆฌกๅฏน่ฏ้ฝไป้ถๅผๅง**ใAgent ไธ่ฎฐๅพๆจๅคฉๅญฆๅฐ็๏ผไธ่ฎฐๅพไธๅจ็ฏ็้๏ผๆขไธชไบบๆฅๆไธๅๅฝ้ถใ
DeepBrain ็จไธไธช API ่งฃๅณ๏ผ
```
brain.learn() โ ๆ็ป้ชๅๅ
ฅ่ฎฐๅฟ
brain.recall() โ ้่ฆๆถๆฃ็ดข็ธๅ
ณ่ฎฐๅฟ
brain.evolve() โ ๅฎๆๆ็ผ๏ผ็ฅ่ฏ่ถๆฅ่ถ็ฒพ่ไธๆฏ่ถๆฅ่ถๅค
```
## ๐ฏ ๅ็ซๅ็ๅบๅซ
| | Mem0 | LangChain Memory | Letta | **DeepBrain** |
|---|---|---|---|---|
| ๅฎไฝ | ่ฎฐๅฟๅญๅจ | ๅฏน่ฏๅๅฒ | ๆ็ถๆ Agent | **Agent ่ฎฐๅฟๅผๆ** |
| ๆ ธๅฟ่ฝๅ | CRUD | ็ชๅฃ็ฎก็ | ็ถๆๆบ | **learn/recall/evolve** |
| ็ฅ่ฏๆ็ผ | โ | โ | โ | โ
**่ชๅจ่ฟๅ** |
| ่ฎฐๅฟๅๅฑ | โ | โ | โ
3ๅฑ | โ
**Core/Working/Archival** |
| ๆกๆถ็ปๅฎ | ็ฌ็ซ | LangChain | Letta | **ไปปๆๆกๆถ** |
| ๆฌๅฐ่ฟ่ก | ้่ฆๆๅก | ๅ
ๅญ | ้่ฆๆๅก | โ
**PGLite ้ถไพ่ต** |
**ไธๅฅ่ฏ๏ผๅซไบบ็ฎกๅญ๏ผDeepBrain ็ฎก"็ผ"ใ**
## ๅฟซ้ๅผๅง
```bash
npm install deepbrain
```
```typescript
import { Brain, AgentBrain } from 'deepbrain';
// 1. ๅๅงๅๅคง่
const brain = new Brain({ embedding_provider: 'openai' });
await brain.connect();
const agent = new AgentBrain(brain, 'my-sales-agent');
// 2. ๅญฆไน โ Agent ๆฏๆฌกไบคไบๅ่ชๅจๅญๅจ
await agent.learn({
action: 'ๅฎขๆท้ฎไบ้่ดงๆฟ็ญ',
result: '7ๅคฉๆ ็็ฑ้่ดง๏ผ้ไฟ็ๅ
่ฃ
',
context: { customer: 'VIP', channel: 'wechat' }
});
// 3. ๅๅฟ โ ้่ฆๆถ่ชๅจๆฃ็ดข
const memories = await agent.recall('่ฟไธชๅฎขๆทไนๅ้ฎ่ฟไปไน๏ผ');
// โ [{ text: 'ๅฎขๆท้ฎไบ้่ดงๆฟ็ญ...', score: 0.92 }]
// 4. ่ฟๅ โ ๅฎๆ่ฟ่ก๏ผๆ็ผ็ฅ่ฏ
const report = await agent.evolve();
// โ ๆ 50 ๆก้ถๆฃ็ป้ชๆ็ผๆ 3 ๆก็ฅ่ฏ
```
## ๆ ธๅฟๆฆๅฟต
### ไธไธช API
| API | ๅไปไน | ไปไนๆถๅ่ฐ |
|-----|-------|----------|
| `learn()` | ๅญๅจ็ป้ช/็ฅ่ฏ | ๆฏๆฌก Agent ๅฎๆไปปๅกๅ |
| `recall()` | ่ฏญไนๆฃ็ดข่ฎฐๅฟ | ๆฏๆฌก Agent ้่ฆไธไธๆๆถ |
| `evolve()` | ๆ็ผ+ๅ็บง่ฎฐๅฟ | ๅฎๆถไปปๅก๏ผๅฆๆฏๅคฉๅๆจ๏ผ |
### ่ฎฐๅฟๅๅฑ
```
Core (โค20ๆก) โ ๅง็ปๅจไธไธๆไธญ๏ผๆ้่ฆ็็ฅ่ฏ
Working (โค50ๆก) โ ๅฝๅๆดป่ท๏ผ้ข็น่ฎฟ้ฎ็่ฎฐๅฟ
Archival (ๆ ้) โ ้ฟๆๅญๅจ๏ผๆ้ๆฃ็ดข
```
่ฎฟ้ฎ้ข็้ซ โ ่ชๅจๅ็บงใ้ฟๆไธ็จ โ ่ชๅจ้็บงใ
### ็ฅ่ฏ่ฟๅ (evolve)
่ฟๆฏ DeepBrain ๆๆ ธๅฟ็ๅทฎๅผๅ๏ผ
```
Day 1: 50ๆก้ถๆฃ็ๅฎขๆทๅฏน่ฏ่ฎฐๅฝ
Day 7: evolve() โ ๆ็ผไธบ 5 ๆกๅฎขๆทๅๅฅฝ็ฅ่ฏ
Day 30: evolve() โ ่ฟไธๆญฅ็ฒพ็ผไธบ 2 ๆกๆ ธๅฟๆดๅฏ
```
**็ฅ่ฏ่ถๆฅ่ถ็ฒพ๏ผ่ไธๆฏ่ถๆฅ่ถๅคใ**
### Memory Adapters
DeepBrain ไธ็ปๅฎไปปไฝๆกๆถใ้่ฟ้้
ๅฑๅฏนๆฅ๏ผ
```typescript
import { adapters } from 'deepbrain';
// OpenClaw ้้
const openclaw = adapters.openclaw;
// ๅ็้้
๏ผไปปไฝๆกๆถ๏ผ
const native = adapters.native;
// ๆดๅค้้
ๅฑๅผๅไธญ๏ผLangChain, CrewAI, AutoGen...
```
## ๅ
จ้จ็นๆง
| ็ฑปๅซ | ็นๆง |
|------|------|
| ๐ง **่ฎฐๅฟ** | learn/recall/evolve ไธไปถๅฅใMemory Tiers ่ชๅจๅ้็บง |
| ๐ **ๆ็ดข** | ๅ้่ฏญไนๆ็ดข + ๅ
จๆๆฃ็ดขใๆททๅๆๅบ |
| ๐ **็ปดๆค** | evolve ็ฅ่ฏๆ็ผใdream ่ชๅจ็ปดๆคๅจๆ |
| ๐ **้้
** | OpenClaw / Native ้้
ๅฑใๅฏๆฉๅฑๆฅๅฃ |
| ๐ฅ **ๅฏผๅ
ฅ** | 24+ importers๏ผMarkdown/Notion/Obsidian/Logseq/Readwise...๏ผ |
| ๐ค **AI** | 7 providers๏ผOpenAI/Gemini/DeepSeek/้ไนๅ้ฎ/ๆบ่ฐฑ/Moonshot/Ollama๏ผ |
| ๐ ๏ธ **้ๆ** | MCP ServerใREST APIใWeb UI |
| ๐พ **ๅญๅจ** | PGLite ๆฌๅฐ้ถไพ่ตใๅ้็ดขๅผ |
## CLI ๅฝไปค
```bash
deepbrain learn "ๅฎขๆทๅๅฅฝ๏ผๅจไธไธๅๅผไผ" # ๅญฆไน
deepbrain recall "ๅฎขๆทไปไนๆถๅๅผไผ๏ผ" # ๆฃ็ดข
deepbrain evolve # ็ฅ่ฏ่ฟๅ
deepbrain query "้่ดงๆฟ็ญ" # ่ฏญไนๆ็ดข
deepbrain serve # Web UI + API
deepbrain import notion ./export # ๅฏผๅ
ฅ Notion
deepbrain dream # ็ปดๆคๅจๆ
deepbrain stats # ๆฅ็็ป่ฎก
```
## ๆถๆ
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ไฝ ็ Agent ๆกๆถ โ
โ (OpenClaw / LangChain / ่ช็ / ...) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Memory Adapters โ
โ (openclaw / langchain / native) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ AgentBrain API โ
โ learn() ยท recall() ยท evolve() โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Brain Engine โ
โ ๅ้ๆ็ดข ยท FTS ยท ็ฅ่ฏๅพ่ฐฑ ยท ๅๅฑ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ PGLite + Embeddings โ
โ ๆฌๅฐๅญๅจ ยท ้ถไพ่ต ยท ้ถๆๆฌ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
## ๐ ็ๆ
DeepBrain ๆฏ่ท็ๅผๆบๅไปถๅฅไนไธ๏ผ
| ้กน็ฎ | ๅฎไฝ | ๅ
ณ็ณป |
|------|------|------|
| **DeepBrain** | Agent ่ฎฐๅฟๅผๆ | โ ไฝ ๅจ่ฟ้ |
| [opc-agent](https://github.com/Deepleaper/opc-agent) | Agent OS | Traces โ learn() |
| [agentkits](https://github.com/Deepleaper/agentkits) | ๅธฆ่ฎฐๅฟ็ OpenRouter | ่ชๅจ recall + learn |
| [agent-workstation](https://github.com/Deepleaper/agent-workstation) | ่ๆๅทฅไฝๆจกๆฟ | brain-seed.md โ L1 |
```
opc-agent ๆถ้ Traces โ DeepBrain ๅญฆไน โ agentkits ่ฐ็จๆถ่ชๅจ recall โ Agent ่ถๆฅ่ถ่ชๆ
```
## License
Apache-2.0 โ ๅ
่ดนๅ็จ๏ผๆฌข่ฟ่ดก็ฎใ
---
## English
## ๐ก What Is DeepBrain?
> **Not RAG. Not a knowledge base. DeepBrain is the brain for your AI Agent โ it learns, remembers, and evolves.**
The 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.
DeepBrain solves this with three APIs:
```
brain.learn() โ Write experience into memory
brain.recall() โ Retrieve relevant memories when needed
brain.evolve() โ Periodically refine โ knowledge gets sharper, not bigger
```
## ๐ฏ Competitive Comparison
| | Mem0 | LangChain Memory | Letta | **DeepBrain** |
|---|---|---|---|---|
| Positioning | Memory storage | Conversation history | Stateful Agent | **Agent Memory Engine** |
| Core capability | CRUD | Window management | State machine | **learn/recall/evolve** |
| Knowledge refinement | โ | โ | โ | โ
**Auto-evolve** |
| Memory tiers | โ | โ | โ
3 tiers | โ
**Core/Working/Archival** |
| Framework lock-in | Standalone | LangChain | Letta | **Any framework** |
| Local-first | Requires service | In-memory | Requires service | โ
**PGLite, zero dependencies** |
**In one line: others store memories; DeepBrain *refines* them.**
## Quick Start
```bash
npm install deepbrain
```
```typescript
import { Brain, AgentBrain } from 'deepbrain';
// 1. Initialize the brain
const brain = new Brain({ embedding_provider: 'openai' });
await brain.connect();
const agent = new AgentBrain(brain, 'my-sales-agent');
// 2. Learn โ automatically store after each interaction
await agent.learn({
action: 'Customer asked about return policy',
result: '7-day no-questions-asked return, original packaging required',
context: { customer: 'VIP', channel: 'wechat' }
});
// 3. Recall โ retrieve when needed
const memories = await agent.recall('What did this customer ask before?');
// โ [{ text: 'Customer asked about return policy...', score: 0.92 }]
// 4. Evolve โ run periodically to refine knowledge
const report = await agent.evolve();
// โ Distills 50 scattered experiences into 3 pieces of knowledge
```
## Core Concepts
### Three APIs
| API | What it does | When to call |
|-----|-------------|-------------|
| `learn()` | Store experience/knowledge | After each Agent task completion |
| `recall()` | Semantic memory retrieval | When the Agent needs context |
| `evolve()` | Refine + upgrade memories | Scheduled task (e.g., daily at midnight) |
### Memory Tiers
```
Core (โค20 items) โ Always in context, most important knowledge
Working (โค50 items) โ Currently active, frequently accessed memories
Archival (unlimited) โ Long-term storage, retrieved on demand
```
High access frequency โ auto-promoted. Long unused โ auto-demoted.
### Knowledge Evolution (evolve)
This is DeepBrain's core differentiator:
```
Day 1: 50 scattered customer conversation records
Day 7: evolve() โ Refined into 5 customer preference insights
Day 30: evolve() โ Further distilled into 2 core insights
```
**Knowledge gets sharper, not bigger.**
### Memory Adapters
DeepBrain is framework-agnostic. Connect via adapters:
```typescript
import { adapters } from 'deepbrain';
// OpenClaw adapter
const openclaw = adapters.openclaw;
// Native adapter (any framework)
const native = adapters.native;
// More adapters in development: LangChain, CrewAI, AutoGen...
```
## Full Feature Set
| Category | Features |
|----------|----------|
| ๐ง **Memory** | learn/recall/evolve trio, Memory Tiers with auto-promotion/demotion |
| ๐ **Search** | Vector semantic search + full-text search, hybrid ranking |
| ๐ **Maintenance** | evolve knowledge refinement, dream auto-maintenance cycle |
| ๐ **Adapters** | OpenClaw / Native adapter layer, extensible interface |
| ๐ฅ **Import** | 24+ importers (Markdown/Notion/Obsidian/Logseq/Readwise...) |
| ๐ค **AI** | 7 providers (OpenAI/Gemini/DeepSeek/Qwen/GLM/Moonshot/Ollama) |
| ๐ ๏ธ **Integration** | MCP Server, REST API, Web UI |
| ๐พ **Storage** | PGLite local zero-dependency, vector indexing |
## CLI Commands
```bash
deepbrain learn "Customer prefers Monday morning meetings" # Learn
deepbrain recall "When does the customer have meetings?" # Recall
deepbrain evolve # Knowledge evolution
deepbrain query "return policy" # Semantic search
deepbrain serve # Web UI + API
deepbrain import notion ./export # Import from Notion
deepbrain dream # Maintenance cycle
deepbrain stats # View statistics
```
## Architecture
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Your Agent Framework โ
โ (OpenClaw / LangChain / Custom / ...) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Memory Adapters โ
โ (openclaw / langchain / native) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ AgentBrain API โ
โ learn() ยท recall() ยท evolve() โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Brain Engine โ
โ Vector Search ยท FTS ยท Knowledge Graph โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ PGLite + Embeddings โ
โ Local Storage ยท Zero Deps ยท Zero Cost โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
## ๐ Ecosystem
DeepBrain is part of Deepleaper's open-source suite of four:
| Project | Role | Relationship |
|---------|------|-------------|
| **DeepBrain** | Agent Memory Engine | โ You are here |
| [opc-agent](https://github.com/Deepleaper/opc-agent) | Agent OS | Traces โ learn() |
| [agentkits](https://github.com/Deepleaper/agentkits) | OpenRouter with Memory | Auto recall + learn |
| [agent-workstation](https://github.com/Deepleaper/agent-workstation) | Virtual Role Templates | brain-seed.md โ L1 |
```
opc-agent collects Traces โ DeepBrain learns โ agentkits auto-recalls during calls โ Agents get smarter over time
```
## License
Apache-2.0 โ Free for commercial use. Contributions welcome.