compact

compact is a skill for Claude Code from crisandrews/ClawCode. It costs 43 tokens per session (607 once invoked), scanned A, original, MIT.

A manual memory-saving command for an AI agent. It records important decisions, facts, tasks, and solved problems from the current conversation in a daily log.

In plain words
What is it for?
Use it to save a checkpoint of a discussion to memory/YYYY-MM-DD.md. It can be triggered with commands such as /compact, /flush, or their listed alternatives.
Why use it?
It preserves useful context before moving on, especially on messaging platforms that do not have a built-in context-compaction command. It does not compact the agent’s active conversation.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: mentions Claude Code.

Part of the agent plugin — 21 skills, 10 hooks, 1 MCP server shipped together

Good fit Use it to save a checkpoint of a discussion to memory/YYYY-MM-DD.md. It can be triggered with commands such as /compact, /flush, or their listed alternatives.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/crisandrews/clawcode/compact
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add crisandrews/ClawCode --skill compact
Clone the repo
git clone --depth 1 https://github.com/crisandrews/ClawCode

Made for: Claude Code.

Or install agent, the plugin that ships this one along with the rest of its 21 skills, 10 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for compact

README.md
[![agentmods](https://agentmods.dev/badge/skills/crisandrews/clawcode/compact/github.svg)](https://agentmods.dev/skills/crisandrews/clawcode/compact)
Your own site
<a href="https://agentmods.dev/skills/crisandrews/clawcode/compact"><img src="https://agentmods.dev/badge/skills/crisandrews/clawcode/compact/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for compact

Your own site · 80×15
<a href="https://agentmods.dev/skills/crisandrews/clawcode/compact"><img src="https://agentmods.dev/badge/skills/crisandrews/clawcode/compact.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 607 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.00607
Opus 5.5 $0.00017 $0.00243
Sonnet 5.5 $0.00009 $0.00121
Haiku 4.5 $0.00004 $0.00061

Measured 2mo ago against content hash f18ed9dd05ee, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

compact scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/compact/SKILL.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/compact — Manual memory flush

Save the important parts of the current conversation to memory/YYYY-MM-DD.md. This is a manual version of what the PreCompact hook does automatically.

Important — architectural honesty

  • On CLI: The native /compact compacts Claude Code's context. A skill CANNOT invoke it. If you run /compact in the REPL, the native one runs (and the PreCompact hook fires to save memory automatically). This skill is only useful if you want a MANUAL flush WITHOUT triggering actual compaction.
  • On messaging channels (WhatsApp, Telegram, etc.): There is NO native compact. Each message is its own turn. This skill just saves the recent exchange to memory — useful as an explicit "save this" checkpoint.

This skill does NOT say "now run /compact" (that would cause a loop if the user pastes it again). It just saves and confirms.

Steps

  1. Detect surface.

  2. Scan the current session for things worth remembering:

    • Decisions made
    • Facts the user shared
    • Tasks discussed
    • Problems solved
  3. Append to daily log:

    DATE=$(date +%Y-%m-%d)
    TIME=$(date +%H:%M)
    
    
    ## Manual flush (<TIME>)
    
    ### Decisions
    - ...
    
    ### Facts learned
    - ...
    
    ### Open items
    - ...
    
  4. Respond briefly per surface:

CLI

✅ Flush complete → memory/<DATE>.md

If you want Claude Code to also compact the context, run the native /compact.
(The PreCompact hook already saves memory automatically when that happens.)

WhatsApp

✅ *Saved* → memory/<DATE>.md

Telegram

✅ **Saved** → memory/<DATE>.md

IMPORTANT: Respond in the user's language. If the user writes in Spanish, translate these templates to Spanish on the fly. Do the same for any other language. The templates above are English defaults — adapt them.

  1. Do NOT say "now run /compact" — that causes a loop. The user decides if they want to run the native command.

Important

Read the full file on GitHub · 78 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 78 lines · 43 tokens per session scan A f18ed9dd05ee

Subscribe to this mod's changes

compact is a skill published in the GitHub repository crisandrews/ClawCode (63 stars, last pushed today), licensed MIT. It adds 43 tokens to every session and 607 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

wiki-write

Add or update wiki content — autonomous ingest from URL, file, or text; autonomous update of existing pages. Auto-creates .wiki/ on first use. Use when: 'save to wiki', 'remember this', 'note this', 'store this', 'add to knowledge base', 'save findings', 'save research', 'save idea', 'write to wiki', 'ingest', 'add…

Oshayr/LLM-Wiki · 90 tokens

wiki-view

Wiki dashboard — browse pages, view stats, knowledge graph, export. Use on: 'wiki dashboard', 'wiki stats', 'show wiki', 'wiki pages', 'list wiki', 'wiki graph', 'export wiki', 'wiki overview'.

Oshayr/LLM-Wiki · 52 tokens

research-collector

A web-research automation pipeline that searches from several angles, collects pages, stores structured findings in persistent memory, and produces a report.

Kit4Some/Oh-my-ClaudeClaw · 88 tokens

project-memory

Use to create and maintain durable cross-session project memory and the progress ledger, so long autonomous builds resume cleanly after compaction, restarts, or new sessions. Read it when starting work and update it as decisions and tasks land.

martian56/claude-engineer · 50 tokens

knowledge-refiner

Skill "knowledge-refiner" from Kit4Some/Oh-my-ClaudeClaw, covering knowledge refiner — memory optimization & refinement skill, preamble, role, workflow and step 1 — status assessment.

Kit4Some/Oh-my-ClaudeClaw · 0 tokens

knowledge-sync

Skill "knowledge-sync" from Kit4Some/Oh-my-ClaudeClaw, covering knowledge sync — omc ↔ openclaw-cc memory synchronization, preamble, role, sync directions and workflow.

Kit4Some/Oh-my-ClaudeClaw · 0 tokens