@totalreclaw/mcp-server 3.5.0 → 3.5.1-rc.2

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 (42) hide show
  1. package/README.md +10 -4
  2. package/SKILL.md +1 -1
  3. package/dist/dispatch.d.ts +16 -1
  4. package/dist/dispatch.d.ts.map +1 -1
  5. package/dist/dispatch.js +18 -4
  6. package/dist/dispatch.js.map +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +48 -47
  9. package/dist/index.js.map +1 -1
  10. package/dist/prompts.d.ts +4 -4
  11. package/dist/prompts.d.ts.map +1 -1
  12. package/dist/prompts.js +6 -7
  13. package/dist/prompts.js.map +1 -1
  14. package/dist/subgraph/credentials.d.ts +32 -8
  15. package/dist/subgraph/credentials.d.ts.map +1 -1
  16. package/dist/subgraph/credentials.js +64 -18
  17. package/dist/subgraph/credentials.js.map +1 -1
  18. package/dist/subgraph/protobuf.d.ts +71 -0
  19. package/dist/subgraph/protobuf.d.ts.map +1 -0
  20. package/dist/subgraph/protobuf.js +114 -0
  21. package/dist/subgraph/protobuf.js.map +1 -0
  22. package/dist/subgraph/store.d.ts +1 -45
  23. package/dist/subgraph/store.d.ts.map +1 -1
  24. package/dist/subgraph/store.js +11 -98
  25. package/dist/subgraph/store.js.map +1 -1
  26. package/dist/tools/account.d.ts +40 -3
  27. package/dist/tools/account.d.ts.map +1 -1
  28. package/dist/tools/account.js +51 -11
  29. package/dist/tools/account.js.map +1 -1
  30. package/dist/tools/index.d.ts +1 -1
  31. package/dist/tools/index.d.ts.map +1 -1
  32. package/dist/tools/index.js +4 -2
  33. package/dist/tools/index.js.map +1 -1
  34. package/dist/tools/pair.d.ts +70 -7
  35. package/dist/tools/pair.d.ts.map +1 -1
  36. package/dist/tools/pair.js +165 -48
  37. package/dist/tools/pair.js.map +1 -1
  38. package/dist/tools/support.js +2 -2
  39. package/dist/tools/support.js.map +1 -1
  40. package/dist/tools/types.d.ts +5 -2
  41. package/dist/tools/types.d.ts.map +1 -1
  42. package/package.json +6 -4
package/dist/prompts.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export declare const SERVER_INSTRUCTIONS = "\nYou have access to TotalReclaw, a persistent encrypted memory system. You SHOULD use these tools PROACTIVELY -- do not wait for the user to say \"remember this\" or \"recall that.\"\n\n## CRITICAL SAFETY: Recovery Phrase\nTotalReclaw uses a 12-word BIP-39 recovery phrase as the user's identity. The recovery phrase MUST NEVER cross your context window. NEVER ask the user to paste their phrase into chat. NEVER echo, print, or summarize a phrase. NEVER invoke a phrase-touching CLI (e.g. \"npx @totalreclaw/mcp-server setup\", \"npx @totalreclaw/mcp-server show-phrase\") via a shell tool \u2014 its stdout enters your context. If the user pastes a phrase in chat anyway, tell them it is compromised and they need to generate a fresh wallet via the OpenClaw or Hermes browser pair flow.\n\n## Setup Flow\nIf any TotalReclaw tool returns a \"not_configured\" or \"tool_removed\" error, the user has not yet wired their recovery phrase into the MCP host config. Direct them to the URL-driven install guide at https://github.com/p-diogo/totalreclaw/blob/main/docs/guides/claude-code-setup.md. The user sources their phrase out-of-band \u2014 from the OpenClaw or Hermes browser pair flow (relay only ever sees ciphertext), from a prior ~/.totalreclaw/credentials.json cache, or from an offline BIP-39 generator \u2014 and pastes it directly into TOTALRECLAW_RECOVERY_PHRASE in the MCP host config (Claude Desktop / Cursor / Windsurf / Claude Code). After they save the config and restart the host, the MCP server picks up the phrase and all TotalReclaw tools become available. There is no in-chat setup tool: the totalreclaw_setup MCP tool was removed in 3.2.1 because returning the phrase through tool output crossed your context, violating phrase-safety.\n\n## CRITICAL: Automatic Memory Behaviors\n\n### At Conversation Start\nALWAYS call totalreclaw_recall at the beginning of EVERY new conversation with a brief summary of the user's first message as the query. This loads relevant context from past conversations. Present recalled memories naturally as context -- do not announce \"I found these memories\" or list them explicitly unless the user asks.\n\n### Proactive Memory Storage (IMPORTANT)\nYou should call totalreclaw_remember WITHOUT being asked whenever the user shares:\n- Personal preferences (\"I prefer...\", \"I like...\", \"I hate...\")\n- Personal information (name, location, occupation, family details)\n- Decisions or goals (\"I decided to...\", \"I want to...\", \"I chose X because Y\")\n- Corrections to previous information (\"Actually, I'm vegan now\", \"We moved to Berlin\")\n- Important events or dates (\"My birthday is...\", \"I started a new job at...\")\n- Technical preferences (programming language, tools, frameworks, workflows)\n- Project context (what they're working on, deadlines, team details)\n- Opinions and values that shape future interactions\n\nThe user should NOT have to tell you to remember things. If information would be valuable in a future conversation, store it automatically. Think of yourself as a thoughtful assistant who naturally takes notes on important details.\n\nDo NOT store:\n- Temporary/transient context (weather today, a one-time task)\n- Generic knowledge unrelated to the user\n- Sensitive credentials (passwords, API keys, tokens)\n\n### Memory Recall\nCall totalreclaw_recall proactively when:\n- Starting any new conversation (query based on the user's first message)\n- The user asks about something that might relate to past conversations\n- You need context about the user's background, projects, or preferences\n- The user says \"remember when...\", \"what did I say about...\", \"do you know my...\"\n\n### Memory Hygiene\n- Before storing a new fact, check recalled memories to avoid duplicates\n- When the user corrects information, store the correction (the system handles deduplication)\n- Use importance 7-9 for core identity/preferences, 4-6 for moderate facts, 1-3 for minor details\n- Extract atomic facts: \"User prefers dark mode\" not \"User said they prefer dark mode and also use VS Code\"\n\n### Billing & Quota\nBoth tiers store memories permanently on Gnosis mainnet (E2E encrypted). Free tier is capped at 250 memories per month; Pro is capped at 1,500 memories per month. Reads are unlimited on both tiers. Do NOT guess or hardcode pricing or quota numbers \u2014 use totalreclaw_status to check exact usage, the current cap, and current pricing. For pricing details, refer users to https://totalreclaw.xyz/pricing\n\nWhen a totalreclaw_remember call fails with \"quota_exceeded\":\n1. Inform the user they've hit a usage limit\n2. Offer to check their usage with totalreclaw_status\n3. If they want to upgrade, use totalreclaw_upgrade to get a checkout link \u2014 upgrading is done right here through the agent\nDo NOT repeatedly attempt to store memories after a quota error.\n\nNote: Billing status is cached locally for up to 2 hours. After upgrading to Pro, the new tier may take up to 2 hours to take effect. If the user reports that Pro features are not active after upgrading, suggest restarting their agent to force a billing cache refresh.\n\n### Importing memories from other tools\nIf the user mentions migrating from Mem0, MCP Memory Server, or any other AI memory tool, offer to use totalreclaw_import_from. Start with dry_run=true to preview, then confirm before importing.\nAPI keys provided by the user are used only for the import and are never stored.\n\n### Agent-specific tips\n- If your agent supports background routines or scheduled tasks, set up a routine to call totalreclaw_remember after conversations to ensure nothing is missed.\n- If your agent supports a credential vault or secret store, the user's TOTALRECLAW_RECOVERY_PHRASE should be stored there instead of as a plaintext environment variable.\n- TotalReclaw memories are fully portable -- they work across OpenClaw, IronClaw, Claude Desktop, Cursor, NanoClaw, and any MCP-compatible agent.\n\n### User-controlled memory edits (v1)\nIn addition to remember + forget, three tools let the user correct stored memories without\nwiping the vault. Use these when the user says something like:\n- \"pin that\" / \"never forget this\" \u2192 totalreclaw_pin (preserves a fact across auto-resolution)\n- \"that was actually a directive, not a preference\" \u2192 totalreclaw_retype\n- \"that was work context\" / \"file that under personal\" \u2192 totalreclaw_set_scope\n\nAll three operate by supersession: they create a new claim with the override and link it\nback to the original via superseded_by. The original stays in the vault as a tombstone so\nhistory is inspectable. All three are idempotent (no-op if the target already matches).\n\n### End of Conversation\nWhen a substantive conversation is ending (the user says goodbye, the topic is resolved,\nor the conversation naturally concludes), call totalreclaw_debrief with the key takeaways.\n\nFocus on what individual memory storage missed:\n- What was the conversation about overall?\n- What was decided or resolved?\n- What approaches were tried and what was the outcome?\n- What's left unfinished?\n\nDo NOT debrief casual conversations (greetings, simple Q&A, small talk).\nMax 5 items, each 1-3 sentences, type \"summary\" or \"context\", importance 7-8.\n";
2
- export declare const SYSTEM_PROMPT_FRAGMENT = "\nYou have access to TotalReclaw, a persistent encrypted memory system. You SHOULD use these tools PROACTIVELY -- do not wait for the user to say \"remember this\" or \"recall that.\"\n\n## CRITICAL SAFETY: Recovery Phrase\nTotalReclaw uses a 12-word BIP-39 recovery phrase as the user's identity. The recovery phrase MUST NEVER cross your context window. NEVER ask the user to paste their phrase into chat. NEVER echo, print, or summarize a phrase. NEVER invoke a phrase-touching CLI (e.g. \"npx @totalreclaw/mcp-server setup\", \"npx @totalreclaw/mcp-server show-phrase\") via a shell tool \u2014 its stdout enters your context. If the user pastes a phrase in chat anyway, tell them it is compromised and they need to generate a fresh wallet via the OpenClaw or Hermes browser pair flow.\n\n## Setup Flow\nIf any TotalReclaw tool returns a \"not_configured\" or \"tool_removed\" error, the user has not yet wired their recovery phrase into the MCP host config. Direct them to the URL-driven install guide at https://github.com/p-diogo/totalreclaw/blob/main/docs/guides/claude-code-setup.md. The user sources their phrase out-of-band \u2014 from the OpenClaw or Hermes browser pair flow (relay only ever sees ciphertext), from a prior ~/.totalreclaw/credentials.json cache, or from an offline BIP-39 generator \u2014 and pastes it directly into TOTALRECLAW_RECOVERY_PHRASE in the MCP host config (Claude Desktop / Cursor / Windsurf / Claude Code). After they save the config and restart the host, the MCP server picks up the phrase and all TotalReclaw tools become available. There is no in-chat setup tool: the totalreclaw_setup MCP tool was removed in 3.2.1 because returning the phrase through tool output crossed your context, violating phrase-safety.\n\n## CRITICAL: Automatic Memory Behaviors\n\n### At Conversation Start\nALWAYS call totalreclaw_recall at the beginning of EVERY new conversation with a brief summary of the user's first message as the query. This loads relevant context from past conversations. Present recalled memories naturally as context -- do not announce \"I found these memories\" or list them explicitly unless the user asks.\n\n### Proactive Memory Storage (IMPORTANT)\nYou should call totalreclaw_remember WITHOUT being asked whenever the user shares:\n- Personal preferences (\"I prefer...\", \"I like...\", \"I hate...\")\n- Personal information (name, location, occupation, family details)\n- Decisions or goals (\"I decided to...\", \"I want to...\", \"I chose X because Y\")\n- Corrections to previous information (\"Actually, I'm vegan now\", \"We moved to Berlin\")\n- Important events or dates (\"My birthday is...\", \"I started a new job at...\")\n- Technical preferences (programming language, tools, frameworks, workflows)\n- Project context (what they're working on, deadlines, team details)\n- Opinions and values that shape future interactions\n\nThe user should NOT have to tell you to remember things. If information would be valuable in a future conversation, store it automatically. Think of yourself as a thoughtful assistant who naturally takes notes on important details.\n\nDo NOT store:\n- Temporary/transient context (weather today, a one-time task)\n- Generic knowledge unrelated to the user\n- Sensitive credentials (passwords, API keys, tokens)\n\n### Memory Recall\nCall totalreclaw_recall proactively when:\n- Starting any new conversation (query based on the user's first message)\n- The user asks about something that might relate to past conversations\n- You need context about the user's background, projects, or preferences\n- The user says \"remember when...\", \"what did I say about...\", \"do you know my...\"\n\n### Memory Hygiene\n- Before storing a new fact, check recalled memories to avoid duplicates\n- When the user corrects information, store the correction (the system handles deduplication)\n- Use importance 7-9 for core identity/preferences, 4-6 for moderate facts, 1-3 for minor details\n- Extract atomic facts: \"User prefers dark mode\" not \"User said they prefer dark mode and also use VS Code\"\n\n### Billing & Quota\nBoth tiers store memories permanently on Gnosis mainnet (E2E encrypted). Free tier is capped at 250 memories per month; Pro is capped at 1,500 memories per month. Reads are unlimited on both tiers. Do NOT guess or hardcode pricing or quota numbers \u2014 use totalreclaw_status to check exact usage, the current cap, and current pricing. For pricing details, refer users to https://totalreclaw.xyz/pricing\n\nWhen a totalreclaw_remember call fails with \"quota_exceeded\":\n1. Inform the user they've hit a usage limit\n2. Offer to check their usage with totalreclaw_status\n3. If they want to upgrade, use totalreclaw_upgrade to get a checkout link \u2014 upgrading is done right here through the agent\nDo NOT repeatedly attempt to store memories after a quota error.\n\nNote: Billing status is cached locally for up to 2 hours. After upgrading to Pro, the new tier may take up to 2 hours to take effect. If the user reports that Pro features are not active after upgrading, suggest restarting their agent to force a billing cache refresh.\n\n### Importing memories from other tools\nIf the user mentions migrating from Mem0, MCP Memory Server, or any other AI memory tool, offer to use totalreclaw_import_from. Start with dry_run=true to preview, then confirm before importing.\nAPI keys provided by the user are used only for the import and are never stored.\n\n### Agent-specific tips\n- If your agent supports background routines or scheduled tasks, set up a routine to call totalreclaw_remember after conversations to ensure nothing is missed.\n- If your agent supports a credential vault or secret store, the user's TOTALRECLAW_RECOVERY_PHRASE should be stored there instead of as a plaintext environment variable.\n- TotalReclaw memories are fully portable -- they work across OpenClaw, IronClaw, Claude Desktop, Cursor, NanoClaw, and any MCP-compatible agent.\n\n### User-controlled memory edits (v1)\nIn addition to remember + forget, three tools let the user correct stored memories without\nwiping the vault. Use these when the user says something like:\n- \"pin that\" / \"never forget this\" \u2192 totalreclaw_pin (preserves a fact across auto-resolution)\n- \"that was actually a directive, not a preference\" \u2192 totalreclaw_retype\n- \"that was work context\" / \"file that under personal\" \u2192 totalreclaw_set_scope\n\nAll three operate by supersession: they create a new claim with the override and link it\nback to the original via superseded_by. The original stays in the vault as a tombstone so\nhistory is inspectable. All three are idempotent (no-op if the target already matches).\n\n### End of Conversation\nWhen a substantive conversation is ending (the user says goodbye, the topic is resolved,\nor the conversation naturally concludes), call totalreclaw_debrief with the key takeaways.\n\nFocus on what individual memory storage missed:\n- What was the conversation about overall?\n- What was decided or resolved?\n- What approaches were tried and what was the outcome?\n- What's left unfinished?\n\nDo NOT debrief casual conversations (greetings, simple Q&A, small talk).\nMax 5 items, each 1-3 sentences, type \"summary\" or \"context\", importance 7-8.\n";
1
+ export declare const SERVER_INSTRUCTIONS = "\nYou have access to TotalReclaw, a persistent encrypted memory system. You SHOULD use these tools PROACTIVELY -- do not wait for the user to say \"remember this\" or \"recall that.\"\n\n## CRITICAL SAFETY: Recovery Phrase\nTotalReclaw uses a 12-word BIP-39 recovery phrase as the user's identity. The recovery phrase MUST NEVER cross your context window. NEVER ask the user to paste their phrase into chat. NEVER echo, print, or summarize a phrase. NEVER invoke a phrase-touching CLI (e.g. \"npx @totalreclaw/mcp-server setup\", \"npx @totalreclaw/mcp-server show-phrase\") via a shell tool \u2014 its stdout enters your context. If the user pastes a phrase in chat anyway, tell them it is compromised and they need to generate a fresh wallet via the OpenClaw or Hermes browser pair flow.\n\n## Setup Flow\nIf any TotalReclaw tool returns a \"not_configured\" or \"tool_removed\" error, the user has not yet wired their recovery phrase into the MCP host config. Direct them to the URL-driven install guide at https://github.com/graphprotocol/totalreclaw/blob/main/docs/guides/claude-code-setup.md. The user sources their phrase out-of-band \u2014 from the OpenClaw or Hermes browser pair flow (relay only ever sees ciphertext), from a prior ~/.totalreclaw/credentials.json cache, or from an offline BIP-39 generator \u2014 and pastes it directly into TOTALRECLAW_RECOVERY_PHRASE in the MCP host config (Claude Desktop / Cursor / Windsurf / Claude Code). After they save the config and restart the host, the MCP server picks up the phrase and all TotalReclaw tools become available. There is no in-chat setup tool: the totalreclaw_setup MCP tool was removed in 3.2.1 because returning the phrase through tool output crossed your context, violating phrase-safety.\n\n## CRITICAL: Automatic Memory Behaviors\n\n### At Conversation Start\nALWAYS call totalreclaw_recall at the beginning of EVERY new conversation with a brief summary of the user's first message as the query. This loads relevant context from past conversations. Present recalled memories naturally as context -- do not announce \"I found these memories\" or list them explicitly unless the user asks.\n\n### Proactive Memory Storage (IMPORTANT)\nYou should call totalreclaw_remember WITHOUT being asked whenever the user shares:\n- Personal preferences (\"I prefer...\", \"I like...\", \"I hate...\")\n- Personal information (name, location, occupation, family details)\n- Decisions or goals (\"I decided to...\", \"I want to...\", \"I chose X because Y\")\n- Corrections to previous information (\"Actually, I'm vegan now\", \"We moved to Berlin\")\n- Important events or dates (\"My birthday is...\", \"I started a new job at...\")\n- Technical preferences (programming language, tools, frameworks, workflows)\n- Project context (what they're working on, deadlines, team details)\n- Opinions and values that shape future interactions\n\nThe user should NOT have to tell you to remember things. If information would be valuable in a future conversation, store it automatically. Think of yourself as a thoughtful assistant who naturally takes notes on important details.\n\nDo NOT store:\n- Temporary/transient context (weather today, a one-time task)\n- Generic knowledge unrelated to the user\n- Sensitive credentials (passwords, API keys, tokens)\n\n### Memory Recall\nCall totalreclaw_recall proactively when:\n- Starting any new conversation (query based on the user's first message)\n- The user asks about something that might relate to past conversations\n- You need context about the user's background, projects, or preferences\n- The user says \"remember when...\", \"what did I say about...\", \"do you know my...\"\n\n### Memory Hygiene\n- Before storing a new fact, check recalled memories to avoid duplicates\n- When the user corrects information, store the correction (the system handles deduplication)\n- Use importance 7-9 for core identity/preferences, 4-6 for moderate facts, 1-3 for minor details\n- Extract atomic facts: \"User prefers dark mode\" not \"User said they prefer dark mode and also use VS Code\"\n\n### Billing & Quota\nBoth tiers store memories permanently on Gnosis mainnet (E2E encrypted). Free tier is capped at 250 memories per month; Pro is capped at 1,500 memories per month. Reads are unlimited on both tiers. Do NOT guess or hardcode pricing or quota numbers \u2014 use totalreclaw_status to check exact usage, the current cap, and current pricing. For pricing details, refer users to https://totalreclaw.xyz/pricing\n\nWhen a totalreclaw_remember call fails with \"quota_exceeded\":\n1. Inform the user they've hit a usage limit\n2. Offer to check their usage with totalreclaw_status\n3. If they want to upgrade, use totalreclaw_upgrade to get a checkout link \u2014 upgrading is done right here through the agent\nDo NOT repeatedly attempt to store memories after a quota error.\n\nNote: Billing status is cached locally for up to 2 hours. After upgrading to Pro, the new tier may take up to 2 hours to take effect. If the user reports that Pro features are not active after upgrading, suggest restarting their agent to force a billing cache refresh.\n\n### Importing memories from other tools\nIf the user mentions migrating from Mem0, MCP Memory Server, or any other AI memory tool, offer to use totalreclaw_import_from. Start with dry_run=true to preview, then confirm before importing.\nAPI keys provided by the user are used only for the import and are never stored.\n\n### Agent-specific tips\n- If your agent supports background routines or scheduled tasks, set up a routine to call totalreclaw_remember after conversations to ensure nothing is missed.\n- If your agent supports a credential vault or secret store, the user's TOTALRECLAW_RECOVERY_PHRASE should be stored there instead of as a plaintext environment variable.\n- TotalReclaw memories are fully portable -- they work across OpenClaw, IronClaw, Claude Desktop, Cursor, NanoClaw, and any MCP-compatible agent.\n\n### User-controlled memory edits (v1)\nIn addition to remember + forget, three tools let the user correct stored memories without\nwiping the vault. Use these when the user says something like:\n- \"pin that\" / \"never forget this\" \u2192 totalreclaw_pin (preserves a fact across auto-resolution)\n- \"that was actually a directive, not a preference\" \u2192 totalreclaw_retype\n- \"that was work context\" / \"file that under personal\" \u2192 totalreclaw_set_scope\n\nAll three operate by supersession: they create a new claim with the override and link it\nback to the original via superseded_by. The original stays in the vault as a tombstone so\nhistory is inspectable. All three are idempotent (no-op if the target already matches).\n\n### End of Conversation\nWhen a substantive conversation is ending (the user says goodbye, the topic is resolved,\nor the conversation naturally concludes), call totalreclaw_debrief with the key takeaways.\n\nFocus on what individual memory storage missed:\n- What was the conversation about overall?\n- What was decided or resolved?\n- What approaches were tried and what was the outcome?\n- What's left unfinished?\n\nDo NOT debrief casual conversations (greetings, simple Q&A, small talk).\nMax 5 items, each 1-3 sentences, type \"summary\" or \"context\", importance 7-8.\n";
2
+ export declare const SYSTEM_PROMPT_FRAGMENT = "\nYou have access to TotalReclaw, a persistent encrypted memory system. You SHOULD use these tools PROACTIVELY -- do not wait for the user to say \"remember this\" or \"recall that.\"\n\n## CRITICAL SAFETY: Recovery Phrase\nTotalReclaw uses a 12-word BIP-39 recovery phrase as the user's identity. The recovery phrase MUST NEVER cross your context window. NEVER ask the user to paste their phrase into chat. NEVER echo, print, or summarize a phrase. NEVER invoke a phrase-touching CLI (e.g. \"npx @totalreclaw/mcp-server setup\", \"npx @totalreclaw/mcp-server show-phrase\") via a shell tool \u2014 its stdout enters your context. If the user pastes a phrase in chat anyway, tell them it is compromised and they need to generate a fresh wallet via the OpenClaw or Hermes browser pair flow.\n\n## Setup Flow\nIf any TotalReclaw tool returns a \"not_configured\" or \"tool_removed\" error, the user has not yet wired their recovery phrase into the MCP host config. Direct them to the URL-driven install guide at https://github.com/graphprotocol/totalreclaw/blob/main/docs/guides/claude-code-setup.md. The user sources their phrase out-of-band \u2014 from the OpenClaw or Hermes browser pair flow (relay only ever sees ciphertext), from a prior ~/.totalreclaw/credentials.json cache, or from an offline BIP-39 generator \u2014 and pastes it directly into TOTALRECLAW_RECOVERY_PHRASE in the MCP host config (Claude Desktop / Cursor / Windsurf / Claude Code). After they save the config and restart the host, the MCP server picks up the phrase and all TotalReclaw tools become available. There is no in-chat setup tool: the totalreclaw_setup MCP tool was removed in 3.2.1 because returning the phrase through tool output crossed your context, violating phrase-safety.\n\n## CRITICAL: Automatic Memory Behaviors\n\n### At Conversation Start\nALWAYS call totalreclaw_recall at the beginning of EVERY new conversation with a brief summary of the user's first message as the query. This loads relevant context from past conversations. Present recalled memories naturally as context -- do not announce \"I found these memories\" or list them explicitly unless the user asks.\n\n### Proactive Memory Storage (IMPORTANT)\nYou should call totalreclaw_remember WITHOUT being asked whenever the user shares:\n- Personal preferences (\"I prefer...\", \"I like...\", \"I hate...\")\n- Personal information (name, location, occupation, family details)\n- Decisions or goals (\"I decided to...\", \"I want to...\", \"I chose X because Y\")\n- Corrections to previous information (\"Actually, I'm vegan now\", \"We moved to Berlin\")\n- Important events or dates (\"My birthday is...\", \"I started a new job at...\")\n- Technical preferences (programming language, tools, frameworks, workflows)\n- Project context (what they're working on, deadlines, team details)\n- Opinions and values that shape future interactions\n\nThe user should NOT have to tell you to remember things. If information would be valuable in a future conversation, store it automatically. Think of yourself as a thoughtful assistant who naturally takes notes on important details.\n\nDo NOT store:\n- Temporary/transient context (weather today, a one-time task)\n- Generic knowledge unrelated to the user\n- Sensitive credentials (passwords, API keys, tokens)\n\n### Memory Recall\nCall totalreclaw_recall proactively when:\n- Starting any new conversation (query based on the user's first message)\n- The user asks about something that might relate to past conversations\n- You need context about the user's background, projects, or preferences\n- The user says \"remember when...\", \"what did I say about...\", \"do you know my...\"\n\n### Memory Hygiene\n- Before storing a new fact, check recalled memories to avoid duplicates\n- When the user corrects information, store the correction (the system handles deduplication)\n- Use importance 7-9 for core identity/preferences, 4-6 for moderate facts, 1-3 for minor details\n- Extract atomic facts: \"User prefers dark mode\" not \"User said they prefer dark mode and also use VS Code\"\n\n### Billing & Quota\nBoth tiers store memories permanently on Gnosis mainnet (E2E encrypted). Free tier is capped at 250 memories per month; Pro is capped at 1,500 memories per month. Reads are unlimited on both tiers. Do NOT guess or hardcode pricing or quota numbers \u2014 use totalreclaw_status to check exact usage, the current cap, and current pricing. For pricing details, refer users to https://totalreclaw.xyz/pricing\n\nWhen a totalreclaw_remember call fails with \"quota_exceeded\":\n1. Inform the user they've hit a usage limit\n2. Offer to check their usage with totalreclaw_status\n3. If they want to upgrade, use totalreclaw_upgrade to get a checkout link \u2014 upgrading is done right here through the agent\nDo NOT repeatedly attempt to store memories after a quota error.\n\nNote: Billing status is cached locally for up to 2 hours. After upgrading to Pro, the new tier may take up to 2 hours to take effect. If the user reports that Pro features are not active after upgrading, suggest restarting their agent to force a billing cache refresh.\n\n### Importing memories from other tools\nIf the user mentions migrating from Mem0, MCP Memory Server, or any other AI memory tool, offer to use totalreclaw_import_from. Start with dry_run=true to preview, then confirm before importing.\nAPI keys provided by the user are used only for the import and are never stored.\n\n### Agent-specific tips\n- If your agent supports background routines or scheduled tasks, set up a routine to call totalreclaw_remember after conversations to ensure nothing is missed.\n- If your agent supports a credential vault or secret store, the user's TOTALRECLAW_RECOVERY_PHRASE should be stored there instead of as a plaintext environment variable.\n- TotalReclaw memories are fully portable -- they work across OpenClaw, IronClaw, Claude Desktop, Cursor, NanoClaw, and any MCP-compatible agent.\n\n### User-controlled memory edits (v1)\nIn addition to remember + forget, three tools let the user correct stored memories without\nwiping the vault. Use these when the user says something like:\n- \"pin that\" / \"never forget this\" \u2192 totalreclaw_pin (preserves a fact across auto-resolution)\n- \"that was actually a directive, not a preference\" \u2192 totalreclaw_retype\n- \"that was work context\" / \"file that under personal\" \u2192 totalreclaw_set_scope\n\nAll three operate by supersession: they create a new claim with the override and link it\nback to the original via superseded_by. The original stays in the vault as a tombstone so\nhistory is inspectable. All three are idempotent (no-op if the target already matches).\n\n### End of Conversation\nWhen a substantive conversation is ending (the user says goodbye, the topic is resolved,\nor the conversation naturally concludes), call totalreclaw_debrief with the key takeaways.\n\nFocus on what individual memory storage missed:\n- What was the conversation about overall?\n- What was decided or resolved?\n- What approaches were tried and what was the outcome?\n- What's left unfinished?\n\nDo NOT debrief casual conversations (greetings, simple Q&A, small talk).\nMax 5 items, each 1-3 sentences, type \"summary\" or \"context\", importance 7-8.\n";
3
3
  export declare const REMEMBER_TOOL_DESCRIPTION = "Store user info PROACTIVELY \u2014 don't wait for \"remember this\".\nINVOKE WHEN USER SAYS \"I prefer X\", \"I'm X\", \"I chose X because Y\"; reveals identity/location/job/family.\nNOT FOR: chitchat, passwords, generic knowledge.\nExtract ATOMIC. Good: \"User is vegan\". Bad: \"User said they became vegan, prefer organic\".\nPARAMS facts[]: text; importance 1-10 def 5; type claim|preference|directive|commitment|episode|summary; scope work|personal|health|family|creative|finance|misc|unspecified. Dedup auto.";
