
Speclock
io.github.sgroy10由 GitHub 帳號 sgroy10 發布v5.5.3更新於 Oct 24, 2026
AI Constraint Engine — enforces CLAUDE.md and .cursorrules as laws. 51 MCP tools.
概覽
SpecLock 把 CLAUDE.md、AGENTS.md 和 .cursorrules 中的專案規則變成約束,在 AI 編輯、執行指令和提交前先進行檢查。
- 可以做什麼
- SpecLock 會讀取既有的 AI 規則檔案並轉成鎖定項目,在動作執行前先做檢查。它的 MCP 伺服器提供 51 個工具,涵蓋約束管理、語意衝突檢查、執行模式、工作階段追蹤、稽核驗證、合規匯出、原則規則、型別化約束、修補審查和程式碼圖分析。它也提供命令列工具,用於初始化、提交前掛鉤、漂移評分,以及把規則同步到其他編碼工具。
- 適用情境
- 當助理要修改的程式庫中有某些檔案、系統或資料不能被碰觸,而你希望這些約束被實際檢查、而不只是被記住時,就值得加入。建議模式可以低風險地查看哪些動作會被標記;嚴格模式則用於必須阻擋的動作。
- 執行需求
- 以 npm 套件形式在本機透過 stdio 執行(npx speclock),不需要帳號。選用環境變數包括 SPECLOCK_API_KEY、SPECLOCK_ENCRYPTION_KEY、SPECLOCK_LLM_KEY、GEMINI_API_KEY 和 SPECLOCK_TELEMETRY。部分宿主也提供遠端 HTTP 端點。執行強度取決於宿主客戶端提供的掛鉤。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Speclock,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Rules files tell AI what not to change.
SpecLock enforces them.
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.
[npm version] [npm downloads] [CI] [MIT License] [MCP 51 tools]
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
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:
When the advisory output looks right, enable blocking:
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:
Then protect the current project once:
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:
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:
What you get
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
Full reference: npx speclock@latest help
New in v5.8.0
- Portable Agent Plugin packaging for Cursor-compatible discovery.
- Gemini CLI extension packaging with MCP startup and constraint context.
- Codex plugin with a
$speclock-guardrailsskill and pinned MCP server. - GitHub Copilot CLI compatibility through the repository marketplace.
- Explicit per-platform enforcement labels: native hook, MCP-assisted, or Git/CI.
More links and project badges
[Blocked by SpecLock] Smithery · Badge gallery · Sandeep Roy
The Problem
AI coding tools have memory now. Claude Code has CLAUDE.md. Cursor has .cursorrules. Mem0 exists.
But memory without enforcement is useless.
Your AI remembers you use PostgreSQL — then switches to MongoDB because it "seemed better." Your AI remembers your auth setup — then rewrites it while "fixing" a bug. You said "never touch the payment logic" 3 sessions ago — the AI doesn't care.
Remembering is not respecting. No existing tool stops the AI from breaking what you locked.
How It Works
You set constraints. SpecLock enforces them — across sessions, across tools, across teams.
The semantic engine doesn't do keyword matching. It understands:
- "clean up old data" = deletion (euphemism detection)
- "streamline checkout" = modify payment flow (synonym + concept mapping)
- "temporarily disable logging" = disable logging (temporal evasion detection)
- "Update UI and also drop the users table" = hidden violation (compound splitter)
And it knows what's safe:
- "Enable audit logging" when the lock says "Never disable audit logging" → no conflict (intent alignment)
Quick Start by Platform
Bolt.new / Aider / Any npm Platform
Creates SPECLOCK.md, injects rules into package.json, generates .speclock/context/latest.md. The AI reads these automatically.
Claude Code
Install the plugin using the commands above. For MCP-only setup without the
plugin hooks, add this to .mcp.json:
Cursor / Windsurf / Cline
Same config — add to .cursor/mcp.json or equivalent.
Lovable (No Install)
- Go to Settings → Connectors → New MCP server
- Enter URL:
https://speclock-mcp-production.up.railway.app/mcp - Paste project instructions into Knowledge
Why SpecLock Over Alternatives?
Other tools remember. SpecLock enforces.
Semantic Engine
Not keyword matching — semantic analysis with an optional Gemini Flash hybrid for grey-zone and cross-domain cases. The repository includes adversarial, false-positive, question-framing, patch-gateway, and diff-analysis test suites.
Under the hood: 65+ synonym groups · 80+ euphemism mappings · domain concept maps (fintech, e-commerce, IoT, healthcare, SaaS, payments, gaming, telecom, government) · intent classifier · compound sentence splitter · temporal evasion detector · verb tense normalization · UI cosmetic detection · safe-intent patterns · passive voice parsing — all in pure JavaScript. Gemini Flash hybrid for grey-zone cases ($0.01/1000 checks).
Hard Enforcement
Two modes:
- Configurable threshold — default 70%. Only HIGH confidence conflicts block.
- Override with reason —
speclock override <lockId> "JIRA-1234: approved by CTO"(logged to audit trail) - Auto-escalation — lock overridden 3+ times → auto-flags for review
Enterprise Security
API Key Auth + RBAC
AES-256-GCM Encryption
PBKDF2 key derivation (100K iterations). Authenticated encryption. HIPAA 2026 compliant.
HMAC Audit Chain
Every event gets an HMAC-SHA256 hash chained to the previous event. Modify anything — the chain breaks.
Compliance Exports
Policy-as-Code
Declarative YAML rules for organization-wide enforcement:
Import and export policies between projects. Share constraint templates across your organization.
REST API v2
Real-time constraint checking, patch review, and autonomous systems:
51 MCP Tools
Memory — goal, locks, decisions, notes, deploy facts
Enforcement — conflict detection, hard blocking, overrides
Tracking & Sessions — changes, events, session continuity
Intelligence — suggestions, health, templates, reports
Enterprise — audit, compliance, policy, telemetry
Typed Constraints — numerical, range, state, temporal (v5.0)
Spec Compiler & Code Graph — NL→constraints, dependency analysis (v5.0)
Patch Gateway & AI Patch Firewall — change review, diff analysis (v5.1/v5.2)
Universal Rules Sync & Incident Replay — cross-tool sync, session replay (v5.3)
CLI
Full command reference: npx speclock help
Auto-Guard
When you lock something, SpecLock finds related files and injects a warning the AI sees when it opens them:
The AI opens the file and sees:
Architecture
3 npm dependencies. Zero runtime dependencies for the semantic engine. Pure JavaScript.
Configuration
Tip: The heuristic engine alone scores 95%+ accuracy at ~250ms. The Gemini proxy adds cross-domain coverage but takes ~2s. For fastest response, set
SPECLOCK_NO_PROXY=true.
Test Results
Pre-publish gate runs all 24 suites before every npm publish. If any test fails, publish is blocked.
Reproducible project test gate: all 1,043 repository tests pass on v5.8.0. These are project-maintained automated scenarios, not third-party certification; run them yourself with npm test.
Tested across: fintech, e-commerce, IoT, healthcare, SaaS, gaming, biotech, aerospace, payments, payroll, robotics, autonomous systems, telecom, insurance, government. All 11 Indian payment gateways detected. Zero false positives on UI/cosmetic actions.
Simulated Developer Journeys
John scenario — Indie developer on Bolt.new
8 sessions building an ecommerce app. 5 locks (auth, Firebase, Supabase, shipping, Stripe). Every direct violation caught. Every euphemistic attack caught ("clean up auth", "modernize database", "streamline serverless"). Zero false positives on safe actions (product page, cart, dark mode). 86/86 tests passed.
Sam scenario — Senior engineer building a HIPAA hospital ERP
10 sessions with 8 HIPAA locks. Every violation caught — expose PHI, remove encryption, disable audit, downgrade MFA, bypass FHIR. Euphemistic HIPAA attacks caught ("simplify data flow", "modernize auth"). Full auth + RBAC + encryption + compliance export workflow verified. 124/124 tests passed.
Pricing
Changelog
Prior-version feature tours. The Quick Start and What's New sections above cover v5.7.0–v5.8.0 — this section preserves details on features shipped in v5.0–v5.5.
v5.4 — Drift Score, Lock Coverage, Lock Strengthener
Drift Score. How much has your AI-built project drifted from your original intent? Only SpecLock can answer this — because only SpecLock knows what was intended vs what was done.
Lock Coverage Audit. SpecLock scans your codebase and tells you what's unprotected:
Like a security scanner, but for AI constraint gaps.
Lock Strengthener. Your locks might be too vague. SpecLock grades each one and suggests improvements:
v5.3 — Universal Rules Sync, Incident Replay, Safety Templates
Universal Rules Sync. One command syncs your SpecLock constraints to every AI coding tool:
Define constraints once in SpecLock, sync everywhere. --format cursor for single format, --preview to dry-run, --list to see supported formats.
Incident Replay. Flight recorder for your AI coding sessions:
speclock replay --list lists sessions; --session <id> replays a specific one.
Safety Templates. Pre-built constraint packs:
Safe Defaults prevents the 5 most common AI disasters: database deletion, auth removal, secret exposure, error-handling removal, logging disablement.
v5.2 — AI Patch Firewall
Reviews actual diffs, not just descriptions. Catches things intent review misses:
Signal detection: interface breaks, protected symbol edits in locked zones, dependency drift, schema/migration destructive changes, public API route changes. Hard escalation: auto-BLOCK on destructive schema changes, removed API routes, protected symbol edits. Unified review: merges intent (35%) + diff (65%), takes the stronger verdict.
v5.1 — Patch Gateway
One API call gates every change. Takes a description + file list, returns ALLOW/WARN/BLOCK:
Combines semantic conflict detection + lock-to-file mapping + blast radius + typed constraint awareness into a single risk score (0-100).
v5.0 — Spec Compiler, Code Graph, Typed Constraints, Python SDK & ROS2
Spec Compiler. Paste a PRD, README, or architecture doc — SpecLock extracts all constraints automatically:
Uses Gemini Flash by default ($0.01 per 1000 compilations).
Code Graph. Live dependency graph of your codebase. Parses JS/TS/Python imports.
Lock-to-file mapping auto-maps locks to source files; module detection groups files into logical modules.
Typed Constraints. Real-time value and state checking for autonomous systems, IoT, robotics:
Python SDK & ROS2.
Uses the same .speclock/brain.json as the Node.js MCP server. ROS2 Guardian Node subscribes to /joint_states, /cmd_vel, /speclock/state_transition; publishes violations to /speclock/violations; triggers emergency stop via /speclock/emergency_stop.
Show your support
If SpecLock saves your project from a 3am incident, add this badge to your README:
Or run speclock badge in your terminal to see all variants. Full gallery: sgroy10.github.io/speclock/badge.html · Full docs: BADGES.md.
Every adoption helps another developer discover SpecLock and stop their AI from wrecking their project. Thank you.
Spread the word
Want to help SpecLock reach more developers? Everything you need to post — tweets, LinkedIn drafts, Reddit templates, Show HN copy, Discord messages, one-liners, elevator pitches — is pre-written and fact-checked in VIRAL-KIT.md. Copy, paste, send. Zero effort.
Contributing
Issues and PRs welcome on GitHub.
License
Author
SpecLock is created and maintained by Sandeep Roy.
Sandeep Roy is the sole developer of SpecLock — the AI Constraint Engine that enforces project rules across AI coding sessions. All 51 MCP tools, the semantic conflict detection engine, enterprise security features (SOC 2, HIPAA, RBAC, encryption), and the pre-publish test gate were designed and built by Sandeep Roy.
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.
來源:README.md,提交 f0f0b2c
工具
0版本歷史
1- v5.5.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分