@torqon/mcp 0.2.4 → 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 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -75,19 +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.4' }, {
80
- instructions: `Torqon persistent memory is active for this conversation.
81
-
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.
102
+ const server = new McpServer({ name: 'torqon', version: '0.2.6' }, {
103
+ instructions: `Torqon persistent memory is active.${userFactsBlock}
83
104
 
84
- After auto_process returns:
85
- - If it returns "[Torqon memory]" facts, treat them as ground truth. Use exact stored values (names, decisions, stack choices, numbers).
86
- - If it returns "No relevant memory found", answer normally.
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.
87
108
 
88
- Also call store_memory explicitly whenever 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 confirmed saved.
89
-
90
- Session ID: ${SESSION_ID}`,
109
+ Session: ${SESSION_ID}`,
91
110
  });
92
111
  // Live memory loader — user runs /torqon_context once at conversation start.
93
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.4",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {