ContextLattice
ContextLattice
为什么选择 ContextLattice
ContextLattice 通过将之前的项目工作转化为高价值、可检索的上下文,减少了重复推理。
持久化内存写入,并扇出至专用存储。
具备分阶段获取和故障开放延续功能的快速+深度检索模式。
优先使用汇总上下文,在保持高效 Token 使用的同时,保留通往原始工件的深入路径。
本地优先部署,并提供可选的云端依赖支持。
通过 HTTP API、MCP 传输和操作仪表板实现人机协作 UX。
Related MCP server: copilot-memory-store
架构 (Public v3 lane)
层级 | 主要运行时 | 职责 |
网关/API | Go |
|
检索 + 内存服务 | Go + Rust | 快速/持久检索通道、汇总处理、内存库适配器 |
旧版回退 | Python | 仅用于兼容性回退(非默认热路径) |
仪表板 | TypeScript/Next.js | 控制台、思维导图、状态、计费、设置 UX |
安装
非技术用户安装程序
macOS DMG:
https://github.com/sheawinkler/ContextLattice/releases/latest/download/ContextLattice-macOS-universal.dmgLinux bundle:
https://github.com/sheawinkler/ContextLattice/releases/latest/download/ContextLattice-linux-bootstrap.tar.gzWindows MSI:
https://github.com/sheawinkler/ContextLattice/releases/latest/download/ContextLattice-windows-x64.msi
开发者安装
git clone git@github.com:sheawinkler/ContextLattice.git
cd ContextLattice
gmake quickstart快速入门
先决条件
兼容 Docker/Compose v2 的运行时
macOS、Linux 或 Windows (WSL2)
gmake,jq,rg,python3,curl
启动
1) 配置环境
cp .env.example .env
ln -svf ../../.env infra/compose/.env
gmake quickstartgmake quickstart 会提示输入运行时配置文件,并以合理的默认值启动。
如果从 macOS DMG 引导程序启动,它还会生成:
~/ContextLattice/setup/agent_contextlattice_instructions.md(已复制到剪贴板)~/ContextLattice/setup/agent_smoke_write_read.md(操作员写入/读取冒烟测试)
验证
ORCH_KEY="$(awk -F= '/^CONTEXTLATTICE_ORCHESTRATOR_API_KEY=/{print substr($0,index($0,"=")+1)}' .env)"
curl -fsS http://127.0.0.1:8075/health | jq
curl -fsS -H "x-api-key: ${ORCH_KEY}" http://127.0.0.1:8075/status | jq '.service,.sinks'运行时配置文件
配置文件 | 使用场景 | CPU | 内存 | 存储 |
| 笔记本电脑友好型本地使用 | 2-4 vCPU | 8-12 GB | 25-80 GB |
| 更高的吞吐量和更深度的召回 | 6-8 vCPU | 12-20 GB | 100-180 GB |
核心 API 示例
MCP 工具契约 (Glama-lite / stdio 桥接)
Glama 单容器配置文件暴露了三个具有明确作用域的 MCP 工具:
health: 只读就绪/故障排除检查 (GET /health),无副作用。memory.search: 只读作用域检索 (POST /memory/search),包含生命周期状态 (ready|pending|degraded|empty) 以及可选的接地/调试负载。memory.write: 状态变更的持久化写入 (POST /memory/write),包含明确的扇出状态和警告字段。
这三个工具均以文本内容和结构化负载形式返回 JSON,以实现客户端兼容性。
写入内存
curl -X POST "http://127.0.0.1:8075/memory/write" \
-H "Content-Type: application/json" \
-H "x-api-key: ${ORCH_KEY}" \
-d '{
"projectName": "my_project",
"fileName": "notes/decision.md",
"content": "Switched retrieval_mode to balanced for normal runs.",
"topicPath": "runbooks/retrieval"
}'读取内存
curl -X POST "http://127.0.0.1:8075/memory/search" \
-H "Content-Type: application/json" \
-H "x-api-key: ${ORCH_KEY}" \
-d '{
"project": "my_project",
"query": "retrieval mode decision",
"topic_path": "runbooks/retrieval",
"include_grounding": true
}'带有延续元数据的深度读取
curl -X POST "http://127.0.0.1:8075/memory/search" \
-H "Content-Type: application/json" \
-H "x-api-key: ${ORCH_KEY}" \
-d '{
"project": "my_project",
"query": "full architecture context",
"retrieval_mode": "deep",
"include_grounding": true,
"include_retrieval_debug": true
}'配置 (公共安全要点)
仅设置正常运行所需的内容:
CONTEXTLATTICE_ORCHESTRATOR_URL=http://127.0.0.1:8075
CONTEXTLATTICE_ORCHESTRATOR_API_KEY=<set-by-setup>
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=<long-random-secret>
APP_URL=http://localhost:3000如需完整配置参考,请使用 .env.example。
仪表板
UI:
http://127.0.0.1:3000/console思维导图:
http://127.0.0.1:3000/mindmap状态:
http://127.0.0.1:3000/status
公共版与付费版
此仓库跟踪公共免费通道 (v3.x)。
高级付费调优、专有优化策略以及私有商业化文档位于此公共通道之外。
文档
网站文档:
https://contextlattice.io/本地文档索引:
docs/Hugging Face lite 部署:
docs/huggingface-space-lite.md
许可证
Apache 2.0。请参阅 LICENSE。
Available Tools
3 toolshealthARead-onlyIdempotentInspect
Run a non-destructive runtime health check before any memory tool call. Use this when a connection fails, startup seems incomplete, or you need readiness evidence before writes. Returns a JSON health envelope (for example: status/services/components/queue fields) as both text and structured JSON. If the orchestrator requires an API key and the bridge is not configured, this returns an auth failure instead of mutating state.
Inputs: no named parameters. Returns: Health payload from GET /health.
memory.searchARead-onlyIdempotentInspect
Read-only contextual retrieval for pre-inference recall. Required: project + query. Keep project aligned with prior memory.write calls so ranking and topic continuity remain coherent. Parameter interactions: topic_path narrows scope and usually reduces noise/latency; if scoped reads return empty/degraded, retry once without topic_path. include_grounding=true adds citation-safe grounding with strict numeric copy behavior (numbers must be consumed verbatim). include_retrieval_debug=true adds source policy/timing/failure detail for diagnosis and can increase payload size. agent_id should stay stable across sessions so retrieval profile defaults (mode/sources/escalation) remain deterministic. Lifecycle handling: result_state can be ready/pending/degraded/empty; when pending/degraded, use warnings/source status and continuation metadata to re-read after cache warm. Do not use this tool for writes or health checks: use memory.write for persistence and health for startup/readiness checks. On auth/upstream failures this returns isError=true with structured error payload.
Inputs: query (required), project (required), agent_id, topic_path, +2 more. Returns: Memory search payload from POST /memory/search.
memory.writeAInspect
State-changing durable memory write used for checkpoints, implementation decisions, and compact recall artifacts. Parameter interactions: projectName should match the project used by memory.search; fileName is the logical lineage key (stable fileName preserves continuity and dedupe behavior); topicPath controls retrieval partitioning and, if omitted, is derived from fileName. content should be concise and factual (avoid full transcripts; preserve numeric facts verbatim). Side effects: successful writes may trigger asynchronous fanout/indexing/rollup work. ok=true with event_id means the write was accepted, but per-target fanout can still be pending/retrying and is returned in fanout/warnings. Do not use this for retrieval or diagnostics: use memory.search for reads and health for readiness checks. On auth/upstream errors this returns isError=true with structured error payload.
Inputs: content (required), fileName (required), projectName (required), topicPath. Returns: Memory write acknowledgement payload from POST /memory/write.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
The three tools have completely distinct purposes: health handles readiness checks, memory.search is read-only retrieval, and memory.write is state-changing persistence. Their descriptions explicitly cross-reference each other to prevent confusion.
memory.search and memory.write follow a consistent memory.<verb> pattern, but health is a standalone noun not following the same convention. Minor deviation, still readable.
Three tools is within the ideal 3-15 range and each tool serves a distinct, necessary purpose (health, retrieval, persistence). The scope is tightly focused with no redundancy.
Core read/write operations are covered along with a health check. Missing operations like delete or list all might be absent, but search and write cover the primary memory lifecycle without clear dead ends.
Maintenance
Related MCP Connectors
CellMath is a governed AI memory and knowledge-cell MCP server designed to stop context bloat, unverified memory drift, and agent hallucinations. Instead of dumping raw, noisy RAG chunks into every turn, CellMath organizes persistent agent knowledge into structured, isolated Knowledge Cells with causal graph edges and strict write-time governance—keeping the full 3-tool MCP schema ultra-compact (~1,200 tokens). Core 3-Tool Pipeline: • vault_access — Read-only lookup, cell hydration, and graph edge traversal with strict zero-match silence (never fabricates context when no verified cell exists). • verify_safety — Preflight security and policy gate that blocks destructive or unsafe operations before execution. • vault_commit — Governed state mutation (store, update, causal edges, session checkpoints, and 4-tier purge) enforcing source provenance. Built for Claude, Cursor, ChatGPT, Gemini, and autonomous agents over Streamable HTTP.
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Cross-tool persistent memory and context for AI assistants over MCP.
Shared memory for your AI tools: tasks, notes and context every tool can read and write over MCP.
Related MCP Servers
- AlicenseBqualityDmaintenanceElevate your LLM task management with Task Orchestrator, an MCP server that empowers you to define, organize, and track goals and tasks with hierarchical precision. Integrate intelligent task management into your workflow.57MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI tools like GitHub Copilot to manage and persist context using a local JSON-based memory store. Provides CLI, MCP server, and VS Code integration for storing, retrieving, and managing context entries.2-
- AlicenseNot gradedqualityDmaintenanceA persistent memory and context management system for AI CLI tools that utilizes a three-layer architecture and semantic search to prevent context loss between sessions. It provides time-aware orientation and smart memory routing to help AI agents maintain project knowledge and architectural decisions.1MIT
- AlicenseAqualityAmaintenanceLocal RAG system for Claude Code with hybrid search (semantic + BM25), cross-encoder reranking, markdown-aware chunking, and 12 MCP tools. Zero external servers, pure ONNX in-process.13515 PyPI306MIT