0147a79d18
Phase 9a (ADR-0014): Registry.RegisterResolver for dynamic tiers; DefineTool[Args] typed tools; Usage cache/reasoning detail fields wired through anthropic/openai/google; WithPromptCaching (Anthropic cache_control); agent supervision hooks (WithMaxStepsFunc, WithSteer, WithCompactor, WithToolErrorLimits + ErrToolLoop); health Bench/Unbench/Snapshot; ChainConfig.Observer failover events. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
ADR-0014: Conversion-driven extensions (resolvers, typed tools, hooks, ops controls)
Status: Accepted — 2026-06-10
Context
Executing the mort conversion (docs/mort-migration.md) surfaced seven capabilities mort's orchestration layer needs from its model substrate. Each is general-purpose — none encodes anything mort-specific — and each was promised in the migration blueprint.
Decision
Registry.RegisterResolver— dynamic alias resolution for DB/ config-backed tiers. Checked after static aliases (static wins), in registration order, without holding the registry lock (resolvers do I/O); output expands recursively under the existing cycle guard.DefineTool[Args]— typed tools: parameters fromSchemaFor[Args], arguments unmarshaled before the handler. Schema failure panics (startup-time programming error, mirroring NewToolbox).Usagedetail fields — CacheReadTokens / CacheWriteTokens / ReasoningTokens, populated where providers report them (Anthropic cache fields; OpenAI prompt/completion detail objects; Google cached-content- thoughts). Input/Output remain totals; details are portions.
WithPromptCaching— Anthropic top-levelcache_controlauto-placement; a no-op for providers that cache implicitly or not at all.- Agent loop hooks —
WithMaxStepsFunc(dynamic ceiling, consulted every step, for supervisor budget adjustment),WithSteer(per-run message injection drained before each step),WithCompactor(pre-Generate transcript transformation; errors fall back to the original — losing a request to a broken summarizer is worse than a long prompt),WithToolErrorLimits(consecutive all-error steps and identical-call repeats end the run withErrToolLoop+ partial result). The canonical transcript inResult.Messagesis always the uncompacted truth; compaction affects only what is sent. - Manual health controls —
Tracker.Bench/Unbench/Snapshotfor ops surfaces (".failover bench" commands, dashboards). ChainConfig.Observer— one synchronous callback per failover decision (failed attempt with classification, bench, benched-skip). This is a hook, not an observability stack; persistence/metrics remain the consumer's business (anti-creep guardrail intact).
Consequences
- mort's tier resolver,
.failoveradmin surface, failover-event log, run-critic budget control, steering, and compaction all rebase onto public API. - The agent loop gains supervision points without changing its never-panic, partial-result-on-error contract.