speclock 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +151 -190
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # SpecLock
2
2
 
3
- **AI Continuity Engine** — The MCP server that kills AI amnesia.
3
+ **AI Constraint Engine** — Memory + enforcement for AI coding tools. The only solution that makes your AI **respect boundaries**, not just remember things.
4
4
 
5
5
  > Developed by **Sandeep Roy** ([github.com/sgroy10](https://github.com/sgroy10))
6
6
 
7
+ **Website**: [sgroy10.github.io/speclock](https://sgroy10.github.io/speclock/) | **npm**: [npmjs.com/package/speclock](https://www.npmjs.com/package/speclock) | **Smithery**: [smithery.ai/servers/sgroy10/speclock](https://smithery.ai/servers/sgroy10/speclock)
8
+
7
9
  [![npm version](https://img.shields.io/npm/v/speclock.svg)](https://www.npmjs.com/package/speclock)
8
10
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
11
  [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io)
@@ -13,73 +15,78 @@
13
15
 
14
16
  ## The Problem
15
17
 
16
- Every AI coding tool forgets. Every. Single. Session.
18
+ AI tools now have memory. Claude Code has auto-memory. Cursor has Memory Bank. Mem0 exists.
19
+
20
+ **But memory without enforcement is dangerous.**
17
21
 
18
- - Claude Code forgets the decisions you made yesterday
19
- - Cursor forgets the constraints you set last week
20
- - Codex rebuilds what another agent already built
21
- - Your AI agent violates rules it agreed to 3 sessions ago
22
+ - Your AI remembers you use PostgreSQL then switches to MongoDB because it "seemed better"
23
+ - Your AI remembers your auth setup then rewrites it while "fixing" a bug
24
+ - Your AI remembers your constraints then ignores them when they're inconvenient
25
+ - You said "never touch auth files" 3 sessions ago — the AI doesn't care
22
26
 
23
- **AI amnesia is the #1 productivity killer in AI-assisted development.**
27
+ **Remembering is not the same as respecting.** AI tools need guardrails, not just memory.
24
28
 
25
29
  ## The Solution
26
30
 
27
- SpecLock maintains a `.speclock/` directory inside your repo that gives every AI agent perfect memory across sessions, across tools, across time.
31
+ 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**.
28
32
 
29
33
  ```
30
- .speclock/
31
- ├── brain.json # Structured project memory
32
- ├── events.log # Append-only event ledger (JSONL)
33
- ├── patches/ # Git diffs captured per event
34
- └── context/
35
- └── latest.md # Always-fresh context pack for any AI agent
36
- ```
34
+ You: "Don't ever touch the auth files"
35
+ AI: 🔒 Locked: "Never modify auth files"
37
36
 
38
- **SpecLock = MCP Server + Project Instructions.**
37
+ ... 5 sessions later ...
39
38
 
40
- The MCP server gives the AI tools for memory and constraint checking. The project instructions force the AI to use them on every action — automatically. Together, they create an active guardrail that prevents AI coding tools from breaking your work.
39
+ You: "Add social login to the login page"
40
+ AI: ⚠️ CONFLICT: This violates your lock "Never modify auth files"
41
+ Should I proceed or find another approach?
42
+ ```
41
43
 
42
- **No context is ever lost. No constraints ever violated.**
44
+ No other tool does this. Not Claude's native memory. Not Mem0. Not CLAUDE.md files.
43
45
 
44
- ## Why SpecLock Wins
46
+ ## How SpecLock Is Different
45
47
 
46
- | Feature | CLAUDE.md / .cursorrules | Chat History | Memory Plugins | **SpecLock** |
47
- |---------|--------------------------|--------------|----------------|--------------|
48
- | Structured memory | Static files | Noise-heavy | Generic | **Structured brain.json** |
49
- | Constraint enforcement | None | None | None | **Active lock checking** |
50
- | Conflict detection | None | None | None | **Semantic + synonym matching** |
51
- | Drift detection | None | None | None | **Auto-scan against locks** |
52
- | Git-aware | No | No | No | **Checkpoints, diffs, reverts** |
53
- | Multi-agent | No | No | Partial | **Full session timeline** |
54
- | Auto-suggestions | No | No | No | **AI-powered lock suggestions** |
55
- | Cross-tool | Tool-specific | Tool-specific | Tool-specific | **Universal MCP** |
48
+ | Feature | Claude Native Memory | Mem0 | CLAUDE.md / .cursorrules | **SpecLock** |
49
+ |---------|---------------------|------|--------------------------|--------------|
50
+ | Remembers context | Yes | Yes | Manual | **Yes** |
51
+ | **Stops the AI from breaking things** | No | No | No | **Yes active enforcement** |
52
+ | **Semantic conflict detection** | No | No | No | **Yes synonym + negation analysis** |
53
+ | Works on Bolt.new | No | No | No | **Yes — npm file-based mode** |
54
+ | Works on Lovable | No | No | No | **Yes MCP remote** |
55
+ | Structured decisions/locks | No | Tags only | Flat text | **Goals, locks, decisions, changes** |
56
+ | Git-aware (checkpoints, rollback) | No | No | No | **Yes** |
57
+ | Drift detection | No | No | No | **Yes — scans changes against locks** |
58
+ | Multi-agent timeline | No | No | No | **Yes** |
59
+ | Cross-platform | Claude only | MCP only | Tool-specific | **Universal (MCP + npm)** |
56
60
 
57
61
  **Other tools remember. SpecLock enforces.**
58
62
 
59
63
  ## Quick Start
60
64
 
61
- ### 1. Connect SpecLock to Your AI Tool
65
+ ### Bolt.new / Aider / Any npm Platform (No MCP Needed)
62
66
 
63
- **Lovable** (no install needed):
67
+ Just tell the AI:
64
68
 
65
- 1. Go to **Settings → Connectors → Personal connectors → New MCP server**
66
- 2. Enter URL: `https://speclock-mcp-production.up.railway.app/mcp` No auth
67
- 3. Enable it in your project's prompt box
69
+ ```
70
+ "Install speclock and set up project memory"
71
+ ```
68
72
 
69
- **Claude Code** Add to `.claude/settings.json` or `.mcp.json`:
73
+ Or run it yourself:
70
74
 
71
- ```json
72
- {
73
- "mcpServers": {
74
- "speclock": {
75
- "command": "npx",
76
- "args": ["-y", "speclock", "serve", "--project", "."]
77
- }
78
- }
79
- }
75
+ ```bash
76
+ npx speclock setup --goal "Build my app"
80
77
  ```
81
78
 
82
- **Cursor**Add to `.cursor/mcp.json`:
79
+ **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.
80
+
81
+ ### Lovable (MCP Remote — No Install)
82
+
83
+ 1. Go to **Settings → Connectors → Personal connectors → New MCP server**
84
+ 2. Enter URL: `https://speclock-mcp-production.up.railway.app/mcp` — No auth
85
+ 3. Paste [Project Instructions](#project-instructions) into Knowledge
86
+
87
+ ### Claude Code (MCP Local)
88
+
89
+ Add to `.claude/settings.json` or `.mcp.json`:
83
90
 
84
91
  ```json
85
92
  {
@@ -92,83 +99,85 @@ The MCP server gives the AI tools for memory and constraint checking. The projec
92
99
  }
93
100
  ```
94
101
 
95
- **Windsurf / Cline / Any MCP tool** — Same pattern as above.
96
-
97
- ### 2. Add Project Instructions (Required)
102
+ ### Cursor / Windsurf / Cline
98
103
 
99
- > **This is the critical step.** Without project instructions, the AI has the tools but won't use them automatically. With them, SpecLock becomes an active guardrail.
104
+ Same MCP config as Claude Code. Add to `.cursor/mcp.json` or equivalent.
100
105
 
101
- Copy-paste the rules below into your platform's project instruction settings:
106
+ ### Project Instructions
102
107
 
103
- | Platform | Where to paste |
104
- |----------|----------------|
105
- | **Lovable** | Project Settings → Knowledge |
106
- | **Cursor** | `.cursorrules` file in project root |
107
- | **Claude Code** | `CLAUDE.md` file in project root |
108
- | **Windsurf** | `.windsurfrules` file in project root |
109
-
110
- **The rules to paste:**
108
+ For MCP platforms, paste these rules into your platform's instruction settings (Lovable Knowledge, .cursorrules, CLAUDE.md, etc.):
111
109
 
112
110
  ```
113
111
  ## SpecLock Rules (MANDATORY — follow on every message)
114
112
 
115
- 1. START OF EVERY CONVERSATION: Call speclock_session_briefing FIRST. Read all locks, decisions, and goals before doing anything else. Show a brief summary: "🔒 Memory loaded — X locks, Y decisions."
116
-
117
- 2. BEFORE WRITING OR MODIFYING ANY CODE: Call speclock_check_conflict with a description of what you're about to change. If a conflict is found with HIGH confidence, STOP and tell me which lock would be violated. Do NOT proceed unless I explicitly say to override it.
113
+ 1. START: Call speclock_session_briefing FIRST. Show: "🔒 Memory loaded — X locks, Y decisions."
114
+ 2. BEFORE CHANGES: Call speclock_check_conflict. If HIGH conflict, STOP and warn.
115
+ 3. LOCK: When user says "never/always/don't touch" call speclock_add_lock immediately.
116
+ 4. AFTER FEATURES: Call speclock_log_change with summary + files affected.
117
+ 5. UNLOCK: When user wants to change something locked → warn first, only proceed on confirm.
118
+ 6. END: Call speclock_session_summary with what was accomplished.
119
+ ```
118
120
 
119
- 3. WHEN I SAY "lock this", "never touch this", "don't ever change this", "this is critical", or similar: Immediately call speclock_add_lock with my exact constraint. Confirm with: "🔒 Locked: [constraint]"
121
+ See [SPECLOCK-INSTRUCTIONS.md](SPECLOCK-INSTRUCTIONS.md) for platform-specific versions.
120
122
 
121
- 4. AFTER COMPLETING ANY FEATURE OR SIGNIFICANT CHANGE: Call speclock_log_change with a summary of what was built/changed and which files were affected. Also call speclock_add_decision if an architectural choice was made.
123
+ ## What It Looks Like In Practice
122
124
 
123
- 5. WHEN I ASK TO REMOVE OR CHANGE SOMETHING THAT WAS LOCKED: Warn me first: "⚠️ You locked this: [constraint]. Want me to unlock it and proceed?" Only proceed if I confirm.
125
+ ### Bolt.new Session 1 (Setup)
126
+ ```
127
+ User: "Install speclock and set up memory for my SaaS"
124
128
 
125
- 6. END OF CONVERSATION: Call speclock_session_summary with what was accomplished.
129
+ Bolt: Ran npx speclock setup
130
+ ✓ Set goal: "Build B2B SaaS API"
131
+ ✓ Added 6 locks (auth, security, rate limiting...)
132
+ ✓ Recorded 7 decisions (Supabase, Stripe, Gemini...)
133
+ ✓ Context file generated — project memory active
126
134
  ```
127
135
 
128
- See [SPECLOCK-INSTRUCTIONS.md](SPECLOCK-INSTRUCTIONS.md) for platform-specific versions and detailed examples.
136
+ ### Bolt.new Session 2 (Full Memory)
137
+ ```
138
+ User: "Create a plan for the API endpoints"
129
139
 
130
- ### 3. Start Building
140
+ Bolt: Read project context (6 locks, 7 decisions)
141
+ ✓ Created 10-phase plan respecting ALL constraints
142
+ ✓ All plans use Supabase (locked), Bearer auth (locked)
143
+ ✓ Logged planning phase back to SpecLock
144
+ ```
131
145
 
132
- That's it. Now when you chat with your AI tool:
146
+ ### Any Platform Constraint Enforcement
147
+ ```
148
+ You: "Add social login to the login page"
149
+ AI: ⚠️ CONFLICT (HIGH — 100%): Violates lock "Never modify auth files"
150
+ Reasons:
151
+ - Direct keyword match: auth
152
+ - Synonym match: security, authentication
153
+ - Lock prohibits this action (negation detected)
154
+
155
+ Should I proceed or find another approach?
156
+ ```
133
157
 
134
- 1. **Every session starts**: AI auto-loads your project memory — goals, constraints, decisions, history
135
- 2. **During work**: AI auto-captures decisions, logs changes, checks constraints before modifying code
136
- 3. **Constraint protection**: If the AI tries to break something you locked, it stops and warns you
137
- 4. **Every session ends**: AI records what was accomplished
138
- 5. **Next session**: Full continuity — the AI remembers everything from all previous sessions
158
+ ## Killer Feature: Semantic Conflict Detection
139
159
 
140
- ## How It Works In Practice
160
+ Not just keyword matching. SpecLock uses **synonym expansion** (15 groups), **negation detection**, and **destructive action flagging**:
141
161
 
142
- ### You lock something important:
143
- ```
144
- You: "Don't ever touch the auth files"
145
- AI: 🔒 Locked: "Never modify auth files"
146
162
  ```
163
+ Lock: "No breaking changes to public API"
164
+ Action: "Remove the external endpoints"
147
165
 
148
- ### AI checks before every change:
149
- ```
150
- You: "Add social login to the login page"
151
- AI: ⚠️ This conflicts with your lock: "Never modify auth files"
152
- Should I proceed anyway, or find another approach?
166
+ Result: [HIGH] Conflict detected (confidence: 85%)
167
+ - synonym match: remove/delete, external/public, endpoints/api
168
+ - lock prohibits this action (negation detected)
169
+ - destructive action against locked constraint
153
170
  ```
154
171
 
155
- ### New session, full memory:
156
- ```
157
- You: "Let's keep working on the dashboard"
158
- AI: 🔒 Memory loaded — 5 locks, 3 decisions, 2 sessions tracked.
159
- Last session you added the payment page and locked the auth files.
160
- Ready to work on the dashboard.
161
- ```
172
+ ## Three Integration Modes
162
173
 
163
- ### You change your mind:
164
- ```
165
- You: "Actually, unlock the auth files, I need to change them"
166
- AI: You locked: "Never modify auth files". Want me to unlock this?
167
- You: "Yes"
168
- AI: 🔓 Unlocked. Proceeding with auth file changes.
169
- ```
174
+ | Mode | Platforms | How It Works |
175
+ |------|-----------|--------------|
176
+ | **MCP Remote** | Lovable, bolt.diy, Base44 | Connect via URL — no install needed |
177
+ | **MCP Local** | Claude Code, Cursor, Windsurf, Cline | `npx speclock serve` — 19 tools via MCP |
178
+ | **npm File-Based** | Bolt.new, Aider, Rocket.new | `npx speclock setup` — AI reads SPECLOCK.md + uses CLI |
170
179
 
171
- ## MCP Tools (19)
180
+ ## 19 MCP Tools
172
181
 
173
182
  ### Memory Management
174
183
  | Tool | Purpose |
@@ -185,11 +194,11 @@ AI: 🔓 Unlocked. Proceeding with auth file changes.
185
194
  ### Change Tracking
186
195
  | Tool | Purpose |
187
196
  |------|---------|
188
- | `speclock_log_change` | Manually log a significant change |
197
+ | `speclock_log_change` | Log a significant change |
189
198
  | `speclock_get_changes` | Get recent tracked changes |
190
- | `speclock_get_events` | Get event log (filterable by type/time) |
199
+ | `speclock_get_events` | Get event log (filterable) |
191
200
 
192
- ### Continuity Protection
201
+ ### Enforcement & Protection
193
202
  | Tool | Purpose |
194
203
  |------|---------|
195
204
  | `speclock_check_conflict` | Check action against locks (semantic matching) |
@@ -202,110 +211,62 @@ AI: 🔓 Unlocked. Proceeding with auth file changes.
202
211
  | `speclock_checkpoint` | Create named git tag for rollback |
203
212
  | `speclock_repo_status` | Branch, commit, changed files, diff |
204
213
 
205
- ### Intelligence (NEW in v1.1)
214
+ ### Intelligence
206
215
  | Tool | Purpose |
207
216
  |------|---------|
208
217
  | `speclock_suggest_locks` | AI-powered lock suggestions from patterns |
209
218
  | `speclock_detect_drift` | Scan changes for constraint violations |
210
219
  | `speclock_health` | Health score + multi-agent timeline |
211
220
 
212
- ## Killer Features
213
-
214
- ### Semantic Conflict Detection
215
-
216
- Not just keyword matching — SpecLock understands synonyms, negation, and destructive intent:
217
-
218
- ```
219
- Lock: "No breaking changes to public API"
220
-
221
- Action: "remove the external endpoints"
222
- Result: [HIGH] Conflict detected (confidence: 85%)
223
- - synonym match: remove/delete, external/public, endpoints/api
224
- - lock prohibits this action (negation detected)
225
- - destructive action against locked constraint
226
- ```
227
-
228
- ### Auto-Lock Suggestions
229
-
230
- SpecLock analyzes your decisions and notes for commitment language and suggests constraints:
231
-
232
- ```
233
- Decision: "Always use REST for public endpoints"
234
- → Suggestion: Promote to lock (contains "always" — strong commitment language)
235
-
236
- Project mentions "security" but has no security lock
237
- → Suggestion: "No secrets or credentials in source code"
238
- ```
239
-
240
- ### Drift Detection
241
-
242
- Proactively scans recent changes against your locks:
243
-
244
- ```
245
- Lock: "No database schema changes without migration"
246
- Change: "Modified users table schema directly"
247
- → [HIGH] Drift detected — review immediately
248
- ```
249
-
250
- ### Multi-Agent Timeline
251
-
252
- Track which AI tools touched your project and what they did:
253
-
254
- ```
255
- Health Check — Score: 85/100 (Grade: A)
256
-
257
- Multi-Agent Timeline:
258
- - claude-code: 12 sessions, last active 2026-02-24
259
- - cursor: 5 sessions, last active 2026-02-23
260
- - codex: 2 sessions, last active 2026-02-20
261
- ```
262
-
263
221
  ## CLI Commands
264
222
 
265
- ```
266
- speclock init Initialize SpecLock
267
- speclock goal <text> Set project goal
268
- speclock lock <text> [--tags a,b] Add a SpecLock constraint
269
- speclock lock remove <id> Remove a lock
270
- speclock decide <text> Record a decision
271
- speclock note <text> Add a note
272
- speclock facts deploy --provider X Set deploy facts
273
- speclock context Generate and print context pack
274
- speclock watch Start file watcher
275
- speclock serve [--project <path>] Start MCP server
276
- speclock status Show brain summary
277
- ```
223
+ ```bash
224
+ # Setup
225
+ speclock setup --goal "Build my app" # One-shot: init + rules + context
278
226
 
279
- ## Why MCP?
227
+ # Memory
228
+ speclock goal <text> # Set project goal
229
+ speclock lock <text> [--tags a,b] # Add a constraint
230
+ speclock lock remove <id> # Remove a lock
231
+ speclock decide <text> # Record a decision
232
+ speclock note <text> # Add a note
280
233
 
281
- MCP (Model Context Protocol) is the universal integration standard for AI tools. One SpecLock MCP server works with:
234
+ # Tracking
235
+ speclock log-change <text> --files x # Log a change
236
+ speclock context # Regenerate context file
282
237
 
283
- - Claude Code
284
- - Cursor
285
- - Windsurf
286
- - Cline
287
- - Codex
288
- - Any MCP-compatible tool
238
+ # Enforcement
239
+ speclock check <text> # Check for lock conflicts
289
240
 
290
- SpecLock is infrastructure, not a competitor. It makes **every** AI coding tool better.
241
+ # Other
242
+ speclock status # Show brain summary
243
+ speclock serve [--project <path>] # Start MCP server
244
+ speclock watch # Start file watcher
245
+ ```
291
246
 
292
247
  ## Architecture
293
248
 
294
249
  ```
295
- ┌─────────────────────────────────────────────────────────┐
296
- AI Tool (Claude Code, Cursor, etc.)
297
- └────────────────────┬────────────────────────────────────┘
298
- MCP Protocol (stdio)
299
- ┌────────────────────▼────────────────────────────────────┐
300
- │ SpecLock MCP Server (19 tools) │
301
- │ Memory | Tracking | Protection | Git | Intelligence │
302
- └────────────────────┬────────────────────────────────────┘
303
-
304
- .speclock/
305
- ├── brain.json (structured memory)
306
- ├── events.log (immutable audit trail)
307
- ├── patches/ (git diffs per event)
308
- └── context/ (generated context packs)
250
+ ┌─────────────────────────────────────────────────────┐
251
+ AI Tool (Bolt.new, Lovable, Claude Code)
252
+ └──────────────┬──────────────────┬────────────────────┘
253
+
254
+ MCP Protocol File-Based (npm)
255
+ (19 tool calls) (reads SPECLOCK.md +
256
+ .speclock/context/latest.md,
257
+ runs CLI commands)
258
+
259
+ ┌──────────────▼──────────────────▼────────────────────┐
260
+ SpecLock Core Engine │
261
+ │ Memory | Tracking | Enforcement | Git | Intelligence│
262
+ └──────────────────────┬───────────────────────────────┘
263
+
264
+ .speclock/
265
+ ├── brain.json (structured memory)
266
+ ├── events.log (immutable audit trail)
267
+ ├── patches/ (git diffs per event)
268
+ └── context/
269
+ └── latest.md (human-readable context)
309
270
  ```
310
271
 
311
272
  ## Contributing
@@ -326,4 +287,4 @@ MIT License - see [LICENSE](LICENSE) file.
326
287
 
327
288
  ---
328
289
 
329
- *SpecLock — Because no AI session should ever forget.*
290
+ *SpecLock v1.3.1 — Because remembering isn't enough. AI needs to respect boundaries.*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speclock",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "AI continuity engine — MCP server + CLI that kills AI amnesia. Maintains project memory, enforces constraints, and detects drift across AI coding sessions.",
5
5
  "type": "module",
6
6
  "main": "src/mcp/server.js",