@torqon/mcp 0.2.3 → 0.2.4

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/dist/index.js +40 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -76,7 +76,7 @@ function hasSignal(text) {
76
76
  return words.length >= 3;
77
77
  }
78
78
  // ── MCP Server ───────────────────────────────────────────────────────────────
79
- const server = new McpServer({ name: 'torqon', version: '0.2.3' }, {
79
+ const server = new McpServer({ name: 'torqon', version: '0.2.4' }, {
80
80
  instructions: `Torqon persistent memory is active for this conversation.
81
81
 
82
82
  RULE: Call auto_process with the full user message BEFORE you respond to anything — every message, no exceptions, including greetings and one-word replies. It runs in under 200ms and simultaneously stores new facts AND retrieves relevant memory.
@@ -89,33 +89,54 @@ Also call store_memory explicitly whenever the user shares their name, a project
89
89
 
90
90
  Session ID: ${SESSION_ID}`,
91
91
  });
92
- // Auto-injected system promptClaude Desktop loads this at conversation start.
93
- // Written as a SYSTEM-level instruction so Claude treats it as a standing rule.
94
- server.prompt('torqon_context', 'Torqon persistent memory active for this session', {}, async () => {
92
+ // Live memory loaderuser runs /torqon_context once at conversation start.
93
+ // Fetches all stored facts from the API and injects them directly into the prompt.
94
+ // This is more reliable than auto_process-per-message because it's a deliberate
95
+ // one-time action, not a tool Claude has to remember to call before every message.
96
+ server.prompt('torqon_context', 'Load your Torqon memory into this conversation (run once at the start)', {}, async () => {
97
+ if (!API_KEY) {
98
+ return {
99
+ messages: [{
100
+ role: 'user',
101
+ content: { type: 'text', text: '[Torqon] No API key configured. Run: npx -y @torqon/mcp@latest add claude --api-key <your-key>' },
102
+ }],
103
+ };
104
+ }
105
+ // Fetch all current facts for this user
106
+ let facts = [];
107
+ try {
108
+ const res = await fetch(`${API_URL}/api/v1/memory`, { headers });
109
+ if (res.ok) {
110
+ const data = await res.json();
111
+ facts = data?.results ?? [];
112
+ }
113
+ }
114
+ catch { /* network error — start with empty facts */ }
115
+ const factLines = facts
116
+ .map((f) => f.metadata?.type ? `${f.metadata.type}: ${f.content}` : f.content)
117
+ .join('\n');
118
+ const memoryBlock = factLines
119
+ ? `[TORQON MEMORY — treat as ground truth]\n${factLines}`
120
+ : '[TORQON MEMORY — no facts stored yet]';
95
121
  return {
96
122
  messages: [
97
123
  {
98
124
  role: 'user',
99
125
  content: {
100
126
  type: 'text',
101
- text: `<torqon_memory_rules>
102
- TORQON PERSISTENT MEMORY IS ACTIVE. These are non-negotiable behavioral rules:
103
-
104
- BEFORE YOU RESPOND TO ANYTHING — call auto_process with the user's message. Every single message. No exceptions. Not even greetings. Not even "yes" or "ok". Call it first, then respond.
105
-
106
- Why: auto_process runs in under 200ms. It simultaneously stores new facts AND retrieves relevant memory. Skipping it means the user loses context they paid for.
127
+ text: `${memoryBlock}
107
128
 
108
- After auto_process returns:
109
- - If it returns facts tagged [Torqon memory], treat them as ground truth. Names, decisions, stack choices, numbers — use the exact stored values, not your training data.
110
- - If it returns "No relevant memory found", answer normally.
129
+ These are verified facts stored across all your previous sessions. Use them exactly as written — do not infer, expand, or contradict them.
111
130
 
112
- Also call store_memory explicitly when the user shares: their name, a project name, a key decision, a tech stack choice, a deadline, a constraint, or a preference. auto_process stores automatically but store_memory is for high-value facts you want to make sure are saved.
131
+ From this point:
132
+ - When the user shares new facts (name, project, stack, decision, deadline, preference), call store_memory to save them.
133
+ - When the user asks about something that might be in memory, call retrieve_context.
134
+ - You do NOT need to call auto_process on every message — just store and retrieve deliberately.
113
135
 
114
- Session: ${SESSION_ID}
115
- </torqon_memory_rules>`
116
- }
117
- }
118
- ]
136
+ Session: ${SESSION_ID}`,
137
+ },
138
+ },
139
+ ],
119
140
  };
120
141
  });
121
142
  // ── auto_process ─────────────────────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torqon/mcp",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {