🧠 OPC DeepBrain
Self-Evolving Knowledge Engine for AI Agents — 6-Layer Memory That Grows With You
AI Agent 自进化知识引擎 — 6 层记忆,越用越聪明
💡 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.
Metadata
Release files for opc-deepbrain 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opc_deepbrain-0.4.1.tar.gz | 31.0 kB | Without provenance | Details for opc_deepbrain-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opc_deepbrain-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for opc_deepbrain-0.4.1-py3-none-any.whl |
Total release size: 56.7 kB
Release files / opc_deepbrain-0.4.1.tar.gz
| Download URL | opc_deepbrain-0.4.1.tar.gz |
|---|---|
| Size | 31.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c7e5d347ce5f408a0dfb69fea052a8eff23eb5c87102ca3d5e861bbdd312dcb
|
|
BLAKE2b-256 checksum How to use checksums |
d7258d049b9e913811380b1db394a1a7436a2496006cf69f6320f0fb26615ad7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / opc_deepbrain-0.4.1-py3-none-any.whl
| Download URL | opc_deepbrain-0.4.1-py3-none-any.whl |
|---|---|
| Size | 25.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0df6bc9668f65dea621af7f6089cf36de4ac7afb6978ecf8e42c072c1125c2b
|
|
BLAKE2b-256 checksum How to use checksums |
6c16b9ea574ae27b245ea0e11fbcab74b88643b0e52a952c8e037c3085e48ed6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for opc-deepbrain 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.