v2.5.0 — Claude Code Plugin + CLI

Never lose context
in Claude Code again.

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.

claude — context-engineering-kit
╔══════════════════════════════════════════════════════════╗
║ 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

Claude Code has a memory problem.

Every compaction, device switch, or subscription change risks losing your task state, decisions, and progress.

🔄

Context window fills up

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

💻

Switching devices

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

📊

No usage visibility

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

🆕

Every new repo starts cold

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

🔀

Subscription changes break flow

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

🧹

Context rot

Default /compact summarises everything uniformly. Important code decisions get compressed the same as exploration noise.

→ /compact-smart preserves code and decisions at higher fidelity

Hooks wire into Claude Code automatically.

You install once. After that, every session start, compaction, and stop event is handled silently in the background.

🚀

Session Start

State injected. New repos bootstrapped. Morning brief generated.

💬

Every Prompt

Usage tracked. Warnings injected at 70/80/85/92%. Auto-save triggers.

📦

Pre-Compact

Handover generated. State merged. Files committed to git.

♻️

Post-Compact

Task context re-injected. Claude picks up exactly where it left off.

🔚

Session End

All state files committed. Ready to resume on any device.

Everything context preservation needs.

14 hooks, 8 skills, and a suite of scripts — all working together silently.

Hook · PreCompact

pre-compact.sh

Saves session_handover.md, merges state.json (preserves all fields), updates CLAUDE.md, and commits to git before every compaction. Nothing is lost.

Hook · UserPromptSubmit

usage-sentinel.sh

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%.

Hook · SessionStart

auto_init_project.sh

Detects new git repos with no context-kit files and bootstraps them automatically. Controlled by auto_activate_new_repos in plugin_settings.json.

Skill

/compact-smart

Relevance-scored compaction. Tags code, decisions, and error solutions for verbatim preservation. Tags exploratory noise for aggressive summarisation.

Skill

/session-sync

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.

Skill

/token-status

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.

Skill

/handover

Generates a structured session_handover.md with active task, completed items, remaining work, environment snapshot, and key decisions.

Skill

/model-switch

Switch between Haiku (fast/cheap), Sonnet (default), and Opus (complex reasoning). /model-switch auto analyses your task and recommends the right model.

Hook · PostToolUseFailure

post-tool-failure.sh

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.

Hook · SubagentStart/Stop

subagent-lifecycle.sh

Tracks every spawned subagent: type, description, start/stop timing. Running count maintained in state.json for handover visibility.

Config

plugin_settings.json

Global feature toggles: enable/disable auto-activation, usage sentinel, morning brief, tool failure logging, and subagent tracking. Skip specific repos.

Platform

Windows-native

find_python.sh auto-detects python3pythonpy.exe (Windows Launcher) and verifies it's Python 3 before use. Works on every Windows setup.

Two ways to install.

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.

1

Download the plugin zip

From the latest release, or build from source:

Windows PowerShell
git clone https://github.com/musicofthings/context-engineering-kit.git
cd context-engineering-kit
Compress-Archive -Path . -DestinationPath ..\cek-plugin.zip -Force
macOS
git clone https://github.com/musicofthings/context-engineering-kit.git
cd context-engineering-kit
zip -r ../cek-plugin.zip . --exclude "*.git*" --exclude "briefs/*"
Linux
git clone https://github.com/musicofthings/context-engineering-kit.git
cd context-engineering-kit
zip -r ../cek-plugin.zip . --exclude "*.git*" --exclude "briefs/*"
2

Upload to Claude Code Desktop

Open Claude Code Desktop → Customize (bottom-left gear) → Upload Plugin → select the zip. Restart Claude Code.

3

Set your subscription tier

In Claude Code settings, add to the "env" section:

Windows PowerShell
# Claude Code Desktop → Customize → Advanced → env
{ "CEK_SUBSCRIPTION_TIER": "pro" }  # pro | max | api | team
macOS
// Claude Code Desktop → Customize → Advanced → env
{ "CEK_SUBSCRIPTION_TIER": "pro" }  // pro | max | api | team
Linux
// Claude Code Desktop → Customize → Advanced → env
{ "CEK_SUBSCRIPTION_TIER": "pro" }  // pro | max | api | team
4

Verify

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.

1

Clone and run setup

Windows PowerShell
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)
macOS
git clone https://github.com/musicofthings/context-engineering-kit.git my-project
cd my-project
bash setup.sh
Linux
git clone https://github.com/musicofthings/context-engineering-kit.git my-project
cd my-project
bash setup.sh
2

Set subscription tier

Windows PowerShell
# Edit config\usage_budget.json
{ "subscription_type": "pro" }   # pro | max | api | team
macOS
# config/usage_budget.json
{ "subscription_type": "pro" }   # pro | max | api | team
Linux
# config/usage_budget.json
{ "subscription_type": "pro" }   # pro | max | api | team
3

Launch and verify

Windows PowerShell
claude.cmd      # use claude.cmd on Windows (avoids PATH conflict)

/context-health  # verify hooks and state
macOS
claude

/context-health  # verify hooks and state
Linux
claude

/context-health  # verify hooks and state

Eight slash commands.

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.

Fires automatically. You do nothing.

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

Start where you left off.
Every time.

Install in 4 steps. Works with Pro, Max, and API billing.