assafkip

Claude Focus — Development skill for Claude Code

Development community

Three hooks that fix Claude Code's attention drift.

How to install Claude Focus

This entry records only its repository, not the path inside it, so there is no exact command to give. Open assafkip/claude-focus and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Focus does

Three hooks that fix Claude Code's attention drift. Cited research, one-line install.

Alternatives in Development

  • Ecc Guide — Navigate ECC's current agents, skills, commands, hooks, install profiles, and docs from the live repository su 243.5k ★
  • Fix Py Line Too Long 71.9k ★
  • Bib Filter — Filter a LaTeX project's bibliography to the entries actually cited 130 ★

README

claude-focus

**Three hooks that stop Claude Code from drifting, lying about "done," and burning tokens.** ~550 lines of Python. Zero dependencies. MIT. Drop them into `~/.claude/hooks/` and wire three lines of settings.

git clone https://github.com/assafkip/claude-focus.git ~/.claude/hooks/claude-focus
cp ~/.claude/hooks/claude-focus/examples/settings.example.json ~/.claude/settings.json

Open Claude Code. The hooks are live. If you already have a `~/.claude/settings.json`, merge the `hooks` block instead of overwriting.

The three hooks are `token-guard.py` (circuit breaker), `verification-gate.py` (catches false "done" reports), and `echo-of-prompt.py` (re-injects the original task so the model stops drifting). They run as PreToolUse / UserPromptSubmit / Stop hooks. No LLM call sits in the hot path, so they are fast and deterministic.

Version 1.1 - updated 2026-05-28

How do I stop Claude Code from running away and burning tokens?

Add a `PreToolUse` hook that counts tool calls and blocks the turn when it sees a runaway pattern. `token-guard.py` is that hook. It catches the model retrying a failed call three times, making 50 tool calls with no user input, spawning subagents that produce nothing, or hammering an MCP server. When a pattern trips, it blocks the turn (exit code 2) and tells the model what to do instead.

Trigger What it catches Action
Same tool + same input, 3x Retry loops without diagnosis Block
50 tool calls since last user message Runaway execution Block
25 subagents since last user message Agent-spawn storm Block
30 MCP calls in 60s API hammering Block
3 edit attempts on same file Wrong-approach edit spiral Block
Attempted edit to .env, .pem, .key Accidental secret exposure Block
15 consecutive reads, no write Grep drift Warn
Same file read 3x Re-read loop Warn
5 greps since last write Searching instead of wo