Automated hooks and skills that save your session state before compaction, sync it across devices, and restore it on every session start — so Claude always knows exactly where you left off.
╔══════════════════════════════════════════════════════════╗
║ context-engineering-kit v2.5 — Session Started ║
╚══════════════════════════════════════════════════════════╝
📅 Date/Time : Thursday May 07 2026, 09:30 UTC
🌿 Branch : main
📝 Last task : implementing auth middleware
⏱ Session start: 2026-05-07T09:30:00Z
📊 Plan : pro (300min window)
── Last session ─────────────────────────────────────────
Task : implement JWT refresh token rotation
Phase : Phase 3 — Testing
Next : write integration tests for /auth/refresh
✅ Hooks verified · State restored · Ready to continue
The Problem
Every compaction, device switch, or subscription change risks losing your task state, decisions, and progress.
Claude compacts the conversation and loses all the decisions, file paths, and task context you built up.
→ PreCompact hook saves everything before it's gone
You're mid-task on your work machine. You open your laptop at home and have no idea where you left off.
→ session_sync.sh commits state to git — pull and resume anywhere
You hit the Pro limit with no warning and lose a long session. Or you switch to Opus for a trivial rename.
→ usage-sentinel tracks burn rate and auto-saves before you hit the wall
You clone a new repo and Claude has no awareness of what you were doing, the project structure, or conventions.
→ auto_activate_new_repos bootstraps context on first open
Pro → Max → API billing — each switch is a new session with no continuity.
→ Same git repo, same session_handover.md, same state across all tiers
Default /compact summarises everything uniformly. Important code decisions get compressed the same as exploration noise.
→ /compact-smart preserves code and decisions at higher fidelity
How It Works
You install once. After that, every session start, compaction, and stop event is handled silently in the background.
State injected. New repos bootstrapped. Morning brief generated.
Usage tracked. Warnings injected at 70/80/85/92%. Auto-save triggers.
Handover generated. State merged. Files committed to git.
Task context re-injected. Claude picks up exactly where it left off.
All state files committed. Ready to resume on any device.
Features
14 hooks, 8 skills, and a suite of scripts — all working together silently.
Saves session_handover.md, merges state.json (preserves all fields), updates CLAUDE.md, and commits to git before every compaction. Nothing is lost.
Tracks Pro/Max/API usage against your 5-hour window. Injects warnings at 70%, save reminders at 80%, and auto-save directives at 85% and 92%.
Detects new git repos with no context-kit files and bootstraps them automatically. Controlled by auto_activate_new_repos in plugin_settings.json.
Relevance-scored compaction. Tags code, decisions, and error solutions for verbatim preservation. Tags exploratory noise for aggressive summarisation.
Commits session_handover.md and state.json to git and pushes. On any new device: git pull → session_sync load → resume. Works across Pro ↔ Max ↔ API.
Live view of your 5-hour window usage, context percentage, cost today, turns taken, and ETA to limit. Reads real rate_limits data from the Stop event.
Generates a structured session_handover.md with active task, completed items, remaining work, environment snapshot, and key decisions.
Switch between Haiku (fast/cheap), Sonnet (default), and Opus (complex reasoning). /model-switch auto analyses your task and recommends the right model.
Logs every tool failure with tool name, error, and file path to tool-failures.jsonl and state.json. Failures surface in handover and context-health.
Tracks every spawned subagent: type, description, start/stop timing. Running count maintained in state.json for handover visibility.
Global feature toggles: enable/disable auto-activation, usage sentinel, morning brief, tool failure logging, and subagent tracking. Skip specific repos.
find_python.sh auto-detects python3 → python → py.exe (Windows Launcher) and verifies it's Python 3 before use. Works on every Windows setup.
Installation
Plugin mode activates in every project automatically. CLI mode wires into a single project.
Recommended. Installs once, activates automatically in every project you open in Claude Code Desktop.
From the latest release, or build from source:
git clone https://github.com/musicofthings/context-engineering-kit.git cd context-engineering-kit Compress-Archive -Path . -DestinationPath ..\cek-plugin.zip -Force
git clone https://github.com/musicofthings/context-engineering-kit.git cd context-engineering-kit zip -r ../cek-plugin.zip . --exclude "*.git*" --exclude "briefs/*"
git clone https://github.com/musicofthings/context-engineering-kit.git cd context-engineering-kit zip -r ../cek-plugin.zip . --exclude "*.git*" --exclude "briefs/*"
Open Claude Code Desktop → Customize (bottom-left gear) → Upload Plugin → select the zip. Restart Claude Code.
In Claude Code settings, add to the "env" section:
# Claude Code Desktop → Customize → Advanced → env { "CEK_SUBSCRIPTION_TIER": "pro" } # pro | max | api | team
// Claude Code Desktop → Customize → Advanced → env { "CEK_SUBSCRIPTION_TIER": "pro" } // pro | max | api | team
// Claude Code Desktop → Customize → Advanced → env { "CEK_SUBSCRIPTION_TIER": "pro" } // pro | max | api | team
Open any project in Claude Code and run:
/context-engineering-kit:context-health
Standalone per-project install. Hooks wire directly into the project's .claude/settings.json.
git clone https://github.com/musicofthings/context-engineering-kit.git my-project cd my-project bash.exe setup.sh # requires Git for Windows (Git Bash)
git clone https://github.com/musicofthings/context-engineering-kit.git my-project cd my-project bash setup.sh
git clone https://github.com/musicofthings/context-engineering-kit.git my-project cd my-project bash setup.sh
# Edit config\usage_budget.json { "subscription_type": "pro" } # pro | max | api | team
# config/usage_budget.json { "subscription_type": "pro" } # pro | max | api | team
# config/usage_budget.json { "subscription_type": "pro" } # pro | max | api | team
claude.cmd # use claude.cmd on Windows (avoids PATH conflict) /context-health # verify hooks and state
claude /context-health # verify hooks and state
claude /context-health # verify hooks and state
Skills Reference
Type them in Claude Code at any time. Plugin mode prefixes with context-engineering-kit:.
| CLI command | Plugin command | What it does |
|---|---|---|
| /context-health | /cek:context-health | Full audit — hooks wired, scripts present, state valid, git sync status |
| /handover | /cek:handover | Generate session_handover.md with active task, decisions, remaining work |
| /token-status | /cek:token-status | Live: context %, 5h window %, cost today, turns, ETA to limit |
| /compact-smart | /cek:compact-smart | Relevance-scored compaction — preserves code and decisions verbatim |
| /model-switch | /cek:model-switch | Switch Haiku / Sonnet / Opus, or auto to let Claude decide |
| /session-sync | /cek:session-sync | save / load / status — sync state to git for cross-device continuity |
| /usage-forecast | /cek:usage-forecast | Daily burn rate, turns-to-warn, predicted time to subscription limit |
| /morning-brief | /cek:morning-brief | Today's AI/ML news digest from RSS feeds (auto-generated on session start) |
/cek: is shorthand for /context-engineering-kit: in plugin mode.
Hooks Reference
Every hook is wired in hooks/hooks.json (plugin) or .claude/settings.json (CLI standalone).
| Event | Script | What it saves / does |
|---|---|---|
| SessionStart | auto_init_project.sh | Bootstraps new repos with state.json + session_handover.md |
| SessionStart | session-start.sh | Injects date, branch, task, usage status into context |
| UserPromptSubmit | usage-sentinel.sh | Tracks usage %; injects warnings; auto-saves at 85/92% |
| PreCompact | pre-compact.sh | Generates handover, merges state, updates CLAUDE.md, git commits |
| PostCompact | post-compact.sh | Re-injects task/branch/state so Claude retains awareness |
| Stop (async) | extract-state-on-stop.sh | Extracts next_action and active task hint from response text |
| Stop (async) | usage-tracker.py | Records rate_limits %, context %, cost per turn to daily-usage.json |
| SessionEnd | session-end.sh | Git commits all session state files on close |
| PostToolUseFailure | post-tool-failure.sh | Logs tool failures to tool-failures.jsonl + state.json |
| SubagentStart/Stop | subagent-lifecycle.sh | Tracks delegated work; maintains running subagent count |
| PreToolUse · Bash | guard-dangerous.sh | Blocks rm -rf /, production config writes before execution |
Install in 4 steps. Works with Pro, Max, and API billing.