Skip to content

docs(claude,hooks): D2 v2-governance — CLAUDE.md plugin-host kernel + pre-commit ZERO-ALIASES teeth (#49) - #88

Merged
atrawog merged 5 commits into
mainfrom
feat/d2-v2-governance
Jul 13, 2026
Merged

atrawog merged 5 commits into
mainfrom
feat/d2-v2-governance

Conversation

@atrawog

@atrawog atrawog commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

#49 (D2, superproject half) — v2-governance: CLAUDE.md plugin-host kernel + pre-commit ZERO-ALIASES teeth

Operator-directed v2-architecture governance. The plugins half (#42) carries the boundary-law sweep + the ## Target architecture (v2) design section + the pr-validator ARCHITECTURE GATE + the agents responsibility matrix; THIS half adds the CLAUDE.md contract + the runtime pre-commit teeth.

Changes

  • CLAUDE.md — the Key Rule renamed "Core is the kernel" → "Core is a PLUGIN HOST" + rewritten (plugin-host fabric only — loading / registry+transports / prescan-dispatch / kind-decode-materialize / reverse-broker; imports sdk/spec+proto only; everything else = K-wave migration inventory) + the IMPORT-PURITY + ZERO-ALIASES standing rules + the P16 TRIPLE gate. The boundary-law (M) clause drops "irreducibly on the load/build/deploy spine"; (D) gains loaderkit.Threaded. R5 corollary + the responsibility-matrix pointer; the internal self-reference to the renamed heading swept.
  • .claude/hooks/pre-commit-gate.sh — the ZERO-ALIASES teeth (assert_no_new_alias, tier-independent, fail-OPEN): blocks a NEW charly/*_aliases.go file or a declaration-form kit-alias line (type X = kit.Y / var x = kit.Y) in any charly/*.go. Deliberately does NOT match a plain residual kit call/import (the migration-pattern exception the pr-validator judges).
  • .claude/hooks/gate_test.py — +4 cases (new-alias-file / type-alias-line → BLOCK; residual call / import → ALLOW). 81/81 green.
  • VISION.md — R5 cross-ref POINTER sweep ONLY (renamed Key-Rule heading), NOT a VISION content change (the design detail lives in /charly-internals:plugin).

The plugins gitlink bump is the chain's final step

Not in this commit yet — appended after #42 merges (B2 producer-first: the gitlink must reference a commit on plugins main, which only the merge produces).

R10 — hook/script change class (the hook executed live)

Tier analysed on a live system. gate_test.py 81/81 + an old-ALLOW/new-BLOCK differential: a NEW charly/*_aliases.go → OLD hook=ALLOW (no teeth) vs NEW hook=BLOCK (teeth bite). The docs (CLAUDE.md, VISION cross-ref) ride along.


https://claude.ai/code/session_017rPy3PE6EuVHWsBbAUvxxL

Assisted-by: Claude (analysed on a live system)

atrawog added 3 commits July 13, 2026 09:53
… pre-commit ZERO-ALIASES teeth (#49)

The superproject half of #49 (D2, operator-directed v2-architecture governance).

- CLAUDE.md: the Key Rule renamed "Core is the kernel" -> "Core is a PLUGIN HOST" + rewritten
  (plugin-host fabric only: loading/registry/transports/prescan-dispatch/kind-decode-materialize/
  reverse-broker; imports sdk/spec+proto only; everything else = K-wave migration inventory) +
  the IMPORT-PURITY + ZERO-ALIASES standing rules + the P16 TRIPLE gate. The boundary-law (M) clause
  drops "irreducibly on the load/build/deploy spine" (only loading/dispatch/materialize/broker are
  in-core M); (D) gains loaderkit.Threaded. R5 corollary + the agents responsibility-matrix pointer;
  the internal self-reference to the renamed heading swept.
- .claude/hooks/pre-commit-gate.sh: the ZERO-ALIASES teeth (assert_no_new_alias, tier-independent,
  fail-OPEN) -- blocks a NEW charly/*_aliases.go file or a declaration-form kit-alias line
  (type X = kit.Y / var x = kit.Y) in charly/*.go; a plain residual kit call/import a K-wave move
  leaves is NOT matched (the migration-pattern exception the pr-validator judges).
- .claude/hooks/gate_test.py: +4 cases (new-alias-file / type-alias-line -> BLOCK; residual
  call / import -> ALLOW). 81/81 green + an old-ALLOW/new-BLOCK differential.
- VISION.md: R5 cross-ref POINTER sweep only (renamed Key-Rule heading), NOT a VISION content change.

The plugins gitlink bump to the merged D2 plugins half (#42) is the chain's final step, appended
after #42 merges.

Assisted-by: Claude (analysed on a live system)
Claude-Session: https://claude.ai/code/session_017rPy3PE6EuVHWsBbAUvxxL
…D2 plugins half (#49)

The chain-final pointer bump: plugins #42 (the boundary-law plugin-host skill rewrite,
the pr-validator ARCHITECTURE GATE, the orchestrator integrity duty + responsibility
matrix) merged as b7082ae on plugins main; this superproject commit pins it. Pure
submodule-pointer bump to an all-documentation submodule commit — the narrative lives
in the plugins CHANGELOG and the superproject 2026.194.0751 entry from the first commit.

Assisted-by: Claude (documentation reviewed)
Claude-Session: https://claude.ai/code/session_017rPy3PE6EuVHWsBbAUvxxL
@atrawog

atrawog commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — CHANGES REQUESTED ❌

Change class: hook/workflow + docs (runtime script class → analysed on a live system)

Independently re-derived against R0–R10 + the skills. One blocking finding; everything else is a clean PASS (fix is one clause, then re-push).

Verified GREEN (re-run, not trusted)

  • plugins gitlink == b7082ae exactly (my own git ls-tree) = the real merged plugins main (my feat(landing): squash-only merges; a PR is updated in place, never closed and recreated #42 squash). Effective diff = exactly the 6 D2 files, no pollution; base current (659567a).
  • Security (T3/T4): pre-commit-gate.sh ONLY adds assert_no_new_alias — no existing gate removed/loosened (sole existing-code change is whitespace). fail-OPEN (doctrine floor). KIT_ALIAS_DECL precisely excludes plain calls/imports. A strengthening, not a weakening.
  • gate_test.py LIVE on the feat-branch hooks → EXIT 0, 81/81. The 4 new fix(vm): clear the managed save image when undefining a domain #49 cases pass both directions (new *_aliases.go → BLOCK; type X = deploykit.Y → BLOCK; residual kit CALL → ALLOW; residual kit IMPORT → ALLOW). Every pre-existing invariant (force-push / no-verify / direct-to-main / hooksPath / tier / CHANGELOG / go-lint) still passes.
  • CLAUDE.md ①② (Key Rule "Core is a PLUGIN HOST" + (M) spine-drop + (D) loaderkit.Threaded) pair exactly with PR1's plugin/SKILL.md and resolve its forward-refs; R5 corollary added. VISION:53 pointer sweep correct; old-title Core is the kernel → 0 hits. CHANGELOG present, valid CalVer.

❌ Blocking — R5/R1 claim-keyed sweep miss (item 9)

The CLAUDE.md "Hooks doctrine" bullet enumerates the pre-commit hook's mechanical gates by name — hook-bypass, illegal/absent tier, force-push, direct-push-to-main, the missing-CHANGELOG gate (#34), and the golangci-lint-clean gate. This cutover adds a 7th commit-time mechanical gate (assert_no_new_alias / ZERO-ALIASES) to pre-commit-gate.sh, and PR1's already-merged agents-skill 4-layer enforcement stack explicitly names "the pre-commit hook (commit-time no-new-alias / no-new-kit-import block)" as layer 1 — but the CLAUDE.md hooks-doctrine enumeration was not swept to include it.

Result: CLAUDE.md now describes its own hook's mechanical gate-set incompletely, and is internally inconsistent with the merged agents skill's 4-layer stack. R1 makes this a documentation-divergence incident; R2/R5 make the fix blocking in this same cutover (the enumeration already lists this gate's siblings — the per-gate convention is established, so the sweep must include the new gate). The CHANGELOG confirms the sweep reached R5, the Key Rule, (M)/(D), the Agents pointer, and the renamed-heading self-reference — but not this bullet.

Fix (one clause, same cutover)

Add the ZERO-ALIASES / no-new-alias commit-time gate to the CLAUDE.md "Hooks doctrine" bullet's enumeration (alongside its siblings; matching the agents-skill 4-layer-stack layer-1 wording). Append the fix commit in place and re-push — the status resets and I re-validate. No other change required.

Assisted-by: Claude (analysed on a live system)

atrawog added 2 commits July 13, 2026 10:20
…ks-doctrine enumeration (#49)

R5 fix (V-D2chain CHANGES-REQUESTED on #88): the Hooks-doctrine PreToolUse-gate enumeration
named 6 gates but omitted the 7th this cutover adds — the ZERO-ALIASES no-new-alias block.
Appended it (declaration-form, tier-independent, fail-open, allows residual kit imports/calls)
so CLAUDE.md matches the hook gate-set and the merged #42 agents-skill layer-1 enforcement
wording. Docs-only; the hook files are unchanged (no gate re-run needed).

Assisted-by: Claude (documentation reviewed)
Claude-Session: https://claude.ai/code/session_017rPy3PE6EuVHWsBbAUvxxL
Evaluator-applied merge-time CalVer stamp for the D2 superproject cutover:
rename the placeholder CHANGELOG entry + rewrite its H1 date.

Assisted-by: Claude (documentation reviewed)
@atrawog
atrawog merged commit c1fcaa6 into main Jul 13, 2026
@atrawog
atrawog deleted the feat/d2-v2-governance branch July 13, 2026 08:25
github-actions Bot pushed a commit that referenced this pull request Nov 17, 2026
…ate org-wide (#1180)

* chore(deps): bump spec/sdk/plugin-box to the releases that fix vm create org-wide

Consumes opencharly/spec#342, which makes `#ResolvedVm.backend` and `.autostart` optional, and
therefore fixes the failure that has blocked every `charly vm create`:

  charly: error: command "vm": applying vm defaults for "<entity>":
    applyCueDefaults vm: decode: autostart: cannot convert non-concrete value bool

MEASURED AFTER THE BUMP, on this tree's own binary (`2026.320.0227`, built by
scripts/bootstrap-charly.sh - R9):

  $ charly -C <distro-ubuntu> vm create ubuntu-debootstrap
  Generated SSH keypair in ~/.local/share/charly/vm/charly-ubuntu-debootstrap
  Created VM charly-ubuntu-debootstrap (libvirt session)

The probe VM was destroyed afterwards and `vm list` verified empty.

THE CHAIN, producer-first, with each link's evidence recorded on the way:

  spec        v0.2026319.1619 -> v0.2026320.2116   (PR #342, merged + tagged)
  plugin-box  v0.2026317.2259 -> v0.2026320.2124   (PR #88, merged + tagged)
  sdk         v0.2026319.1356 -> v0.2026320.1345

plugin-box had to go between them rather than being skipped: bumping straight to the new spec
failed to compile at the OLD plugin-box pin (`inspect_list.go:228: a.Name undefined`), and
enumerating charly's build graph showed it was the ONLY module that needed the intermediate
release - so this is a two-link chain, not an org-wide sweep.

The four lockstep `tools/*` modules are bumped to the same pins (the canonical-go.mod gate
asserts one shared pin) and each still builds. `charly/testdata/…/go.mod` is deliberately NOT
touched: it is a fixture that pins its own older version on purpose.

Gates on this tree:

  $ scripts/bootstrap-charly.sh        # built ./bin/charly (2026.320.0227)
  $ cd charly && go build ./...        # ok
  $ tools/{generate-packages,golden-cloudinit,golden-compile,gomod-canonical}: go build ./...   # ok
  $ vm create ubuntu-debootstrap       # Created VM charly-ubuntu-debootstrap (libvirt session)

THE VM BED, run against this binary (distro-ubuntu's check-ubuntu-debootstrap-vm, run
2026.320.2130) - it now gets through the VM lifecycle the decoder used to block:

  [vm-build] PASS   [vm-create] PASS (1.9s)   [wait-ready] PASS   [deploy-add] PASS (2m12)
  [bring-up-members] PASS   [check-live] FAIL   [cleanup] PASS   [cleanup-members] PASS

The single FAILURE is not this bump's: `tailscale-repo-suite-ubuntu-resolute` greps the guest's
/etc/apt/sources.list.d/tailscale.list for the `resolute` SUITE, and this binary still embeds the
`noble` vocabulary because the vocabulary change is #1177, not this commit.
That is the producer-first order made visible by the artifact: the sweep asserts the new suite,
the vocabulary that writes it has not landed, so the assertion fails while
`tailscale-package-installed` PASSES (the package came from the old suite).

So the ordering this commit enables is exactly:

  this bump  -> #1177 rebases onto it and its bed passes -> distro-ubuntu#65's bed passes

I am not claiming a green VM bed here: I am claiming the decoder is fixed, which the first five
steps show by getting through `vm-create` at all.

Refs opencharly/spec#341 (closed by #342).

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

* test(spec): decode the RawBody view sub-shapes the spec's authored-def extraction left opaque

The pin bump alone does not compile the test suite, and the reviewer's CI found it before I did:

  candy_test_helpers_test.go:147: have Alias() []spec.CandyAlias
                                 want Alias() []spec.ResolvedCandyAlias

MEASURED, and the mechanism is a deliberate upstream design rather than a rename:

- spec v0.2026320.2116 moved the AUTHORED candy sub-shapes (#CandyAlias, #CandyVolume, ...) out
  of spec and into the plugin that owns the candy body, keeping only the WIRE (resolved) twins.
  The spec's own candy_reader.go states the split: "A reader decodes a body that has already been
  validated, so the resolved form is what it needs - the same split the vm unit landed
  (VmSpec = ResolvedVm)".
- so `CandyView`/`CandyModel`'s sub-shape fields are now `spec.RawBody` (= json.RawMessage), and a
  reader must DECODE them into the resolved types it returns.

Only the TEST helper implements spec.CandyReader in this repo (production builds untouched - `go
build ./...` passed before this commit), so the adaptation is confined to
candy_test_helpers_test.go: two small generic helpers plus the accessors the compiler names.

This is exactly the sibling of the defect this PR's pin fixes: the vm unit made the same
authored/resolved split, and that split is what opencharly/spec#341 was about.

Gates on this tree:

  $ go vet ./...        # clean
  $ go test ./...       # rc=0, zero failures (the CI failure was here)

A first attempt at this used a regex over the accessors and touched fields that were never
RawBody (Plan/PlanSteps among them) - reverted in full and redone one accessor per compiler error,
which is why the diff is now only the six the type-checker named.

Refs opencharly/spec#341, #1177.

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

* fix(test): count DECODED elements in the Has* predicates, not raw-JSON bytes

The RawBody migration left four predicates measuring byte length instead of element count, so a body
encoding an EMPTY list (the two-byte empty JSON array) reported as present:

  HasExtract() { return len(a.m.Extract) > 0 }   // a.m.Extract is now spec.RawBody
  HasData()    { return len(a.m.Data) > 0 }
  HasAliases() { return len(a.v.Aliases) > 0 }
  HasVolumes() { return len(a.v.Volumes) > 0 }

Measured from the spec's own structs, which are the authority on which fields moved: CandyModel's
RawBody fields are Service, Extract, Data, Volumes, Aliases, Hook, Artifact, and CandyView's are
Volumes and Aliases - so these four are exactly the predicates over a RawBody field. The other ten
Has* predicates read typed slices and are unchanged.

They now count the decoded slice:

  return len(decodeRawSlice[spec.CandyExtract](a.m.Extract)) > 0

This is a semantic bug, not a compile error: len(bytes) > 0 is true for the empty JSON array, so a
fixture with no aliases would have reported HasAliases() true and silently widened what a downstream
test believed. Caught by review, not by the compiler - the compiler cannot see it, which is exactly
why the four predicates needed reading rather than patching.

gates: go vet ./... clean; go test ./... rc=0, zero failures.

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
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