Engram——人工智能记忆与智能平台
生产级多层AI存储平台。Engram为AI助手提供了跨项目的持久、可搜索的内存,内置了OSINT爬虫、知识图和统一的仪表板。
______________________________________________________________________
快速开始
# First-time setup (interactive env configuration + deploy)
./scripts/deploy-unified.sh init
# Or step by step:
./scripts/deploy-unified.sh setup # configure .env interactively
./scripts/deploy-unified.sh up # build and start all services
# Services:
# Platform UI http://localhost:3002
# Memory API http://localhost:8000
# Crawler API http://localhost:11235
# MCP Server http://localhost:3000
# Weaviate http://localhost:8080完整部署指南 -> docs/01-deployment-manual.md______________________________________________________________________
什么是Engram?
| 组件 | 用途 | 堆栈 |
|---|---|---|
| Engram AiMemory | 三层向量内存系统 | Python 3.11+、FastAPI、Weaviate、Redis |
| Engram AiCrawler | OSINT网络爬虫与AI分析 | Python 3.11+,FastAPI,Crawl4AI,Chromium |
| Engram MCP | 模型上下文协议服务器 | TypeScript,节点20,OAuth 2.1,381测试 |
| Engram平台 | 统一前端仪表板 | Next.js 15、React 19、Clerk、Tailwind v4 |
数据流: Crawler发现和抓取->内存API存储向量->MCP向AI客户端公开工具->平台提供UI。
______________________________________________________________________
建筑
+---------------------------------------------+
| Engram-Platform (Next.js 15, port 3002) |
| Dashboard . Memory browser . Crawler UI |
+--------------+--------------+---------------+
| Engram-MCP | Crawler API | Memory API |
| port 3000 | port 11235 | port 8000 |
+--------------+--------------+---------------+
| Weaviate :8080 | Redis x2 :6379/:6380 |
+------------------+--------------------------+项目结构
Engram/
+-- Engram-AiMemory/ Python FastAPI memory system + CLI
+-- Engram-AiCrawler/ Python FastAPI OSINT crawler
+-- Engram-MCP/ TypeScript MCP server (canonical)
+-- Engram-Platform/ Next.js 15 dashboard (canonical UI)
| +-- docker-compose.yml Master orchestration file
+-- scripts/
| +-- deploy-unified.sh Canonical deployment entry point
+-- docs/ Consolidated documentation
+-- engram-shared/ Shared Python utilities
+-- archive/ Retired artifacts and session docs
+-- plans/ Implementation roadmaps______________________________________________________________________
统一部署
所有部署都通过一个入口点:
./scripts/deploy-unified.sh | 命令 | 描述 |
|---|---|
init | 首次设置:交互式环境配置+构建+部署+健康检查 |
setup | 交互式环境配置向导 |
up | 构建并启动堆栈 |
down | 停止堆叠 |
deploy [--dry-run] | 生产部署和飞行前检查 |
health | 检查所有服务运行状况端点 |
ps | 显示容器状态 |
logs [service] | 尾部服务日志 |
restart [service] | 重新启动所有或一个服务 |
config | 验证编写配置 |
通过委托可以访问每个子项目的遗留脚本:
./scripts/deploy-unified.sh deploy:production # full production deploy
./scripts/deploy-unified.sh deploy:devnode # devnode-optimized deploy
./scripts/deploy-unified.sh deploy:memory # memory system deploy______________________________________________________________________
文档
从这里开始
| 文档 | 描述 |
|---|---|
docs/00-index.md | 完整文档索引 |
docs/01-deployment-manual.md | 使用Docker Compose进行部署 |
docs/03-architecture-manual.md | 系统设计和数据流 |
docs/05-mcp-manual.md | MCP服务器设置和工具 |
参考
| 文档 | 描述 |
|---|---|
docs/reference/environment-variables.md | 全部 .env 变量 |
docs/reference/ports-network.md | 服务端口和URL |
docs/reference/commands.md | 常用开发命令 |
运营
| 文档 | 描述 |
|---|---|
docs/02-maintenance-manual.md | 备份、更新、监控 |
docs/04-troubleshooting-manual.md | 诊断和常见错误 |
docs/06-admin-manual.md | 用户管理、租户、安全 |
docs/07-pre-commit-guide.md | 代码质量挂钩设置 |
PRODUCTION_SETUP.md | 生产配置说明 |
TAILSCALE_SETUP.md | VPN和远程访问设置 |
项目
| 文档 | 描述 |
|---|---|
PROJECT_ROADMAP.md | 竣工计划 |
MEMORY_FEATURES.md | 存储系统功能参考 |
engram-shared/README.md | 共享Python实用程序包 |
______________________________________________________________________
开发设置
先决条件
- Docker&Docker编写
- Python 3.11+(用于AiMemory和AiCrawler开发)
- Node.js 20+(用于MCP和平台开发)
每个子项目开发
# AiMemory -- Python memory system + CLI
cd Engram-AiMemory
python3.11 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
make test
# AiCrawler -- FastAPI + React
cd Engram-AiCrawler/01_devroot
source .venv/bin/activate
uvicorn app.main:app --reload --port 11235
# MCP Server -- TypeScript (381 tests, OAuth 2.1)
cd Engram-MCP
npm install && npm run dev
# Platform -- Next.js 15 + React 19
cd Engram-Platform/frontend
npm install && npm run dev # http://localhost:3002共享公用设施
pip install -e ./engram-shared______________________________________________________________________
关键端口
| 服务 | 端口 | 注释 |
|---|---|---|
| 平台UI | 3002 | Next.js,带Clerk身份验证 |
| 内存API | 8000 | FastAPI,JWT验证 |
| 爬网程序API | 11235 | FastAPI,主管 |
| MCP服务器 | 3000 | 双传输:stdio+HTTP,OAuth 2.1 |
| 编织 | 8080 | 矢量数据库 |
| 爬虫Redis | 6379 | 缓存 |
| 内存Redis | 6380 | 缓存 |
______________________________________________________________________
环境变量
跑 ./scripts/deploy-unified.sh setup 用于交互式配置或复制 .env.example:
cp Engram-Platform/.env.example Engram-Platform/.env关键变量:
# Auth
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_...
CLERK_SECRET_KEY=sk_...
JWT_SECRET=your-secret-min-32-chars
# Embeddings
EMBEDDING_PROVIDER=deepinfra # openai | deepinfra | nomic | local
# Network (never use 0.0.0.0 in production)
BIND_ADDRESS=127.0.0.1
TAILSCALE_HOSTNAME=your-host.tail1234.ts.net
# MCP
MCP_AUTH_TOKEN=your-mcp-token看 docs/reference/environment-variables.md 查看完整列表。
______________________________________________________________________
测试
# AiMemory (Python, 80% coverage threshold)
cd Engram-AiMemory && make test
# AiCrawler (Python)
cd Engram-AiCrawler/01_devroot && pytest tests/ -v
# MCP (TypeScript, 381 tests)
cd Engram-MCP && npm test
# Platform (Vitest + Playwright)
cd Engram-Platform/frontend && npm run test:run && npm run test:e2e______________________________________________________________________
生产
Engram部署在Tailscale上(*.tail4da6b7.ts.net).永远不要直接在公共IP上公开服务。
./scripts/deploy-unified.sh deploy # full deploy with pre-flight
./scripts/deploy-unified.sh deploy --dry-run # validate without changes
./scripts/deploy-unified.sh health # verify all services看 docs/01-deployment-manual.md 和 PRODUCTION_SETUP.md.
______________________________________________________________________
状态
当前: 约75%已完成——正在积极开发中(基线2026-03-17) 路线图: PROJECT_ROADMAP.md
| 组件 | 测试覆盖率 | 测试 | 总体 |
|---|---|---|---|
| AiMemory | 78%(4049 stmts) | 883次通过,18次失败 | 70% |
| AiCrawler | 81%(12468次) | 2393次通过 | 75% |
| MCP服务器 | 未测量 | 381通过 | 80% |
| 平台 | 79%的stmts,72%的分支 | 318通过 | 60% |
