Skip to content

r.writeHandler(...)

r.writeHandler(...) — registers a command handler: name, Zod input schema, handler closure, plus optional access and rateLimit rules. The header is declarative; schema and body stay opaque source spans.

description is the prose the AI agent sees as this handler’s tool description in the manifest — without it, the handler stays invisible to the agent (fail-closed: no description, no exposure). agent.expose overrides that derivation explicitly (force-show or force-hide); agent.risk (“low” | “mid” | “high”) classifies the action’s blast radius, defaulting to “mid” for a write handler.

access/rateLimit/escapeHatch/agent additionally accept a RawRefSentinel for a non-literal value (imported/same-file const, or a sub-value like personalData: PD) that would otherwise lose the reference on render.


From packages/feature-ast/src/patterns.ts -> WriteHandlerPattern