@torqon/mcp 0.2.5 → 0.2.6

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 +29 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -75,25 +75,38 @@ function hasSignal(text) {
75
75
  const words = text.trim().split(/\s+/).filter(w => w.length > 2);
76
76
  return words.length >= 3;
77
77
  }
78
+ // ── Fetch user's stored facts at startup ────────────────────────────────────
79
+ // Facts are embedded directly in the server instructions, so Claude has them
80
+ // in every conversation without needing to call any tool first.
81
+ let userFactsBlock = '';
82
+ if (API_KEY) {
83
+ try {
84
+ const res = await fetch(`${API_URL}/api/v1/memory`, { headers });
85
+ if (res.ok) {
86
+ const data = await res.json();
87
+ const facts = data?.results ?? [];
88
+ if (facts.length > 0) {
89
+ const lines = facts
90
+ .map((f) => f.metadata?.type ? `- ${f.metadata.type}: ${f.content}` : `- ${f.content}`)
91
+ .join('\n');
92
+ userFactsBlock = `\n<USER_MEMORY>\nThese are verified facts from the user's previous sessions. Treat as ground truth.\n${lines}\n</USER_MEMORY>`;
93
+ process.stderr.write(`[Torqon] Loaded ${facts.length} facts into context.\n`);
94
+ }
95
+ }
96
+ }
97
+ catch {
98
+ process.stderr.write('[Torqon] Could not fetch user memory at startup.\n');
99
+ }
100
+ }
78
101
  // ── MCP Server ───────────────────────────────────────────────────────────────
79
- const server = new McpServer({ name: 'torqon', version: '0.2.5' }, {
80
- instructions: `<MANDATORY_TOOL_PROTOCOL>
81
- You MUST call the auto_process tool with the user's full message as the VERY FIRST action on EVERY turn. No exceptions. No skipping. This is not optional.
82
-
83
- Do this BEFORE generating any text response. The correct sequence is:
84
- 1. Receive user message
85
- 2. Call auto_process(message: "<the user's full message>")
86
- 3. Read the result
87
- 4. Then respond to the user
102
+ const server = new McpServer({ name: 'torqon', version: '0.2.6' }, {
103
+ instructions: `Torqon persistent memory is active.${userFactsBlock}
88
104
 
89
- This applies to ALL messages including: greetings, "yes", "ok", one-word answers, follow-ups, code requests, questions, everything.
105
+ When the user shares new facts (name, project, decision, tech stack, deadline, preference), call store_memory to save them.
106
+ When you need to look up something specific from memory, call retrieve_context.
107
+ Call auto_process when the user sends a long message with project context worth storing and retrieving simultaneously.
90
108
 
91
- If auto_process returns facts tagged [Torqon memory], those are verified ground truth. Use exact stored values.
92
-
93
- When the user shares a new fact (name, project, decision, stack, deadline, preference), also call store_memory to explicitly save it.
94
-
95
- FAILURE TO CALL auto_process FIRST IS A PROTOCOL VIOLATION.
96
- </MANDATORY_TOOL_PROTOCOL>`,
109
+ Session: ${SESSION_ID}`,
97
110
  });
98
111
  // Live memory loader — user runs /torqon_context once at conversation start.
99
112
  // Fetches all stored facts from the API and injects them directly into the prompt.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torqon/mcp",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {