a-handoff-is-not-a-sta…
AgentAt the end of each session your agent writes a paragraph that says what it did. The next session still spends its first half hour…
Your harness has grown to about two hundred tools across several teams. The model cannot hold all of them in context, two teams once registered the same name and the second silently replaced the first, and the success rate has fallen as the catalog grew. Design the registry and
Claude Code
$ npx -y skills add rohitg00/ai-engineering-from-scratch --agent claude-code
Cursor
Cursor also loads subagents from .claude/agents, so copy this file there to use it in Cursor.
id: two-hundred-tools-in-the-catalog title: Two hundred registered tools, forty visible at a time card: agents kind: design level: 4 roles: [agentic-ai-engineer, forward-deployed-ai-engineer] rounds: [system-design, design-review] tags: [tool-registry, progressive-disclosure, tool-catalog, schema, dispatcher] minutes: 15 lessons: [phases/19-capstone-projects/21-tool-registry-schema-validation, phases/14-agent-engineering/31-agent-workbench-why-models-fail] manuals: [] practice: [] cheatsheet: [tool-calling, agent-harness] related: [agents/error-paths-the-model-can-fix] updated: 2026-11-03
Your harness has grown to about two hundred tools across several teams. The model cannot hold all of them in context, two teams once registered the same name and the second silently replaced the first, and the success rate has fallen as the catalog grew. Design the registry and the policy for what the model sees on each turn.
Make the registry the only source of truth for what exists, what shape the arguments take and which handler runs, and surface only ten to forty tools per turn. The registry holds a typed record per tool, rejects a second registration of a name unless the caller asks to override, and validates every call against a small schema subset with pointer-shaped errors. The exposure policy loads tool metadata into context only when the task needs it, and the fewer tools the model sees, the better it calls them.
| Field | Purpose | |---|---| | `name` | Unique, lower-case segments separated by dots | | `description` | One line shown to the model | | `schema` | A subset of JSON Schema with eight keywords | | `handler` | The callable, opaque to the validator | | `idempotent` | Lets the dispatcher decide whether a retry is safe | | `timeout_ms` | Per-tool override of the dispatcher default |
The schema is data and the handler is code. Keep them apart so that validation never ends up inside handlers.
1. **No silent overwrite.** `register` raises on a known name unless `override=True`. The incident in the prompt is this rule missing. 2. **Validate before dispatch.** A pure, recursive walk over the schema returns `Ok` or a list of errors with JSON pointer paths. No coercion, no handler call, no I/O, so the validator can run again over a replay log. 3. **The registry is shape, not safety.** Timeouts and sandboxing live in the dispatcher. A validated call can still misbehave.
A catalog of two hundred tools and a context that fits forty is a routing problem. Surface a subset per turn based on the task, and load the rest just in time. The workbench lesson describes the pattern as skills that are revealed step by step: a function registry whose metadata enters context only when needed. The same lesson reports a team that deleted 80 percent of its agent's tools and saw the success rate go from 80 percent to 100 percent. More tools in view means more wrong choices, longer prompts and more schema to misread.
Practical selection signals: the active scope contract, the task type on the board, the tools used in the last few turns, and an explicit request from the model for a named family. Log the exposed set per turn so that a failure can be traced to a missing tool rather than a wrong call.
Past about fifty tools, add `$ref` against a local definitions block so that shared argument shapes are written once, and `additionalProperties: false` so that an extra argument is an error rather than a silent drop. Both are small. Both are common.
The [tool registry lesson](../../../phases/19-capstone-projects/21-tool-registry-schema-validation/) builds the record and the validator, and the [why capable models still fail lesson](../../../phases/14-agent-engineering/31-agent-workbench-why-models-fail/) places skills and tool catalogs among the harness primitives.
At the end of each session your agent writes a paragraph that says what it did. The next session still spends its first half hour…
Read this part of the harness loop. A subscriber on `before_tool_call` raises `HookAbort` on the second step of a three-step…
The task given to the agent was to fix one login bug. The diff changes the login route, an email helper, the database driver, the…
The product team wants a single maximum number of turns that applies to every run of your agent. The agent handles one-line…
Read this run method from the toy agent loop. A caller shows the returned string to the user as the answer. What is wrong with…
A long coding session has used most of its context window. The runtime offers to summarize the older turns and keep going. Your…
Reviews the repository's shared Claude Code configuration (.claude/settings.json, CLAUDE.md, .claude/rules/, .mcp.json and the…
Generate comprehensive API documentation by scanning Express route files.
Advisor to a busy principal. Optimizes for the user's time, attention, and decision quality. One of the starter-kit council…