Claude-skill-registry claude-code-internals
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/claude-code-internals" ~/.claude/skills/majiayu000-claude-skill-registry-claude-code-internals && rm -rf "$T"
skills/data/claude-code-internals/SKILL.mdClaude Code Internals Explorer
Procedures for analyzing Claude Code's standalone binary.
Quick Start
Note: All script paths are relative to this skill's directory (where SKILL.md resides).
Delegate all binary exploration to subagent:
Task tool (subagent_type: Explore) Prompt: "Run scripts/find_installation.sh to get binary path. Then search for [keyword] using: strings $BINARY | grep -E '[pattern]' | head -50 Return: version, matching lines with context (-B2 -A2)."
The subagent handles token-heavy strings output; main context receives only summarized findings.
Zero-Context Mode (Recommended)
Problem: Subagent output is recorded in session logs. Binary analysis can cause session file bloat → SIGTRAP crashes.
Solution: Write prompt to temp file, then execute via Headless CLI wrapper. Script internals are not logged; only final stdout is recorded.
Workflow
- Write prompt to temp file (supports multiline)
- Execute
scripts/analyze-binary.sh <prompt_file> [allowed_tools]
Script Interface
| Argument | Description | Default |
|---|---|---|
| Prompt file path (required) | - |
| Allowed tools (comma-separated) | |
The script injects
BINARY_PATH automatically.
Example
# Use unique ID in filename for parallel independence PROMPT_FILE="/tmp/internals_prompt_$$.txt" # 1. Write prompt to temp file cat > "$PROMPT_FILE" << 'EOF' Search the binary for beta headers. Instructions: 1. Use: strings "$BINARY_PATH" | grep -E "anthropic-beta|20[0-9]{2}-[0-9]{2}" | head -30 2. List all matching headers with their apparent status 3. Note any patterns suggesting feature flags EOF # 2. Execute with tool restriction scripts/analyze-binary.sh "$PROMPT_FILE" "Bash,Read,Glob,Grep" # 3. Cleanup (optional - /tmp clears on reboot) rm -f "$PROMPT_FILE"
Dynamic Prompting
The agent constructs prompts dynamically based on investigation context.
File naming convention:
/tmp/internals_prompt_<unique_id>.txt
- Use
(PID) or UUID for parallel execution independence$$ - Multiple concurrent investigations won't conflict
PROMPT_FILE="/tmp/internals_prompt_$(date +%s%N).txt" cat > "$PROMPT_FILE" << 'EOF' Investigate context management settings. 1. Search for contextWindow, warningThreshold, errorThreshold 2. Find related numeric constants (5-6 digit numbers) 3. Return: setting name, value, surrounding context EOF scripts/analyze-binary.sh "$PROMPT_FILE"
Tool Inheritance
Agent's tool restrictions are passed to Headless CLI via
--allowedTools:
| Agent tools | Script invocation |
|---|---|
| |
| |
Why this works: Bash subagent executes the script as an external process. Only the script's stdout appears in session logs, not the intermediate 350K+ lines from
.strings
⚠️ Warning (Legacy Mode): If using direct subagent delegation below, subagent output is recorded in session logs. Large outputs (>1MB) can cause session file bloat, leading to SIGTRAP crashes on new Claude sessions. Always use
to limit results.| head -N
Workflow
1. Delegate Binary Exploration
Call Task tool with:
:subagent_typeExplore
: Specify search target and expected output formatprompt
Example delegations:
# Feature investigation Find Claude Code binary using scripts/find_installation.sh. Search for "anthropic-beta" using: strings $BINARY | grep -E "anthropic-beta|20[0-9]{2}-[0-9]{2}" | head -30 Return: version, matching lines (max 30). # Settings discovery Run find_installation.sh, then search for setting patterns: strings $BINARY | grep -E "autoCompact|permission|default.*:" | head -50 Return: setting names and apparent default values (max 50 lines).
The subagent executes commands and returns summarized findings.
2. Subagent Search Commands (Reference)
Note: These commands are for subagent execution, not main context.
# Get binary path using find_installation.sh source scripts/find_installation.sh # Sets: BINARY_PATH variable # Search with context (ALWAYS limit output!) strings "$BINARY_PATH" | grep -B2 -A2 "pattern" | head -50 # Cache for multiple searches (within subagent session) strings "$BINARY_PATH" > /tmp/claude-strings.txt grep "pattern1" /tmp/claude-strings.txt | head -30 grep "pattern2" /tmp/claude-strings.txt | head -30 # Remember to cleanup: rm /tmp/claude-strings.txt
3. Investigation Types
| Goal | Approach |
|---|---|
| Specific feature | Search for known keywords with |
| New version changes | Compare with , check release notes |
| Hidden settings | Search for setting patterns |
| Beta features | Search for beta headers |
4. Analyze & Document
- Use
for contextgrep -B2 -A2 - Compare with
references/known-features.md - Update
with new discoveriesknown-features.md
Common Investigations
| Task | Approach |
|---|---|
| Check feature enabled | |
| Find default values | See Settings section |
| Discover new commands | See Commands section |
| Compare release notes | Search mentioned features -> compare with |
Resources
- scripts/find_installation.sh: Locate Claude Code binary
- references/search-patterns.md: Comprehensive search patterns by category
- references/known-features.md: Baseline of known features for comparison
Resource Map
| Resource | Path | Load When |
|---|---|---|
| Zero-context analyzer | | Recommended default |
| Known features baseline | | Comparing with new discoveries |
| Search pattern library | | Investigating specific category |
| Installation finder | | Starting investigation |
Tips
- Cache strings:
once, grep multiple timesstrings $BINARY_PATH > /tmp/claude-strings.txt - Start narrow: Specific terms before broad exploration
- Chain searches: Find one string, search nearby for related code
- Clean up: Remove
after investigation/tmp/claude-strings.txt