Memory System

VerifiedSafe

Manages persistent memory across sessions using a tiered global and project architecture. Enables saving, recalling, and forgetting facts and events, helping maintain context and user preferences over time.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#memory#persistence#context#facts#events

Recommended for

Automated summary

Provides a tiered memory system to persist information across sessions using global and project scopes.

Strengths

  • Persistent memory across sessions
  • Hierarchical scope (global vs project)
  • Automatic event logging
  • Explicit commands for control

Limitations

  • Requires manual commands to remember/forget
  • Monthly fact consolidation needed
  • May not be supported by all tools
When to use it

Use when the AI assistant needs to remember user preferences, project facts, or context across multiple sessions.

When not to use it

Avoid for transient conversations that don't need persistence, or when simplicity is preferred.

Security analysis

Safe
Quality score90/100

The skill does not contain destructive, exfiltrating, or obfuscated instructions. It uses Bash only to run transparent Python helper scripts that read/write local JSON files. No network access, no arbitrary command execution beyond its defined functions.

No concerns found

How this analysis is made

Examples

Remember a user preference
Remember that I use pnpm as my package manager.
Recall stored information
What do you know about my project setup?
Forget a fact
Forget that I prefer npm over pnpm.

name: memory-system description: Read and write to the memory system. Use when user says "remember this", "what do you know about", "forget", or when other skills need to persist information. allowed-tools: Read, Write, Glob, Grep, Bash

Memory System

Manage persistent memory across sessions with tiered global + project architecture.

Memory Architecture

Scope Tiers

┌─────────────────────────────────────────────────┐
│                 GLOBAL MEMORY                    │
│            ~/.claude/memory/                     │
│  - User preferences across all projects          │
│  - Universal patterns and learnings              │
│  - Cross-project insights                        │
└─────────────────────────────────────────────────┘
                      ↓ inherits
┌─────────────────────────────────────────────────┐
│                PROJECT MEMORY                    │
│           .claude/memory/                        │
│  - Project-specific facts                        │
│  - Codebase patterns                             │
│  - Local context                                 │
└─────────────────────────────────────────────────┘

Access Priority

  1. Project facts - checked first (most specific)
  2. Global facts - fallback (universal knowledge)
  3. Merged context - combines both for full picture

Temperature Tiers

Hot Memory (Context Window)

  • Current conversation
  • Loaded at session start from active_context.md
  • Fastest access
  • Ephemeral (lost on session end unless saved)

Warm Memory (JSON/JSONL)

  • Recent events: .claude/memory/events/
  • Cached context: .claude/memory/context-cache.json
  • Facts: .claude/memory/facts/
  • Access within seconds
  • Persists across sessions

Cold Memory (Archives)

  • CLAUDE.md - Project instructions
  • Session archives: .claude/memory/session_logs/
  • Historical patterns
  • Requires explicit retrieval

Commands

/remember <fact> or /remember --global <fact>

Save a fact to memory.

Scope:

  • Default: Project memory (.claude/memory/facts/)
  • --global: Global memory (~/.claude/memory/facts/)

Process:

  1. Parse the fact
  2. Generate unique ID
  3. Categorize (preference, pattern, learning, etc.)
  4. Write to .claude/memory/facts/
  5. Update active_context.md if relevant

Fact Schema:

{
  "id": "fact-uuid",
  "timestamp": "ISO-8601",
  "category": "preference|pattern|learning|context",
  "content": "The fact to remember",
  "source": "user|pattern-detector|session",
  "confidence": 1.0,
  "last_accessed": null,
  "access_count": 0
}

/recall <query>

Search memory for relevant information.

Process:

  1. Search facts by keyword
  2. Search events for context
  3. Check active_context.md
  4. Return ranked results

/forget <fact-id|query>

Remove information from memory.

