Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mcp/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]

### Changed
- **Server instructions: unprompted save/recall wording restored up front.** Codex saved 0/6 facts unprompted with the 3.6.0-rc.1 text, 5/6 with 3.5.3's. The first 512 characters now say ALWAYS recall at the start of EVERY conversation and call remember WITHOUT being asked, in the same turn; a `## Remembering` section lists the categories again. Phrase-safety text is unchanged. Still within the 512 / 2,000 character budget (`tests/server-instructions-budget.test.ts` patterns updated for the new wording).
- **Recall downloads much less data on large vaults.** Blind-index queries in `src/subgraph/search.ts` now return fact ids only. Each unique fact's payload is then fetched once, in batches of 100, with at most 6 subgraph queries in flight (the trapdoor batches used to fire all at once). Same candidates in the same order, so ranking is unchanged. On a mocked 1,000-fact vault, a recall dropped from about 6.5 MB to 3.1 MB. Port of the Python change (public #703); internal #666.

### Fixed
Expand Down
12 changes: 6 additions & 6 deletions mcp/src/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
// SERVER_GUIDE, served as the `totalreclaw://guide` resource and the
// `totalreclaw_instructions` prompt.

export const SERVER_INSTRUCTIONS = `TotalReclaw is the user's encrypted long-term memory across their AI apps. Use it unprompted:
- Recall: call totalreclaw_recall at the start of every conversation (query: the user's first message) and whenever past context could help. Use results quietly.
- Remember: call totalreclaw_remember when the user shares a durable fact: preferences, identity, decisions, goals, corrections, projects.
export const SERVER_INSTRUCTIONS = `TotalReclaw is the user's encrypted long-term memory. Use it unprompted:
- Recall: ALWAYS call totalreclaw_recall at the start of EVERY conversation (query: the user's first message) and whenever past context could help. Use quietly.
- Remember: call totalreclaw_remember WITHOUT being asked, same turn, whenever the user shares a durable fact. They never need to say "remember this".
- Safety: the recovery phrase must never enter this chat. Never ask for it, echo it or run a CLI that prints it.

## Recovery phrase (hard rules)
Expand All @@ -22,13 +22,13 @@ export const SERVER_INSTRUCTIONS = `TotalReclaw is the user's encrypted long-ter
- If the user pastes a phrase anyway, tell them it is compromised and they need a fresh one from the browser pair flow (totalreclaw_pair).

## Remembering
Store atomic facts ("User is vegan"). Don't wait for "remember this". Skip small talk, one-off tasks, generic knowledge and secrets (passwords, API keys, tokens). For a correction, store the new fact; dedup is automatic.
Store without being asked whenever the user shares: preferences, personal info, decisions or goals, corrections, important dates or events, tech preferences, project context, opinions or values. If it could help later, store it automatically. Store atomic facts ("User is vegan"). Skip small talk, one-off tasks, generic knowledge and secrets (passwords, API keys, tokens). Correction: store the new fact.

## Setup
A "not_configured" error means no account yet. Call totalreclaw_pair and give the user the link + PIN. The phrase is created or entered in a browser only, never in config, env vars or chat. After Pairing: when the page says "You're all set", ask them to fully quit and reopen this app (or start a new session); until then every tool returns not_configured.
"not_configured" means no account yet. Call totalreclaw_pair and give the user the link + PIN. The phrase is created or entered in a browser only, never in config, env vars or chat. After Pairing, on "You're all set", ask them to fully quit and reopen this app (or start a new session).

## Everything else
Details live in each tool's description. Quick map: "quota_exceeded" -> tell the user, offer totalreclaw_status / totalreclaw_upgrade, stop storing. "pin that" -> totalreclaw_pin. Migrating from another memory tool -> totalreclaw_import_from (dry_run first). "file that under X" / "that's a work thing" -> totalreclaw_set_scope. End of a substantive conversation -> totalreclaw_debrief. Full guide: resource totalreclaw://guide.`;
"quota_exceeded" -> tell the user, offer totalreclaw_status / totalreclaw_upgrade, stop storing. "pin that" -> totalreclaw_pin. Migrating -> totalreclaw_import_from (dry_run first). "file that under X" / "that's a work thing" -> totalreclaw_set_scope. End of a substantive conversation -> totalreclaw_debrief. Guide: totalreclaw://guide.`;

// Keep backward-compat export name (some callers may still reference it)
export const SYSTEM_PROMPT_FRAGMENT = SERVER_INSTRUCTIONS;
Expand Down
4 changes: 2 additions & 2 deletions mcp/tests/server-instructions-budget.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ describe(`first ${FIRST_WINDOW} characters carry the essentials`, () => {
it.each([
['what the server is', /TotalReclaw is the user's encrypted long-term memory/],
['use it unprompted', /unprompted/],
['when to recall', /totalreclaw_recall at the start of every conversation/],
['when to remember', /totalreclaw_remember when the user shares a durable fact/],
['when to recall', /ALWAYS call totalreclaw_recall at the start of EVERY conversation/],
['when to remember', /totalreclaw_remember WITHOUT being asked[^\n]*durable fact/],
['phrase-safety one-liner', /recovery phrase must never enter this chat/],
['never ask, echo or print it', /Never ask for it, echo it or run a CLI that prints it/],
])('%s', (_label, pattern) => {
Expand Down
Loading