4
4
  export declare const RECALL_TOOL_DESCRIPTION = "Search encrypted vault. Top 8 reranked by provenance+semantic+recency.\nINVOKE WHEN USER SAYS:\n- \"what's my [phone/address/doctor]\"\n- \"remember when I...\" / \"what did I say about...\"\n- \"do you know my...\" / \"my preferences for...\"\n- opens convo on a topic (auto-recall first msg)\nWHEN NOT TO USE: world knowledge, small talk.\nDOES: trapdoor search, decrypt, rerank BM25+cosine+source-provenance.\nPARAMS: query (5-15 words), k (def 8, max 50).\nDon't announce \"I found these memories\" \u2014 just use them.";
5
5
  export declare const FORGET_TOOL_DESCRIPTION = "Permanently remove memory.\nINVOKE WHEN USER SAYS:\n- \"forget what I said about X\" / \"delete that fact\"\n- \"that's wrong/outdated \u2014 remove it\"\n- \"I don't want you remembering X\"\n- \"erase that password I pasted\"\nWHEN NOT TO USE:\n- CORRECTING \u2192 totalreclaw_remember (dedup auto)\n- changing mind (\"I prefer tea now\") \u2192 remember new pref\n- no explicit request \u2014 never forget proactively\nDOES: fact_id \u2192 tombstone. query \u2192 recall \u226450, tombstone all.\nPARAMS: fact_id (pref), query (max 50), scope (hint).";
