Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Compact current session memory into structured text for session recovery. Supports custom descriptions and tagging.
.claude/skills/catlog22-compact/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 412% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 237% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 557% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 105% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 162% | 0% |
The memory:compact command compresses current session working memory into structured text optimized for session recovery, extracts critical information, and saves it to persistent storage via MCP core_memory tool.
Core Philosophy:
--description: Custom session description (optional)--tags: Comma-separated tags for categorization (optional)--force: Skip confirmation, save directlymarkdown## Session ID [WFS-ID if workflow session active, otherwise (none)] ## Project Root [Absolute path to project root, e.g., D:\Claude_dms3] ## Objective [High-level goal - the "North Star" of this session] ## Execution Plan [CRITICAL: Embed the LATEST plan in its COMPLETE and DETAILED form] ### Source: [workflow | todo | user-stated | inferred] <details> <summary>Full Execution Plan (Click to expand)</summary> [PRESERVE COMPLETE PLAN VERBATIM - DO NOT SUMMARIZE] - ALL phases, tasks, subtasks - ALL file paths (absolute) - ALL dependencies and prerequisites - ALL acceptance criteria - ALL status markers ([x] done, [ ] pending) - ALL notes and context Example: ## Phase 1: Setup - [x] Initialize project structure - Created D:\Claude_dms3\src\core\index.ts - Added dependencies: lodash, zod - [ ] Configure TypeScript - Update tsconfig.json for strict mode ## Phase 2: Implementation - [ ] Implement core API - Target: D:\Claude_dms3\src\api\handler.ts - Dependencies: Phase 1 complete - Acceptance: All tests pass </details> ## Working Files (Modified) [Absolute paths to actively modified files] - D:\Claude_dms3\src\file1.ts (role: main implementation) - D:\Claude_dms3\tests\file1.test.ts (role: unit tests) ## Reference Files (Read-Only) [Absolute paths to context files - NOT modified but essential for understanding] - D:\Claude_dms3\.claude\CLAUDE.md (role: project instructions) - D:\Claude_dms3\src\types\index.ts (role: type definitions) - D:\Claude_dms3\package.json (role: dependencies) ## Last Action [Last significant action and its result/status] ## Decisions - [Decision]: [Reasoning] - [Decision]: [Reasoning] ## Constraints - [User-specified limitation or preference] ## Dependencies - [Added/changed packages or environment requirements] ## Known Issues - [Deferred bug or edge case] ## Changes Made - [Completed modification] ## Pending - [Next step] or (none) ## Notes [Unstructured thoughts, hypotheses, debugging trails]
| Field | Purpose | Recovery Value | |-------|---------|----------------| | Session ID | Workflow session identifier (WFS-) | Links memory to specific stateful task execution | | Project Root | Absolute path to project directory | Enables correct path resolution in new sessions | | Objective | Ultimate goal of the session | Prevents losing track of broader feature | | Execution Plan | Complete plan from any source (verbatim) | Preserves full planning context, avoids re-planning | | Working Files | Actively modified files (absolute paths) | Immediately identifies where work was happening | | Reference Files | Read-only context files (absolute paths) | Eliminates re-exploration for critical context | | Last Action | Final tool output/status | Immediate state awareness (success/failure) | | Decisions | Architectural choices + reasoning | Prevents re-litigating settled decisions | | Constraints | User-imposed limitations | Maintains personalized coding style | | Dependencies | Package/environment changes | Prevents missing dependency errors | | Known Issues | Deferred bugs/edge cases | Ensures issues aren't forgotten | | Changes Made | Completed modifications | Clear record of what was done | | Pending | Next steps | Immediate action items | | Notes | Hypotheses, debugging trails | Preserves "train of thought" |
Extract the following from conversation history:
javascriptconst sessionAnalysis = { sessionId: "", // WFS-* if workflow session active, null otherwise projectRoot: "", // Absolute path: D:\Claude_dms3 objective: "", // High-level goal (1-2 sentences) executionPlan: { source: "workflow" | "todo" | "user-stated" | "inferred", content: "" // Full plan content - ALWAYS preserve COMPLETE and DETAILED form }, workingFiles: [], // {absolutePath, role} - modified files referenceFiles: [], // {absolutePath, role} - read-only context files lastAction: "", // Last significant action + result decisions: [], // {decision, reasoning} constraints: [], // User-specified limitations dependencies: [], // Added/changed packages knownIssues: [], // Deferred bugs changesMade: [], // Completed modifications pending: [], // Next steps notes: "" // Unstructured thoughts }
javascript// Helper: Generate execution plan section const generateExecutionPlan = (plan) => { const sourceLabels = { 'workflow': 'workflow (IMPL_PLAN.md)', 'todo': 'todo (TodoWrite)', 'user-stated': 'user-stated', 'inferred': 'inferred' }; // CRITICAL: Preserve complete plan content verbatim - DO NOT summarize return `### Source: ${sourceLabels[plan.source] || plan.source} <details> <summary>Full Execution Plan (Click to expand)</summary> ${plan.content} </details>`; }; const structuredText = `## Session ID ${sessionAnalysis.sessionId || '(none)'} ## Project Root ${sessionAnalysis.projectRoot} ## Objective ${sessionAnalysis.objective} ## Execution Plan ${generateExecutionPlan(sessionAnalysis.executionPlan)} ## Working Files (Modified) ${sessionAnalysis.workingFiles.map(f => `- ${f.absolutePath} (role: ${f.role})`).join('\n') || '(none)'} ## Reference Files (Read-Only) ${sessionAnalysis.referenceFiles.map(f => `- ${f.absolutePath} (role: ${f.role})`).join('\n') || '(none)'} ## Last Action ${sessionAnalysis.lastAction} ## Decisions ${sessionAnalysis.decisions.map(d => `- ${d.decision}: ${d.reasoning}`).join('\n') || '(none)'} ## Constraints ${sessionAnalysis.constraints.map(c => `- ${c}`).join('\n') || '(none)'} ## Dependencies ${sessionAnalysis.dependencies.map(d => `- ${d}`).join('\n') || '(none)'} ## Known Issues ${sessionAnalysis.knownIssues.map(i => `- ${i}`).join('\n') || '(none)'} ## Changes Made ${sessionAnalysis.changesMade.map(c => `- ${c}`).join('\n') || '(none)'} ## Pending ${sessionAnalysis.pending.length > 0 ? sessionAnalysis.pending.map(p => `- ${p}`).join('\n') : '(none)'} ## Notes ${sessionAnalysis.notes || '(none)'}`
Use the MCP core_memory tool to save the structured text:
javascriptmcp__ccw-tools__core_memory({ operation: "import", text: structuredText })
Or via CLI (pipe structured text to import):
bash# Write structured text to temp file, then import echo "$structuredText" | ccw core-memory import # Or from a file ccw core-memory import --file /path/to/session-memory.md
Response Format:
json{ "operation": "import", "id": "CMEM-YYYYMMDD-HHMMSS", "message": "Created memory: CMEM-YYYYMMDD-HHMMSS" }
After successful import, clearly display the Recovery ID to the user:
╔════════════════════════════════════════════════════════════════════════════╗
║ ✓ Session Memory Saved ║
║ ║
║ Recovery ID: CMEM-YYYYMMDD-HHMMSS ║
║ ║
║ To restore: "Please import memory <ID>" ║
║ (MCP: core_memory export | CLI: ccw core-memory export --id <ID>) ║
╚════════════════════════════════════════════════════════════════════════════╝Before generating:
.git/, package.json, .claude/javascript// Convert relative to absolute const toAbsolutePath = (relativePath, projectRoot) => { if (path.isAbsolute(relativePath)) return relativePath; return path.join(projectRoot, relativePath); }; // Example: "src/api/auth.ts" → "D:\Claude_dms3\src\api\auth.ts"
| Category | Examples | Priority | |----------|----------|----------| | Project Config | .claude/CLAUDE.md, package.json, tsconfig.json | High | | Type Definitions | src/types/*.ts, *.d.ts | High | | Related Modules | Parent/sibling modules with shared interfaces | Medium | | Test Files | Corresponding test files for modified code | Medium | | Documentation | README.md, ARCHITECTURE.md | Low |
javascript// Check for active workflow session const manifest = await mcp__ccw-tools__session_manager({ operation: "list", location: "active" }); if (manifest.sessions?.length > 0) { const session = manifest.sessions[0]; const plan = await mcp__ccw-tools__session_manager({ operation: "read", session_id: session.id, content_type: "plan" }); sessionAnalysis.sessionId = session.id; sessionAnalysis.executionPlan.source = "workflow"; sessionAnalysis.executionPlan.content = plan.content; }
javascript// Extract from conversation - look for TodoWrite tool calls // Preserve COMPLETE todo list with all details const todos = extractTodosFromConversation(); if (todos.length > 0) { sessionAnalysis.executionPlan.source = "todo"; // Format todos with full context - preserve status markers sessionAnalysis.executionPlan.content = todos.map(t => `- [${t.status === 'completed' ? 'x' : t.status === 'in_progress' ? '>' : ' '}] ${t.content}` ).join('\n'); }
javascript// Look for explicit plan statements in user messages: // - "Here's my plan: 1. ... 2. ... 3. ..." // - "I want to: first..., then..., finally..." // - Numbered or bulleted lists describing steps const userPlan = extractUserStatedPlan(); if (userPlan) { sessionAnalysis.executionPlan.source = "user-stated"; sessionAnalysis.executionPlan.content = userPlan; }
javascript// If no explicit plan, infer from: // - Task description and breakdown discussion // - Sequence of actions taken // - Outstanding work mentioned const inferredPlan = inferPlanFromDiscussion(); if (inferredPlan) { sessionAnalysis.executionPlan.source = "inferred"; sessionAnalysis.executionPlan.content = inferredPlan; }
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 9,398 | 5,954 | -37% | 1 | 1 | 0% | 1,841 | 3,734 | +103% | 0 | 0 | — |
case-02 | fail→fail | 9,970 | 25,854 | +159% | 1 | 1 | 0% | 1,764 | 3,728 | +111% | 0 | 0 | — |
case-03 | fail→fail | 7,136 | 6,073 | -15% | 1 | 1 | 0% | 1,184 | 3,679 | +211% | 0 | 0 | — |
case-04 | fail→pass | 4,368 | 3,233 | -26% | 1 | 1 | 0% | 772 | 3,954 | +412% | 0 | 0 | — |
case-05 | pass→pass | 8,915 | 3,095 | -65% | 1 | 1 | 0% | 1,650 | 3,883 | +135% | 0 | 0 | — |
case-06 | pass→pass | 4,233 | 3,105 | -27% | 1 | 1 | 0% | 767 | 3,874 | +405% | 0 | 0 | — |
case-07 | fail→pass | 7,878 | 4,994 | -37% | 1 | 1 | 0% | 1,243 | 4,192 | +237% | 0 | 0 | — |
case-08 | fail→pass | 3,438 | 3,842 | +12% | 1 | 1 | 0% | 618 | 4,061 | +557% | 0 | 0 | — |
case-09 | fail→pass | 10,418 | 2,203 | -79% | 1 | 1 | 0% | 1,779 | 3,644 | +105% | 0 | 0 | — |
case-10 | fail→pass | 9,458 | 2,562 | -73% | 1 | 1 | 0% | 1,427 | 3,733 | +162% | 0 | 0 | — |
case-11 | fail→pass | 4,475 | 1,980 | -56% | 1 | 1 | 0% | 733 | 3,637 | +396% | 0 | 0 | — |
case-12 | fail→pass | 5,721 | 2,908 | -49% | 1 | 1 | 0% | 930 | 3,852 | +314% | 0 | 0 | — |
case-13 | fail→fail | 15,384 | 2,161 | -86% | 1 | 1 | 0% | 2,236 | 3,578 | +60% | 0 | 0 | — |
case-14 | fail→fail | 10,790 | 4,134 | -62% | 1 | 1 | 0% | 1,711 | 3,967 | +132% | 0 | 0 | — |
case-15 | fail→pass | 6,755 | 3,047 | -55% | 1 | 1 | 0% | 1,172 | 3,847 | +228% | 0 | 0 | — |
case-16 | fail→pass | 5,906 | 2,903 | -51% | 1 | 1 | 0% | 1,135 | 3,904 | +244% | 0 | 0 | — |
case-17 | fail→pass | 4,862 | 2,214 | -54% | 1 | 1 | 0% | 768 | 3,599 | +369% | 0 | 0 | — |
case-18 | fail→fail | 6,459 | 2,044 | -68% | 1 | 1 | 0% | 588 | 3,599 | +512% | 0 | 0 | — |
case-19 | fail→pass | 2,976 | 5,983 | +101% | 1 | 1 | 0% | 615 | 4,175 | +579% | 0 | 0 | — |
case-20 | pass→pass | 5,952 | 5,205 | -13% | 1 | 1 | 0% | 1,185 | 4,317 | +264% | 0 | 0 | — |
case-21 | pass→pass | 13,054 | 13,473 | +3% | 1 | 1 | 0% | 2,779 | 6,196 | +123% | 0 | 0 | — |
case-22 | pass→pass | 9,082 | 2,797 | -69% | 1 | 1 | 0% | 1,678 | 3,713 | +121% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 19 counted toward the lift figure. The other 3 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +50 percentage points is the difference between those two pass rates over the 19 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.