optimizelisted
Install: claude install-skill ictechgy/claude-token-tools
# ContextGuard
Goal: reduce Claude Code token usage without lowering task success quality.
Use this order:
1. Measure before changing behavior.
- Ask the user to run `/usage` and `/context` if inside Claude Code.
- For first-time setup, run `context-guard-setup --plan` and offer `context-guard-setup --yes` for recommended project-local settings.
- If transcript files are available, run `context-guard-audit ~/.claude/projects --top 20 --recommend`.
- For project configuration/context bloat, run `context-guard-diet scan .`.
2. Identify the largest bucket:
- stale conversation history -> recommend `/clear` between unrelated tasks and focused `/compact` for long tasks.
- startup context -> prune `CLAUDE.md`, move long workflows to skills, disable unused MCP servers.
- large file reads -> use `context-guard-read-symbol` and the example Read guard before whole-file context.
- very large logs that may need later exact slices -> store sanitized output with `context-guard-artifact store` and query only needed lines/patterns.
- noisy command output -> use `context-guard-trim-output` wrappers or the example PreToolUse hook.
- grep/diff output with possible secrets -> use `context-guard-sanitize-output` or the example Bash hook.
- expensive reasoning -> route default work to `sonnet` and lower `/effort`; reserve Opus/`opusplan` for planning.
- noisy exploration -> keep it local: use `rg`, `context-guard-read-symbol`, artifact queries, or a bounded s