The governance engine: parse/audit/lock/tone/ops planes in the CLI (v0.17.0)#1
Merged
Conversation
…s in the CLI (v0.17.0)
Overhaul session 1 (see BUILDLOG.md + docs/architecture.md). The CLI grows
from installer to deterministic governance engine:
- cli/src/engine/: typed model + parser for the law plane; structural audit
with findings classified above/below the firewall; constitution.lock.json +
`constitution firewall` (F-IV as a CI gate — `lock accept` is human-TTY-only);
tone rendering as hash-keyed derived views (one canonical text, ever);
.constitution/ ops plane (events.jsonl, kanban board + static HTML dashboard,
proposals queue, compile packs); doctor (self-heal below the firewall, draft
above it, never apply).
- 14 vitest cases incl. dogfooding this repo (0 audit errors); CI workflow runs
build + tests + audit + firewall gate.
- Docs as a product: README rewrite + docs/{architecture,quickstart,firewall,
tone,ops}.md; two new cli/AGENTS.md statutes (engine determinism, tests).
- Below the firewall throughout: no Article text/status touched. Lock not yet
accepted (ratifier's act) and 0.17.0 not yet published (operator npm auth).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…scratch consumer - `constitution init --name N --ratifier R --agents a,b` for CI/scripted installs (interactive path unchanged). - Ran the [0.16.11] pre-publish standard against 0.17.0: packed tarball, npm-installed into a fresh consumer, non-interactive init, then audit/feature/compile/board/doctor from the installed binary — all working (BUILDLOG addendum). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Overhaul session 1 (standing goal: make
constitutionan installable AI-governance product). The CLI grows from installer to deterministic governance engine —cli/src/engine/: typed model + parser for the existing document formats, structural audit, the firewall lock, tone rendering, the ops plane, L4 compile packs, a ratification queue, and a self-healing doctor. Full design indocs/architecture.md; the session-by-session record (including what broke and how it was fixed) inBUILDLOG.md.Highlights:
constitution.lock.jsonrecords canonical hashes of ratified L0/L1 units;constitution firewallfails on changed/added/removed ratified text.lock acceptandratifyrefuse non-TTY sessions (agents can't cross by accident). The lock in this PR was accepted and committed by Chinmay (13f0678);constitution firewallruns clean against it.constitution render <unit> --tone plain|casual|formal; renders are derived artifacts cache-keyed by canonical hash + transform version, stale by construction on amendment, pruned bydoctor. One canonical text, ever..constitution/holds events (constitution feature <verb>), the Kanban board (constitution board [--html]with a governance-health strip), compile packs, tone caches, and the proposals queue. Volume lives there; the law never grows from usage.constitution doctorfixes below (stale caches, version sync viaconstitution.config.json, scaffold gaps) and drafts above (proposals withstatus: PROPOSED, ruled on only by interactive humanconstitution ratify).constitution compile "<task>"emits the complete canonical law pack + briefing contract; judgment stays in thecompile-promptskill.constitution init --name N --ratifier R --agents a,b; CI workflow (.github/workflows/governance.yml); README +docs/rewritten as a product; two newcli/AGENTS.mdstatutes (engine determinism, failing-first tests).Why
Shrink the intent→shipped gap and make it checkable: the law plane stays small and durable, everything voluminous is pushed into the ops plane, and the firewall becomes something CI can prove held rather than something an audit notices later.
Verification (all actually run)
npm run build(strict tsc) clean;npm test— 14/14 vitest cases, including a dogfood test that parses and audits this very repo (0 errors).constitution auditon this repo: 0 errors, honest warnings only (F-IIIHOLDS+UNGUARDEDmechanization debt).constitution firewall: clean against the human-accepted lock; lock tests prove edits/unaccepted-ratifications/repeals trip it while conformance updates and paragraph reflow don't.lock accept < /dev/nullrefuses with the F-IV message (non-TTY guard demonstrated).[0.16.11]: packed0.17.0, npm-installed into a scratch consumer, non-interactiveinit, thenaudit/feature/compile --out/board/doctorfrom the installed binary — all working.For the reviewer
[0.17.0]is agent-authored and explicitly pending your review; no Article text, status, or L0 line was touched anywhere (below the firewall throughout — the cleanconstitution firewallrun is the proof).claude -pcouldn't auth nested in-session; stub-tested + honest-degradation verified), the interactiveratifyTTY flow end-to-end (logic unit-tested), and publishing0.17.0to GitHub Packages (needs your npm auth).BUILDLOG.md(skills consuming engine output, DSAMind adoption, live dashboard).🤖 Generated with Claude Code