@@ -9,8 +9,8 @@ export declare const UPGRADE_TOOL_DESCRIPTION = "Stripe checkout URL for Pro (1,
9
9
  export declare const IMPORT_FROM_TOOL_DESCRIPTION = "Import from Mem0, MCP Memory, ChatGPT, Claude, Gemini, JSON/CSV.\nINVOKE WHEN USER SAYS:\n- \"migrate memory from [Mem0/ChatGPT/Claude]\"\n- \"import my ChatGPT memories\" / \"here's my Mem0 export\"\n- \"I pasted my Claude memory \u2014 store it\"\nWHEN NOT TO USE: TotalReclaw backup \u2192 totalreclaw_import. Single fact \u2192 totalreclaw_remember.\nDOES: adapter parses+stores (unless dry_run). Fingerprint dedup. Convo sources return chunks for host LLM.\nALWAYS dry_run=true first \u2192 preview \u2192 confirm.";
10
10
  export declare const IMPORT_TOOL_DESCRIPTION = "Restore from totalreclaw_export backup (JSON/Markdown).\nINVOKE WHEN USER SAYS:\n- \"restore memories from this backup\" / \"import this JSON\"\n- \"I exported from another TotalReclaw account\"\n- \"here's the Markdown export \u2014 put it back\"\nWHEN NOT TO USE:\n- Mem0/ChatGPT/Claude \u2192 totalreclaw_import_from\n- single fact \u2192 totalreclaw_remember\nDOES: parse JSON/Markdown (auto), store via totalreclaw_remember + fingerprint dedup.\nPARAMS: content (req), format, merge_strategy, validate_only.";
11
11
  export declare const SUPPORT_TOOL_DESCRIPTION = "Support contact, docs, troubleshooting.\nINVOKE WHEN USER SAYS:\n- \"how do I get help?\" / \"who do I contact?\"\n- \"memories aren't loading\" / \"getting errors\"\n- \"lost my recovery phrase\" / \"where's the docs?\"\n- \"how do I report a bug?\"\n- asks: slow recall, quota errors, failed imports, missing post-upgrade memories\nDOES: static bundle (pre-filled email, docs URL, issues URL, troubleshooting table). Works unconfigured.\nWHEN NOT TO USE: billing info \u2192 totalreclaw_status. Skip unrelated questions.";
