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.
npx agentmods add commands/sefaertunc/worclaude/compact-safegit clone --depth 1 https://github.com/sefaertunc/WorclaudeWrote 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.
[](https://agentmods.dev/commands/sefaertunc/worclaude/compact-safe)<a href="https://agentmods.dev/commands/sefaertunc/worclaude/compact-safe"><img src="https://agentmods.dev/badge/commands/sefaertunc/worclaude/compact-safe.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00008 | $0.00806 |
| Opus 5 | $0.00004 | $0.00403 |
| Sonnet 5 | $0.00002 | $0.00161 |
| Haiku 4.5 | $0.00001 | $0.00081 |
Grade D, and why
compact-safe scanned grade D with 2 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 4d 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.
Reads agent configuration directoriesmediumAgent snooping
.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.
node -e 'const s = require("./.claude/settings.json"); console.log(JSON.stringify(s.hooks?.PostCompact || []))' Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
patterns: `rm -rf`, `git reset --hard`, `git push --force`, `DROP TABLE`, How it starts
The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/compact-safe adds pre-flight safety checks to bare /compact. Compaction
loses fine-grained conversation state; running it on a session with
uncommitted work, mid-implementation TODOs, or recent destructive operations
risks losing context the user expected to keep. This command surfaces those
risks before triggering compaction.
Pre-flight safety checks
Run all four checks. Report the findings as a short table. Stop and ask the user for confirmation if any check trips.
1. Uncommitted changes
git status --porcelain
If output is non-empty, surface a warning: "You have N uncommitted changes. Compaction loses references to specific files and line numbers — consider committing or stashing first."
Offer via AskUserQuestion:
commit— write a WIP commit before compacting (reversible)stash— stash changes, compact, thengit stash popafterproceed— compact anyway (you accept the risk)cancel— abort compaction
2. In-flight work signals
Scan for indicators that compaction would lose useful context:
- Recent test failures — check the last
npm test/vitest/pytestoutput if available. If there are failing tests, warn the user and offer to run/verifyfirst to capture the failure list before compacting. - Mid-implementation TODOs —
grep -rn "TODO(claude)\|FIXME\|XXX" src/on files changed in the last hour (git diff --name-only HEAD@{1.hour.ago}if available, otherwise--name-only HEAD~1). If matches exist, surface them — they may be context Claude needs to remember.
3. Recent destructive operations
Check the last 20 commands in transcript or shell history for destructive
patterns: rm -rf, git reset --hard, git push --force, DROP TABLE,
etc. If any were run within the last 30 minutes, warn the user — they may
want to keep the conversation context until they verify the destructive
op landed correctly.
4. PostCompact hook verification
Confirm .claude/settings.json has a PostCompact hook configured. Without
it, compaction strips CLAUDE.md / PROGRESS.md context permanently. If the
hook is missing, surface a warning and stop — compacting in this state
silently breaks Claude's session orientation.
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.
- 4d ago First seen · 90 lines · 8 tokens per session scan D d3d57483d287
compact-safe is a command published in the GitHub repository sefaertunc/Worclaude (4 stars, last pushed 25d ago), licensed MIT. It adds 8 tokens to every session and 806 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it D with 2 findings (reads agent configuration directories, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
context-stats
Display context window usage and token statistics.
meetings-list
List recent meetings and voice memos. Use when the user asks "what meetings did I have", "show my recent recordings", "any meetings today", "list my voice memos", or wants an overview of their meeting history. Also use when they need to find a specific meeting by browsing rather than searching.
meetings-search
Search meeting transcripts and voice memos for people, topics, decisions, commitments, or remembered ideas. Use when the user asks what was discussed, decided, or said across their meeting history. Not for preparing an upcoming meeting; use $meetings-prep.
handoff
Create, accept, or update the persistent .context/ai-handoff.md state shared by AI sessions and machines. Use when continuing in a new Claude or Codex session, transferring work between clients, or recording ownership and restart state.
thoughts_init
Initialize thoughts system for current repository.
handoff
Create a handoff document for seamless session continuity.