MCP Hub
Back to servers

speclock

Validation Failed

AI continuity engine — MCP server + CLI that kills AI amnesia. Maintains project memory, enforces constraints, and detects drift across AI coding sessions.

Stars
3
Updated
Feb 26, 2026
Validated
Feb 28, 2026

Validation Error:

Timeout after 45s

Quick Install

npx -y speclock

SpecLock

AI Constraint Engine — Memory + enforcement for AI coding tools. The only solution that makes your AI respect boundaries, not just remember things.

Developed by Sandeep Roy (github.com/sgroy10)

Website: sgroy10.github.io/speclock | npm: npmjs.com/package/speclock | Smithery: smithery.ai/servers/sgroy10/speclock

npm version License: MIT MCP Compatible Node.js


The Problem

AI tools now have memory. Claude Code has auto-memory. Cursor has Memory Bank. Mem0 exists.

But memory without enforcement is dangerous.

  • 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
  • Your AI remembers your constraints — then ignores them when they're inconvenient
  • You said "never touch auth files" 3 sessions ago — the AI doesn't care

Remembering is not the same as respecting. AI tools need guardrails, not just memory.

The Solution

SpecLock adds active constraint enforcement on top of persistent memory. When your AI tries to break something you locked, SpecLock stops it before the damage is done.

You:    "Don't ever touch the auth files"
AI:     🔒 Locked: "Never modify auth files"

... 5 sessions later ...

You:    "Add social login to the login page"
AI:     ⚠️ CONFLICT: This violates your lock "Never modify auth files"
        Should I proceed or find another approach?

No other tool does this. Not Claude's native memory. Not Mem0. Not CLAUDE.md files.

How SpecLock Is Different

FeatureClaude Native MemoryMem0CLAUDE.md / .cursorrulesSpecLock
Remembers contextYesYesManualYes
Stops the AI from breaking thingsNoNoNoYes — active enforcement
Semantic conflict detectionNoNoNoYes — synonym + negation analysis
Works on Bolt.newNoNoNoYes — npm file-based mode
Works on LovableNoNoNoYes — MCP remote
Structured decisions/locksNoTags onlyFlat textGoals, locks, decisions, changes
Git-aware (checkpoints, rollback)NoNoNoYes
Drift detectionNoNoNoYes — scans changes against locks
Multi-agent timelineNoNoNoYes
Cross-platformClaude onlyMCP onlyTool-specificUniversal (MCP + npm)

Other tools remember. SpecLock enforces.

Quick Start

Bolt.new / Aider / Any npm Platform (No MCP Needed)

Just tell the AI:

"Install speclock and set up project memory"

Or run it yourself:

npx speclock setup --goal "Build my app"

That's it. The AI reads SPECLOCK.md, follows the rules, and uses CLI commands. Tested on Bolt.new — the AI ran 17 commands automatically on first install, setting up goals, locks, and decisions without any configuration.

Lovable (MCP Remote — No Install)

  1. Go to Settings → Connectors → Personal connectors → New MCP server
  2. Enter URL: https://speclock-mcp-production.up.railway.app/mcp — No auth
  3. Paste Project Instructions into Knowledge

Claude Code (MCP Local)

Add to .claude/settings.json or .mcp.json:

{
  "mcpServers": {
    "speclock": {
      "command": "npx",
      "args": ["-y", "speclock", "serve", "--project", "."]
    }
  }
}

Cursor / Windsurf / Cline

Same MCP config as Claude Code. Add to .cursor/mcp.json or equivalent.

Project Instructions

For MCP platforms, paste these rules into your platform's instruction settings (Lovable Knowledge, .cursorrules, CLAUDE.md, etc.):

## SpecLock Rules (MANDATORY — follow on every message)

1. START: Call speclock_session_briefing FIRST. Show: "🔒 Memory loaded — X locks, Y decisions."
2. BEFORE CHANGES: Call speclock_check_conflict. If HIGH conflict, STOP and warn.
3. LOCK: When user says "never/always/don't touch" → call speclock_add_lock immediately.
4. AFTER FEATURES: Call speclock_log_change with summary + files affected.
5. UNLOCK: When user wants to change something locked → warn first, only proceed on confirm.
6. END: Call speclock_session_summary with what was accomplished.

See SPECLOCK-INSTRUCTIONS.md for platform-specific versions.

What It Looks Like In Practice

Bolt.new — Session 1 (Setup)

User: "Install speclock and set up memory for my SaaS"

Bolt: ✓ Ran npx speclock setup
      ✓ Set goal: "Build B2B SaaS API"
      ✓ Added 6 locks (auth, security, rate limiting...)
      ✓ Recorded 7 decisions (Supabase, Stripe, Gemini...)
      ✓ Context file generated — project memory active

Bolt.new — Session 2 (Full Memory)

User: "Create a plan for the API endpoints"

Bolt: ✓ Read project context (6 locks, 7 decisions)
      ✓ Created 10-phase plan respecting ALL constraints
      ✓ All plans use Supabase (locked), Bearer auth (locked)
      ✓ Logged planning phase back to SpecLock

Any Platform — Constraint Enforcement

You:    "Add social login to the login page"
AI:     ⚠️ CONFLICT (HIGH — 100%): Violates lock "Never modify auth files"
        Reasons:
        - Direct keyword match: auth
        - Synonym match: security, authentication
        - Lock prohibits this action (negation detected)

        Should I proceed or find another approach?

Killer Feature: Semantic Conflict Detection

Not just keyword matching. SpecLock uses synonym expansion (15 groups), negation detection, and destructive action flagging:

Lock:   "No breaking changes to public API"
Action: "Remove the external endpoints"

Result: [HIGH] Conflict detected (confidence: 85%)
  - synonym match: remove/delete, external/public, endpoints/api
  - lock prohibits this action (negation detected)
  - destructive action against locked constraint

Three Integration Modes

ModePlatformsHow It Works
MCP RemoteLovable, bolt.diy, Base44Connect via URL — no install needed
MCP LocalClaude Code, Cursor, Windsurf, Clinenpx speclock serve — 19 tools via MCP
npm File-BasedBolt.new, Aider, Rocket.newnpx speclock setup — AI reads SPECLOCK.md + uses CLI

19 MCP Tools

Memory Management

ToolPurpose
speclock_initInitialize SpecLock in project
speclock_get_contextTHE KEY TOOL — full context pack
speclock_set_goalSet/update project goal
speclock_add_lockAdd non-negotiable constraint
speclock_remove_lockDeactivate a lock by ID
speclock_add_decisionRecord an architectural decision
speclock_add_noteAdd a pinned note
speclock_set_deploy_factsRecord deploy configuration

Change Tracking

ToolPurpose
speclock_log_changeLog a significant change
speclock_get_changesGet recent tracked changes
speclock_get_eventsGet event log (filterable)

Enforcement & Protection

ToolPurpose
speclock_check_conflictCheck action against locks (semantic matching)
speclock_session_briefingStart session + full briefing
speclock_session_summaryEnd session + record summary

Git Integration

ToolPurpose
speclock_checkpointCreate named git tag for rollback
speclock_repo_statusBranch, commit, changed files, diff

Intelligence

ToolPurpose
speclock_suggest_locksAI-powered lock suggestions from patterns
speclock_detect_driftScan changes for constraint violations
speclock_healthHealth score + multi-agent timeline

CLI Commands

# Setup
speclock setup --goal "Build my app"   # One-shot: init + rules + context

# Memory
speclock goal <text>                   # Set project goal
speclock lock <text> [--tags a,b]      # Add a constraint
speclock lock remove <id>              # Remove a lock
speclock decide <text>                 # Record a decision
speclock note <text>                   # Add a note

# Tracking
speclock log-change <text> --files x   # Log a change
speclock context                       # Regenerate context file

# Enforcement
speclock check <text>                  # Check for lock conflicts

# Other
speclock status                        # Show brain summary
speclock serve [--project <path>]      # Start MCP server
speclock watch                         # Start file watcher

Architecture

┌─────────────────────────────────────────────────────┐
│       AI Tool (Bolt.new, Lovable, Claude Code)       │
└──────────────┬──────────────────┬────────────────────┘
               │                  │
     MCP Protocol          File-Based (npm)
    (19 tool calls)      (reads SPECLOCK.md +
                        .speclock/context/latest.md,
                         runs CLI commands)
               │                  │
┌──────────────▼──────────────────▼────────────────────┐
│              SpecLock Core Engine                      │
│   Memory | Tracking | Enforcement | Git | Intelligence│
└──────────────────────┬───────────────────────────────┘
                       │
                .speclock/
                ├── brain.json         (structured memory)
                ├── events.log         (immutable audit trail)
                ├── patches/           (git diffs per event)
                └── context/
                    └── latest.md      (human-readable context)

Contributing

Contributions welcome! Please open an issue or PR on GitHub.

License

MIT License - see LICENSE file.

Author

Developed by Sandeep Roy


SpecLock v1.3.1 — Because remembering isn't enough. AI needs to respect boundaries.

Reviews

No reviews yet

Sign in to write a review