Skip to content

gm-o9t8.15: formalize .gemba/constitution.md schema (v1.0.0) - #12

Merged
MikeBengtson merged 2 commits into
mainfrom
worktree-agent-a6905241
May 15, 2026
Merged

MikeBengtson merged 2 commits into
mainfrom
worktree-agent-a6905241

Conversation

@MikeBengtson

Copy link
Copy Markdown
Collaborator

Summary

Constitution schema formalization with explicit versioning, additionalProperties: false enforcement, and a migration path for future keys.

  • `internal/spec/schema/constitution.schema.json` — schema v1.0.0, required `schema_version` (semver), all properties typed with defaults/descriptions, `examples` array.
  • `internal/spec/constitution/version.go` — `CurrentVersion = "1.0.0"`, idempotent `MigrateConstitution` (injects schema_version into frontmatter / `## Config` fence / prepends fresh frontmatter).
  • `internal/spec/constitution/constitution.go` — adds `SchemaVersion` + `UnknownKeys` to parsed struct; runs MigrateConstitution on Parse; `ErrUnknownConstitutionKey` returned alongside parsed Constitution (existing callers continue to work).
  • `internal/spec/lint/lint.go` — new `ScanConstitution` with rules: `constitution-version-mismatch` (warn) and `constitution-unknown-key` (error). Wired into `gemba constitution lint`.
  • `internal/spec/templates/constitution.md.tmpl` — top-level YAML frontmatter with `schema_version: 1.0.0` + permissive defaults for every catalogued key.
  • `docs/design/asdd-whitepaper.md` §10 — new "Constitution Schema (Reference)" section pointing at the schema and listing the catalogued key set.

Key set

`spec_strict`, `spec_strict_no_tasks_md`, `asdd_mode`, `require_decision_parent`, `forbid_orphan_beads`, `min_ac_count`, `require_priority`.

Test plan

  • `go build ./...` clean
  • `go test ./internal/spec/... ./internal/cli/...` — 401 pass
  • `golangci-lint run --timeout=2m` — 0 issues

Closes gm-o9t8.15.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

- JSON Schema: lock down properties, additionalProperties: false, add
  required schema_version (semver), examples, full descriptions.
- New version.go: CurrentVersion="1.0.0" + MigrateConstitution that
  idempotently injects schema_version into frontmatter or '## Config'.
- Parser: read top-level YAML frontmatter in addition to '## Config',
  surface SchemaVersion + UnknownKeys; Load returns
  ErrUnknownConstitutionKey for unrecognized top-level keys.
- Lint: new ScanConstitution emits constitution-version-mismatch (warn)
  and constitution-unknown-key (error); wired into 'gemba constitution
  lint'.
- Template: frontmatter at the top with schema_version + permissive
  defaults for every catalogued key.
- Whitepaper: new §10 "Constitution Schema (Reference)" listing the
  catalog and pointing at the JSON Schema.

Existing constitutions without schema_version still load (migration
auto-injects); strict rejection is reserved for unknown keys.
@MikeBengtson
MikeBengtson merged commit cc2395b into main May 15, 2026
11 of 14 checks passed
@MikeBengtson
MikeBengtson deleted the worktree-agent-a6905241 branch May 15, 2026 02:15
@MikeBengtson
MikeBengtson restored the worktree-agent-a6905241 branch June 10, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant