Skip to content
Back to search

cozempic

Context cleaning for Claude Code — prune bloated sessions, protect Agent Teams from context loss, auto-guard with tiered pruning

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/ruya-ai--cozempic/badge.svg)](/listings/ruya-ai--cozempic)

HTML

<a href="/listings/ruya-ai--cozempic"><img src="/api/listings/ruya-ai--cozempic/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Pick your package manager. `uvx`/`pipx`/`npm`/`pip` are the lowest-friction (no Homebrew trust prompt — see the note below):

# uv — persistent install, always on PATH (recommended)
uv tool install cozempic

# uvx — run once without installing (handy to try it, but the guard daemon
# can't auto-start from an ephemeral env — use `uv tool install` for that)
uvx cozempic --help

# pipx — isolated user install, always on PATH
pipx install cozempic

# npm — global install
npm install -g cozempic

# pip (Python ≥ 3.10)
pip install cozempic

# Homebrew (macOS / Linux) — use the fully-qualified name (see note below)
brew install Ruya-AI/cozempic/cozempic

# Nix flake
nix profile install github:Ruya-AI/cozempic?dir=packaging/nix

> **Homebrew tap trust:** recent Homebrew versions gate non-official taps behind an explicit trust step. The **fully-qualified** `brew install Ruya-AI/cozempic/cozempic` above trusts just this formula inline — no extra command. A bare `brew install cozempic` / `brew upgrade cozempic` will instead error with *"Refusing to load formula … from untrusted tap"*; if you hit that, run `brew trust Ruya-AI/cozempic` once (or just prefer one of the install methods above, none of which have this gate).

AUR (`yay -S cozempic`) and MacPorts (`port install py-cozempic`) submissions are in progress — see [`packaging/README.md`](packaging/README.md) for status and PKGBUILD/Portfile sources.

That's it. Cozempic auto-initializes on first use — hooks are wired globally, guard daemon auto-starts on every Claude Code session. No manual setup needed. Opt out with `COZEMPIC_NO_GLOBAL_INIT=1`.

Auto-update & how to control it

Cozempic auto-updates from PyPI by default, **on purpose**: Claude Code ships frequent changes to its session/context format, and auto-update is how a compatibility fix reaches you *before* a stale release can mishandle and lose your context. For most users that safety outweighs the convenience cost, so we recommend leaving it on. If you'd rather control it, set one of these — ideally in your shell profile (`~/.zshrc` / `~/.bashrc`) so it applies *before* the first session wires anything:

| Goal | Set | |---|---| | Hold a specific reviewed version, keep hooks + guard running | `export COZEMPIC_PIN=1.8.30` | | Stop all auto-updates, keep hooks + guard running | `export COZEMPIC_NO_AUTO_UPDATE=1` | | No global hooks / no daemon at all (manual CLI only) | `export COZEMPIC_NO_GLOBAL_INIT=1` |

