3.8 KiB
Contract Registry
Kova models OpenClaw coverage with declarative contracts. Add a new OpenClaw capability or user state by updating JSON first; change engine code only when the new contract needs evidence that Kova cannot already collect.
Add A Surface
Create surfaces/<id>.json.
Required fields:
id: stable kebab-case surface id.title: short human name.ownerArea: OpenClaw subsystem likely to own failures.description: what OpenClaw behavior this surface proves.purposes: Kova purposes this surface is relevant to, such asrelease,regression,diagnostic,performance,upgrade,plugin,provider, orsoak.processRoles: role ids fromprocess-roles/*.json.thresholds: default pass/fail thresholds for the surface.diagnostics: source-build timeline expectations when available.requirements: stable requirement ids for this surface. Each requirement owns the states or state traits, target kinds, and metrics that prove that part of the surface contract.
Then:
- Add or update one scenario in
scenarios/*.jsonwith"surface": "<id>"andprovesentries for the requirement ids it exercises. - Add missing metric ids to
metrics/known.json. - Add state fixture hooks or traits in
states/*.jsononly when the requirement needs a new user condition. - Add profile requirement coverage in
profiles/*.jsononly when the surface requirement should be part of that profile. - Run
node bin/kova.mjs plan --json. - Run a dry-run for the scenario.
- Add self-check coverage if the surface introduces new evidence parsing.
Do not add a surface for an implementation detail. A surface should represent a real OpenClaw workflow a user or release gate cares about.
Add A State
Create states/<id>.json.
Required fields:
id: stable kebab-case state id.title: short human name.objective: what user history or degraded condition this state models.traits: known traits validated by Kova.riskArea: what can break when this state is used.ownerArea: OpenClaw subsystem most likely to own state-specific failures.setupEvidence: what proves setup happened.cleanupGuarantees: what Kova must clean or destroy after execution.
Lifecycle command phases are optional. If a state needs setup, keep commands inside disposable Kova envs and make the evidence explicit. Existing user state must be represented through clone/import metadata, not direct mutation of a durable env.
Put positive state compatibility on surface requirements through states or
stateTraits. Add incompatibleSurfaces only for hard safety blocks where a
fixture must never run against a surface; do not store empty compatibility
lists.
Then:
- Pair the state with compatible scenarios or profile entries.
- Add or update surface requirements when this state becomes required proof for a surface.
- Run
node bin/kova.mjs plan --json. - Dry-run at least one scenario/state pair.
- Execute a disposable scenario when the state lifecycle mutates files, services, plugins, or runtimes.
Validation Rules
Self-check and plan validation must fail for:
- unknown surface, state, process role, metric, or profile references
- unknown purpose references
- scenarios that prove unknown surface requirements
- surface requirements that reference unknown states, traits, target kinds, or metrics
- invalid state traits
- malformed lifecycle phases
- scenario/state pairs that violate requirement state contracts or hard incompatibility blocks
- profile entries that require unknown surfaces or states
- profile gate coverage that uses derived policy fields instead of
requirementsorplatforms
If a new surface or state needs exceptions to these rules, the contract is too loose. Tighten the JSON or add a focused validator.