Process:

  1. Find matching facts
  2. Confirm with user
  3. Archive (don't delete)
  4. Update active_context.md

Event Logging

All significant events are logged to .claude/memory/events/{date}.jsonl:

{"timestamp": "...", "event": "session_start", "data": {...}}
{"timestamp": "...", "event": "tool_use", "tool": "Edit", "file": "src/app.ts"}
{"timestamp": "...", "event": "pattern_detected", "pattern_id": "..."}
{"timestamp": "...", "event": "session_end", "summary": "..."}

Active Context

The active_context.md file is loaded at session start:

# Active Context

## Recent Learnings
- {Learning 1}
- {Learning 2}

## User Preferences
- Prefers TypeScript over JavaScript
- Uses pnpm as package manager

## Current Focus
- Working on authentication feature
- Last session: Implemented login UI

## Quick Notes
- {Note 1}

Memory Maintenance

Consolidation (Weekly)

  • Merge similar facts
  • Archive old events
  • Update active_context.md

Cleanup (Monthly)

  • Remove stale facts (not accessed in 60 days)
  • Compress event logs
  • Update patterns

Helper Scripts

memory_read.py

#!/usr/bin/env python3
import json
import sys
from pathlib import Path

def read_memory(query, memory_dir=".claude/memory"):
    results = []

    # Search facts
    facts_dir = Path(memory_dir) / "facts"
    for fact_file in facts_dir.glob("*.json"):
        fact = json.loads(fact_file.read_text())
        if query.lower() in fact["content"].lower():
            results.append(fact)

    return sorted(results, key=lambda x: x.get("access_count", 0), reverse=True)

if __name__ == "__main__":
    query = sys.argv[1] if len(sys.argv) > 1 else ""
    for result in read_memory(query):
        print(json.dumps(result))

memory_write.py

#!/usr/bin/env python3
import json
import sys
import uuid
from datetime import datetime
from pathlib import Path

def write_fact(content, category="learning", memory_dir=".claude/memory"):
    fact = {
        "id": f"fact-{uuid.uuid4().hex[:8]}",
        "timestamp": datetime.utcnow().isoformat() + "Z",
        "category": category,
        "content": content,
        "source": "user",
        "confidence": 1.0,
        "access_count": 0
    }

    facts_dir = Path(memory_dir) / "facts"
    facts_dir.mkdir(parents=True, exist_ok=True)

    fact_file = facts_dir / f"{fact['id']}.json"
    fact_file.write_text(json.dumps(fact, indent=2))

    return fact

if __name__ == "__main__":
    content = sys.argv[1] if len(sys.argv) > 1 else ""
    category = sys.argv[2] if len(sys.argv) > 2 else "learning"
    fact = write_fact(content, category)
    print(json.dumps(fact))

Usage

# Remember a fact (project scope)
/remember "User prefers dark mode themes"

# Remember globally
/remember --global "Always use TypeScript"

# Search memory
/recall "user preferences"

# Forget a fact
/forget fact-abc123

# Forget by query
/forget "outdated preference"

Output Format

## Memory: [action]

**Action**: [remembered/recalled/forgotten]
**Scope**: [project/global]

### Details
[Fact content or search results]

### Location
[File path where stored/found]

Error Handling

| Error | Cause | Resolution | |-------|-------|------------| | Memory dir not found | Not initialized | Run /setup to create structure | | JSON parse error | Corrupted fact file | Repair or delete corrupted file | | Duplicate fact | Already exists | Skip or update existing | | Fact not found | Invalid ID or query | Check ID or broaden search | | Write permission denied | File system issue | Check directory permissions |

Fallback: If structured memory fails, fall back to CLAUDE.md for critical facts.

Safety Constraints

  • Never store sensitive data (passwords, keys)
  • Validate JSON before writing
  • Maintain backup before bulk operations
  • Respect .gitignore for local memory

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/memory-system-mmk3nhmp/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/memory-system-mmk3nhmp' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/memory-system-mmk3nhmp/download' --output '.skill-downloads/memory-system-mmk3nhmp/SKILL.md.part' && mv '.skill-downloads/memory-system-mmk3nhmp/SKILL.md.part' '.skill-downloads/memory-system-mmk3nhmp/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Write, Glob, Grep, Bash

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/memory-system-mmk3nhmp/SKILL.md' && test -s '.skill-downloads/memory-system-mmk3nhmp/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/memory-system' && cp -R '.skill-downloads/memory-system-mmk3nhmp' '.claude/skills/memory-system'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/memory-system-mmk3nhmp'

openskills read 'memory-system-mmk3nhmp'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/memory-system-mmk3nhmp/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills