skills/memories-mcp/SKILL.md
MCP server integration for memories.sh — the persistent memory layer for AI agents. Use when: (1) Configuring the memories.sh MCP server for any client (Claude Code, Cursor, Windsurf, VS Code, v0, Claude Desktop, OpenCode, Factory), (2) Using MCP tools to store, search, retrieve memories, run lifecycle session workflows, or manage reminders, (3) Understanding get_context vs search_memories vs list_memories, (4) Working with streaming memory tools for SSE content, (5) Troubleshooting MCP connection issues, (6) Choosing between cloud MCP (HTTP) and local MCP (stdio) transports.
npx skillsauth add webrenew/memories memories-mcpInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Connect AI agents to the memories.sh memory layer via MCP (Model Context Protocol).
The CLI is the primary interface for memories.sh — use
memories generateto create native config files for each tool. The MCP server is a fallback for real-time access when static configs aren't enough. It's also the best choice for browser-based agents (v0, bolt.new, Lovable) where the CLI can't run.
# Local stdio transport (most reliable)
memories serve
# HTTP/SSE transport (for web clients like v0)
memories serve --sse --port 3030
# Cloud-hosted (no local install needed)
# Endpoint: https://memories.sh/api/mcp
# Header: Authorization: Bearer YOUR_KEY
get_contextAlways start with get_context — it returns active rules + relevant memories in one call:
get_context({ query: "authentication flow" })
→ ## Active Rules
→ - Always use TypeScript strict mode
→ ## Relevant to: "authentication flow"
→ 💡 DECISION (P) abc123: Chose JWT for stateless auth
Leave query empty to get just rules. Use limit to control memory count (default: 10).
For lifecycle-aware callers on local CLI MCP, pass compaction/session hints:
get_context({
query: "checkout timeout",
session_id: "sess_123",
budget_tokens: 6000,
turn_count: 6,
turn_budget: 24,
last_activity_at: "2026-02-26T23:00:00.000Z",
inactivity_threshold_minutes: 45
})
These hints let the server trigger write-ahead checkpointing before destructive compaction.
When relationship extraction is enabled server-side, get_context may also return conflicts[] for contradiction-linked memories. Treat these as clarification prompts before taking irreversible actions.
| Goal | Tool | When |
|------|------|------|
| Start a task | get_context | Beginning of any task — gets rules + relevant context |
| Save knowledge | add_memory | After learning something worth persisting |
| Resolve contradictory context | get_context | If conflicts[] is present, ask a disambiguating question and persist the answer |
| Find specific info | search_memories | Full-text search with prefix matching |
| Browse recent | list_memories | Explore what's stored, filter by type/tags |
| Get coding standards | get_rules | When you only need rules, not memories |
| Update a memory | edit_memory | Fix content, change type, update tags |
| Remove a memory | forget_memory | Soft-delete (recoverable) |
| Bulk remove memories | bulk_forget_memories | Filtered mass soft-delete by type, tags, age, pattern |
| Reclaim storage | vacuum_memories | Permanently purge all soft-deleted records |
| Start lifecycle session (local) | start_session | Begin explicit session tracking |
| Persist turn checkpoint (local) | checkpoint_session | Save meaningful event/checkpoint |
| End session (local) | end_session | Close or compact active session |
| Read/create session snapshot (local) | snapshot_session | Capture raw transcript snapshot |
| Run consolidation (local) | consolidate_memories | Merge duplicates and supersede stale truths |
| Add reminder (local) | add_reminder | Create cron-based reminder in local CLI DB |
| Run reminders (local) | run_due_reminders | Emit due reminders and advance schedule |
| Manage reminders (local) | list_reminders, enable_reminder, disable_reminder, delete_reminder | Inspect and control reminder lifecycle |
When using add_memory, pick the right type:
get_context)category and metadata)global: true in add_memoryproject_id: "github.com/org/repo" in add_memory (or start_memory_stream) to force project scope when the MCP process is running outside that repoDo not send both global: true and project_id in the same call.
For collecting content from SSE sources (v0 artifacts, streaming responses):
start_memory_stream({ type?, tags?, global?, project_id? }) → returns stream_idappend_memory_chunk({ stream_id, chunk }) (repeat for each piece)finalize_memory_stream({ stream_id }) → creates memory + triggers embeddingcancel_memory_stream({ stream_id }) → discard if abortedThese tools are currently available when running memories serve locally:
start_session({ title?, client?, user_id?, metadata?, global?, project_id? })checkpoint_session({ session_id, content, role?, kind?, token_count?, turn_index?, is_meaningful? })end_session({ session_id, status? })snapshot_session({ session_id, source_trigger?, slug?, transcript_md?, message_count?, meaningful_only? })consolidate_memories({ types?, include_global?, global_only?, project_id?, dry_run?, model? })For clients that support MCP resources:
| URI | Content |
|-----|---------|
| memories://rules | All active rules as markdown |
| memories://recent | 20 most recent memories |
| memories://project/{id} | Memories for a specific project |
| Transport | Use Case | Command |
|-----------|----------|---------|
| stdio | Claude Code, Cursor, local tools | memories serve |
| HTTP/SSE | v0, web-based agents, remote | memories serve --sse --port 3030 |
| Cloud | No local install, cross-device | https://memories.sh/api/mcp + Authorization: Bearer KEY |
Local-only tools: lifecycle + reminders + streaming. Hosted MCP focuses on tenant-routed core memory tools.
tools
OpenClaw integration workflows for memories.sh. Use when: (1) Setting up OpenClaw with memories.sh (`openclaw onboard`, `memories init`), (2) Syncing OpenClaw workspace contracts (`~/.openclaw/workspace/AGENTS.md`, `SOUL.md`, `TOOLS.md`, `IDENTITY.md`, `USER.md`, `HEARTBEAT.md`, `BOOTSTRAP.md`, memory files, and skills), (3) Running lifecycle memory file workflows via `memories openclaw memory bootstrap|flush|snapshot|sync`, (4) Scheduling reminder prompts for OpenClaw refresh via `memories reminders`, (5) Troubleshooting OpenClaw workspace drift, missing skills, or path/config mismatches, (6) Updating OpenClaw runbooks or `llms.txt` guidance.
tools
Build against the memories.sh SDK packages in application code. Use when working with `@memories.sh/core` or `@memories.sh/ai-sdk`, including: (1) Initializing `MemoriesClient`, (2) Reading, writing, searching, or editing memories from backend code, route handlers, workers, or scripts, (3) Integrating memories with the Vercel AI SDK via `memoriesMiddleware`, `memoriesTools`, `preloadContext`, or `createMemoriesOnFinish`, (4) Choosing and applying `tenantId` / `userId` / `projectId` scoping, (5) Managing SDK skill files or management APIs, or (6) Debugging memories SDK usage in TypeScript or JavaScript applications. Use `memories-cli` for CLI workflows, `memories-mcp` for MCP setup, and `memories-dev` for monorepo internals.
tools
Developer guide for contributing to and extending the memories.sh codebase. Use when: (1) Understanding the memories.sh architecture and lifecycle model, (2) Adding new CLI commands or MCP tools, (3) Modifying the memory storage layer (SQLite/libSQL), (4) Working on the web dashboard (Next.js/Supabase), (5) Adding new generation targets for AI tools, (6) Extending cloud sync, session compaction, or embeddings functionality, (7) Debugging build, test, or deployment issues in the monorepo.
tools
CLI reference and workflows for memories.sh — the persistent memory layer for AI agents. Use when: (1) Running memories CLI commands to add, search, edit, or manage memories, (2) Managing lifecycle workflows (session/checkpoint/compaction/consolidation/OpenClaw memory files), (3) Setting up memories.sh in a new project (memories init), (4) Generating AI tool config files (CLAUDE.md, .cursor/rules, etc.), (5) Importing existing rules from AI tools (memories ingest), (6) Managing cloud sync, embeddings, git hooks, or reminders, (7) Troubleshooting with memories doctor, (8) Working with memory templates, links, history, tags, or reminder schedules.