speclock 1.2.0 → 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 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
- Any AI tool calls `speclock_session_briefing` → gets **full project context** works with complete memory → calls `speclock_session_summary` → next session continues seamlessly.
38
+ **SpecLock = MCP Server + Project Instructions.**
39
39
 
40
- **No context is ever lost again.**
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. Install
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
- ```bash
68
- npx speclock init
69
- ```
63
+ **Lovable** (no install needed):
70
64
 
71
- ### 2. Initialize in Your Project
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
- ```bash
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
- ### 4. Use It
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
- The AI tool now has access to **19 SpecLock tools**. The key workflow:
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
- 1. **Start session**: AI calls `speclock_session_briefing` gets full context + what changed
127
- 2. **During work**: AI uses `add_decision`, `log_change`, `check_conflict`, `detect_drift`
128
- 3. **End session**: AI calls `speclock_session_summary` records what was accomplished
129
- 4. **Next session (any tool)**: Step 1 repeats — full continuity preserved
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.2.0",
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",
@@ -41,7 +41,7 @@ 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.1.0";
44
+ const VERSION = "1.2.0";
45
45
  const AUTHOR = "Sandeep Roy";
46
46
 
47
47
  function createSpecLockServer() {
@@ -49,38 +49,37 @@ function createSpecLockServer() {
49
49
  { name: "speclock", version: VERSION },
50
50
  {
51
51
  instructions: [
52
- `You have SpecLock connected — an AI Continuity Engine by ${AUTHOR}. Follow these rules AUTOMATICALLY without the user ever having to ask:`,
52
+ `CRITICAL: You have SpecLock connected — an AI Continuity Engine that remembers project context across sessions. You MUST follow these rules:`,
53
53
  ``,
54
- `## ON EVERY NEW CONVERSATION / SESSION START:`,
55
- `1. IMMEDIATELY call speclock_session_briefing BEFORE responding to the user's first message.`,
56
- `2. If it returns "not initialized", call speclock_init first, then proceed normally.`,
57
- `3. Use the briefing context to understand the project's goal, constraints, decisions, and history.`,
58
- `4. Never ask the user to "initialize SpecLock" or "start a session" just do it silently.`,
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
59
  ``,
60
- `## AUTOMATIC CONTEXT CAPTURE (do this silently as you work):`,
61
- `- When the user describes what they're building → call speclock_set_goal with a concise summary.`,
62
- `- When the user says something is non-negotiable (e.g., "always use Supabase", "never remove auth", "must support mobile") → call speclock_add_lock to save it as an immutable constraint.`,
63
- `- When the user makes a technology/architecture choice (e.g., "let's use React Query", "we'll go with Stripe") → call speclock_add_decision.`,
64
- `- When you complete a significant piece of work → call speclock_log_change.`,
65
- `- Look for keywords like "always", "never", "must", "don't ever", "make sure to keep" — these signal constraints that should be locked.`,
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.`,
66
65
  ``,
67
- `## BEFORE MAKING SIGNIFICANT CHANGES:`,
68
- `- Call speclock_check_conflict with a description of what you're about to do.`,
69
- `- If a conflict is detected (confidence HIGH), WARN the user and explain which constraint would be violated.`,
70
- `- Do NOT proceed with the change unless the user explicitly says to override or remove the lock.`,
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.`,
71
70
  ``,
72
- `## WHEN THE USER ASKS TO REMOVE SOMETHING THEY PREVIOUSLY LOCKED:`,
73
- `- Remind them: "You previously locked this constraint: [constraint text]. Want me to remove the lock and proceed?"`,
74
- `- If they confirm, call speclock_remove_lock, then proceed.`,
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.`,
75
74
  ``,
76
- `## AT THE END OF A CONVERSATION (when the user says goodbye, or the conversation naturally ends):`,
77
- `- Call speclock_session_summary with a brief description of what was accomplished.`,
75
+ `## STEP 5 CLOSE (when conversation ends):`,
76
+ `- Call speclock_session_summary with a brief description of what was done.`,
78
77
  ``,
