Stop Claude Code, Cursor, Codex, Windsurf, and other AI coding tools from crossing project constraints you already wrote in CLAUDE.md, AGENTS.md, and .cursorrules.
Install Β· See a block Β· Claude Code plugin Β· Website Β· Saves Wall
> **Why another rules tool?** Rules files are context. They can be forgotten, diluted, or overridden during a long coding session. SpecLock turns those rules into checks that run before edits, shell commands, and commits. ## See the difference ```text CLAUDE.md: Never modify the authentication system. You: Add social login to the login page. Without SpecLock Claude: I'll update the auth flow and add an OAuth provider... With SpecLock (strict mode) SpecLock: BLOCKED β conflicts with "Never modify the authentication system" Match: login β auth β authentication The action was denied before the files changed. ``` SpecLock uses semantic conflict detection rather than simple keyword matching. It catches indirect actions such as βclean up old patient data,β βstreamline checkout,β or βtemporarily disable MFAβ when they violate an active constraint. ## 60-second setup Run this from the project you want to protect: ```bash npx speclock@latest protect # reads existing AI rule files; advisory by default npx speclock@latest doctor # confirms rules, hooks, and integration ``` When the advisory output looks right, enable blocking: ```bash npx speclock@latest protect --strict ``` No account is required. SpecLock runs locally by default, and advisory mode never blocks a change. ## Install as a Claude Code plugin Inside Claude Code, run: ```text /plugin marketplace add sgroy10/speclock /plugin install speclock@speclock-marketplace ``` Then protect the current project once: ```bash npx speclock@latest protect # warnings only npx speclock@latest protect --strict # block confirmed conflicts ``` The plugin automatically starts SpecLock's MCP server and checks Claude Code `Write`, `Edit`, and `Bash` actions before execution. It includes all 51 MCP tools and works alongside your existing `CLAUDE.md`. ## Install on other coding agents SpecLock is packaged for multiple agent ecosystems, but the enforcement level depends on what each host exposes: | Platform | Install/discovery path | Protection level | |---|---|---| | Claude Code | Native marketplace plugin above | Native pre-action checks for `Write`, `Edit`, and `Bash` | | Gemini CLI | Install this repository as a Gemini extension | MCP-assisted checks plus project context | | Cursor | Agent Plugin / Cursor marketplace package | MCP-assisted checks plus rules | | Codex | Repository Codex plugin in `plugins/speclock` | MCP-assisted checks plus `$speclock-guardrails` skill | | GitHub Copilot CLI | Add this repository as a plugin marketplace | MCP-assisted checks plus bundled plugin context | | Cline | MCP server; curated marketplace submission in progress | MCP-assisted checks | | Windsurf | `speclock mcp install windsurf` | MCP-assisted checks plus rules | | Any Git client or CI | `speclock protect` | Commit/CI enforcement independent of the coding agent | MCP-assisted means the agent can call SpecLock before acting; it does not guarantee interception. Use `speclock protect --strict` and CI when a constraint must be enforced regardless of the client. SpecLock has a different job from memory and skills: **memory recalls context, skills provide procedures, and SpecLock verifies planned actions against explicit constraints.** It reduces constraint drift; it cannot guarantee factual correctness or make a model hallucination-free. Repository installs supported by current clients: ```bash gemini extensions install https://github.com/sgroy10/speclock copilot plugin marketplace add sgroy10/speclock copilot plugin install speclock@speclock-marketplace ``` ## What you get | Capability | What it does | |---|---| | Pre-action checks | Reviews Claude Code writes, edits, and shell commands before they run | | Semantic constraints | Detects synonyms, euphemisms, compound requests, and indirect violations | | Git enforcement | Adds a second guard at commit time | | Advisory and strict modes | Start with warnings; opt in to hard blocking when ready | | Audit trail | Records decisions in a tamper-evident HMAC chain | | MCP integration | Exposes 51 tools to Claude Code, Cursor, Codex, Windsurf, and Cline | | Shareable save receipts | Shows what SpecLock prevented with `speclock wins` | ## Proven in the open - **10,000+ npm downloads** before the native Claude Code plugin release. - **1,043 automated tests across 24 suites**, including adversarial conflicts, false-positive cases, patch analysis, enforcement, auth, and compliance. - **MIT licensed** and inspectable end to end. - **Local-first defaults** with optional remote features clearly separated. ## Commands you will use most ```bash speclock protect # extract constraints and install project protection speclock protect --strict # enable hard enforcement speclock doctor # verify the complete setup speclock check "action description" # preview whether an action conflicts speclock add-lock "rule" # add a constraint explicitly speclock list-locks # inspect active constraints speclock enforce hard|advisory # switch enforcement mode speclock mcp install
Smithery Β·
Badge gallery Β·
Sandeep Roy
| Category | Detection | Example |
| Direct violations | 100% | "Delete the auth module" vs lock "Never modify auth" |
| Euphemistic attacks | 100% | "Clean up old patient data" = deletion |
| Temporal evasion | 100% | "Temporarily disable MFA" = disable MFA |
| Dilution attacks | 100% | Violation buried in multi-part request |
| Compound sentences | 100% | "Update UI and also drop users table" |
| Synonym substitution | 100% | "Sunset the API" = remove the API |
| Payment brand names (11 gateways) | 100% | "Add Razorpay" / "Implement PayU" vs "Must use Stripe" |
| Salary/payroll cross-vocab | 100% | "Optimize salary" vs "Payroll records locked" |
| Safety system bypass | 100% | "Disable safety interlock" = bypass safety |
| Unknown domains (via Gemini) | 100% | Gaming, biotech, aerospace, music, legal |
| Safe actions (true negatives) | 0% FP | "Change the font" correctly passes auth locks |
SpecLock v5.8.0 β Cross-platform action guardrails with native Claude Code enforcement, MCP integrations, 1,043 core tests, and 51 MCP tools. Developed by Sandeep Roy.