speclock 1.1.1 → 1.2.1
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.
- package/README.md +80 -40
- package/package.json +1 -1
- package/src/mcp/http-server.js +35 -4
- package/src/mcp/server.js +34 -3
package/README.md
CHANGED
|
@@ -35,9 +35,11 @@ SpecLock maintains a `.speclock/` directory inside your repo that gives every AI
|
|
|
35
35
|
└── latest.md # Always-fresh context pack for any AI agent
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
**SpecLock = MCP Server + Project Instructions.**
|
|
39
39
|
|
|
40
|
-
|
|
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.
|
|
41
|
+
|
|
42
|
+
**No context is ever lost. No constraints ever violated.**
|
|
41
43
|
|
|
42
44
|
## Why SpecLock Wins
|
|
43
45
|
|
|
@@ -56,31 +58,15 @@ Any AI tool calls `speclock_session_briefing` → gets **full project context**
|
|
|
56
58
|
|
|
57
59
|
## Quick Start
|
|
58
60
|
|
|
59
|
-
### 1.
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
npm install -g speclock
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Or use directly with npx:
|
|
61
|
+
### 1. Connect SpecLock to Your AI Tool
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
npx speclock init
|
|
69
|
-
```
|
|
63
|
+
**Lovable** (no install needed):
|
|
70
64
|
|
|
71
|
-
|
|
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
|
|
72
68
|
|
|
73
|
-
|
|
74
|
-
cd your-project
|
|
75
|
-
speclock init
|
|
76
|
-
speclock goal "Ship v1 of the product"
|
|
77
|
-
speclock lock "No breaking changes to public API"
|
|
78
|
-
speclock decide "Use PostgreSQL for persistence"
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### 3. Connect to Your AI Tool
|
|
82
|
-
|
|
83
|
-
**Claude Code** — Add to `.claude/settings.json`:
|
|
69
|
+
**Claude Code** — Add to `.claude/settings.json` or `.mcp.json`:
|
|
84
70
|
|
|
85
71
|
```json
|
|
86
72
|
{
|
|
@@ -106,27 +92,81 @@ speclock decide "Use PostgreSQL for persistence"
|
|
|
106
92
|
}
|
|
107
93
|
```
|
|
108
94
|
|
|
109
|
-
**Windsurf / Cline / Any MCP tool** — Same pattern
|
|
95
|
+
**Windsurf / Cline / Any MCP tool** — Same pattern as above.
|
|
96
|
+
|
|
97
|
+
### 2. Add Project Instructions (Required)
|
|
98
|
+
|
|
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.
|
|
100
|
+
|
|
101
|
+
Copy-paste the rules below into your platform's project instruction settings:
|
|
102
|
+
|
|
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:**
|
|
110
111
|
|
|
111
|
-
```json
|
|
112
|
-
{
|
|
113
|
-
"mcpServers": {
|
|
114
|
-
"speclock": {
|
|
115
|
-
"command": "npx",
|
|
116
|
-
"args": ["-y", "speclock", "serve", "--project", "."]
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
112
|
```
|
|
113
|
+
## SpecLock Rules (MANDATORY — follow on every message)
|
|
121
114
|
|
|
122
|
-
|
|
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."
|
|
123
116
|
|
|
124
|
-
|
|
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.
|
|
125
118
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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]"
|
|
120
|
+
|
|
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.
|
|
122
|
+
|
|
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.
|
|
124
|
+
|
|
125
|
+
6. END OF CONVERSATION: Call speclock_session_summary with what was accomplished.
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
See [SPECLOCK-INSTRUCTIONS.md](SPECLOCK-INSTRUCTIONS.md) for platform-specific versions and detailed examples.
|
|
129
|
+
|
|
130
|
+
### 3. Start Building
|
|
131
|
+
|
|
132
|
+
That's it. Now when you chat with your AI tool:
|
|
133
|
+
|
|
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
|
|
139
|
+
|
|
140
|
+
## How It Works In Practice
|
|
141
|
+
|
|
142
|
+
### You lock something important:
|
|
143
|
+
```
|
|
144
|
+
You: "Don't ever touch the auth files"
|
|
145
|
+
AI: 🔒 Locked: "Never modify auth files"
|
|
146
|
+
```
|
|
147
|
+
|
|
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?
|
|
153
|
+
```
|
|
154
|
+
|
|
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
|
+
```
|
|
162
|
+
|
|
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
|
+
```
|
|
130
170
|
|
|
131
171
|
## MCP Tools (19)
|
|
132
172
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "speclock",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
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",
|
package/src/mcp/http-server.js
CHANGED
|
@@ -41,15 +41,46 @@ import {
|
|
|
41
41
|
} from "../core/git.js";
|
|
42
42
|
|
|
43
43
|
const PROJECT_ROOT = process.env.SPECLOCK_PROJECT_ROOT || process.cwd();
|
|
44
|
-
const VERSION = "1.
|
|
44
|
+
const VERSION = "1.2.0";
|
|
45
45
|
const AUTHOR = "Sandeep Roy";
|
|
46
46
|
|
|
47
47
|
function createSpecLockServer() {
|
|
48
48
|
const server = new McpServer(
|
|
49
49
|
{ name: "speclock", version: VERSION },
|
|
50
50
|
{
|
|
51
|
-
instructions:
|
|
52
|
-
`
|
|
51
|
+
instructions: [
|
|
52
|
+
`CRITICAL: You have SpecLock connected — an AI Continuity Engine that remembers project context across sessions. You MUST follow these rules:`,
|
|
53
|
+
``,
|
|
54
|
+
`## STEP 1 — FIRST THING IN EVERY CONVERSATION (MANDATORY):`,
|
|
55
|
+
`Before doing ANYTHING else, call speclock_session_briefing. This loads the project's goal, constraints, decisions, and history from previous sessions.`,
|
|
56
|
+
`- If it returns "not initialized", call speclock_init first, then tell the user: "I've set up project memory for this workspace. I'll remember your decisions and constraints across sessions."`,
|
|
57
|
+
`- If it returns context, start your response with a brief one-line status like: "🔒 Project memory loaded — [X] constraints, [Y] decisions tracked from previous sessions." Then proceed to answer the user's actual question.`,
|
|
58
|
+
`- If there is no meaningful context yet (new project), say: "🔒 Project memory active. I'll automatically remember your key decisions and constraints across sessions." Then proceed normally.`,
|
|
59
|
+
``,
|
|
60
|
+
`## STEP 2 — LISTEN AND CAPTURE (do this continuously as you work):`,
|
|
61
|
+
`- When the user describes what they're building → call speclock_set_goal.`,
|
|
62
|
+
`- When the user says something is non-negotiable or uses words like "always", "never", "must", "don't ever change", "make sure to keep", "this is critical" → call speclock_add_lock. Then briefly confirm: "🔒 Locked: [constraint]"`,
|
|
63
|
+
`- When the user makes a technology or design choice → call speclock_add_decision.`,
|
|
64
|
+
`- When you complete significant work → call speclock_log_change.`,
|
|
65
|
+
``,
|
|
66
|
+
`## STEP 3 — PROTECT (before making significant changes):`,
|
|
67
|
+
`- Before removing features, changing architecture, switching technologies, or modifying core logic → call speclock_check_conflict.`,
|
|
68
|
+
`- If a conflict is found (confidence HIGH), STOP and warn: "⚠️ This would conflict with a constraint you set: [constraint]. Should I proceed anyway or keep the current approach?"`,
|
|
69
|
+
`- Do NOT proceed unless the user explicitly confirms.`,
|
|
70
|
+
``,
|
|
71
|
+
`## STEP 4 — REMEMBER (when the user wants to change their mind):`,
|
|
72
|
+
`- If they want to remove or change something they previously locked, remind them: "You previously locked: [constraint]. Want me to unlock this and proceed?"`,
|
|
73
|
+
`- If confirmed, call speclock_remove_lock, then proceed.`,
|
|
74
|
+
``,
|
|
75
|
+
`## STEP 5 — CLOSE (when conversation ends):`,
|
|
76
|
+
`- Call speclock_session_summary with a brief description of what was done.`,
|
|
77
|
+
``,
|
|
78
|
+
`## KEY BEHAVIOR:`,
|
|
79
|
+
`- The 🔒 emoji is your SpecLock indicator. Users learn to recognize it means their project memory is active.`,
|
|
80
|
+
`- Keep SpecLock confirmations SHORT — one line max. Don't dump data.`,
|
|
81
|
+
`- Present remembered context NATURALLY. Instead of "SpecLock says your goal is X", just say "Based on our previous work, the goal is X."`,
|
|
82
|
+
`- If the user asks "how do you remember this?" — explain that SpecLock is connected as a project memory layer that persists across sessions.`,
|
|
83
|
+
].join("\n"),
|
|
53
84
|
}
|
|
54
85
|
);
|
|
55
86
|
|
|
@@ -264,7 +295,7 @@ app.get("/", (req, res) => {
|
|
|
264
295
|
tools: 19,
|
|
265
296
|
mcp_endpoint: "/mcp",
|
|
266
297
|
npm: "https://www.npmjs.com/package/speclock",
|
|
267
|
-
github: "https://github.com/sgroy10/
|
|
298
|
+
github: "https://github.com/sgroy10/speclock",
|
|
268
299
|
});
|
|
269
300
|
});
|
|
270
301
|
|
package/src/mcp/server.js
CHANGED
|
@@ -50,14 +50,45 @@ const PROJECT_ROOT =
|
|
|
50
50
|
args.project || process.env.SPECLOCK_PROJECT_ROOT || process.cwd();
|
|
51
51
|
|
|
52
52
|
// --- MCP Server ---
|
|
53
|
-
const VERSION = "1.
|
|
53
|
+
const VERSION = "1.2.0";
|
|
54
54
|
const AUTHOR = "Sandeep Roy";
|
|
55
55
|
|
|
56
56
|
const server = new McpServer(
|
|
57
57
|
{ name: "speclock", version: VERSION },
|
|
58
58
|
{
|
|
59
|
-
instructions:
|
|
60
|
-
`
|
|
59
|
+
instructions: [
|
|
60
|
+
`CRITICAL: You have SpecLock connected — an AI Continuity Engine that remembers project context across sessions. You MUST follow these rules:`,
|
|
61
|
+
``,
|
|
62
|
+
`## STEP 1 — FIRST THING IN EVERY CONVERSATION (MANDATORY):`,
|
|
63
|
+
`Before doing ANYTHING else, call speclock_session_briefing. This loads the project's goal, constraints, decisions, and history from previous sessions.`,
|
|
64
|
+
`- If it returns "not initialized", call speclock_init first, then tell the user: "I've set up project memory for this workspace. I'll remember your decisions and constraints across sessions."`,
|
|
65
|
+
`- If it returns context, start your response with a brief one-line status like: "🔒 Project memory loaded — [X] constraints, [Y] decisions tracked from previous sessions." Then proceed to answer the user's actual question.`,
|
|
66
|
+
`- If there is no meaningful context yet (new project), say: "🔒 Project memory active. I'll automatically remember your key decisions and constraints across sessions." Then proceed normally.`,
|
|
67
|
+
``,
|
|
68
|
+
`## STEP 2 — LISTEN AND CAPTURE (do this continuously as you work):`,
|
|
69
|
+
`- When the user describes what they're building → call speclock_set_goal.`,
|
|
70
|
+
`- When the user says something is non-negotiable or uses words like "always", "never", "must", "don't ever change", "make sure to keep", "this is critical" → call speclock_add_lock. Then briefly confirm: "🔒 Locked: [constraint]"`,
|
|
71
|
+
`- When the user makes a technology or design choice → call speclock_add_decision.`,
|
|
72
|
+
`- When you complete significant work → call speclock_log_change.`,
|
|
73
|
+
``,
|
|
74
|
+
`## STEP 3 — PROTECT (before making significant changes):`,
|
|
75
|
+
`- Before removing features, changing architecture, switching technologies, or modifying core logic → call speclock_check_conflict.`,
|
|
76
|
+
`- If a conflict is found (confidence HIGH), STOP and warn: "⚠️ This would conflict with a constraint you set: [constraint]. Should I proceed anyway or keep the current approach?"`,
|
|
77
|
+
`- Do NOT proceed unless the user explicitly confirms.`,
|
|
78
|
+
``,
|
|
79
|
+
`## STEP 4 — REMEMBER (when the user wants to change their mind):`,
|
|
80
|
+
`- If they want to remove or change something they previously locked, remind them: "You previously locked: [constraint]. Want me to unlock this and proceed?"`,
|
|
81
|
+
`- If confirmed, call speclock_remove_lock, then proceed.`,
|
|
82
|
+
``,
|
|
83
|
+
`## STEP 5 — CLOSE (when conversation ends):`,
|
|
84
|
+
`- Call speclock_session_summary with a brief description of what was done.`,
|
|
85
|
+
``,
|
|
86
|
+
`## KEY BEHAVIOR:`,
|
|
87
|
+
`- The 🔒 emoji is your SpecLock indicator. Users learn to recognize it means their project memory is active.`,
|
|
88
|
+
`- Keep SpecLock confirmations SHORT — one line max. Don't dump data.`,
|
|
89
|
+
`- Present remembered context NATURALLY. Instead of "SpecLock says your goal is X", just say "Based on our previous work, the goal is X."`,
|
|
90
|
+
`- If the user asks "how do you remember this?" — explain that SpecLock is connected as a project memory layer that persists across sessions.`,
|
|
91
|
+
].join("\n"),
|
|
61
92
|
}
|
|
62
93
|
);
|
|
63
94
|
|