checkwright 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -1361
- package/bin/checkwright.ps1 +176 -0
- package/bin/checkwright.sh +187 -44
- package/package.json +15 -14
- package/payload/artifact/aarch64-apple-darwin/checkwright-gates +0 -0
- package/payload/artifact/aarch64-apple-darwin/checkwright-gates.sha256 +1 -0
- package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe +0 -0
- package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -0
- package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
- package/payload/artifact/aarch64-unknown-linux-musl/checkwright-gates +0 -0
- package/payload/artifact/aarch64-unknown-linux-musl/checkwright-gates.sha256 +1 -0
- package/payload/artifact/targets.list +133 -24
- package/payload/artifact/x86_64-apple-darwin/checkwright-gates +0 -0
- package/payload/artifact/x86_64-apple-darwin/checkwright-gates.sha256 +1 -0
- package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe +0 -0
- package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
- package/payload/artifact/x86_64-unknown-linux-musl/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-musl/checkwright-gates.sha256 +1 -0
- package/payload/canon-kit/README.md +25 -37
- package/payload/canon-kit/checks/check-amendment-queue.gate +2 -2
- package/payload/canon-kit/checks/check-amendment-retired-spelling.gate +3 -0
- package/payload/canon-kit/checks/check-amendment-update-target.gate +1 -1
- package/payload/canon-kit/checks/check-citation-link.gate +4 -0
- package/payload/canon-kit/checks/check-comment-tier.gate +1 -1
- package/payload/canon-kit/checks/check-deprecation-task.gate +2 -1
- package/payload/canon-kit/checks/check-docs-cmd.gate +2 -2
- package/payload/canon-kit/checks/check-docs-link-convention.gate +1 -1
- package/payload/canon-kit/checks/check-docs-page-repeat.gate +4 -0
- package/payload/canon-kit/checks/check-docs-restatement-parity.gate +4 -0
- package/payload/canon-kit/checks/check-fence-command-head.gate +3 -0
- package/payload/canon-kit/checks/check-fence-run.gate +3 -0
- package/payload/canon-kit/checks/check-install-claim.gate +2 -1
- package/payload/canon-kit/checks/check-knob-citation.gate +1 -1
- package/payload/canon-kit/checks/check-manifest-count.gate +1 -1
- package/payload/canon-kit/checks/check-manifest-temporal.gate +1 -1
- package/payload/canon-kit/checks/check-md-refs.gate +1 -1
- package/payload/canon-kit/checks/check-md-unwrapped.gate +3 -0
- package/payload/canon-kit/checks/check-measured-claim.gate +2 -1
- package/payload/canon-kit/checks/check-payload-claim.gate +2 -1
- package/payload/canon-kit/checks/check-prose-bounds.gate +3 -0
- package/payload/canon-kit/checks/check-prose-enum.gate +2 -1
- package/payload/canon-kit/checks/check-prose-tells.gate +1 -1
- package/payload/canon-kit/checks/check-provenance-seam.gate +3 -0
- package/payload/canon-kit/checks/check-spec-derivable-section.gate +1 -1
- package/payload/canon-kit/checks/check-spec-dod-singleton.gate +1 -1
- package/payload/canon-kit/checks/check-spec-embedded-source.gate +1 -1
- package/payload/canon-kit/checks/check-spec-fence-balance.gate +1 -1
- package/payload/canon-kit/checks/check-spec-pointer.gate +2 -2
- package/payload/canon-kit/checks/check-surface-duplication.gate +3 -0
- package/payload/canon-kit/checks/check-todo-task-liveness.gate +1 -1
- package/payload/canon-kit/checks/check-tracking-claim.gate +1 -1
- package/payload/canon-kit/checks/check-unmarked-claim.gate +2 -1
- package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-tidy.md +3 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +37 -8
- package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +6 -3
- package/payload/canon-kit/gate-tests/check-amendment-queue/good/SPEC-widget.md +7 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/good/TASK-QUEUE.md +11 -3
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/SPEC-nosection.md +16 -0
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/SPEC-thing.md +26 -0
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/expect.txt +8 -0
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/surface/one.md +4 -0
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/surface/two.md +3 -0
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/SPEC-tidy.md +20 -0
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/SPEC-widget.md +37 -0
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/component/README.md +4 -0
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/component/SPEC.md +4 -0
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/unnamed.md +4 -0
- package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +1 -1
- package/payload/canon-kit/gate-tests/check-citation-link/bad/expect.txt +6 -0
- package/payload/canon-kit/gate-tests/check-citation-link/bad/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-citation-link/bad/site/page.md +13 -0
- package/payload/canon-kit/gate-tests/check-citation-link/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-citation-link/good/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-citation-link/good/site/page.md +28 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/bad/.github/workflows/ci.yml +15 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/bad/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/good/.github/workflows/ci.yml +23 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/good/config.yml +2 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -1
- package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +1 -1
- package/payload/canon-kit/gate-tests/check-comment-tier/good/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +37 -26
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/TASK-QUEUE.md +3 -1
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/TASK-QUEUE.md +6 -2
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -1
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +12 -10
- package/payload/canon-kit/gate-tests/check-docs-cmd/good/doc.md +4 -1
- package/payload/canon-kit/gate-tests/check-docs-cmd.test.sh +61 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/expect.txt +3 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +21 -2
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/bad/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/bad/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/bad/site/page.md +8 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/good/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-docs-page-repeat/good/site/page.md +24 -0
- package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/kit/README.md +10 -0
- package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/kit/index.md +11 -0
- package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/scripts/gate-sdk-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/kit/README.md +12 -0
- package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/kit/index.md +13 -0
- package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/scripts/gate-sdk-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-fence-command-head/bad/args +1 -0
- package/payload/canon-kit/gate-tests/check-fence-command-head/bad/doc.md +16 -0
- package/payload/canon-kit/gate-tests/check-fence-command-head/bad/expect.txt +5 -0
- package/payload/canon-kit/gate-tests/check-fence-command-head/good/args +1 -0
- package/payload/canon-kit/gate-tests/check-fence-command-head/good/bin/run.sh +3 -0
- package/payload/canon-kit/gate-tests/check-fence-command-head/good/doc.md +41 -0
- package/payload/canon-kit/gate-tests/check-fence-command-head/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-fence-command-head/good/lib/tool.sh +5 -0
- package/payload/canon-kit/gate-tests/check-fence-command-head/good/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-fence-run/bad/args +1 -0
- package/payload/canon-kit/gate-tests/check-fence-run/bad/doc.md +32 -0
- package/payload/canon-kit/gate-tests/check-fence-run/bad/expect.txt +7 -0
- package/payload/canon-kit/gate-tests/check-fence-run/good/args +1 -0
- package/payload/canon-kit/gate-tests/check-fence-run/good/doc.md +31 -0
- package/payload/canon-kit/gate-tests/check-fence-run/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.knobs +7 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.knobs +7 -0
- package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +42 -7
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +1 -2
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
- package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +37 -8
- package/payload/canon-kit/gate-tests/check-manifest-count/bad/SPEC.md +3 -0
- package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +10 -0
- package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +6 -6
- package/payload/canon-kit/gate-tests/check-md-refs.test.sh +1 -1
- package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/doc.md +13 -0
- package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/expect.txt +4 -0
- package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/scripts/canon-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-md-unwrapped/good/doc.md +45 -0
- package/payload/canon-kit/gate-tests/check-md-unwrapped/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-md-unwrapped/good/scripts/canon-config.knobs +4 -0
- package/payload/canon-kit/gate-tests/check-measured-claim/bad/SPEC.md +3 -0
- package/payload/canon-kit/gate-tests/check-measured-claim/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.knobs +4 -0
- package/payload/canon-kit/gate-tests/check-measured-claim/good/SPEC.md +8 -0
- package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.knobs +4 -0
- package/payload/canon-kit/gate-tests/check-measured-claim/good/worktrees/SPEC.md +12 -0
- package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +32 -13
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.knobs +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.knobs +6 -0
- package/payload/canon-kit/gate-tests/check-prose-bounds/bad/CLAUDE.md +9 -0
- package/payload/canon-kit/gate-tests/check-prose-bounds/bad/SPEC.md +11 -0
- package/payload/canon-kit/gate-tests/check-prose-bounds/bad/expect.txt +3 -0
- package/payload/canon-kit/gate-tests/check-prose-bounds/bad/scripts/canon-config.knobs +3 -0
- package/payload/canon-kit/gate-tests/check-prose-bounds/good/CLAUDE.md +10 -0
- package/payload/canon-kit/gate-tests/check-prose-bounds/good/SPEC.md +27 -0
- package/payload/canon-kit/gate-tests/check-prose-bounds/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-prose-bounds/good/scripts/canon-config.knobs +3 -0
- package/payload/canon-kit/gate-tests/check-prose-bounds.test.sh +98 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.knobs +3 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.knobs +3 -0
- package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +55 -25
- package/payload/canon-kit/gate-tests/check-prose-tells/bad/prose.md +2 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.knobs +5 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/good/prose.md +6 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/good/scripts/{canon-config.sh → canon-config.knobs} +2 -5
- package/payload/canon-kit/gate-tests/check-prose-tells/good/worktrees/prose.md +17 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/bad/TASK-QUEUE.md +15 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/bad/expect.txt +8 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/canon-config.knobs +3 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/gate-sdk-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/lifecycle-config.knobs +12 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/bad/widget-toolkit/SPEC.md +27 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/good/TASK-QUEUE.md +15 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/canon-config.knobs +3 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/gate-sdk-config.knobs +2 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/lifecycle-config.knobs +12 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam/good/widget-toolkit/SPEC.md +20 -0
- package/payload/canon-kit/gate-tests/check-provenance-seam.test.sh +136 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +1 -1
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/README.md +6 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-widget.md +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.rs +2 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +4 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.knobs +6 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-widget.md +10 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -1
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.rs +2 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.knobs +6 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/vendored-kit/notes.txt +4 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/TASK-QUEUE.md +3 -1
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/TASK-QUEUE.md +9 -3
- package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +1 -1
- package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/SPEC.md +3 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.knobs +4 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/good/SPEC.md +3 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.knobs +4 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim/good/worktrees/SPEC.md +11 -0
- package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +53 -28
- package/payload/canon-kit/templates/SPEC-amendment.md +46 -25
- package/payload/canon-kit/templates/canon-config.knobs +1 -0
- package/payload/context-kit/README.md +33 -61
- package/payload/context-kit/checks/check-brevity.gate +2 -2
- package/payload/context-kit/checks/check-footprint-fresh.gate +3 -2
- package/payload/context-kit/checks/check-memory-off.gate +1 -1
- package/payload/context-kit/checks/check-settings-paths.gate +2 -2
- package/payload/context-kit/checks/check-settings-pins.gate +1 -1
- package/payload/context-kit/checks/check-surface-ratchet.gate +3 -0
- package/payload/context-kit/gate-tests/check-brevity/bad/CLAUDE.md +9 -2
- package/payload/context-kit/gate-tests/check-brevity/bad/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-brevity/good/CLAUDE.md +9 -4
- package/payload/context-kit/gate-tests/check-brevity/good/expect.txt +1 -1
- package/payload/context-kit/gate-tests/check-brevity.test.sh +107 -24
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/CLAUDE.md +6 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/demo-kit/SPEC.md +3 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/demo-kit/templates/guide.md +3 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/docs/footprint.md +32 -0
- package/payload/context-kit/gate-tests/check-memory-off/bad/scripts/{context-config.sh → context-config.knobs} +1 -3
- package/payload/context-kit/gate-tests/check-memory-off/good/scripts/{context-config.sh → context-config.knobs} +1 -3
- package/payload/context-kit/gate-tests/check-memory-off.test.sh +1 -1
- package/payload/context-kit/gate-tests/check-settings-paths/bad/expect.txt +2 -0
- package/payload/context-kit/gate-tests/check-settings-paths/bad/settings.json +21 -0
- package/payload/context-kit/gate-tests/check-settings-paths/bad/tools/run-gates.sh +4 -0
- package/payload/context-kit/gate-tests/check-settings-paths/good/expect.txt +2 -1
- package/payload/context-kit/gate-tests/check-settings-paths/good/settings.json +48 -1
- package/payload/context-kit/gate-tests/check-settings-paths/good/tools/run-gates.sh +4 -0
- package/payload/context-kit/gate-tests/check-settings-pins.test.sh +1 -1
- package/payload/context-kit/gate-tests/check-surface-ratchet/bad/CLAUDE.md +5 -0
- package/payload/context-kit/gate-tests/check-surface-ratchet/bad/expect.txt +2 -0
- package/payload/context-kit/gate-tests/check-surface-ratchet/bad/scripts/context-config.knobs +4 -0
- package/payload/context-kit/gate-tests/check-surface-ratchet/bad/surface-ceiling.txt +2 -0
- package/payload/context-kit/gate-tests/check-surface-ratchet/bad/templates/ungoverned.md +3 -0
- package/payload/context-kit/gate-tests/check-surface-ratchet/good/CLAUDE.md +3 -0
- package/payload/context-kit/gate-tests/check-surface-ratchet/good/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-surface-ratchet/good/scripts/context-config.knobs +4 -0
- package/payload/context-kit/gate-tests/check-surface-ratchet/good/surface-ceiling.txt +4 -0
- package/payload/context-kit/gate-tests/check-surface-ratchet/good/templates/held.md +4 -0
- package/payload/context-kit/gate-tests/check-surface-ratchet.test.sh +76 -0
- package/payload/context-kit/index-tests/corpus/baseline.txt +1 -1
- package/payload/context-kit/index-tests/corpus/surface.md +1 -6
- package/payload/context-kit/index-tests/expected/always-loaded.txt +1 -1
- package/payload/context-kit/templates/close-brevity.md +9 -28
- package/payload/context-kit/templates/context-config.knobs +1 -0
- package/payload/context-kit/templates/session-context.sh +44 -29
- package/payload/delegation-kit/README.md +35 -69
- package/payload/delegation-kit/checks/check-agent-tier-explicit.gate +1 -1
- package/payload/delegation-kit/checks/check-gate-tamper.gate +1 -1
- package/payload/delegation-kit/gate-tests/check-gate-tamper.test.sh +23 -2
- package/payload/delegation-kit/templates/agent-execution.md +23 -389
- package/payload/delegation-kit/templates/delegation-config.knobs +4 -0
- package/payload/delegation-kit/templates/dispatch-checklists.md +8 -45
- package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +33 -17
- package/payload/doctrine-kit/DOCTRINE.md +92 -458
- package/payload/doctrine-kit/README.md +24 -55
- package/payload/doctrine-kit/checks/check-doctrine-registration.gate +1 -1
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +48 -3
- package/payload/drift-kit/README.md +43 -89
- package/payload/drift-kit/templates/close-knowledge.md +7 -22
- package/payload/drift-kit/templates/drift-config.knobs +1 -0
- package/payload/drift-kit/templates/economics.md +10 -48
- package/payload/drift-kit/templates/kpi-deprecated-surface.sh +31 -9
- package/payload/drift-kit/templates/kpis.list +2 -1
- package/payload/drift-kit/templates/price-table.tsv +1 -1
- package/payload/evidence-kit/README.md +24 -43
- package/payload/evidence-kit/checks/check-battery-roster.gate +1 -1
- package/payload/evidence-kit/checks/check-evidence-baseline.gate +2 -2
- package/payload/evidence-kit/checks/check-evidence-manifest.gate +1 -1
- package/payload/evidence-kit/checks/check-producer-liveness.gate +3 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.knobs +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.knobs +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +7 -7
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/TASK-QUEUE.md +3 -1
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/expect.txt +2 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/scripts/evidence-config.knobs +4 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/validate-baseline.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/TASK-QUEUE.md +3 -1
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/scripts/evidence-config.knobs +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +134 -14
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/scripts/{evidence-config.sh → evidence-config.knobs} +3 -5
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/scripts/{evidence-config.sh → evidence-config.knobs} +3 -5
- package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +5 -4
- package/payload/evidence-kit/gate-tests/diff-baseline-status.test.sh +128 -0
- package/payload/evidence-kit/gate-tests/evidence-lib.test.sh +51 -45
- package/payload/evidence-kit/gate-tests/pre-hook.test.sh +66 -0
- package/payload/evidence-kit/gate-tests/producer-lock.test.sh +29 -16
- package/payload/evidence-kit/templates/evidence-config.knobs +1 -0
- package/payload/gate-sdk/README.md +48 -79
- package/payload/gate-sdk/bin/build-native.sh +27 -4
- package/payload/gate-sdk/bin/run-gates.ps1 +266 -0
- package/payload/gate-sdk/bin/run-gates.sh +53 -277
- package/payload/gate-sdk/checks/check-action-gh-repo.gate +1 -1
- package/payload/gate-sdk/checks/check-action-job-ref.gate +3 -0
- package/payload/gate-sdk/checks/check-action-permissions.gate +3 -0
- package/payload/gate-sdk/checks/check-action-pinning.gate +1 -1
- package/payload/gate-sdk/checks/check-action-run-path.gate +3 -0
- package/payload/gate-sdk/checks/check-action-run-shell.gate +3 -0
- package/payload/gate-sdk/checks/check-commit-msg.gate +2 -1
- package/payload/gate-sdk/checks/check-commit-subject.gate +1 -1
- package/payload/gate-sdk/checks/check-core-files.gate +1 -1
- package/payload/gate-sdk/checks/check-crate-arms.gate +3 -0
- package/payload/gate-sdk/checks/check-enforcement-fresh.gate +3 -2
- package/payload/gate-sdk/checks/check-exec-bit.gate +1 -1
- package/payload/gate-sdk/checks/check-front-end-fail-open.gate +3 -0
- package/payload/gate-sdk/checks/check-gate-assertions.gate +2 -2
- package/payload/gate-sdk/checks/check-gate-binary-fresh.gate +1 -1
- package/payload/gate-sdk/checks/check-gate-exemption-tasks.gate +1 -1
- package/payload/gate-sdk/checks/check-gate-fail-closed.gate +1 -1
- package/payload/gate-sdk/checks/check-gate-fixture-coverage.gate +1 -1
- package/payload/gate-sdk/checks/check-gate-output.gate +1 -1
- package/payload/gate-sdk/checks/check-gate-substrate-parity.gate +3 -0
- package/payload/gate-sdk/checks/check-graph.gate +2 -1
- package/payload/gate-sdk/checks/check-hook-exec-bit.gate +1 -1
- package/payload/gate-sdk/checks/check-identity.gate +1 -1
- package/payload/gate-sdk/checks/check-install-disposition.gate +3 -0
- package/payload/gate-sdk/checks/check-kit-enum.gate +1 -1
- package/payload/gate-sdk/checks/check-kit-registration.gate +1 -1
- package/payload/gate-sdk/checks/check-kit-roots-dialect.gate +3 -0
- package/payload/gate-sdk/checks/check-packed-links.gate +3 -0
- package/payload/gate-sdk/checks/check-path-dialect.gate +3 -0
- package/payload/gate-sdk/checks/check-pipe-membership.gate +3 -0
- package/payload/gate-sdk/checks/check-portability-floor.gate +4 -0
- package/payload/gate-sdk/checks/check-projection-roster.gate +4 -0
- package/payload/gate-sdk/checks/check-reads-couples.gate +1 -1
- package/payload/gate-sdk/checks/check-root-tiering.gate +1 -1
- package/payload/gate-sdk/checks/check-shellcheck.gate +3 -0
- package/payload/gate-sdk/checks/check-template-copy-parity.gate +1 -1
- package/payload/gate-sdk/checks/check-tree-terms.gate +2 -1
- package/payload/gate-sdk/checks/check-workflow-tiering.gate +1 -1
- package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/scripts/gate-sdk-config.knobs +1 -0
- package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/tree/notes.md +3 -0
- package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/tree/workflows/ci.yml +8 -0
- package/payload/gate-sdk/gate-tests/check-action-job-ref/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-action-job-ref/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-job-ref/good/scripts/gate-sdk-config.knobs +1 -0
- package/payload/gate-sdk/gate-tests/check-action-job-ref/good/tree/notes.md +3 -0
- package/payload/gate-sdk/gate-tests/check-action-job-ref/good/tree/workflows/ci.yml +8 -0
- package/payload/gate-sdk/gate-tests/check-action-permissions/bad/args +3 -0
- package/payload/gate-sdk/gate-tests/check-action-permissions/bad/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-action-permissions/bad/tree/workflows/empty-allowlist.yml +29 -0
- package/payload/gate-sdk/gate-tests/check-action-permissions/bad/tree/workflows/gates.yml +25 -0
- package/payload/gate-sdk/gate-tests/check-action-permissions/good/args +5 -0
- package/payload/gate-sdk/gate-tests/check-action-permissions/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/action.yml +9 -0
- package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/not-actions.yml +7 -0
- package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/workflows/declared.yml +69 -0
- package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/workflows/valves.yml +22 -0
- package/payload/gate-sdk/gate-tests/check-action-run-path/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-action-run-path/bad/expect.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-action-run-path/bad/tree/scripts/present.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-action-run-path/bad/tree/workflows/ci.yml +14 -0
- package/payload/gate-sdk/gate-tests/check-action-run-path/good/args +5 -0
- package/payload/gate-sdk/gate-tests/check-action-run-path/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/scripts/build.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/sub/scripts/inner.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/workflows/ci.yml +36 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/args +4 -2
- package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/expect.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/tree/workflows/runner-dialect.yml +36 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/args +3 -2
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/expect.txt +1 -1
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/workflows/runner-dialect.yml +71 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +102 -9
- package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/smoke/install.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-assertion-strength/good/smoke/install.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-assertion-strength.test.sh +55 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/bad/msg.txt +4 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/bad/patterns.list +5 -1
- package/payload/gate-sdk/gate-tests/check-commit-msg/good/msg.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/good/patterns.list +5 -1
- package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +2 -2
- package/payload/gate-sdk/gate-tests/check-core-files.test.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.knobs +3 -0
- package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.knobs +3 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/SPEC.md +3 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/checks/check-demo.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/probe.conf +1 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/templates/guide.md +3 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/docs/enforcement.md +33 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/scripts/gate-sdk-config.knobs +1 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/scripts/gates.list +1 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/args +3 -0
- package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/expect.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/gate-sdk/bin/run-gates.ps1 +5 -0
- package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/gate-sdk/bin/run-gates.sh +9 -0
- package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/args +4 -0
- package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/gate-sdk/bin/run-gates.ps1 +5 -0
- package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/gate-sdk/bin/run-gates.sh +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +4 -1
- package/payload/gate-sdk/gate-tests/check-gate-assertions.test.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +6 -12
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +5 -3
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/TASK-QUEUE.md +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks.test.sh +4 -2
- package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/ci/build-artifact.sh +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/ci.yml +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +4 -2
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.knobs +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/ci/build-artifact.sh +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/ci.yml +16 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -3
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.knobs +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +1 -1
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +222 -197
- package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +7 -2
- package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +4 -0
- package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-second-gate.md +3 -1
- package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +8 -8
- package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +2 -2
- package/payload/gate-sdk/gate-tests/check-graph-tree.test.sh +49 -14
- package/payload/gate-sdk/gate-tests/check-identity/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +4 -4
- package/payload/gate-sdk/gate-tests/check-identity/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +4 -4
- package/payload/gate-sdk/gate-tests/check-identity.test.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-eta.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-iota.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-theta.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-zeta.gate +3 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/smoke/install.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-install-disposition/bad/args +8 -5
- package/payload/gate-sdk/gate-tests/check-install-disposition/bad/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/bad/native/src/installer/recipe.rs +10 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/args +8 -4
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/expect.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/{alpha-kit → site-kit}/checks/check-alpha.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-beta.gate +3 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-gamma.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-omega.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-psi.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/{alpha-kit → site-kit}/smoke/install.sh +2 -2
- package/payload/gate-sdk/gate-tests/check-kit-registration/bad/registry-doc.md +15 -12
- package/payload/gate-sdk/gate-tests/check-kit-registration/good/args +7 -5
- package/payload/gate-sdk/gate-tests/check-kit-registration/good/scripts/gate-sdk-config.knobs +2 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +2 -2
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/args +5 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/checks/placeholder.txt +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/gate-tests/alpha.test.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/lib/alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/checks/placeholder.txt +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/gate-tests/beta.test.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/lib/beta.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/gate-sdk/checks/placeholder.txt +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/gate-sdk/lib/gate.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/scripts/gate-sdk-config.knobs +7 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/scripts/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/args +7 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/checks/placeholder.txt +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/gate-tests/alpha.test.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/lib/alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/checks/placeholder.txt +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/gate-tests/beta.test.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/lib/beta.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/gate-sdk/checks/placeholder.txt +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/gate-sdk/lib/gate.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/scripts/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/bad/alpha-kit/README.md +5 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/bad/args +5 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/bad/beta-kit/README.md +5 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/bad/expect.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/bad/scripts/gate-sdk-config.knobs +4 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/good/alpha-kit/README.md +5 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/good/args +8 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/good/beta-kit/README.md +9 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/good/gamma-kit/SPEC.md +4 -0
- package/payload/gate-sdk/gate-tests/check-packed-links/good/scripts/gate-sdk-config.knobs +6 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/args +3 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/expect.txt +15 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/primitive.rs +19 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/producer.rs +8 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/walk.rs +13 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/bound-root.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/case-arm.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/commented.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/common-dir.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/glob-test.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/late-anchor.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/logical-readback.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/probe.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/two-root.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/expect.txt +13 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/commented.rs +5 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/local.rs +12 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/namespace.rs +11 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/typed.rs +10 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/verdict.rs +5 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/walk.rs +24 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/anchored.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/cd-only.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/commented.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/one-root.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/probe.sh +8 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/rooted.sh +23 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/subshell.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/two-line.sh +8 -0
- package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/verdict.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/expect.txt +6 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/scripts/gate-sdk-config.knobs +1 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/array-grep.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/echo-max-count.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/gate-tests/membership.test.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/loop-head.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/tests/relocated.test.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/good/args +5 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/good/expect.txt +3 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/full-reader.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/gate-tests/check-x/bad/violating.test.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/gate-tests/clean.test.sh +8 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/loop-membership.sh +8 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/no-pipefail.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/one-line-producer.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/bad/expect.txt +8 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/bad/patterns.list +4 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/bad/scripts/gate-sdk-config.knobs +4 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/empty-reason-verb +5 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/strings.ps1 +6 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/too-far-verb +5 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/undeclared-verb +3 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/good/patterns.list +5 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/good/scripts/gate-sdk-config.knobs +4 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/front.ps1 +7 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/plain-verb +5 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/portability-patterns.list +5 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/upgrade-verb +7 -0
- package/payload/gate-sdk/gate-tests/check-portability-floor.test.sh +154 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/bad/demo-kit/checks/check-beta.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/bad/docs/roster.md +11 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/bad/expect.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-alpha.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-gamma.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-plain.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/gate-sdk-config.knobs +3 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/good/demo-kit/checks/check-beta.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/good/docs/roster.md +16 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-alpha.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-delta.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-epsilon.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-plain.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/gate-sdk-config.knobs +4 -0
- package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/gates.list +5 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.knobs +4 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +1 -1
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.knobs +4 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/expect.txt +1 -1
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/sandbox-gate.sh +4 -4
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/sandbox-gate.sh +4 -4
- package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +25 -20
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/install.sh +1 -1
- package/payload/gate-sdk/gate-tests/{check-template-registry-parity/bad/scripts/gate-sdk-config.sh → check-smoke-entry-guard/bad/scripts/gate-sdk-config.knobs} +2 -3
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/install.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/violation.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/args +1 -1
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/beta-kit/smoke/install.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.knobs +4 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/args +3 -1
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/session-note.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/expect.txt +1 -1
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/session-note.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity.test.sh +1 -1
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/drift-kit/templates/kpis.list +18 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +2 -0
- package/payload/gate-sdk/gate-tests/{check-smoke-entry-guard/bad/scripts/gate-sdk-config.sh → check-template-registry-parity/bad/scripts/gate-sdk-config.knobs} +2 -3
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +3 -1
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/drift-kit/templates/kpis.list +17 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -1
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.knobs +4 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +5 -5
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/patterns.list +4 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/accounts.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +5 -1
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/anchored.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/handles.txt +2 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +44 -5
- package/payload/gate-sdk/gate-tests/emit-arm-shape.test.sh +95 -0
- package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +10 -10
- package/payload/gate-sdk/gate-tests/lib-gate.test.sh +10 -184
- package/payload/gate-sdk/gate-tests/reads-census.test.sh +96 -0
- package/payload/gate-sdk/gate-tests/run-arm-contract.test.sh +190 -0
- package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +64 -41
- package/payload/gate-sdk/gate-tests/run-for-path.test.sh +2 -2
- package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +121 -16
- package/payload/gate-sdk/gate-tests/run-gates-linked-worktree.test.sh +136 -0
- package/payload/gate-sdk/lib/gate.sh +231 -484
- package/payload/gate-sdk/lib/test-hermetic.sh +39 -9
- package/payload/gate-sdk/templates/check-skeleton.sh +3 -2
- package/payload/gate-sdk/templates/gates-workflow.yml +16 -32
- package/payload/gate-sdk/templates/msg-patterns.list +14 -5
- package/payload/gate-sdk/templates/portability-patterns.list +56 -0
- package/payload/guard-kit/README.md +43 -47
- package/payload/guard-kit/checks/check-door-binding.gate +3 -0
- package/payload/guard-kit/gate-tests/check-door-binding/bad/alpha-kit/README.md +6 -0
- package/payload/guard-kit/gate-tests/check-door-binding/bad/alpha-kit/templates/alpha-config.knobs +3 -0
- package/payload/guard-kit/gate-tests/check-door-binding/bad/args +5 -0
- package/payload/guard-kit/gate-tests/check-door-binding/bad/beta-kit/lib/beta.sh +6 -0
- package/payload/guard-kit/gate-tests/check-door-binding/bad/expect.txt +5 -0
- package/payload/guard-kit/gate-tests/check-door-binding/bad/scripts/gate-sdk-config.knobs +4 -0
- package/payload/guard-kit/gate-tests/check-door-binding/bad/scripts/guard-config.knobs +3 -0
- package/payload/guard-kit/gate-tests/check-door-binding/bad/site/banner.md +8 -0
- package/payload/guard-kit/gate-tests/check-door-binding/bad/site/landing.md +11 -0
- package/payload/guard-kit/gate-tests/check-door-binding/good/alpha-kit/README.md +8 -0
- package/payload/guard-kit/gate-tests/check-door-binding/good/alpha-kit/templates/settings-hooks.json +20 -0
- package/payload/guard-kit/gate-tests/check-door-binding/good/args +7 -0
- package/payload/guard-kit/gate-tests/check-door-binding/good/beta-kit/lib/beta.sh +6 -0
- package/payload/guard-kit/gate-tests/check-door-binding/good/expect.txt +1 -0
- package/payload/guard-kit/gate-tests/check-door-binding/good/scripts/gate-sdk-config.knobs +4 -0
- package/payload/guard-kit/gate-tests/check-door-binding/good/scripts/guard-config.knobs +3 -0
- package/payload/guard-kit/gate-tests/check-door-binding/good/site/mirror.md +12 -0
- package/payload/guard-kit/gate-tests/check-door-binding/good/site/register.md +24 -0
- package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +40 -27
- package/payload/guard-kit/gate-tests/consumer-rules.test.sh +189 -0
- package/payload/guard-kit/gate-tests/door-binding-corpus.test.sh +72 -0
- package/payload/guard-kit/gate-tests/git-mutation-under-producer.test.sh +48 -23
- package/payload/guard-kit/gate-tests/guard-config-knobs.test.sh +170 -0
- package/payload/guard-kit/gate-tests/rewrite.test.sh +73 -0
- package/payload/guard-kit/gate-tests/scan-prompts.test.sh +174 -8
- package/payload/guard-kit/gate-tests/scratch-run.test.sh +150 -13
- package/payload/guard-kit/gate-tests/worktree-confinement.test.sh +169 -0
- package/payload/guard-kit/guard-tests/background-cases.tsv +14 -5
- package/payload/guard-kit/guard-tests/cases.tsv +360 -54
- package/payload/guard-kit/guard-tests/powershell-background-cases.tsv +29 -0
- package/payload/guard-kit/guard-tests/powershell-cases.tsv +81 -0
- package/payload/guard-kit/templates/close-triage.md +15 -62
- package/payload/guard-kit/templates/guard-config.knobs +26 -0
- package/payload/guard-kit/templates/settings-allow.json +15 -0
- package/payload/guard-kit/templates/settings-hooks.json +5 -5
- package/payload/lifecycle-kit/README.md +50 -76
- package/payload/lifecycle-kit/checks/check-audit-roster.gate +3 -0
- package/payload/lifecycle-kit/checks/check-close-surfaces.gate +1 -1
- package/payload/lifecycle-kit/checks/check-dispatch-entry.gate +3 -0
- package/payload/lifecycle-kit/checks/check-gap-inbox-neutrality.gate +1 -1
- package/payload/lifecycle-kit/checks/check-lesson-disposition.gate +1 -1
- package/payload/lifecycle-kit/checks/check-lifecycle-registration.gate +1 -1
- package/payload/lifecycle-kit/checks/check-merge-attrs.gate +1 -1
- package/payload/lifecycle-kit/checks/check-scratch-citation.gate +1 -1
- package/payload/lifecycle-kit/checks/check-shim-restatement.gate +1 -1
- package/payload/lifecycle-kit/checks/check-skill-binding.gate +1 -1
- package/payload/lifecycle-kit/checks/check-stage-entry.gate +2 -2
- package/payload/lifecycle-kit/checks/check-stage-evidence.gate +1 -1
- package/payload/lifecycle-kit/checks/check-stage-skill-coverage.gate +2 -2
- package/payload/lifecycle-kit/checks/check-stamp-subject.gate +3 -0
- package/payload/lifecycle-kit/checks/check-survey-record.gate +2 -2
- package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +98 -21
- package/payload/lifecycle-kit/gate-tests/boundary-stage-journal.test.sh +196 -0
- package/payload/lifecycle-kit/gate-tests/boundary-worktree-refusal.test.sh +214 -0
- package/payload/lifecycle-kit/gate-tests/capture-linked-worktree.test.sh +53 -0
- package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/expect.txt +6 -0
- package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/roster.txt +34 -0
- package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/roster.txt +22 -0
- package/payload/lifecycle-kit/gate-tests/check-audit-roster.test.sh +101 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.knobs +2 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/owners/worktrees/inbox.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.knobs +2 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +21 -4
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/args +6 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/head.txt +5 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/marker.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/msg.txt +4 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/paths.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/staged.txt +5 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/args +6 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/head.txt +5 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/marker.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/msg.txt +4 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/paths.txt +2 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/staged.txt +6 -0
- package/payload/lifecycle-kit/gate-tests/check-dispatch-entry.test.sh +60 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +1 -1
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/AGENT.md +1 -5
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/AGENT.md +1 -5
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +1 -1
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +2 -2
- package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.knobs +2 -0
- package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.knobs +2 -0
- package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/surfaces/worktrees/queue.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +1 -1
- package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +1 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +165 -15
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +27 -2
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/align.md +4 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/build.md +4 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/close.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/scope.md +4 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/validate.md +1 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/expect.txt +1 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/align.md +4 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/build.md +4 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/close.md +4 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/scope.md +4 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/validate.md +4 -1
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage.test.sh +73 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/args +4 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/head.txt +5 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/msg.txt +4 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/staged.txt +6 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/args +4 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/head.txt +5 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/msg.txt +4 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/staged.txt +7 -0
- package/payload/lifecycle-kit/gate-tests/check-stamp-subject.test.sh +59 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +33 -2
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -1
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +19 -2
- package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +66 -7
- package/payload/lifecycle-kit/gate-tests/dispatch-marker.test.sh +152 -0
- package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +23 -48
- package/payload/lifecycle-kit/gate-tests/gap-inbox-route.test.sh +7 -5
- package/payload/lifecycle-kit/gate-tests/lead-journal-open.test.sh +119 -0
- package/payload/lifecycle-kit/gate-tests/preflight-valve.test.sh +170 -0
- package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +5 -3
- package/payload/lifecycle-kit/gate-tests/ruling-staleness.test.sh +89 -0
- package/payload/lifecycle-kit/gate-tests/stamp-before-write.test.sh +77 -0
- package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +12 -6
- package/payload/lifecycle-kit/templates/consult.md +9 -63
- package/payload/lifecycle-kit/templates/lead.md +147 -431
- package/payload/lifecycle-kit/templates/lifecycle-config.knobs +1 -0
- package/payload/lifecycle-kit/templates/release-sweep.md +6 -35
- package/payload/lifecycle-kit/templates/stages/align.md +14 -82
- package/payload/lifecycle-kit/templates/stages/build.md +30 -98
- package/payload/lifecycle-kit/templates/stages/close.md +21 -170
- package/payload/lifecycle-kit/templates/stages/scope.md +42 -167
- package/payload/lifecycle-kit/templates/stages/spec.md +31 -97
- package/payload/lifecycle-kit/templates/stages/validate.md +22 -59
- package/payload/lifecycle-kit/templates/upgrade.md +6 -37
- package/payload/queue-kit/README.md +33 -48
- package/payload/queue-kit/checks/check-deferred-board-tags.gate +3 -0
- package/payload/queue-kit/checks/check-queue-entry-budget.gate +2 -2
- package/payload/queue-kit/checks/check-queue-hygiene.gate +2 -2
- package/payload/queue-kit/checks/check-queue-prose-precondition.gate +1 -1
- package/payload/queue-kit/checks/check-queue-sections.gate +1 -1
- package/payload/queue-kit/checks/check-queue-slug-liveness.gate +2 -2
- package/payload/queue-kit/checks/check-queue-wrap.gate +2 -2
- package/payload/queue-kit/checks/check-roadmap-fresh.gate +3 -2
- package/payload/queue-kit/checks/check-tag-lead-line.gate +2 -2
- package/payload/queue-kit/checks/check-task-conservation.gate +1 -1
- package/payload/queue-kit/checks/check-task-names.gate +2 -2
- package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/TASK-QUEUE.md +41 -0
- package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/expect.txt +6 -0
- package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/widget-kit/README.md +3 -0
- package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/TASK-QUEUE.md +39 -0
- package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/widget-kit/README.md +3 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +76 -31
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +12 -4
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.knobs +4 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +58 -19
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/expect.txt +8 -4
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.knobs +4 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget.test.sh +124 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/TASK-QUEUE.md +11 -1
- package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/expect.txt +2 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +30 -11
- package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/TASK-QUEUE.md +3 -1
- package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/TASK-QUEUE.md +22 -6
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/TASK-QUEUE.md +3 -1
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/docs/page.md +1 -1
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/expect.txt +3 -1
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.knobs +1 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/TASK-QUEUE.md +6 -2
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/page.md +3 -3
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/worktrees/page.md +4 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.knobs +1 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness.test.sh +100 -0
- package/payload/queue-kit/gate-tests/check-queue-wrap/bad/TASK-QUEUE.md +3 -1
- package/payload/queue-kit/gate-tests/check-queue-wrap/good/TASK-QUEUE.md +20 -6
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/TASK-QUEUE.md +15 -8
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.knobs +5 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/TASK-QUEUE.md +13 -6
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.knobs +5 -0
- package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/TASK-QUEUE.md +28 -7
- package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/expect.txt +10 -2
- package/payload/queue-kit/gate-tests/check-tag-lead-line/good/TASK-QUEUE.md +30 -8
- package/payload/queue-kit/gate-tests/check-task-names/bad/TASK-QUEUE.md +18 -3
- package/payload/queue-kit/gate-tests/check-task-names/bad/expect.txt +9 -0
- package/payload/queue-kit/gate-tests/check-task-names/good/TASK-QUEUE.md +20 -6
- package/payload/queue-kit/gate-tests/entry-history.test.sh +197 -0
- package/payload/queue-kit/gate-tests/queue-counts.test.sh +77 -73
- package/payload/queue-kit/gate-tests/queue-edges.test.sh +168 -87
- package/payload/queue-kit/gate-tests/queue-index.test.sh +30 -16
- package/payload/queue-kit/gate-tests/roadmap.test.sh +65 -58
- package/payload/queue-kit/templates/TASK-QUEUE.md +36 -23
- package/payload/queue-kit/templates/queue-config.knobs +1 -0
- package/payload/site-kit/README.md +29 -45
- package/payload/site-kit/checks/check-docs-cname-parity.gate +1 -1
- package/payload/site-kit/checks/check-docs-collapsible.gate +3 -0
- package/payload/site-kit/checks/check-docs-highlight-coverage.gate +4 -0
- package/payload/site-kit/checks/check-docs-liquid-parse.gate +3 -0
- package/payload/site-kit/checks/check-docs-render-fidelity.gate +3 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +1 -1
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/scripts/site-config.knobs +2 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +2 -2
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/scripts/site-config.knobs +2 -0
- package/payload/site-kit/gate-tests/check-docs-collapsible/bad/docs/regions.md +23 -0
- package/payload/site-kit/gate-tests/check-docs-collapsible/bad/expect.txt +4 -0
- package/payload/site-kit/gate-tests/check-docs-collapsible/good/docs/plain.md +3 -0
- package/payload/site-kit/gate-tests/check-docs-collapsible/good/docs/regions.md +26 -0
- package/payload/site-kit/gate-tests/check-docs-collapsible/good/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/docs/_layouts/default.html +11 -0
- package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/expect.txt +4 -0
- package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/scripts/highlight-tokens.list +7 -0
- package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/scripts/site-config.knobs +3 -0
- package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/docs/_layouts/default.html +14 -0
- package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/scripts/highlight-tokens.list +7 -0
- package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/scripts/site-config.knobs +1 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/docs/_layouts/default.html +4 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/docs/span.md +3 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/expect.txt +2 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/_layouts/default.html +4 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/front.md +7 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/loop.md +5 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/plain.html +1 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/raw.md +3 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/search.json +4 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-liquid-parse-parser.test.sh +62 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +40 -45
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-foreign.test.sh +7 -4
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-span.test.sh +7 -4
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-table.test.sh +7 -4
- package/payload/site-kit/templates/site-health.yml +60 -88
- package/profiles.list +4 -5
- package/lib/common/digest.sh +0 -18
- package/lib/common/lock.sh +0 -75
- package/lib/common/profile.sh +0 -91
- package/lib/common/recipe.sh +0 -106
- package/lib/diff.sh +0 -66
- package/lib/doctor.sh +0 -164
- package/lib/init.sh +0 -428
- package/lib/uninstall.sh +0 -214
- package/lib/update.sh +0 -34
- package/payload/canon-kit/SPEC.md +0 -2443
- package/payload/canon-kit/checks/check-surface-duplication.sh +0 -106
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +0 -6
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +0 -6
- package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.sh +0 -10
- package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.sh +0 -10
- package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.sh +0 -6
- package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.sh +0 -6
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +0 -8
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +0 -8
- package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.sh +0 -4
- package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.sh +0 -4
- package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.sh +0 -8
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.sh +0 -5
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.sh +0 -5
- package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.sh +0 -6
- package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.sh +0 -6
- package/payload/canon-kit/lib/spec.sh +0 -560
- package/payload/canon-kit/smoke/install.sh +0 -58
- package/payload/canon-kit/smoke/violation.sh +0 -22
- package/payload/canon-kit/templates/canon-config.sh +0 -2
- package/payload/context-kit/SPEC.md +0 -1134
- package/payload/context-kit/bin/always-loaded.sh +0 -70
- package/payload/context-kit/bin/env-probe.sh +0 -142
- package/payload/context-kit/bin/md-index.sh +0 -80
- package/payload/context-kit/bin/md-section.sh +0 -63
- package/payload/context-kit/bin/pub-index.sh +0 -90
- package/payload/context-kit/bin/run-index-tests.sh +0 -91
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/args +0 -4
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/emit.txt +0 -12
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/projection.txt +0 -12
- package/payload/context-kit/index-tests/expected/toolfloor.txt +0 -23
- package/payload/context-kit/index-tests/toolfloor-cases.sh +0 -49
- package/payload/context-kit/lib/context.sh +0 -56
- package/payload/context-kit/lib/pub-lang/rust.sh +0 -26
- package/payload/context-kit/lib/pub-lang/ts.sh +0 -32
- package/payload/context-kit/lib/toolfloor.sh +0 -58
- package/payload/context-kit/smoke/agents-md.sh +0 -139
- package/payload/context-kit/smoke/install.sh +0 -64
- package/payload/context-kit/smoke/violation.sh +0 -21
- package/payload/context-kit/templates/context-config.sh +0 -2
- package/payload/delegation-kit/SPEC.md +0 -2078
- package/payload/delegation-kit/bin/run-budget-guard-tests.sh +0 -88
- package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +0 -97
- package/payload/delegation-kit/bin/run-trend-tests.sh +0 -63
- package/payload/delegation-kit/bin/run-usage-tests.sh +0 -226
- package/payload/delegation-kit/bin/usage-trend.sh +0 -120
- package/payload/delegation-kit/bin/usage-verdict.sh +0 -144
- package/payload/delegation-kit/bin/wait-probe.sh +0 -184
- package/payload/delegation-kit/gate-tests/subagent-stop-liveness.test.sh +0 -99
- package/payload/delegation-kit/lib/delegation.sh +0 -84
- package/payload/delegation-kit/smoke/install.sh +0 -83
- package/payload/delegation-kit/smoke/violation.sh +0 -16
- package/payload/delegation-kit/templates/agent-budget-guard.sh +0 -18
- package/payload/delegation-kit/templates/agent-dispatch-guard.sh +0 -61
- package/payload/delegation-kit/templates/delegation-config.sh +0 -6
- package/payload/delegation-kit/templates/statusline-usage.sh +0 -101
- package/payload/delegation-kit/templates/subagent-stop-liveness.sh +0 -56
- package/payload/delegation-kit/templates/usage-poller.sh +0 -67
- package/payload/delegation-kit/usage-tests/budget-guard-cases.tsv +0 -20
- package/payload/doctrine-kit/SPEC.md +0 -385
- package/payload/doctrine-kit/bin/install-doctrine.sh +0 -194
- package/payload/doctrine-kit/bin/stage-rules.sh +0 -51
- package/payload/doctrine-kit/lib/doctrine.sh +0 -29
- package/payload/doctrine-kit/smoke/install.sh +0 -203
- package/payload/doctrine-kit/smoke/violation.sh +0 -13
- package/payload/drift-kit/SPEC.md +0 -1187
- package/payload/drift-kit/bin/drift-report.sh +0 -155
- package/payload/drift-kit/bin/kfric.sh +0 -61
- package/payload/drift-kit/bin/overhead-meter.sh +0 -106
- package/payload/drift-kit/bin/stage-economics.sh +0 -465
- package/payload/drift-kit/kpis/kpi-always-loaded.sh +0 -39
- package/payload/drift-kit/kpis/kpi-amendment-age.sh +0 -33
- package/payload/drift-kit/kpis/kpi-deferred-age.sh +0 -46
- package/payload/drift-kit/kpis/kpi-gate-backlog.sh +0 -52
- package/payload/drift-kit/kpis/kpi-gate-runtime.sh +0 -31
- package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +0 -42
- package/payload/drift-kit/kpis/kpi-knowledge-friction.sh +0 -21
- package/payload/drift-kit/kpis/kpi-overhead.sh +0 -44
- package/payload/drift-kit/kpis/kpi-price-table-age.sh +0 -68
- package/payload/drift-kit/kpis/kpi-prompt-friction.sh +0 -38
- package/payload/drift-kit/kpis/kpi-queue-net-delta.sh +0 -74
- package/payload/drift-kit/kpis/kpi-settings-local.sh +0 -21
- package/payload/drift-kit/kpis/kpi-task-split.sh +0 -43
- package/payload/drift-kit/lib/drift.sh +0 -43
- package/payload/drift-kit/smoke/install.sh +0 -537
- package/payload/drift-kit/smoke/overhead-fixture.jsonl +0 -4
- package/payload/drift-kit/templates/drift-config.sh +0 -2
- package/payload/evidence-kit/SPEC.md +0 -740
- package/payload/evidence-kit/bin/diff-baseline.sh +0 -34
- package/payload/evidence-kit/bin/run-validate.sh +0 -124
- package/payload/evidence-kit/checks/check-producer-liveness.sh +0 -75
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +0 -7
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +0 -7
- package/payload/evidence-kit/lib/evidence.sh +0 -193
- package/payload/evidence-kit/smoke/install.sh +0 -59
- package/payload/evidence-kit/smoke/violation.sh +0 -8
- package/payload/evidence-kit/templates/evidence-config.sh +0 -2
- package/payload/gate-sdk/SPEC.md +0 -10872
- package/payload/gate-sdk/bin/gen-pre-commit.sh +0 -297
- package/payload/gate-sdk/bin/install-hooks.sh +0 -60
- package/payload/gate-sdk/bin/port-blockers.sh +0 -473
- package/payload/gate-sdk/bin/run-consumer-smoke.sh +0 -239
- package/payload/gate-sdk/bin/run-gate-tests.sh +0 -179
- package/payload/gate-sdk/bin/upgrade-smoke.sh +0 -236
- package/payload/gate-sdk/checks/check-action-run-shell.sh +0 -223
- package/payload/gate-sdk/checks/check-crate-arms.sh +0 -62
- package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +0 -450
- package/payload/gate-sdk/checks/check-install-disposition.sh +0 -93
- package/payload/gate-sdk/checks/check-shellcheck.sh +0 -57
- package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.sh +0 -2
- package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.sh +0 -2
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/args +0 -4
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/emit.txt +0 -14
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/projection.txt +0 -14
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +0 -2
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +0 -2
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +0 -6
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +0 -3
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +0 -6
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +0 -3
- package/payload/gate-sdk/gate-tests/check-install-disposition/bad/installer/lib/common/recipe.sh +0 -9
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-beta.gate +0 -3
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-gamma.sh +0 -6
- package/payload/gate-sdk/gate-tests/check-install-disposition/good/installer/lib/common/recipe.sh +0 -10
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +0 -5
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +0 -5
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.sh +0 -5
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +0 -5
- package/payload/gate-sdk/gate-tests/declaration-lib-parity.test.sh +0 -211
- package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +0 -112
- package/payload/gate-sdk/lib/consumer-smoke.sh +0 -69
- package/payload/gate-sdk/lib/declaration.sh +0 -59
- package/payload/gate-sdk/lib/inject.sh +0 -80
- package/payload/gate-sdk/smoke/install.sh +0 -171
- package/payload/gate-sdk/smoke/violation.sh +0 -13
- package/payload/guard-kit/SPEC.md +0 -1415
- package/payload/guard-kit/bin/compare-settings-allow.sh +0 -115
- package/payload/guard-kit/bin/run-guard-tests.sh +0 -110
- package/payload/guard-kit/bin/scan-prompts.sh +0 -166
- package/payload/guard-kit/bin/scratch-run.sh +0 -34
- package/payload/guard-kit/gate-tests/guard-read-path.test.sh +0 -52
- package/payload/guard-kit/lib/guard.sh +0 -1014
- package/payload/guard-kit/smoke/install.sh +0 -26
- package/payload/guard-kit/templates/bash-guard.sh +0 -20
- package/payload/guard-kit/templates/escalation-guard.sh +0 -27
- package/payload/guard-kit/templates/guard-config.sh +0 -8
- package/payload/guard-kit/templates/wakeup-guard.sh +0 -20
- package/payload/lifecycle-kit/SPEC.md +0 -2884
- package/payload/lifecycle-kit/bin/cite-survey.sh +0 -81
- package/payload/lifecycle-kit/bin/enter-stage.sh +0 -380
- package/payload/lifecycle-kit/bin/file-gap.sh +0 -101
- package/payload/lifecycle-kit/bin/file-survey.sh +0 -69
- package/payload/lifecycle-kit/bin/install-lifecycle.sh +0 -36
- package/payload/lifecycle-kit/bin/session-id.sh +0 -75
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.sh +0 -4
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.sh +0 -4
- package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.sh +0 -4
- package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.sh +0 -4
- package/payload/lifecycle-kit/gate-tests/workflow-state-guard.test.sh +0 -100
- package/payload/lifecycle-kit/lib/stages.sh +0 -194
- package/payload/lifecycle-kit/smoke/install.sh +0 -434
- package/payload/lifecycle-kit/smoke/violation.sh +0 -8
- package/payload/lifecycle-kit/templates/lifecycle-config.sh +0 -2
- package/payload/lifecycle-kit/templates/workflow-state-guard.sh +0 -29
- package/payload/queue-kit/SPEC.md +0 -1436
- package/payload/queue-kit/bin/lesson-sink.sh +0 -28
- package/payload/queue-kit/bin/queue-counts.sh +0 -35
- package/payload/queue-kit/bin/queue-edges.sh +0 -78
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.sh +0 -6
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.sh +0 -6
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.sh +0 -3
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.sh +0 -3
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.sh +0 -6
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.sh +0 -6
- package/payload/queue-kit/gate-tests/queue-lib-parity.test.sh +0 -215
- package/payload/queue-kit/lib/queue.sh +0 -129
- package/payload/queue-kit/smoke/install.sh +0 -25
- package/payload/queue-kit/smoke/violation.sh +0 -8
- package/payload/queue-kit/templates/queue-config.sh +0 -2
- package/payload/site-kit/SPEC.md +0 -601
- package/payload/site-kit/checks/check-docs-render-fidelity.sh +0 -242
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/scripts/site-config.sh +0 -7
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/scripts/site-config.sh +0 -7
- package/payload/site-kit/lib/site.sh +0 -43
- package/payload/site-kit/smoke/install.sh +0 -34
- package/payload/site-kit/smoke/violation.sh +0 -20
- /package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/{check-ported.gate → check-stage-entry.gate} +0 -0
|
@@ -1,2078 +0,0 @@
|
|
|
1
|
-
# delegation-kit — safe delegated-agent execution for budget-bounded sessions
|
|
2
|
-
|
|
3
|
-
Delegated agents are cheap to dispatch and expensive to trust. Three failure
|
|
4
|
-
surfaces dominate: **shared mutable state** (two committing agents race the
|
|
5
|
-
git index and one sweeps the other's staged files under the wrong message),
|
|
6
|
-
**interrupted long units** (a usage-window wall fires mid-flight and the
|
|
7
|
-
uncommitted investigation dies with the session), and **untrustworthy
|
|
8
|
-
self-reports** (a sub-agent's "passed" claim, or a gate quietly weakened to
|
|
9
|
-
make its commit pass). The kit packages the supervisor-side protocol that
|
|
10
|
-
closes all three, plus the two pieces that are mechanizable: a trustworthy
|
|
11
|
-
budget verdict (`usage-verdict`) and a commit-shape gate over gate tampering
|
|
12
|
-
(`check-gate-tamper`).
|
|
13
|
-
|
|
14
|
-
The kit carries the protocol templates, the budget-verdict tool, and the
|
|
15
|
-
tamper gate; the consumer supplies its own validate battery, shared-file
|
|
16
|
-
roster, and toolchain checks — those are project rule content and never
|
|
17
|
-
ship.
|
|
18
|
-
|
|
19
|
-
## The delegation model
|
|
20
|
-
|
|
21
|
-
One **supervisor** session dispatches `Agent` tasks and owns every ruling;
|
|
22
|
-
agents execute briefs and surface anything the brief does not cover.
|
|
23
|
-
`templates/agent-execution.md` owns the load-bearing rules — it is the
|
|
24
|
-
procedure a session loads, and each bullet's bold lead-in is the rule's stable
|
|
25
|
-
name (§One template, a resident pointer). This section keeps the mechanism
|
|
26
|
-
contracts and only the rationale that earns spec residency (a failure surface,
|
|
27
|
-
a calibration history, a bound that is correctness rather than preference),
|
|
28
|
-
each paragraph citing its rule by name rather than restating it.
|
|
29
|
-
|
|
30
|
-
**Boundary — this protocol stays fire-and-forget.** An agent here executes a
|
|
31
|
-
bounded brief and its result returns to the supervisor; a paused session that
|
|
32
|
-
holds its working state and *resumes in place* when a question is answered is a
|
|
33
|
-
different interaction model — *resume-in-place orchestration*, lifecycle-kit's
|
|
34
|
-
lead template (lifecycle-kit/SPEC.md §templates/lead.md), which reuses this
|
|
35
|
-
protocol's dispatch safety unchanged rather than replacing it.
|
|
36
|
-
|
|
37
|
-
The template's **Serialize on shared files; ≤`DELEGATION_KIT_FAN_WIDTH`-wide
|
|
38
|
-
otherwise** rule caps an *unlocked* fan-out at read-only work because the git
|
|
39
|
-
index and HEAD are shared for every committing agent regardless of source-file
|
|
40
|
-
disjointness — so the cap is a correctness bound, never a preference a consumer
|
|
41
|
-
may configure up for committing agents (the knob's derivation: §Layout and
|
|
42
|
-
configuration).
|
|
43
|
-
|
|
44
|
-
The template's **Background + notification, never poll** rule reads as
|
|
45
|
-
universal but is not, and the sentence that scopes it is a fact rather than a
|
|
46
|
-
role list: backgrounding survives a turn, and a dispatched agent's turn end is
|
|
47
|
-
its session end. Attested failure surface — a stage session read the rule,
|
|
48
|
-
backgrounded its whole validate suite, ended its turn to report progress, and
|
|
49
|
-
its child died with it: an entry stamp, no results, the suite re-run from
|
|
50
|
-
scratch. Nothing reddened, because missing evidence is indistinguishable from
|
|
51
|
-
pending evidence. Two phrasings were drafted and rejected on the way to the
|
|
52
|
-
current one, and both failures are instructive: a role-neutral "never end your
|
|
53
|
-
turn with detached work" forbids the supervisor pattern the same rule
|
|
54
|
-
prescribes, and "await it in the **foreground**" names a lever the agent may
|
|
55
|
-
not have — dispatches made *without* requesting backgrounding have been
|
|
56
|
-
observed detached anyway, so a rule stated on foreground is unfollowable
|
|
57
|
-
exactly where it is needed. That a subagent's return terminates its background
|
|
58
|
-
children was **attested here and inferred from the harness docs, not stated by
|
|
59
|
-
them**, and a counter-observation has since narrowed it: a validate session
|
|
60
|
-
backgrounded a *shell* producer, ended its turn, and the process kept running
|
|
61
|
-
and kept writing its output file for minutes. Reaping holds for an `Agent`
|
|
62
|
-
child and not for a shell one, so the rule's mechanism is the unconditional
|
|
63
|
-
loss of the **observer**, not the conditional loss of the work — and the
|
|
64
|
-
surviving-producer case is the worse of the two, since it is
|
|
65
|
-
`validate-producer-liveness-unobservable`'s hazard (an unread producer mutating
|
|
66
|
-
shared files while the next actor moves) arriving through the backgrounding
|
|
67
|
-
door. The rule is anchored on the invariant either way — an agent's contract
|
|
68
|
-
with its caller is its return value, so work whose result is not in the return
|
|
69
|
-
did not happen as far as the caller is concerned — which is why the
|
|
70
|
-
counter-observation cost the rule a sentence and not its content, exactly as
|
|
71
|
-
this paragraph predicted a reaping change would.
|
|
72
|
-
|
|
73
|
-
**Why that correction needed an affordance, not just a better reason.** The
|
|
74
|
-
session that produced the counter-observation reasoned *correctly* into the
|
|
75
|
-
failure: it read the producer-liveness hazard, concluded it must not let the
|
|
76
|
-
next actor proceed until the producer finished, and ended its turn to wait for
|
|
77
|
-
the completion notification — the one act that destroys that channel for a
|
|
78
|
-
dispatched role. A rule whose correct application requires a channel the reader
|
|
79
|
-
does not have is defeated by careful readers and not only careless ones, so the
|
|
80
|
-
template names the channel a dispatched role *does* have: an in-turn wait on the
|
|
81
|
-
work's own artifact. This is the case where the backgrounding rule and the
|
|
82
|
-
liveness hazard meet and neither, alone, covered it.
|
|
83
|
-
|
|
84
|
-
The template's **Background + notification, never poll** rule now carries a
|
|
85
|
-
*which primitive* clause, and that clause's residency here is a calibration
|
|
86
|
-
history. The template first named the harness's waiting primitive in the
|
|
87
|
-
singular while the harness offers two forms with opposite reactivity, so a
|
|
88
|
-
session picking one unaided picked by shape. Naming a form teaches a spelling;
|
|
89
|
-
naming the property a wait must have and sorting the forms under it teaches the
|
|
90
|
-
discriminator — a bound that is correctness rather than preference, because it
|
|
91
|
-
is what survives a harness adding a third form.
|
|
92
|
-
|
|
93
|
-
**Two waitable things, and only one of them has a path.** The template splits
|
|
94
|
-
what a session waits *on* and carries that mechanism itself. What is added here
|
|
95
|
-
is that the split is *complete* rather than merely convenient, because the
|
|
96
|
-
attested failure had no third case — and that the artifact's home is the resume
|
|
97
|
-
journal's own scoping widened rather than a second rule, so the survivability
|
|
98
|
-
grounds are stated once and cited twice.
|
|
99
|
-
|
|
100
|
-
**The shell branch names its artifact, and the naming is the substance.** The
|
|
101
|
-
split above left that branch pointing at *an artifact the session placed* without
|
|
102
|
-
saying which, so a session that wanted to comply had nothing to write, and of the
|
|
103
|
-
long-running shell producers a session might background, most publish no record of
|
|
104
|
-
any kind. The artifact is a **launch-time liveness record**: the child's PID,
|
|
105
|
-
captured by the launcher at the moment it backgrounds the child. The obvious
|
|
106
|
-
repair — have the child touch a file when it finishes and wait on that — is
|
|
107
|
-
refused, and the attested failure is exactly why: a completion marker answers *is
|
|
108
|
-
it done* **to a live observer**, and the failure case is the one where the
|
|
109
|
-
observer is gone. A liveness record answers *is it still running* **to whoever
|
|
110
|
-
arrives next**, which is a question a dead session's successor can still ask.
|
|
111
|
-
|
|
112
|
-
**The record's producer is the launcher, and the alternative is recorded as
|
|
113
|
-
refused rather than merely not chosen.** The alternative is per-producer
|
|
114
|
-
self-claiming — the producer-liveness lock's shape generalized so every
|
|
115
|
-
long-running producer claims its own record — and it fails on three counts. It
|
|
116
|
-
reaches only producers the consumer's own tree owns, where most backgrounded work
|
|
117
|
-
is an ad-hoc command composed at the call site. It puts the record's production in
|
|
118
|
-
the one process whose death is the event being detected, so a producer that dies
|
|
119
|
-
before claiming is invisible in exactly the window that matters. And it bills a
|
|
120
|
-
program for a property that belongs to the *launch* rather than to the program:
|
|
121
|
-
the same script backgrounded is in this class and run in the foreground is not.
|
|
122
|
-
The launcher, by contrast, knows the PID of anything it started, is the party that
|
|
123
|
-
needs to read it back, and is the only one present at the moment the class is
|
|
124
|
-
entered.
|
|
125
|
-
|
|
126
|
-
**The liveness clause widened rather than acquiring an exception, and its own
|
|
127
|
-
premise is what falsified it.** The clause sanctioned a recorded-PID match *where
|
|
128
|
-
liveness genuinely is the condition — a producer this session did not start*, and
|
|
129
|
-
that exclusion rested on an assumption: a session that started the producer was
|
|
130
|
-
taken to have a better instrument, namely its own artifact. The better instrument
|
|
131
|
-
requires a live reader, and the failure being fixed is the loss of the reader. So
|
|
132
|
-
the subject widens to cover a producer the session started **and backgrounded**,
|
|
133
|
-
and the widening is on the subject alone, never on the predicate — pattern-matched
|
|
134
|
-
liveness stays refused, and the bracket trick stays refused as the sanctioned
|
|
135
|
-
form on the grounds below.
|
|
136
|
-
|
|
137
|
-
**The record's grammar is evidence-kit's, and that is what makes the second reader
|
|
138
|
-
free.** There are two readers, and they are different parties at different
|
|
139
|
-
transitions: the **launching session**, in-turn, as its wait condition; and
|
|
140
|
-
**whoever arrives next**, which is the case the attested failure is actually
|
|
141
|
-
about, where the launcher is gone and something else must be able to tell that a
|
|
142
|
-
producer is still mutating shared files. Written in the one-line `pid=<n>
|
|
143
|
-
run=<key>` grammar the producer-liveness lock already carries, the record is a
|
|
144
|
-
legal subject for `check-producer-liveness` **unchanged** — that gate already
|
|
145
|
-
takes a record path and already reports exactly *is the producer named here still
|
|
146
|
-
running*, on a ruled exit contract. No new gate, no new tool, no new grammar, and
|
|
147
|
-
a reader already specified, already fixture-covered and already wired. An inverted
|
|
148
|
-
grammar would have bought a second implementation of a decided thing, which is the
|
|
149
|
-
only argument this needs; it is recorded because *a launch record is not a lock,
|
|
150
|
-
so it should have its own shape* is the reading a later session will reach for,
|
|
151
|
-
and the answer is that the two records carry the same field, answer the same
|
|
152
|
-
question, and differ only in who wrote them. How a PID's liveness is *decided*
|
|
153
|
-
stays evidence-kit's — the predicate, the PID-reuse residual and the refused TTL
|
|
154
|
-
are ruled in evidence-kit/SPEC.md §The producer-liveness lock and are not
|
|
155
|
-
seconded here. delegation-kit owns *when a session waits and on what*.
|
|
156
|
-
|
|
157
|
-
**The record's name is a convention, and what the convention buys is a derivable
|
|
158
|
-
set.** It is written as `<scratch-dir>/<key>.run`, carrying the same `pid=<n>
|
|
159
|
-
run=<key>` line — the filename's `<key>` is that record's own `run=` value, not
|
|
160
|
-
a third field. The grammar is untouched; what was missing is not the record's
|
|
161
|
-
shape but its **discoverability**. Without a convention the record's path is
|
|
162
|
-
known only to the session that wrote it and to whoever it happens to tell, so
|
|
163
|
-
the second reader named above — *whoever arrives next*, where the launcher is
|
|
164
|
-
gone — can read a record only by guessing its name. A suffix makes the set a
|
|
165
|
-
glob, and every reader that must ask *is anything still running here* reads the
|
|
166
|
-
set rather than a path: `check-producer-liveness`'s set mode
|
|
167
|
-
(evidence-kit/SPEC.md §check-producer-liveness), the stage-entry preflight
|
|
168
|
-
behind it, and guard-kit rule 14.
|
|
169
|
-
|
|
170
|
-
**`.run` rather than `.lock`, and the distinction is load-bearing.** A lock is
|
|
171
|
-
claimed and released by one owner and its absence means *free*;
|
|
172
|
-
`EVIDENCE_KIT_LOCK_FILE` is one and keeps its name. A launch record is a
|
|
173
|
-
**statement of fact left behind** — it answers *is it still running* to whoever
|
|
174
|
-
arrives next, a question a dead session's successor can still ask — and its
|
|
175
|
-
absence means *nothing was recorded*, never *nothing is running*. Two meanings,
|
|
176
|
-
two suffixes; and a consumer's scratch reset carries no `*.run` on its keep-list,
|
|
177
|
-
because a record surviving a work-unit boundary names a producer from the
|
|
178
|
-
previous one, which is precisely the stale statement the sweep exists to remove.
|
|
179
|
-
|
|
180
|
-
**Both affordances are refused, and the refusal's cost is bounded rather than
|
|
181
|
-
denied.** A tool to write the record and a second one to read it are declined: the
|
|
182
|
-
write is a PID captured at launch and the read is a single liveness match, each a
|
|
183
|
-
shell builtin away and both already spelled in the template, and a script whose
|
|
184
|
-
body is one builtin is the clearest case of the script-interpreter surface this
|
|
185
|
-
methodology shrinks. The generic reading affordance that would genuinely earn its
|
|
186
|
-
place already exists and is `check-producer-liveness`, which the grammar reuse
|
|
187
|
-
reaches without adding anything. What the refusal costs is stated rather than
|
|
188
|
-
hidden: an affordance would make the record's grammar impossible to get wrong, and
|
|
189
|
-
a hand-written one can be malformed. That failure is bounded by the consumer,
|
|
190
|
-
which exits **2** on a record it cannot parse, so a malformed record reads as
|
|
191
|
-
*could not be established* and never as *nothing running*.
|
|
192
|
-
|
|
193
|
-
**What the naming does not claim.** No gate enforces it, and the reason is
|
|
194
|
-
structural rather than budgetary: the subject is *did a session record a PID
|
|
195
|
-
before backgrounding*, and a session that skips the rule writes nothing, so there
|
|
196
|
-
is no absence a check could have been told to expect. The artifact-side backstop
|
|
197
|
-
stays the one §Operative residency already names — `check-producer-liveness` at a
|
|
198
|
-
stage entry, covering the **concurrent** case, a producer still live when the next
|
|
199
|
-
entry is stamped. Widening what that backstop may be pointed at does not make the
|
|
200
|
-
rule itself checkable. What the naming removes is a different failure: a session
|
|
201
|
-
that **wanted** to comply had no named artifact and was carved out of the only
|
|
202
|
-
clause that fit.
|
|
203
|
-
|
|
204
|
-
**The enforcement-design question is now answered, and the answer is a
|
|
205
|
-
relocation rather than a reversal.** *Given that prose alone does not hold, what
|
|
206
|
-
does* stood open here while the ruling above — the write is structurally
|
|
207
|
-
uncheckable — stayed true. It still is. What changed is the subject: the
|
|
208
|
-
**harm** a missed wait causes is not the turn-end but a tracked-tree mutation
|
|
209
|
-
under a live producer, and that arrives as an ordinary tool call at a
|
|
210
|
-
`PreToolUse` chokepoint, which is precisely the class §Operative residency says
|
|
211
|
-
the interception axis admits. It is enforced there, as guard-kit rule 14
|
|
212
|
-
(guard-kit/SPEC.md §The generic ruleset). The chokepoint ruling is confirmed by
|
|
213
|
-
this, not weakened.
|
|
214
|
-
|
|
215
|
-
**The claim ships with its bound, because a claim without one is the failure
|
|
216
|
-
this rule keeps re-earning.** The enforcement holds only for **a session that
|
|
217
|
-
recorded**. The paragraph above rules that the record's write is structurally
|
|
218
|
-
uncheckable — a session that skips the rule writes nothing, so there is no
|
|
219
|
-
absence a check could have been told to expect — so a session that backgrounds
|
|
220
|
-
without recording is invisible to rule 14 and to the entry preflight alike. It is
|
|
221
|
-
now **advised at the launch**, and still not refused. This narrows the failure to
|
|
222
|
-
that residue rather than closing it.
|
|
223
|
-
|
|
224
|
-
**The record's *write* is now reached at the launch chokepoint, and the refusal
|
|
225
|
-
that stood here is discharged.** The candidate was a rule firing on the
|
|
226
|
-
backgrounding call itself, held back on one empirical unknown: a shell `&` is in
|
|
227
|
-
the command text every rule already reads, but a harness's background-this
|
|
228
|
-
parameter is **tool input, not command text**, and whether it reaches the
|
|
229
|
-
`PreToolUse` payload was a question about one field. It does:
|
|
230
|
-
`.tool_input.run_in_background` is a JSON boolean `true` on a backgrounded Bash
|
|
231
|
-
call and absent on a foreground one (guard-kit/SPEC.md §The guard framework
|
|
232
|
-
records the payload's shape, so no session re-buys the probe). Both forms are
|
|
233
|
-
therefore reachable and **guard-kit rule 15 builds both arms in one rule**. The
|
|
234
|
-
judgment that held it back is kept rather than retired, because it is what made
|
|
235
|
-
the two-arm rule the right build rather than a bigger one: **building only the
|
|
236
|
-
`&` arm would have been worse than not building it** — every attested firing used
|
|
237
|
-
the harness form, so a rule covering only the shell spelling would have blocked
|
|
238
|
-
the form nobody uses and passed the one that fires, coverage in appearance and an
|
|
239
|
-
assertion about nothing in fact. What ships is an **advisory**, not a block, on
|
|
240
|
-
grounds guard-kit/SPEC.md §The generic ruleset states with the rule, and its
|
|
241
|
-
re-opening condition is named there.
|
|
242
|
-
|
|
243
|
-
**The guard interaction that produced it resolves without touching the guard.**
|
|
244
|
-
The attested sequence: a session reached for the correct artifact wait, spelled
|
|
245
|
-
it against the harness's own scratchpad path, and the consumer's bash guard
|
|
246
|
-
refused it and steered to repo-local scratch. The guard was **right** and needed
|
|
247
|
-
no change. What was missing is that the doctrine never said where an awaited
|
|
248
|
-
artifact belongs, so the refusal read as a refusal of artifact-waiting itself and
|
|
249
|
-
pushed the session onto the process-liveness form that then broke. With the split
|
|
250
|
-
above, a session waiting on an `Agent` never reaches for a path at all, and a
|
|
251
|
-
session waiting on a shell child has a path the guard already sanctions.
|
|
252
|
-
|
|
253
|
-
**The bracket trick is refused as the sanctioned form, and the grounds are here
|
|
254
|
-
because the template defers them here.** The template carries the mechanism —
|
|
255
|
-
why a process-liveness predicate can never go false, and the two sanctioned
|
|
256
|
-
repairs — and sends here the one question it does not answer: why the third,
|
|
257
|
-
`pgrep -f '[r]un-smoke.sh'`, is refused rather than passed over. It is the first
|
|
258
|
-
thing a reader reaches for and it *works*, so what disqualifies it is not correctness
|
|
259
|
-
but its failure mode: a spelling that must be remembered, whose omission is
|
|
260
|
-
invisible at the call site and whose cost when omitted is silent and expensive.
|
|
261
|
-
A rule whose correct form differs from its incorrect form by one character is a
|
|
262
|
-
rule that will be got wrong, which is why the enforcement half is a guard rule
|
|
263
|
-
over the shape (guard-kit/SPEC.md §The generic ruleset) rather than more prose.
|
|
264
|
-
|
|
265
|
-
The template's **Findings you will act on are durable before you act on them**
|
|
266
|
-
rule rests on a near-loss rather than a loss: a close stage dispatched two
|
|
267
|
-
audit sweeps and then hit the session wall. Both had already returned, which
|
|
268
|
-
was luck; had the wall landed mid-sweep the audit work would have been gone
|
|
269
|
-
with no record it ran. The gap is that the journal mechanics are written for a
|
|
270
|
-
dispatched *mutating* agent, so a read-only child journals nothing and its
|
|
271
|
-
findings exist only as a return value in the parent's context. The fix
|
|
272
|
-
deliberately does **not** overturn the read-only-fan-out caveat in §Resume
|
|
273
|
-
journal — that caveat was re-examined against this evidence and kept, with its
|
|
274
|
-
duty relocated to the receiving end, because overturning it would put the write
|
|
275
|
-
back exactly where the observed failures are. Recorded here because the rule
|
|
276
|
-
and the caveat otherwise read as each other's contradiction and the next
|
|
277
|
-
reader re-litigates them.
|
|
278
|
-
|
|
279
|
-
`templates/agent-budget-guard.sh` closes the gap the template's
|
|
280
|
-
**Budget-check before *each* dispatch in a fan-out** rule leaves when it relies
|
|
281
|
-
on the agent *choosing* to run the tool: a memory-quoted percentage acts in its
|
|
282
|
-
place (a session quoted ~5% while the live verdict read 29%). It is a `PreToolUse` hook (matcher `Agent`) the
|
|
283
|
-
harness fires on every dispatch once the consumer registers it in settings —
|
|
284
|
-
per-dispatch freshness, not a start-of-session reading a mid-session window
|
|
285
|
-
outlives. It runs `usage-verdict` at the decision point and routes on the exit
|
|
286
|
-
code:
|
|
287
|
-
|
|
288
|
-
- **PAUSE (1)** → `guard_block`: the verdict line plus its corrective (wait for
|
|
289
|
-
the window reset, or re-run with `DELEGATION_KIT_PAUSE_PCT` deliberately
|
|
290
|
-
raised). This is guard-kit's one sanctioned fail-closed deny — the hook
|
|
291
|
-
matcher proves the tool identity and PAUSE is reachable only through a fresh,
|
|
292
|
-
readable, over-threshold snapshot, so blocking cannot wedge a consumer with
|
|
293
|
-
no producer.
|
|
294
|
-
- **STALE / unreadable (2)** and **OK / RESET-OK (0)** → `guard_advise`,
|
|
295
|
-
feeding the verdict line back as `additionalContext` so the live reading
|
|
296
|
-
rides in context at every dispatch and a memory-quoted percentage can never
|
|
297
|
-
be the acting source. The advise arm relays that line and adds nothing: the
|
|
298
|
-
verdict string carries its own decision consequence (§usage-verdict), so
|
|
299
|
-
restating it on the arm would be one fact in two places. Routing STALE to
|
|
300
|
-
advice rather than out of delegation is what keeps a consumer with no
|
|
301
|
-
snapshot producer working — budget-unknown is decision-relevant, never
|
|
302
|
-
disqualifying.
|
|
303
|
-
|
|
304
|
-
The harness is the producer (it fires the hook once the settings registration
|
|
305
|
-
is set); the consumers are the dispatching agent, which reads the verdict line
|
|
306
|
-
off `additionalContext` at the dispatch-decision transition, and the
|
|
307
|
-
supervising user, who consumes a block by ruling — raise the knob or wait; the
|
|
308
|
-
agent never overrides. delegation-kit owns the verdict, its thresholds, and the
|
|
309
|
-
routing; guard-kit supplies only the framework primitives (its second
|
|
310
|
-
consumer). Registration is the opt-in valve: a consumer wanting pure advice
|
|
311
|
-
does not wire the hook. No new persistent state and no new key on the
|
|
312
|
-
`usage.txt` contract — the verdict line is the only interface.
|
|
313
|
-
|
|
314
|
-
**Covered at every depth, aggregated at none.** The hook's registration is
|
|
315
|
-
session-wide, so it fires inside dispatched sessions too: a dispatched
|
|
316
|
-
session's own dispatches re-arm it, carrying that session's identity, and the
|
|
317
|
-
coverage reaches every depth rather than stopping at the root. What it cannot
|
|
318
|
-
do is **aggregate** — each fire is independent and holds no state about the
|
|
319
|
-
tree, so a verdict prices the one call it gates and never the subtree that call
|
|
320
|
-
opens. That pairing is what the subtree clause of the template's
|
|
321
|
-
**Budget-check before *each* dispatch in a fan-out** rule exists to compensate,
|
|
322
|
-
and stating both halves here is what stops the next reader re-filing either.
|
|
323
|
-
Calibration history, because the silence invited the wrong turn: the hook
|
|
324
|
-
script is stateless and carries no depth counter, and a scope survey read that
|
|
325
|
-
as *the guard does not reach below the root* and filed against it. The reading
|
|
326
|
-
of the script was exact; the inference from it was false. A guard whose output
|
|
327
|
-
is only ever seen by the session it fires in looks absent from every other
|
|
328
|
-
vantage point — so a supervisor counting its own hook fires is watching a
|
|
329
|
-
strict undercount of its own tree, which is the observation the residual
|
|
330
|
-
projection gap is stated against rather than a coverage gap to be re-armed.
|
|
331
|
-
|
|
332
|
-
A knob-raise ruling has one working transport in this harness: the settings
|
|
333
|
-
env block (`.claude/settings.local.json`), which hooks re-read per fire — the
|
|
334
|
-
raised `DELEGATION_KIT_PAUSE_PCT` reaches the guard on the next dispatch with
|
|
335
|
-
no restart, and deleting the entry afterwards restores the default just as
|
|
336
|
-
immediately. A Bash-tool inline `export` never reaches the hook (the hook
|
|
337
|
-
process does not inherit the tool's shell), so it is not an override path.
|
|
338
|
-
Propagation is asymmetric within a live session: the hook re-reads the file
|
|
339
|
-
per fire, but the Bash tool environment retains an injected value after the
|
|
340
|
-
entry is deleted until the session restarts — an in-session `usage-verdict`
|
|
341
|
-
run and a hook fire can judge against different thresholds in that window, so
|
|
342
|
-
the hook's verdict line, not an in-session re-run, is the acting reading. That
|
|
343
|
-
this transport *works* is not a permission to use it for everything a harness
|
|
344
|
-
env var reaches: the subagent-model override below rides the same block and is
|
|
345
|
-
refused there, so the two must not read as one sanction.
|
|
346
|
-
|
|
347
|
-
**The subagent-model environment override is refused, and the reason is
|
|
348
|
-
precedence.** Model resolution runs in a fixed order — the subagent-model
|
|
349
|
-
environment override, then a dispatch's own `model` parameter, then the agent
|
|
350
|
-
definition's `model:` frontmatter, then the dispatching conversation's model —
|
|
351
|
-
and the environment rung sits *above* the per-dispatch parameter. Setting it
|
|
352
|
-
would pin every subagent to a cheap tier in one line, and would thereby
|
|
353
|
-
silently defeat a supervisor's deliberate per-batch tier pin, the mechanism
|
|
354
|
-
`lifecycle-kit/templates/lead.md` §Economics — batch, and compact where it pays
|
|
355
|
-
depends on to tier a batch by its work classes. A lever that overrides the
|
|
356
|
-
deliberate choice is not a default; it is a ceiling, so it is recorded as
|
|
357
|
-
rejected rather than left to be rediscovered as an improvement. The correct
|
|
358
|
-
rung is the **frontmatter**, third in the chain: it supplies the standing
|
|
359
|
-
default the template's **Match the dispatched model and effort to the unit's
|
|
360
|
-
shape** rule asks for while the per-dispatch parameter still overrides it. The
|
|
361
|
-
same rule's affirmative-selection clause is why the field is *stated* rather
|
|
362
|
-
than left out — an omitted `model:` resolves to the literal `inherit`, so
|
|
363
|
-
omission spells the dispatcher's tier rather than a neutral absence, and
|
|
364
|
-
`check-agent-tier-explicit` is that clause's oracle over the tracked surface.
|
|
365
|
-
|
|
366
|
-
**Isolation's second purpose, and why the cost objection does not land.** The
|
|
367
|
-
template's **A read-only claim is made by isolation, not by sentence** rule
|
|
368
|
-
states the disposition and carries none of its grounds, which are these. "It has
|
|
369
|
-
no Edit tool" is not the safety property it reads as: every agent type available
|
|
370
|
-
for audit-shaped work carries write tools, or at least a shell that reaches
|
|
371
|
-
`git`, so a toolset is never narrowed by the brief describing it. And the
|
|
372
|
-
isolation is not purely a cost — the harness auto-cleans a worktree left
|
|
373
|
-
unchanged, so the worktree survives **iff** the agent was not in fact read-only,
|
|
374
|
-
which makes one mechanism both the confinement and its own detector. Gitignoring
|
|
375
|
-
the worktree path trades that free `git status` signal away, which is why the
|
|
376
|
-
rule's second cost sends the parent to an explicit `git worktree list` at the
|
|
377
|
-
reaping boundary instead.
|
|
378
|
-
|
|
379
|
-
**`worktree.baseRef` is vendor configuration, and choosing it is the consumer's
|
|
380
|
-
job.** The template's **Isolation charges three harness costs, and paying them
|
|
381
|
-
is the parent's job** rule names the knob and both of its values rather than a
|
|
382
|
-
choice, because a vendoring consumer inherits the template and never a settings
|
|
383
|
-
file. A consumer that dispatches isolated agents therefore sets the knob
|
|
384
|
-
deliberately instead of inheriting the default, and — where its harness config is
|
|
385
|
-
gated — pins it, through the general settings-pin mechanism (context-kit/SPEC.md
|
|
386
|
-
§check-settings-pins) rather than anything this kit ships. What is ruled is that
|
|
387
|
-
the value be *chosen*, never which value: a consumer wanting a clean tree per
|
|
388
|
-
dispatch is right to stay on the default. No knob joins delegation-kit's own
|
|
389
|
-
roster for it (§Layout and configuration) — this is harness configuration, not
|
|
390
|
-
kit configuration, and a kit knob shadowing a vendor setting would be a second
|
|
391
|
-
source for one value. Recorded so a later reader does not read the omission as an
|
|
392
|
-
oversight and close it.
|
|
393
|
-
|
|
394
|
-
**Why that cost names a knob and not a measurement.** "The worktree is cut at
|
|
395
|
-
the remote tracking ref, so staleness equals the unpushed backlog" describes the
|
|
396
|
-
`fresh` value alone; stated as universal it is false, and it reached shipped,
|
|
397
|
-
consumer-facing doctrine on seven attestations — every one taken under that
|
|
398
|
-
default, not one of them bearing on whether the behavior was configurable.
|
|
399
|
-
Repeated confirmation of a behavior is not evidence about its mutability, and
|
|
400
|
-
each re-confirmation made the mechanism feel more settled and so suppressed the
|
|
401
|
-
configuration probe that would have settled it. Hence the rule's shape: name the
|
|
402
|
-
knob and both values, and leave any measurement attributed to the configuration
|
|
403
|
-
it was taken under. It follows that no parent "owes the doubt back" for a
|
|
404
|
-
structural defect here — there is none, and the discipline below costs one line
|
|
405
|
-
in a prompt.
|
|
406
|
-
|
|
407
|
-
**The child-side rev discipline is kept as defence in depth, and the first
|
|
408
|
-
ground alone is sufficient.** The parent cannot read the child's *effective*
|
|
409
|
-
setting — `baseRef` resolves on the dispatching machine's merged settings,
|
|
410
|
-
nothing in the dispatch payload carries it and nothing returns it — so a parent
|
|
411
|
-
assuming either value is asserting an unverified premise about a third-party
|
|
412
|
-
tool, which is the move that produced the false doctrine above. Second, a
|
|
413
|
-
vendoring consumer inherits the template and not a settings file, so for every
|
|
414
|
-
consumer that has not set the knob the discipline is the whole protection. Third,
|
|
415
|
-
even a repo that pins the knob is not covered end to end: a managed tier and a
|
|
416
|
-
command-line override outrank a project settings file and lie outside any repo's
|
|
417
|
-
reach. It is also nearly free and self-verifying — one command whose output *is*
|
|
418
|
-
the evidence — so under a holding pin it degrades from load-bearing to a cheap
|
|
419
|
-
assertion rather than becoming dead weight.
|
|
420
|
-
|
|
421
|
-
**The untracked half reaches no configuration at all, and its disposition is
|
|
422
|
-
refusal.** An isolated child sees only committed state, so the third cost is a
|
|
423
|
-
ruling rather than a mitigation: no value of the knob helps and naming a rev does
|
|
424
|
-
not either. Attested twice — a sweep sent to triage an untracked capture log read
|
|
425
|
-
an empty file and reported its corpus absent, and a settings-overlay comparison
|
|
426
|
-
saw no overlay because the local settings file is uncommitted. Both returned a
|
|
427
|
-
confident "nothing there", indistinguishable in shape from a clean result, which
|
|
428
|
-
makes it the worse of the two failure modes. It binds *against* the read-only
|
|
429
|
-
rule rather than beside it: a read-only claim is made by isolation, and isolation
|
|
430
|
-
is what blinds the read, so a claimed-read-only sweep over an untracked corpus
|
|
431
|
-
has no correct form at all.
|
|
432
|
-
|
|
433
|
-
**The dispatch-shape rules are one mechanism, seen from several sides.** The template's **Never dispatch
|
|
434
|
-
a fork to narrow a child**, **A read-only claim is made by isolation, not by
|
|
435
|
-
sentence**, and **A child's only upward route is a durable artifact** rules are
|
|
436
|
-
one defect seen from three sides: each governs the *shape of a dispatch call*,
|
|
437
|
-
and each failed the same way — the prose did not reach the reader it binds.
|
|
438
|
-
One attested surface per rule: a fork dispatched as a read-only audit completed
|
|
439
|
-
a whole stage, commits included; four forks dispatched with prose-only
|
|
440
|
-
"read-only, no edits" briefs, one of which committed unreviewed on the shared
|
|
441
|
-
branch; and repeated fan-outs, across stages and across iterations, messaged the top-level
|
|
442
|
-
session instead of their dispatcher, which no prompt wording could have fixed.
|
|
443
|
-
|
|
444
|
-
**Why an oracle is owed here and not for the turn-ending rule.** §Operative
|
|
445
|
-
residency closes on the finding that a restated rule is reachable, not obeyed,
|
|
446
|
-
and owes no gate because no check can read a session's choice to end a turn —
|
|
447
|
-
the act leaves no tracked artifact. A dispatch leaves no tracked artifact
|
|
448
|
-
either, so the distinguishing axis is not durability but interception:
|
|
449
|
-
|
|
450
|
-
> Where a rule binds an act that leaves no tracked artifact, the enforcement
|
|
451
|
-
> question is whether the act passes a **chokepoint** — not whether it reaches
|
|
452
|
-
> the tree. A dispatch does. A turn-end does not.
|
|
453
|
-
|
|
454
|
-
**That second sentence was a claim about the harness, and it has now been
|
|
455
|
-
measured.** A `SubagentStop` hook *is* a chokepoint at the turn-end, so it is the
|
|
456
|
-
one candidate that could falsify the axis — and the decisive question was whether
|
|
457
|
-
the harness already defers a subagent's stop while a background child is live,
|
|
458
|
-
since a harness that deferred would dissolve the class this rule exists for. The
|
|
459
|
-
logging-only probe at §The turn-end liveness probe (template) put a live producer
|
|
460
|
-
under a deliberate turn-end and read `live=yes`: **the stop is not deferred**. So
|
|
461
|
-
the sentence stands as written for the `PreToolUse` axis it was said on, the
|
|
462
|
-
relocation to guard-kit rule 14 stands, and the turn-end's own event is reachable
|
|
463
|
-
but buys enforcement only through a blocking hook nobody has authorized.
|
|
464
|
-
|
|
465
|
-
**The chokepoint — what a `PreToolUse` hook can actually read.** The payload
|
|
466
|
-
carries `session_id`, `prompt_id`, `transcript_path`, `cwd`, `permission_mode`,
|
|
467
|
-
`hook_event_name`, `tool_name`, `tool_input`, and `tool_use_id`; and, **only
|
|
468
|
-
when the hook fires inside a subagent**, `agent_id` and `agent_type`. For the
|
|
469
|
-
dispatch tool, `tool_input` carries the dispatch's own parameters —
|
|
470
|
-
`subagent_type`, `isolation`, `model`, `description`, `prompt`. Three
|
|
471
|
-
consequences carry the guard below: the fork ban has an exact trigger
|
|
472
|
-
(`tool_input.subagent_type`), the read-only claim has an exact trigger
|
|
473
|
-
(`tool_input.isolation`), and depth has an exact, *documented* discriminator —
|
|
474
|
-
`agent_id` is present iff the dispatching session is itself a subagent, so its
|
|
475
|
-
presence means the call about to be made creates a grandchild.
|
|
476
|
-
|
|
477
|
-
**Honest limit on that roster.** It is sourced from the harness's own published
|
|
478
|
-
hook contract, fetched rather than recalled, and from nothing in this tree —
|
|
479
|
-
the same footing as `CLAUDE_CODE_CHILD_SESSION`'s "verified, not trusted"
|
|
480
|
-
treatment (lifecycle-kit/SPEC.md §bin/session-id.sh). A future harness revision
|
|
481
|
-
reshaping the payload is drift this SPEC cannot self-detect; only re-reading the
|
|
482
|
-
hook contract catches it.
|
|
483
|
-
|
|
484
|
-
**Two depth routes ruled out**, both being the obvious move.
|
|
485
|
-
`CLAUDE_CODE_CHILD_SESSION` is set in top-level sessions too, and
|
|
486
|
-
`CLAUDE_CODE_SESSION_ID` carries the *root* id for a child, so a depth-1 and a
|
|
487
|
-
depth-2 dispatcher are indistinguishable by environment alone — that route
|
|
488
|
-
ships a rule silently mis-firing at the top level. The meta record beside a
|
|
489
|
-
transcript does carry an exact spawn depth, and that route works and is
|
|
490
|
-
deliberately not taken: it couples a hook to an *uncontracted* harness artifact
|
|
491
|
-
to answer a question one *contracted* boolean already answers. The
|
|
492
|
-
stage-economics meter accepts that same coupling (drift-kit/SPEC.md §The
|
|
493
|
-
stage-economics meter, the fan-out row) because it needs the whole spawn forest
|
|
494
|
-
and no contracted field supplies it; a hook needs one bit and gets it under
|
|
495
|
-
contract. The axis is what the contract supplies, not appetite for risk.
|
|
496
|
-
|
|
497
|
-
`templates/agent-dispatch-guard.sh` is that oracle — a second `PreToolUse` hook
|
|
498
|
-
on matcher `Agent`, beside the budget guard, composed from
|
|
499
|
-
`guard-kit/lib/guard.sh` primitives. It reads the payload once and runs the
|
|
500
|
-
rules below, in order:
|
|
501
|
-
|
|
502
|
-
| # | rule | trigger | decision |
|
|
503
|
-
| --- | --- | --- | --- |
|
|
504
|
-
| D1 | fork ban | `tool_input.subagent_type` is `fork` | block |
|
|
505
|
-
| D2 | isolation claim | `tool_input.subagent_type` ∈ `DELEGATION_KIT_READONLY_TYPES` and `tool_input.isolation` is not `worktree` | block |
|
|
506
|
-
| D3 | depth advisory | payload carries `agent_id` | advise |
|
|
507
|
-
|
|
508
|
-
Order is load-bearing only between D1/D2 and D3 — a blocked dispatch needs no
|
|
509
|
-
advisory, so D3 runs last. D1 precedes D2 because the fork ban is unconditional
|
|
510
|
-
and its message is the more specific one for a dispatch violating both.
|
|
511
|
-
|
|
512
|
-
**Why a second guard rather than more rules in the budget guard.** Four
|
|
513
|
-
reasons, each independently sufficient: the budget guard blocks on a
|
|
514
|
-
**transient** condition and is deliberately knob-overridable, while these block
|
|
515
|
-
on a **permanent** doctrine violation that must not be per-dispatch
|
|
516
|
-
overridable; the budget guard reads no stdin at all; a consumer may want either
|
|
517
|
-
enforcement without the other, and hook registration is the only opt-in valve
|
|
518
|
-
there is; and their test lanes take different payload grammars. The harness
|
|
519
|
-
fires every hook registered on a matcher and any exit 2 blocks, so the two
|
|
520
|
-
compose with no dispatcher between them.
|
|
521
|
-
|
|
522
|
-
**D1 blocks unconditionally**, which the template's own boundary does not — a
|
|
523
|
-
fork stays correct where the child does the same job at the same authority, and
|
|
524
|
-
a hook cannot read intent. The block is ruled unconditional on the ground that
|
|
525
|
-
no sanctioned fork use exists in this doctrine, and the valve is **unwiring the
|
|
526
|
-
hook**, never a knob: a per-dispatch override is exactly the honour system
|
|
527
|
-
these rules exist to end, and a knob would restore it under a better
|
|
528
|
-
name. The block message names the two lawful alternatives, as guard-kit
|
|
529
|
-
requires of every block message.
|
|
530
|
-
|
|
531
|
-
**D2 is inert until configured**, by construction — the default roster is empty
|
|
532
|
-
and the kit ships no agent-type names. An inert D2 reports nothing; it is a
|
|
533
|
-
hook, not a gate, so there is no clean line to print. Stated here so a consumer
|
|
534
|
-
does not infer coverage it has not configured.
|
|
535
|
-
|
|
536
|
-
**D3 advises rather than blocks**, and both halves are deliberate. It cannot
|
|
537
|
-
block: a nested dispatch is legitimate and common — a stage session's own
|
|
538
|
-
read-only fan-out *is* a grandchild dispatch — so blocking would remove a
|
|
539
|
-
capability rather than confine one. It must not be silent: this is the one rule
|
|
540
|
-
whose bound reader provably never loads the protocol template (§One template, a
|
|
541
|
-
resident pointer), so the advisory is the *only* delivery of it, which is
|
|
542
|
-
§Operative residency's (a)–(c) shape applied at a hook instead of a doc. Ruled
|
|
543
|
-
out for D3: keying on whether the prompt text "names a path" — that fires on
|
|
544
|
-
the word and teaches dispatchers to game the wording, buying a green hook and
|
|
545
|
-
no channel. The `agent_id` trigger is exact and unforgeable; the message
|
|
546
|
-
carries the judgment the trigger cannot.
|
|
547
|
-
|
|
548
|
-
**Degradation — fail-open, but loud**, the posture guard-kit/SPEC.md §The guard
|
|
549
|
-
framework names for a deny-guard whose matcher proves the tool but whose rule
|
|
550
|
-
turns on a payload field:
|
|
551
|
-
|
|
552
|
-
| what is missing | behavior |
|
|
553
|
-
| --- | --- |
|
|
554
|
-
| `jq` absent | allow; one advisory naming the unenforced rules |
|
|
555
|
-
| payload unparseable, or `tool_input` absent | allow; same advisory |
|
|
556
|
-
| `subagent_type` absent from a parseable payload | D1 and D2 do not fire (nothing to match); D3 unaffected |
|
|
557
|
-
| `DELEGATION_KIT_READONLY_TYPES` unset or empty | D2 inert, and silently so; D1 and D3 unaffected |
|
|
558
|
-
| `DELEGATION_KIT_CONFIG_FILE` set but naming no file | allow; advisory naming D2 unenforced |
|
|
559
|
-
| `guard-kit/lib/guard.sh` not vendored | the guard exits 0 before sourcing, as both shipped guards already do |
|
|
560
|
-
|
|
561
|
-
Two implementation facts those rows force, recorded because the obvious build
|
|
562
|
-
gets each of them wrong:
|
|
563
|
-
|
|
564
|
-
- **The `jq`-absent arm cannot deliver through `guard_advise`.** That primitive
|
|
565
|
-
is itself jq-backed, and measuring it rather than assuming settles what
|
|
566
|
-
happens: with `jq` off `PATH` it writes an empty stdout and leaves a shell
|
|
567
|
-
"command not found" on stderr, which names none of the unenforced rules — the
|
|
568
|
-
silent success these rules exist to end, arriving inside the mechanism meant
|
|
569
|
-
to prevent it. The guard therefore emits the advisory envelope itself on that
|
|
570
|
-
arm, and every advisory literal it carries is kept free of the characters
|
|
571
|
-
JSON must escape, since that fallback carries no escaper.
|
|
572
|
-
- **The guard does not source delegation-kit's validating config loader**, only
|
|
573
|
-
the consumer config file, for the one array it reads. The loader exits 2 on
|
|
574
|
-
any malformed knob and a hook that exits 2 blocks, so routing the fork ban
|
|
575
|
-
through a validator for `DELEGATION_KIT_FAN_WIDTH` would let an unrelated
|
|
576
|
-
typo wedge every dispatch in the consumer whose primary token lever is
|
|
577
|
-
delegation — the fail-closed posture this guard is specified against,
|
|
578
|
-
arriving through the config door. The distinction the last two table rows
|
|
579
|
-
draw is this kit's standing one: a roster **configured to nothing** is
|
|
580
|
-
silent, a roster that **could not be read** is loud.
|
|
581
|
-
|
|
582
|
-
### One template, a resident pointer
|
|
583
|
-
|
|
584
|
-
`templates/agent-execution.md` is the single source for the protocol — a
|
|
585
|
-
binding-shim *template* in lifecycle-kit's grammar (lifecycle-kit/SPEC.md
|
|
586
|
-
§check-skill-binding). The consumer creates `.claude/commands/agent-execution.md`
|
|
587
|
-
as a shim that names the template and binds its two slots — the shared-file
|
|
588
|
-
roster and the validate battery — the consumer-specialization discipline of
|
|
589
|
-
guard-kit's consumer-rules block, now carried by the slot/binding mechanism the
|
|
590
|
-
lifecycle skills already use. `check-skill-binding` enforces the slot pairing on
|
|
591
|
-
the consumer side.
|
|
592
|
-
|
|
593
|
-
A spec reference to one of those rules uses the citation grammar
|
|
594
|
-
`the template's **<name>** rule`, where `<name>` is a bullet's bold lead-in
|
|
595
|
-
verbatim minus its trailing period; `check-rule-citation` resolves every such
|
|
596
|
-
citation in §The delegation model forward into the template, so a lead-in
|
|
597
|
-
rename cannot silently dangle a reference.
|
|
598
|
-
|
|
599
|
-
`templates/dispatch-checklists.md` is a second, load-triggered template the
|
|
600
|
-
protocol template reaches by a single pointer line: `agent-execution.md` names
|
|
601
|
-
it for a deletion, rename, or heavy cross-spec audit dispatch, and it loads only
|
|
602
|
-
then — never resident, and not a binding shim (it binds no slots, so
|
|
603
|
-
`check-skill-binding` does not scan it). It carries the mechanical pre-flight for
|
|
604
|
-
those dispatch shapes — the importer/collision/sweep-verification checks — while
|
|
605
|
-
the protocol proper stays whole in `agent-execution.md`; the pointer-line
|
|
606
|
-
contract is that the protocol template stays complete alone and the checklists
|
|
607
|
-
are a reach-through, so the width, journal, and validate rules live once in the
|
|
608
|
-
protocol template and are cited from the checklists, never restated. This is the
|
|
609
|
-
load-trigger-residency rule applied a rung deeper: even inside a load-triggered
|
|
610
|
-
template, a subset that only a narrower trigger (a deletion or rename dispatch)
|
|
611
|
-
needs sits behind its own pointer.
|
|
612
|
-
|
|
613
|
-
The consumer's CLAUDE.md carries no digest of the bullets, only a resident
|
|
614
|
-
pointer: the pre-authorization sentence (consumer judgment on what delegation
|
|
615
|
-
needs no ask) and `/agent-execution`. Rationale: a rule is resident only when it
|
|
616
|
-
has no load trigger (the load-trigger-residency doctrine), and every protocol
|
|
617
|
-
bullet triggers at `Agent` dispatch **for the role that dispatches** — which
|
|
618
|
-
already has a mechanical seam, the
|
|
619
|
-
per-dispatch budget guard, whose block message names `/agent-execution`. The
|
|
620
|
-
doctrine lives behind the trigger, not in the always-loaded file. Honest limit,
|
|
621
|
-
tightened now that a second hook rides the same matcher: the guards enforce
|
|
622
|
-
mechanically exactly the rules that pass a chokepoint — the budget check, and
|
|
623
|
-
the dispatch-shape rules (§The delegation model) — and protocol literacy
|
|
624
|
-
beyond those stays unenforced. A session that dispatches without invoking the
|
|
625
|
-
skill still carries only the resident pointer for everything else.
|
|
626
|
-
|
|
627
|
-
**That role qualifier is load-bearing rather than hedging.** Stated without it,
|
|
628
|
-
the rationale is role-blind: a *dispatched* role fires no such trigger — it is
|
|
629
|
-
not dispatching at all, it is executing a stage, and no stage skill or stage
|
|
630
|
-
template loads this protocol — so for that reader the pointer posture leaves the
|
|
631
|
-
rule unreached, which is how a posture nobody disputes produced three incidents.
|
|
632
|
-
§Operative residency governs that case, and the bounded imperative it sanctions
|
|
633
|
-
in a consumer's always-loaded agent definition is this same doctrine applied at a
|
|
634
|
-
different reader, not an exception carved out of this paragraph.
|
|
635
|
-
|
|
636
|
-
### Operative residency
|
|
637
|
-
|
|
638
|
-
A rule may be **restated as an imperative in a surface that does not own it**
|
|
639
|
-
when all three of these hold:
|
|
640
|
-
|
|
641
|
-
- **(a) Unreachable trigger.** The actor the rule binds never fires a trigger
|
|
642
|
-
that loads the rule's owning doc. This is a property of the *reader*, settled
|
|
643
|
-
by asking which triggers that reader actually fires.
|
|
644
|
-
- **(b) Imperative only.** What is restated is the instruction. The reasoning,
|
|
645
|
-
the failure analysis, and the mechanism stay with the owner.
|
|
646
|
-
- **(c) Adjacent citation.** The restatement names the owning surface beside
|
|
647
|
-
itself, so the owner stays the single place the rule is explained and changed.
|
|
648
|
-
|
|
649
|
-
Each condition has a reader at a transition rather than being self-evident: (a)
|
|
650
|
-
and (b) are read by whoever authors a restatement, at authoring, and again by a
|
|
651
|
-
reviewer or an authoring stage assessing an existing one; (c) is the pointer any
|
|
652
|
-
later reader — and any content-tiering check — follows back to the owner. The
|
|
653
|
-
reader the sanction exists for is the third and never inspects a condition at
|
|
654
|
-
all: the bound actor, which receives the imperative at the tier it always loads,
|
|
655
|
-
which is the whole point.
|
|
656
|
-
|
|
657
|
-
**The anti-licence clause is part of the rule, not commentary.** The sanction is
|
|
658
|
-
keyed on (a): a rule that the bound actor's own skill or template already loads
|
|
659
|
-
fails (a) and stays a pointer. Without that clause this reads as "duplicate when
|
|
660
|
-
it feels important", which is the failure content-tiering exists to prevent and
|
|
661
|
-
would cost more than the gap it closes.
|
|
662
|
-
|
|
663
|
-
**This is load-trigger residency's own logic, not an exception to it.** That
|
|
664
|
-
doctrine earns a rule a place in an always-loaded file only when no stage, skill,
|
|
665
|
-
or tool-call trigger exists to load it, and the decisive question is *exists for
|
|
666
|
-
whom*. A trigger that exists but that the bound actor never fires is, for that
|
|
667
|
-
actor, no trigger. The doctrine's stated justification — a rule a stage or a tool
|
|
668
|
-
call would load anyway costs nothing to defer and everything to keep resident —
|
|
669
|
-
does not merely fail for such an actor, it inverts: nothing loads it anyway, so
|
|
670
|
-
deferring costs everything.
|
|
671
|
-
|
|
672
|
-
**Content-tiering is satisfied by bounding what is copied, which is what (b) is
|
|
673
|
-
for.** The restatement is still a restatement, which is why it needs this
|
|
674
|
-
sanction rather than an argument; but its drift surface is one instruction rather
|
|
675
|
-
than a slab, and the place the rule is explained and changed stays single.
|
|
676
|
-
|
|
677
|
-
The attested subjects are the template's **Background + notification, never
|
|
678
|
-
poll** rule and its **Findings you will act on are durable before you act on
|
|
679
|
-
them** rule, both of which bind a dispatched session. Three such sessions read a
|
|
680
|
-
*descriptive* pointer to them at the always-loaded tier and derived no constraint
|
|
681
|
-
from it. The derivations were easy, which is what makes the failure instructive:
|
|
682
|
-
under load a descriptive sentence reads as background about one's situation
|
|
683
|
-
rather than as a constraint on the next action. The defect this rule names is
|
|
684
|
-
therefore pointer-versus-operative-statement, never absence.
|
|
685
|
-
|
|
686
|
-
**Operative is not obeyed, and a fourth firing is the attestation.** A dispatched
|
|
687
|
-
session ended its turn on work still running while the waiting rule sat in that
|
|
688
|
-
session's own agent definition as a bare imperative, restated under (a)–(c) —
|
|
689
|
-
the compliant form this sanction licenses. So the diagnosis above names a cause
|
|
690
|
-
*removed*, not the defect *closed*: residency makes a rule reachable at the point
|
|
691
|
-
of use, and reachable is not obeyed. Every restatement this sanction licenses is
|
|
692
|
-
a request delivered where it is read. Weigh it as one — worth its small drift
|
|
693
|
-
surface for the failure mode it does remove, and never a substitute for an
|
|
694
|
-
oracle where one is buildable. In the attested instance what caught the
|
|
695
|
-
consequence was the artifact-side oracle below, with the prose already in its
|
|
696
|
-
strengthened form.
|
|
697
|
-
|
|
698
|
-
**The propagate obligation has fired, and the record names what it cost.** The
|
|
699
|
-
waiting rule changed — the primitive named by its reactivity property, the
|
|
700
|
-
awaited artifact given a home — and the template's *when either rule changes
|
|
701
|
-
here, propagate* header sent that change to both of its restatements in this
|
|
702
|
-
consumer's `.claude/agents/` definitions: one a stage-session type, one a
|
|
703
|
-
read-only sweep type. They did not carry the rule alike. One cited the bullet by
|
|
704
|
-
name and restated its wait mechanics at length; the other carried a single
|
|
705
|
-
turn-end line with no citation, no primitive and no home. **The target is
|
|
706
|
-
symmetric even where the starting text is not**, so propagation into the second
|
|
707
|
-
was a genuine addition sized to that file's own voice rather than a paste of the
|
|
708
|
-
first's paragraph — and neither absorbed the rejected-alternative reasoning,
|
|
709
|
-
which is (b)'s line and stays with this section's owner. Recorded because the
|
|
710
|
-
sanction's cost is exactly this: every rule it licenses acquires N carriers that
|
|
711
|
-
a later change must find, and a restatement that drifted *unevenly* is harder to
|
|
712
|
-
spot than one that drifted at all.
|
|
713
|
-
|
|
714
|
-
**The obligation fired again, and the second firing found a carrier the roster
|
|
715
|
-
did not hold.** The waiting rule changed once more — the shell-child branch named
|
|
716
|
-
its artifact, and the liveness clause widened past *a producer this session did
|
|
717
|
-
not start* — and propagation reached both `.claude/agents/` definitions as before.
|
|
718
|
-
It also reached a **third** carrier sitting outside this section's roster
|
|
719
|
-
entirely: guard-kit's self-matching-`pgrep` rule states the same clause verbatim
|
|
720
|
-
in the corrective help text it prints when it blocks, mirrored in prose in that
|
|
721
|
-
kit's own SPEC. Left alone, a guard-blocked session would read advice that
|
|
722
|
-
undersells what it may now do with its own backgrounded child — a restatement
|
|
723
|
-
whose reader arrives at the worst possible moment, already stopped and looking for
|
|
724
|
-
the sanctioned form. Recorded because of what found it: the clause's own wording,
|
|
725
|
-
grepped across the tree, and not this section's list of known carriers. The
|
|
726
|
-
sanction's cost is N carriers a later change must find, and N is discovered by
|
|
727
|
-
grepping the rule's phrasing rather than by consulting the roster — a roster is a
|
|
728
|
-
record of the carriers someone noticed, never a proof of the set.
|
|
729
|
-
|
|
730
|
-
**The rule's own attested counter-examples are now explained, and the explanation
|
|
731
|
-
indicted the wording rather than the primitive.** Four of one session's
|
|
732
|
-
backgrounded waiters had died before their conditions went true with their
|
|
733
|
-
producers verifiably alive, against an event-stream call that succeeded first try
|
|
734
|
-
— a standing case that the mandated primitive was the wrong one on this machine.
|
|
735
|
-
It was measured rather than argued (§bin/wait-probe): every trial on a
|
|
736
|
-
*completion-marker* predicate outlived its condition, on both harness forms and on
|
|
737
|
-
a detached shell child, at producer durations up to and including the longest
|
|
738
|
-
swept — so no form carries a wall-clock ceiling in that range. Every early exit
|
|
739
|
-
instead shared one property, and it was not the form: the loop tested the
|
|
740
|
-
producer's **liveness**, and it reproduced on the harness-uninvolved control in
|
|
741
|
-
milliseconds, which exonerates the harness and the primitive together.
|
|
742
|
-
|
|
743
|
-
**The cause is that the rule's two clauses compose into an inverted loop.** The
|
|
744
|
-
protocol mandates wrapping `until <cond>; do sleep N; done` *and* looping on the
|
|
745
|
-
recorded PID's liveness. `until` ends when its condition becomes **true** and
|
|
746
|
-
`kill -0` is true while the producer is **alive**, so the literal composition of
|
|
747
|
-
the two clauses exits at once, cleanly, with the producer running — which is
|
|
748
|
-
exactly the reported signature, down to the clean exit status. The wait's
|
|
749
|
-
condition must be its **continuation** condition: `until` takes a *done* predicate
|
|
750
|
-
and `while` takes a *still-running* one, and liveness is a still-running
|
|
751
|
-
predicate. So the ordering the template states stands **unchanged** and what
|
|
752
|
-
changed is the spelling every carrier shipped, propagated to all four. That the
|
|
753
|
-
correction is free at the guard was probed rather than assumed: rules 13 and 15
|
|
754
|
-
walk `do … done` spans without reading the loop keyword, so the `while` form is
|
|
755
|
-
exempt exactly as the `until` form is (guard-kit/SPEC.md §The generic ruleset).
|
|
756
|
-
|
|
757
|
-
**Recorded here because of what the near-miss was.** A rule whose attested
|
|
758
|
-
counter-examples stay unexplained is a rule its readers discount, and the
|
|
759
|
-
discounting was already under way — the counter-examples had been read as evidence
|
|
760
|
-
*against the primitive*, which would have inverted a correct ordering and left the
|
|
761
|
-
actual defect, one keyword, shipped in all four carriers. The fifth firing's own
|
|
762
|
-
lesson generalizes past this rule: an operative restatement propagates a rule's
|
|
763
|
-
**wording**, so a defect in the wording is propagated with it, and N carriers make
|
|
764
|
-
N copies of the bug rather than N chances to catch it.
|
|
765
|
-
|
|
766
|
-
**No gate is owed *over the act*, and not for budget — but one is now owed over
|
|
767
|
-
its harm, and it exists.** No check can read a session's choice to end a turn:
|
|
768
|
-
the act leaves no tracked artifact, and no `PreToolUse` chokepoint sees it. The
|
|
769
|
-
harness's own turn-end event does see it — measured, not assumed (§The turn-end
|
|
770
|
-
liveness probe (template)) — and seeing is not refusing: reading the act there
|
|
771
|
-
would take a blocking hook, which is a separate authorization and is not held. So
|
|
772
|
-
the relocation below is the enforcement, and it is that on the merits rather than
|
|
773
|
-
for want of an alternative. What the ruling never licensed was stopping there. The harm
|
|
774
|
-
the turn-end causes does pass a chokepoint — a tracked-tree mutation while a
|
|
775
|
-
recorded producer is still writing arrives as an ordinary tool call — and it is
|
|
776
|
-
blocked there by guard-kit rule 14 (guard-kit/SPEC.md §The generic ruleset,
|
|
777
|
-
whose design §The delegation model owns). So the enforcement question this
|
|
778
|
-
section left open is answered **by relocating the subject from the act to its
|
|
779
|
-
consequence**, and the honest bound travels with the answer: it reaches only a
|
|
780
|
-
session that recorded, since the record's write is itself structurally
|
|
781
|
-
uncheckable.
|
|
782
|
-
|
|
783
|
-
**The anti-restatement gates were**
|
|
784
|
-
checked against a sanctioned restatement rather than assumed inert, since a
|
|
785
|
-
sanction that required weakening a gate would be the wrong sanction:
|
|
786
|
-
`check-shim-restatement` scans binding shims under the skills directory against a
|
|
787
|
-
corpus of the consumer's always-loaded file plus kit templates, so a consumer's
|
|
788
|
-
agent definition is neither its scanned surface nor its corpus, and
|
|
789
|
-
`check-surface-duplication`'s predicate is a glossary term's definition on a
|
|
790
|
-
canonical SPEC surface, which reaches no agent definition either. The sanction
|
|
791
|
-
therefore ships with **no gate exemption** — and the honest converse ships with
|
|
792
|
-
it: nothing in the battery would catch a *non*-compliant restatement, so (a)–(c)
|
|
793
|
-
are review-enforced. Both buildable oracles detect a *consequence* rather than
|
|
794
|
-
the act, and they sit at different distances from it: guard-kit rule 14
|
|
795
|
-
**prevents** the consequence at the tool call that would cause it, and
|
|
796
|
-
`check-producer-liveness` **detects** a producer still running at the next
|
|
797
|
-
stage's entry (evidence-kit/SPEC.md §check-producer-liveness). The second
|
|
798
|
-
detects late by construction — the turns between the firing and that entry are
|
|
799
|
-
already spent, and a firing at the last stage of an iteration has no entry after
|
|
800
|
-
it — which is what makes it the backstop behind the first rather than a
|
|
801
|
-
substitute for it.
|
|
802
|
-
|
|
803
|
-
**A case where an oracle *was* buildable now sits beside this one, and the two
|
|
804
|
-
are not each other's contradiction.** The dispatch-shape rules bind acts
|
|
805
|
-
that leave no tracked artifact either, yet they are gated. The axis that
|
|
806
|
-
separates them is **interception, not durability**: a dispatch passes a
|
|
807
|
-
chokepoint the harness fires a hook on, and a turn-end passes none the
|
|
808
|
-
dispatch-shape rules could have used (§The delegation model, which owns the
|
|
809
|
-
generalization, and §The turn-end liveness probe (template), which measured the
|
|
810
|
-
harness's own turn-end event and found it reachable). So "no tracked artifact" is
|
|
811
|
-
why neither rule gets a *gate* over the tree, and it is not by itself a reason
|
|
812
|
-
to stop looking for an oracle. Recorded here for the same reason §The
|
|
813
|
-
delegation model records the durability rule beside the read-only-fan-out
|
|
814
|
-
caveat: otherwise the next reader re-litigates one of the two paragraphs.
|
|
815
|
-
|
|
816
|
-
**That last sentence was cashed rather than left standing.** The search it
|
|
817
|
-
licensed found one: the turn-end is unreachable from the tool-call axis, but the
|
|
818
|
-
mutation it enables is a `PreToolUse` call, and rule 14 fires there. It then
|
|
819
|
-
found a second candidate on a different axis — the harness's own `SubagentStop`
|
|
820
|
-
event, which the probe above measured and found live. It is an oracle that
|
|
821
|
-
*observes* rather than one that refuses, and turning it into the second kind is a
|
|
822
|
-
separate authorization. Recorded because a
|
|
823
|
-
sentence saying *keep looking* is cheap to write and easy to leave un-acted, and
|
|
824
|
-
the next reader should find the outcome beside the licence rather than have to
|
|
825
|
-
reconstruct whether anyone ever looked.
|
|
826
|
-
|
|
827
|
-
## The turn-end liveness probe (template)
|
|
828
|
-
|
|
829
|
-
`templates/subagent-stop-liveness.sh` is an opt-in `SubagentStop` hook, inert
|
|
830
|
-
until a consumer registers it, that answers one question the section above
|
|
831
|
-
leaves open: **does the harness already defer a subagent's stop while a
|
|
832
|
-
background child is live?** If it does, the whole class §The delegation model's
|
|
833
|
-
waiting rule exists for dissolves; if it does not, the axis holds at the turn-end
|
|
834
|
-
too and a blocking hook is the only lever left. It is a **probe with a durable
|
|
835
|
-
artifact, not an enforcement mechanism** — its deliverable is an answer, and *a
|
|
836
|
-
capped refusal buys nothing* is one of the answers it is entitled to return.
|
|
837
|
-
|
|
838
|
-
**The event is `SubagentStop`, never `Stop`.** A dispatched session is a
|
|
839
|
-
subagent, so its turn end fires `SubagentStop`, and every attested firing of the
|
|
840
|
-
waiting rule was a dispatched session. `Stop` is deliberately not registered:
|
|
841
|
-
the main-session turn end has no attested firing, so registering it would widen
|
|
842
|
-
the subject past what the evidence carries.
|
|
843
|
-
|
|
844
|
-
**Logging-only, and the variant boundary is part of the contract.** The hook
|
|
845
|
-
reads its payload from stdin, asks the liveness reader whether any launch record
|
|
846
|
-
under `${GATE_SDK_TMP_DIR:-.tmp}` names a live producer, appends one line to
|
|
847
|
-
`DELEGATION_KIT_STOP_LOG`, and **exits 0 unconditionally, emitting no hook JSON
|
|
848
|
-
at all**. A hook that blocks is a **separate authorization** and nothing here
|
|
849
|
-
implies one.
|
|
850
|
-
|
|
851
|
-
**Emitting nothing is the design, and it is what makes this variant buildable.**
|
|
852
|
-
guard-kit's framework hardcodes `hookEventName:"PreToolUse"` in each of its three
|
|
853
|
-
emitters, so a hook that had to *speak* at `SubagentStop` would need a primitive
|
|
854
|
-
guard-kit does not have and whose event scope its SPEC never states. Speaking
|
|
855
|
-
nothing needs no emitter, so this template **does not source guard-kit's lib** —
|
|
856
|
-
which also keeps delegation-kit from acquiring a dependency on guard-kit being
|
|
857
|
-
vendored. The two payload fields it does read cost a `cat` and a `jq -r`; the
|
|
858
|
-
blocking variant's emitter cost is stacked on its own authorization rather than
|
|
859
|
-
paid here.
|
|
860
|
-
|
|
861
|
-
**It never wedges a turn.** Every failure path — an unreadable payload, an absent
|
|
862
|
-
`jq`, an absent or hung liveness reader, an unwritable log — exits 0, recording
|
|
863
|
-
the failure in the line where the line can be written and silently where it
|
|
864
|
-
cannot. The reader is invoked under `timeout` where one is available, because a
|
|
865
|
-
reader that hung would refuse the turn end by accident and that is the blocking
|
|
866
|
-
variant arrived at sideways.
|
|
867
|
-
|
|
868
|
-
**The liveness reading reuses `check-producer-liveness` and copies no grammar.**
|
|
869
|
-
§The delegation model rules that the reading affordance which would genuinely
|
|
870
|
-
earn its place already exists and is that gate; a hook re-implementing the
|
|
871
|
-
`pid=<n> run=<key>` parse and the PID predicate would be a third copy of a
|
|
872
|
-
grammar evidence-kit owns. So the hook invokes the reader in **set mode** over
|
|
873
|
-
the scratch dir — which already quantifies the per-record verdict and already
|
|
874
|
-
resolves *exit 2 wins over red wins over green* (evidence-kit/SPEC.md
|
|
875
|
-
§check-producer-liveness) — and maps its exit class onto `verdict` and `live`.
|
|
876
|
-
Nothing about how a PID's liveness is decided is seconded here.
|
|
877
|
-
|
|
878
|
-
**The prerequisite is stated, not assumed.** A consumer that wires this hook with
|
|
879
|
-
no reader resolvable at `DELEGATION_KIT_LIVENESS_CMD` — evidence-kit unvendored,
|
|
880
|
-
or the knob deliberately emptied — gets `verdict=unavailable` on every line and a
|
|
881
|
-
probe that answers nothing. That is honest degradation and it is preferable to a
|
|
882
|
-
silent third parse that would work everywhere and drift from its owner.
|
|
883
|
-
|
|
884
|
-
**One line per firing**, appended, space-delimited `key=value` after a leading
|
|
885
|
-
timestamp:
|
|
886
|
-
|
|
887
|
-
```
|
|
888
|
-
<UTC ISO-8601> event=<hook_event_name|-> session=<session_id|-> live=<yes|no> verdict=<green|red|corrupt|unavailable> records=<n> keys=<comma-separated top-level payload keys>
|
|
889
|
-
```
|
|
890
|
-
|
|
891
|
-
Every field has a reader at a named transition, and no field is carried that this
|
|
892
|
-
list does not name one for:
|
|
893
|
-
|
|
894
|
-
- **timestamp** — read by the close-stage reader to order firings and to tell a
|
|
895
|
-
fresh line from a stale one.
|
|
896
|
-
- **`event`** — the payload's own `hook_event_name`. Read at the **first** firing,
|
|
897
|
-
to confirm the event fires at all for a dispatched session and that it is
|
|
898
|
-
spelled `SubagentStop`. The entry's whole correction turned on the event's
|
|
899
|
-
identity, which is what earns it a field.
|
|
900
|
-
- **`session`** — the payload's `session_id`, `-` otherwise. Read to separate the
|
|
901
|
-
firings of one top-level session from another's in a shared log. **It is not the
|
|
902
|
-
subagent's own id**, and the first firings settled that against the field's
|
|
903
|
-
original reader: a dispatched agent and its dispatcher log the *same*
|
|
904
|
-
`session_id`, and neither matches the identifier a stage stamp carries, so
|
|
905
|
-
attributing a firing to a stage session is not a reading this field supports.
|
|
906
|
-
The payload's `agent_id` is the discriminator that would, and logging it is a
|
|
907
|
-
grammar change this variant did not take.
|
|
908
|
-
- **`live`** — `yes` exactly when the reader reported a live producer. **The
|
|
909
|
-
decisive field**; the honest limit below is what bounds how it may be read.
|
|
910
|
-
- **`verdict`**, **`records`** — the reader's exit class and the number of `*.run`
|
|
911
|
-
records under the scratch dir. Read together: `records=0` makes a `live=no`
|
|
912
|
-
uninformative, while `records=2 live=no` says records existed and their
|
|
913
|
-
producers had exited. `verdict=corrupt` carries `live=no` because the field is
|
|
914
|
-
two-valued — the pair is the reading, never `live` alone.
|
|
915
|
-
- **`keys`** — the payload's top-level key set, nothing more. Read **once**, at
|
|
916
|
-
the first firing, to settle what a `SubagentStop` payload carries without
|
|
917
|
-
asserting anything about it in advance. **It returned against the advance
|
|
918
|
-
claim**, which is the whole reason the field logs the set rather than assuming
|
|
919
|
-
it: the payload carries a top-level `background_tasks`, so the pre-wiring premise
|
|
920
|
-
that it names no background task was wrong, and only the key read caught it.
|
|
921
|
-
Values stay unlogged on the ground that survives that correction — logging them
|
|
922
|
-
would put transcript paths and prompt ids into a file for no reader — so what
|
|
923
|
-
`background_tasks` actually carries is **unsettled**, and reading it is a change
|
|
924
|
-
to this privacy ruling rather than a free follow-up. The question is filed as
|
|
925
|
-
`subagent-stop-payload-background-tasks-read`.
|
|
926
|
-
|
|
927
|
-
**`records` is counted by the hook's own `*.run` glob, not parsed back out of the
|
|
928
|
-
reader**, and the reason is the reader's output contract rather than convenience:
|
|
929
|
-
`check-producer-liveness` publishes a count only on its green line, printing one
|
|
930
|
-
finding per blocking record on red and no total. Same directory, same glob, same
|
|
931
|
-
number — and the field stays meaningful when the reader is unavailable, which is
|
|
932
|
-
the case the prerequisite above makes reachable. For the same reason the reader's
|
|
933
|
-
first output line is **not** carried verbatim: over `verdict`, `records` and
|
|
934
|
-
`live` it adds only the blocking record paths, and a free-text field would break
|
|
935
|
-
the space-delimited parse the grammar above is for.
|
|
936
|
-
|
|
937
|
-
**The log is capture-tier** — gitignored, advisory, drained by a named reclaim
|
|
938
|
-
path (gate-sdk/SPEC.md §The workflow directory), which is what keeps
|
|
939
|
-
`check-workflow-tiering` green on a member that is neither tracked nor ignored,
|
|
940
|
-
and it declares itself on the close-surface roster (lifecycle-kit/SPEC.md §The
|
|
941
|
-
close-surface roster) naming its own clear as the reclaim path:
|
|
942
|
-
|
|
943
|
-
close-surface: .workflow/subagent-stop-liveness.log advisory reclaim=: > .workflow/subagent-stop-liveness.log
|
|
944
|
-
|
|
945
|
-
`advisory` rather than `forced`, on the reasoning guard-kit's friction log takes:
|
|
946
|
-
nothing refuses a close that skips it, and a visible skip is the honest mode for a
|
|
947
|
-
probe.
|
|
948
|
-
|
|
949
|
-
**No gate observes the wiring, and that is recorded rather than assumed.**
|
|
950
|
-
`check-settings-pins` asserts only the pinned paths in the consumer's pins file
|
|
951
|
-
(none under `hooks`), `check-settings-paths`'s subject is `permissions.allow[]`
|
|
952
|
-
alone and never `hooks[].hooks[].command`, and `check-memory-off` scans the memory
|
|
953
|
-
surface. So the registration reds nothing — and neither would a registration
|
|
954
|
-
naming a script that does not exist. A session decides this wiring by reading this
|
|
955
|
-
section, never by predicting a verdict.
|
|
956
|
-
|
|
957
|
-
### The probe is asymmetric, and no reading may treat it otherwise
|
|
958
|
-
|
|
959
|
-
**A `live=yes` line proves the harness does not defer the stop.** One firing with
|
|
960
|
-
a live producer settles the unknown in that direction and the class stands.
|
|
961
|
-
|
|
962
|
-
**No accumulation of `live=no` lines proves that it does.** `live=no` is equally
|
|
963
|
-
consistent with *the harness deferred the stop*, *the session waited correctly*,
|
|
964
|
-
and *the session recorded nothing* — the last being the residue guard-kit rule 15
|
|
965
|
-
advises against and does not close. Passive accumulation therefore cannot return
|
|
966
|
-
the finding that would dissolve the class, and anyone waiting for it waits forever
|
|
967
|
-
and then reports the wrong thing.
|
|
968
|
-
|
|
969
|
-
**So the reading is bought by a deliberate firing, never by a wait.** A dispatched
|
|
970
|
-
session backgrounds a producer that runs long, writes its `<key>.run` record, and
|
|
971
|
-
then ends its turn. Both outcomes are results: the hook fires immediately with
|
|
972
|
-
`live=yes`, so the harness does not defer and §Operative residency's axis holds at
|
|
973
|
-
the turn-end too; or the hook does not fire until the child exits, so the harness
|
|
974
|
-
does defer, the class dissolves, and this template's remaining value is the
|
|
975
|
-
evidence for retiring it. The log is what makes that firing, and every later
|
|
976
|
-
accidental one, legible.
|
|
977
|
-
|
|
978
|
-
**The firing was bought, and it returned the first branch.** A dispatched agent
|
|
979
|
-
backgrounded a producer with a recorded PID and ended its turn without waiting;
|
|
980
|
-
the log took `live=yes verdict=red records=1` four seconds later, and again at
|
|
981
|
-
that agent's own stop, while the producer went on writing for another two and a
|
|
982
|
-
half minutes. **The harness does not defer the stop**, so the class the waiting
|
|
983
|
-
rule exists for does not dissolve, the relocation to guard-kit rule 14 stands, and
|
|
984
|
-
a blocking hook is the only lever left — which is a second authorization this
|
|
985
|
-
result does not grant.
|
|
986
|
-
|
|
987
|
-
**The same firings settled a second thing nothing could have settled before
|
|
988
|
-
wiring: `SubagentStop` is not the session-end event.** It fired seventeen times
|
|
989
|
-
inside one dispatched session that had ended no turn at all, spaced by assistant
|
|
990
|
-
steps rather than by the clock — a stretch spanning three long tool calls and no
|
|
991
|
-
assistant step produced no firing at all. A blocking variant would therefore
|
|
992
|
-
refuse at *every* intermediate step of a session rather than once at its return,
|
|
993
|
-
which is what a bounded run of blocks would actually be spent on. Recorded here
|
|
994
|
-
because it is a cost the blocking variant's authorization should be weighed
|
|
995
|
-
against, and because it is exactly the class of fact a logging-only probe exists
|
|
996
|
-
to buy.
|
|
997
|
-
|
|
998
|
-
## Resume journal — agent writes, scratch reset sweeps
|
|
999
|
-
|
|
1000
|
-
**The contract, in four clauses.** A mutating agent journals to a repo-local
|
|
1001
|
-
gitignored scratch directory in the main checkout; the supervisor grants that
|
|
1002
|
-
path **absolute** in the dispatch prompt; each finding lands inline as it is
|
|
1003
|
-
confirmed; a `DONE` marker is appended on success. The operative text — what
|
|
1004
|
-
each clause requires of an agent, and why a temporary worktree and a system
|
|
1005
|
-
temp dir both fail the survivability test — is
|
|
1006
|
-
`templates/agent-execution.md`'s **Resume journal — agent writes, scratch reset
|
|
1007
|
-
sweeps** bullet, which is the surface an agent loads. This section owns what
|
|
1008
|
-
that bullet cannot carry: the lifetime rule's reasoning, the attestation it was
|
|
1009
|
-
priced against, and the two readings the marker carries.
|
|
1010
|
-
|
|
1011
|
-
**Lifetime — why retention rather than an eager deletion chore.** Cleanup is
|
|
1012
|
-
the consumer's own scratch reset at its next work-unit boundary, a mechanism
|
|
1013
|
-
the consumer already owns (here, `enter-stage.sh`'s boundary wipe of `.tmp/` at
|
|
1014
|
-
the next scope entry — lifecycle-kit/SPEC.md §bin/enter-stage.sh). Two things
|
|
1015
|
-
break when the supervisor deletes on its own schedule instead, and both appear
|
|
1016
|
-
only once a dispatched agent is **resumable** rather than one-shot: a resumed
|
|
1017
|
-
agent is still writing to the file, and a supervisor treating the journal as
|
|
1018
|
-
its **pull channel** (lifecycle-kit/templates/lead.md §Channel design)
|
|
1019
|
-
destroys at the first verified commit the channel it is supposed to keep
|
|
1020
|
-
reading. A one-shot sweep hides both, which is why an eager deletion chore
|
|
1021
|
-
read as correct for as long as it did.
|
|
1022
|
-
|
|
1023
|
-
**Attested.** A supervisor deleted a resumable session's journal after
|
|
1024
|
-
validating that session's first commits; the session resumed minutes later,
|
|
1025
|
-
found the file gone mid-write, rebuilt it from context, and reported the
|
|
1026
|
-
disappearance as a suspected scratch-directory reliability defect. The lost
|
|
1027
|
-
working state was the cheaper half — the false defect signal, raised against
|
|
1028
|
-
the scratch dir and against an unrelated sibling unit, is what retention is
|
|
1029
|
-
priced against. The same supervisor then retained two later sessions'
|
|
1030
|
-
journals against the then-governed text; that deviation is what this section
|
|
1031
|
-
now states.
|
|
1032
|
-
|
|
1033
|
-
**Reading `DONE` under retention.** Retention costs the *presence* of a
|
|
1034
|
-
journal its meaning: every journal now survives its session, so finding one
|
|
1035
|
-
signals nothing by itself. The marker still carries the completion claim, with
|
|
1036
|
-
one sharpening a resumable session forces — `DONE` is meaningful **only as the
|
|
1037
|
-
file's last line**, since a session resumed past its own marker appends after
|
|
1038
|
-
it, and a mid-file `DONE` claims a completion the later content contradicts.
|
|
1039
|
-
Whether a *missing* marker signals interruption still turns on whether the
|
|
1040
|
-
supervisor consumed the agent's return. On the ordinary completion path it
|
|
1041
|
-
did, and that return plus its post-commit verification (§Verify after every
|
|
1042
|
-
agent commit) *is* the recovery contract, so the marker is redundant there.
|
|
1043
|
-
Only in a **cold read** — a journal found with no return ever consumed, the
|
|
1044
|
-
agent's session having died before returning (a background sandbox died, a
|
|
1045
|
-
crash, a timeout) — is the marker the sole signal, and there the original
|
|
1046
|
-
reading holds: no `DONE` = interrupted, resume from it. A live journal is told
|
|
1047
|
-
from a spent one by per-session journal naming, the consumer's own work
|
|
1048
|
-
cursor, and `git log`, which together say more than presence ever did, and the
|
|
1049
|
-
boundary sweep bounds the ambiguity to the current work unit. The
|
|
1050
|
-
inline-findings rule above is that cold arm's insurance — with no surviving
|
|
1051
|
-
return, a pointer-only journal would make a would-be `DONE` lie about
|
|
1052
|
-
recoverability.
|
|
1053
|
-
|
|
1054
|
-
**Caveat — the sandbox may block the journal write.** Background agents
|
|
1055
|
-
have been observed unable to `Write` to the granted path, silently falling
|
|
1056
|
-
back to returning findings in the final message — which defeats the journal
|
|
1057
|
-
exactly when it matters (a long, interruptible run). The template's
|
|
1058
|
-
read-only-fan-out carve-out and its grant-the-path-explicitly clause both
|
|
1059
|
-
follow from this observation. That contract has two ends. The caveat's
|
|
1060
|
-
evidence is about **the child's** write failing silently, and its true
|
|
1061
|
-
content is *do not make recoverability depend on a backgrounded child's
|
|
1062
|
-
write* — which is why it is kept rather than overturned by the template's
|
|
1063
|
-
**Findings you will act on are durable before you act on them** rule. That
|
|
1064
|
-
rule's duty falls on **the parent**, which has already demonstrated it can
|
|
1065
|
-
write, being the session that granted the path. The two are disjoint
|
|
1066
|
-
readings of one contract, not each other's contradiction.
|
|
1067
|
-
|
|
1068
|
-
**Journalling is a discharge path, not a dispatched session's privilege.** The
|
|
1069
|
-
template's durability rule turns on **capability, never role** — a session
|
|
1070
|
-
journals when it cannot commit and commits when it can — and this section owns
|
|
1071
|
-
why the earlier role-keyed reading failed. That reading granted the journal to a
|
|
1072
|
-
dispatched session and denied it to a top-level one, on the premise that a
|
|
1073
|
-
top-level session is by construction able to commit. The premise is false
|
|
1074
|
-
whenever another session holds the shared index, which is the *normal* condition
|
|
1075
|
-
while a work unit is in flight rather than an edge case: the supervising role
|
|
1076
|
-
improvised scratch notes on three separate occasions in one iteration, each time
|
|
1077
|
-
because a live dispatched session held the index. Improvised scratch is the
|
|
1078
|
-
journal mechanism with none of its contract — no granted path inside the sweep's
|
|
1079
|
-
reach, no inline landing, no marker — so the failure was silent and the
|
|
1080
|
-
reconstruction cost was paid per occurrence. Widening by capability rather than
|
|
1081
|
-
carving out a second surface per role is what keeps the reclaim story unchanged:
|
|
1082
|
-
every discharge path still lands in the same scratch directory the consumer's
|
|
1083
|
-
own work-unit boundary already sweeps, so no new lifetime, keep-list entry, or
|
|
1084
|
-
inbound-triage surface is created by the widening.
|
|
1085
|
-
|
|
1086
|
-
## Verify after every agent commit
|
|
1087
|
-
|
|
1088
|
-
Re-run the relevant gates plus the consumer's validate battery (for this
|
|
1089
|
-
repo and any gate-sdk consumer: `bash gate-sdk/bin/run-gates.sh` and the
|
|
1090
|
-
kit fixture runners; a toolchain consumer adds its compile/lint/test set in
|
|
1091
|
-
the template's marked section, including a zero-byte-file sweep after
|
|
1092
|
-
renames — silent edit corruption is real). **Diff every gate change in an
|
|
1093
|
-
agent commit before accepting**: an agent blocked by a gate will weaken it
|
|
1094
|
-
(a false exemption) rather than fix the code — "the gate is in my way"
|
|
1095
|
-
almost always means the code doesn't fit the convention.
|
|
1096
|
-
|
|
1097
|
-
**The act is `verify`; the artifact stays the `validate battery`.** The
|
|
1098
|
-
discipline is an act a supervisor performs; the battery is the command set
|
|
1099
|
-
that act runs. One word for both made *completing the act* read as completing
|
|
1100
|
-
whatever else the consumer names with that word — attested where a consumer's
|
|
1101
|
-
stage roster carries it, and the near-miss was a skipped stage. Renaming the
|
|
1102
|
-
act rather than the artifact is the cheap side: the battery is a binding-slot
|
|
1103
|
-
name every consumer's shim carries (§One template, a resident pointer, read by
|
|
1104
|
-
`check-skill-binding`), while the act is named only in prose. The result reads
|
|
1105
|
-
coherently — *you verify an agent's commit by re-running the relevant gates and
|
|
1106
|
-
the consumer's validate battery* — and the act and the artifact having
|
|
1107
|
-
different names is the distinction that was missing.
|
|
1108
|
-
|
|
1109
|
-
**A verify step never runs the producer of what it is verifying.** Re-running
|
|
1110
|
-
is safe and idempotent exactly when the dispatched unit's output is *work* and
|
|
1111
|
-
the check's output is *a verdict about that work*; it stops being safe the
|
|
1112
|
-
moment those coincide. Where a unit's deliverable **is** an evidence artifact,
|
|
1113
|
-
the verify is a **read of the committed artifact**, never a re-execution of
|
|
1114
|
-
what wrote it: re-running the producer mutates or duplicates the very record
|
|
1115
|
-
the check exists to confirm.
|
|
1116
|
-
|
|
1117
|
-
**The two wrong re-runs are not equally harmful, and a supervisor needs the
|
|
1118
|
-
split.** A check that writes nothing the artifact depends on is *inert* on it —
|
|
1119
|
-
misrouted and wasted work, with nothing lost. Re-running the artifact's **sole
|
|
1120
|
-
writer** is *destructive*. The routing defect is the same in both; only the
|
|
1121
|
-
second leaves evidence to restore, and the supervisor that has already run the
|
|
1122
|
-
wrong one reads this split to learn which one it is holding. Collapsing them
|
|
1123
|
-
would either overstate the harm of a wasteful re-run or understate the harm of
|
|
1124
|
-
the destructive one.
|
|
1125
|
-
|
|
1126
|
-
**Honest limit — this rule installs no oracle**, and recurrence is what
|
|
1127
|
-
establishes it matters rather than a projection: the misrouting fired in two
|
|
1128
|
-
consecutive iterations and an operator caught it both times. The check class
|
|
1129
|
-
that would catch it is a gate over a *supervisor's choice of command*, and no
|
|
1130
|
-
scanner is buildable — the choice leaves no tracked artifact to read, the same
|
|
1131
|
-
structural reason §Operative residency owes no gate. A consumer whose evidence
|
|
1132
|
-
producer claims a liveness lock has a partial artifact-side proxy; its coverage
|
|
1133
|
-
boundary is that consumer's own mechanism to state, not this section's. So
|
|
1134
|
-
detection stays human, and it is stated here rather than left implicit because
|
|
1135
|
-
an unstated limit reads as an oversight for a later session to close with a
|
|
1136
|
-
gate that cannot exist.
|
|
1137
|
-
|
|
1138
|
-
`check-gate-tamper` is the mechanical floor under the diff-every-gate-change
|
|
1139
|
-
duty. Two assertions, blocking the two attested tamper shapes:
|
|
1140
|
-
|
|
1141
|
-
- **A — gate-edit isolation.** A commit that touches a gate file (the
|
|
1142
|
-
`DELEGATION_KIT_GATE_FILES` globs) may touch only meta-layer paths
|
|
1143
|
-
(`DELEGATION_KIT_META_PATHS` prefixes + root `*.md`); co-staging product
|
|
1144
|
-
code with a gate edit is blocked. Split the gate change into its own
|
|
1145
|
-
commit.
|
|
1146
|
-
- **B — no self-serving exemption.** A newly added path/glob entry in any
|
|
1147
|
-
gate's `# exception-list:` array must not match a file staged in the same
|
|
1148
|
-
commit — an exemption never excuses the very change it lands with.
|
|
1149
|
-
|
|
1150
|
-
**Honest limit:** the gate blocks by commit *shape*; it does not catch
|
|
1151
|
-
semantic weakening inside a legitimate scripts-only commit — the by-eye
|
|
1152
|
-
diff review of agent gate edits remains a supervisor duty. `--fixture <dir>`
|
|
1153
|
-
injects `staged-files` / `added-exemptions` lists (fixture-pair test
|
|
1154
|
-
capability); live mode reads `git diff --cached`.
|
|
1155
|
-
|
|
1156
|
-
`checks/check-gate-tamper.gate` (`precommit`, binary-dispatched). `--fixture`
|
|
1157
|
-
**survives the port**: it selects the rule's own input corpus, which no knob
|
|
1158
|
-
resolves, so it is not the arrives-too-late shape gate-sdk/SPEC.md §The non-gate
|
|
1159
|
-
arm deletes — the invocation delegation-kit/README.md documents stays true.
|
|
1160
|
-
|
|
1161
|
-
**Criterion 4 binds on this gate as a property of the *consumer's* configured
|
|
1162
|
-
globs, not of the gate.** Under the kit-shipped `DELEGATION_KIT_GATE_FILES`
|
|
1163
|
-
default the corpus is the consumer's own gates directory, which holds no kit
|
|
1164
|
-
declaration, and the criterion clears. Under a config widening the globs to
|
|
1165
|
-
every kit's check dir — this repo's — the gate's own declaration falls inside
|
|
1166
|
-
them, and staging it makes the gate read its own bytes. Reading the kit default,
|
|
1167
|
-
which is the natural first stop, therefore gives the wrong answer for the tree
|
|
1168
|
-
the port actually runs against; gate-sdk/SPEC.md §The port-candidate criteria
|
|
1169
|
-
carries the instance class.
|
|
1170
|
-
|
|
1171
|
-
**Two behaviours changed with the port, and both are rulings rather than
|
|
1172
|
-
drift.** Assertion B's report lines came out of the shell form in no
|
|
1173
|
-
reproducible order once a commit added two matching exemptions; the
|
|
1174
|
-
compiled form emits the same **set** byte-sorted, on the kit-roots cohort's
|
|
1175
|
-
ruling that a compiled form implements set semantics rather than a shell's
|
|
1176
|
-
incidental ordering. And a trailing `--fixture` with no directory after it
|
|
1177
|
-
**hung** the shell form in its argument-parsing loop; the compiled form reads the
|
|
1178
|
-
missing value as the empty directory name and refuses. A hang is not a verdict, so ending it costs no assertion.
|
|
1179
|
-
|
|
1180
|
-
## check-agent-tier-explicit
|
|
1181
|
-
|
|
1182
|
-
Every agent definition under `DELEGATION_KIT_AGENT_DIR` declares a `model:`
|
|
1183
|
-
field in its frontmatter. This is the oracle over the tracked half of the
|
|
1184
|
-
template's **Match the dispatched model and effort to the unit's shape** rule:
|
|
1185
|
-
the per-dispatch habit leaves no artifact, but a standing choice does, and the
|
|
1186
|
-
gate reads it.
|
|
1187
|
-
|
|
1188
|
-
**It polices silence, not the choice.** An explicit `inherit`-valued `model:`
|
|
1189
|
-
**passes** — a dispatched session that should ride its dispatcher's tier is a
|
|
1190
|
-
legitimate answer and the gate has no business overruling it. What reds is
|
|
1191
|
-
*omission*, the one state indistinguishable from not having thought about it,
|
|
1192
|
-
and the one state that is not the neutral absence it looks like — the refused
|
|
1193
|
-
environment override and the precedence chain behind that reading are in
|
|
1194
|
-
§The delegation model. A reader arriving at this gate expecting it to enforce
|
|
1195
|
-
cheapness has the wrong model of it.
|
|
1196
|
-
|
|
1197
|
-
**Counted inertness.** A consumer with no such directory — or one holding no
|
|
1198
|
-
definitions — scans zero and reports a clean counted line, the derived-scan-set
|
|
1199
|
-
shape the kit's other gates use. There is no roster and no registration list to
|
|
1200
|
-
maintain: the scan set is the directory's contents.
|
|
1201
|
-
|
|
1202
|
-
**Honest limit.** It holds the tracked surface only. A dispatch naming no agent
|
|
1203
|
-
type and no `model` parameter inherits and leaves no artifact for any gate to
|
|
1204
|
-
read, so the gate converts the standing-choice class from unenforceable to
|
|
1205
|
-
enforced and leaves the per-dispatch class to the rule's prose. That is
|
|
1206
|
-
strictly better than nothing and not a claim to have closed the tier question
|
|
1207
|
-
mechanically.
|
|
1208
|
-
|
|
1209
|
-
## usage-verdict
|
|
1210
|
-
|
|
1211
|
-
Emits a trustworthy budget verdict from a usage snapshot file, closing the
|
|
1212
|
-
three failure modes a raw percentage reading leaves open:
|
|
1213
|
-
|
|
1214
|
-
1. **Stale reading** — `now - updated_at` beyond `DELEGATION_KIT_STALE_AGE` → STALE
|
|
1215
|
-
(exit 2): budget-unknown, never blocking delegation — re-read or refresh
|
|
1216
|
-
before trusting the number.
|
|
1217
|
-
2. **Dead window** — `resets_at <= now` → RESET-OK (exit 0): the percentage
|
|
1218
|
-
is from the dead window and must not be read as a pause signal. The
|
|
1219
|
-
weekly axis carries the same rule per-axis (`seven_day_resets_at <= now`
|
|
1220
|
-
disarms the weekly pause without forcing the whole verdict to RESET-OK —
|
|
1221
|
-
the axes are judged independently).
|
|
1222
|
-
3. **Post-login lag** — a fresh login starts a new window but the
|
|
1223
|
-
server-fed percentage lags it, and the file-write age check cannot see
|
|
1224
|
-
that. The gate reads the auth event from the credentials file's mtime
|
|
1225
|
-
(`DELEGATION_KIT_LOGIN_WINDOW`) and, within that window, routes a
|
|
1226
|
-
would-be OK to STALE (re-read). Letting the lag print OK would emit a
|
|
1227
|
-
fresh-looking chimera, since the producer stamps the new account id while
|
|
1228
|
-
the percentage and `resets_at` still carry the dead login's window.
|
|
1229
|
-
Self-limiting: once the mtime ages out, the reroute stops firing.
|
|
1230
|
-
|
|
1231
|
-
**The reroute is asymmetric — it may suppress an OK, never a PAUSE.** It
|
|
1232
|
-
therefore follows the axis compares rather than preceding them. The two
|
|
1233
|
-
directions of a lagging reading have opposite costs: a lagging *low*
|
|
1234
|
-
percentage printing OK invites a dispatch the budget may not afford, which
|
|
1235
|
-
is what the reroute exists to prevent; a lagging *high* percentage
|
|
1236
|
-
suppressed into STALE waves that dispatch through, because STALE is
|
|
1237
|
-
advisory and never blocks (§usage-verdict). An unconditional
|
|
1238
|
-
reroute closes the first and opens the second, so it must fire on the
|
|
1239
|
-
non-blocking outcome only: inside the window an at-or-over reading still
|
|
1240
|
-
exits 1 on whichever axis fired, and an under-threshold one still exits 2.
|
|
1241
|
-
An account switch swaps both windows, so neither axis escapes the
|
|
1242
|
-
suppression when the outcome is a would-be OK.
|
|
1243
|
-
|
|
1244
|
-
**The mtime is a proxy, and the roll witnesses refute it.** A credentials
|
|
1245
|
-
file's mtime cannot distinguish an actual login from a routine OAuth token
|
|
1246
|
-
rotation, which rewrites the same file — so every rotation mints a fake
|
|
1247
|
-
auth event and blinds the verdict for the window's duration, and rotations
|
|
1248
|
-
cluster around long-session resume, exactly when a verdict is being asked
|
|
1249
|
-
for. The reroute's *premise* is that a low percentage inside the window is
|
|
1250
|
-
a **lagging** reading; when the five-hour window has demonstrably rolled,
|
|
1251
|
-
a low percentage is the **expected** reading and the premise is false. Two
|
|
1252
|
-
witnesses of a roll are already in hand at that point, and the verdict
|
|
1253
|
-
consults both — conjunctively, since either alone is ambiguous:
|
|
1254
|
-
|
|
1255
|
-
- the snapshot's `five_hour_resets_at` differs from the newest
|
|
1256
|
-
`DELEGATION_KIT_USAGE_HISTORY` sample's `resets_at` (the boundary moved);
|
|
1257
|
-
- the snapshot's `updated_at` is past that **previous** boundary (time
|
|
1258
|
-
actually crossed it, rather than the boundary being restamped by an
|
|
1259
|
-
account switch).
|
|
1260
|
-
|
|
1261
|
-
Both firing disarms the reroute and the reading verdicts on its own merits.
|
|
1262
|
-
This makes the verdict path a **reader** of the trend log it already
|
|
1263
|
-
appends to; the read is taken before this run's own append, so the witness
|
|
1264
|
-
is the previous reading and never this one. It falls open to the
|
|
1265
|
-
unrefuted reroute whenever the log cannot answer — knob unset, file absent
|
|
1266
|
-
or unreadable, or a tail carrying no numeric `resets_at` — which is the
|
|
1267
|
-
pre-existing behavior, so an unconfigured consumer is unchanged. The
|
|
1268
|
-
residual limit is honest and named: a rotation with **no** roll still
|
|
1269
|
-
blinds the window, because no witness in hand contradicts it; closing that
|
|
1270
|
-
needs an account-keyed check against the credential's own identity, not a
|
|
1271
|
-
sharper time window.
|
|
1272
|
-
|
|
1273
|
-
Check order: parse → RESET-OK → age-STALE → pause axes → login-STALE → OK. The
|
|
1274
|
-
RESET-OK branch is the same decision one step earlier and is ordering
|
|
1275
|
-
precedent for the witnesses: the file already accepts that a demonstrated roll
|
|
1276
|
-
outranks the reroute. It covers only a snapshot from an already-dead window;
|
|
1277
|
-
the witnesses cover a window that rolled *between* samples, where the
|
|
1278
|
-
re-polled snapshot carries a live `resets_at`.
|
|
1279
|
-
|
|
1280
|
-
Exit codes: **0** OK / RESET-OK, **1** PAUSE, **2** STALE or unreadable. Exit
|
|
1281
|
-
2 is fail-closed on *trusting the number* and deliberately fail-open on
|
|
1282
|
-
*refusing work* — budget-unknown never blocks delegation — so it is never the
|
|
1283
|
-
code a reading that should refuse an expensive dispatch may land on. The bin's
|
|
1284
|
-
`# exit:` header declares that mapping, stating exit 2's consequence rather
|
|
1285
|
-
than labelling it a bare "fail-closed" (which named only the trust axis and
|
|
1286
|
-
read as a claim about the blocking one). That declaration is **machine-read** by
|
|
1287
|
-
`check-assertion-strength` (gate-sdk/SPEC.md), which derives the verdict
|
|
1288
|
-
vocabulary from it rather than carrying a literal — so the header is a surface
|
|
1289
|
-
with a consumer, not loose documentation, and rewording it reshapes what that
|
|
1290
|
-
gate can discriminate.
|
|
1291
|
-
Fail-closed throughout: missing keys and a non-numeric percentage route to
|
|
1292
|
-
STALE; each threshold compare uses `awk`, not integer-only bash
|
|
1293
|
-
arithmetic, so a fractional percentage cannot silently skip PAUSE; and both
|
|
1294
|
-
pause compares are **at-or-over** (`>=`), so a reading exactly at
|
|
1295
|
-
`DELEGATION_KIT_PAUSE_PCT` / `DELEGATION_KIT_PAUSE_PCT_7D` pauses — the
|
|
1296
|
-
boundary reading is judged at the
|
|
1297
|
-
limit, not under it.
|
|
1298
|
-
|
|
1299
|
-
**Demand-driven refresh.** The decision point triggers the poll: when
|
|
1300
|
-
`DELEGATION_KIT_REFRESH_CMD` is non-empty, `usage-verdict` runs it before
|
|
1301
|
-
reading the snapshot, so the budget guard and any verdict caller read live
|
|
1302
|
-
data instead of whatever the last statusline render left behind. This closes
|
|
1303
|
-
the push producer's blind spot at the point of use — a lead that delegates
|
|
1304
|
-
stops rendering exactly when it goes static, and the first live poll proved
|
|
1305
|
-
the gap: the snapshot said 2-5% while the endpoint said 28%. Empty (the
|
|
1306
|
-
default) keeps the read-only behavior, so an unconfigured consumer's push and
|
|
1307
|
-
timer producers are unchanged.
|
|
1308
|
-
|
|
1309
|
-
The refresh is **short-circuited** by `DELEGATION_KIT_REFRESH_MIN_AGE`: the
|
|
1310
|
-
command runs only when the snapshot is missing, unreadable, or its
|
|
1311
|
-
`updated_at` age is at least that value. The statusline calls `usage-verdict`
|
|
1312
|
-
on every render for trend sampling; without the floor a configured refresh
|
|
1313
|
-
would hammer the source on the render path. At dispatch-decision time a
|
|
1314
|
-
stale-enough snapshot still polls.
|
|
1315
|
-
|
|
1316
|
-
It is **fail-soft**: a non-zero refresh exit leaves the snapshot untouched and
|
|
1317
|
-
the verdict proceeds on the cached file — the staleness machinery above judges
|
|
1318
|
-
its trust, turning a dead producer into a STALE verdict rather than a silent
|
|
1319
|
-
green. Refresh diagnostics are suppressed rather than mixed into the verdict
|
|
1320
|
-
output, which callers relay verbatim; the snapshot's age is the signal.
|
|
1321
|
-
`usage.txt` survives as last-known-good cache, source-agnostic seam, and test
|
|
1322
|
-
seam. A refresh inside the `DELEGATION_KIT_LOGIN_WINDOW` rewrites `updated_at` while the
|
|
1323
|
-
server-fed percentage may still lag the login by about a minute — the reroute
|
|
1324
|
-
correctly keeps those readings STALE for the window's duration, save the
|
|
1325
|
-
at-or-over ones it is forbidden to suppress.
|
|
1326
|
-
|
|
1327
|
-
**The verdict-string contract.** Every line `usage-verdict` emits carries three
|
|
1328
|
-
parts: the **reading** (the measured fields), the **epistemic status** of that
|
|
1329
|
-
reading (how far to trust the number), and its **decision consequence** for
|
|
1330
|
-
delegation (what the reading gates). A verdict string stating a status without
|
|
1331
|
-
its consequence is incomplete by contract — the reader completes it by
|
|
1332
|
-
inference, and the inference is unconstrained: a session reading a bare STALE
|
|
1333
|
-
infers "do not trust the number" into "do not dispatch". That read is wrong
|
|
1334
|
-
(STALE never blocks) and is structurally uncorrectable downstream, because the
|
|
1335
|
-
budget guard fires *on* dispatch, the act a hesitating session has not yet
|
|
1336
|
-
performed. STALE's status half is site-specific — each emission site names why
|
|
1337
|
-
it is stale — while its consequence half is uniform, because the consequence is
|
|
1338
|
-
uniform: STALE is budget-unknown at every site and never blocks delegation. The
|
|
1339
|
-
consequence clause appends *after* the `` -> <verdict> `` arrow, leaving it
|
|
1340
|
-
disjoint from the `width=<n>` invariant below.
|
|
1341
|
-
|
|
1342
|
-
**The `width=<n>` field.** Every emitted verdict line — OK, PAUSE, STALE (the
|
|
1343
|
-
fail-closed diagnostics included), RESET-OK — carries a `width=<n>` field
|
|
1344
|
-
immediately before the `` -> <verdict> `` arrow, read from
|
|
1345
|
-
`DELEGATION_KIT_FAN_WIDTH` (§Layout and configuration). It is the knob's
|
|
1346
|
-
mechanical reader: the budget check already runs before every dispatch, so the
|
|
1347
|
-
read-only fan-out bound surfaces at exactly the wave-sizing decision point, and
|
|
1348
|
-
`agent-budget-guard.sh` relays the verdict line verbatim (block on PAUSE, advise
|
|
1349
|
-
otherwise) so the width rides into context with the budget verdict. *Verbatim*
|
|
1350
|
-
governs the verdict line's own text, not the surrounding frame: the guard
|
|
1351
|
-
prefixes the relayed line and the PAUSE arm appends its corrective, but no arm
|
|
1352
|
-
restates the payload's content — there is exactly one advise arm and it adds
|
|
1353
|
-
nothing. The field is
|
|
1354
|
-
a config constant, not derived from the snapshot, so it is present even on an
|
|
1355
|
-
unreadable-snapshot STALE. No exit-code or other-field change: existing callers
|
|
1356
|
-
that key off the exit code or the `-> <verdict>` arrow are unaffected.
|
|
1357
|
-
|
|
1358
|
-
**Two pause axes.** The five-hour window is the always-on axis; the weekly
|
|
1359
|
-
(7-day) window is a second axis, armed only when both `seven_day_used_pct`
|
|
1360
|
-
and `seven_day_resets_at` are present (a three-line snapshot keeps today's
|
|
1361
|
-
behavior — no retroactive contract break). The weekly limit can deplete
|
|
1362
|
-
while the 5h window sits comfortable, and a weekly PAUSE costs days, not
|
|
1363
|
-
hours, so it must gate delegation planning, not merely appear in a log —
|
|
1364
|
-
delegation is the discretionary spend, the first thing to stop near the
|
|
1365
|
-
weekly ceiling so the remaining week stays with the supervisor. The axes
|
|
1366
|
-
are judged independently against `DELEGATION_KIT_PAUSE_PCT` and
|
|
1367
|
-
`DELEGATION_KIT_PAUSE_PCT_7D`; either
|
|
1368
|
-
firing is a PAUSE (exit 1), and the message names the axis that fired
|
|
1369
|
-
(`PAUSE (7-day window)` vs `PAUSE (5h window)`, the weekly named when both
|
|
1370
|
-
fire) because the operator's remediation differs by days. No caller
|
|
1371
|
-
changes: the session-context hook and the per-dispatch Agent budget guard
|
|
1372
|
-
already consume the exit code, so the weekly axis flows into every dispatch
|
|
1373
|
-
decision the moment a producer supplies the keys.
|
|
1374
|
-
|
|
1375
|
-
**Usage-history sampling.** When `DELEGATION_KIT_USAGE_HISTORY` is non-empty,
|
|
1376
|
-
`usage-verdict` appends one sample line (§The usage.txt contract) to that log
|
|
1377
|
-
after every successfully parsed snapshot, whatever the verdict — the raw
|
|
1378
|
-
harness-reported values verbatim; write-time smoothing or correction is
|
|
1379
|
-
forbidden (a later corrective push is evidence about the earlier sample, and
|
|
1380
|
-
only the reader has both). A STALE exit from an unreadable or unparseable
|
|
1381
|
-
snapshot appends nothing — a sample the gate would not trust is not history.
|
|
1382
|
-
`usage-trend` (§Trend reporter) reads the log, and so does `usage-verdict`
|
|
1383
|
-
itself: the newest sample's `resets_at` is one of the two roll witnesses
|
|
1384
|
-
(§usage-verdict). That read is the log's only in-verdict consumer and is
|
|
1385
|
-
strictly fall-open, so the log stays an advisory trend surface rather than
|
|
1386
|
-
becoming a correctness dependency — a consumer with sampling off gets the
|
|
1387
|
-
same verdicts it always did.
|
|
1388
|
-
|
|
1389
|
-
### The usage.txt contract
|
|
1390
|
-
|
|
1391
|
-
The snapshot is the wire contract between any producer and the gate — three
|
|
1392
|
-
`key=value` lines:
|
|
1393
|
-
|
|
1394
|
-
```
|
|
1395
|
-
five_hour_used_pct=<float>
|
|
1396
|
-
five_hour_resets_at=<epoch-seconds>
|
|
1397
|
-
updated_at=<epoch-seconds>
|
|
1398
|
-
```
|
|
1399
|
-
|
|
1400
|
-
Beyond the three mandatory lines a producer may write optional keys when its
|
|
1401
|
-
source exposes them; `usage-verdict` reads the ones it interprets and passes
|
|
1402
|
-
the rest through: `seven_day_used_pct` / `seven_day_resets_at` (the weekly
|
|
1403
|
-
window — read at the verdict transition to arm the second pause axis),
|
|
1404
|
-
`account` (the logged-in account identity — `login_at` detects a switch,
|
|
1405
|
-
`account` says to whom, which lets `usage-trend` group a multi-account
|
|
1406
|
-
operator's segments per account), `tier` (subscription tier — the
|
|
1407
|
-
denominator behind the percentages), and `tokens_in` / `tokens_out`
|
|
1408
|
-
(cumulative token counts, the axis that binds API-billed consumers for whom
|
|
1409
|
-
no subscription percentage applies). Optional keys are omitted when their
|
|
1410
|
-
source has no value, never written empty; keys the verdict does not read
|
|
1411
|
-
pass through unchanged.
|
|
1412
|
-
|
|
1413
|
-
The kit ships two reference producers — one push, one poll — and any producer
|
|
1414
|
-
honoring the contract works beside them. `templates/statusline-usage.sh` is
|
|
1415
|
-
the push producer: a statusline hook
|
|
1416
|
-
that parses the harness's rate-limit JSON and atomically writes the
|
|
1417
|
-
snapshot (`tmp` + `mv`) to `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/usage.txt`.
|
|
1418
|
-
It also produces the weekly pair from the payload and `account` / `tier`
|
|
1419
|
-
from the local account config (`.credentials.json` / `~/.claude.json`,
|
|
1420
|
-
overridable via `DELEGATION_KIT_CRED_FILE` / `DELEGATION_KIT_ACCOUNT_CONFIG`).
|
|
1421
|
-
It ships no `tokens_in` / `tokens_out` producer: this harness's payload
|
|
1422
|
-
carries no cumulative token count, so under the dead-producer rule the keys
|
|
1423
|
-
stay defined here for third-party producers but no dead producer is shipped.
|
|
1424
|
-
Beyond the snapshot write it renders a status bar (§The statusline template).
|
|
1425
|
-
The snapshot write is the contract; the bar is reference UX a consumer may
|
|
1426
|
-
restyle or discard. The source is pluggable
|
|
1427
|
-
(`DELEGATION_KIT_USAGE_FILE`), so no
|
|
1428
|
-
single-operator `CLAUDE_CONFIG_DIR` assumption is baked in.
|
|
1429
|
-
|
|
1430
|
-
`templates/usage-poller.sh` is the poll producer, closing the push producer's
|
|
1431
|
-
blind spot: the statusline fires on the supervising session's own message
|
|
1432
|
-
flow, so a lead that delegates stops producing exactly when it goes static —
|
|
1433
|
-
a delegated build can run for hours with every per-dispatch budget verdict
|
|
1434
|
-
reading a stale file. The poller is one poll cycle per invocation: read the
|
|
1435
|
-
harness OAuth token from the credentials file the kit already knows
|
|
1436
|
-
(`DELEGATION_KIT_CRED_FILE`; the token goes into the request header and
|
|
1437
|
-
nowhere else — never logged, never echoed, never written to the snapshot),
|
|
1438
|
-
query the account usage source, map the payload onto the contract (the three
|
|
1439
|
-
mandatory lines plus whichever optional keys the source exposes; **no new
|
|
1440
|
-
key**), and atomically rewrite the snapshot (`tmp` + `mv`, the same
|
|
1441
|
-
discipline). No daemon, no loop: scheduling belongs to the consumer, and two
|
|
1442
|
-
modes are sanctioned. **Demand-driven** (§usage-verdict): point
|
|
1443
|
-
`DELEGATION_KIT_REFRESH_CMD` at the poller and the same one-cycle producer runs
|
|
1444
|
-
at verdict time, which puts the freshest reading exactly at the decision point.
|
|
1445
|
-
**Timer-driven**: a cron line such as `*/5 * * * * bash usage-poller.sh` or a
|
|
1446
|
-
systemd timer, for consumers wanting continuous trend density independent of
|
|
1447
|
-
verdict calls. Either entry is the enabling config; with neither, the producer
|
|
1448
|
-
is dead. The usage endpoint is harness-account plumbing, not a
|
|
1449
|
-
published contract, so the poller is **fail-soft**: a missing/unreadable
|
|
1450
|
-
credentials file, a fetch failure, or an unparseable payload exits non-zero
|
|
1451
|
-
with a `help:` line *without touching the snapshot* — a stale snapshot is
|
|
1452
|
-
already the detected condition downstream (`usage-verdict`'s `updated_at`
|
|
1453
|
-
staleness check turns it into a STALE verdict, never a silent green), and the
|
|
1454
|
-
non-zero exit lands in the invoking timer's logging, deliberately nowhere
|
|
1455
|
-
else. The endpoint URL is the `DELEGATION_KIT_USAGE_ENDPOINT` knob — both the
|
|
1456
|
-
test seam (the smoke points it at a local `file://` stub) and the valve when
|
|
1457
|
-
the source moves.
|
|
1458
|
-
|
|
1459
|
-
Both producers write the whole snapshot atomically from the same account
|
|
1460
|
-
source; last-writer-wins is correct because the freshest write is the truest
|
|
1461
|
-
and `updated_at` arbitrates downstream. Nothing serializes them and nothing
|
|
1462
|
-
needs to. The trend log is unaffected: `usage-verdict` stays the single
|
|
1463
|
-
append author (§usage-verdict); the poller writes the snapshot only.
|
|
1464
|
-
|
|
1465
|
-
Because the
|
|
1466
|
-
statusline fires far more often than the per-session /
|
|
1467
|
-
per-dispatch verdict calls, a consumer wanting a denser trend history can drive
|
|
1468
|
-
sampling from the render path — `usage-verdict` stays the single append author
|
|
1469
|
-
(§usage-verdict), so the statusline calls it (with `DELEGATION_KIT_USAGE_HISTORY`
|
|
1470
|
-
set) rather than appending the log itself.
|
|
1471
|
-
|
|
1472
|
-
**The sample line.** With sampling enabled (§usage-verdict), `usage-verdict`
|
|
1473
|
-
appends one line per parsed snapshot — the trend log's wire contract between
|
|
1474
|
-
it and `usage-trend`:
|
|
1475
|
-
|
|
1476
|
-
```
|
|
1477
|
-
updated_at=<epoch> pct=<float> resets_at=<epoch> verdict=<word> login_at=<epoch>[ account=<word>][ tier=<word>][ pct_7d=<float> resets_7d=<epoch>][ tokens_in=<n> tokens_out=<n>]
|
|
1478
|
-
```
|
|
1479
|
-
|
|
1480
|
-
Space-separated `key=value`, order-insensitive; optional groups are omitted
|
|
1481
|
-
(never written empty) when the snapshot lacks them. `login_at` is the
|
|
1482
|
-
credentials-file mtime the post-login-lag check already reads, stamped per
|
|
1483
|
-
sample so an account switch becomes data; `pct` / `resets_at` are the 5h
|
|
1484
|
-
values verbatim and `pct_7d` / `resets_7d` the weekly ones. The log is
|
|
1485
|
-
append-only (the tmp-prune / boundary-truncate conventions own cleanup), and
|
|
1486
|
-
carries operator-local account identifiers, so it lives under the gitignored
|
|
1487
|
-
measurement dir and never reaches a tracked file.
|
|
1488
|
-
|
|
1489
|
-
### The statusline template
|
|
1490
|
-
|
|
1491
|
-
`templates/statusline-usage.sh` renders model/effort, a context gauge, the 5h
|
|
1492
|
-
and 7d windows with reset countdowns, an `iteration@stage` readout, and a queue
|
|
1493
|
-
counter group. Self-contained ANSI, no external asset (§Out of scope).
|
|
1494
|
-
|
|
1495
|
-
The `iteration@stage` readout's two halves come from two surfaces: the iteration
|
|
1496
|
-
from the queue header, the stage from the lifecycle evidence file's **last data
|
|
1497
|
-
line**. Both are repo-root-relative reads in the template's existing hardcode
|
|
1498
|
-
style — a consumer-owned template adds no knob. With no cursor to read (no
|
|
1499
|
-
evidence file, or one truncated to its preamble at an iteration boundary) the
|
|
1500
|
-
readout degrades to the iteration alone rather than printing a dangling
|
|
1501
|
-
separator or a partial parse.
|
|
1502
|
-
|
|
1503
|
-
**The counter group** is a compact `N12 T3 D48 I7` tally of the queue's task
|
|
1504
|
-
sections, appended last. The template does not know how many sections exist,
|
|
1505
|
-
what they are called, or which tiers the set contains: it runs
|
|
1506
|
-
queue-kit's `bin/queue-counts.sh` and renders whatever
|
|
1507
|
-
`<section-name><TAB><count>` lines come back, labelling each with the initial of
|
|
1508
|
-
the name it was handed (queue-kit/SPEC.md §bin/queue-counts.sh). The section
|
|
1509
|
-
vocabulary therefore stays entirely inside the kit that owns it — there is
|
|
1510
|
-
nothing here for a later editor to hardcode. As soon as two returned names share
|
|
1511
|
-
an initial, **every** label widens to two characters, so a colliding pair stays
|
|
1512
|
-
distinguishable and the group stays aligned rather than only the collision
|
|
1513
|
-
changing width.
|
|
1514
|
-
|
|
1515
|
-
**It is a subprocess call, and that is the contract, not an implementation
|
|
1516
|
-
detail.** The counter's library exits 2 at *source* time on a malformed queue
|
|
1517
|
-
config; sourced into this shell it would take the whole status bar down — model,
|
|
1518
|
-
context gauge, both rate-limit gauges — over a component worth four characters.
|
|
1519
|
-
As a subprocess the same fault is a non-zero exit the render absorbs. An absent
|
|
1520
|
-
or non-executable counter, a non-zero exit, and empty output all drop the group
|
|
1521
|
-
and change nothing else about the bar, matching the two degradations the
|
|
1522
|
-
template already performs (an absent queue file drops the iteration; an absent
|
|
1523
|
-
evidence file drops the `@stage` suffix). The existence guard is kept even
|
|
1524
|
-
though every installer profile carrying this template also carries queue-kit,
|
|
1525
|
-
because a future profile pairing differently would otherwise turn a roster fact
|
|
1526
|
-
into a broken status bar.
|
|
1527
|
-
|
|
1528
|
-
The render cost is one subprocess per statusline fire, which is the kit's most
|
|
1529
|
-
frequent trigger by a wide margin (§The usage.txt contract). A full scan of a
|
|
1530
|
-
~3,600-line queue measures in single-digit milliseconds, so the group needs no
|
|
1531
|
-
cache — recorded so a later session does not add one on suspicion.
|
|
1532
|
-
|
|
1533
|
-
## Trend reporter
|
|
1534
|
-
|
|
1535
|
-
`bin/usage-trend.sh` reads the history log and reports how the footprint
|
|
1536
|
-
evolves — advisory tooling, never a gate: exit **0** report emitted, **2**
|
|
1537
|
-
knob unset or history missing/unreadable (fail-closed, mirroring the
|
|
1538
|
-
verdict's STALE discipline), never **1** (it renders no verdict; the verdict
|
|
1539
|
-
stays the sole pause authority). The source signal is known-noisy — a
|
|
1540
|
-
rolling-window reading spikes and reverts-down when a harness over-report is
|
|
1541
|
-
corrected by the next push — so the design separates signal from noise by
|
|
1542
|
-
the window's one physical constraint: within a segment, true usage never
|
|
1543
|
-
decreases.
|
|
1544
|
-
|
|
1545
|
-
1. **Segment** samples per axis by that axis's reset epoch, `login_at`,
|
|
1546
|
-
`account`, and `tier`: the 5h axis keys on `resets_at`, the weekly axis
|
|
1547
|
-
on `resets_7d` (the windows roll independently — a weekly segment spans
|
|
1548
|
-
many 5h segments). A timer reset, a `/login`, or an account or tier
|
|
1549
|
-
change each starts a segment; only within-segment comparisons are
|
|
1550
|
-
meaningful, so an account switch is a boundary, not a flagged anomaly.
|
|
1551
|
-
2. **Flag** any sample whose pct is below an earlier one in the same segment
|
|
1552
|
-
as a monotonicity violation: the downward correction indicts the elevated
|
|
1553
|
-
sample(s) before it as reader noise, and both sides are excluded from rate
|
|
1554
|
-
math, never averaged in. Median-of-3 smoothing resolves single-sample
|
|
1555
|
-
spikes; segment endpoints keep their own value (no 2-window averaging).
|
|
1556
|
-
3. **Report** per segment and axis — first/last smoothed pct, pct-per-hour
|
|
1557
|
-
rate, token deltas when token keys ride, tier, sample count, and
|
|
1558
|
-
suspect-sample count (a high suspect ratio means the producer is
|
|
1559
|
-
unreliable and no number from that segment is trusted). The weekly axis
|
|
1560
|
-
additionally reports headroom against `DELEGATION_KIT_PAUSE_PCT_7D` at the current rate —
|
|
1561
|
-
the planning number for how much delegation the week still affords — and,
|
|
1562
|
-
when `account` is present, segments group under an account heading so a
|
|
1563
|
-
rotating operator reads one weekly trajectory per account rather than an
|
|
1564
|
-
interleaved stream.
|
|
1565
|
-
|
|
1566
|
-
## bin/wait-probe
|
|
1567
|
-
|
|
1568
|
-
`bin/wait-probe.sh` is the instrument behind §Operative residency's wait-primitive
|
|
1569
|
-
measurement: it stands a **known-duration producer** up and exercises candidate
|
|
1570
|
-
wait forms against it, recording one line per trial. Hand-invoked, no trigger,
|
|
1571
|
-
wired into **no** tier — it launches processes and sleeps for its declared
|
|
1572
|
-
durations, so a gate tier would put a multi-second sleep on every commit for a
|
|
1573
|
-
measurement bought once. Its precedent for existing at all is `demo/run-demo.sh`
|
|
1574
|
-
and `gate-sdk/bin/port-blockers.sh`, runnable artifacts a session invokes by hand.
|
|
1575
|
-
It writes nothing tracked: producers, markers and launch records go to
|
|
1576
|
-
`GATE_SDK_TMP_DIR`, trials to the capture-tier evidence file below, and it mints
|
|
1577
|
-
no knob of its own for either (§Layout and configuration owns why).
|
|
1578
|
-
|
|
1579
|
-
Exit **0** on a completed subcommand, **2** on misuse; `-h`/`--help` prints the
|
|
1580
|
-
subcommand roster on stdout and exits 0, the `bin/`-tool contract
|
|
1581
|
-
(gate-sdk/SPEC.md §The bin/-tool contract).
|
|
1582
|
-
|
|
1583
|
-
**One trial** is: launch a producer that sleeps a declared duration and then writes
|
|
1584
|
-
a completion marker; record its PID at launch in a `<key>.run` file exactly as
|
|
1585
|
-
`templates/agent-execution.md` mandates — the rule applies to the instrument that
|
|
1586
|
-
measures it, so the probe's own producers are visible to `check-producer-liveness`
|
|
1587
|
-
and to guard rule 14 like any other; arm the wait form under test; and record
|
|
1588
|
-
whether the waiter exited **before** the marker appeared. That before/after
|
|
1589
|
-
relation is the whole measurement: a waiter that outlives its condition is
|
|
1590
|
-
working, and one that exits early is the observed failure.
|
|
1591
|
-
|
|
1592
|
-
**The producer's duration is swept, not fixed**, because a single duration cannot
|
|
1593
|
-
distinguish the candidate causes. The probe reads no harness internals and asserts
|
|
1594
|
-
no ceiling; it varies the input and reports where the behavior changes.
|
|
1595
|
-
|
|
1596
|
-
**Two axes, and the second is what the instrument earns its keep on.** The *form*
|
|
1597
|
-
axis varies how the wait is armed. The *predicate* axis varies what the loop tests
|
|
1598
|
-
— a completion marker, or the producer's liveness. A form-only instrument can
|
|
1599
|
-
report that a form failed and can never report **why**, and the attested failures
|
|
1600
|
-
turned out to sit on the predicate axis, which a form-only sweep would have
|
|
1601
|
-
recorded as unexplained. Both axes are swept in the same run on identical
|
|
1602
|
-
producers, so no cell's result rests on a comparison with a differently-shaped
|
|
1603
|
-
trial, and every form arms the **same** wait body.
|
|
1604
|
-
|
|
1605
|
-
**The per-trial line.** Every field has a named reader and the field set is closed
|
|
1606
|
-
at these:
|
|
1607
|
-
|
|
1608
|
-
- **`form`** — which wait form the trial armed. Read at the comparison; the only
|
|
1609
|
-
field that distinguishes the candidates.
|
|
1610
|
-
- **`predicate`** — what the loop tested. Read at the classification, and it is
|
|
1611
|
-
what separates a failing *form* from a failing *condition*.
|
|
1612
|
-
- **`producer_ms`** — the producer's declared duration. Read at the sweep analysis:
|
|
1613
|
-
a ceiling shows as a threshold in this field.
|
|
1614
|
-
- **`waiter_exit`** — the waiter's exit status. Read at the classification, to
|
|
1615
|
-
separate a signal status from a clean zero with the marker absent.
|
|
1616
|
-
- **`marker_at_ms`**, **`waiter_at_ms`** — elapsed wall-clock at the marker's
|
|
1617
|
-
appearance and at the waiter's exit. Read **together and only together**: their
|
|
1618
|
-
*order* is the measurement and neither alone says anything.
|
|
1619
|
-
- **`producer_alive_at_exit`** — whether the recorded PID still answered `kill -0`
|
|
1620
|
-
when the waiter exited, establishing the *producer verifiably alive* condition —
|
|
1621
|
-
on the recorded PID and never a process-table pattern, which is the protocol's
|
|
1622
|
-
own rule.
|
|
1623
|
-
- **`class`** — `ok` on a clean trial; otherwise the cause, from the closed list
|
|
1624
|
-
below.
|
|
1625
|
-
|
|
1626
|
-
The producer's own PID is **not** logged: the `<key>.run` record already holds it
|
|
1627
|
-
for the lifetime the wait needs, and a second copy in an advisory log would be a
|
|
1628
|
-
PID with no reader once the trial ends.
|
|
1629
|
-
|
|
1630
|
-
**The candidate causes are enumerated before the run, not after it**, so a run
|
|
1631
|
-
returns a cause rather than an anecdote:
|
|
1632
|
-
|
|
1633
|
-
- **(i) `reaped`** — the harness or the session boundary killed the backgrounded
|
|
1634
|
-
shell. Tell: a signal exit status with the producer still alive.
|
|
1635
|
-
- **(ii) `ceiling`** — a wall-clock deadline the form carries. Tell: early exits
|
|
1636
|
-
cluster above one duration and short trials never fail.
|
|
1637
|
-
- **(iii) `predicate`** — the condition went true, or could not go false, for a
|
|
1638
|
-
reason unrelated to the producer. Tell: a clean **zero** exit with the marker
|
|
1639
|
-
absent, reproducing on a form the harness never touched.
|
|
1640
|
-
- **(iv) `unexplained`** — recorded as such and reported as such. A closed list
|
|
1641
|
-
that cannot say *I do not know* would force a wrong attribution, which is the
|
|
1642
|
-
failure the enumeration exists to avoid.
|
|
1643
|
-
|
|
1644
|
-
**The honest limit, and it is a division of labour rather than a defect.** Cause
|
|
1645
|
-
(ii)'s tell is a **threshold across the sweep**, so no single line can carry it:
|
|
1646
|
-
`record` classifies from the tells a trial can see on its own and the `report` arm
|
|
1647
|
-
is the only reader that sees the sweep whole and can name (ii). A reader taking a
|
|
1648
|
-
line's `class` for the run's verdict has read the wrong surface. The second limit
|
|
1649
|
-
is scope: the probe arms the forms a shell can arm and the *session* arms the
|
|
1650
|
-
harness's own, calling `record` for each — the tool cannot invoke a harness tool
|
|
1651
|
-
parameter, so a run that measures the harness forms is a session's run and `sweep`
|
|
1652
|
-
is the harness-uninvolved reproducer a second machine executes.
|
|
1653
|
-
|
|
1654
|
-
**The trials land in `.workflow/wait-primitive-evidence.txt`** — capture-tier,
|
|
1655
|
-
gitignored, advisory (gate-sdk/SPEC.md §The workflow directory), declared on the
|
|
1656
|
-
close-surface roster (lifecycle-kit/SPEC.md §The close-surface roster) naming its
|
|
1657
|
-
own clear as the reclaim path:
|
|
1658
|
-
|
|
1659
|
-
close-surface: .workflow/wait-primitive-evidence.txt advisory reclaim=: > .workflow/wait-primitive-evidence.txt
|
|
1660
|
-
|
|
1661
|
-
`advisory` rather than `forced`, on the reasoning §The turn-end liveness probe's
|
|
1662
|
-
log already takes: nothing refuses a close that skips it, and a visible skip is
|
|
1663
|
-
the honest mode for a probe. The **finding** — the branch the trials select and
|
|
1664
|
-
its grounds — lands in this SPEC, never in the log; the log is evidence, and
|
|
1665
|
-
evidence is not the record.
|
|
1666
|
-
|
|
1667
|
-
## Layout and configuration
|
|
1668
|
-
|
|
1669
|
-
```
|
|
1670
|
-
delegation-kit/
|
|
1671
|
-
bin/usage-verdict.sh
|
|
1672
|
-
bin/usage-trend.sh # footprint trend reporter over the history log
|
|
1673
|
-
bin/run-usage-tests.sh # verdict decision-table runner
|
|
1674
|
-
bin/run-budget-guard-tests.sh # budget-guard decision-table runner
|
|
1675
|
-
bin/run-dispatch-guard-tests.sh # dispatch-guard decision-table runner (D1/D2/D3)
|
|
1676
|
-
bin/run-trend-tests.sh # trend-reporter assertion runner
|
|
1677
|
-
bin/wait-probe.sh # wait-primitive probe: hand-invoked, no trigger, wired into no tier
|
|
1678
|
-
lib/delegation.sh # shared helpers for the usage tools and the kit's gates
|
|
1679
|
-
usage-tests/cases.tsv # expected-verdict <TAB> scenario knobs
|
|
1680
|
-
usage-tests/budget-guard-cases.tsv # expected-action <TAB> scenario knobs
|
|
1681
|
-
usage-tests/dispatch-guard-cases.tsv # expected-outcome <TAB> scenario knobs
|
|
1682
|
-
usage-tests/trend-history.log # fixture history for the trend runner
|
|
1683
|
-
checks/check-gate-tamper.gate # binary-dispatched; live arm reads the index through git
|
|
1684
|
-
checks/check-rule-citation.gate # hermetic, binary-dispatched: every SPEC rule citation resolves to a template lead-in
|
|
1685
|
-
checks/check-agent-tier-explicit.gate # hermetic, binary-dispatched: every agent definition declares an explicit model:
|
|
1686
|
-
gate-tests/check-gate-tamper/{good,bad}/
|
|
1687
|
-
gate-tests/check-gate-tamper.test.sh # the live arm, over throwaway git repos
|
|
1688
|
-
gate-tests/check-rule-citation/{good,bad}/
|
|
1689
|
-
gate-tests/check-agent-tier-explicit/{good,bad}/
|
|
1690
|
-
templates/agent-execution.md # full protocol, bound as a skill shim
|
|
1691
|
-
templates/dispatch-checklists.md # deletion/rename/audit pre-flight, reached by a pointer
|
|
1692
|
-
templates/agent-budget-guard.sh # PreToolUse(Agent) budget guard
|
|
1693
|
-
templates/agent-dispatch-guard.sh # PreToolUse(Agent) dispatch-shape guard (D1/D2/D3)
|
|
1694
|
-
templates/statusline-usage.sh # push usage.txt producer (statusline hook) + status bar incl. the queue counter group
|
|
1695
|
-
templates/usage-poller.sh # poll usage.txt producer (timer-driven, fail-soft)
|
|
1696
|
-
templates/subagent-stop-liveness.sh # SubagentStop turn-end liveness probe (logging-only)
|
|
1697
|
-
templates/delegation-config.sh # knob overrides (arrays live here)
|
|
1698
|
-
smoke/install.sh
|
|
1699
|
-
smoke/violation.sh
|
|
1700
|
-
```
|
|
1701
|
-
|
|
1702
|
-
Config follows the established kit pattern: copy
|
|
1703
|
-
`templates/delegation-config.sh` into the gates dir (or point
|
|
1704
|
-
`DELEGATION_KIT_CONFIG_FILE` elsewhere) and override any knob; defaults
|
|
1705
|
-
fill what the consumer left unset. The loader is fail-closed: a
|
|
1706
|
-
`DELEGATION_KIT_CONFIG_FILE` named but absent, or a config leaving any knob
|
|
1707
|
-
malformed, exits 2 (a broken machine gates nothing). Knobs (this repo's
|
|
1708
|
-
layout as defaults):
|
|
1709
|
-
|
|
1710
|
-
- `DELEGATION_KIT_USAGE_FILE` — default
|
|
1711
|
-
`${CLAUDE_CONFIG_DIR:-$HOME/.claude}/usage.txt`; positional `$1`
|
|
1712
|
-
overrides (test injection).
|
|
1713
|
-
- `DELEGATION_KIT_CRED_FILE` — default the usage file's sibling
|
|
1714
|
-
`.credentials.json`; positional `$2` overrides.
|
|
1715
|
-
- `DELEGATION_KIT_USAGE_ENDPOINT` — the poll producer's usage source; default
|
|
1716
|
-
`https://api.anthropic.com/api/oauth/usage`. The test seam (a `file://` stub)
|
|
1717
|
-
and the stability valve when the unpublished source moves (§The usage.txt
|
|
1718
|
-
contract).
|
|
1719
|
-
- `DELEGATION_KIT_PAUSE_PCT` — default `80`.
|
|
1720
|
-
- `DELEGATION_KIT_PAUSE_PCT_7D` — weekly-axis pause threshold; default `95`,
|
|
1721
|
-
deliberately looser than the 5h axis: a weekly PAUSE is remediated in days,
|
|
1722
|
-
not hours, so pausing at the 5h conservatism would strand a fifth of the
|
|
1723
|
-
week's budget — only the true red zone stops delegation on this axis.
|
|
1724
|
-
- `DELEGATION_KIT_STALE_AGE` — default `600` (seconds).
|
|
1725
|
-
- `DELEGATION_KIT_LOGIN_WINDOW` — default `600` (seconds).
|
|
1726
|
-
- `DELEGATION_KIT_REFRESH_CMD` — the command `usage-verdict` runs before
|
|
1727
|
-
reading the snapshot (§usage-verdict); default empty, which keeps the
|
|
1728
|
-
read-only behavior. This repo points it at the poll producer, run in place
|
|
1729
|
-
from its template path.
|
|
1730
|
-
- `DELEGATION_KIT_REFRESH_MIN_AGE` — the refresh short-circuit (§usage-verdict);
|
|
1731
|
-
default `60` (seconds), validated a non-negative integer by the loader. The
|
|
1732
|
-
floor is set by the render path, not the dispatch path: the statusline calls
|
|
1733
|
-
the verdict on every render, so the default bounds source traffic to roughly
|
|
1734
|
-
one poll a minute while leaving any dispatch-time reading fresh enough to act
|
|
1735
|
-
on.
|
|
1736
|
-
- `DELEGATION_KIT_USAGE_HISTORY` — sample-log path; default empty (sampling
|
|
1737
|
-
off). This repo sets `.metric/usage-history.log`, a gitignored persistent
|
|
1738
|
-
measurement trend (drift-kit/SPEC.md §Layout and configuration owns the
|
|
1739
|
-
metric-dir retention contract).
|
|
1740
|
-
- `DELEGATION_KIT_FAN_WIDTH` — read-only-fan-out width bound; default `2`,
|
|
1741
|
-
validated a positive integer by the loader. It bounds read-only fan-outs
|
|
1742
|
-
only: a committing fan-out serializes or takes its own worktree regardless
|
|
1743
|
-
(the template's **Serialize on shared files; ≤`DELEGATION_KIT_FAN_WIDTH`-wide
|
|
1744
|
-
otherwise** rule), so this knob is never a licence to widen concurrent
|
|
1745
|
-
committers.
|
|
1746
|
-
The default is the loss-bounding invariant — bound the in-flight loss to
|
|
1747
|
-
what the window can absorb when the wall fires mid-flight — at a Pro-class
|
|
1748
|
-
subscription window; a Max-class window absorbs more, and an API-billed
|
|
1749
|
-
operator has no mid-flight window wall at all, so there spend rate and the
|
|
1750
|
-
provider's rate limits replace the rationale. A consumer retunes from the
|
|
1751
|
-
invariant, not the number. **Supervision ceiling:** operator attention over
|
|
1752
|
-
N concurrent reports does not scale with the budget window — a bigger
|
|
1753
|
-
window raises the affordable width, not the reviewable one, so budget is
|
|
1754
|
-
never the sole input to widening. `usage-verdict` surfaces the live value
|
|
1755
|
-
as the `width=` field (§usage-verdict), the knob's mechanical reader.
|
|
1756
|
-
- `DELEGATION_KIT_AGENT_DIR` — the directory `check-agent-tier-explicit` walks
|
|
1757
|
-
for agent definitions; default `.claude/agents`, this harness's conventional
|
|
1758
|
-
agent-definition location, validated non-empty by the loader. Positional `$1`
|
|
1759
|
-
overrides (fixture injection). A consumer whose harness keeps definitions
|
|
1760
|
-
elsewhere repoints it; one with no such directory leaves it and the gate
|
|
1761
|
-
reports its counted-inert clean line (§check-agent-tier-explicit).
|
|
1762
|
-
- `DELEGATION_KIT_GATE_FILES` — globs naming gate files for tamper
|
|
1763
|
-
assertion A; default
|
|
1764
|
-
`("${GATE_SDK_GATES_DIR:-scripts}/check-*.sh" "${GATE_SDK_GATES_DIR:-scripts}/check-*.gate")`
|
|
1765
|
-
plus the gate-sdk lib and
|
|
1766
|
-
runners. **Both declaration spellings are on the default**, because a gate's
|
|
1767
|
-
declaration path is `<name>.sh` *or* `<name>.gate`
|
|
1768
|
-
(gate-sdk/SPEC.md §The `# graph:` manifest)
|
|
1769
|
-
and a consumer on the default would otherwise receive a
|
|
1770
|
-
ported gate whose edits escape the isolation rule entirely — the widening the
|
|
1771
|
-
`check-gate-tamper` row of
|
|
1772
|
-
gate-sdk/SPEC.md §Meta-gate conservation for the binary substrate
|
|
1773
|
-
mandates, come due at the first live descriptor.
|
|
1774
|
-
A consumer declaration **replaces** this default outright rather
|
|
1775
|
-
than extending it — the loader guards it with `declare -p … ||`, so the
|
|
1776
|
-
default is the no-declaration fallback, not a base to append to. A consumer
|
|
1777
|
-
adding kit-shipped globs must therefore restate any default glob it still
|
|
1778
|
-
wants covered (this repo's config names `*/checks/*.sh` and `*/checks/*.gate`
|
|
1779
|
-
**and** their `scripts/check-*` counterparts, because it has gates in both
|
|
1780
|
-
places). Contrast
|
|
1781
|
-
`DELEGATION_KIT_META_PATHS` below, whose kit-root union *is* additive — the
|
|
1782
|
-
two knobs do not behave alike.
|
|
1783
|
-
- `DELEGATION_KIT_META_PATHS` — prefixes counted as meta-layer for
|
|
1784
|
-
assertion A; default `("${GATE_SDK_GATES_DIR:-scripts}/"
|
|
1785
|
-
"${GATE_SDK_WORKFLOW_DIR:-.workflow}/" ".claude/")`; root-level `*.md` is
|
|
1786
|
-
always meta. When `gate.sh` is resolvable (`GATE_SDK_LIB`, else the vendored
|
|
1787
|
-
sibling), the loader unions every `gate_kit_roots` member into this array as a
|
|
1788
|
-
root-relative `dir/` prefix — a vendored kit's edits are meta-layer by
|
|
1789
|
-
definition, so the consumer's config need not name kit dirs at all (this
|
|
1790
|
-
repo's keeps only the non-kit prefixes). The union is additive, never a
|
|
1791
|
-
filter: a
|
|
1792
|
-
prefix the consumer declared cannot be lost, and without `gate.sh` the config
|
|
1793
|
-
is used exactly as written.
|
|
1794
|
-
- `DELEGATION_KIT_STOP_LOG` — the turn-end probe's log (§The turn-end liveness
|
|
1795
|
-
probe (template)); default
|
|
1796
|
-
`${GATE_SDK_WORKFLOW_DIR:-.workflow}/subagent-stop-liveness.log`, the same
|
|
1797
|
-
deferral guard-kit's two logs already take. No scratch-dir knob sits beside it:
|
|
1798
|
-
the launch record's home is `${GATE_SDK_TMP_DIR:-.tmp}`, the cross-kit deferral
|
|
1799
|
-
every kit reaching that directory already resolves it through, and a second
|
|
1800
|
-
name for it would be the duplication rather than the config. **The rule has
|
|
1801
|
-
since governed a second artifact and held**: `bin/wait-probe` (§bin/wait-probe)
|
|
1802
|
-
writes producers, markers and `<key>.run` records into that same directory and
|
|
1803
|
-
mints no knob of its own for it either. It mints none for its evidence log
|
|
1804
|
-
either, and there the reasoning is the narrower one this bullet's own knob does
|
|
1805
|
-
not meet: a knob needs a reader, and `DELEGATION_KIT_STOP_LOG` has one — a
|
|
1806
|
-
*second process*, the consumer-side hook, which must be told where to write.
|
|
1807
|
-
The probe both writes and reads its own log in one tool, so a knob there would
|
|
1808
|
-
be a name nothing reads, and the close stage reaches the file through the
|
|
1809
|
-
roster's literal rather than through a knob.
|
|
1810
|
-
- `DELEGATION_KIT_LIVENESS_CMD` — the liveness reader the probe invokes in set
|
|
1811
|
-
mode; default `evidence-kit/checks/check-producer-liveness.sh`. A knob rather
|
|
1812
|
-
than a literal because a consumer's evidence-kit may sit elsewhere, and because
|
|
1813
|
-
it is read through the **unset** form, so an explicitly empty value is the
|
|
1814
|
-
supported way to run the probe with no reader at all — the honest-degradation
|
|
1815
|
-
case the section states.
|
|
1816
|
-
- `DELEGATION_KIT_READONLY_TYPES` — agent-type names the consumer dispatches for
|
|
1817
|
-
read-only work; D2's only trigger (§The delegation model). Default empty, in
|
|
1818
|
-
which case D2 is inert by construction. Every entry is the consumer's own
|
|
1819
|
-
agent roster, never the kit's (CLAUDE.md §The provenance seam) — the same
|
|
1820
|
-
reasoning that ships `GUARD_KIT_BREADTH_PROBES` with no default probes.
|
|
1821
|
-
Deliberately not knobbed alongside it, each ruled out for a stated reason: a
|
|
1822
|
-
fork-type-name knob and an accepted-isolation-values knob — `fork` and
|
|
1823
|
-
`worktree` are the **harness's** dispatch vocabulary, and a guard template
|
|
1824
|
-
carries its harness's tool vocabulary as literals the same way
|
|
1825
|
-
`wakeup-guard.sh` matches `ScheduleWakeup`/`CronCreate` literally, so
|
|
1826
|
-
knobbing them would imply a portability the mechanism does not have; a
|
|
1827
|
-
warn-only or per-rule opt-out — a doctrine downgradable per session is the
|
|
1828
|
-
honour system these rules exist to end, so the valve stays the whole guard's
|
|
1829
|
-
registration, never a finer one; and accepting `isolation: remote` as
|
|
1830
|
-
satisfying D2 — plausibly correct (a remote agent cannot touch the local
|
|
1831
|
-
index) but unverified from here, and remote availability is gated, so it is
|
|
1832
|
-
excluded with its reason recorded rather than admitted on plausibility.
|
|
1833
|
-
|
|
1834
|
-
`check-gate-tamper` registers in the consumer's `gates.list`
|
|
1835
|
-
(tier: precommit) — in this repo's too; dogfooding is day-one, and agents
|
|
1836
|
-
commit here.
|
|
1837
|
-
|
|
1838
|
-
`agent-budget-guard.sh` is not a gate — it is a hook, so it registers not in
|
|
1839
|
-
`gates.list` but under `PreToolUse` matcher `Agent` in the consumer's
|
|
1840
|
-
`.claude/settings.json` (beside the guard-kit Bash guard). Copy the template
|
|
1841
|
-
into the gates dir and wire `bash scripts/agent-budget-guard.sh`; it resolves
|
|
1842
|
-
`guard-kit/lib/guard.sh` and `bin/usage-verdict.sh` at their vendored paths,
|
|
1843
|
-
overridable with `GUARD_KIT_LIB` / `DELEGATION_KIT_VERDICT_BIN`. Registration
|
|
1844
|
-
is the whole opt-in: unwired, the guard is inert. This repo registers it, and
|
|
1845
|
-
its consumer session brief (`scripts/session-context.sh`) additionally prints
|
|
1846
|
-
the verdict line at SessionStart for planning-time visibility — a consumer-side
|
|
1847
|
-
edit; the context-kit template stays uncoupled from delegation-kit.
|
|
1848
|
-
|
|
1849
|
-
`subagent-stop-liveness.sh` is a third hook, and the only one on a non-`PreToolUse`
|
|
1850
|
-
event. It registers under `SubagentStop` in the consumer's `.claude/settings.json`
|
|
1851
|
-
— an event that takes **no matcher**, so the entry carries a `hooks` array alone
|
|
1852
|
-
and is not tool-scoped, the shape a `SessionStart` entry already has. Copy the
|
|
1853
|
-
template into the gates dir and wire `bash scripts/subagent-stop-liveness.sh`; it
|
|
1854
|
-
sources no kit lib at all (§The turn-end liveness probe (template) owns why) and
|
|
1855
|
-
resolves its reader through `DELEGATION_KIT_LIVENESS_CMD`. Registration is again
|
|
1856
|
-
the whole opt-in, and here the opt-in is also the consent: the wiring is a
|
|
1857
|
-
permission-surface write, so it is the consumer's own act and never an agent
|
|
1858
|
-
session's.
|
|
1859
|
-
|
|
1860
|
-
`agent-dispatch-guard.sh` is a second hook on that same matcher, registered the
|
|
1861
|
-
same way and **independently**: the harness fires every hook a matcher carries
|
|
1862
|
-
and any exit 2 blocks, so neither guard knows about the other and a consumer
|
|
1863
|
-
may wire either one alone (§The delegation model owns why they are two scripts
|
|
1864
|
-
rather than one). It resolves `guard-kit/lib/guard.sh` at its vendored path,
|
|
1865
|
-
overridable with `GUARD_KIT_LIB`, and reads the consumer's delegation config for
|
|
1866
|
-
D2's roster and nothing else. Registration is again the whole opt-in: unwired,
|
|
1867
|
-
it is inert — and an unwired dispatch guard is the exact failure shape it
|
|
1868
|
-
exists to catch, so wiring it is not optional dogfooding for a consumer that
|
|
1869
|
-
delegates.
|
|
1870
|
-
|
|
1871
|
-
**An `OK` verdict is a floor, not a recommendation.** The guard answers one
|
|
1872
|
-
question — is there headroom in the window *right now* — and blocks only on
|
|
1873
|
-
`PAUSE`. Everything else a dispatch decision turns on sits outside its reach:
|
|
1874
|
-
how long the dispatched work runs, what a fan-out beneath the checkpoint will
|
|
1875
|
-
cost in total (the guard re-arms on those children but prices each of them
|
|
1876
|
-
alone: covered at every depth, aggregated at none — §The delegation model),
|
|
1877
|
-
and whether anything forces the dispatch now rather than after the window
|
|
1878
|
-
resets. `OK` is therefore one input to that decision and never the decision
|
|
1879
|
-
itself; a dispatcher reading `OK` as "go" has substituted the guard's question
|
|
1880
|
-
for its own. The asymmetry is deliberate: a wrong `PAUSE` costs a delayed
|
|
1881
|
-
dispatch, while an `OK` that is right about headroom and silent about duration
|
|
1882
|
-
costs the work in flight.
|
|
1883
|
-
|
|
1884
|
-
## Testing
|
|
1885
|
-
|
|
1886
|
-
`check-gate-tamper` speaks the full gate contract (`GATE-TAMPER: clean
|
|
1887
|
-
(…)` / findings + `help:` lines / exit 0-1-2) and ships the standard
|
|
1888
|
-
`good/`+`bad/` fixture pair driven through `--fixture` by gate-sdk's
|
|
1889
|
-
`run-gate-tests.sh`. The pair reaches both assertions — the bad case carries a
|
|
1890
|
-
co-staged non-meta path *and* a newly added path exemption matching one of its
|
|
1891
|
-
own staged files, beside a bare token assertion B must pass over.
|
|
1892
|
-
|
|
1893
|
-
**The pair cannot reach the live arm, and that is a property of the injection
|
|
1894
|
-
rather than of the cases.** `--fixture` supplies both lists directly, so the
|
|
1895
|
-
function that derives them — reading each staged gate file's bytes out of the
|
|
1896
|
-
object store and diffing its exemption set against `HEAD`'s — runs in no fixture
|
|
1897
|
-
case. `gate-tests/check-gate-tamper.test.sh` is where it is exercised: each case
|
|
1898
|
-
builds a throwaway git repo, stages a commit shape into a real index, and runs
|
|
1899
|
-
the gate inside it. It holds the four verdicts the pair cannot — a HEAD-resident
|
|
1900
|
-
exemption is not "added" even when a co-staged file matches it, a newly appended
|
|
1901
|
-
one is, an added one matching nothing staged stays silent, and a staged
|
|
1902
|
-
*deletion* of a gate file reads as an empty exemption set rather than a failure
|
|
1903
|
-
to read.
|
|
1904
|
-
|
|
1905
|
-
`check-rule-citation` speaks the same gate contract and ships the standard
|
|
1906
|
-
`good/`+`bad/` fixture pair (a citation resolving to a template lead-in vs one
|
|
1907
|
-
naming an absent lead-in), driven by `run-gate-tests.sh` over fixture-local
|
|
1908
|
-
spec + template files passed as its two positional arguments.
|
|
1909
|
-
|
|
1910
|
-
`check-agent-tier-explicit` speaks the same gate contract and ships the standard
|
|
1911
|
-
`good/`+`bad/` fixture pair over a fixture-local agent directory passed as its
|
|
1912
|
-
one positional argument. The `good/` side carries both passing shapes — a
|
|
1913
|
-
definition naming a cheaper class outright and one declaring `inherit` — so the
|
|
1914
|
-
pair proves the gate discriminates omission from choice rather than merely
|
|
1915
|
-
finding a `model:` string; the `bad/` side omits the field.
|
|
1916
|
-
|
|
1917
|
-
`usage-verdict` does not fit the gate contract (a three-state verdict, not a
|
|
1918
|
-
clean/violation pair), so — like guard-kit's guard-tests — the kit ships
|
|
1919
|
-
its own decision-table runner: `usage-tests/cases.tsv` pairs an expected
|
|
1920
|
-
verdict token (`OK`/`PAUSE`/`STALE`/`RESET-OK`) and exit code with scenario
|
|
1921
|
-
knobs (percentage, snapshot age offset, reset offset, credential age);
|
|
1922
|
-
`bin/run-usage-tests.sh` materializes each case as a generated snapshot
|
|
1923
|
-
file (timestamps must be computed relative to *now* — static fixtures
|
|
1924
|
-
would age into permanent STALE) and asserts verdict and exit code. Each
|
|
1925
|
-
case runs in a throwaway sandbox with no consumer config on the lookup
|
|
1926
|
-
path **and** with ambient `DELEGATION_KIT_*` exports stripped at each gate
|
|
1927
|
-
invocation, so the gate exercises its own defaults hermetic to the host
|
|
1928
|
-
repo — the decision table encodes those defaults, and a host override (a
|
|
1929
|
-
raised pause threshold, say) must not reshape it. The trend and
|
|
1930
|
-
budget-guard runners below share the strip, each runner under a deliberate
|
|
1931
|
-
poison export that fails its own table loudly if the strip ever breaks;
|
|
1932
|
-
`cases.tsv` columns are `verdict exit pct age_off reset_off cred_age pct_7d
|
|
1933
|
-
reset7d_off append axis desc` (the offsets seconds from *now*; `pct_7d` `-`
|
|
1934
|
-
omits the weekly keys, `append` is the expected sample-line count, `axis`
|
|
1935
|
-
asserts which window a PAUSE names). Every verdict branch and both pause axes
|
|
1936
|
-
carry a firing and a non-firing case — the fixture-pair discipline,
|
|
1937
|
-
transplanted — covering a weekly PAUSE while 5h is comfortable, the axis
|
|
1938
|
-
named in the output, absent keys disarming the weekly axis, a dead weekly
|
|
1939
|
-
window not pausing, each axis's at-or-over boundary (a reading exactly at the
|
|
1940
|
-
threshold pauses; just under does not), both directions of the login reroute
|
|
1941
|
-
(an under-threshold percentage with a fresh login is STALE, not OK; an
|
|
1942
|
-
at-or-over one on either axis is still PAUSE, not STALE — the asymmetry is
|
|
1943
|
-
what keeps the reroute from waving an unaffordable dispatch through), and the
|
|
1944
|
-
sample-append discipline (a parsed snapshot
|
|
1945
|
-
appends one line whatever the verdict; a non-numeric snapshot appends none;
|
|
1946
|
-
`pct_7d` present-vs-omitted in the passed-through line).
|
|
1947
|
-
|
|
1948
|
-
The demand-driven refresh needs a command seam the table's columns do not
|
|
1949
|
-
carry, so it is asserted beside the table through a stub
|
|
1950
|
-
`DELEGATION_KIT_REFRESH_CMD` (a real
|
|
1951
|
-
poll would need the network): **armed** — a stale snapshot invokes the command
|
|
1952
|
-
and the verdict reads the values the refresh wrote, not the cached ones;
|
|
1953
|
-
**fail-soft** — a non-zero stub leaves the snapshot byte-identical, the verdict
|
|
1954
|
-
proceeds and the cached reading is judged STALE by the existing staleness
|
|
1955
|
-
machinery, and no refresh diagnostic leaks into the relayed verdict line;
|
|
1956
|
-
**short-circuit** — a snapshot under `DELEGATION_KIT_REFRESH_MIN_AGE` never invokes the
|
|
1957
|
-
command. Armed and short-circuit are the firing/non-firing pair over the same
|
|
1958
|
-
stub, so the absence proves the floor rather than a broken stub.
|
|
1959
|
-
|
|
1960
|
-
The **roll witnesses** need a pre-seeded history tail the table's columns do
|
|
1961
|
-
not carry, so they are asserted beside it too, over one fixed shape — a low
|
|
1962
|
-
percentage with a credentials mtime inside the login window, which without a
|
|
1963
|
-
witness is STALE. Both witnesses present verdicts OK; each of the four ways
|
|
1964
|
-
the log can fail to answer holds the STALE — the boundary unmoved, the
|
|
1965
|
-
previous boundary uncrossed, a tail with a non-numeric `resets_at`, and no
|
|
1966
|
-
history at all. The two single-witness cases are the discriminating pair: they
|
|
1967
|
-
prove the conjunction is load-bearing rather than either witness carrying it
|
|
1968
|
-
alone. A sixth case asserts the read is not self-witnessing — a run with an
|
|
1969
|
-
empty log still STALEs and leaves exactly its own sample behind, so the
|
|
1970
|
-
witness can only ever be a previous reading.
|
|
1971
|
-
|
|
1972
|
-
`usage-trend` is likewise not a gate (it renders no clean/violation
|
|
1973
|
-
verdict), so it ships an assertion runner, `bin/run-trend-tests.sh`, over a
|
|
1974
|
-
static fixture history `usage-tests/trend-history.log` (static epochs are
|
|
1975
|
-
safe — the reporter measures within-segment deltas, never against *now*). It
|
|
1976
|
-
asserts per-axis segmentation at a reset boundary, a `login_at` change, and
|
|
1977
|
-
an account change; per-account grouping reuniting a weekly trajectory across
|
|
1978
|
-
a switch-back; a spike-then-correction flagged and excluded rather than
|
|
1979
|
-
averaged; token deltas and weekly headroom on the report; and the
|
|
1980
|
-
fail-closed exits (knob unset / history missing → 2). No fixture pair owed —
|
|
1981
|
-
neither script is a gate.
|
|
1982
|
-
|
|
1983
|
-
`agent-budget-guard.sh` is a hook, not a gate, so it speaks exit-2 + hook
|
|
1984
|
-
JSON rather than the gate output contract — and like the verdict it ships a
|
|
1985
|
-
decision-table runner beside the verdict tests: `usage-tests/budget-guard-cases.tsv`
|
|
1986
|
-
pairs an expected action (`block`/`advise`) with the same snapshot knobs
|
|
1987
|
-
(`action pct age_off reset_off cred_age desc`, `pct=UNREADABLE` for the
|
|
1988
|
-
no-snapshot case), and `bin/run-budget-guard-tests.sh` drives the *template*
|
|
1989
|
-
with each injected snapshot — feeding an Agent hook JSON on stdin, pointing
|
|
1990
|
-
`DELEGATION_KIT_USAGE_FILE` at the generated fixture — and classifies the
|
|
1991
|
-
result: PAUSE → `block` (exit 2, verdict on stderr), OK/RESET-OK/STALE/unreadable
|
|
1992
|
-
→ `advise` (exit 0, verdict in `additionalContext`). The block branch carries
|
|
1993
|
-
its firing (PAUSE) and non-firing (the four advise cases) — the fixture-pair
|
|
1994
|
-
discipline again — and every case asserts the live verdict text rides the
|
|
1995
|
-
output so a memory-quoted percentage cannot be the acting source.
|
|
1996
|
-
|
|
1997
|
-
`agent-dispatch-guard.sh` takes its own decision-table lane rather than
|
|
1998
|
-
guard-kit's `guard-tests/` (keyed on a command, or a to+message — neither can
|
|
1999
|
-
express a dispatch's parameters, the same reason the budget guard has its own
|
|
2000
|
-
runner) or the budget guard's table (a different payload grammar again):
|
|
2001
|
-
`usage-tests/dispatch-guard-cases.tsv` pairs an expected outcome
|
|
2002
|
-
(`block`/`advise`/`fallthrough`) with `subagent_type isolation nested desc`,
|
|
2003
|
-
and `bin/run-dispatch-guard-tests.sh` drives the *template* with a built Agent
|
|
2004
|
-
hook payload — `tool_input.subagent_type`/`.isolation`, and, for a nested case,
|
|
2005
|
-
the top-level `agent_id`/`agent_type` the harness only sets inside a subagent —
|
|
2006
|
-
classifying block (exit 2) / advise (exit 0, `additionalContext` present) /
|
|
2007
|
-
fallthrough (exit 0, empty stdout). The table fixes one roster for its whole
|
|
2008
|
-
run, `DELEGATION_KIT_READONLY_TYPES=(ro-type)`, supplied through a generated
|
|
2009
|
-
config file and `DELEGATION_KIT_CONFIG_FILE`; a `subagent_type` prefixed
|
|
2010
|
-
`noroster:` runs instead with no config file at all (an empty declare),
|
|
2011
|
-
stripped before it reaches the guard — the row that proves D2 is inert on the
|
|
2012
|
-
roster's *absence*, not merely on this dispatch's type missing from a
|
|
2013
|
-
populated one. Every rule carries a firing and a non-firing case (the
|
|
2014
|
-
fixture-pair discipline, transplanted): D1 — a fork blocks, a typed dispatch
|
|
2015
|
-
under an empty roster does not; D2 — a rostered type without isolation blocks,
|
|
2016
|
-
the same type with `isolation: worktree` does not, an unrostered type under a
|
|
2017
|
-
populated roster does not, and the empty-roster case does not; D3 — a payload
|
|
2018
|
-
carrying `agent_id` advises, one without it falls through. The degradation
|
|
2019
|
-
posture gets its own case rather than being asserted only in prose: an
|
|
2020
|
-
unparseable payload (`subagent_type` `UNPARSEABLE`, sent as invalid JSON on
|
|
2021
|
-
stdin) advises rather than blocks — the assertion that makes delta 6's
|
|
2022
|
-
fail-open-but-loud posture testable, not merely stated, and the one case this
|
|
2023
|
-
lane must not drop for brevity. The runner strips ambient `DELEGATION_KIT_*` at
|
|
2024
|
-
every invocation, the discipline `run-budget-guard-tests.sh` already uses, so a
|
|
2025
|
-
consumer's live roster or config-file pointer cannot leak into the fixture.
|
|
2026
|
-
|
|
2027
|
-
`smoke/install.sh` copies the templates and `bin/` tools into the scratch
|
|
2028
|
-
consumer, registers the tamper gate, and drives one crafted snapshot
|
|
2029
|
-
through `usage-verdict` asserting a verdict — self-verifying install. It opens
|
|
2030
|
-
with **one hermetic env prelude covering the whole file**: it strips the whole
|
|
2031
|
-
`DELEGATION_KIT_*` namespace and then sets the knobs with no per-call home —
|
|
2032
|
-
sampling off, and both pause thresholds at the defaults the 95% reading is
|
|
2033
|
-
judged against. A prelude rather than per-instance pins because
|
|
2034
|
-
instance-pinning has already missed
|
|
2035
|
-
once by construction: a pass that pinned the two knobs then biting left the
|
|
2036
|
-
third, and the survivor was the one whose failure is **silent** — an
|
|
2037
|
-
unpinned history path makes every smoke verdict append a synthetic sample
|
|
2038
|
-
into whatever trend log the ambient config names, indistinguishable in shape
|
|
2039
|
-
from a real operator reading. That this repo's runs happened not to pollute
|
|
2040
|
-
was accidental, not designed: the harness runs the file with cwd = the
|
|
2041
|
-
scratch consumer root and the configured history path is *relative*, so the
|
|
2042
|
-
appends died with the scratch tree — hermeticity that evaporates the moment a
|
|
2043
|
-
consumer configures an absolute path or the file is invoked from a real tree.
|
|
2044
|
-
Stripping the whole namespace is the shape that cannot miss a third knob.
|
|
2045
|
-
The credentials pin stays **at each invocation** rather than moving into the
|
|
2046
|
-
prelude, because gate-sdk/SPEC.md §check-test-hermetic reads it there — a
|
|
2047
|
-
line-local pin is evidence a reader and a gate can both see without tracing
|
|
2048
|
-
file-level state — and the poller's own snapshot, credentials and endpoint
|
|
2049
|
-
paths stay inline too, being genuine per-call arguments the prelude has no
|
|
2050
|
-
business pre-empting. That
|
|
2051
|
-
assertion is **code-specific**: the 95% guard captures the exit status and
|
|
2052
|
-
compares it to the PAUSE code, reporting the status it observed rather than
|
|
2053
|
-
claiming an outcome it did not establish, so a STALE regression cannot pass
|
|
2054
|
-
under a "did not PAUSE" message (gate-sdk/SPEC.md
|
|
2055
|
-
§check-assertion-strength, the gate for the class). It also
|
|
2056
|
-
drives the poll producer through its `file://` stub seam: the happy path
|
|
2057
|
-
writes a contract-valid snapshot (asserted by driving it through
|
|
2058
|
-
`usage-verdict`), and a fetch failure exits non-zero leaving a pre-seeded
|
|
2059
|
-
snapshot byte-identical — the fail-soft contract, exercised end to end.
|
|
2060
|
-
`smoke/violation.sh` stages a gate edit co-staged with a product file in
|
|
2061
|
-
the scratch consumer and asserts the battery reds (assertion A) — the
|
|
2062
|
-
violation is craftable, so the file is mandatory
|
|
2063
|
-
(gate-sdk/SPEC.md §Consumer smoke).
|
|
2064
|
-
|
|
2065
|
-
## Out of scope
|
|
2066
|
-
|
|
2067
|
-
A consumer's validate battery (its compile/lint/test command set and rename
|
|
2068
|
-
corruption sweeps), its shared-file roster, and its width/burn anecdotes tied
|
|
2069
|
-
to specific sweeps are rule content, referenced only as marked-section
|
|
2070
|
-
examples. A task-output tailer is not shipped: such a tool hardcodes local
|
|
2071
|
-
harness paths and exists to violate the template's **Background + notification,
|
|
2072
|
-
never poll** rule for debugging. The
|
|
2073
|
-
`usage.txt` write contract and a reference producer rendering the gauge bars
|
|
2074
|
-
and `iteration@stage` readout do ship (the producer's ANSI is self-contained,
|
|
2075
|
-
pulling no external asset); a consumer's *particular* statusline styling and
|
|
2076
|
-
any asset its own gauges pull are not the rendering mechanism and stay with
|
|
2077
|
-
it. The split is protocol and mechanisms here, a consumer's rosters,
|
|
2078
|
-
batteries, and bespoke UX in its own copies.
|