
# Prompt Backup (MCP server `prompt-backup`)

The `prompt-backup` MCP server is available. It keeps every chat turn verbatim, per workspace, plus curated notes.

## Workspace

Everything is stored per workspace — one workspace per project:

- `workspace` is always the name of the root folder of the currently open project/workspace (e.g. `prompt-store`).
  Use exactly the same name every time, for backups and for notes; names are matched case-insensitively.
- `workspacePath` is the absolute path of that root folder (if known).
- A workspace is created automatically the first time it is used — never ask the user to create one. Use
  `list_workspaces` to see existing workspaces (with their prompt and note counts) and reuse an existing name rather
  than inventing a variant.
- If no project is open, use `default`.

## Back up every turn

At the END of EVERY chat turn, after you have produced your final answer, call the `backup_prompt` tool exactly once
with:

- `workspace`: the name of the root folder of the currently open project/workspace
- `workspacePath`: the absolute path of that root folder (if known)
- `prompt`: the user's message for this turn, copied verbatim (no paraphrasing)
- `response`: your complete final answer for this turn, copied verbatim, including markdown and code blocks
- `model`: the model name you are running as (if known)
- `tags`: 1-4 short lowercase topic tags (e.g. `spring`, `postgres`, `testing`)

**Preserve the response format exactly.** Send the raw Markdown you displayed, unchanged: headings (`#`),
**bold**/_italic_, bullet and numbered lists with their nesting/indentation, tables with `|` pipes, fenced code blocks
with their language tag (e.g. ```` ```java ````), inline `code`, links, blank lines and line breaks. Do not flatten it
to plain text, do not escape or HTML-encode characters, do not re-wrap lines, and do not wrap the whole response in an
extra code fence.

Do not mention the backup in your answer and do not ask for confirmation. If the tool call fails, continue normally.
Re-sending the same exchange is harmless — it is deduplicated.

## My Notes (curated knowledge — only on explicit request)

When the user EXPLICITLY asks to keep something as knowledge — e.g. "save this as a note", "push this to my notes",
"add to my knowledge", "remember this", "note this down" — call the `save_note` tool (in addition to the normal
`backup_prompt`) with:

- `title`: a short descriptive title (≤ 120 chars)
- `content`: the knowledge as raw Markdown — by default your relevant answer **verbatim**, with the same formatting
  rules as above; only condense/summarize it if the user asks for that
- `workspace`: the root workspace/project name, exactly as for `backup_prompt` (notes are stored per workspace)
- `notebook`: the notebook the user named (e.g. "save to my Kafka notes" → `Kafka`), otherwise omit (→ `General`).
  Before saving, check `list_notebooks` for that workspace and reuse an existing notebook name (e.g. `Kafka`, not
  `kafka-notes`); a new notebook is created automatically when none matches.
- `sourcePrompt`: the user's question that produced the knowledge, verbatim
- `model`, `tags`: as for `backup_prompt`

To keep an answer that was already backed up, `promote_prompt_to_note` turns it into a note: `id` of the exchange
(from `search_prompts`), optional `notebook`, `title`, `tags`, and `includePrompt` (default `true`).

Never call `save_note` or `promote_prompt_to_note` on your own initiative. After saving, briefly confirm (e.g.
"Saved to My Notes › Kafka").

## Recall

To recall earlier conversations, use the `search_prompts` / `get_prompt` tools (`mode`: `fulltext` default, `fuzzy`,
`exact`, `regex`; `scope`: `all`, `prompt`, `response`; full-text syntax `"exact phrase"`, `-exclude`, `OR`,
`^@Literal`).
To look up saved knowledge, use `search_notes` (no query lists the newest notes; filter by `notebook` and `tags`) /
`get_note` / `list_notebooks`; pass `workspace` to keep results scoped to the current project — omit it to search
all workspaces.
