ADR 0008 — Agent design
Status: accepted (2026-11-22)
Decision
- One coordinating agent on the Messages API with a manual tool loop that PRISM owns. "Roles" (intent, components, layout, data, logic, QA, permissions) are sections of one system prompt, not separate models. No subagents until a measured gain justifies them.
- 30 typed tools (
ToolCatalog), each with a JSON schema, a scope (catalog,draft,preview,project,system), input validation before execution, structured errors ({error: {code, message}}), an audit entry per call, and dry-run for mutating tools. No shell tool. - The agent edits a draft (
BuildWorkspace). Nothing reaches the saved project until the build ends: a first build is saved only if its checks pass; a change becomes a proposal the user reviews, checks and approves. - Catalog before code is enforced by the executor: adding a component fails with
catalog.firstuntil the catalog was consulted. - Verification is PRISM's, not the model's: when the model stops, PRISM runs validation plus a preview run itself; failures go back to the model for at most
maxRepairRounds(3) rounds. - Budgets: tool calls, turns, tokens and estimated cost; reaching one ends the build with a status that names it. Cancellation propagates to the HTTP stream.
- API usage (from the current documentation, not memory): streaming;
eager_input_streamingon tools with strict parsing and schema validation on our side; truncated (max_tokens) or refused turns never execute tools; append-only history with assistant content echoed unchanged (thinking blocks included); a cache breakpoint on the system prompt plus automatic caching of the growing conversation;output_config.effort; no sampling parameters, no forcedtool_choice; the server-side refusal fallback on the model families documented to accept it, dropped automatically if the API rejects it. - Model IDs are discovered from
/v1/models; the only hard-coded ID is the explicit fallbackAgentSettings.fallbackModel. - Rows of the user's data are never sent unless the user turns on "sample rows" (max 5 per query).
Evaluation
tests/evals/prompts.json is the fixed set; scripts/eval.sh runs it live and records valid-blueprint rate, coverage, tool calls, tokens and cost per prompt in build/evals/summary.json.