Skip to content

Named Zod schemas live per package

Source: harness/docs/decisions/schemas-per-package.md
Status: current

Named Zod parsers sit under each package’s own src/schemas/, and that directory is the sole definition home. Files that were the established public import seat (protocol.ts, driver config.ts, register.ts, channel.ts) re-export from there so existing imports do not fan out. There is no monorepo-wide schema dump and no dual definitions.

These stay in place, not moved: Arrival sz + EnvCapability.define configuration, openai-compat adapter wireSchema, inline InhumanTool input:, merge.ts stem-name refine, and the JSON-Schema interpreters in pretty-mcp / schema-repair.

A schema’s home is the package that owns the shape. A single shared dump inverts that — every package imports across the workspace, and a change to one shape recompiles everything. Re-export hops keep the public surface where consumers already point, so a schema move is a one-line re-export rather than an import rewrite across packages.

dist/ from before this move may still point at well-known/, shape.js, or tingle types.js — rebuild those packages before publishing.

See also: fail-laws-are-load-bearing.md.