
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Store, search, recall, and link memories with automatic embeddings, fact extraction, versioning, deduplication, and graph visualization.
https://img.shields.io/badge/License-Elastic--2.0-blue.svg](LICENSE) https://img.shields.io/badge/version-5.11.0-gold.svg](CHANGELOG.md)
Quick Start · API Reference · SDKs · MCP Server · CLI · Self-Host
Engram gives your AI agents long-term memory. Instead of losing context between sessions, agents store what they learn and recall it when relevant, automatically.
bash# Store what the agent learns curl -X POST http://localhost:4200/store \ -H "Authorization: Bearer eg_your_key" \ -H "Content-Type: application/json" \ -d '{"content": "User prefers dark mode and uses Vim keybindings", "category": "decision", "importance": 8}' # Later, in a new session - recall relevant context curl -X POST http://localhost:4200/recall \ -H "Authorization: Bearer eg_your_key" \ -H "Content-Type: application/json" \ -d '{"query": "setting up the user editor"}' # → Returns the dark mode + Vim preference automatically
Key features:
GET /graph/timeline shows how your knowledge graph grew week by weekabstained: true when confidence is below threshold. The system knows when it doesn't know.temporal_sort orders results chronologically. Episode search by date range.POST /guard checks proposed actions against stored rules before execution. Returns allow/warn/block. Prevents repeated deployment mistakes, outdated references, and policy violations.engram-cli store, engram-cli search, etc.)docker compose upSix standalone microservices absorbed into the Engram monolith as native modules. No new dependencies, no new processes. Same database, same auth.
Thymus (quality evaluation) - Rubric-based scoring engine for agent output quality. Define evaluation criteria with weighted scales, run evaluations, track agent scores over time. Stores quality metrics alongside memories.
POST /thymus/rubrics - Create evaluation rubrics with weighted criteriaGET /thymus/rubrics - List rubricsPOST /thymus/evaluations - Score agent output against a rubricGET /thymus/evaluations - List evaluations with agent/rubric filteringGET /thymus/agents/:agent/scores - Aggregate scores per agentPOST /thymus/metrics - Record arbitrary quality metricsGET /thymus/metrics - Query metrics with time range and agent filteringGET /thymus/stats - Rubric, evaluation, and metric countsSoma (agent registry) - Agent lifecycle management. Register agents with capabilities, track heartbeats, organize into groups, collect structured logs.
POST /soma/agents - Register an agentGET /soma/agents - List agents with type/status/capability filteringPATCH /soma/agents/:id - Update agent metadataDELETE /soma/agents/:id - Deregister (atomic cascade delete)POST /soma/agents/:id/heartbeat - Heartbeat with optional status updateGET /soma/agents/stale - Find agents that missed heartbeatsPOST /soma/agents/:id/logs - Submit structured log entriesGET /soma/agents/:id/logs - Read agent logsPOST /soma/groups - Create agent groupsGET /soma/groups - List groupsPOST /soma/groups/:id/members - Add agent to groupDELETE /soma/groups/:id/members/:agentId - Remove from groupGET /soma/agents/capability/:name - Find agents by capabilityGET /soma/stats - Registry statisticsChiasm (task tracking) - Lightweight task coordination for multi-agent systems. Agents create tasks, update status, and read each other's active work via a feed endpoint.
POST /tasks - Create a taskGET /tasks - List tasks with status/agent/project filteringGET /tasks/:id - Get task with full audit trailPATCH /tasks/:id - Update status/summary (creates audit entry)DELETE /tasks/:id - Delete taskGET /tasks/stats - Task counts by statusGET /feed - Activity feed of recent task updatesAxon (event bus) - Real-time pub/sub event bus with SSE streaming, webhook fan-out, and cursor-based polling. Agents publish events to named channels, subscribe for real-time delivery or poll at their own pace.
POST /axon/publish - Publish an event to a channelGET /axon/events - Query events with channel/type/source filteringGET /axon/channels - List channels with event and subscriber countsPOST /axon/channels - Create a new channelPOST /axon/subscribe - Subscribe agent to channel (optional webhook URL)POST /axon/unsubscribe - Remove subscriptionGET /axon/subscriptions - List subscriptionsGET /axon/poll - Cursor-based event consumptionGET /axon/stream - SSE real-time event streamGET /axon/stats - Bus statisticsLoom (workflow orchestration) - Multi-step pipeline engine with dependency-based execution. Define reusable workflows with webhook, LLM, and transform step types. Runs track progress, retry failed steps, and collect outputs.
POST /loom/workflows - Create a workflow definitionGET /loom/workflows - List workflowsPOST /loom/runs - Start a workflow run with inputGET /loom/runs - List runs with status filteringGET /loom/runs/:id - Get run with full statePOST /loom/runs/:id/cancel - Cancel a running workflowGET /loom/runs/:id/steps - Get step states for a runGET /loom/runs/:id/logs - Get execution logsPOST /loom/steps/:id/complete - External callback to complete a stepPOST /loom/steps/:id/fail - External callback to fail a stepGET /loom/stats - Workflow and run statisticsBroca (action log and narrator) - Agent action logger with template-based narration and natural language query. Logs what agents do, translates actions into plain English, and answers questions about system activity.
POST /broca/actions - Log an action with auto-narrationGET /broca/actions - Query actions with filteringGET /broca/actions/:id - Get single actionGET /broca/actions/:id/narrate - Generate narrative for actionGET /broca/feed - Activity feed with narrativesPOST /broca/narrate - Bulk narrate actionsPOST /broca/ask - Natural language query over the systemGET /broca/stats - Action statisticsAll six services share the main Engram database, reuse auth middleware, and publish events via the Axon event bus.
PageRank for Memory Graphs - Full iterative PageRank algorithm with type-aware edge weighting. Memories linked to by important memories score higher, not just memories with lots of connections. Scores are normalized 0-1 and stored per memory. Runs automatically every 25th store alongside community detection.
Search Ranking from Graph Structure - Search results now get a 0-15% boost based on their PageRank score. Structurally important memories surface higher in /search and /context results. This works on top of the existing RRF scoring, decay, and temporal signals.
Auto Graph Analysis on Store - Every 25th memory stored triggers background community detection and PageRank recomputation via the durable job queue. No impact on store latency.
Temporal Graph Evolution - New GET /graph/timeline endpoint returns weekly aggregates of graph growth.
Enriched Graph Endpoint - /graph now returns pagerank_score per node. Node sizes are boosted by PageRank.
Server-Side Source Filtering - /search, /context, and /recall accept a source parameter. Filter propagates into hybrid search at both vector and FTS5 stages.
Worker Thread Embeddings - ONNX inference moved to a dedicated Worker thread. No more event loop blocking.
Batch Link Queries - Relationship expansion uses single batch query instead of N+1.
TypeScript Zero Errors - Clean compilation with zero TS errors.
v5.8.2 - Blended Retrieval, Memory Health, Feedback Loop
Blended Multi-Strategy Retrieval - classifyQuestionMixed detects mixed-intent queries and blends multiple question types with normalized weights. blendStrategies produces a weighted combination of SearchStrategy configs.
Memory Health Endpoint - GET /memory-health returns four diagnostic categories: stale, duplicates, high-value unlinked, and contradiction hints.
Retrieval Feedback - POST /feedback accepts signals (used, ignored, corrected, irrelevant, helpful). Auto-adjusts importance. GET /feedback/stats returns analytics.
Search Explainability - Per-channel score breakdowns (vector, FTS, graph, personality, reranker, decay) in search results.
Freshness-Weighted Structured Facts - Facts sorted by freshness with linear decay. Old facts tagged [possibly outdated].
Contradiction Ranking Penalty - Non-latest-version memories with contradiction keywords receive 0.65x score penalty.
v5.8.1 - Durable Jobs, Security Hardening, Scheduler Leases
Durable Job Queue - DB-backed jobs table with retry, exponential backoff, and crash recovery.
Scheduler Leases - DB-backed leases prevent duplicate background work in multi-instance deployments.
Security - Atomic memory ownership, bootstrap hardening, cross-tenant scratchpad fix, SSRF redirect blocking, passport tenant binding.
Readiness Probes - GET /live and GET /ready with 503 when degraded.
v5.8.0 - Intelligence Pipeline Overhaul
Reciprocal Rank Fusion - 4-channel RRF scoring (vector, FTS5, personality, graph). Question-type-aware strategies.
SimHash Deduplication - 64-bit locality-sensitive hashing detects near-duplicates before embedding.
Bi-Temporal Fact Tracking - Structured facts with valid_at/invalid_at windows. Contradiction-based invalidation.
Entity Cooccurrence Graph - Composite scoring (name similarity, frequency, temporal proximity).
Community Detection - Label propagation on memory_links graph.
Cross-Encoder Reranker - BGE-reranker-base (INT8, sub-100ms). Optional.
Personality Engine - Six signal types: preference, value, motivation, decision, emotion, identity.
Progressive Disclosure - /context depth=1/2/3 for token budget control.
v5.7.0 - BGE-large, Episodic Memory, Multi-Tenant Isolation
BGE-large-en-v1.5 (1024-dim), episodic memory, complete multi-tenant security audit, guardrails, abstention, assistant recall, 2-hop graph traversal, implicit connection inference.
v5.6.0 - Node.js 22, Graph Intelligence
Node.js 22+, optimized MCP server, vitest, Graphology knowledge graph.
v5.5.0 - Intelligence Layer
LLM fact extraction, auto-tagging, conversation extraction, URL ingest, reflections, derived memories, auto-consolidation.
v5.4.0 - Security Hardening
7 security fixes (S1-S7), RBAC, timing-safe auth, rate limiting, HSTS, CSP.
v5.3.0 - FSRS-6 Spaced Repetition
FSRS-6 with 21 trained weights, dual-strength model, time travel, smart context, reflections, digests, derived memories, auto-consolidation.
v5.0.0 - Multi-Tenant
Users, API keys, spaces, FTS5+vector hybrid search, auto-linking, version chains, libsql.
v4.0.0 - SQLite + Local Embeddings
SQLite + FTS5, MiniLM-L6-v2 embeddings, basic CRUD, conversations.
v3.0.0 - Initial Release
In-memory storage, basic embedding search.
bashgit clone https://github.com/zanfiel/engram.git && cd engram npm install cp .env.example .env # Edit .env: set ENGRAM_GUI_PASSWORD npm start # Or: docker compose up -d
bashcurl -X POST http://localhost:4200/bootstrap \ -H "Content-Type: application/json" \ -d '{"name": "my-admin-key"}' # Save the returned eg_... key
bashexport KEY="eg_your_key_here" curl -X POST http://localhost:4200/store \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"content": "Production database is PostgreSQL 16 on db.example.com:5432", "category": "reference", "importance": 8}' curl -X POST http://localhost:4200/store \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"content": "Never deploy on Fridays - outage on 2026-01-15 was caused by Friday deploy", "category": "decision", "importance": 9}' curl -X POST http://localhost:4200/store \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"content": "Migrated auth service from JWT to opaque sessions for compliance", "category": "decision", "importance": 7}'
bash# Semantic search curl -X POST http://localhost:4200/search \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"query": "database connection details"}' # Decision-focused search curl -X POST http://localhost:4200/search \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"query": "deployment policy", "mode": "decision"}' # Budget-aware context for RAG injection curl -X POST http://localhost:4200/context \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"query": "setting up a new deploy pipeline", "mode": "fast"}'
bash# Before deploying, check against stored rules curl -X POST http://localhost:4200/guard \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"action": "deploy to production on Friday"}' # Returns: { "verdict": "warn", "reasons": ["Never deploy on Fridays..."] }
Engram is especially strong as a decision memory system. It tracks not just what you know, but what you decided, why, and what changed.
contradicts linkPOST /correct stores a correction that supersedes the original, with corrects relationshipPOST /guard checks proposed actions against stored decision rules before executionmode=timeline or time-travel queriesThis makes Engram ideal for:
Memories extracted by LLM (fact extraction, personality signals) land in the review inbox instead of being immediately trusted. This gives you control over what enters long-term memory.
bash# List pending memories curl http://localhost:4200/inbox -H "Authorization: Bearer $KEY" # Approve a memory curl -X POST http://localhost:4200/inbox/42/approve -H "Authorization: Bearer $KEY" # Reject a memory curl -X POST http://localhost:4200/inbox/42/reject -H "Authorization: Bearer $KEY"
Memories you store directly via /store bypass the inbox and are approved immediately.
typescriptimport { Engram } from "@zanfiel/engram/sdk"; const engram = new Engram({ url: "http://localhost:4200", apiKey: "eg_..." }); // Store await engram.store("User prefers dark mode", { category: "decision", importance: 8 }); // Search with presets const results = await engram.search("dark mode", { mode: "preference" }); // Budget-aware context for RAG const ctx = await engram.context("setting up the editor", { mode: "fast" }); // Guardrails const check = await engram.guard("deploy to production on Friday"); if (check.verdict === "block") console.log("Blocked:", check.reasons); // Inbox review const pending = await engram.inbox(); for (const mem of pending.pending) { await engram.approve(mem.id); // or: engram.reject(mem.id) }
bash# Store curl -X POST http://localhost:4200/store \ -H "Authorization: Bearer eg_your_key" \ -H "Content-Type: application/json" \ -d '{"content": "Server migrated to new IP", "category": "state", "importance": 7}' # Search with mode preset curl -X POST http://localhost:4200/search \ -H "Authorization: Bearer eg_your_key" \ -H "Content-Type: application/json" \ -d '{"query": "server migration", "mode": "timeline", "limit": 5}' # Recall curl -X POST http://localhost:4200/recall \ -H "Authorization: Bearer eg_your_key" \ -H "Content-Type: application/json" \ -d '{"query": "infrastructure changes"}' # FSRS state curl http://localhost:4200/fsrs/state?id=42 \ -H "Authorization: Bearer eg_your_key"
Engram includes a real https://modelcontextprotocol.io/ server for integration with Claude Desktop, Cursor, Windsurf, and other MCP-compatible tools.
Transport: JSON-RPC 2.0 over stdio
Add to claude_desktop_config.json:
json{ "mcpServers": { "engram": { "command": "node", "args": ["--experimental-strip-types", "path/to/engram/mcp-server.ts"], "env": { "ENGRAM_URL": "http://localhost:4200", "ENGRAM_API_KEY": "eg_your_key" } } } }
| Tool | Description |
|---|---|
memory_store | Store a new memory with category, importance, and model attribution |
memory_recall | Semantic + full-text search across memories |
memory_context | Token-budget-aware context packing for LLM injection |
memory_list | List recent memories, optionally filtered by category |
memory_delete | Delete a memory by ID |
memory_guard | Check a proposed action against stored rules (allow/warn/block) |
memory_inbox | Review pending memories awaiting triage (approve/reject) |
memory_search_preset | Search with opinionated presets: fact, timeline, preference, decision, recent |
memory_entities | List or search tracked entities (people, servers, tools, services) |
memory_projects | List or search tracked projects |
memory_episodes | List conversation episodes (sessions of related work) |
memory_scratch | Read/write scratchpad (short-term working memory, 30min TTL) |
structural_analyze | Analyze a system in EN syntax -- topology (Pipeline/Tree/DAG/Cycle), node roles, bridges |
structural_detail | Deep analysis -- concurrency metrics, critical path, flow depth, resilience |
structural_between | Betweenness centrality for a node (0-1 score) |
structural_distance | Shortest path between two nodes with subsystem annotations |
structural_trace | Follow directed flow from A to B along yields->needs edges |
structural_impact | Blast radius -- what disconnects if a node is removed |
structural_diff | Structural diff between two systems -- topology changes, role changes, bridges |
structural_evolve | Dry-run architectural changes and preview the structural delta |
structural_categorize | Auto-discover subsystem boundaries via Louvain community detection |
structural_extract | Extract a named subsystem as standalone EN source |
structural_compose | Merge two EN graphs with entity linking |
structural_memory_graph | Analyze Engram's own memory link graph structurally |
Note: The MCP server connects to a running Engram instance via HTTP. All tools support signed tool manifests for integrity verification when
ENGRAM_SIGNING_SECRETis set.
Engram ships a full CLI that wraps the HTTP API. Zero external dependencies -- uses Node.js 22 built-in util.parseArgs.
bash# Install globally (or use npx) npm install -g @zanfiel/engram # Configure export ENGRAM_URL=http://localhost:4200 export ENGRAM_API_KEY=eg_your_key # Store engram-cli store "Deployed auth migration to production" --category state --importance 9 # Search engram-cli search "deployment history" --limit 5 --explain # Context (RAG) engram-cli context "current infrastructure state" --budget 4000 # Recall engram-cli recall --context "what changed recently" # Other commands engram-cli list --limit 20 engram-cli forget 42 --reason "outdated" engram-cli delete 42 engram-cli health engram-cli stats
All commands support --json for raw API output and --quiet for minimal output (IDs and counts only). Config can also be set in ~/.engram/config.json.
All endpoints
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务