Both `COZEMPIC_NO_AUTO_UPDATE` and `COZEMPIC_PIN` are honored by the Python updater, the SessionStart hook's shell upgrade, and the npm installer. `COZEMPIC_PIN` disables auto-update and warns (not auto-installs) if your running version drifts from the pin, so you stay on a version you've reviewed with a human in the loop. (Releases are published from CI via PyPI [Trusted Publishing](https://docs.pypi.org/trusted-publishers/) — no long-lived upload token — to reduce the chance of a compromised publish in the first place.)

As a Claude Code Plugin

Install cozempic (any method above), then inside Claude Code:

/plugin marketplace add Ruya-AI/cozempic
/plugin install cozempic

This gives you MCP tools, skills (`/cozempic:diagnose`, `/cozempic:treat`, etc.), and auto-wired hooks.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 22 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "name": "cozempic",
  3. "owner": {
  4. "name": "Ruya AI",
  5. "email": "hello@ruya.ai"
  6. },
  7. "metadata": {
  8. "description": "2x the effective context with smart weight-loss for Claude Code — prune bloated sessions, protect agent teams from compaction, monitor token usage with MCP tools",
  9. "version": "1.8.39",
  10. "pluginRoot": "./plugin"
  11. },
  12. "plugins": [
  13. {
  14. "name": "cozempic",
  15. "source": "./plugin",
  16. "description": "2x the effective context with smart weight-loss for Claude Code — prune bloated sessions, protect agent teams from compaction, monitor token usage with MCP tools",
  17. "version": "1.8.39",
  18. "category": "productivity",
  19. "tags": ["context", "pruning", "compaction", "agent-teams", "tokens", "optimization"]
  20. }
  21. ]
  22. }
README.md · README · 379 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Cozempic
  2. ![Downloads](https://img.shields.io/badge/downloads-100k%2B-brightgreen) ![Version](https://img.shields.io/badge/version-1.8.39-blue) ![License](https://img.shields.io/badge/license-MIT-lightgrey)
  3. **100,000+ power users** trust Cozempic to keep their Claude Code sessions lean.
  4. Context cleaning for [Claude Code](https://claude.ai/code) — **remove the bloat, keep everything that matters, protect Agent Teams from context loss**.
  5. ## What It Does
  6. Claude Code sessions fill up with dead weight: progress ticks, thinking blocks, stale file reads, duplicate CLAUDE.md injections, base64 screenshots, oversized tool outputs, and metadata bloat. A typical session carries 8-46MB — most of it noise that inflates every API call.
  7. Cozempic removes it with **18 composable strategies** across 3 prescription tiers, while your actual conversation, decisions, and working context stay untouched. The guard daemon runs automatically — install once, forget about it.
  8. ### Key Features
  9. - **18 pruning strategies** — gentle (5), standard (11), aggressive (18)
  10. - **Guard daemon** — auto-starts via SessionStart hook, monitors and prunes continuously
  11. - **Interactive "prune now?" nudge** — a non-blocking heads-up at 25% / 55% / 80% context (once per tier) recommending `cozempic reload`, so interactive users get cozempic's higher-fidelity prune+resume on their own terms instead of falling back to lossy autocompact. Takes no action on its own; silence with `COZEMPIC_NUDGE_OFF=1`
  12. - **Interactive-safe reload** — in interactive sessions the guard warns first and reloads only at an idle breakpoint (never mid-turn); headless sessions reload as before
  13. - **Safe-point protection** — the guard never terminates-and-resumes through in-flight work: a running Workflow, a background subagent, an agent team, or an open tool call defers the reload so nothing is lost
  14. - **compact-summary-collapse** — 85-95% savings by removing pre-compaction messages already in the summary
  15. - **Agent Teams protection** — checkpoints team state through compaction, reactive overflow recovery
  16. - **Behavioral digest** — extracts your corrections ("don't do X"), persists them to Claude Code's memory system so they survive compaction
  17. - **15 doctor checks** — diagnose and auto-fix session corruption, orphaned tool results, zombie teams, unresumable sessions
  18. - **Token-aware diagnostics** — exact token counts from `usage` fields, cache hit rate, context % bar
  19. - **Auto-detects 1M context** — correct thresholds for both 200K and 1M models
  20. - **Efficient idle polling** — backs off the poll cadence when the session is quiet and skips redundant no-op checkpoints
  21. - **Auto-updates** — checks PyPI daily, upgrades in-place
  22. **Zero external dependencies.** Python 3.10+ stdlib only.
  23. ## Install
  24. Pick your package manager. `uvx`/`pipx`/`npm`/`pip` are the lowest-friction (no Homebrew trust prompt — see the note below):
  25. ```bash
  26. # uv — persistent install, always on PATH (recommended)
  27. uv tool install cozempic
  28. # uvx — run once without installing (handy to try it, but the guard daemon
  29. # can't auto-start from an ephemeral env — use `uv tool install` for that)
  30. uvx cozempic --help
  31. # pipx — isolated user install, always on PATH
  32. pipx install cozempic
  33. # npm — global install
  34. npm install -g cozempic
  35. # pip (Python ≥ 3.10)
  36. pip install cozempic
  37. # Homebrew (macOS / Linux) — use the fully-qualified name (see note below)
  38. brew install Ruya-AI/cozempic/cozempic
  39. # Nix flake
  40. nix profile install github:Ruya-AI/cozempic?dir=packaging/nix
  41. ```
  42. > **Homebrew tap trust:** recent Homebrew versions gate non-official taps behind an explicit trust step. The **fully-qualified** `brew install Ruya-AI/cozempic/cozempic` above trusts just this formula inline — no extra command. A bare `brew install cozempic` / `brew upgrade cozempic` will instead error with *"Refusing to load formula … from untrusted tap"*; if you hit that, run `brew trust Ruya-AI/cozempic` once (or just prefer one of the install methods above, none of which have this gate).
  43. AUR (`yay -S cozempic`) and MacPorts (`port install py-cozempic`) submissions are in progress — see [`packaging/README.md`](packaging/README.md) for status and PKGBUILD/Portfile sources.
  44. That's it. Cozempic auto-initializes on first use — hooks are wired globally, guard daemon auto-starts on every Claude Code session. No manual setup needed. Opt out with `COZEMPIC_NO_GLOBAL_INIT=1`.
  45. ### Auto-update & how to control it
  46. Cozempic auto-updates from PyPI by default, **on purpose**: Claude Code ships frequent changes to its session/context format, and auto-update is how a compatibility fix reaches you *before* a stale release can mishandle and lose your context. For most users that safety outweighs the convenience cost, so we recommend leaving it on. If you'd rather control it, set one of these — ideally in your shell profile (`~/.zshrc` / `~/.bashrc`) so it applies *before* the first session wires anything:
  47. | Goal | Set |
  48. |---|---|
  49. | Hold a specific reviewed version, keep hooks + guard running | `export COZEMPIC_PIN=1.8.30` |
  50. | Stop all auto-updates, keep hooks + guard running | `export COZEMPIC_NO_AUTO_UPDATE=1` |
  51. | No global hooks / no daemon at all (manual CLI only) | `export COZEMPIC_NO_GLOBAL_INIT=1` |
  52. Both `COZEMPIC_NO_AUTO_UPDATE` and `COZEMPIC_PIN` are honored by the Python updater, the SessionStart hook's shell upgrade, and the npm installer. `COZEMPIC_PIN` disables auto-update and warns (not auto-installs) if your running version drifts from the pin, so you stay on a version you've reviewed with a human in the loop. (Releases are published from CI via PyPI [Trusted Publishing](https://docs.pypi.org/trusted-publishers/) — no long-lived upload token — to reduce the chance of a compromised publish in the first place.)
  53. ### As a Claude Code Plugin
  54. Install cozempic (any method above), then inside Claude Code:
  55. ```
  56. /plugin marketplace add Ruya-AI/cozempic
  57. /plugin install cozempic
  58. ```
  59. This gives you MCP tools, skills (`/cozempic:diagnose`, `/cozempic:treat`, etc.), and auto-wired hooks.
  60. ## Quick Start
  61. ```bash
  62. # Auto-detect and diagnose the current session
  63. cozempic current --diagnose
  64. # Dry-run the standard prescription
  65. cozempic treat current
  66. # Apply with backup
  67. cozempic treat current --execute
  68. # Go aggressive on a specific session
  69. cozempic treat <session_id> -rx aggressive --execute
  70. # Check for session corruption
  71. cozempic doctor
  72. # View behavioral digest rules
  73. cozempic digest show
  74. # Show all strategies & prescriptions
  75. cozempic formulary
  76. ```
  77. ## Strategies
  78. | # | Strategy | Tier | What It Does | Expected |
  79. |---|----------|------|-------------|----------|
  80. | 1 | `compact-summary-collapse` | gentle | Remove all pre-compaction messages (already in the summary) | 85-95% |
  81. | 2 | `attribution-snapshot-strip` | gentle | Strip attribution-snapshot metadata entries | 0-2% |
  82. | 3 | `progress-collapse` | gentle | Collapse consecutive and isolated progress tick messages | 40-48% |
  83. | 4 | `file-history-dedup` | gentle | Deduplicate file-history-snapshot messages | 3-6% |
  84. | 5 | `metadata-strip` | gentle | Strip token usage stats, stop_reason, costs | 1-3% |
  85. | 6 | `thinking-blocks` | standard | Remove/truncate thinking content + signatures | 2-5% |
  86. | 7 | `tool-output-trim` | standard | Trim large tool results (>8KB or >100 lines), microcompact-aware | 1-8% |
  87. | 8 | `tool-result-age` | standard | Compact old tool results by age — minify mid-age, stub old | 10-40% |
  88. | 9 | `stale-reads` | standard | Remove file reads superseded by later edits | 0.5-2% |
  89. | 10 | `system-reminder-dedup` | standard | Deduplicate repeated system-reminder tags | 0.1-3% |
  90. | 11 | `tool-use-result-strip` | standard | Strip toolUseResult envelope field (Edit diffs, never sent to API) | 5-50% |
  91. | 12 | `image-strip` | aggressive | Strip old base64 image blocks, keep most recent 20% | 1-40% |
  92. | 13 | `http-spam` | aggressive | Collapse consecutive HTTP request runs | 0-2% |
  93. | 14 | `error-retry-collapse` | aggressive | Collapse repeated error-retry sequences | 0-5% |
  94. | 15 | `background-poll-collapse` | aggressive | Collapse repeated polling messages | 0-1% |
  95. | 16 | `document-dedup` | aggressive | Deduplicate large document blocks (CLAUDE.md injection) | 0-44% |
  96. | 17 | `mega-block-trim` | aggressive | Trim any content block over 32KB | safety net |
  97. | 18 | `envelope-strip` | aggressive | Strip constant envelope fields (cwd, version, slug) | 2-4% |
  98. ### Prescriptions
  99. | Prescription | Strategies | Risk | Typical Savings |
  100. |---|---|---|---|
  101. | `gentle` | 5 | Minimal | 85-95% (with compact boundary) |
  102. | `standard` | 11 | Low | 25-45% |
  103. | `aggressive` | 18 | Moderate | 35-60% |
  104. **Dry-run is the default.** Nothing is modified until you pass `--execute`. Backups are always created.
  105. ## Guard — Continuous Protection
  106. The guard daemon monitors your session and prunes automatically:
  107. ```bash
  108. # Auto-starts via SessionStart hook after cozempic init
  109. # Or run manually:
  110. cozempic guard --daemon
  111. ```
  112. **4-tier proactive pruning** (every 30s):
  113. | Tier | Threshold | Action | Reload? |
  114. |------|-----------|--------|---------|
  115. | Soft | 25% | gentle file cleanup | No |
  116. | Hard | 55% | standard prune | Yes (interactive: at a breakpoint; deferred if agents active) |
  117. | Hard2 | 80% | aggressive prune | Yes (gated by the safe-point check) |
  118. | User | 90% | manual aggressive | Yes |
  119. **Interactive sessions** — instead of a surprise reload mid-work, the guard surfaces a [nudge](#key-features) and reloads only once you pause between turns, after warning you. Near the wall (≈88%) it reloads even mid-turn — a higher-fidelity prune beats hitting autocompact. Detection is automatic (`COZEMPIC_INTERACTIVE=auto`); `on`/`off` force it. Headless/CI sessions reload immediately as before.
  120. **Safe-point reload** — a reload terminates and resumes the Claude process, so the guard validates first: if a Workflow, a background subagent, an agent team, or an open tool call is in flight, the reload defers (read-only checkpoint) rather than destroying that work. Tune the near-wall force point with `COZEMPIC_FORCE_RELOAD_PCT` (default `0.88`).
  121. **Reactive overflow recovery** — kqueue/polling file watcher detects inbox-flood overflow within milliseconds, auto-prunes with escalating prescriptions, circuit breaker prevents loops.
  122. **tmux/screen** — reload resumes in the same pane via `send-keys`. Plain terminals open a new window.
  123. **Token thresholds auto-detect** — 200K and 1M models detected automatically. Override with `COZEMPIC_CONTEXT_WINDOW=200000` for Pro plan.
  124. ## Behavioral Digest
  125. Cozempic extracts your corrections and persists them across compactions:
  126. ```bash
  127. # View extracted rules
  128. cozempic digest show
  129. # Manually extract from current session
  130. cozempic digest update
  131. # Sync rules to Claude Code's memory system
  132. cozempic digest inject
  133. ```
  134. **How it works:**
  135. - Detects correction signals in your messages ("don't do X", "stop adding Y", "always use Z")
  136. - All corrections start as "pending" and activate after 2 occurrences (prevents one-shot noise from polluting the digest)
  137. - Rules synced to Claude Code's native memory system (`~/.claude/projects/<cwd>/memory/`)
  138. - Claude reads these as feedback memories on every turn — they survive compaction natively
  139. - PreCompact and Stop hooks auto-extract before context is lost
  140. ## Agent Teams Protection
  141. When Claude's auto-compaction fires, Agent Teams lose coordination state. Cozempic prevents this with five layers:
  142. 1. **Continuous checkpoint** — saves team state every N seconds
  143. 2. **Hook-driven checkpoint** — fires after every Task spawn, TaskCreate/Update, before compaction, at session end
  144. 3. **Tiered pruning** — soft threshold trims without disruption; hard threshold does full prune + reload
  145. 4. **Reactive overflow recovery** — detects inbox-flood within milliseconds, auto-recovers (~10s downtime)
  146. 5. **is_protected()** — compact summaries, compact boundaries, content-replacement entries, and behavioral digest messages are never stripped
  147. ## Doctor
  148. ```bash
  149. cozempic doctor # Diagnose issues
  150. cozempic doctor --fix # Auto-fix where possible
  151. ```
  152. | Check | What It Detects | Auto-Fix |
  153. |-------|----------------|----------|
  154. | `trust-dialog-hang` | Resume hangs on Windows | Reset flag |
  155. | `claude-json-corruption` | Truncated/corrupted JSON | Restore from backup |
  156. | `corrupted-tool-use` | `tool_use.name` >200 chars | Parse and repair |
  157. | `orphaned-tool-results` | `tool_result` missing matching `tool_use` — causes 400 errors | Strip orphans |
  158. | `zombie-teams` | Stale team directories with dead agents | Remove stale dirs |
  159. | `oversized-sessions` | Session files >50MB | — |
  160. | `stale-backups` | Old `.jsonl.bak` files wasting disk | Delete old backups |
  161. | `disk-usage` | Session storage exceeding healthy thresholds | — |
  162. ## Commands
  163. ```
  164. cozempic init Wire hooks + slash command into project
  165. cozempic list List sessions with sizes and token estimates
  166. cozempic current [-d] Show/diagnose current session
  167. cozempic diagnose <session> Analyze bloat sources
  168. cozempic treat <session> [-rx PRESET] Run prescription (dry-run default)
  169. cozempic treat <session> --execute Apply changes with backup
  170. cozempic strategy <name> <session> Run single strategy
  171. cozempic reload [-rx PRESET] Treat + auto-resume in new terminal
  172. cozempic checkpoint [--show] Save team state to disk
  173. cozempic guard [--daemon] Start guard (auto-starts via hook)
  174. cozempic doctor [--fix] Check for known issues
  175. cozempic digest [show|update|clear|flush|recover|inject]
  176. cozempic dashboard Build a static HTML report of your prune savings
  177. cozempic self-update Upgrade to latest version from PyPI
  178. cozempic formulary Show all strategies & prescriptions
  179. cozempic uninstall [--project|--all|--purge] Reverse init: unwire hooks + slash command
  180. ```
  181. ## Hook Integration
  182. After `cozempic init`, these hooks are wired automatically:
  183. | Hook | When | What |
  184. |------|------|------|
  185. | `SessionStart` | Session opens | Guard daemon + digest inject |
  186. | `PostToolUse[Task]` | Agent spawn | Team checkpoint |
  187. | `PostToolUse[TaskCreate\|TaskUpdate]` | Todo changes | Team checkpoint |
  188. | `PreCompact` | Before compaction | Checkpoint + digest flush |
  189. | `Stop` | Session end | Checkpoint + digest flush |
  190. ## Safety
  191. - **Dry-run by default** — `--execute` required to modify files
  192. - **Atomic writes** — `write → fsync → os.replace()` — no partial writes
  193. - **Strict session resolution** — refuses to act on ambiguous matches
  194. - **Timestamped backups** — automatic `.jsonl.bak` before any modification
  195. - **is_protected()** — compact summaries, boundaries, marble-origami state, content-replacement, behavioral digest entries are never removed
  196. - **parentUuid re-linking** — conversation chain integrity maintained after removals
  197. - **Sibling tool_use protection** — tool_use blocks are kept when their tool_result is kept
  198. - **Team messages protected** — Task, TaskCreate, SendMessage never pruned
  199. - **Strategies compose sequentially** — each runs on the output of the previous
  200. ## Example Output
  201. ```
  202. Prescription: aggressive
  203. Before: 158.2K tokens (29.56MB, 6602 messages)
  204. After: 121.5K tokens (23.09MB, 5073 messages)
  205. Freed: 36.7K tokens (23.2%) — 6.47MB, 1529 removed, 4038 modified
  206. Context: [============--------] 61%
  207. Strategy Results:
  208. compact-summary-collapse 8.17MB saved (85.2%) (4201 removed)
  209. progress-collapse 1.63MB saved (5.5%) (1525 removed)
  210. metadata-strip 693.9KB saved (2.3%) (2735 modified)
  211. tool-use-result-strip 1.44MB saved (4.9%) (891 modified)
  212. thinking-blocks 1.11MB saved (3.8%) (1127 modified)
  213. tool-output-trim 1.72MB saved (5.8%) (167 modified)
  214. ...
  215. ```
  216. ## Changelog
  217. ### v1.8.23
  218. - **Hardened numeric input validation** — `NaN`, `infinity`, and non-representable huge integers are now rejected with a clear error at every CLI flag, `COZEMPIC_*` env var, and config field (a `NaN` threshold would otherwise silently disable the gate it controls). Thanks to **[@ynaamane](https://github.com/ynaamane)** (#116), and folded in the matching fix for the interactive-guard reload-grace knob
  219. - **Standing adversarial QA fleet** — `docs/qa-fleet.md` + a corpus-driven regression test so this whole class can't regress
  220. ### v1.8.22
  221. - **Interactive "prune now?" nudge** — non-blocking heads-up at 25% / 55% / 80% context (once per tier, with hysteresis so it never nags), recommending `cozempic reload`. Brings cozempic's higher-fidelity prune+resume to interactive sessions without surprise reloads. Tunable via `COZEMPIC_NUDGE_PCTS`; silence with `COZEMPIC_NUDGE_OFF=1`
  222. - **Interactive-safe reload** — warns first, then reloads only at an idle breakpoint (never mid-turn); near the wall (`COZEMPIC_FORCE_RELOAD_PCT`, default 88%) it reloads even mid-turn. Headless/CI behaviour unchanged
  223. - **Safe-point protection** — the guard never terminates-and-resumes through a running Workflow, background subagent, agent team, or open tool call; the reload defers instead so in-flight work is preserved
  224. - **Interactivity detection** — `COZEMPIC_INTERACTIVE=auto|on|off`
  225. - **Efficient idle polling** — exponential poll back-off when the session is quiet (`COZEMPIC_IDLE_BACKOFF_CYCLES`) and skips redundant no-op SOFT checkpoints
  226. ### v1.7.1
  227. - **`cozempic reload --session <id|path>`** escape hatch when auto-detect fails in multi-agent sessions. Previously reload had no way to recover from ambiguous session detection, leaving users stuck. Matches `guard --session`.
  228. - Error message now names the flag to use (was "use an explicit session ID" with no instruction on how)
  229. - **Auto-update message clarified**: after upgrade, says "active on next run (this process still vX.Y.Z)" — users no longer think the upgrade failed when `--version` still prints the old number (the running Python process can't hot-swap its own code)
  230. ### v1.7.0
  231. - **Telemetry opt-out**: `COZEMPIC_NO_TELEMETRY=1` disables anonymous usage counters
  232. - **Documented configuration**: `COZEMPIC_NO_AUTO_UPDATE`, `COZEMPIC_NO_TELEMETRY`, `COZEMPIC_CONTEXT_WINDOW` env vars
  233. ### v1.6.x
  234. - **4-tier pruning**: soft (25%, no reload) → hard (55%, reload) → emergency (80%, aggressive reload) → user (90%, manual)
  235. - **Agent-aware reload**: defers reload at 55% when agents are running, forces at 80%
  236. - **Same-terminal resume**: tmux/screen users get `/exit` + `claude --resume` in the same pane
  237. - **Clean messaging**: only shows strategies that did something, 1-line hook status output
  238. - **1M default**: Opus/Sonnet 4.5/4.6 default to 1M context (CC doesn't use `[1m]` suffix)
  239. - **Auto-upgrade everywhere**: SessionStart hook backgrounds `pip install --upgrade cozempic` on every session. MCP/plugin use `uv run --upgrade`. npm install.js always upgrades.
  240. - **`cozempic self-update`**: force-upgrade from PyPI regardless of install method (pip, uv, editable, clone)
  241. - **Auto-updater fixed**: removed TTY check (was blocking hook-triggered updates), tries uv → pip → pipx
  242. ### v1.5.0
  243. - **`tool-result-age` strategy** — age-based tool result compaction. Recent results stay verbatim, mid-age get JSON minified and diff context collapsed, old replaced with compact stubs. Claude can re-read any file. 10-40% additional savings targeting the 45% of session size that tool results occupy.
  244. - 18 strategies total, standard prescription 11, aggressive 18
  245. - Tests: 273 → 283
  246. ### v1.4.0 / v1.4.1
  247. - **Track 1 — Bug fixes**: `is_protected()` guard on all strategies, `isSidechain` preserved in envelope-strip, `output_tokens` in token formula, `parentUuid` re-linking, sibling tool_use protection
  248. - **Track 2 — New strategies**: `compact-summary-collapse` (85-95%), `attribution-snapshot-strip`, microcompact-aware `tool-output-trim`
  249. - **Behavioral digest**: extract corrections, sync to Claude Code memory, CLI commands, hook wiring
  250. - **Context window detection**: MCP server and plugin now auto-detect 200K/1M (was hardcoded 200K)
  251. - **Cache efficiency metrics**: `cozempic diagnose` shows cache hit rate
  252. - **transcript_path**: hooks parse session path from payload for faster resolution
  253. - Tests: 165 → 273
  254. ### v1.3.0 / v1.3.1
  255. - Writer-safe live prune + sidecar session store
  256. - Guard startup cleanup, updater fixes, MCP maintenance
  257. ### v1.2.0 — v1.2.8
  258. - Atomic file writes, strict session resolution, schema-first team detection
  259. - tool-use-result-strip strategy (5-50% on edit-heavy sessions)
  260. - image-strip strategy (keep last 20%)
  261. - Auto-update, install tracking, npm package
  262. - Safety improvements: SIGTERM handler, backup cleanup, permission error handling
  263. ## Configuration
  264. | Variable | Default | Effect |
  265. |----------|---------|--------|
  266. | `COZEMPIC_CONTEXT_WINDOW` | auto-detect | Override context window size (e.g. `200000` for Pro plan) |
  267. | `COZEMPIC_NO_AUTO_UPDATE` | off | Disable all automatic upgrades (honored by the Python updater, SessionStart hook, and npm installer). Not generally recommended — Claude Code ships frequent changes and cozempic updates keep strategies compatible with the latest session format. See [Auto-update & how to control it](#auto-update--how-to-control-it). |
  268. | `COZEMPIC_PIN` | unset | Hold a reviewed version (e.g. `1.8.30`): disables auto-update on both paths and warns on drift instead of auto-installing. For users who want the protection on a version they've vetted. |
  269. | `COZEMPIC_NO_TELEMETRY` | off | Skip anonymous usage counters. Cozempic pings a simple counter on each prune — no personal data, session content, or identifiable information is sent. Helps us prioritize development. |
  270. ## Contributing
  271. Contributions welcome. To add a strategy:
  272. 1. Create a function in the appropriate tier file under `src/cozempic/strategies/`
  273. 2. Decorate with `@strategy(name, description, tier, expected_savings)`
  274. 3. Return a `StrategyResult` with a list of `PruneAction`s
  275. 4. Add to the appropriate prescription in `src/cozempic/registry.py`
  276. ## License
  277. MIT — see [LICENSE](LICENSE).
  278. Built by [Ruya AI](https://ruya.ai).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.