metalworks.testing are the contract: if your adapter passes them, it
works everywhere the protocol is used.
Versioning. The protocols are versioned as a unit
(metalworks.PROTOCOLS_VERSION); minor versions add keyword-only parameters with
defaults, major versions break. Your adapter declares which version it implements.
ChatModel
thinking_budget is in tokens; adapters map it to their provider’s mechanism.
Dispatch on capabilities.native_grounding, never isinstance.
GroundedChatModel
GroundedResult carries text, chunks: tuple[GroundingChunk, ...], and
supports: tuple[GroundingSupport, ...]. Support spans are character
offsets into text (adapters convert provider byte offsets), so finding-to-
citation overlap bucketing is correct for non-ASCII output.
SearchProvider
GroundedChatModel. The research web stream prefers internal
grounding and falls back to an external SearchProvider + structured synthesis.
EmbeddingProvider
IndexIdentity (model id + dim) and
hard-fails with EmbeddingModelMismatch on a mismatch. Vectors from different
models are geometrically incompatible; same-dimension swaps degrade retrieval
silently, so the guard is a hard error, not a warning.
Storage repos
Typed repositories, not a generic document store (production tables are columnar). One backend object implements as many as it supports.BriefRepo, RunRepo, AccountRepo, OpportunityRepo, and InboxRepo follow
the same shape. Backends shipped in core: MemoryStores and SqliteStores
(WAL, serialized writer). Hosted backends (Postgres/PostgREST) are a custom
store you implement downstream — see Bring your own store.
Verify any backend with metalworks.testing.check_all_repos.
Errors
Every error carries an actionablefix and a machine-readable envelope used by
the MCP tools: