Custom agents
Model and tools ENFORCED, not filtered; the tool is absent. No hot-reload.
One node in a single signed graph. Here is how this primitive connects across the other layers.
Custom agents are named agent definitions (model + tool set + instructions) stored in .claude/agents/ and referenced by skill to enforce a specific runtime sandbox.
How It Works
A custom agent is a YAML frontmatter document that declares a name, description, model (haiku/sonnet/opus), tools (comma-separated list), and optional thinking flag. Skills reference it via agent: agent-name in the skill YAML. When a skill routes to its agent, the harness enforces the model and tool set as hard constraints—not filters or suggestions. A skill with agent: cheap-researcher and context: fork spawns a Haiku worker with only Read, Grep, Glob available, period.
Location: .claude/agents/ (project), ~/.claude/agents/ (global), or plugins/*/agents/ (plugin scope).
What the Test Found
Runtime test 2026-01-07 validated three behaviors:
Model and tool enforcement works. A skill referencing
cheap-researcherrouted correctly to Haiku and refused Bash access. Tools are enforced at availability level, not execution time.Invalid agent names fail silently. Specifying
agent: totally-fake-agent-namedoesn't error; the harness falls back to defaults with no warning. This is the most dangerous finding.No hot-reload. Modifying an agent definition requires session restart. Skills hot-reload, but agents do not. This limits iteration speed during development.
Use Cases and Limits
Custom agents unlock cost-optimized multi-tier workflows (cheap research via Haiku, safe edits via Sonnet-only) and domain-specific tool sandboxing (read-only research, no-bash safety roles). They are reusable: define once in .claude/agents/, use in multiple skills.
The key limit: once an agent is named in a skill, you cannot override the model in that skill's YAML. Defining agent: cheap-researcher + model: opus does not promote to Opus; the agent wins. This is intentional but worth knowing.
Interaction with allowed-tools in skill YAML is untested.
- commitd4e4467 ↗
primitive_2baf941eb2202b4f35f9f322ed255199b87705613b1e2fd064d57fa75a6b679d2856ceafad6b1daa8f982493871b6dd73ca0ecfdc3f79dbb217f3607e36aa62bf581cdb0ec5e1bdc80a9ed257d9a3e9aaa1fdf906ce5844ee7e4cc790374d4471ba5c50df82b302dfde6245beb9d108Signed with an ed25519 key held off the repo. Anyone can verify against the published public key; nobody without the secret key can forge it. Click verify: it recomputes the signature in your browser. The signature proves integrity and authorship of this exact content — not a third-party timestamp or that the underlying claim is objectively true. signedAt is when the @f3/attest pipeline ran, not when the work happened; the evidence refs carry the source dates.
- instance-of Sandbox / Capability Class
- introduces (in) Claude Code 2.1.0 (Night Zero) Release
- verifies (in) Custom agents — runtime test Test
- emerges-from (in) The self-improver invented its own safety limits Finding
- emerges-from (in) The real sandbox boundary is the agent definition, not the skill Finding