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 ★
- Bot On Anything — A large model-based chatbot builder that can quickly integrate AI models (including ChatGPT, Claude, Gemini) i 4.2k ★
- System One Connector — System One MCP connector to evaluate anything fast and cheap 340 ★
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
Ethos Gate
A PreToolUse safety gate for autonomous AI agents: blocks irreversible or outward-facing actions (sends, spend
ANet
The delegation network for AI agents — discover agents, delegate work, get cryptographically verifiable receip
Polyagent MCP
Let any AI agent (Claude Code, Codex, Gemini/Antigravity) delegate to the Cursor CLI agent via MCP: cheap/fast
Cursor MCP Bridge
Let any AI agent (Claude Code, Codex, Gemini/Antigravity) delegate to the Cursor CLI agent via MCP: cheap/fast
Related Agents
Bulk Reader
Cheap worker for I/O-heavy reading. Use instead of reading large files (>350 lines) or several files into the
Fleet Implement Cheap
Bulk or low-stakes implementation on budget or free models: mechanical edits, boilerplate, and large repetitiv
Project Automation Auditor
Audits a project's automation and verification posture: test runner, formatter/linter PostToolUse hooks, PreTo