New to Claude Skills? Learn how to install them →

mem0ai on GitHub

Mem0 Pin

Free

Protect critical memories from being pruned.

by mem0ai63k stars on mem0ai/mem0
Updated Aug 7, 2026
Get this skill

Free · Opens the source repo

What Mem0 Pin does

Mem0 Pin is a specialized tool designed to help users mark certain memories as high-priority within the Mem0 AI framework. This skill is particularly useful in scenarios where specific memories, such as architectural decisions, security constraints, or immutable team conventions, must be preserved and protected from the automatic pruning that occurs during dream consolidation. By pinning these memories, users can ensure that vital information remains accessible and intact for future reference.

The process of pinning a memory involves a straightforward four-step execution. First, users can either search for a memory using a query or provide a memory ID directly. Once the desired memory is identified, the skill retrieves its current content and metadata. The next step involves updating the memory to include a pin marker, which serves as an indicator that the memory is critical and should not be removed. For new memories, users can add them directly with the pin marker included.

Unpinning a memory is equally simple; users can remove the pin marker when they no longer need the memory to be protected. This flexibility allows for dynamic management of memory priorities, making it easy to adapt as project needs evolve. Overall, Mem0 Pin is an essential tool for developers and designers who need to maintain a clear record of important decisions and constraints without the risk of losing them to the system's natural memory management processes.

When to use it

Use Mem0 Pin when you have important memories that must remain accessible, such as key decisions or guidelines.

When not to use it

Avoid using this skill for transient or less important memories that do not require long-term retention.

What you can build with it

Preserving Architectural Decisions

When working on a software project, use Mem0 Pin to ensure that key architectural decisions are retained for future reference.

Maintaining Security Constraints

Pin security constraints that are critical to the project, ensuring they are not lost during memory pruning.

Documenting Team Conventions

Use the skill to pin team conventions that guide development practices, keeping them accessible for all team members.

How to install Mem0 Pin

View source

1. Install with the skills CLI

npx skills add mem0ai/mem0/mem0-pin --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by mem0ai

Mem0 Pin

Pin a memory to mark it as high-priority and protect from pruning.

Execution

Step 1: Find the memory

The user provides either a search query or memory ID.

If memory ID:

  • Call get_memory with the ID.

If search query:

  • Call search_memories with the query, filters={"AND": [{"user_id": "<id>"}, {"app_id": "<pid>"}]}, top_k=5.
  • Show numbered list with content previews.
  • Ask: "Which memory to pin? Enter a number."

Step 2: Read current content

Call get_memory with the selected memory ID. Store:

  • original_text — the memory's text content
  • original_metadata — the existing metadata dict

Step 3: Pin it

The update_memory tool updates a memory by id. To pin durably, append a pin marker to the text so it travels with the memory:

pinned_text = "[PINNED] " + original_text if not original_text.startswith("[PINNED]") else original_text
update_memory(id=<selected_id>, text=pinned_text)

For new memories (user wants to pin text that isn't stored yet):

  1. Call add_memory with:
    • text="[PINNED] <the user's text>"
    • user_id=<active_user_id>
    • app_id=<active_project_id>
    • metadata={"pinned": true, "type": "decision", "confidence": 1.0}
    • infer=False
  2. The response contains event_id. Call get_event_status(event_id=<event_id>) once to retrieve the memory ID, then confirm.

Step 4: Confirm

Pinned: "<memory content, first 80 chars>"
Memory ID: <id>

Append ... only if content exceeds 80 characters.

Unpin

If the user says "unpin":

  1. Call get_memory to read current content.
  2. Remove the pin marker from the text:
    unpinned_text = original_text.removeprefix("[PINNED] ")
    update_memory(memory_id=<id>, text=unpinned_text)
    
  3. Print: Unpinned: "<content>..."

Output formatting

IMPORTANT: Do NOT use markdown in your output. OpenCode TUI renders text verbatim — markdown like bold, ## headers, and | table | syntax appears as raw characters. Use plain text with indentation for structure. Use dashes for lists. Use spaces to align columns instead of markdown tables.

Frequently asked questions about Mem0 Pin

Similar skills