Repository navigation
v1.2.0 — Atomic writes, strict session resolution, schema-first teams, real supervisor
What's New
Atomic file writes
All session writes now use write → fsync → os.replace(). No partial writes on crash, interrupt, or full disk. Applies to save_messages() and fix_corrupted_tool_use().
Strict session resolution
Destructive operations (--execute, reload, guard auto-detect) now refuse to act when the session match is ambiguous. Previously they'd silently pick the most recently modified file and operate on the wrong session. Now they error out and ask you to specify explicitly.
Schema-first team detection
Team messages are now classified by tool_use block names (Task, TaskCreate, TaskUpdate, etc.) and <task-notification> XML only. Keyword scanning of text content has been removed, eliminating false positives that could accidentally protect non-team messages from pruning.
Strong-join config merge
~/.claude/teams/*/config.json is now merged into state only when there's a matching leadSessionId, leadAgentId, or member intersection. The loose "most-recent config wins" fallback is gone.
Real supervisor on guard reload
Guard now sends SIGTERM, waits up to 5s for a clean exit, then SIGKILL before spawning the resume watcher. Previously it only spawned the watcher without terminating Claude first. SSH sessions detect this condition and print manual recovery instructions instead.
Dual-channel token metrics
metadata-strip records the exact token count from usage fields before stripping them. If the session had usage data, you see real pre-treatment token counts. treat prints a note when the method shifts from exact to heuristic after stripping.
Stale-backups scope fix
doctor now targets *.jsonl.bak files only (not all *.bak files), preventing accidental deletion of non-Cozempic backup files.
New Tests
97 new tests across 5 new test files, including a golden corpus suite with 5 real-world JSONL fixtures covering bloated sessions, team protection, corrupted tool use, orphaned tool results, and post-compact recovery.
Upgrade
pip install --upgrade cozempic