cozempic
cozempic copied to clipboard
Context cleaning for Claude Code — prune bloated sessions, protect Agent Teams from context loss, auto-guard with tiered pruning
## Audit-P1 remediation: merge #128/#129/#130 + close all whole-codebase-audit P1s Closes the confirmed P1s from the 2026-06-15 whole-codebase QA-fleet audit, and merges three clean contributor PRs, on one branch. **Suite...
Follow-up to my review comment on #138 (https://github.com/Ruya-AI/cozempic/pull/138#issuecomment-4719614747) — this targets the `remediation/audit-p1` branch with the 3 cleanest, independently-verified fixes from that review (the HIGH + two MED). RED→GREEN per...
## Problem `agents_active` (guard.py) was `any(s.status in ("running","unknown") for s in state.subagents)` — it iterated ONLY `state.subagents`, never `state.teammates`. An `Agent`-tool-spawned teammate lives in `state.teammates`, so a running teammate +...
## Problem Two task-notification block-regexes in the reload-gate + checkpoint hot path ran **uncapped** DOTALL lazy-star on attacker-sized message content — O(openers × len), freezing the 30s loop: - `guard.py:2518`...
## Problem Three test modules resolve the current session / checkpoint through the **real `~/.claude`**, so they FAIL whenever pytest runs on a machine with an active Claude session (i.e....
## Problem — the reload-storm guard can be silently disabled The reload-**storm** guard (which stops a runaway reload→regrow→reload loop) could be silently defeated four ways: 1. **Unbounded env knobs.** \`_reload_ledger_window_s\`...
## Problem — slug split-brain `reload_lock._slug_for` was the **only** slug producer that did not lowercase its input: | producer | behaviour | |---|---| | `reload_lock._slug_for` | `_SAFE_CHARS_RE = [^a-zA-Z0-9_-]`, **no...
Three guard.py lifecycle / resource cleanups (LOW–MED), none touching the hot reload path. Per-line analysis confirmed no overlap with the in-flight reload-gate PRs. ## GC-1 — SIGTERM startup-leak `_graceful_shutdown` (the...
## Problem — phantom-clear / phantom-terminate of live agents via user-typed text The reload-gate read genuine-harness-delivery markers from surfaces that **untrusted user-typed text** also occupies → a user/injected string could...
## Problem On a compacted session, compact-summary-collapse relinks the `compact_boundary` entry's `parentUuid` to `None` (it becomes the single root — the pre-boundary history has been replaced by the compact summary)....