Local-first self-learning knowledge base. Turn your documents into searchable, evolving knowledge.
Project description
๐ง OPC DeepBrain
Self-Evolving Knowledge Engine for AI Agents โ 6-Layer Memory That Grows With You
AI Agent ่ช่ฟๅ็ฅ่ฏๅผๆ โ 6 ๅฑ่ฎฐๅฟ๏ผ่ถ็จ่ถ่ชๆ
Website ยท Quick Start ยท API Reference ยท vs Mem0
๐ก Why DeepBrain?
Memory solutions like Mem0 store facts. DeepBrain evolves knowledge.
| Problem | Mem0 / Others | DeepBrain |
|---|---|---|
| Memory model | Flat key-value | 6-layer evolving hierarchy |
| Quality control | None | 4-Gate validation system |
| Knowledge growth | Manual CRUD | Auto-promotion through layers |
| Dependencies | Redis, Qdrant, OpenAIโฆ | Zero (stdlib only) |
| Storage | Cloud vectors | SQLite (100% local) |
| Self-awareness | โ | โ Meta-knowledge layer |
DeepBrain is a standalone, embeddable knowledge engine that gives any AI agent long-term, self-evolving memory โ in 3 lines of code, with zero dependencies.
โจ Key Features
- ๐๏ธ 6-Layer Memory Architecture โ From flash memory to meta-knowledge, just like the human brain
- ๐ช 4-Gate Quality Control โ Every piece of knowledge passes Relevance โ Novelty โ Consistency โ Utility gates
- ๐ฆ Zero Dependencies โ Pure Python stdlib. No numpy, no torch, no API keys
- ๐พ 100% Local โ SQLite storage. Your knowledge never leaves your machine
- ๐ Embeddable โ Drop into any Python agent framework in 3 lines
- ๐ Auto-Evolution โ Knowledge automatically promotes, consolidates, and archives
๐ Quick Start
pip install opc-deepbrain
from opc_deepbrain import DeepBrain
# Initialize
brain = DeepBrain("./my_brain.db")
# Learn
brain.learn("User prefers concise, technical answers", source="conversation")
# Recall
results = brain.recall("What communication style does the user prefer?")
print(results[0].content) # โ "User prefers concise, technical answers"
That's it. No API keys. No config. No cloud. 3 lines to persistent, evolving memory.
๐๏ธ 6-Layer Memory Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Layer 5: ๐ฎ Meta-Knowledge โ
โ "I know that I know X well, but Y is uncertain"โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Layer 4: ๐๏ธ Archived โ
โ Historical reference, low-access but preserved โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Layer 3: ๐๏ธ Consolidated โ
โ Cross-session patterns, validated over time โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Layer 2: ๐ Long-Term โ
โ Validated knowledge, frequently accessed โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Layer 1: ๐ Short-Term โ
โ Recent interactions, hours to days โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Layer 0: โก Flash Memory โ
โ Current session buffer, minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Auto-promotion based on relevance,
frequency, and validation scores
How Knowledge Evolves
- Ingestion โ New knowledge enters Layer 0 (Flash)
- 4-Gate Check โ Relevance, Novelty, Consistency, Utility scoring
- Promotion โ High-quality knowledge moves up layers over time
- Consolidation โ Related facts merge into coherent understanding
- Meta-Learning โ The system learns its own knowledge strengths/gaps
๐ช 4-Gate Quality Control
Every piece of knowledge must pass through 4 gates:
| Gate | Purpose | Question Asked |
|---|---|---|
| ๐ฏ Relevance | Is this useful? | Does this relate to active contexts? |
| ๐ Novelty | Is this new? | Do we already know this? |
| โ Consistency | Does this fit? | Does it contradict existing knowledge? |
| ๐ง Utility | Is this actionable? | Can this improve future responses? |
๐ API Reference
Core API
from opc_deepbrain import DeepBrain
brain = DeepBrain(db_path="./brain.db")
# Learn โ store knowledge
brain.learn(
content="FastAPI is preferred over Flask for new projects",
source="architecture-review",
category="tech-decisions",
tags=["python", "web", "architecture"]
)
# Recall โ retrieve relevant knowledge
results = brain.recall(
query="Which web framework should we use?",
top_k=5,
min_score=0.3
)
# Search โ keyword search
results = brain.search("FastAPI", category="tech-decisions")
# Stats โ memory statistics
stats = brain.stats()
print(f"Total entries: {stats['total']}")
print(f"By layer: {stats['by_layer']}")
# Evolve โ trigger manual evolution cycle
brain.evolve()
# Export / Import
brain.export("backup.json")
brain.load("backup.json")
Embedding in Your Agent
# Works with any agent framework
class MyAgent:
def __init__(self):
self.brain = DeepBrain("./agent_brain.db")
def chat(self, user_message):
# Recall relevant context
context = self.brain.recall(user_message, top_k=3)
# Generate response (your LLM call here)
response = self.llm.generate(user_message, context=context)
# Learn from the interaction
self.brain.learn(
f"User asked about: {user_message}",
source="conversation"
)
return response
โ๏ธ Comparison / ๅฏนๆฏ
| Feature | OPC DeepBrain | Mem0 | ChromaDB | Pinecone |
|---|---|---|---|---|
| Memory Model | 6-layer evolving | Flat store | Vector store | Vector store |
| Quality Control | 4-Gate system | โ | โ | โ |
| Auto-Evolution | โ | โ | โ | โ |
| Meta-Knowledge | โ | โ | โ | โ |
| Dependencies | 0 | 5+ | 3+ | 2+ |
| Storage | SQLite (local) | Redis + Qdrant | Local/Cloud | Cloud only |
| Cloud Required | โ | โ ๏ธ Optional | โ ๏ธ Optional | โ Yes |
| Pricing | Free | Free/Paid | Free/Paid | Paid |
| Self-Evolving | โ | โ | โ | โ |
| Python stdlib only | โ | โ | โ | โ |
๐ Integrations
DeepBrain powers memory in:
- OPC Agent โ Local AI agent
- Leaper Agent โ Global agent framework
- Leaper Agent CN โ China-optimized agent
- Your project โ
pip install opc-deepbrainand go
๐ License
BSL-1.1 โ see LICENSE for details.
๐ค Contributing
We welcome contributions! See CONTRIBUTING.md.
๐ง Contact: tech@deepleaper.com
Built with โค๏ธ by Deepleaper Technology / ่ท็็งๆ
Give your AI agent a brain that evolves.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opc_deepbrain-0.4.1.tar.gz.
File metadata
- Download URL: opc_deepbrain-0.4.1.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c7e5d347ce5f408a0dfb69fea052a8eff23eb5c87102ca3d5e861bbdd312dcb
|
|
| MD5 |
92a19b72621bc5b7ca27943c7f229116
|
|
| BLAKE2b-256 |
d7258d049b9e913811380b1db394a1a7436a2496006cf69f6320f0fb26615ad7
|
File details
Details for the file opc_deepbrain-0.4.1-py3-none-any.whl.
File metadata
- Download URL: opc_deepbrain-0.4.1-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0df6bc9668f65dea621af7f6089cf36de4ac7afb6978ecf8e42c072c1125c2b
|
|
| MD5 |
912dbb865b5b62979fad86944c4cbeee
|
|
| BLAKE2b-256 |
6c16b9ea574ae27b245ea0e11fbcab74b88643b0e52a952c8e037c3085e48ed6
|