ctx hooks into Claude Code's compaction cycle to automatically capture and restore your working context — goal, decisions, and next steps — across every session.
Every time Claude Code hits its context limit, it compacts. The conversation is summarized — but your specific goal, the decisions you made, the file you were editing — all of it gets diluted or lost.
ctx hooks into three Claude Code events. Install once, it works automatically from that point forward.
Run /compact manually or let Claude Code auto-compact. The PreCompact hook fires and ctx gets to work.
ctx reads the session transcript and git state, calls claude -p to extract semantics, and writes a structured snapshot scoped to the current branch.
On every new session, the SessionStart hook finds the snapshot for your project and branch and injects it as context. Claude knows exactly where you were and what to do next.
Install the binary, run ctx init, and ctx starts working on every compaction and session start.
Binary lands in ~/.local/bin (macOS/Linux) or %LOCALAPPDATA%\Programs\ctx (Windows)