{"id":51594370,"url":"https://github.com/deepleaper/opc-deepbrain","last_synced_at":"2026-07-11T17:02:16.779Z","repository":{"id":354789117,"uuid":"1225160568","full_name":"Deepleaper/opc-deepbrain","owner":"Deepleaper","description":"Pure local self-learning knowledge base. No cloud, no cost, your data stays on your machine.","archived":false,"fork":false,"pushed_at":"2026-05-12T16:39:38.000Z","size":122,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-12T18:33:08.234Z","etag":null,"topics":["ai","knowledge-base","local-first","ollama","python","self-learning","sqlite"],"latest_commit_sha":null,"homepage":"https://github.com/Deepleaper","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Deepleaper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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-30T02:21:53.000Z","updated_at":"2026-05-12T17:03:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Deepleaper/opc-deepbrain","commit_stats":null,"previous_names":["deepleaper/opc-deepbrain"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Deepleaper/opc-deepbrain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepleaper%2Fopc-deepbrain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepleaper%2Fopc-deepbrain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepleaper%2Fopc-deepbrain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepleaper%2Fopc-deepbrain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Deepleaper","download_url":"https://codeload.github.com/Deepleaper/opc-deepbrain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepleaper%2Fopc-deepbrain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35368768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"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":["ai","knowledge-base","local-first","ollama","python","self-learning","sqlite"],"created_at":"2026-07-11T17:02:14.711Z","updated_at":"2026-07-11T17:02:16.772Z","avatar_url":"https://github.com/Deepleaper.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e ⚠️ **DEPRECATED**: OPC DeepBrain has been merged into [OPC Agent](https://github.com/Deepleaper/opc-agent) v1.0.0+.\n\u003e Install pip install opc-agent to get both the Agent and DeepBrain in a single package.\n\u003e This repository is archived for reference only.\n\u003cdiv align=\"center\"\u003e\n\n# 🧠 OPC DeepBrain\n\n### Self-Evolving Knowledge Engine for AI Agents — 6-Layer Memory That Grows With You\n\n### AI Agent 自进化知识引擎 — 6 层记忆，越用越聪明\n\n[![PyPI version](https://img.shields.io/pypi/v/opc-deepbrain.svg)](https://pypi.org/project/opc-deepbrain/)\n[![Downloads](https://img.shields.io/pypi/dm/opc-deepbrain.svg)](https://pypi.org/project/opc-deepbrain/)\n[![GitHub stars](https://img.shields.io/github/stars/deepleaper/opc-deepbrain.svg)](https://github.com/deepleaper/opc-deepbrain/stargazers)\n[![License](https://img.shields.io/badge/License-BSL--1.1-blue.svg)](LICENSE)\n[![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)](https://python.org)\n[![Dependencies](https://img.shields.io/badge/Dependencies-0-green.svg)](#)\n\n[Website](https://www.deepleaper.com) · [Quick Start](#-quick-start) · [API Reference](#-api-reference) · [vs Mem0](#-comparison)\n\n\u003c/div\u003e\n\n---\n\n## 💡 Why DeepBrain?\n\nMemory solutions like Mem0 store facts. **DeepBrain evolves knowledge.**\n\n| Problem | Mem0 / Others | DeepBrain |\n|---------|--------------|-----------|\n| Memory model | Flat key-value | 6-layer evolving hierarchy |\n| Quality control | None | 4-Gate validation system |\n| Knowledge growth | Manual CRUD | Auto-promotion through layers |\n| Dependencies | Redis, Qdrant, OpenAI… | **Zero** (stdlib only) |\n| Storage | Cloud vectors | SQLite (100% local) |\n| Self-awareness | ❌ | ✅ Meta-knowledge layer |\n\n**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.\n\n## ✨ Key Features\n\n- 🏗️ **6-Layer Memory Architecture** — From flash memory to meta-knowledge, just like the human brain\n- 🚪 **4-Gate Quality Control** — Every piece of knowledge passes Relevance → Novelty → Consistency → Utility gates\n- 📦 **Zero Dependencies** — Pure Python stdlib. No numpy, no torch, no API keys\n- 💾 **100% Local** — SQLite storage. Your knowledge never leaves your machine\n- 🔌 **Embeddable** — Drop into any Python agent framework in 3 lines\n- 🔄 **Auto-Evolution** — Knowledge automatically promotes, consolidates, and archives\n\n## 🚀 Quick Start\n\n```bash\npip install opc-deepbrain\n```\n\n```python\nfrom deepbrain import DeepBrain\n\n# Initialize\nbrain = DeepBrain(\"./my_brain.db\")\n\n# Learn\nbrain.learn(\"User prefers concise, technical answers\", source=\"conversation\")\n\n# Recall\nresults = brain.search(\"What communication style does the user prefer?\")\nprint(results[0][\"content\"])  # → \"User prefers concise, technical answers\"\n```\n\n**That's it.** No API keys. No config. No cloud. 3 lines to persistent, evolving memory.\n\n## 🏗️ 6-Layer Memory Architecture\n\n```\n┌─────────────────────────────────────────────────┐\n│  Layer 5: 🔮 Meta-Knowledge                     │\n│  \"I know that I know X well, but Y is uncertain\"│\n├─────────────────────────────────────────────────┤\n│  Layer 4: 🗄️ Archived                           │\n│  Historical reference, low-access but preserved  │\n├─────────────────────────────────────────────────┤\n│  Layer 3: 🏗️ Consolidated                       │\n│  Cross-session patterns, validated over time     │\n├─────────────────────────────────────────────────┤\n│  Layer 2: 📚 Long-Term                          │\n│  Validated knowledge, frequently accessed        │\n├─────────────────────────────────────────────────┤\n│  Layer 1: 📝 Short-Term                         │\n│  Recent interactions, hours to days              │\n├─────────────────────────────────────────────────┤\n│  Layer 0: ⚡ Flash Memory                        │\n│  Current session buffer, minutes                 │\n└─────────────────────────────────────────────────┘\n         ↑ Auto-promotion based on relevance,\n           frequency, and validation scores\n```\n\n### How Knowledge Evolves\n\n1. **Ingestion** → New knowledge enters Layer 0 (Flash)\n2. **4-Gate Check** → Relevance, Novelty, Consistency, Utility scoring\n3. **Promotion** → High-quality knowledge moves up layers over time\n4. **Consolidation** → Related facts merge into coherent understanding\n5. **Meta-Learning** → The system learns its own knowledge strengths/gaps\n\n## 🚪 4-Gate Quality Control\n\nEvery piece of knowledge must pass through 4 gates:\n\n| Gate | Purpose | Question Asked |\n|------|---------|---------------|\n| 🎯 **Relevance** | Is this useful? | Does this relate to active contexts? |\n| 🆕 **Novelty** | Is this new? | Do we already know this? |\n| ✅ **Consistency** | Does this fit? | Does it contradict existing knowledge? |\n| 🔧 **Utility** | Is this actionable? | Can this improve future responses? |\n\n## 📖 API Reference\n\n### Core API\n\n```python\nfrom deepbrain import DeepBrain\n\nbrain = DeepBrain(db_path=\"./brain.db\")\n\n# Learn — store knowledge\nbrain.learn(\n    content=\"FastAPI is preferred over Flask for new projects\",\n    source=\"architecture-review\",\n    namespace=\"tech-decisions\"\n)\n\n# Recall — retrieve relevant knowledge\nresults = brain.search(\n    query=\"Which web framework should we use?\",\n    top_k=5\n)\n\n# Search — keyword search\nresults = brain.search(\"FastAPI\", namespace=\"tech-decisions\")\n\n# Stats — memory statistics\nstats = brain.stats()\nprint(f\"Total entries: {stats['total']}\")\nprint(f\"By layer: {stats['by_namespace']}\")\n\n# Evolve — trigger manual evolution cycle\nbrain.evolve()\n\n```\n\n### Embedding in Your Agent\n\n```python\n# Works with any agent framework\nclass MyAgent:\n    def __init__(self):\n        self.brain = DeepBrain(\"./agent_brain.db\")\n\n    def chat(self, user_message):\n        # Recall relevant context\n        context = self.brain.search(user_message, top_k=3)\n\n        # Generate response (your LLM call here)\n        response = self.llm.generate(user_message, context=context)\n\n        # Learn from the interaction\n        self.brain.learn(\n            f\"User asked about: {user_message}\",\n            source=\"conversation\"\n        )\n\n        return response\n```\n\n## ⚖️ Comparison / 对比\n\n| Feature | **OPC DeepBrain** | Mem0 | ChromaDB | Pinecone |\n|---------|:-:|:-:|:-:|:-:|\n| Memory Model | 6-layer evolving | Flat store | Vector store | Vector store |\n| Quality Control | 4-Gate system | ❌ | ❌ | ❌ |\n| Auto-Evolution | ✅ | ❌ | ❌ | ❌ |\n| Meta-Knowledge | ✅ | ❌ | ❌ | ❌ |\n| Dependencies | **0** | 5+ | 3+ | 2+ |\n| Storage | SQLite (local) | Redis + Qdrant | Local/Cloud | Cloud only |\n| Cloud Required | ❌ | ⚠️ Optional | ⚠️ Optional | ✅ Yes |\n| Pricing | **Free** | Free/Paid | Free/Paid | Paid |\n| Self-Evolving | ✅ | ❌ | ❌ | ❌ |\n| Python stdlib only | ✅ | ❌ | ❌ | ❌ |\n\n## 🔌 Integrations\n\nDeepBrain powers memory in:\n- [OPC Agent](https://github.com/deepleaper/opc-agent) — Local AI agent\n- [Leaper Agent](https://github.com/deepleaper/leaper-agent) — Global agent framework\n- [Leaper Agent CN](https://github.com/deepleaper/leaper-agent-cn) — China-optimized agent\n- **Your project** — `pip install opc-deepbrain` and go\n\n## 📄 License\n\n[BSL-1.1](LICENSE) — see LICENSE for details.\n\n## 🤝 Contributing\n\nWe welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md).\n\n📧 Contact: [tech@deepleaper.com](mailto:tech@deepleaper.com)\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Built with ❤️ by [Deepleaper Technology / 跃盟科技](https://www.deepleaper.com)**\n\n*Give your AI agent a brain that evolves.*\n\n\u003c/div\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepleaper%2Fopc-deepbrain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepleaper%2Fopc-deepbrain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepleaper%2Fopc-deepbrain/lists"}