Agent skill

Compact

by catlog22 in catlog22/Claude-Code-Workflow

Compact current session memory into structured text for session recovery.

MITAuto-check passedAgent Workflows

Install Compact

skills CLI
$ npx skills add catlog22/Claude-Code-Workflow --skill compact -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install catlog22/Claude-Code-Workflow compact --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/catlog22/Claude-Code-Workflow.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.codex/skills/memory-compact .claude/skills/compact && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
compact
GitHub stars
2.1k
Token cost
~3.2k tokens
SKILL.md length
562 words
Files
1
Skills in repo
82
Repo updated
First seen
Licence
MIT

At a glance

Compact current session memory into structured text for session recovery.

  • Works in 9 steps: Overview → Parameters → Structured Output Format → …
  • Tasks that involve Agent memory
  • SKILL.md covers 1. Overview, 2. Parameters, 3. Structured Output Format and 4. Field Definitions, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Compact is an agent skill from catlog22/Claude-Code-Workflow. Compact current session memory into structured text for session recovery. Supports custom descriptions and tagging.

Its SKILL.md is about 3.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Agent memory. The repository describes itself as: JSON-driven multi-agent cadence-team development framework with intelligent CLI orchestration (Gemini/Qwen/Codex), context-first architecture, and automated workflow execution. The licence is MIT.

When your agent uses it

  • Tasks that involve Agent memory

Example prompts

  • “/compact”

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Overview
  2. Parameters
  3. Structured Output Format
  4. Field Definitions
  5. Execution Flow
  6. Quality Checklist
  7. Path Resolution Rules
  8. Plan Detection (Priority Order)
  9. Notes

What it can do on your machine

Read from SKILL.md and the folder at commit 07491b0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are javascript, markdown, bash and json).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Compact loads about 3.2k tokens when it runs. Until then it costs about 31 tokens; SKILL.md has 562 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~31
When it runs · the whole SKILL.md, loaded when a task matches
~3.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from catlog22/Claude-Code-Workflow at commit 07491b0, republished under its MIT licence (© catlog22). 562 words, ~3,212 tokens.

Download SKILL.mdSave it as .claude/skills/compact/SKILL.md (or your agent's skills folder).
name
compact
description
Compact current session memory into structured text for session recovery. Supports custom descriptions and tagging.
argument-hint
[--description="..."] [--tags=<tag1,tag2>] [--force]

Memory Compact Command (/memory:compact)

1. Overview

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:

  • Session Recovery First: Capture everything needed to resume work seamlessly
  • Minimize Re-exploration: Include file paths, decisions, and state to avoid redundant analysis
  • Preserve Train of Thought: Keep notes and hypotheses for complex debugging
  • Actionable State: Record last action result and known issues

2. Parameters

  • --description: Custom session description (optional)
    • Example: "completed core-memory module"
    • Example: "debugging JWT refresh - suspected memory leak"
  • --tags: Comma-separated tags for categorization (optional)
  • --force: Skip confirmation, save directly

3. Structured Output Format

markdown
## 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]

4. Field Definitions

FieldPurposeRecovery Value
Session IDWorkflow session identifier (WFS-*)Links memory to specific stateful task execution
Project RootAbsolute path to project directoryEnables correct path resolution in new sessions
ObjectiveUltimate goal of the sessionPrevents losing track of broader feature
Execution PlanComplete plan from any source (verbatim)Preserves full planning context, avoids re-planning
Working FilesActively modified files (absolute paths)Immediately identifies where work was happening
Reference FilesRead-only context files (absolute paths)Eliminates re-exploration for critical context
Last ActionFinal tool output/statusImmediate state awareness (success/failure)
DecisionsArchitectural choices + reasoningPrevents re-litigating settled decisions
ConstraintsUser-imposed limitationsMaintains personalized coding style
DependenciesPackage/environment changesPrevents missing dependency errors
Known IssuesDeferred bugs/edge casesEnsures issues aren't forgotten
Changes MadeCompleted modificationsClear record of what was done
PendingNext stepsImmediate action items
NotesHypotheses, debugging trailsPreserves "train of thought"

5. Execution Flow

Step 1: Analyze Current Session

Extract the following from conversation history:

javascript
const 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
}
Step 2: Generate Structured Text
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)'}`
Step 3: Import to Core Memory via MCP

