Repository Public License
1# ADR 0008 — Agent design23**Status:** accepted (2026-11-22)45## Decision6- **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.7- **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.8- 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.9- **Catalog before code** is enforced by the executor: adding a component fails with `catalog.first` until the catalog was consulted.10- **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.11- **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.12- **API usage** (from the current documentation, not memory): streaming; `eager_input_streaming` on 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 forced `tool_choice`; the server-side refusal fallback on the model families documented to accept it, dropped automatically if the API rejects it.13- **Model IDs** are discovered from `/v1/models`; the only hard-coded ID is the explicit fallback `AgentSettings.fallbackModel`.14- Rows of the user's data are never sent unless the user turns on "sample rows" (max 5 per query).1516## Evaluation17`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`.18