English | 日本語 | 한국어 | 简体中文 | 繁體中文
Keep your agent instructions short. Load the project details only when a task needs them.
agents-context-router helps coding agents turn an oversized AGENTS.md into a small shared kernel and a set of task-specific wiki topics. A lightweight Python script prints only the selected topic; history stays available without loading into every task.
Keep rules that apply to every task in AGENTS.md. Move runbooks and reference material into topic pages, and keep dated notes in history. The agent reads the kernel, chooses a topic, and loads only that topic.
- Measures always-loaded instruction files before and after the split.
- Sorts content into a small kernel, task topics, history, and human docs.
- Routes each topic to whole files or exact Markdown headings through
wiki/ai-context.json. - Bundles
scripts/ai-context.py, a dependency-free router withlist, topic, andcheckcommands. - Checks byte budgets, missing or ambiguous headings, unlisted topics, and orphaned wiki/history files.
- Adds an in-repo maintenance guide so the router can be maintained after the skill is removed.
The default budgets are 8 KiB for the root instructions and 16 KiB per topic. Split an oversized topic instead of raising its limit.
In a Claude Code session:
/plugin marketplace add runkids/agents-context-router
/plugin install agents-context-router@agents-context-router
Add the repository's Codex plugin marketplace, then open /plugins and install agents-context-router:
codex plugin marketplace add runkids/agents-context-router --sparse .agents/plugins
codexAlready use Skillshare? Install it as a plain skill and sync it to all your targets:
skillshare install runkids/agents-context-router --global
skillshare syncOr install the complete native plugin and sync it to Claude Code and Codex alongside your other agent plugins:
skillshare plugin add runkids/agents-context-router \
--plugin agents-context-router \
--target claude --target codex --global
skillshare sync pluginsSkillshare keeps complete native plugins in one place and shows each agent's install status. See the plugin command guide.
Native manifests for more agents live in this repository:
# Pi
pi install git:github.com/runkids/agents-context-router
# Hermes Agent
hermes plugins install runkids/agents-context-router --enable
# Muse
git clone https://github.com/runkids/agents-context-router.git
muse plugins install ./agents-context-router
muse plugins approve agents-context-router# Kimi Code
/plugins install https://github.com/runkids/agents-context-router
Install it as a skill with Vercel's Skills CLI:
npx skills add runkids/agents-context-routerIn a repository with bloated agent docs, ask your coding agent:
“Our
AGENTS.mdis too big. Split it into a small kernel and task-specific wiki topics.”
The skill measures the current context, reorganizes the docs, wires the router, and checks the result. It also handles overlapping CLAUDE.md rules and preserves milestone logs in their original language.
After the refactor, the generated script works in that repository:
python3 scripts/ai-context.py list
python3 scripts/ai-context.py debugging
python3 scripts/ai-context.py checklist shows available topics. A topic command prints only its mapped sections, marked with their source paths. check validates the router and its configured limits.
AGENTS.md Always-loaded rules and topic index
wiki/ai-context.json Topic-to-document map
scripts/ai-context.py Print topics and check the docs
wiki/<topic>.md Task-specific guides and runbooks
wiki/history/*.md Dated records, kept out of default context
wiki/README.md Human-readable topic and history index
The bundled script uses only the Python standard library (Python 3.8+). Examples use python3; on Windows use python or py -3 instead. The skill tells the agent to pick the right command when it installs the router. Exact-heading references fail if a heading is missing or duplicated, so a renamed section cannot silently route the wrong instructions.
Issues and pull requests are welcome. The skill workflow and eval prompts are in skills/agents-context-router/.
MIT
If this helps keep your agent's context focused, give the repo a ⭐ so more developers can find it.