Use the MCP core_memory tool to save the structured text:

javascript
mcp__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"
}
Step 4: Report Recovery ID

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>)         ║
╚════════════════════════════════════════════════════════════════════════════╝
Show full SKILL.md (239 more words)Show less

6. Quality Checklist

Before generating:

  • Session ID captured if workflow session active (WFS-*)
  • Project Root is absolute path (e.g., D:\Claude_dms3)
  • Objective clearly states the "North Star" goal
  • Execution Plan: COMPLETE plan preserved VERBATIM (no summarization)
  • Plan Source: Clearly identified (workflow | todo | user-stated | inferred)
  • Plan Details: ALL phases, tasks, file paths, dependencies, status markers included
  • All file paths are ABSOLUTE (not relative)
  • Working Files: 3-8 modified files with roles
  • Reference Files: Key context files (CLAUDE.md, types, configs)
  • Last Action captures final state (success/failure)
  • Decisions include reasoning, not just choices
  • Known Issues separates deferred from forgotten bugs
  • Notes preserve debugging hypotheses if any

7. Path Resolution Rules

Project Root Detection
  1. Check current working directory from environment
  2. Look for project markers: .git/, package.json, .claude/
  3. Use the topmost directory containing these markers
Absolute Path Conversion
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"
Reference File Categories
CategoryExamplesPriority
Project Config.claude/CLAUDE.md, package.json, tsconfig.jsonHigh
Type Definitionssrc/types/*.ts, *.d.tsHigh
Related ModulesParent/sibling modules with shared interfacesMedium
Test FilesCorresponding test files for modified codeMedium
DocumentationREADME.md, ARCHITECTURE.mdLow

8. Plan Detection (Priority Order)

Priority 1: Workflow Session (IMPL_PLAN.md)
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;
}
Priority 2: TodoWrite (Current Session Todos)
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');
}
Priority 3: User-Stated Plan
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;
}
Priority 4: Inferred Plan
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;
}

9. Notes

  • Timing: Execute at task completion or before context switch
  • Frequency: Once per independent task or milestone
  • Recovery: New session can immediately continue with full context
  • Knowledge Graph: Entity relationships auto-extracted for visualization
  • Absolute Paths: Critical for cross-session recovery on different machines

© catlog22, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .codex/skills/memory-compact of catlog22/Claude-Code-Workflow.

Open the folder on GitHubat commit 07491b0

Compare with similar skills

Compact next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Compact compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Compact this skillcatlog22/Claude-Code-Workflow2.1k—~3.2kAutomated safety check: PassMIT
Project Timeline Reportthedotmack/claude-mem97k1 repos~3.1kAutomated safety check: PassApache-2.0
Neat-Freak Knowledge CloseoutKKKKhazix/khazix-skills21k—~1.9kAutomated safety check: PassMIT
Beads Task Memorygastownhall/beads28k—~1.2kAutomated safety check: PassMIT
MemPalace Memory SearchMemPalace/mempalace59k—~1.4kAutomated safety check: PassMIT
Reflect on Session Learningscursor/plugins10k5 repos~1.2kAutomated safety check: PassNone

Similar skills

  • Project Timeline Report

    thedotmack/claude-mem

    Writes a narrative Journey Into report on a project's whole development history, built from the timeline that claude-mem has recorded.

    97k GitHub starsUsed in 1 repo~3.1k tokens
    Agent WorkflowsAuto-check passed
  • Neat-Freak Knowledge Closeout

    KKKKhazix/khazix-skills

    Brings project docs, agent rule files, authorized memory and leftover workspace files back in line with what the code and runtime actually do at the end of a work session.

    21k GitHub stars~1.9k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check passed
  • Beads Task Memory

    gastownhall/beads

    Tracks multi-session work with dependencies in the bd issue tracker so the agent can find ready tasks and recover its context after conversation compaction.

    28k GitHub stars~1.2k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • MemPalace Memory Search

    MemPalace/mempalace

    Mines project files and conversation exports into a local, searchable memory palace and recalls past work by semantic search through the mempalace CLI.

    59k GitHub stars~1.4k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Official

    Starts three parallel reviewer subagents over the current conversation transcript, then turns their findings into concrete edits to existing skills.

    10k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • Compound Learning Writer

    EveryInc/compound-engineering-plugin

    Records one solved and verified problem as a durable learning in the repository, but only when the reasoning is not already clear from the final code, tests or docs.

    25k GitHub stars~2k tokensUpdated today
    Agent WorkflowsAuto-check passed

More from catlog22/Claude-Code-Workflow

All 82 skills in this repo
  • Prompt Generator

    catlog22/Claude-Code-Workflow

    Generate or convert Claude Code prompt files — command orchestrators, skill files, agent role definitions, or style conversion of existing files.

    2.1k GitHub starsUsed in 1 repo~4.7k tokens
    Auto-check: notes
  • Ccw Help

    catlog22/Claude-Code-Workflow

    CCW command help system. An agent skill from catlog22/Claude-Code-Workflow.

    2.1k GitHub stars~2.5k tokensUpdated 3 mo ago
    Auto-check passed
  • Team Ultra Analyze

    catlog22/Claude-Code-Workflow

    Deep collaborative analysis team skill. An agent skill from catlog22/Claude-Code-Workflow.

    2.1k GitHub starsUsed in 1 repo~2.4k tokens
    Auto-check: notes
  • Brainstorm

    catlog22/Claude-Code-Workflow

    Unified brainstorming skill with dual-mode operation — auto mode (framework generation, parallel multi-role analysis, cross-role synthesis) and single role analysis.

    2.1k GitHub stars~4.8k tokensUpdated 3 mo ago
    Auto-check: notes
  • Ccw Chain

    catlog22/Claude-Code-Workflow

    Chain-based CCW workflow orchestrator. An agent skill from catlog22/Claude-Code-Workflow.

    2.1k GitHub stars~1.1k tokensUpdated 3 mo ago
    Auto-check: notes
  • Delegation Check

    catlog22/Claude-Code-Workflow

    Check workflow delegation prompts against agent role definitions for content separation violations.

    2.1k GitHub stars~2.8k tokensUpdated 3 mo ago
    Auto-check: notes

Categories

Questions about Compact

What does Compact do?

Compact current session memory into structured text for session recovery. Compact is an agent skill from catlog22/Claude-Code-Workflow. Compact current session memory into structured text for session recovery.

When should I use Compact?

Compact fits situations like: tasks that involve Agent memory.

How do I install Compact in Claude Code?

Run `npx skills add catlog22/Claude-Code-Workflow --skill compact -a claude-code`. Or copy the skill folder (.codex/skills/memory-compact in catlog22/Claude-Code-Workflow) into .claude/skills/compact in your project. Claude Code loads it when a task matches its description.

How do I install Compact in Codex?

Run `npx skills add catlog22/Claude-Code-Workflow --skill compact -a codex`. Or copy the skill folder (.codex/skills/memory-compact in catlog22/Claude-Code-Workflow) into .agents/skills/compact in your project. Codex loads it when a task matches its description.

Can I use Compact in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add catlog22/Claude-Code-Workflow --skill compact -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/compact, .gemini/skills/compact, .github/skills/compact and .opencode/skills/compact in your project.

What does Compact need to run?

SKILL.md names no scripts, command-line tools or credentials: Compact is instructions for the agent only.

Does Compact access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Compact safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Compact use?

Compact is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Compact use?

About 3.2k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Compact?

Skills that share tags, products or a category with Compact: Project Timeline Report (thedotmack/claude-mem, 97k stars), Neat-Freak Knowledge Closeout (KKKKhazix/khazix-skills, 21k stars), Beads Task Memory (gastownhall/beads, 28k stars) and MemPalace Memory Search (MemPalace/mempalace, 59k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Compact?

catlog22 (a GitHub user) maintains it in catlog22/Claude-Code-Workflow, which has 2,130 GitHub stars. The repository holds 82 skills in this directory. The repository was last updated on June 18, 2026.

Source: catlog22/Claude-Code-Workflow on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.