lattice
Provides bounded repository context and edit-grant MCP tools to coding agents such as Codex, indexing local repositories and enabling fingerprint-checked patch application.
README
Lattice
An open-source context and execution layer for coding agents.
Created and led by Moulwyse.
This repository is the original and canonical home of Lattice.
Early public release: review the limitations and security model before using Lattice on a sensitive repository. The package is intentionally marked private until the release checklist is completed; install it from source rather than from npm.
Lattice indexes a local repository, selects bounded task-relevant context, coordinates an agent run, validates edits against repository fingerprints, and records local execution state. It is designed to reduce unnecessary context movement without hiding what was read, changed, or verified.
Lattice was originally created and developed by Moulwyse.
Install in a few minutes
You need Git and a supported
Node.js version (20.19+ or 22.12+). You
do not need an API key to install Lattice or run its local demo.
Windows (PowerShell)
Copy and run these commands:
git clone https://github.com/moulwyse/lattice.git
Set-Location lattice
npm ci
npm run build
npm link
lattice --version
lattice benchmark --worker mock
The final command is a credential-free self-test. A successful installation ends with a passed benchmark and creates no model charges.
To connect Lattice to an already installed and authenticated Codex environment:
codex login status
lattice integration codex doctor --workspace .
lattice integration codex enable
lattice integration codex status --workspace .
The Windows integration registers the Lattice MCP server and installs its Lattice-owned launcher and synchronization hooks. Restart Codex after enabling it. Lattice never asks you to paste a Codex API key into its configuration.
macOS or Linux
Install and run the same local self-test:
git clone https://github.com/moulwyse/lattice.git
cd lattice
npm ci
npm run build
npm link
lattice --version
lattice benchmark --worker mock
Then register the read-only MCP bridge with Codex manually:
codex login status
codex mcp add lattice -- node "$(pwd)/dist/cli.js" mcp-server
codex mcp list
The full automatic launcher and hook lifecycle is currently Windows-only. macOS and Linux receive the three bounded repository-context MCP tools through the manual registration above. Native runtime verification on those systems is still welcome; see platform support.
If npm link is unavailable or requires global permissions, skip it and run
the CLI from the cloned directory as node dist/cli.js <command>.
Use it on a repository
Open a terminal in the repository you want to work on and run:
lattice doctor --workspace .
Resolve any reported error, then open that repository in Codex. On Windows, the enabled integration keeps the Codex model and reasoning selection in sync and exposes Lattice automatically. On macOS and Linux, Codex can use the manually registered Lattice MCP tools.
Undo the integration
Windows:
lattice integration codex disable
npm unlink --global lattice-v2
macOS or Linux:
codex mcp remove lattice
npm unlink --global lattice-v2
The disable command removes only integration state that Lattice recognizes as its own. Full installation, troubleshooting, and safety notes are in the installation guide.
What is included
| Capability | Status | Notes |
|---|---|---|
| Local repository discovery and index | Available | Respects repository boundaries and ignore rules. |
| Bounded context pages and edit grants | Available | Local deterministic controls; covered by tests. |
| Fingerprint-checked patch application | Available | Rejects stale or out-of-scope edits. |
| Mock worker and deterministic fixture benchmark | Available | Runs without a model account or API credential. |
| Manual handoff workflow | Available | The operator transfers a bounded request and response. |
| Direct Codex SDK worker | Beta | Requires a separately installed/authenticated Codex environment; not live-tested during this export. |
| Transparent Codex launcher, hooks, sidecar, and MCP bridge | Experimental | Alters user-level integration state when explicitly enabled; inspect before use. |
| Adaptive model selection and verified-patch cache | Experimental | Opt-in; exact behavior and limits are documented. |
| Claude Code, Gemini, Cursor, Grok, or other providers | Not implemented | No adapter for these providers is included in this repository. |
“Available” describes implemented and locally tested behavior, not a production support guarantee. See provider status for the precise boundary.
Requirements
- Node.js
^20.19.0or>=22.12.0, matching the locked development toolchain; - Git for repository and worktree features;
- Windows, macOS, or Linux with a filesystem accessible to Node.js;
- Codex authentication only when using the Codex worker.
The final local release audit ran on Windows. GitHub Actions now builds and tests the public repository on Ubuntu, Windows, and macOS with Node.js 20 and 22. Dependency resolution was also checked for Linux x64 and Darwin ARM64. Hosted CI is valuable compatibility evidence, but it is not the same as a full interactive Codex integration test on every platform.
Core commands
lattice
lattice run "<task>" --worker mock
lattice run "<task>" --worker manual
lattice run "<task>" --worker codex
lattice continue <task-id>
lattice handoff validate <task-id>
lattice session new|show|reset
lattice doctor
lattice benchmark --worker mock
lattice integration codex status|doctor|enable|disable
lattice sidecar status|stop
lattice --version
lattice --about
Use lattice <command> --help for command-specific options. A direct Codex run
can inherit the active Codex model settings, or accept explicit
--model, --reasoning-effort, and --model-policy options. Model identifiers
are passed to the provider; availability depends on the installed provider and
account.
Configuration
Configuration is repository-local in lattice.config.json. Start from
examples/lattice.config.example.json:
{
"model": "inherit",
"reasoningEffort": "inherit",
"modelPolicy": "inherit"
}
Do not commit credentials or provider session state. Lattice does not require
an API key field in this file. Configuration precedence and experimental
adaptive behavior are documented in
docs/configuration.md.
How it works
- Lattice discovers a safe repository root and builds a local structural index.
- A task compiler converts the goal into acceptance criteria and context needs.
- The context kernel returns bounded pages instead of an unrestricted repository dump.
- An agent or manual operator proposes edits against explicit edit grants.
- Lattice checks fingerprints, applies the transaction in an isolated Git worktree when available, and runs allowlisted verification commands.
- State and diagnostics are written beneath the repository-local
.lattice/directory, which must remain ignored and private.
See architecture, protocol, and persistence schemas.
Tests and quality checks
npm test
npm run lint
npm run format:check
npm run scan:public
npm run package:check
npm test builds the project before running the Vitest suite. The public-export
scanner reports suspicious artifacts and exits non-zero; it never deletes
files. The scanner is defense in depth, not proof that a repository is safe.
Security and privacy
Lattice reads source code in the repository you point it at. Context sent to a
remote model is subject to that provider's terms, account settings, and
retention policy. Local metadata can contain source excerpts, diffs, goals, and
diagnostics. Treat .lattice/ as sensitive, keep it out of version control,
and remove it before sharing a repository copy.
The optional transparent Codex integration can create Lattice-owned launch
shims, an MCP registration, and Codex hooks in user-level configuration. It is
never enabled by installation. Run lattice integration codex doctor, review
the reported paths, and keep a configuration backup before enabling it. The
disable command removes only state that Lattice recognizes as its own.
Automatic persistent-PATH setup through lattice integration codex enable is
currently Windows-only. On macOS and Linux, the core CLI and manual stdio MCP
registration remain available, but the transparent launcher/hook lifecycle is
not claimed as implemented. See installation and
provider status.
Read SECURITY.md and
docs/security.md before real use.
Limitations
- This is an early public release, not a hosted service or security boundary.
- A smaller context is not automatically a correct context.
- Verification is only as strong as the repository's tests and the configured command allowlist.
- Token and latency savings vary by task, repository, model, cache state, and provider accounting.
- Local integration tests do not substitute for a live provider evaluation.
- The included reset-token benchmark is a deterministic functional fixture, not independent evidence of general model quality or cost reduction.
The complete list is in docs/limitations.md.
Evaluation
Performance claims should come from paired, isolated runs with provider-reported
usage, evaluator-owned tasks, disclosed failures, and a predeclared acceptance
rule. The proposed protocol is documented in
docs/evaluation.md.
A separate evidence repository is intended at moulwyse/lattice-evaluation, but it is not yet public and should be treated as unavailable. This source export contains no raw model transcripts, raw telemetry, private configurations, or unreviewed recordings.
Contributing
Read CONTRIBUTING.md and the Code of Conduct. Bug reports and pull requests must not contain secrets, personal paths, private source, model transcripts, or provider session data.
Support
See SUPPORT.md. Security vulnerabilities belong in the private reporting path described by SECURITY.md, not in public issues.
Lattice is independently built and maintained. To support its development, discuss sponsorship, or help with access to testing infrastructure, contact ptech1500@gmail.com.
You can also support the project through Patreon. Patreon support helps cover cross-platform testing, CI, reproducible benchmarks, and model access.
Please do not send credentials, API keys, or private source code by email.
License and authorship
Licensed under the Apache License 2.0. Attribution and provenance are recorded in NOTICE, AUTHORS.md, and CITATION.cff. Project-name guidance for forks is in TRADEMARKS.md.
Lattice was originally created and developed by Moulwyse.
- Original author: https://github.com/moulwyse
- Canonical repository: https://github.com/moulwyse/lattice
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。