speclaw
Local MCP server that gives AI agents a project constitution (LAWS.md), a code graph (Compass), and a spec-driven workflow — all 100% local with no LLM or cloud.
README
<div align="center">
<img src="brand/speclaw-banner.svg" width="820" alt="speclaw — where specs become law">
<br/>
<a href="https://www.npmjs.com/package/@esneiderbravo/speclaw"><img src="https://img.shields.io/npm/v/@esneiderbravo/speclaw?color=0E8E8E&labelColor=0B0F10&style=flat-square&label=npm" alt="npm"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-0E8E8E?labelColor=0B0F10&style=flat-square" alt="MIT"></a> <img src="https://img.shields.io/badge/node-%E2%89%A522-0E8E8E?labelColor=0B0F10&style=flat-square" alt="Node >= 22">
<br/><br/>
<p align="center"> <b>AI agents are brilliant and blind</b> — brilliant at writing code, blind to <i>your</i> project's rules. <b>speclaw</b> hands them what they're missing: the codebase's <b>written laws</b> (a constitution built from your real code), a <b>local map</b> to navigate it without burning tokens, and a <b>disciplined workflow</b> for every change. <br/> One command. No cloud, no LLM, no API keys — <b>everything runs on your machine.</b> </p>
<img src="https://img.shields.io/badge/100%25_local-0E8E8E?labelColor=0B0F10&style=flat-square" alt="100% local"> <img src="https://img.shields.io/badge/no_LLM_·no_cloud-0E8E8E?labelColor=0B0F10&style=flat-square" alt="no LLM"> <img src="https://img.shields.io/badge/CLI+_MCP-0E8E8E?labelColor=0B0F10&style=flat-square" alt="CLI + MCP"> <img src="https://img.shields.io/badge/any_agent-0E8E8E?labelColor=0B0F10&style=flat-square" alt="any agent">
</div>
<br/>
[!TIP] One command sets everything up. Run
npx @esneiderbravo/speclaw init, pick the agents you use, and speclaw scaffolds the project, indexes your code, and hands your agent a ready-to-paste prompt to finish the setup.
<br/>
◆ Quick start
<p align="center"> <img src="brand/terminal-quickstart.svg" width="800" alt="npx @esneiderbravo/speclaw init"> </p>
<p align="center">Copy & run in your project root: <code>npx @esneiderbravo/speclaw init</code></p>
init will:
- Ask which agents you use (Claude Code, Cursor, Codex, …) — and configure only those. Add more later; nothing is forced on you.
- Write the foundation (constitution + standards) and the spec workflow.
- Index your code with a live progress bar and a summary of what it found.
- Register the speclaw MCP server in each chosen agent's config.
- Print a prompt to paste into your agent so it fills the constitution with your project's real architecture and conventions.
Works with npm, pnpm (pnpm dlx @esneiderbravo/speclaw init), and yarn.
<br/>
◆ It looks like this
<p align="center"> <img src="brand/terminal-init.svg" width="800" alt="speclaw init — terminal output"> </p>
<p align="center"><i>Teal steps, green checks, a live progress bar — themed with the speclaw palette.</i></p>
<br/>
◆ The suite — four modules
| Module | What it does |
|---|---|
| Foundation | The project's constitution: LAWS.md binding a set of granular standards under docs/standards/ (base, architecture, backend, frontend, testing, documentation, conventions, spec-workflow), plus strict CLAUDE.md / AGENTS.md agent contracts — filled from your real codebase. |
| Compass | speclaw's own local code graph. Parses your code (tree-sitter) into nodes + edges plus a local vector store, so an agent finds and understands code with a fraction of the tokens a grep/read loop would cost. No LLM, 100% local, lives in .speclaw/ (gitignored). |
| Spec | speclaw's own spec-driven workflow: draft → build → sync → archive (and explore), backed by spec_* engine tools. No external CLI. |
| Tools | Opt-in packs of skills and subagents (currently the dev-agents) that agents use for specific tasks. |
Compass is inspired by CodeGraph and the Spec module by OpenSpec — both MIT. speclaw reimplements the ideas as its own code and gives full credit; see ATTRIBUTION.md.
<br/>
◆ Two ways to use it
speclaw meets you where you are. Everything works through the CLI — so no one is blocked by MCP setup — and the same capabilities are exposed as MCP tools for a smoother, integrated experience once configured. An agent without MCP can still use Compass and the spec engine by calling the CLI from its shell.
<p align="center"><b>CLI</b> — the installer & operator, runs anywhere <code>node</code> does</p> <p align="center"><img src="brand/terminal-cli.svg" width="800" alt="speclaw CLI commands"></p>
<p align="center"><b>MCP</b> — the integrated agent surface, auto-registered by <code>init</code></p> <p align="center"><img src="brand/terminal-mcp.svg" width="800" alt="speclaw MCP tools"></p>
<br/>
◆ What lands in your project
<p align="center"> <img src="brand/terminal-tree.svg" width="800" alt="what speclaw writes into your project"> </p>
<br/>
◆ Philosophy — why "laws"?
[!NOTE] A guideline is a suggestion. A law is enforced. The most common failure mode of AI coding agents isn't lack of capability — it's working without the project's tacit knowledge: the rules the team actually lives by. speclaw makes that knowledge explicit, executable, and binding, and gives agents a local map (Compass) and a disciplined workflow (Spec) to act on it — without burning tokens.
<br/>
◆ Requirements
- Node.js ≥ 22 — uses the built-in
node:sqlite. - No native builds, no services, no API keys, no LLM download. Tree-sitter parsers ship as WASM; the vector store is local.
<br/>
<div align="center">
MIT · built on ideas from OpenSpec & CodeGraph · see ATTRIBUTION.md
<i>speclaw · where specs become law</i>
</div>
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。