Define a subagent specification (compiles to agents/<name>.md).
// agents/reviewer.md.spec.ts
export default agent({
name: "reviewer",
description: "Review a diff for correctness. Dispatch PROACTIVELY after edits.",
model: "sonnet",
tools: ["Read", "Grep", "Bash"],
body: instructionsReview the diff. Run ${cmd("npm test")} first.,
rules: {
"no-floating": enforce("@typescript-eslint/no-floating-promises", "Await promises."),
},
});
Generic over a tool Vocabulary (default OpenToolVocabulary — no
constraint). A harness adapter re-exports a vocabulary-bound agent (e.g.
vigiles/claude-code) so purity: "pure" + a side-effecting tool is a tsc
error at edit time; the bare core agent() accepts any tools, as before.
Also generic over the result's Ok/Err shapes, inferred from output: result(...). The returned value is a TypedAgentSpec<Ok, Err> — an
AgentSpec that carries those shapes at the type level, so a typed pipe
can cross-reference the handoff. With no output the shapes default to the
erased Shape, and the value is still a plain AgentSpec — backwards-compatible.
Define a subagent specification (compiles to
agents/<name>.md).// agents/reviewer.md.spec.ts export default agent({ name: "reviewer", description: "Review a diff for correctness. Dispatch PROACTIVELY after edits.", model: "sonnet", tools: ["Read", "Grep", "Bash"], body: instructions
Review the diff. Run ${cmd("npm test")} first., rules: { "no-floating": enforce("@typescript-eslint/no-floating-promises", "Await promises."), }, });Generic over a tool
Vocabulary(defaultOpenToolVocabulary— no constraint). A harness adapter re-exports a vocabulary-boundagent(e.g.vigiles/claude-code) sopurity: "pure"+ a side-effecting tool is atscerror at edit time; the bare coreagent()accepts any tools, as before.Also generic over the result's
Ok/Errshapes, inferred fromoutput: result(...). The returned value is aTypedAgentSpec<Ok, Err>— anAgentSpecthat carries those shapes at the type level, so a typedpipecan cross-reference the handoff. With nooutputthe shapes default to the erasedShape, and the value is still a plainAgentSpec— backwards-compatible.