Smart Context Delegation — AI skill for Claude Code
Cut coding-agent token usage by ~90%: a PreToolUse hook blocks large file reads; bulk-read/code-write delegate to a cheap model.
How to install Smart Context Delegation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open romangalaxys10-spec/smart-context-delegation and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Smart Context Delegation does
Cut coding-agent token usage by ~90%: a PreToolUse hook blocks large file reads; bulk-read/code-write delegate to a cheap model. Works with Claude Code, zcode, Trae, opencode, Cursor, Cline and any shell-capable agent.
Alternatives in AI
- Repomix — 📦 Repomix is a powerful tool that packs your entire repository into a single, AI-friendly file 22.7k ★
- Graphify — AI coding assistant skill (Claude Code, Codex, OpenCode, OpenClaw, Factory Droid, Trae) 20.9k ★
- AI Guide — 程序员鱼皮的 AI 资源大全 + Vibe Coding 零基础教程,分享 OpenClaw 保姆级教程、大模型玩法(DeepSeek / GPT / Gemini / Claude)、最新 AI 资讯、Prompt 提 11.8k ★
README
⚡ Smart-Context Delegation (SCD)
**Stop feeding entire files to your frontier model. Cut coding-agent token usage by ~90%.**
A drop-in *skill* for Claude Code, zcode, Trae, opencode, Cursor, Windsurf, Cline, Roo, aider — or any agent that can run a shell command.
[](https://github.com/romangalaxys10-spec/smart-context-delegation/actions/workflows/ci.yml) [](LICENSE) [](hooks/pre_tool_use.py) [](hooks/pre_tool_use.js) [](#quick-start) [](CONTRIBUTING.md)
The 90% stat
Naive session: read 518-line file → 56,400 main-context tokens $0.169
SCD session: delegate to cheap → 5,100 main-context tokens $0.013
──────────────────── ──────
−91% tokens −92% $
Why: a file read into the main context is **re-sent as input on every subsequent turn** of the session. SCD keeps the raw file out of that loop entirely. Full math with stated assumptions: [`examples/demo-transcript.md`](examples/demo-transcript.md)
Inspired by the "How Spotify cut Claude Code token usage by 90%" diagram.
How it works
Three layers, because markdown prompts alone get ignored under context pressure:
| Layer | What | Enforcement |
|---|---|---|
| 1 · Rules | SKILL.md / CLAUDE.md / .cursor/rules |
advisory |
| 2 · Scripts | bulk-read · code-write · token-report |
operational |
| 3 · Hooks | PreToolUse gate refuses large reads | hard |
Main agent tries Read(ca
Related Skills
Sidequest
Cut Claude Code token costs by delegating bulk LLM work to cheap models. 600+ models via NanoGPT, OpenRouter,
AI Agent Guardrails Windows Guide
Verified guide: a global guardrail that blocks catastrophic shell commands from AI agents on Windows (Claude C
Expert Dispatch
new Specialist Dispatch Pattern -- let cheap AI assistants delegate complex tasks to Claude Code CLI. Bash ada
Claude Session Hooks Template
Template for AI agents to create Claude Code session hook plugins - includes SessionStart, UserPromptSubmit, S
ANet
The delegation network for AI agents — discover agents, delegate work, get cryptographically verifiable receip
Subagents Pydantic AI
Subagent Delegation framework for Pydantic AI, enabling nested subagents that can spawn their own specialists
Related Agents
Fable Worker Haiku
Fable stage worker for bulk mechanical work — file processing, format conversion, boilerplate, structured extr
Code Scout
Searches or bulk-reads a codebase to answer one fully specified factual question, returning a compact conclusi
Usage Analyst
AI spending analyst that proactively monitors and reports on Cursor Enterprise team usage patterns, spending a