N
Nexus API Referencev2.4.1

Claude Code Internals

API reference and code examples for the Claude Code Internals module.

GET

The Big Picture

markdown

Nine-crate map of the Claude Code agent harness, the request loop in eleven lines of pseudocode, and the eight architectural moves worth borrowing.

GET

The Tool Surface

markdown

All 50 tools cataloged by category, the four-field ToolSpec struct, and the deferred-loading mechanism that keeps the system prompt small.

GET

Sub-agents & Context Cleanliness

markdown

How the Agent tool spawns isolated runtimes, why the parent's context stays clean, and the per-subagent-type tool allowlists that prevent whole classes of mistakes.

GET

The Request Loop, Traced

markdown

End-to-end walk of one bash invocation: REPL → conversation runtime → API stream → permission gate → sandbox → tool result, with file:line refs at every step.

GET

Context, Caching, Compaction

markdown

The static-vs-dynamic system prompt boundary, where claw-code's prompt cache stops short of upstream Claude Code, and the compaction algorithm that trades cache invalidation for headroom.

GET

Plan vs Execution

markdown

How plan mode, TaskRegistry, and recovery recipes keep long agent runs from drifting off course.

GET

Permissions & Sandboxing

markdown

Five-tier permission mode, the deny-context-ask-allow-mode-default decision tree, capability-probed Linux sandboxing, and the bash validation gaps.

GET

Extensibility (Hooks, Plugins, Skills, MCP)

markdown

Five extensibility surfaces with different blast radii: hooks can block tool calls, plugins ship bundled tools, skills inject guidance, slash commands are user-invokable, and MCP brings external servers into the registry.

GET

Multi-Agent Coordination

markdown

Lanes as event streams, branch locks before merge, teams and crons — the claw-code-specific layer that enables Discord-driven autonomous coordination.

GET

The Mock Parity Harness

markdown

A faithful mock of /v1/messages plus 12 scripted scenarios — a deterministic, sub-second integration test pattern worth lifting wholesale.

GET

Patterns to Borrow

markdown

Twelve patterns ranked by impact-per-line-of-code, plus a file:line cheat sheet and the parity gaps to know about.