You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Claude Code reads your CLAUDE.md file for project instructions — but it can still drift, forget, or reinterpret those rules across sessions. SpecLock turns those suggestions into enforced constraints that persist.
Step-by-step guide
1. Install SpecLock
npx speclock init
This creates a .speclock/ directory in your project root that stores your constraints, decisions, and session history.
2. Define your rules as locks
When you tell the AI something like:
"Never remove the auth middleware"
"Always use PostgreSQL, not SQLite"
"The API must stay REST, don't switch to GraphQL"
SpecLock captures these as locks — persistent, enforceable constraints.
3. Run protection
npx speclock protect
This scans your codebase and checks whether any recent changes violate your locked constraints. Example output:
🔒 SpecLock Protection Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ 12 constraints checked
⚠️ 1 potential violation found:
Lock: "Never remove auth middleware from API routes"
File: src/routes/api.ts (line 47)
Issue: Auth middleware call removed from /api/users endpoint
Confidence: HIGH
💡 Run speclock_check_conflict before making changes to catch violations early.
4. Integrate with Claude Code MCP
When connected as an MCP server, SpecLock automatically:
Loads your project context at the start of every session (speclock_session_briefing)
Captures new constraints as you state them (speclock_add_lock)
Checks for conflicts before making changes (speclock_check_conflict)
Logs what was done for the next session (speclock_log_change)
Why this matters
CLAUDE.md is a suggestion. SpecLock is enforcement. Your rules persist across sessions, across tools, and across team members.
SpecLock is free and MIT licensed. Install: npx speclock init
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
How to enforce CLAUDE.md rules with SpecLock
Claude Code reads your
CLAUDE.mdfile for project instructions — but it can still drift, forget, or reinterpret those rules across sessions. SpecLock turns those suggestions into enforced constraints that persist.Step-by-step guide
1. Install SpecLock
This creates a
.speclock/directory in your project root that stores your constraints, decisions, and session history.2. Define your rules as locks
When you tell the AI something like:
SpecLock captures these as locks — persistent, enforceable constraints.
3. Run protection
This scans your codebase and checks whether any recent changes violate your locked constraints. Example output:
4. Integrate with Claude Code MCP
When connected as an MCP server, SpecLock automatically:
speclock_session_briefing)speclock_add_lock)speclock_check_conflict)speclock_log_change)Why this matters
CLAUDE.mdis a suggestion. SpecLock is enforcement. Your rules persist across sessions, across tools, and across team members.SpecLock is free and MIT licensed. Install:
npx speclock initBeta Was this translation helpful? Give feedback.
All reactions