Skip to main content
skill CX Codex

Sandbox Routing — Claude Code skill: what it does, how to install

Sandbox Routing — a skill for Claude Code routes large-file analysis and lengthy command output through sandbox tools. It activates when an agent needs a small detail without pulling the full output into context.

MIT ★ 26 updated 2026-11-16

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add wrg32786/aigent-os --skill sandbox-routing -a claude-code
Open on GitHub

What Sandbox Routing does

The skill sends analysis of large files and commands producing more than 20 lines through sandbox tools. Only the printed summary enters context; raw output stays out. Multiple commands can run as labelled chunks and be indexed for FTS5 search.

It expects context-mode or equivalent tools: ctx_execute, ctx_execute_file, and ctx_batch_execute. Without them, it recommends narrowing searches with head_limit, reading specific line ranges, and avoiding full dumps of large files. Full reads remain appropriate when editing a file.

What it helps with

  • locate a value in a large file without loading it whole
  • trim lengthy command output to the relevant result
  • run several commands and index their output for search

Example prompts for the agent

  • Find sandbox-routing in skill-index.json without loading the whole file into context.
  • Run git log --oneline -100 and show only matches for ship.
  • Extract the needed field from large-config.yaml using sandbox tools.

How to install Sandbox Routing

1Skills CLI (Vercel)

npx skills add wrg32786/aigent-os --skill sandbox-routing -a claude-code

2Manually: put the files in place

~/.claude/skills/sandbox-routing/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/sandbox-routing/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about Sandbox Routing

How do I install Sandbox Routing in Claude Code?

Run npx skills add wrg32786/aigent-os --skill sandbox-routing -a claude-code. The skill file is located at ~/.claude/skills/sandbox-routing/SKILL.md.

What does Sandbox Routing do?

It routes analysis of large files and commands with long output through sandbox tools, so only the relevant results enter context.

What does Sandbox Routing need to work?

It expects context-mode or compatible tools: ctx_execute, ctx_execute_file, and ctx_batch_execute. If they are unavailable, it falls back to bounded searches with head_limit and reads of selected line ranges.

Source text

SKILL.md · MIT
---
name: Sandbox Routing
description: "Route large files and command output through sandbox tools that return summaries. Use when extracting small details from huge files or avoiding context flooding."
---

# Sandbox Routing

> [!danger] HARD RULE — fires before any large Read or Bash that isn't for editing
> If you're about to Read a long file to *analyze* (not to Edit), or run a Bash command with >20 line output, **route through sandbox tools instead**. Raw output stays out of context; only the summary you print enters context.

This skill assumes your Claude Code install includes context-mode (or equivalent) sandbox tools — `ctx_execute`, `ctx_execute_file`, `ctx_batch_execute`. If those aren't available, the principle still applies: use `head_limit` on Grep, narrow Read to specific line ranges, and avoid `cat large.log`.

## The decision tree

```
Am I about to Read or run Bash?
   ├── Editing a file? (need full content for Edit tool)
   │     → Read is correct, proceed
   │
   ├── Running git status / git log -n short / mkdir / mv / rm / short command?
   │     → Bash is correct, proceed
   │
   ├── Reading a file just to extract a piece of info / find a line?
   │     → STOP. Use ctx_execute_file with grep/awk code that prints just the answer.
   │
   ├── Running a shell command with >20 line output?
   │     → STOP. Use ctx_execute with the same command — only printed summary enters context.
   │
   └── Multiple commands at once?
         → Use ctx_batch_execute with all commands as labelled chunks, indexed for FTS5 search.
```

## When to use each tool

### `ctx_execute(language, code)`
- Shell command with large output → `language: "shell"`
- Python data processing → `language: "python"`
- API calls + response analysis → wrap the call in code
- Anything where you want *the answer*, not the raw output

### `ctx_execute_file(path, language, code)`
- File analysis without loading the file into context
- Searching within a specific known file
- Extracting structured info from JSON/YAML/MD

### `ctx_batch_execute(commands, queries)`
- Multiple commands you want to run + index together
- Chained recon (e.g., git log + git diff + git status as one batch)
- Building a knowledge base for later FTS5 queries

## Calibration anchors

| File size | Read/Bash OK? | Sandbox? |
|---|---|---|
| <20 lines | ✅ Read/Bash | not needed |
| 20-100 lines | ✅ if editing or referencing in full | ✅ if extracting |
| 100-500 lines | ⚠️ only if editing | ✅ for extraction |
| 500+ lines | ❌ unless absolutely editing | ✅ always for extraction |

## Concrete examples

### Example A: Find an insertion anchor in a 900-line JSON
- ❌ **Wrong:** `Read skill-index.json (entire file)` to find where to insert
- ✅ **Right:** `ctx_execute_file path=skill-index.json code='grep -n "skill-name" skill-index.json'` → returns just the line number, then use Edit

### Example B: Check git log for a specific commit pattern
- ❌ **Wrong:** `Bash: git log --oneline -100` (100 lines of log into context)
- ✅ **Right:** `ctx_execute language=shell code='git log --oneline -100 | grep -i "ship"'` → returns just matches

### Example C: Read a large config file for one value
- ❌ **Wrong:** `Read large-config.yaml`
- ✅ **Right:** `ctx_execute_file path=large-config.yaml code='grep "specific_key" large-config.yaml'`

## Output format

When this skill fires, internally evaluate before the tool call:
- Will the raw output be >20 lines AND I don't need it for editing?
- If yes → re-route to sandbox before invoking

You don't need to announce this to the principal. Just use the right tool.

## Anti-patterns this prevents

- Reading a 900-line skill-index just to find an insertion anchor
- `cat large.log` via Bash to "see what's happening"
- Reading 50-page docs to extract one quote
- Running parallel Bash commands when a single batch call could do one round-trip
- The PreToolUse hooks firing reminders that get ignored as false positives

## Connects to

- [`/timeline-calibration`](../timeline-calibration/SKILL.md) — sister discipline rule, both about respecting the resource budget

© wrg32786 · MIT · wrg32786/aigent-os

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set58

The whole set →
setup This Claude Code skill configures aigent-OS identity, priorities, and authority boundaries. Run /setup to configure the system or revise specific sections later. CX Codex +1 ★ 26repo stars semantic-search The semantic-search Claude Code skill searches an Obsidian vault by meaning using local embeddings. It runs for finding related notes or recalling what you wrote about a topic. CX Codex +1 ★ 26repo stars Self-Review The Self-Review Claude Code skill sends substantial code changes through a focused second review. It targets multi-file edits, hot paths, prompts, and work that still feels uncertain. CX Codex +1 ★ 26repo stars scout-vault The scout-vault Claude Code skill finds related vault notes, links, and code definitions. It runs for note discovery, vault inventory, or call-chain searches. CX Codex +1 ★ 26repo stars resume Restores context for unfinished work. Run /resume to compare the saved capsule with live memory and take the next step. CX Codex +1 ★ 26repo stars research-deep The research-deep Claude Code skill combines vault notes, web sources, and GitHub research into a cited briefing with evidence and a recommendation. It runs on requests to investigate a topic or compare sources. CX Codex +1 ★ 26repo stars reconcile This Claude Code skill compares seven days of project attention with stated Tier-1 shares. Run it to reconcile attention or check for priority drift. CX Codex +1 ★ 26repo stars Promote The Promote Claude Code skill turns useful conversation insights into lasting vault notes. It activates when a decision, fact, or idea should remain available after the session. CX Codex +1 ★ 26repo stars

Project sponsors

Companies that keep this analytics open