79
- `## IMPORTANT:`,
80
- `- NEVER mention "SpecLock" to the user unless they ask about it. Just use it silently in the background.`,
81
- `- The user should feel like the AI simply "remembers everything" — SpecLock is invisible infrastructure.`,
82
- `- If the user asks "how do you remember this?" you can explain SpecLock is connected as a memory layer.`,
83
- `- When showing the user what you know from previous sessions, present it naturally, not as a data dump.`,
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.`,
84
83
  ].join("\n"),
85
84
  }
86
85
  );
package/src/mcp/server.js CHANGED
@@ -50,45 +50,44 @@ const PROJECT_ROOT =
50
50
  args.project || process.env.SPECLOCK_PROJECT_ROOT || process.cwd();
51
51
 
52
52
  // --- MCP Server ---
53
- const VERSION = "1.1.0";
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
59
  instructions: [
60
- `You have SpecLock connected — an AI Continuity Engine by ${AUTHOR}. Follow these rules AUTOMATICALLY without the user ever having to ask:`,
60
+ `CRITICAL: You have SpecLock connected — an AI Continuity Engine that remembers project context across sessions. You MUST follow these rules:`,
61
61
  ``,
62
- `## ON EVERY NEW CONVERSATION / SESSION START:`,
63
- `1. IMMEDIATELY call speclock_session_briefing BEFORE responding to the user's first message.`,
64
- `2. If it returns "not initialized", call speclock_init first, then proceed normally.`,
65
- `3. Use the briefing context to understand the project's goal, constraints, decisions, and history.`,
66
- `4. Never ask the user to "initialize SpecLock" or "start a session" just do it silently.`,
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
67
  ``,
68
- `## AUTOMATIC CONTEXT CAPTURE (do this silently as you work):`,
69
- `- When the user describes what they're building → call speclock_set_goal with a concise summary.`,
70
- `- When the user says something is non-negotiable (e.g., "always use Supabase", "never remove auth", "must support mobile") → call speclock_add_lock to save it as an immutable constraint.`,
71
- `- When the user makes a technology/architecture choice (e.g., "let's use React Query", "we'll go with Stripe") → call speclock_add_decision.`,
72
- `- When you complete a significant piece of work → call speclock_log_change.`,
73
- `- Look for keywords like "always", "never", "must", "don't ever", "make sure to keep" — these signal constraints that should be locked.`,
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.`,
74
73
  ``,
75
- `## BEFORE MAKING SIGNIFICANT CHANGES:`,
76
- `- Call speclock_check_conflict with a description of what you're about to do.`,
77
- `- If a conflict is detected (confidence HIGH), WARN the user and explain which constraint would be violated.`,
78
- `- Do NOT proceed with the change unless the user explicitly says to override or remove the lock.`,
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.`,
79
78
  ``,
80
- `## WHEN THE USER ASKS TO REMOVE SOMETHING THEY PREVIOUSLY LOCKED:`,
81
- `- Remind them: "You previously locked this constraint: [constraint text]. Want me to remove the lock and proceed?"`,
82
- `- If they confirm, call speclock_remove_lock, then proceed.`,
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.`,
83
82
  ``,
84
- `## AT THE END OF A CONVERSATION (when the user says goodbye, or the conversation naturally ends):`,
85
- `- Call speclock_session_summary with a brief description of what was accomplished.`,
83
+ `## STEP 5 CLOSE (when conversation ends):`,
84
+ `- Call speclock_session_summary with a brief description of what was done.`,
86
85
  ``,
87
- `## IMPORTANT:`,
88
- `- NEVER mention "SpecLock" to the user unless they ask about it. Just use it silently in the background.`,
89
- `- The user should feel like the AI simply "remembers everything" — SpecLock is invisible infrastructure.`,
90
- `- If the user asks "how do you remember this?" you can explain SpecLock is connected as a memory layer.`,
91
- `- When showing the user what you know from previous sessions, present it naturally, not as a data dump.`,
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.`,
92
91
  ].join("\n"),
93
92
  }
94
93
  );