ContextLattice
ContextLattice is an HTTP-first, MCP-compatible memory/context/task orchestrator that persists writes and returns fused recall from specialized stores with local-first defaults. Primary URL: https://contextlattice.io/ Install: https://contextlattice.io/installation.html Troubleshooting: https://contextlattice.io/troubleshooting.html
README
ContextLattice
<p align="center"> <a href="https://contextlattice.io/" target="_blank" rel="noopener noreferrer"> <img src="docs/public_overview/assets/architecture-service-map.svg" alt="Context Lattice system context map" width="100%" /> </a> </p>
<p align="center"> Local-first memory orchestration for AI systems with durable writes, multi-sink fanout, retrieval learning loops, and operator-grade controls. </p>
<p align="center"> <a href="https://modelcontextprotocol.io/"><img src="https://img.shields.io/badge/MCP-HTTP%20Gateway-6b7280?style=for-the-badge" alt="MCP HTTP Gateway"></a> <a href="#quickstart"><img src="https://img.shields.io/badge/Deploy-Docker%20Compose-4b5563?style=for-the-badge" alt="Docker Compose"></a> <a href="#performance-profile"><img src="https://img.shields.io/badge/Write%20Rate-100%2B%20msg%2Fs-374151?style=for-the-badge" alt="Write rate"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/License-BSL%201.1-1f2937?style=for-the-badge" alt="BSL 1.1"></a> </p>
<p align="center"> <a href="https://contextlattice.io/">Overview</a> | <a href="https://contextlattice.io/architecture.html">Architecture</a> | <a href="https://contextlattice.io/installation.html">Installation</a> | <a href="https://contextlattice.io/integration.html">Integrations</a> | <a href="https://contextlattice.io/troubleshooting.html">Troubleshooting</a> | <a href="https://contextlattice.io/updates.html">Updates</a> </p>
Why Context Lattice
Context Lattice is built for teams running high-volume memory writes where durability and retrieval quality matter more than prompt bloat.
- One ingress contract (
/memory/write) with validated + normalized payloads. - Durable outbox fanout to specialized sinks (Qdrant, Mongo raw, MindsDB, Letta, memory-bank).
- Retrieval orchestration that merges multi-source recall and improves ranking through a learning loop.
- Local-first operation with optional cloud BYO for specific sinks.
Architecture Snapshot
<table> <tr> <td width="50%"> <a href="https://contextlattice.io/architecture.html"> <img src="docs/public_overview/assets/architecture-service-map.svg" alt="Context Lattice service map" width="100%" /> </a> </td> <td width="50%"> <a href="https://contextlattice.io/architecture.html"> <img src="docs/public_overview/assets/architecture-write-flow.svg" alt="Write flow with durable outbox fanout" width="100%" /> </a> </td> </tr> <tr> <td width="50%"> <a href="https://contextlattice.io/architecture.html"> <img src="docs/public_overview/assets/architecture-retrieval-flow.svg" alt="Retrieval and learning feedback flow" width="100%" /> </a> </td> <td width="50%"> <a href="https://contextlattice.io/architecture.html"> <img src="docs/public_overview/assets/architecture-task-coordination.svg" alt="Task coordination and agent communication flow" width="100%" /> </a> </td> </tr> </table>
Quickstart
Prerequisites
- Container app requirement: a Compose v2-compatible container runtime is required (
docker compose), such as Docker Desktop, Docker Engine, or another runtime that supports Compose v2 - Supported host environments: macOS, Linux, or Windows (WSL2)
- Host machine sized for selected profile (
litevsfull) with enough CPU, RAM, and disk gmake,jq,rg,python3,curl- Tested baseline: macOS 13+ with Docker Desktop
1) Configure environment
cp .env.example .env
ln -svf ../../.env infra/compose/.env
2) One-command quickstart (recommended)
gmake quickstart
This command:
- creates
.envif missing - links compose env
- generates
MEMMCP_ORCHESTRATOR_API_KEYif missing - applies secure local defaults
- boots the stack
- runs smoke + auth-safe health checks
3) 60-second verify (recommended)
ORCH_KEY="$(awk -F= '/^MEMMCP_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'
Expected:
/healthreturns{"ok": true, ...}/statusreturns service and sink states (with API key)
4) Manual bootstrap (optional)
BOOTSTRAP=1 scripts/first_run.sh
MINDSDB_REQUIRED now defaults automatically from COMPOSE_PROFILES.
5) Other launch profiles
# launch using current COMPOSE_PROFILES from .env
gmake mem-up
# explicit modes
gmake mem-up-lite
gmake mem-up-full
gmake mem-up-core
# persist profile mode for future gmake mem-up
gmake mem-mode-full
gmake mem-mode-core
6) Verify health and telemetry
ORCH_KEY="$(awk -F= '/^MEMMCP_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
curl -fsS -H "x-api-key: ${ORCH_KEY}" http://127.0.0.1:8075/telemetry/fanout | jq
curl -fsS -H "x-api-key: ${ORCH_KEY}" http://127.0.0.1:8075/telemetry/retention | jq
7) First-run toggles (optional)
scripts/first_run.sh --allow-secrets-storage
scripts/first_run.sh --block-secrets-storage
scripts/first_run.sh --insecure-local
scripts/first_run.sh now enforces secure local-first defaults unless explicitly overridden:
- loopback-only host port binding (
HOST_BIND_ADDRESS=127.0.0.1) - production auth posture (
MEMMCP_ENV=production, strict API key requirement) - private status/docs/webhook endpoints
- secrets-safe writes (
SECRETS_STORAGE_MODE=redact)
Security toggles:
--allow-secrets-storage--block-secrets-storage--insecure-local(explicit opt-out)
Agent Operator Prompt (Paste Once)
Paste this into any new agent session (ChatGPT app, Claude chat apps, Claude Code, Codex):
You must use Context Lattice as the memory/context layer.
Runtime:
- Orchestrator: http://127.0.0.1:8075
- API key: MEMMCP_ORCHESTRATOR_API_KEY from my local .env
Required behavior:
1) Before planning, call POST /memory/search with compact query + project/topic filters.
2) During long tasks, checkpoint major decisions/outcomes via POST /memory/write.
3) Before final answer, run one more POST /memory/search for recency.
4) Keep writes compact (summary, decisions, diffs), never full transcripts.
5) If memory endpoints fail, continue task and report degraded-memory mode explicitly.
Detailed playbook: docs/human_agent_instruction_playbook.md
External Agent Task Routing (Generic)
Context Lattice can queue and route tasks to external runners (Codex, OpenCode, Claude Code) and still supports internal application workers.
- External-first pattern: set
agentto the external runner id (codex,opencode,claude-code, or any custom worker name). - Internal app workers remain supported: use
agent=internalor leave unassigned (agentempty /any) for orchestrator workers. - Practical default: external runners as primary path, internal workers as fallback/secondary for high-resource systems.
ORCH_KEY="$(awk -F= '/^MEMMCP_ORCHESTRATOR_API_KEY=/{print substr($0,index($0,"=")+1)}' .env)"
# 1) Create a task targeted to any external runner id.
curl -fsS -X POST http://127.0.0.1:8075/agents/tasks \
-H "content-type: application/json" \
-H "x-api-key: ${ORCH_KEY}" \
-d '{
"title":"summarize deployment notes",
"project":"default",
"agent":"codex",
"priority":3,
"payload":{
"action":"memory_search",
"query":"deployment notes",
"project":"default",
"limit":8
}
}'
# 2) Runner claims only tasks assigned to its worker id (plus unassigned/any tasks).
curl -fsS -X POST "http://127.0.0.1:8075/agents/tasks/next?worker=codex" \
-H "x-api-key: ${ORCH_KEY}"
# 3) Runner reports completion.
curl -fsS -X POST http://127.0.0.1:8075/agents/tasks/<TASK_ID>/status \
-H "content-type: application/json" \
-H "x-api-key: ${ORCH_KEY}" \
-d '{"status":"succeeded","message":"completed by external runner","metadata":{"worker":"codex"}}'
Performance Profile
- Sustained write throughput target:
100+ messages/secondfor typical memory payloads on modern laptop-class hardware. - Outbox protection: fanout retries, coalescing windows, and target-level backpressure to protect core durability.
- Storage pressure controls: retention runner, low-value TTL pruning, optional snapshot pruning, and external NVMe cold path support.
- Retrieval path: parallel source reads with orchestrator merge/rank loop and preference-learning feedback.
Model Runtime
- Ships with a sane local default (
qwenvia Ollama). - Any OpenAI-compatible endpoint can be used when preferred.
- BYO model runtimes supported through:
- Ollama
- LM Studio
- llama.cpp compatible server
- hosted OpenAI-compatible providers
Security defaults
SECRETS_STORAGE_MODE=redactredacts secret-like material before memory persistence/fanout.SECRETS_STORAGE_MODE=blockrejects writes containing secret-like material (422).SECRETS_STORAGE_MODE=allowstores write payloads as-is (operator opt-in).- Compose host bindings default to loopback via
HOST_BIND_ADDRESS=127.0.0.1. - Production strict mode requires
MEMMCP_ORCHESTRATOR_API_KEY.
Main branch release gate (v1.0.0)
Enforce PR-only merges on main with CODEOWNERS approval (.github/CODEOWNERS is * @sheawinkler):
scripts/enable_main_branch_protection.sh main 1
If GitHub returns Upgrade to GitHub Pro or make this repository public, switch repo visibility or plan, then rerun the command.
Web 3 Ready
- IronClaw can be enabled as an optional messaging surface without changing the core local-first deployment.
- OpenClaw/ZeroClaw surfaces now run with strict secret-leakage protections by default.
- IronClaw docs and architecture conventions are excellent references for operator-facing completeness.
# optional IronClaw bridge
IRONCLAW_INTEGRATION_ENABLED=true
IRONCLAW_DEFAULT_PROJECT=messaging
# strict secret guard for openclaw/zeroclaw/ironclaw messaging surfaces
MESSAGING_OPENCLAW_STRICT_SECURITY=true
Ingress endpoints:
POST /integrations/messaging/openclawPOST /integrations/messaging/ironclawPOST /integrations/messaging/command@ContextLattice task create|status|list|approve|replay|deadletter|runtime
API Surface (selected)
POST /memory/writePOST /memory/searchPOST /integrations/messaging/commandPOST /integrations/messaging/openclawPOST /integrations/messaging/ironclawPOST /integrations/telegram/webhookPOST /integrations/slack/eventsPOST /agents/tasksGET /agents/tasksGET /agents/tasks/runtimeGET /agents/tasks/deadletterPOST /agents/tasks/{task_id}/replayPOST /agents/tasks/recover-leasesGET /telemetry/memoryGET /telemetry/fanoutGET /telemetry/retentionPOST /telemetry/retention/run
Docs Index
- Runbook:
docs/onprem_full_runbook.md - Performance:
docs/performance.md - Retention operations:
docs/retention_ops.md - Storage controls:
docs/storage_and_retention.md - Orchestrator enhancements:
docs/orchestrator_enhancements.md - Launch checklist:
docs/launch_checklist.md - Submission requirements audit:
docs/submission_requirements.md - Human agent instruction playbook:
docs/human_agent_instruction_playbook.md - Public messaging package:
docs/public_messaging_package.md - Legal and licensing:
docs/legal/README.md - New repo migration plan:
docs/contextlattice_repo_migration_plan.md
Pre-submit verifier:
gmake submission-preflight
python3 scripts/submission_preflight.py --online
Private/Public Sync Notes
This repository (sheawinkler/ContextLattice) is the primary codebase.
Public landing collateral remains mirrored in the dedicated public overview mirror repository.
- Source:
docs/public_overview/ - Sync script:
scripts/sync_public_overview.sh
License
Business Source License 1.1 with change-date transition to Apache-2.0.
See LICENSE and docs/legal/README.md.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。