# Go API generator `apigen` generates the Go daemon protocol client and the shared API digest from the canonical OpenAPI document. - [`main.go`](main.go) reads [`docs/openapi.yaml`](../../../docs/openapi.yaml). `go -C cli/tools/apigen run .` generates outputs from the repository root. - `go -C cli/tools/apigen run . -check` fails when generated outputs differ. - Outputs are [`api.gen.go`](../../internal/daemon/protocol/api.gen.go), [`digest.gen.go`](../../internal/daemon/protocol/digest.gen.go), and the daemon's [`api_digest.gleam`](../../../apps/albedo/src/albedo/http/api_digest.gleam). - [`patches.go`](patches.go) emits patch-only presence fields and containing serializers in `patches.gen.go`; response fields keep their ordinary types. - [`metadata.go`](metadata.go) emits open problem constants, operation recovery helpers, and audience reference pages from the canonical operation metadata. Audience grouping does not change authorization. - The generator adapts schemas for Go code generation. The daemon adapter owns response decoding and SSE framing. See [the testing reference](../../../robot-docs/testing.md). See [Change the HTTP API](../../../docs/contributing-api.md) for the contract workflow.