compact-on

A project setup command that enables automatic recovery of conversation context after compaction, when a long conversation is shortened to fit available space. It creates a context file and connects it to the project's instructions.

In plain words
What is it for?
Use it to configure the project's Recall integration by updating its Claude Code settings, instruction file, and ignore rules.
Why use it?
It helps the coding agent retain important earlier discussion after compaction. The saved context is kept out of version control.

Command

Part of the recall plugin — 3 commands shipped together

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.

agentmods
npx agentmods add commands/flinedev/recall/compact-on
Clone the repo
git clone --depth 1 https://github.com/FlineDev/Recall

Or install recall, the plugin that ships this one along with the rest of its 3 commands.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 883 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.00883
Opus 5 $0.00000 $0.00441
Sonnet 5 $0.00000 $0.00177
Haiku 4.5 $0.00000 $0.00088

Measured 3d ago against content hash bd968b2f83c3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

compact-on 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 3d 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.

commands/compact-on.md · 105 lines

How it starts

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

Enable Compaction Integration

You are configuring the Recall plugin for the current project. This sets up automatic context recovery after compaction. Follow these steps exactly:

Step 1: Ensure .claude directory exists

mkdir -p "$(pwd)/.claude"

Step 2: Create the recall context file

Create .claude/recall-context.md with an empty placeholder. This file is populated by the PreCompact hook and read via CLAUDE.md @-reference:

echo '<!-- No recall context available. This file is populated by the PreCompact hook. -->' > "$(pwd)/.claude/recall-context.md"

Step 3: Add @-reference to CLAUDE.md

Read the project's CLAUDE.md file (create it if it doesn't exist). Add @.claude/recall-context.md as the very first line of the file — before any other content. This ensures the recall content is loaded even if CLAUDE.md is long.

If CLAUDE.md doesn't exist, create it with:

@.claude/recall-context.md

If CLAUDE.md already exists, check if it already contains @.claude/recall-context.md (on any line). If not, prepend it as the first line. If it's already there, don't add it again.

Step 4: Add to .gitignore

Read the project's .gitignore file (create it if it doesn't exist). Add .claude/recall-context.md if it's not already present. This prevents the auto-generated recall file from being committed.

Append this line (if not already present):

.claude/recall-context.md

Step 5: Add hooks to project settings

Read .claude/settings.json (create it with {} if it doesn't exist). Add the Recall hooks to the hooks key.

If a hooks key already exists, merge the Recall hooks into it. Do NOT overwrite existing hooks for other events. If PreCompact or SessionStart arrays already exist with Recall entries (check if the command path contains recall), replace them. Otherwise append.

If no hooks key exists, add it.

The hooks to add — use version-agnostic paths that resolve to the latest cached version at runtime:

Read the full file on GitHub · 105 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. 3d ago First seen · 105 lines · 0 tokens per session scan A bd968b2f83c3

Subscribe to this mod's changes

compact-on is a command published in the GitHub repository FlineDev/Recall (10 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 883 tokens. 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-31.