12
- export declare const ACCOUNT_TOOL_DESCRIPTION = "Account overview: wallet, tier, usage, memories, features, safe recovery hint.\nINVOKE WHEN USER SAYS:\n- \"show my account\" / \"what's my profile?\"\n- \"how many memories?\" / \"my wallet?\"\n- \"right recovery phrase? hint\"\n- \"summary of my setup\"\nDOES: billing+fact count parallel. Returns wallet, tier, writes_used/limit, total_facts, features, FIRST+LAST recovery words (never full).\nWHEN NOT TO USE:\n- only billing \u2192 totalreclaw_status (lighter)\n- FULL recovery phrase \u2192 NEVER; password manager.";
13
- export declare const PAIR_TOOL_DESCRIPTION = "Set up the user's TotalReclaw account (browser-side recovery-phrase generation or import).\nINVOKE WHEN USER SAYS:\n- \"set up totalreclaw\" / \"set up my account\"\n- \"I don't have a totalreclaw recovery phrase yet\" / \"create a totalreclaw account\"\n- ANY tool returns \"not_configured\" \u2014 propose this tool BEFORE asking the user to edit MCP config.\nDOES: opens a brief relay session, returns {url, pin, expires_at_ms}. Hand the URL + PIN to the user \u2014 they open the URL in any browser, the BROWSER generates (or imports) a 12-word phrase, encrypts it, uploads ciphertext to this MCP server. Server decrypts in-memory, writes ~/.totalreclaw/credentials.json (mode 0600). Phrase NEVER touches LLM context, chat transcript, stdout, or logs.\nAFTER PAIRING: tell the user to RESTART their MCP host (Claude Desktop / Cursor / Claude Code) so the server re-reads credentials.json and switches out of unconfigured mode.\nWHEN NOT TO USE:\n- user already has TOTALRECLAW_RECOVERY_PHRASE in env \u2192 tool will return URL but pairing is unnecessary\n- user explicitly wants terminal-only setup \u2192 point them at `npx @totalreclaw/mcp-server setup` (CLI wizard, runs OUTSIDE your shell tool)\n- NEVER ask the user to paste their phrase in chat. NEVER echo or print a phrase from any source.";
12
+ export declare const ACCOUNT_TOOL_DESCRIPTION = "Account overview: wallet, tier, usage, memories, features, credential kind.\nINVOKE WHEN USER SAYS:\n- \"show my account\" / \"what's my profile?\"\n- \"how many memories?\" / \"my wallet?\"\n- \"summary of my setup\"\nDOES: billing+fact count parallel. Returns wallet, tier, writes_used/limit, total_facts, features, credential kind. Never any part of the recovery phrase.\nWHEN NOT TO USE:\n- only billing \u2192 totalreclaw_status (lighter)\n- recovery phrase (any word) \u2192 NEVER available; user checks own backup.";
13
+ export declare const PAIR_TOOL_DESCRIPTION = "Set up the user's TotalReclaw account (browser-side recovery-phrase generation or import).\nINVOKE WHEN USER SAYS:\n- \"set up totalreclaw\" / \"set up my account\"\n- \"I don't have a totalreclaw recovery phrase yet\" / \"create a totalreclaw account\"\n- ANY tool returns \"not_configured\" \u2014 propose this tool BEFORE asking the user to edit MCP config.\nDOES: opens a relay pairing session, returns {url, pin, expires_at_ms}. Hand the URL + PIN to the user \u2014 they open the URL in any browser, the BROWSER generates (or imports) a 12-word phrase, encrypts it, uploads ciphertext to this MCP server. Server decrypts in-memory, writes ~/.totalreclaw/credentials.json (mode 0600). Phrase NEVER touches LLM context, chat transcript, stdout, or logs.\nAFTER PAIRING: when the page says \"You're all set\", tell the user to fully quit and reopen their MCP host (Claude Desktop / Cursor / Claude Code); the server reads credentials.json only at startup. The link lasts about 10 minutes.\nWHEN NOT TO USE:\n- user already has TOTALRECLAW_RECOVERY_PHRASE in env \u2192 tool will return URL but pairing is unnecessary\n- user explicitly wants terminal-only setup \u2192 point them at `npx @totalreclaw/mcp-server setup` (CLI wizard, runs OUTSIDE your shell tool)\n- NEVER ask the user to paste their phrase in chat. NEVER echo or print a phrase from any source.";
14
14
  export declare const PROMPT_DEFINITIONS: {
15
15
  name: string;
16
16
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,8oOAwF/B,CAAC;AAGF,eAAO,MAAM,sBAAsB,8oOAAsB,CAAC;AAI1D,eAAO,MAAM,yBAAyB,ugBAIoJ,CAAC;AAE3L,eAAO,MAAM,uBAAuB,ihBASqB,CAAC;AAE1D,eAAO,MAAM,uBAAuB,8iBAWkB,CAAC;AAEvD,eAAO,MAAM,uBAAuB,6gBAUF,CAAC;AAEnC,eAAO,MAAM,uBAAuB,kgBASK,CAAC;AAE1C,eAAO,MAAM,wBAAwB,6gBASE,CAAC;AAExC,eAAO,MAAM,4BAA4B,4gBAOM,CAAC;AAEhD,eAAO,MAAM,uBAAuB,qgBAS0B,CAAC;AAE/D,eAAO,MAAM,wBAAwB,+gBAQyC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,8gBASa,CAAC;AAEnD,eAAO,MAAM,qBAAqB,2xCAUgE,CAAC;AAInG,eAAO,MAAM,kBAAkB;;;;;;;;;GAqB9B,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,CAqClE"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,opOAwF/B,CAAC;AAGF,eAAO,MAAM,sBAAsB,opOAAsB,CAAC;AAI1D,eAAO,MAAM,yBAAyB,ugBAIoJ,CAAC;AAE3L,eAAO,MAAM,uBAAuB,ihBASqB,CAAC;AAE1D,eAAO,MAAM,uBAAuB,8iBAWkB,CAAC;AAEvD,eAAO,MAAM,uBAAuB,6gBAUF,CAAC;AAEnC,eAAO,MAAM,uBAAuB,kgBASK,CAAC;AAE1C,eAAO,MAAM,wBAAwB,6gBASE,CAAC;AAExC,eAAO,MAAM,4BAA4B,4gBAOM,CAAC;AAEhD,eAAO,MAAM,uBAAuB,qgBAS0B,CAAC;AAE/D,eAAO,MAAM,wBAAwB,+gBAQyC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,8gBAQmC,CAAC;AAEzE,eAAO,MAAM,qBAAqB,w1CAUgE,CAAC;AAInG,eAAO,MAAM,kBAAkB;;;;;;;;;GAqB9B,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,CAqClE"}
package/dist/prompts.js CHANGED
@@ -12,7 +12,7 @@ You have access to TotalReclaw, a persistent encrypted memory system. You SHOULD
12
12
  TotalReclaw uses a 12-word BIP-39 recovery phrase as the user's identity. The recovery phrase MUST NEVER cross your context window. NEVER ask the user to paste their phrase into chat. NEVER echo, print, or summarize a phrase. NEVER invoke a phrase-touching CLI (e.g. "npx @totalreclaw/mcp-server setup", "npx @totalreclaw/mcp-server show-phrase") via a shell tool — its stdout enters your context. If the user pastes a phrase in chat anyway, tell them it is compromised and they need to generate a fresh wallet via the OpenClaw or Hermes browser pair flow.
13
13
 
14
14
  ## Setup Flow
15
- If any TotalReclaw tool returns a "not_configured" or "tool_removed" error, the user has not yet wired their recovery phrase into the MCP host config. Direct them to the URL-driven install guide at https://github.com/p-diogo/totalreclaw/blob/main/docs/guides/claude-code-setup.md. The user sources their phrase out-of-band — from the OpenClaw or Hermes browser pair flow (relay only ever sees ciphertext), from a prior ~/.totalreclaw/credentials.json cache, or from an offline BIP-39 generator — and pastes it directly into TOTALRECLAW_RECOVERY_PHRASE in the MCP host config (Claude Desktop / Cursor / Windsurf / Claude Code). After they save the config and restart the host, the MCP server picks up the phrase and all TotalReclaw tools become available. There is no in-chat setup tool: the totalreclaw_setup MCP tool was removed in 3.2.1 because returning the phrase through tool output crossed your context, violating phrase-safety.
15
+ If any TotalReclaw tool returns a "not_configured" or "tool_removed" error, the user has not yet wired their recovery phrase into the MCP host config. Direct them to the URL-driven install guide at https://github.com/graphprotocol/totalreclaw/blob/main/docs/guides/claude-code-setup.md. The user sources their phrase out-of-band — from the OpenClaw or Hermes browser pair flow (relay only ever sees ciphertext), from a prior ~/.totalreclaw/credentials.json cache, or from an offline BIP-39 generator — and pastes it directly into TOTALRECLAW_RECOVERY_PHRASE in the MCP host config (Claude Desktop / Cursor / Windsurf / Claude Code). After they save the config and restart the host, the MCP server picks up the phrase and all TotalReclaw tools become available. There is no in-chat setup tool: the totalreclaw_setup MCP tool was removed in 3.2.1 because returning the phrase through tool output crossed your context, violating phrase-safety.
16
16
 
17
17
  ## CRITICAL: Automatic Memory Behaviors
18
18
 
@@ -182,23 +182,22 @@ INVOKE WHEN USER SAYS:
182
182
  - asks: slow recall, quota errors, failed imports, missing post-upgrade memories
183
183
  DOES: static bundle (pre-filled email, docs URL, issues URL, troubleshooting table). Works unconfigured.
184
184
  WHEN NOT TO USE: billing info → totalreclaw_status. Skip unrelated questions.`;
185
- exports.ACCOUNT_TOOL_DESCRIPTION = `Account overview: wallet, tier, usage, memories, features, safe recovery hint.
185
+ exports.ACCOUNT_TOOL_DESCRIPTION = `Account overview: wallet, tier, usage, memories, features, credential kind.
186
186
  INVOKE WHEN USER SAYS:
187
187
  - "show my account" / "what's my profile?"
188
188
  - "how many memories?" / "my wallet?"
189
- - "right recovery phrase? hint"
190
189
  - "summary of my setup"
191
- DOES: billing+fact count parallel. Returns wallet, tier, writes_used/limit, total_facts, features, FIRST+LAST recovery words (never full).
190
+ DOES: billing+fact count parallel. Returns wallet, tier, writes_used/limit, total_facts, features, credential kind. Never any part of the recovery phrase.
192
191
  WHEN NOT TO USE:
193
192
  - only billing → totalreclaw_status (lighter)
194
- - FULL recovery phrase → NEVER; password manager.`;
193
+ - recovery phrase (any word) → NEVER available; user checks own backup.`;
195
194
  exports.PAIR_TOOL_DESCRIPTION = `Set up the user's TotalReclaw account (browser-side recovery-phrase generation or import).
196
195
  INVOKE WHEN USER SAYS:
197
196
  - "set up totalreclaw" / "set up my account"
198
197
  - "I don't have a totalreclaw recovery phrase yet" / "create a totalreclaw account"
199
198
  - ANY tool returns "not_configured" — propose this tool BEFORE asking the user to edit MCP config.
200
- DOES: opens a brief relay session, returns {url, pin, expires_at_ms}. Hand the URL + PIN to the user — they open the URL in any browser, the BROWSER generates (or imports) a 12-word phrase, encrypts it, uploads ciphertext to this MCP server. Server decrypts in-memory, writes ~/.totalreclaw/credentials.json (mode 0600). Phrase NEVER touches LLM context, chat transcript, stdout, or logs.
201
- AFTER PAIRING: tell the user to RESTART their MCP host (Claude Desktop / Cursor / Claude Code) so the server re-reads credentials.json and switches out of unconfigured mode.
199
+ DOES: opens a relay pairing session, returns {url, pin, expires_at_ms}. Hand the URL + PIN to the user — they open the URL in any browser, the BROWSER generates (or imports) a 12-word phrase, encrypts it, uploads ciphertext to this MCP server. Server decrypts in-memory, writes ~/.totalreclaw/credentials.json (mode 0600). Phrase NEVER touches LLM context, chat transcript, stdout, or logs.
200
+ AFTER PAIRING: when the page says "You're all set", tell the user to fully quit and reopen their MCP host (Claude Desktop / Cursor / Claude Code); the server reads credentials.json only at startup. The link lasts about 10 minutes.
202
201
  WHEN NOT TO USE:
