Mémoire - Contexte Long-terme

VérifiéSûr

Lit les fichiers de mémoire à long terme (errors.md, context.md, files.md) pour accéder au contexte historique, aux références de code et aux enregistrements de correction d'erreurs. Utile après un compactage de session ou lorsqu'il faut se souvenir de discussions antérieures, éviter de répéter des erreurs, ou retrouver des motifs de code.

Spar Skills Guide Bot
ProductiviteIntermédiaire
8002/06/2026
Claude Code
#memory#context#long-term#compact#error-prevention

Recommandé pour

Notre avis

Lit les fichiers de mémoire à long terme (erreurs, contexte, fichiers) pour restaurer l'historique après une compaction de session, évitant ainsi la perte d'informations importantes.

Points forts

  • Préserve automatiquement les détails critiques à travers les compacts
  • Priorise les corrections d'erreurs pour éviter les répétitions
  • Truncation intelligente pour économiser le contexte
  • Consultation sélective par fichier thématique

Limites

  • Nécessite une configuration préalable avec le script memory.py
  • Fonctionne uniquement dans l'écosystème Claude Code
  • La troncature peut perdre des détails anciens si le fichier est très volumineux
Quand l'utiliser

Utilisez cette compétence après chaque compact ou lorsque vous reprenez une session pour récupérer le contexte historique et éviter les erreurs passées.

Quand l'éviter

Ne l'utilisez pas si la session est très courte ou si vous voulez repartir de zéro sans historique.

Analyse de sécurité

Sûr
Score qualité90/100

The skill instructs running a local Python script to read specific memory files, with no destructive, exfiltrating, or obfuscated actions. It does not involve network access, secret handling, or disabling safety features.

Aucun point d'attention détecté

Exemples

Read error memory after compact
Read my error memory to recall past mistakes before fixing this test failure.
Read context memory for project background
Read context.md to remember the project requirements and previous discussions.
Read all memory files for full rebuild
Read all memory files to get the complete historical context after compact.

name: memory description: Read long-term memory files to get historical context, code references, and error fix records. Use when user wants to read memory, get context, check history, avoid repeating errors.

Memory - Long-term Context

Read the current session's long-term memory files to access historical context preserved across compacts.

Background

Claude Code's /compact compresses conversations to save context. Repeated compaction causes "memory decay" - important early details gradually get lost.

Max's memory system automatically saves accumulated content to files during each compact, ensuring important information is never lost.

Memory Files

| File | Content | Priority | |------|---------|----------| | errors.md | Error fix records | Highest - Avoid repeating mistakes | | context.md | User messages + technical concepts | Medium - Full background | | files.md | Code file references | Low - Only when needed |

Instructions

Use the memory.py script to read files with automatic truncation (large files are trimmed to last ~15000 chars to save context):

# Read errors.md only (default, recommended)
cd /path/to/skills/memory && uv run memory.py errors.md

# Read specific files
cd /path/to/skills/memory && uv run memory.py errors.md context.md

# Read all files
cd /path/to/skills/memory && uv run memory.py all

The script automatically:

  • Reads from ~/.claude/projects/$MAX_PROJECT_ID/max/$MAX_SESSION_ID/memory/
  • Truncates files > 15000 chars (keeps most recent content)
  • Skips non-existent files

When to Read Memory

After compact - When you see "Earlier details saved to..." in the summary:

  • Always read errors.md first - Critical to avoid repeating past mistakes

On demand - Read specific files based on the situation:

| Situation | Command | |-----------|---------| | Encountering errors / Tests failing | uv run memory.py errors.md | | Need to recall previous discussions | uv run memory.py context.md | | Reusing code patterns / Finding files | uv run memory.py files.md |

Notes

  • Memory files are automatically updated during each /compact
  • Files are appended with timestamps, newest content at the bottom
  • Large files are truncated to ~15000 chars (≈3% of context) to prevent context overflow
Skills similaires