Maintenance in progress: we are indexing a large batch of new skills. Some pages may load slowly or briefly show no results. Nothing is lost, and everything is back to normal within the hour.

Memory Optimization

Summarizing context, pruning history, and managing token budget efficiency.

majiayu000 feedf52 2 files · 1.8 KB Updated 567 repo stars

File contents

memory-optimization Skill

This skill prevents "Context Overflow" and reduces API costs.

1. Summarization Strategies

  • Rolling Summary: Keep the last 10 messages + a summary of everything before.
  • Entity Extraction: Extract key facts ("User chose Redis", "App is on port 3000") and store in semantic/.

2. Context Pruning

  • Irrelevant Files: Only keep file definitions in context if actively editing. Use grep for others.
  • Old Logs: Truncate logs > 50 lines.

3. The "Forget" Protocol

  • When a task is done:
    1. Summarize: Write outcome to AUDIT_LOG.md.
    2. Clear: Remove task-specific context from working memory.
    3. Retain: Keep only global constraints and active file list.

4. Semantic Memory Integration

  • Use Qdrant or PGVector (via MCP) to store embeddings of documentation.
  • Retrieval: Retrieve only the Top-3 relevant chunks for the current query.

majiayu000/claude-skill-registry-data/tree/main/context-management/ops-andreibesleaga-gabbe-11 commit feedf5233e

Frequently asked questions

npx skillmds add majiayu000/memory-optimization-2