cc-reaper: Instructions file for Claude Code

CLAUDE.md

cc-reaper CLAUDE.md is an instructions file for Claude Code from theQuert/cc-reaper. It costs 5,582 tokens per session, scanned A, original, Apache-2.0.

A project instruction file for cc-reaper, a shell utility that cleans up leftover Claude Code processes such as subagents, MCP servers, and plugins. It describes the project layout, cleanup layers, and installation commands.

In plain words
What is it for?
Use it when developing or maintaining cc-reaper, including its stop hook, cleanup shell functions, process-janitor daemon, monitoring script, and installation flow.
Why use it?
It gives coding agents the project context needed to modify the cleanup utility safely. The utility addresses processes that remain after sessions end and consume memory.

Instructions file for Claude Code

Written for Claude Code: SessionEnd hook event. Also seen: mentions CLAUDE.md; mentions subagents; mentions Claude Code.

This is theQuert/cc-reaper's own configuration. It tells Claude Code how to work on cc-reaper itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything cc-reaper configures →

Reuse

Borrowing it

Nothing to install: this file belongs to theQuert/cc-reaper. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/theQuert/cc-reaper/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/theQuert/cc-reaper

Made for: Claude Code.

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 cc-reaper CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/thequert/cc-reaper/claude-md/github.svg)](https://agentmods.dev/instructions/thequert/cc-reaper/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/thequert/cc-reaper/claude-md"><img src="https://agentmods.dev/badge/instructions/thequert/cc-reaper/claude-md/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 cc-reaper CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/thequert/cc-reaper/claude-md"><img src="https://agentmods.dev/badge/instructions/thequert/cc-reaper/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5,582 This file is loaded in full into every session.
When invoked 5,582 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.05582 $0.05582
Opus 5.5 $0.02233 $0.02233
Sonnet 5.5 $0.01116 $0.01116
Haiku 4.5 $0.00558 $0.00558

Measured 7d ago against content hash 4b530f54ea8f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cc-reaper CLAUDE.md 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 7d 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.

CLAUDE.md · 174 lines

How it starts

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

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

cc-reaper is a shell-based utility that cleans up orphan Claude Code/Codex processes and settled git worktrees that leak memory or disk after sessions end. It uses hooks for low-latency triggers, background agents for guarantees, and manual commands for diagnosis/on-demand cleanup.

Repository Structure

  • install.sh — Automated 4-stage installer (shell functions → stop hook → proc-janitor → daemon startup)
  • hooks/stop-cleanup-orphans.sh — Claude Code Stop hook; kills orphans using orphan-parent filtering (only truly orphaned processes — reparented to PID 1, or on Linux to the user's systemd --user manager)
  • shell/claude-cleanup.sh — Shell functions: claude-cleanup (kill orphans), claude-ram (RAM report), claude-fd (FD usage report), claude-sessions (session list), claude-guard (auto-reaper with RSS/FD threshold + idle detection)
  • shell/cc-monitor.sh — Read-only heat attribution monitor (cc-monitor, cc-monitor --apply)
  • shell/worktree-janitor.sh — Shared Claude/Codex worktree inventory and gated removal (clean, unheld, no live/recent harness claim, landed, idle); --claims for read-only claim/lease evidence, --session for either harness, and --scheduled for the guarantee layer. The method is in docs/worktree-reclamation.md
  • config/worktree-janitor.conf — Cross-device 48-hour/session/schedule policy deployed under ~/.cc-reaper
  • shell/reclaim-byproducts.sh — Session scratchpads, anonymous Docker volumes, go build cache, reclaim archives; its own LaunchAgent via --install-launchd (adopted from the skills repository 2026-10-07). The transcript lookup behind the scratchpad liveness rule is one pass, cached under ~/.cc-reaper/state on a corpus fingerprint and bounded by CC_RB_MENTION_BUDGET_SECONDS (default 600); a lookup that does not finish, or whose find or grep errors (status 2 or more, a missing binary, a signal), keeps every directory, writes no cache and no stamp
  • shell/resource-watch.sh — also the disk guard: ALERT:disk-low under 60 GB free; under 40 GB the reclaim (worktree-janitor.sh --scheduled, then reclaim-byproducts.sh) started detached as resource-watch.sh --act with a 30-minute cooldown, a single-instance lock (~/.cc-reaper/state/disk-act.lock) and a 90-minute cap after which the next round ends its process tree by pid; under 20 GB ALERT:disk-emergency and the flag ~/.cc-reaper/state/disk-emergency; a GB/h write rate from disk-free-samples.tsv (ALERT:disk-rate over 10, flag disk-rate-high over 20); and reclaim-byproducts.sh --go-cache-cap every run, bounded to 120 s. ALERT:reclaim-stalled (once per stall, alert only) when reclaim-byproducts' last-finished stamp is older than twice its LaunchAgent's StartInterval (CC_RW_RECLAIM_STALL_SECS); with no stamp at all the age is the plist's mtime (else the script's): inside the line one INFO line, over it the same once-only alert; test T19. A round never waits on the act. Each snapshot line carries swap=<gb>GB rate=<gbh>GB/h. Tests: tests/resource-watch.sh (T12-T21), tests/disk-guard.sh
  • shell/resource-watch-judge.py — the one judge of resource-watch's log, for a spot-check to import: thresholds are the script's defaults overridden by the installed LaunchAgent's EnvironmentVariables; each judged ALERT marker (load, disk, disk-low, disk-emergency, mem, swap, disk-rate) against the line's own numbers. Read-only. Tests: tests/resource-watch-judge.py (its defaults are pinned to the script's)
  • shell/disk-janitor.sh — --check disk guard. Below CC_DJ_ACT_FREE_GB (default 30) it acts; the go build cache age trim (go-build-age) runs on free space under CC_DJ_ACT_LOW_FREE_GB (20), under CC_DJ_GO_BUILD_FREE_GB (35), or a cache over CC_DJ_GO_BUILD_CAP_GB (8), also from --check outside the act. Because the act itself runs only below 30 GB, the effective free-space trigger inside the act is 30 GB, not 20 GB (the 35 GB soft floor is above it, so every act runs the step). It deletes only in CC_DJ_NEW_STEPS_MODE=auto (default spotcheck: logs decision=would-remove), after one bounded (CC_DJ_HOLDER_TIMEOUT_SECONDS, lsof -b) system-wide lsof; a timeout or non-zero lsof deletes nothing. Tests: tests/disk-janitor.sh
  • shell/gce-disk-watch.py — reads each GCE CI host's / from the Mac mini (one IAP df -P / ; df -Pi /, the only remote command; per-host 90 s, per-run 240 s) and tells disk-high (used >= 90%, < 2 GiB free, inodes >= 90%) or unreadable (never for a GDW_KNOWN_UNREADABLE host, logged known-unreadable) once per state change, re-alert every 120 min, one recovery line. Shadow (GDW_APPLY=0) logs would alert lines only; apply writes a GCE-DISK ALERT|STILL|RECOVERED log line and a notification, retrying a failed channel alone; nothing goes to an inbox or an event log. Policy config/gce-disk-watch.conf; agent com.cc-reaper.gce-disk-watch (600 s, never started by install). Tests: tests/gce-disk-watch.py
  • shell/orbstack-memory-trim.sh — Drops the OrbStack guest's clean caches when its VM process holds over a quarter of RAM; com.cc-reaper.orbstack-memory-trim every 15 min (adopted from stima-api 2026-10-07)
  • hooks/worktree-session-end.sh — Thin shared Claude/Codex SessionEnd trigger
  • proc-janitor/config.toml — Daemon config with target patterns, whitelist, and grace period settings
  • launchd/ — macOS LaunchAgent scripts for zero-dependency background monitoring
  • tests/ — Lightweight bash validation scripts (mocked ps/kill for isolated testing)

Read the full file on GitHub · 174 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. 7d ago Changed · -132 tokens per session 4b530f54ea8f
  2. 12d ago Changed · +6 lines · +709 tokens per session 2eaa192a84dc
  3. 13d ago Changed · +1 lines · +395 tokens per session 831cbba2da8a
  4. 17d ago Changed · +3 lines · +214 tokens per session ae05058e0395
  5. 27d ago Changed · +2 lines · +119 tokens per session 95795b457fad
  6. 1mo ago Changed · +2 lines · +115 tokens per session e564d167ba56
  7. 1mo ago Changed · +10 lines · +897 tokens per session e2868e9f11ac
  8. 1mo ago Changed · +3 lines · +106 tokens per session 959fb7471024
  9. 1mo ago Changed · +16 lines · +175 tokens per session 3f1e35303993
  10. 1mo ago First seen · 131 lines · 2,984 tokens per session scan A 7adb95c134ec

Subscribe to this mod's changes

cc-reaper CLAUDE.md is an instructions file published in the GitHub repository theQuert/cc-reaper (19 stars, last pushed yesterday), licensed Apache-2.0. It adds 5,582 tokens to every session, about $0.0223 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

cc-reaper CLAUDE.md compared with instructions from other repositories

cc-reaper CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
cc-reaper CLAUDE.mdtheQuert/cc-reaperInstructions file19yesterdayApache-2.0A5,582Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,685GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode model-prompts.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA2,022GitHub Copilot