203
202
  - user already has TOTALRECLAW_RECOVERY_PHRASE in env → tool will return URL but pairing is unnecessary
204
203
  - user explicitly wants terminal-only setup → point them at \`npx @totalreclaw/mcp-server setup\` (CLI wizard, runs OUTSIDE your shell tool)
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":";AAAA,iFAAiF;AACjF,iFAAiF;AACjF,gFAAgF;;;AA+OhF,8CAwCC;AArRY,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFlC,CAAC;AAEF,yEAAyE;AAC5D,QAAA,sBAAsB,GAAG,2BAAmB,CAAC;AAE1D,gFAAgF;AAEnE,QAAA,yBAAyB,GAAG;;;;0LAIiJ,CAAC;AAE9K,QAAA,uBAAuB,GAAG;;;;;;;;;yDASkB,CAAC;AAE7C,QAAA,uBAAuB,GAAG;;;;;;;;;;;sDAWe,CAAC;AAE1C,QAAA,uBAAuB,GAAG;;;;;;;;;;kCAUL,CAAC;AAEtB,QAAA,uBAAuB,GAAG;;;;;;;;;yCASE,CAAC;AAE7B,QAAA,wBAAwB,GAAG;;;;;;;;;uCASD,CAAC;AAE3B,QAAA,4BAA4B,GAAG;;;;;;;+CAOG,CAAC;AAEnC,QAAA,uBAAuB,GAAG;;;;;;;;;8DASuB,CAAC;AAElD,QAAA,wBAAwB,G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ACT,+EAA+E;QACjF,SAAS,EAAE,EAAqE;KACjF;CACF,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,IAA6B;IAE7B,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,mBAAmB,CAAC,CAAC,CAAC;YACzB,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,gBAAgB,CAAC;YAC9C,OAAO;gBACL;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,4CAA4C,KAAK,gDAAgD;qBACxG;iBACF;aACF,CAAC;QACJ,CAAC;QAED,KAAK,kBAAkB;YACrB,OAAO;gBACL;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,uOAAuO;qBAC9O;iBACF;aACF,CAAC;QAEJ,KAAK,0BAA0B;YAC7B,OAAO;gBACL;oBACE,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,2BAAmB,EAAE;iBACrD;aACF,CAAC;QAEJ;YACE,MAAM,IAAI,KAAK,CAAC,mBAAmB,UAAU,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
@@ -27,6 +27,29 @@
27
27
  * `TOTALRECLAW_SELF_HOSTED=true`. See `index.ts`'s `main()` for the gate.
28
28
  */
29
29
  import { type DerivedBundleV1 } from './bundle.js';
30
+ /**
31
+ * A credentials.json this server recognises as a real credential written by
32
+ * another TotalReclaw client, in a form the MCP server cannot read: an
33
+ * OS-keychain-wrapped file (Hermes on a desktop host, either the v1
34
+ * mnemonic marker or a `version: 2` bundle with `keychain_wrapped: true`),
35
+ * or a `version` newer than this build knows.
36
+ *
37
+ * Distinct from the plain `Error`s below (a `version: 2` bundle that fails
38
+ * `parseBundleV1`'s §4.7 validation): those are evidence of a corrupt or
39
+ * tampered credential store and stay fatal at startup. This one is not —
40
+ * the file is presumably fine, this server just can't use it — so
41
+ * `index.ts` starts in `unconfigured` mode and reports `message` on every
42
+ * tool call instead of crashing (a crash makes the host drop all tools and
43
+ * leaves the reason in a log file the user never sees). Still never a silent
44
+ * downgrade: nothing in the file is used, and `totalreclaw_pair` refuses to
45
+ * overwrite it.
46
+ *
47
+ * `message` never contains any value from the file.
48
+ */
49
+ export declare class UnsupportedCredentialsError extends Error {
50
+ readonly reason: 'keychain_wrapped' | 'unknown_version';
51
+ constructor(reason: 'keychain_wrapped' | 'unknown_version', message: string);
52
+ }
30
53
  export type ResolvedCredential = {
31
54
  kind: 'mnemonic';
32
55
  mnemonic: string;
@@ -48,14 +71,15 @@ export interface ResolveManagedCredentialOptions {
48
71
  * `unconfigured` mode).
49
72
  *
50
73
  * Throws — never returns — on a credentials.json that is present but
51
- * malformed in a way that must not be silently downgraded:
52
- * - `version` present and not `2` (derived-bundle-v1.md §4.7 / the
53
- * client-consistency contract: unknown version is a loud error).
54
- * - `version === 2` but `keychain_wrapped: true` (MCP has no keychain
55
- * unwrap — see the module doc).
56
- * - `version === 2` and the bundle fails `parseBundleV1`'s §4.7
57
- * validation (malformed hex, unknown `signing.kind`, address/key
58
- * mismatch, …).
74
+ * must not be silently downgraded:
75
+ * - `UnsupportedCredentialsError`: `version` present and not `2`
76
+ * (derived-bundle-v1.md §4.7 / the client-consistency contract: unknown
77
+ * version is a loud error), or an OS-keychain-wrapped file (v1 marker or
78
+ * `version === 2` with `keychain_wrapped: true`; MCP has no keychain
79
+ * unwrap — see the module doc). `index.ts` starts unconfigured on these.
80
+ * - plain `Error`: `version === 2` and the bundle fails `parseBundleV1`'s
81
+ * §4.7 validation (malformed hex, unknown `signing.kind`, address/key
82
+ * mismatch, …). Fatal at startup.
59
83
  *
60
84
  * A missing file, an unreadable file, or a file that fails to parse as JSON
61
85
  * at all are treated as "nothing configured" (`undefined`) — matching the
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/subgraph/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAGlE,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC;AAEhD,MAAM,WAAW,+BAA+B;IAC9C,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AASD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,GAAE,+BAAoC,GACzC,kBAAkB,GAAG,SAAS,CAwFhC;AAQD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAQ1E"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/subgraph/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAGlE;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,iBAAiB,CAAC;gBAC5C,MAAM,EAAE,kBAAkB,GAAG,iBAAiB,EAAE,OAAO,EAAE,MAAM;CAK5E;AAYD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC;AAEhD,MAAM,WAAW,+BAA+B;IAC9C,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AASD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,GAAE,+BAAoC,GACzC,kBAAkB,GAAG,SAAS,CAiGhC;AAQD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAQ1E"}
@@ -61,6 +61,7 @@ var __importStar = (this && this.__importStar) || (function () {
61
61
  };
62
62
  })();
63
63
  Object.defineProperty(exports, "__esModule", { value: true });
64
+ exports.UnsupportedCredentialsError = void 0;
64
65
  exports.resolveManagedCredential = resolveManagedCredential;
65
66
  exports.isV2BundleCredentialsFile = isV2BundleCredentialsFile;
66
67
  const fs = __importStar(require("node:fs"));
@@ -68,6 +69,41 @@ const bip39_1 = require("@scure/bip39");
68
69
  const english_js_1 = require("@scure/bip39/wordlists/english.js");
69
70
  const bundle_js_1 = require("./bundle.js");
70
71
  const setup_js_1 = require("../cli/setup.js");
72
+ /**
73
+ * A credentials.json this server recognises as a real credential written by
74
+ * another TotalReclaw client, in a form the MCP server cannot read: an
75
+ * OS-keychain-wrapped file (Hermes on a desktop host, either the v1
76
+ * mnemonic marker or a `version: 2` bundle with `keychain_wrapped: true`),
77
+ * or a `version` newer than this build knows.
78
+ *
79
+ * Distinct from the plain `Error`s below (a `version: 2` bundle that fails
80
+ * `parseBundleV1`'s §4.7 validation): those are evidence of a corrupt or
81
+ * tampered credential store and stay fatal at startup. This one is not —
82
+ * the file is presumably fine, this server just can't use it — so
83
+ * `index.ts` starts in `unconfigured` mode and reports `message` on every
84
+ * tool call instead of crashing (a crash makes the host drop all tools and
85
+ * leaves the reason in a log file the user never sees). Still never a silent
86
+ * downgrade: nothing in the file is used, and `totalreclaw_pair` refuses to
87
+ * overwrite it.
88
+ *
89
+ * `message` never contains any value from the file.
90
+ */
91
+ class UnsupportedCredentialsError extends Error {
92
+ reason;
93
+ constructor(reason, message) {
94
+ super(message);
95
+ this.name = 'UnsupportedCredentialsError';
96
+ this.reason = reason;
97
+ }
98
+ }
99
+ exports.UnsupportedCredentialsError = UnsupportedCredentialsError;
100
+ /** Hermes' v1 keychain marker (`credentials_wrap.py`): `"__keychain__:v1:0x<eoa>"`. */
101
+ const KEYCHAIN_MARKER_PREFIX = '__keychain__:';
102
+ const KEYCHAIN_MESSAGE = 'The credentials file at ~/.totalreclaw/credentials.json keeps its secret in the OS ' +
103
+ 'keychain (another TotalReclaw client, such as Hermes, set it up that way). The MCP ' +
104
+ 'server cannot read the OS keychain yet (a known gap; see mcp/README.md), so TotalReclaw ' +
105
+ 'is not available in this app for now. The file and the account are untouched, and ' +
106
+ 'pairing here is blocked so it cannot replace that account.';
71
107
  function isValidBip39Mnemonic(candidate) {
72
108
  const words = candidate.split(/\s+/);
73
109
  if (words.length !== 12 && words.length !== 24)
@@ -83,14 +119,15 @@ function isValidBip39Mnemonic(candidate) {
83
119
  * `unconfigured` mode).
84
120
  *
85
121
  * Throws — never returns — on a credentials.json that is present but
86
- * malformed in a way that must not be silently downgraded:
87
- * - `version` present and not `2` (derived-bundle-v1.md §4.7 / the
88
- * client-consistency contract: unknown version is a loud error).
89
- * - `version === 2` but `keychain_wrapped: true` (MCP has no keychain
90
- * unwrap — see the module doc).
91
- * - `version === 2` and the bundle fails `parseBundleV1`'s §4.7
92
- * validation (malformed hex, unknown `signing.kind`, address/key
93
- * mismatch, …).
122
+ * must not be silently downgraded:
123
+ * - `UnsupportedCredentialsError`: `version` present and not `2`
124
+ * (derived-bundle-v1.md §4.7 / the client-consistency contract: unknown
125
+ * version is a loud error), or an OS-keychain-wrapped file (v1 marker or
126
+ * `version === 2` with `keychain_wrapped: true`; MCP has no keychain
127
+ * unwrap — see the module doc). `index.ts` starts unconfigured on these.
128
+ * - plain `Error`: `version === 2` and the bundle fails `parseBundleV1`'s
129
+ * §4.7 validation (malformed hex, unknown `signing.kind`, address/key
130
+ * mismatch, …). Fatal at startup.
94
131
  *
95
132
  * A missing file, an unreadable file, or a file that fails to parse as JSON
96
133
  * at all are treated as "nothing configured" (`undefined`) — matching the
@@ -148,14 +185,18 @@ function resolveManagedCredential(opts = {}) {
148
185
  }
149
186
  const obj = parsed;
150
187
  const version = obj.version;
151
- if (version === 2) {
152
- if (obj.keychain_wrapped === true) {
153
- throw new Error('credentials.json has version=2 with keychain_wrapped=true, but the MCP server ' +
154
- 'does not implement OS-keychain unwrapping (that is Python/Hermes-only — see ' +
155
- 'derived-bundle-v1.md §4.3 and mcp/README.md\'s Known Gaps). Provision a ' +
156
- 'plaintext derived-bundle-v1 bundle (the "headless / no keychain" storage form) ' +
157
- 'for MCP hosts instead.');
188
+ // OS-keychain-wrapped file (Hermes desktop storage), v1 marker or v2
189
+ // bundle. MCP has no keychain unwrap (derived-bundle-v1.md §4.3,
190
+ // mcp/README.md Known Gaps). Checked before the version switch so the v1
191
+ // marker (no `version` key) gets the same actionable error instead of
192
+ // silently reading as "nothing configured".
193
+ const mnemonicMarker = typeof obj.mnemonic === 'string' && obj.mnemonic.trim().startsWith(KEYCHAIN_MARKER_PREFIX);
194
+ if (obj.keychain_wrapped === true || mnemonicMarker) {
195
+ if (version === undefined || version === 2) {
196
+ throw new UnsupportedCredentialsError('keychain_wrapped', KEYCHAIN_MESSAGE);
158
197
  }
198
+ }
199
+ if (version === 2) {
159
200
  // parseBundleV1 runs every derived-bundle-v1.md §4.7 invariant and
160
201
  // throws a loud, actionable Error on any violation — never a silent
161
202
  // downgrade to legacy mnemonic handling.
@@ -163,9 +204,14 @@ function resolveManagedCredential(opts = {}) {
163
204
  return { kind: 'bundle', bundle };
164
205
  }
165
206
  if (version !== undefined) {
166
- throw new Error(`credentials.json has an unrecognised version=${JSON.stringify(version)}. Expected 2 ` +
167
- '(a derived-bundle-v1 bundle) or no version key at all (legacy plaintext mnemonic). ' +
168
- 'Refusing to guess — an unknown version is never silently treated as legacy.');
207
+ // `version` is a number or short string in every real file; cap it so a
208
+ // hostile file can't stuff arbitrary content into the message.
209
+ const shown = JSON.stringify(version).slice(0, 16);
210
+ throw new UnsupportedCredentialsError('unknown_version', `credentials.json has an unrecognised version=${shown}. This MCP server reads ` +
211
+ 'version 2 (a derived-bundle-v1 bundle) or no version key at all (legacy plaintext ' +
212
+ 'mnemonic). It may have been written by a newer TotalReclaw client; updating ' +
213
+ '@totalreclaw/mcp-server may fix it. Refusing to guess, so nothing in the file is ' +
214
+ 'used, and pairing here is blocked so it cannot replace that account.');
169
215
  }
170
216
  // 4. Legacy: plaintext {"mnemonic": "…"}.
171
217
  const mnemonicField = obj.mnemonic;
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/subgraph/credentials.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDH,4DA0FC;AAuBD,8DAQC;AA1KD,4CAA8B;AAE9B,wCAAgD;AAChD,kEAA6D;AAE7D,2CAAkE;AAClE,8CAAmD;AAanD,SAAS,oBAAoB,CAAC,SAAiB;IAC7C,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAC7D,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,qBAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,IAAA,wBAAgB,EAAC,SAAS,EAAE,qBAAQ,CAAC,IAAI,aAAa,CAAC;AAChE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAC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AAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAA0B,CAAC;QACxD,OAAO,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * TotalReclaw MCP — outer protobuf encoder for on-chain fact payloads.
3
+ *
4
+ * Dependency-free on purpose: the cross-language parity suite
5
+ * (`tests/parity/outer-protobuf-parity.test.ts`) loads this file directly,
6
+ * without the MCP runtime dependencies installed. `subgraph/store.ts`
7
+ * re-exports everything here, so imports from `./subgraph/store.js` are
8
+ * unchanged.
9
+ *
10
+ * Wire layout is byte-identical to the canonical encoders for the same input:
11
+ * - Rust: rust/totalreclaw-core/src/protobuf.rs encode_fact_protobuf
12
+ * - Python: python/src/totalreclaw/protobuf.py encode_fact_protobuf
13
+ *
14
+ * Field numbers (server/proto/totalreclaw.proto):
15
+ * 1 id, 2 timestamp, 3 owner, 4 encrypted_blob (bytes),
16
+ * 5 blind_indices (repeated), 6 decay_score (double), 7 is_active,
17
+ * 8 version, 9 source (NOT WRITTEN), 10 content_fp,
18
+ * 11 agent_id (NOT WRITTEN), 12 sequence_id (assigned by the subgraph),
19
+ * 13 encrypted_embedding.
20
+ *
21
+ * Fields 9 and 11 left the wire in v3 (provenance lives inside the encrypted
22
+ * blob, field 4). MCP kept writing them as plaintext calldata until PRD-04
23
+ * F8 / DEP-6. Pinned by tests/parity/fixtures/outer-protobuf-v1.json.
24
+ */
25
+ /**
26
+ * Memory Taxonomy v1 outer protobuf wrapper version.
27
+ *
28
+ * The v1 contract (shipped 2026-04-18) mandates that all clients write
29
+ * `version = 4` on the outer protobuf so the subgraph + cross-client
30
+ * readers can recognize the inner blob as a v1 JSON `MemoryClaim`.
31
+ *
32
+ * Canonical source: `rust/totalreclaw-core/src/protobuf.rs`
33
+ * (`PROTOBUF_VERSION_V4 = 4`). The WASM/PyO3 bindings do not re-export
34
+ * this constant to TS; switch to an import from `@totalreclaw/core` if
35
+ * they ever do.
36
+ */
37
+ export declare const PROTOBUF_VERSION_V4 = 4;
38
+ export interface FactPayload {
39
+ id: string;
40
+ timestamp: string;
41
+ owner: string;
42
+ encryptedBlob: string;
43
+ blindIndices: string[];
44
+ decayScore: number;
45
+ /**
46
+ * Write-path label (e.g. `mcp_remember`). NOT encoded on-chain: outer
47
+ * field 9 left the wire in v3 (PRD-04 F8 / DEP-6). Kept on the type so
48
+ * call sites compile unchanged — the Rust `FactPayload.source` and Python
49
+ * `FactPayload.source` fields are likewise accepted and ignored.
50
+ */
51
+ source: string;
52
+ contentFp: string;
53
+ /**
54
+ * Writer id (e.g. `mcp-server`). NOT encoded on-chain: outer field 11
55
+ * left the wire in v3 (PRD-04 F8 / DEP-6). Kept for call-site
56
+ * compatibility, mirroring Rust/Python `agent_id`.
57
+ */
58
+ agentId: string;
59
+ encryptedEmbedding?: string;
60
+ }
61
+ /**
62
+ * Encode a fact payload as a minimal Protobuf wire format.
63
+ *
64
+ * Field 8 (`version`) is always `PROTOBUF_VERSION_V4` (4) — every MCP write
65
+ * carries a v1 inner blob. Fields 9 (`source`) and 11 (`agent_id`) are never
66
+ * written, whatever the caller puts in `fact.source` / `fact.agentId`.
67
+ */
68
+ export declare function encodeFactProtobuf(fact: FactPayload): Buffer;
69
+ /** Encode an integer as a Protobuf varint */
70
+ export declare function encodeVarint(value: number): Buffer;
71
+ //# sourceMappingURL=protobuf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protobuf.d.ts","sourceRoot":"","sources":["../../src/subgraph/protobuf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CA2D5D;AAED,6CAA6C;AAC7C,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASlD"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ /**
3
+ * TotalReclaw MCP — outer protobuf encoder for on-chain fact payloads.
4
+ *
5
+ * Dependency-free on purpose: the cross-language parity suite
6
+ * (`tests/parity/outer-protobuf-parity.test.ts`) loads this file directly,
7
+ * without the MCP runtime dependencies installed. `subgraph/store.ts`
8
+ * re-exports everything here, so imports from `./subgraph/store.js` are
9
+ * unchanged.
10
+ *
11
+ * Wire layout is byte-identical to the canonical encoders for the same input:
12
+ * - Rust: rust/totalreclaw-core/src/protobuf.rs encode_fact_protobuf
13
+ * - Python: python/src/totalreclaw/protobuf.py encode_fact_protobuf
14
+ *
15
+ * Field numbers (server/proto/totalreclaw.proto):
16
+ * 1 id, 2 timestamp, 3 owner, 4 encrypted_blob (bytes),
17
+ * 5 blind_indices (repeated), 6 decay_score (double), 7 is_active,
18
+ * 8 version, 9 source (NOT WRITTEN), 10 content_fp,
19
+ * 11 agent_id (NOT WRITTEN), 12 sequence_id (assigned by the subgraph),
20
+ * 13 encrypted_embedding.
21
+ *
22
+ * Fields 9 and 11 left the wire in v3 (provenance lives inside the encrypted
23
+ * blob, field 4). MCP kept writing them as plaintext calldata until PRD-04
24
+ * F8 / DEP-6. Pinned by tests/parity/fixtures/outer-protobuf-v1.json.
25
+ */
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.PROTOBUF_VERSION_V4 = void 0;
28
+ exports.encodeFactProtobuf = encodeFactProtobuf;
29
+ exports.encodeVarint = encodeVarint;
30
+ /**
31
+ * Memory Taxonomy v1 outer protobuf wrapper version.
32
+ *
33
+ * The v1 contract (shipped 2026-04-18) mandates that all clients write
34
+ * `version = 4` on the outer protobuf so the subgraph + cross-client
35
+ * readers can recognize the inner blob as a v1 JSON `MemoryClaim`.
36
+ *
37
+ * Canonical source: `rust/totalreclaw-core/src/protobuf.rs`
38
+ * (`PROTOBUF_VERSION_V4 = 4`). The WASM/PyO3 bindings do not re-export
39
+ * this constant to TS; switch to an import from `@totalreclaw/core` if
40
+ * they ever do.
41
+ */
42
+ exports.PROTOBUF_VERSION_V4 = 4;
43
+ /**
44
+ * Encode a fact payload as a minimal Protobuf wire format.
45
+ *
46
+ * Field 8 (`version`) is always `PROTOBUF_VERSION_V4` (4) — every MCP write
47
+ * carries a v1 inner blob. Fields 9 (`source`) and 11 (`agent_id`) are never
48
+ * written, whatever the caller puts in `fact.source` / `fact.agentId`.
49
+ */
50
+ function encodeFactProtobuf(fact) {
51
+ const parts = [];
52
+ // Helper: encode a string field (skipped when empty, like core/Python)
53
+ const writeString = (fieldNumber, value) => {
54
+ if (!value)
55
+ return;
56
+ const data = Buffer.from(value, 'utf-8');
57
+ const key = (fieldNumber << 3) | 2; // wire type 2 = length-delimited
58
+ parts.push(encodeVarint(key));
59
+ parts.push(encodeVarint(data.length));
60
+ parts.push(data);
61
+ };
62
+ // Helper: encode a bytes field (always written, even when empty)
63
+ const writeBytes = (fieldNumber, value) => {
64
+ const key = (fieldNumber << 3) | 2;
65
+ parts.push(encodeVarint(key));
66
+ parts.push(encodeVarint(value.length));
67
+ parts.push(value);
68
+ };
69
+ // Helper: encode a double field (wire type 1 = 64-bit)
70
+ const writeDouble = (fieldNumber, value) => {
71
+ const key = (fieldNumber << 3) | 1;
72
+ parts.push(encodeVarint(key));
73
+ const buf = Buffer.alloc(8);
74
+ buf.writeDoubleLE(value);
75
+ parts.push(buf);
76
+ };
77
+ // Helper: encode a varint field (wire type 0)
78
+ const writeVarintField = (fieldNumber, value) => {
79
+ const key = (fieldNumber << 3) | 0;
80
+ parts.push(encodeVarint(key));
81
+ parts.push(encodeVarint(value));
82
+ };
83
+ writeString(1, fact.id);
84
+ writeString(2, fact.timestamp);
85
+ writeString(3, fact.owner);
86
+ writeBytes(4, Buffer.from(fact.encryptedBlob, 'hex'));
87
+ for (const index of fact.blindIndices) {
88
+ writeString(5, index);
89
+ }
90
+ writeDouble(6, fact.decayScore);
91
+ writeVarintField(7, 1); // is_active = true
92
+ writeVarintField(8, exports.PROTOBUF_VERSION_V4); // version = 4 (Memory Taxonomy v1)
93
+ // Field 9 (source) is NOT written — removed from the wire in v3; the
94
+ // provenance lives inside the encrypted blob (field 4). PRD-04 F8 / DEP-6.
95
+ writeString(10, fact.contentFp);
96
+ // Field 11 (agent_id) is NOT written — same reason as field 9.
97
+ // Field 12 (sequence_id) is assigned by the subgraph mapping, not the client.
98
+ if (fact.encryptedEmbedding) {
99
+ writeString(13, fact.encryptedEmbedding);
100
+ }
101
+ return Buffer.concat(parts);
102
+ }
103
+ /** Encode an integer as a Protobuf varint */
104
+ function encodeVarint(value) {
105
+ const bytes = [];
106
+ let v = value >>> 0; // unsigned
107
+ while (v > 0x7f) {
108
+ bytes.push((v & 0x7f) | 0x80);
109
+ v >>>= 7;
110
+ }
111
+ bytes.push(v & 0x7f);
112
+ return Buffer.from(bytes);
113
+ }
114
+ //# sourceMappingURL=protobuf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protobuf.js","sourceRoot":"","sources":["../../src/subgraph/protobuf.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AA+CH,gDA2DC;AAGD,oCASC;AApHD;;;;;;;;;;;GAWG;AACU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E,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,6CAA6C;AAC7C,SAAgB,YAAY,CAAC,KAAa;IACxC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,WAAW;IAChC,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAC9B,CAAC,MAAM,CAAC,CAAC;IACX,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACrB,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
@@ -61,51 +61,7 @@ export interface SubgraphStoreConfig {
61
61
  * throw viem's own less legible error.
62
62
  */
63
63
  export declare function resolveOwnerAccount(config: SubgraphStoreConfig): LocalAccount;
64
- export interface FactPayload {
65
- id: string;
66
- timestamp: string;
67
- owner: string;
68
- encryptedBlob: string;
69
- blindIndices: string[];
70
- decayScore: number;
71
- source: string;
72
- contentFp: string;
73
- agentId: string;
74
- encryptedEmbedding?: string;
75
- }
76
- /**
77
- * Memory Taxonomy v1 outer protobuf wrapper version.
78
- *
79
- * The v1 contract (shipped 2026-04-18) mandates that all clients write
80
- * `version = 4` on the outer protobuf so the subgraph + cross-client
81
- * readers can recognize the inner blob as a v1 JSON `MemoryClaim`.
82
- *
83
- * Canonical source: `rust/totalreclaw-core/src/protobuf.rs`
84
- * (`PROTOBUF_VERSION_V4 = 4`). The WASM/PyO3 bindings do not re-export
85
- * this constant to TS today — when they do, replace this literal with
86
- * an import from `@totalreclaw/core`.
87
- *
88
- * TODO: import from @totalreclaw/core once the constant is re-exported.
89
- */
90
- export declare const PROTOBUF_VERSION_V4 = 4;
91
- /**
92
- * Encode a fact payload as a minimal Protobuf wire format.
93
- *
94
- * Field numbers match server/proto/totalreclaw.proto:
95
- * 1: id (string), 2: timestamp (string), 3: owner (string),
96
- * 4: encrypted_blob (bytes), 5: blind_indices (repeated string),
97
- * 6: decay_score (double), 7: is_active (bool), 8: version (int32),
98
- * 9: source (string), 10: content_fp (string), 11: agent_id (string),
99
- * 12: sequence_id (int64), 13: encrypted_embedding (string)
100
- *
101
- * Field 8 (`version`) is written as `PROTOBUF_VERSION_V4` (4) to match
102
- * the Memory Taxonomy v1 contract. All other v1 clients (plugin, python,
103
- * rust/totalreclaw-memory) write 4 here — writing anything else breaks
104
- * cross-client uniformity.
105
- */
106
- export declare function encodeFactProtobuf(fact: FactPayload): Buffer;
107
- /** Encode an integer as a Protobuf varint */
108
- export declare function encodeVarint(value: number): Buffer;
64
+ export { encodeFactProtobuf, encodeVarint, PROTOBUF_VERSION_V4, type FactPayload, } from './protobuf.js';
109
65
  /** Resolve a viem Chain object from chain ID */
110
66
  export declare function getChainFromId(chainId: number): Chain;
111
67
  /** Build the relay bundler RPC URL from the relay server URL */