supermemory/apps/docs/snippets/agent-prompt.jsx
2026-09-30 14:44:32 -07:00

2 lines
4.2 KiB
JavaScript

export const AGENT_PROMPT =
'# You are onboarding this project to Supermemory\n\nSupermemory is a memory API for AI apps and agents: ingest conversations, documents, files, and URLs; get semantic search, extracted facts, and per-user profiles back. Every call is scoped to one containerTag, with strict isolation between tags.\n\n## What you can call\n\n| Operation | Endpoint | Use when |\n|---|---|---|\n| Add content | POST /v3/documents | Ingest conversations, documents, files, URLs |\n| Search memories | POST /v4/search | Find extracted facts with graph context |\n| Search documents | POST /v3/search | Find raw chunks for RAG grounding |\n| Get profile | POST /v4/profile | Static + dynamic context for a user |\n| List documents | POST /v3/documents/list | Paginate and filter ingested content |\n| Forget memory | DELETE /v4/memories | Soft-delete one fact; JSON body with containerTag plus id or exact content |\n| Forget matching | POST /v4/memories/forget-matching | Soft-delete every fact matching a query or an ids list; dryRun previews first |\n\nTwo processing modes: taskType "memory" (full pipeline: facts, profile, graph — for conversations and personal context) and taskType "superrag" (chunk/embed only, 5x cheaper — for reference material). Search returns memories, documents, or hybrid via searchMode.\n\nFull API reference for agents: https://docs.supermemory.ai/llms.txt\n\nNow work the steps below in order. Do not skip ahead. Stop where a step says to.\n\n## Step 1 — Credentials\n\nAPI key env var: SUPERMEMORY_API_KEY (never hardcode it, never print it back).\n\nKey for this project: YOUR_SUPERMEMORY_API_KEY\n\nIf that reads YOUR_SUPERMEMORY_API_KEY, ask the user to create a key at https://console.supermemory.ai/keys, export it as SUPERMEMORY_API_KEY, and tell you when it is set. Wait for confirmation.\n\n## Step 2 — Install the docs MCP server, then brief the user\n\nAdd this MCP server to your client (public, no auth): https://supermemory.ai/docs/mcp\n\nIt serves search over the full Supermemory docs plus a skill resource with integration rules. Verify it works by searching it for "container tag rules" and confirming a real result returns. Prefer its answers over prior knowledge for anything Supermemory-specific.\n\nThen give the user a short rundown of what Supermemory can do for THIS project, using the table above.\n\n## Step 3 — Scan this repo for integration points\n\nIf this directory has application source, read enough to understand it, then map findings against this table. Cite exact files and lines. If the repo is empty or docs-only, say so and skip to Step 5.\n\n| Code pattern | Replace / augment with |\n|---|---|\n| Chat or agent loop with no memory between sessions | Add each exchange (taskType "memory"), search before the model answers |\n| Full conversation history stuffed into the prompt | Retrieved context from POST /v4/search instead of replaying everything |\n| Homegrown embeddings pipeline (pgvector, pinecone, chroma) | POST /v3/documents + POST /v3/search, no pipeline to maintain |\n| RAG over files or docs sites | Ingest with taskType "superrag", search with searchMode "documents" |\n| Per-user preferences or personalization tables | POST /v4/profile |\n| Multi-tenant SaaS serving many end users | One containerTag per end user (user_123); never share or cross-query tags |\n\n## Step 4 — Propose, then get approval before touching code\n\nPresent findings as a numbered list: file + line range, the endpoint(s) involved, one line on why it is an improvement. Ask which to implement. Do not modify files until the user approves specific items.\n\nWhen implementing, use the official SDK (supermemory on npm and PyPI). The client reads SUPERMEMORY_API_KEY from the environment:\n\n import Supermemory from "supermemory"\n const client = new Supermemory()\n\nContainer tag rules, non-negotiable: singular containerTag (the plural form is deprecated), one tag per end user or project, format ^[a-zA-Z0-9_:-]+$, no cross-tag queries. First write with a new tag creates it.\n\n## Step 5 — Suggest uses tailored to this project\n\nOnly if Step 3 found no application code: propose 3-5 concrete places in the user\'s stack where a memory layer would save effort, each tied to a specific endpoint from the table. Propose, do not build.'