checkwright 0.0.1 → 0.18.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 +260 -4
- package/bin/checkwright.sh +53 -0
- package/lib/common/lock.sh +28 -0
- package/lib/common/profile.sh +58 -0
- package/lib/common/recipe.sh +93 -0
- package/lib/doctor.sh +90 -0
- package/lib/init.sh +289 -0
- package/package.json +15 -3
- package/payload/canon-kit/README.md +79 -0
- package/payload/canon-kit/SPEC.md +1410 -0
- package/payload/canon-kit/checks/check-amendment-queue.sh +116 -0
- package/payload/canon-kit/checks/check-comment-tier.sh +211 -0
- package/payload/canon-kit/checks/check-deprecation-task.sh +90 -0
- package/payload/canon-kit/checks/check-docs-cmd.sh +153 -0
- package/payload/canon-kit/checks/check-docs-link-convention.sh +71 -0
- package/payload/canon-kit/checks/check-install-claim.sh +146 -0
- package/payload/canon-kit/checks/check-knob-citation.sh +117 -0
- package/payload/canon-kit/checks/check-knob-default-coupling.sh +239 -0
- package/payload/canon-kit/checks/check-manifest-count.sh +46 -0
- package/payload/canon-kit/checks/check-manifest-temporal.sh +83 -0
- package/payload/canon-kit/checks/check-md-refs.sh +115 -0
- package/payload/canon-kit/checks/check-prose-enum.sh +115 -0
- package/payload/canon-kit/checks/check-prose-tells.sh +207 -0
- package/payload/canon-kit/checks/check-spec-derivable-section.sh +69 -0
- package/payload/canon-kit/checks/check-spec-dod-singleton.sh +45 -0
- package/payload/canon-kit/checks/check-spec-embedded-source.sh +133 -0
- package/payload/canon-kit/checks/check-spec-fence-balance.sh +42 -0
- package/payload/canon-kit/checks/check-spec-pointer.sh +176 -0
- package/payload/canon-kit/checks/check-surface-duplication.sh +105 -0
- package/payload/canon-kit/checks/check-todo-task-liveness.sh +80 -0
- package/payload/canon-kit/checks/check-tracking-claim.sh +136 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-tidy.md +5 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +15 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/good/SPEC-widget.md +6 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/good/TASK-QUEUE.md +15 -0
- package/payload/canon-kit/gate-tests/check-amendment-queue/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.sh +25 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +32 -0
- package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +146 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/TASK-QUEUE.md +19 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.sh +6 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +5 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/TASK-QUEUE.md +21 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.sh +5 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +5 -0
- package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +98 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/bad/args +1 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/bad/doc.md +9 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/good/args +1 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/good/bin/tool.sh +3 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/good/doc.md +18 -0
- package/payload/canon-kit/gate-tests/check-docs-cmd/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/args +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/demokit/index.md +5 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/args +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/demokit/index.md +6 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/index.md +3 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +3 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/README.md +12 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/install.md +24 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/posts/note.md +7 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.sh +10 -0
- package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/install-transports.sh +7 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/README.md +12 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/install.md +24 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/posts/note.md +7 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.sh +10 -0
- package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/install-transports.sh +7 -0
- package/payload/canon-kit/gate-tests/check-knob-citation/bad/SPEC.md +10 -0
- package/payload/canon-kit/gate-tests/check-knob-citation/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-knob-citation/good/SPEC.md +19 -0
- package/payload/canon-kit/gate-tests/check-knob-citation/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +71 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/scripts/gate-sdk-config.sh +4 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/SPEC.md +4 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/lib/widget-cli.sh +3 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/lib/widget.sh +5 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/SPEC.md +7 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/lib/widget-cli.sh +3 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/lib/widget.sh +5 -0
- package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +73 -0
- package/payload/canon-kit/gate-tests/check-manifest-count/bad/SPEC.md +15 -0
- package/payload/canon-kit/gate-tests/check-manifest-count/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +37 -0
- package/payload/canon-kit/gate-tests/check-manifest-count/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +104 -0
- package/payload/canon-kit/gate-tests/check-manifest-temporal/bad/SPEC.md +6 -0
- package/payload/canon-kit/gate-tests/check-manifest-temporal/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-manifest-temporal/good/SPEC.md +17 -0
- package/payload/canon-kit/gate-tests/check-manifest-temporal/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs/bad/args +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs/bad/doc.md +3 -0
- package/payload/canon-kit/gate-tests/check-md-refs/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs/good/args +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs/good/doc.md +3 -0
- package/payload/canon-kit/gate-tests/check-md-refs/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs/good/target.md +1 -0
- package/payload/canon-kit/gate-tests/check-md-refs.test.sh +82 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/bad/SPEC.md +4 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.sh +4 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/good/SPEC.md +16 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.sh +4 -0
- package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +127 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/bad/prose.md +15 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/good/prose.md +21 -0
- package/payload/canon-kit/gate-tests/check-prose-tells/good/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-spec-derivable-section/bad/SPEC.md +20 -0
- package/payload/canon-kit/gate-tests/check-spec-derivable-section/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-derivable-section/good/SPEC.md +13 -0
- package/payload/canon-kit/gate-tests/check-spec-derivable-section/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton/bad/SPEC.md +15 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton/good/SPEC.md +13 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +63 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/SPEC.md +16 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/widget.sh +9 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC.md +19 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/widget.sh +9 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/args +1 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/doc.md +8 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/args +1 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/doc.md +9 -0
- package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/README.md +4 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-target.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/cand-tmpl.md +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.sh +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/README.md +4 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-target.md +6 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-widget.md +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/cand-tmpl.md +7 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.sh +5 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +6 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/bad/GLOSSARY.md +11 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/bad/VISION.md +6 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/good/GLOSSARY.md +11 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/good/VISION.md +6 -0
- package/payload/canon-kit/gate-tests/check-surface-duplication/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/TASK-QUEUE.md +19 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.sh +5 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/TASK-QUEUE.md +23 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.sh +5 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/bad/README.md +4 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/bad/args +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/bad/kept.txt +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/good/README.md +7 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/good/args +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/good/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/good/kept.txt +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim/good/roster.list +1 -0
- package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +86 -0
- package/payload/canon-kit/lib/spec.sh +505 -0
- package/payload/canon-kit/smoke/install.sh +36 -0
- package/payload/canon-kit/smoke/violation.sh +22 -0
- package/payload/canon-kit/templates/SPEC-amendment.md +55 -0
- package/payload/canon-kit/templates/canon-config.sh +2 -0
- package/payload/context-kit/README.md +82 -0
- package/payload/context-kit/SPEC.md +790 -0
- package/payload/context-kit/bin/always-loaded.sh +86 -0
- package/payload/context-kit/bin/env-probe.sh +144 -0
- package/payload/context-kit/bin/footprint.sh +144 -0
- package/payload/context-kit/bin/md-index.sh +80 -0
- package/payload/context-kit/bin/md-section.sh +63 -0
- package/payload/context-kit/bin/pub-index.sh +90 -0
- package/payload/context-kit/bin/run-index-tests.sh +91 -0
- package/payload/context-kit/checks/check-brevity.sh +123 -0
- package/payload/context-kit/checks/check-footprint-fresh.sh +38 -0
- package/payload/context-kit/checks/check-memory-off.sh +112 -0
- package/payload/context-kit/checks/check-settings-pins.sh +110 -0
- package/payload/context-kit/gate-tests/check-brevity/bad/CLAUDE.md +14 -0
- package/payload/context-kit/gate-tests/check-brevity/bad/args +2 -0
- package/payload/context-kit/gate-tests/check-brevity/bad/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-brevity/good/CLAUDE.md +20 -0
- package/payload/context-kit/gate-tests/check-brevity/good/args +2 -0
- package/payload/context-kit/gate-tests/check-brevity/good/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-brevity.test.sh +89 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/bad/args +4 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/bad/emit.txt +12 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/bad/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/bad/projection.txt +11 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/args +4 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/emit.txt +12 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-footprint-fresh/good/projection.txt +12 -0
- package/payload/context-kit/gate-tests/check-memory-off/bad/args +1 -0
- package/payload/context-kit/gate-tests/check-memory-off/bad/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-memory-off/bad/memory/example-fact.md +6 -0
- package/payload/context-kit/gate-tests/check-memory-off/good/args +1 -0
- package/payload/context-kit/gate-tests/check-memory-off/good/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-memory-off/good/memory/.gitkeep +0 -0
- package/payload/context-kit/gate-tests/check-memory-off.test.sh +54 -0
- package/payload/context-kit/gate-tests/check-settings-pins/bad/args +1 -0
- package/payload/context-kit/gate-tests/check-settings-pins/bad/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-settings-pins/bad/settings-pins.conf +3 -0
- package/payload/context-kit/gate-tests/check-settings-pins/bad/settings.json +6 -0
- package/payload/context-kit/gate-tests/check-settings-pins/good/args +1 -0
- package/payload/context-kit/gate-tests/check-settings-pins/good/expect.txt +1 -0
- package/payload/context-kit/gate-tests/check-settings-pins/good/settings-pins.conf +3 -0
- package/payload/context-kit/gate-tests/check-settings-pins/good/settings.json +6 -0
- package/payload/context-kit/index-tests/corpus/baseline.txt +2 -0
- package/payload/context-kit/index-tests/corpus/hook-sample.txt +4 -0
- package/payload/context-kit/index-tests/corpus/sample.md +23 -0
- package/payload/context-kit/index-tests/corpus/sample.rs +24 -0
- package/payload/context-kit/index-tests/corpus/sample.ts +34 -0
- package/payload/context-kit/index-tests/corpus/surface.md +6 -0
- package/payload/context-kit/index-tests/expected/always-loaded.txt +1 -0
- package/payload/context-kit/index-tests/expected/md-index.txt +6 -0
- package/payload/context-kit/index-tests/expected/md-section.txt +6 -0
- package/payload/context-kit/index-tests/expected/pub-index-shadow.txt +2 -0
- package/payload/context-kit/index-tests/expected/pub-index-ts.txt +12 -0
- package/payload/context-kit/index-tests/expected/pub-index.txt +10 -0
- package/payload/context-kit/index-tests/expected/toolfloor.txt +14 -0
- package/payload/context-kit/index-tests/toolfloor-cases.sh +29 -0
- package/payload/context-kit/lib/pub-lang/rust.sh +26 -0
- package/payload/context-kit/lib/pub-lang/ts.sh +32 -0
- package/payload/context-kit/lib/toolfloor.sh +47 -0
- package/payload/context-kit/smoke/agents-md.sh +116 -0
- package/payload/context-kit/smoke/install.sh +60 -0
- package/payload/context-kit/smoke/violation.sh +21 -0
- package/payload/context-kit/templates/close-brevity.md +30 -0
- package/payload/context-kit/templates/context-config.sh +2 -0
- package/payload/context-kit/templates/session-context.sh +133 -0
- package/payload/context-kit/templates/settings-sessionstart.json +12 -0
- package/payload/delegation-kit/README.md +87 -0
- package/payload/delegation-kit/SPEC.md +792 -0
- package/payload/delegation-kit/bin/run-budget-guard-tests.sh +88 -0
- package/payload/delegation-kit/bin/run-trend-tests.sh +63 -0
- package/payload/delegation-kit/bin/run-usage-tests.sh +226 -0
- package/payload/delegation-kit/bin/usage-trend.sh +120 -0
- package/payload/delegation-kit/bin/usage-verdict.sh +144 -0
- package/payload/delegation-kit/checks/check-gate-tamper.sh +139 -0
- package/payload/delegation-kit/checks/check-rule-citation.sh +76 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/args +1 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/expect.txt +1 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/staged-files +5 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/good/added-exemptions +2 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/good/args +1 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/good/expect.txt +1 -0
- package/payload/delegation-kit/gate-tests/check-gate-tamper/good/staged-files +5 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/bad/args +1 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/bad/expect.txt +1 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/bad/spec.md +9 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/bad/tmpl.md +4 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/good/args +1 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/good/expect.txt +1 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/good/spec.md +20 -0
- package/payload/delegation-kit/gate-tests/check-rule-citation/good/tmpl.md +5 -0
- package/payload/delegation-kit/lib/delegation.sh +81 -0
- package/payload/delegation-kit/smoke/install.sh +61 -0
- package/payload/delegation-kit/smoke/violation.sh +16 -0
- package/payload/delegation-kit/templates/agent-budget-guard.sh +18 -0
- package/payload/delegation-kit/templates/agent-execution.md +136 -0
- package/payload/delegation-kit/templates/delegation-config.sh +2 -0
- package/payload/delegation-kit/templates/dispatch-checklists.md +60 -0
- package/payload/delegation-kit/templates/statusline-usage.sh +79 -0
- package/payload/delegation-kit/templates/usage-poller.sh +67 -0
- package/payload/delegation-kit/usage-tests/budget-guard-cases.tsv +20 -0
- package/payload/delegation-kit/usage-tests/cases.tsv +44 -0
- package/payload/delegation-kit/usage-tests/trend-history.log +20 -0
- package/payload/doctrine-kit/DOCTRINE.md +386 -0
- package/payload/doctrine-kit/README.md +70 -0
- package/payload/doctrine-kit/SPEC.md +233 -0
- package/payload/doctrine-kit/bin/install-doctrine.sh +44 -0
- package/payload/doctrine-kit/bin/stage-rules.sh +51 -0
- package/payload/doctrine-kit/checks/check-doctrine-registration.sh +216 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/AGENT.md +14 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/DOCTRINE.md +12 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/args +1 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/expect.txt +1 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/AGENT.md +15 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/DOCTRINE.md +12 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/args +1 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/expect.txt +1 -0
- package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +208 -0
- package/payload/doctrine-kit/lib/doctrine.sh +29 -0
- package/payload/doctrine-kit/smoke/install.sh +24 -0
- package/payload/doctrine-kit/smoke/violation.sh +13 -0
- package/payload/drift-kit/README.md +115 -0
- package/payload/drift-kit/SPEC.md +881 -0
- package/payload/drift-kit/bin/drift-report.sh +155 -0
- package/payload/drift-kit/bin/kfric.sh +42 -0
- package/payload/drift-kit/bin/overhead-meter.sh +106 -0
- package/payload/drift-kit/bin/stage-economics.sh +311 -0
- package/payload/drift-kit/bin/trajectory.sh +242 -0
- package/payload/drift-kit/kpis/kpi-always-loaded.sh +39 -0
- package/payload/drift-kit/kpis/kpi-amendment-age.sh +33 -0
- package/payload/drift-kit/kpis/kpi-deferred-age.sh +46 -0
- package/payload/drift-kit/kpis/kpi-gate-backlog.sh +52 -0
- package/payload/drift-kit/kpis/kpi-gate-runtime.sh +31 -0
- package/payload/drift-kit/kpis/kpi-knowledge-friction.sh +21 -0
- package/payload/drift-kit/kpis/kpi-overhead.sh +44 -0
- package/payload/drift-kit/kpis/kpi-price-table-age.sh +68 -0
- package/payload/drift-kit/kpis/kpi-prompt-friction.sh +38 -0
- package/payload/drift-kit/kpis/kpi-queue-net-delta.sh +74 -0
- package/payload/drift-kit/kpis/kpi-settings-local.sh +21 -0
- package/payload/drift-kit/kpis/kpi-task-split.sh +43 -0
- package/payload/drift-kit/smoke/install.sh +348 -0
- package/payload/drift-kit/smoke/overhead-fixture.jsonl +4 -0
- package/payload/drift-kit/templates/close-knowledge.md +24 -0
- package/payload/drift-kit/templates/drift-config.sh +2 -0
- package/payload/drift-kit/templates/economics.md +45 -0
- package/payload/drift-kit/templates/kpi-deprecated-surface.sh +32 -0
- package/payload/drift-kit/templates/kpis.list +22 -0
- package/payload/drift-kit/templates/price-table.tsv +21 -0
- package/payload/evidence-kit/README.md +59 -0
- package/payload/evidence-kit/SPEC.md +261 -0
- package/payload/evidence-kit/bin/diff-baseline.sh +34 -0
- package/payload/evidence-kit/bin/run-validate.sh +82 -0
- package/payload/evidence-kit/checks/check-evidence-baseline.sh +103 -0
- package/payload/evidence-kit/checks/check-evidence-manifest.sh +104 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/TASK-QUEUE.md +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/args +2 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/validate-baseline.txt +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/TASK-QUEUE.md +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/args +2 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/validate-baseline.txt +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +84 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/TASK-QUEUE.md +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/WORKFLOW-STATE.txt +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/args +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/validate-evidence.txt +2 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/TASK-QUEUE.md +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/WORKFLOW-STATE.txt +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/args +3 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/validate-evidence.txt +2 -0
- package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +107 -0
- package/payload/evidence-kit/gate-tests/evidence-lib.test.sh +82 -0
- package/payload/evidence-kit/lib/evidence.sh +173 -0
- package/payload/evidence-kit/smoke/install.sh +45 -0
- package/payload/evidence-kit/smoke/violation.sh +8 -0
- package/payload/evidence-kit/templates/evidence-config.sh +2 -0
- package/payload/gate-sdk/README.md +124 -0
- package/payload/gate-sdk/SPEC.md +1876 -0
- package/payload/gate-sdk/bin/enforcement-map.sh +272 -0
- package/payload/gate-sdk/bin/gen-pre-commit.sh +267 -0
- package/payload/gate-sdk/bin/install-hooks.sh +48 -0
- package/payload/gate-sdk/bin/run-consumer-smoke.sh +112 -0
- package/payload/gate-sdk/bin/run-gate-tests.sh +128 -0
- package/payload/gate-sdk/bin/run-gates.sh +147 -0
- package/payload/gate-sdk/bin/upgrade-smoke.sh +163 -0
- package/payload/gate-sdk/checks/check-action-pinning.sh +55 -0
- package/payload/gate-sdk/checks/check-action-run-shell.sh +219 -0
- package/payload/gate-sdk/checks/check-assertion-strength.sh +134 -0
- package/payload/gate-sdk/checks/check-commit-msg.sh +50 -0
- package/payload/gate-sdk/checks/check-commit-subject.sh +43 -0
- package/payload/gate-sdk/checks/check-core-files.sh +52 -0
- package/payload/gate-sdk/checks/check-enforcement-fresh.sh +37 -0
- package/payload/gate-sdk/checks/check-exec-bit.sh +76 -0
- package/payload/gate-sdk/checks/check-gate-assertions.sh +123 -0
- package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +106 -0
- package/payload/gate-sdk/checks/check-gate-fail-closed.sh +84 -0
- package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +92 -0
- package/payload/gate-sdk/checks/check-gate-output.sh +65 -0
- package/payload/gate-sdk/checks/check-graph.sh +632 -0
- package/payload/gate-sdk/checks/check-hook-exec-bit.sh +45 -0
- package/payload/gate-sdk/checks/check-identity.sh +134 -0
- package/payload/gate-sdk/checks/check-kit-enum.sh +94 -0
- package/payload/gate-sdk/checks/check-kit-registration.sh +68 -0
- package/payload/gate-sdk/checks/check-readme-roster.sh +102 -0
- package/payload/gate-sdk/checks/check-reads-couples.sh +148 -0
- package/payload/gate-sdk/checks/check-root-tiering.sh +66 -0
- package/payload/gate-sdk/checks/check-shellcheck.sh +55 -0
- package/payload/gate-sdk/checks/check-smoke-entry-guard.sh +53 -0
- package/payload/gate-sdk/checks/check-template-copy-parity.sh +126 -0
- package/payload/gate-sdk/checks/check-test-hermetic.sh +119 -0
- package/payload/gate-sdk/checks/check-tree-terms.sh +61 -0
- package/payload/gate-sdk/checks/check-workflow-tiering.sh +84 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/bad/tree/mutable.yml +11 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/bad/tree/nested/pinned.yml +5 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/nested/deep.yml +5 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/no-refs.yaml +8 -0
- package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/pinned.yml +10 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/args +3 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/tree/workflows/ci.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/action.yml +14 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/not-actions.yml +16 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/workflows/ci.yml +106 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +88 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/args +3 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/bin/verdict.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/smoke/install.sh +11 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/good/bin/verdict.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-assertion-strength/good/smoke/install.sh +16 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/bad/args +2 -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 +5 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/bad/patterns.list +5 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/good/msg.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-commit-msg/good/patterns.list +5 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/bad/msg.txt +4 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject/good/msg.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +73 -0
- package/payload/gate-sdk/gate-tests/check-core-files/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/bad/core-files.list +3 -0
- package/payload/gate-sdk/gate-tests/check-core-files/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/bad/present.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/good/core-files.list +5 -0
- package/payload/gate-sdk/gate-tests/check-core-files/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/good/nested/also-present.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-core-files/good/present.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/emit.txt +14 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/projection.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/args +4 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/emit.txt +14 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/projection.txt +14 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/bad/dump.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/good/dump.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +46 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/SPEC.md +13 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-baz.sh +13 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-foo.sh +10 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +20 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-baz.sh +12 -0
- package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-foo.sh +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +11 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/TASK-QUEUE.md +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/gates/check-sample.sh +11 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/gates/check-sample.sh +8 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/gates/check-sample.sh +8 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/check-gamma.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gate-tests/check-alpha/bad/.keep +0 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gate-tests/check-alpha/good/.keep +0 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/check-beta.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gate-tests/check-alpha/bad/.keep +0 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gate-tests/check-alpha/good/.keep +0 -0
- package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gates.list +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/gates.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +9 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +12 -0
- package/payload/gate-sdk/gate-tests/check-graph/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-example-gate.md +20 -0
- package/payload/gate-sdk/gate-tests/check-graph/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-graph/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +51 -0
- package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +55 -0
- package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +63 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/hooks/pre-commit +2 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/hooks/pre-commit +2 -0
- package/payload/gate-sdk/gate-tests/check-identity/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/bad/git-config-email +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/bad/git-remotes +2 -0
- package/payload/gate-sdk/gate-tests/check-identity/bad/identity.conf +4 -0
- package/payload/gate-sdk/gate-tests/check-identity/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/good/git-config-email +1 -0
- package/payload/gate-sdk/gate-tests/check-identity/good/git-remotes +3 -0
- package/payload/gate-sdk/gate-tests/check-identity/good/identity.conf +5 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/bad/check-sample.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/bad/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/good/check-sample.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-enum/good/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration/bad/registry-doc.md +20 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration/good/args +5 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +75 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/README.md +14 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/checks/check-alpha-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/checks/check-alpha-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/gamma-kit/README.md +5 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/gamma-kit/checks/check-gamma-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/README.md +16 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/checks/check-alpha-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/checks/check-alpha-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +6 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/beta-kit/smoke/install.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/corpus/sub/deep.md +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/corpus/top.md +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/bad/sandbox-gate.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/corpus/sub/deep.md +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/corpus/top.md +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples/good/sandbox-gate.sh +8 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/bad/allow.list +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/bad/root/README.md +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/bad/root/stray.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/allow.list +3 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/LICENSE +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/README.md +1 -0
- package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/somedir/keep.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/bad/args +1 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/bad/warn.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/good/args +1 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-shellcheck/good/ok.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/install.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/violation.sh +7 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/install.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/violation.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/args +6 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/beta-kit/smoke/install.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/args +9 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/delegation-kit/templates/agent-budget-guard.sh +16 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/scripts/agent-budget-guard.sh +17 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/args +8 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/agent-budget-guard.sh +16 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/delegation-config.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/usage-poller.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/agent-budget-guard.sh +16 -0
- package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/delegation-config.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/args +3 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/leaky.test.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/good/args +3 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/good/exempt.test.sh +4 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic/good/sourced.test.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +84 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/args +2 -0
- 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 +3 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/leak.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +3 -0
- package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/clean.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/.workflow/payload.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/.workflow/projection.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/.workflow/projection.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/.workflow/wire.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +87 -0
- package/payload/gate-sdk/gate-tests/lib-gate.test.sh +78 -0
- package/payload/gate-sdk/gate-tests/run-for-path.test.sh +77 -0
- package/payload/gate-sdk/lib/consumer-smoke.sh +32 -0
- package/payload/gate-sdk/lib/gate.sh +216 -0
- package/payload/gate-sdk/lib/inject.sh +35 -0
- package/payload/gate-sdk/lib/test-hermetic.sh +11 -0
- package/payload/gate-sdk/smoke/install.sh +84 -0
- package/payload/gate-sdk/smoke/violation.sh +13 -0
- package/payload/gate-sdk/templates/check-skeleton.sh +23 -0
- package/payload/gate-sdk/templates/gates-workflow.yml +55 -0
- package/payload/gate-sdk/templates/msg-patterns.list +21 -0
- package/payload/guard-kit/README.md +65 -0
- package/payload/guard-kit/SPEC.md +590 -0
- package/payload/guard-kit/bin/compare-settings-allow.sh +58 -0
- package/payload/guard-kit/bin/run-guard-tests.sh +86 -0
- package/payload/guard-kit/bin/scan-prompts.sh +166 -0
- package/payload/guard-kit/bin/scratch-run.sh +34 -0
- package/payload/guard-kit/gate-tests/scan-prompts.test.sh +70 -0
- package/payload/guard-kit/gate-tests/scratch-run.test.sh +62 -0
- package/payload/guard-kit/guard-tests/cases.tsv +117 -0
- package/payload/guard-kit/guard-tests/escalation-cases.tsv +13 -0
- package/payload/guard-kit/lib/guard.sh +448 -0
- package/payload/guard-kit/smoke/install.sh +26 -0
- package/payload/guard-kit/templates/bash-guard.sh +18 -0
- package/payload/guard-kit/templates/close-triage.md +31 -0
- package/payload/guard-kit/templates/escalation-guard.sh +27 -0
- package/payload/guard-kit/templates/guard-config.sh +2 -0
- package/payload/guard-kit/templates/settings-hooks.json +19 -0
- package/payload/guard-kit/templates/wakeup-guard.sh +20 -0
- package/payload/lifecycle-kit/README.md +106 -0
- package/payload/lifecycle-kit/SPEC.md +1492 -0
- package/payload/lifecycle-kit/bin/close-surfaces.sh +94 -0
- package/payload/lifecycle-kit/bin/enter-stage.sh +215 -0
- package/payload/lifecycle-kit/bin/file-gap.sh +43 -0
- package/payload/lifecycle-kit/bin/install-lifecycle.sh +36 -0
- package/payload/lifecycle-kit/bin/session-id.sh +75 -0
- package/payload/lifecycle-kit/checks/check-close-surfaces.sh +63 -0
- package/payload/lifecycle-kit/checks/check-lesson-disposition.sh +98 -0
- package/payload/lifecycle-kit/checks/check-lifecycle-registration.sh +54 -0
- package/payload/lifecycle-kit/checks/check-merge-attrs.sh +69 -0
- package/payload/lifecycle-kit/checks/check-shim-restatement.sh +97 -0
- package/payload/lifecycle-kit/checks/check-skill-binding.sh +59 -0
- package/payload/lifecycle-kit/checks/check-stage-entry.sh +197 -0
- package/payload/lifecycle-kit/checks/check-stage-evidence.sh +81 -0
- package/payload/lifecycle-kit/checks/check-stage-skill-coverage.sh +47 -0
- package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +96 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/owners/inbox.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.sh +4 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/owners/inbox.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.sh +4 -0
- package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +66 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/evidence.txt +2 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/queue-head.md +8 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/queue-work.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/evidence.txt +3 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/queue-head.md +8 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/queue-work.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +56 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/AGENT.md +11 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/AGENT.md +11 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +59 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +6 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +5 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +113 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/commands/build.md +6 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/corpus.md +4 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/commands/build.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/corpus.md +4 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +80 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/commands/build.md +5 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/templates/build.md +7 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/commands/build.md +7 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/templates/build.md +7 -0
- package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +84 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/.workflow/WORKFLOW-STATE.txt +7 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/TASK-QUEUE.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/.workflow/WORKFLOW-STATE.txt +7 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/TASK-QUEUE.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +251 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/.workflow/WORKFLOW-STATE.txt +6 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/TASK-QUEUE.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/.workflow/WORKFLOW-STATE.txt +6 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/TASK-QUEUE.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +115 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/align.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/build.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/scope.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/validate.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/args +1 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/align.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/build.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/close.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/scope.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/validate.md +2 -0
- package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/expect.txt +1 -0
- package/payload/lifecycle-kit/lib/stages.sh +179 -0
- package/payload/lifecycle-kit/smoke/install.sh +341 -0
- package/payload/lifecycle-kit/smoke/violation.sh +8 -0
- package/payload/lifecycle-kit/templates/lead.md +271 -0
- package/payload/lifecycle-kit/templates/lifecycle-config.sh +2 -0
- package/payload/lifecycle-kit/templates/release-sweep.md +39 -0
- package/payload/lifecycle-kit/templates/stages/align.md +65 -0
- package/payload/lifecycle-kit/templates/stages/build.md +78 -0
- package/payload/lifecycle-kit/templates/stages/close.md +122 -0
- package/payload/lifecycle-kit/templates/stages/scope.md +112 -0
- package/payload/lifecycle-kit/templates/stages/spec.md +91 -0
- package/payload/lifecycle-kit/templates/stages/validate.md +54 -0
- package/payload/lifecycle-kit/templates/upgrade.md +41 -0
- package/payload/queue-kit/README.md +78 -0
- package/payload/queue-kit/SPEC.md +797 -0
- package/payload/queue-kit/bin/lesson-sink.sh +28 -0
- package/payload/queue-kit/bin/queue-index.sh +182 -0
- package/payload/queue-kit/bin/roadmap.sh +76 -0
- package/payload/queue-kit/checks/check-queue-entry-budget.sh +104 -0
- package/payload/queue-kit/checks/check-queue-hygiene.sh +81 -0
- package/payload/queue-kit/checks/check-queue-prose-precondition.sh +63 -0
- package/payload/queue-kit/checks/check-queue-sections.sh +44 -0
- package/payload/queue-kit/checks/check-queue-slug-liveness.sh +63 -0
- package/payload/queue-kit/checks/check-queue-wrap.sh +56 -0
- package/payload/queue-kit/checks/check-roadmap-fresh.sh +110 -0
- package/payload/queue-kit/checks/check-tag-lead-line.sh +70 -0
- package/payload/queue-kit/checks/check-task-conservation.sh +50 -0
- package/payload/queue-kit/checks/check-task-names.sh +128 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +33 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +4 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.sh +6 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +35 -0
- package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.sh +6 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/TASK-QUEUE.md +17 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +25 -0
- package/payload/queue-kit/gate-tests/check-queue-hygiene/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/TASK-QUEUE.md +15 -0
- 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 +25 -0
- package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-sections/bad/TASK-QUEUE.md +13 -0
- package/payload/queue-kit/gate-tests/check-queue-sections/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-sections/good/TASK-QUEUE.md +15 -0
- package/payload/queue-kit/gate-tests/check-queue-sections/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/TASK-QUEUE.md +17 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/docs/page.md +4 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.sh +3 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/TASK-QUEUE.md +19 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/page.md +5 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.sh +3 -0
- package/payload/queue-kit/gate-tests/check-queue-wrap/bad/TASK-QUEUE.md +15 -0
- package/payload/queue-kit/gate-tests/check-queue-wrap/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-queue-wrap/good/TASK-QUEUE.md +25 -0
- package/payload/queue-kit/gate-tests/check-queue-wrap/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/TASK-QUEUE.md +24 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/args +5 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/emit.txt +8 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/projection.txt +16 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.sh +6 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/TASK-QUEUE.md +22 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/args +5 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/emit.txt +7 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/projection.txt +16 -0
- package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.sh +6 -0
- package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/TASK-QUEUE.md +25 -0
- package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/expect.txt +2 -0
- package/payload/queue-kit/gate-tests/check-tag-lead-line/good/TASK-QUEUE.md +30 -0
- package/payload/queue-kit/gate-tests/check-tag-lead-line/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-task-names/bad/TASK-QUEUE.md +18 -0
- package/payload/queue-kit/gate-tests/check-task-names/bad/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/check-task-names/good/TASK-QUEUE.md +25 -0
- package/payload/queue-kit/gate-tests/check-task-names/good/expect.txt +1 -0
- package/payload/queue-kit/gate-tests/queue-index.test.sh +159 -0
- package/payload/queue-kit/gate-tests/roadmap.test.sh +197 -0
- package/payload/queue-kit/lib/queue.sh +193 -0
- package/payload/queue-kit/smoke/install.sh +22 -0
- package/payload/queue-kit/smoke/violation.sh +8 -0
- package/payload/queue-kit/templates/TASK-QUEUE.md +43 -0
- package/payload/queue-kit/templates/queue-config.sh +2 -0
- package/payload/site-kit/README.md +61 -0
- package/payload/site-kit/SPEC.md +269 -0
- package/payload/site-kit/checks/check-docs-cname-parity.sh +80 -0
- package/payload/site-kit/checks/check-docs-render-fidelity.sh +167 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +4 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/site-config.sh +7 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/tree/CNAME +1 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/tree/README.md +5 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +5 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/site-config.sh +7 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/CNAME +1 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/docs/posts/2026-01-01-legacy.md +4 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/index.md +4 -0
- package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/pkg/gate-tests/fixture.md +5 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/args +8 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/tree/docs/install.md +38 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/args +6 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/expect.txt +1 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/tree/docs/install.md +35 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-foreign.test.sh +87 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-span.test.sh +80 -0
- package/payload/site-kit/gate-tests/check-docs-render-fidelity-table.test.sh +90 -0
- package/payload/site-kit/lib/site.sh +29 -0
- package/payload/site-kit/smoke/install.sh +26 -0
- package/payload/site-kit/smoke/violation.sh +20 -0
- package/payload/site-kit/templates/site-health.yml +164 -0
- package/profiles.list +53 -0
|
@@ -0,0 +1,792 @@
|
|
|
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
|
+
`templates/agent-budget-guard.sh` closes the gap the template's
|
|
45
|
+
**Budget-check before *each* dispatch in a fan-out** rule leaves when it relies
|
|
46
|
+
on the agent *choosing* to run the tool: a memory-quoted percentage acts in its
|
|
47
|
+
place (a session quoted ~5% while the live verdict read 29%). It is a `PreToolUse` hook (matcher `Agent`) the
|
|
48
|
+
harness fires on every dispatch once the consumer registers it in settings —
|
|
49
|
+
per-dispatch freshness, not a start-of-session reading a mid-session window
|
|
50
|
+
outlives. It runs `usage-verdict` at the decision point and routes on the exit
|
|
51
|
+
code:
|
|
52
|
+
|
|
53
|
+
- **PAUSE (1)** → `guard_block`: the verdict line plus its corrective (wait for
|
|
54
|
+
the window reset, or re-run with `DELEGATION_KIT_PAUSE_PCT` deliberately
|
|
55
|
+
raised). This is guard-kit's one sanctioned fail-closed deny — the hook
|
|
56
|
+
matcher proves the tool identity and PAUSE is reachable only through a fresh,
|
|
57
|
+
readable, over-threshold snapshot, so blocking cannot wedge a consumer with
|
|
58
|
+
no producer.
|
|
59
|
+
- **STALE / unreadable (2)** and **OK / RESET-OK (0)** → `guard_advise`,
|
|
60
|
+
feeding the verdict line back as `additionalContext` so the live reading
|
|
61
|
+
rides in context at every dispatch and a memory-quoted percentage can never
|
|
62
|
+
be the acting source. The advise arm relays that line and adds nothing: the
|
|
63
|
+
verdict string carries its own decision consequence (§usage-verdict), so
|
|
64
|
+
restating it on the arm would be one fact in two places. Routing STALE to
|
|
65
|
+
advice rather than out of delegation is what keeps a consumer with no
|
|
66
|
+
snapshot producer working — budget-unknown is decision-relevant, never
|
|
67
|
+
disqualifying.
|
|
68
|
+
|
|
69
|
+
The harness is the producer (it fires the hook once the settings registration
|
|
70
|
+
is set); the consumers are the dispatching agent, which reads the verdict line
|
|
71
|
+
off `additionalContext` at the dispatch-decision transition, and the
|
|
72
|
+
supervising user, who consumes a block by ruling — raise the knob or wait; the
|
|
73
|
+
agent never overrides. delegation-kit owns the verdict, its thresholds, and the
|
|
74
|
+
routing; guard-kit supplies only the framework primitives (its second
|
|
75
|
+
consumer). Registration is the opt-in valve: a consumer wanting pure advice
|
|
76
|
+
does not wire the hook. No new persistent state and no new key on the
|
|
77
|
+
`usage.txt` contract — the verdict line is the only interface.
|
|
78
|
+
|
|
79
|
+
A knob-raise ruling has one working transport in this harness: the settings
|
|
80
|
+
env block (`.claude/settings.local.json`), which hooks re-read per fire — the
|
|
81
|
+
raised `DELEGATION_KIT_PAUSE_PCT` reaches the guard on the next dispatch with
|
|
82
|
+
no restart, and deleting the entry afterwards restores the default just as
|
|
83
|
+
immediately. A Bash-tool inline `export` never reaches the hook (the hook
|
|
84
|
+
process does not inherit the tool's shell), so it is not an override path.
|
|
85
|
+
Propagation is asymmetric within a live session: the hook re-reads the file
|
|
86
|
+
per fire, but the Bash tool environment retains an injected value after the
|
|
87
|
+
entry is deleted until the session restarts — an in-session `usage-verdict`
|
|
88
|
+
run and a hook fire can judge against different thresholds in that window, so
|
|
89
|
+
the hook's verdict line, not an in-session re-run, is the acting reading.
|
|
90
|
+
|
|
91
|
+
### One template, a resident pointer
|
|
92
|
+
|
|
93
|
+
`templates/agent-execution.md` is the single source for the protocol — a
|
|
94
|
+
binding-shim *template* in lifecycle-kit's grammar (lifecycle-kit/SPEC.md
|
|
95
|
+
§check-skill-binding). The consumer creates `.claude/commands/agent-execution.md`
|
|
96
|
+
as a shim that names the template and binds its two slots — the shared-file
|
|
97
|
+
roster and the validate battery — the consumer-specialization discipline of
|
|
98
|
+
guard-kit's consumer-rules block, now carried by the slot/binding mechanism the
|
|
99
|
+
lifecycle skills already use. `check-skill-binding` enforces the slot pairing on
|
|
100
|
+
the consumer side.
|
|
101
|
+
|
|
102
|
+
A spec reference to one of those rules uses the citation grammar
|
|
103
|
+
`the template's **<name>** rule`, where `<name>` is a bullet's bold lead-in
|
|
104
|
+
verbatim minus its trailing period; `check-rule-citation` resolves every such
|
|
105
|
+
citation in §The delegation model forward into the template, so a lead-in
|
|
106
|
+
rename cannot silently dangle a reference.
|
|
107
|
+
|
|
108
|
+
`templates/dispatch-checklists.md` is a second, load-triggered template the
|
|
109
|
+
protocol template reaches by a single pointer line: `agent-execution.md` names
|
|
110
|
+
it for a deletion, rename, or heavy cross-spec audit dispatch, and it loads only
|
|
111
|
+
then — never resident, and not a binding shim (it binds no slots, so
|
|
112
|
+
`check-skill-binding` does not scan it). It carries the mechanical pre-flight for
|
|
113
|
+
those dispatch shapes — the importer/collision/sweep-verification checks — while
|
|
114
|
+
the protocol proper stays whole in `agent-execution.md`; the pointer-line
|
|
115
|
+
contract is that the protocol template stays complete alone and the checklists
|
|
116
|
+
are a reach-through, so the width, journal, and validate rules live once in the
|
|
117
|
+
protocol template and are cited from the checklists, never restated. This is the
|
|
118
|
+
load-trigger-residency rule applied a rung deeper: even inside a load-triggered
|
|
119
|
+
template, a subset that only a narrower trigger (a deletion or rename dispatch)
|
|
120
|
+
needs sits behind its own pointer.
|
|
121
|
+
|
|
122
|
+
The consumer's CLAUDE.md carries no digest of the bullets, only a resident
|
|
123
|
+
pointer: the pre-authorization sentence (consumer judgment on what delegation
|
|
124
|
+
needs no ask) and `/agent-execution`. Rationale: a rule is resident only when it
|
|
125
|
+
has no load trigger (the load-trigger-residency doctrine), and every protocol
|
|
126
|
+
bullet triggers at `Agent` dispatch — which already has a mechanical seam, the
|
|
127
|
+
per-dispatch budget guard, whose block message names `/agent-execution`. The
|
|
128
|
+
doctrine lives behind the trigger, not in the always-loaded file. Honest limit:
|
|
129
|
+
the guard enforces budget mechanically, not protocol literacy — a session that
|
|
130
|
+
dispatches without invoking the skill carries only the resident pointer.
|
|
131
|
+
|
|
132
|
+
## Resume journal — agent writes, supervisor deletes
|
|
133
|
+
|
|
134
|
+
A mutating agent `Write`s a running progress journal (findings triaged,
|
|
135
|
+
edits applied, what remains) to a repo-local gitignored scratch directory
|
|
136
|
+
in the main checkout — never a temporary worktree (a worktree-isolated
|
|
137
|
+
agent's own tree is deleted with the worktree, taking the journal) nor a
|
|
138
|
+
system temp dir (a restart wipes tmpfs). The supervisor names that path
|
|
139
|
+
**absolute into the main checkout** in the dispatch prompt, so a
|
|
140
|
+
worktree-isolated agent writes to the surviving checkout, not its doomed
|
|
141
|
+
tree. Repo-dir-local scratch is reboot-survivable, cheap to clean, and
|
|
142
|
+
predictable across coding agents. The agent updates the journal as it
|
|
143
|
+
goes; on success it appends a `DONE` marker. Each finding lands in the journal *inline as it is
|
|
144
|
+
confirmed* — never "see final output": the agent's return message dies with
|
|
145
|
+
the session, so a pointer-only journal makes `DONE` lie about
|
|
146
|
+
recoverability. Agents have no `rm`; the supervisor deletes the journal at
|
|
147
|
+
the post-commit validation checkpoint. Whether a journal *without* `DONE`
|
|
148
|
+
signals interruption turns on whether the supervisor consumed the agent's
|
|
149
|
+
return. On the ordinary completion path the supervisor received the return and
|
|
150
|
+
ran its post-commit verification (§Validate after every agent commit); that
|
|
151
|
+
return plus the verification *is* the recovery contract, attesting completion
|
|
152
|
+
directly, so the `DONE` marker is redundant and a journal without it does
|
|
153
|
+
**not** imply interruption. Only in a **cold read** — the supervisor finds a
|
|
154
|
+
journal but never consumed a return, the agent's session having died before
|
|
155
|
+
returning (a background sandbox died, a crash, a timeout) — is the marker the
|
|
156
|
+
sole signal, and there the original reading holds: no `DONE` = interrupted,
|
|
157
|
+
resume from it. The inline-findings rule above is exactly that cold arm's
|
|
158
|
+
insurance — with no surviving return, a pointer-only journal would make a
|
|
159
|
+
would-be `DONE` lie about recoverability.
|
|
160
|
+
|
|
161
|
+
**Caveat — the sandbox may block the journal write.** Background agents
|
|
162
|
+
have been observed unable to `Write` to the granted path, silently falling
|
|
163
|
+
back to returning findings in the final message — which defeats the journal
|
|
164
|
+
exactly when it matters (a long, interruptible run). So: for a read-only
|
|
165
|
+
fan-out the return value *is* the contract — no journal; for mutating
|
|
166
|
+
agents, grant the journal path explicitly before dispatch rather than
|
|
167
|
+
assuming the write succeeds.
|
|
168
|
+
|
|
169
|
+
## Validate after every agent commit
|
|
170
|
+
|
|
171
|
+
Re-run the relevant gates plus the consumer's validate battery (for this
|
|
172
|
+
repo and any gate-sdk consumer: `bash gate-sdk/bin/run-gates.sh` and the
|
|
173
|
+
kit fixture runners; a toolchain consumer adds its compile/lint/test set in
|
|
174
|
+
the template's marked section, including a zero-byte-file sweep after
|
|
175
|
+
renames — silent edit corruption is real). **Diff every gate change in an
|
|
176
|
+
agent commit before accepting**: an agent blocked by a gate will weaken it
|
|
177
|
+
(a false exemption) rather than fix the code — "the gate is in my way"
|
|
178
|
+
almost always means the code doesn't fit the convention.
|
|
179
|
+
|
|
180
|
+
`check-gate-tamper` is the mechanical floor under that duty. Two
|
|
181
|
+
assertions, blocking the two attested tamper shapes:
|
|
182
|
+
|
|
183
|
+
- **A — gate-edit isolation.** A commit that touches a gate file (the
|
|
184
|
+
`DELEGATION_KIT_GATE_FILES` globs) may touch only meta-layer paths
|
|
185
|
+
(`DELEGATION_KIT_META_PATHS` prefixes + root `*.md`); co-staging product
|
|
186
|
+
code with a gate edit is blocked. Split the gate change into its own
|
|
187
|
+
commit.
|
|
188
|
+
- **B — no self-serving exemption.** A newly added path/glob entry in any
|
|
189
|
+
gate's `# exception-list:` array must not match a file staged in the same
|
|
190
|
+
commit — an exemption never excuses the very change it lands with.
|
|
191
|
+
|
|
192
|
+
**Honest limit:** the gate blocks by commit *shape*; it does not catch
|
|
193
|
+
semantic weakening inside a legitimate scripts-only commit — the by-eye
|
|
194
|
+
diff review of agent gate edits remains a supervisor duty. `--fixture <dir>`
|
|
195
|
+
injects `staged-files` / `added-exemptions` lists (fixture-pair test
|
|
196
|
+
capability); live mode reads `git diff --cached`.
|
|
197
|
+
|
|
198
|
+
## usage-verdict
|
|
199
|
+
|
|
200
|
+
Emits a trustworthy budget verdict from a usage snapshot file, closing the
|
|
201
|
+
three failure modes a raw percentage reading leaves open:
|
|
202
|
+
|
|
203
|
+
1. **Stale reading** — `now - updated_at` beyond `DELEGATION_KIT_STALE_AGE` → STALE
|
|
204
|
+
(exit 2): budget-unknown, never blocking delegation — re-read or refresh
|
|
205
|
+
before trusting the number.
|
|
206
|
+
2. **Dead window** — `resets_at <= now` → RESET-OK (exit 0): the percentage
|
|
207
|
+
is from the dead window and must not be read as a pause signal. The
|
|
208
|
+
weekly axis carries the same rule per-axis (`seven_day_resets_at <= now`
|
|
209
|
+
disarms the weekly pause without forcing the whole verdict to RESET-OK —
|
|
210
|
+
the axes are judged independently).
|
|
211
|
+
3. **Post-login lag** — a fresh login starts a new window but the
|
|
212
|
+
server-fed percentage lags it, and the file-write age check cannot see
|
|
213
|
+
that. The gate reads the auth event from the credentials file's mtime
|
|
214
|
+
(`DELEGATION_KIT_LOGIN_WINDOW`) and, within that window, routes a
|
|
215
|
+
would-be OK to STALE (re-read). Letting the lag print OK would emit a
|
|
216
|
+
fresh-looking chimera, since the producer stamps the new account id while
|
|
217
|
+
the percentage and `resets_at` still carry the dead login's window.
|
|
218
|
+
Self-limiting: once the mtime ages out, the reroute stops firing.
|
|
219
|
+
|
|
220
|
+
**The reroute is asymmetric — it may suppress an OK, never a PAUSE.** It
|
|
221
|
+
therefore follows the axis compares rather than preceding them. The two
|
|
222
|
+
directions of a lagging reading have opposite costs: a lagging *low*
|
|
223
|
+
percentage printing OK invites a dispatch the budget may not afford, which
|
|
224
|
+
is what the reroute exists to prevent; a lagging *high* percentage
|
|
225
|
+
suppressed into STALE waves that dispatch through, because STALE is
|
|
226
|
+
advisory and never blocks (§The staleness contract). An unconditional
|
|
227
|
+
reroute closes the first and opens the second, so it must fire on the
|
|
228
|
+
non-blocking outcome only: inside the window an at-or-over reading still
|
|
229
|
+
exits 1 on whichever axis fired, and an under-threshold one still exits 2.
|
|
230
|
+
An account switch swaps both windows, so neither axis escapes the
|
|
231
|
+
suppression when the outcome is a would-be OK.
|
|
232
|
+
|
|
233
|
+
**The mtime is a proxy, and the roll witnesses refute it.** A credentials
|
|
234
|
+
file's mtime cannot distinguish an actual login from a routine OAuth token
|
|
235
|
+
rotation, which rewrites the same file — so every rotation mints a fake
|
|
236
|
+
auth event and blinds the verdict for the window's duration, and rotations
|
|
237
|
+
cluster around long-session resume, exactly when a verdict is being asked
|
|
238
|
+
for. The reroute's *premise* is that a low percentage inside the window is
|
|
239
|
+
a **lagging** reading; when the five-hour window has demonstrably rolled,
|
|
240
|
+
a low percentage is the **expected** reading and the premise is false. Two
|
|
241
|
+
witnesses of a roll are already in hand at that point, and the verdict
|
|
242
|
+
consults both — conjunctively, since either alone is ambiguous:
|
|
243
|
+
|
|
244
|
+
- the snapshot's `five_hour_resets_at` differs from the newest
|
|
245
|
+
`DELEGATION_KIT_USAGE_HISTORY` sample's `resets_at` (the boundary moved);
|
|
246
|
+
- the snapshot's `updated_at` is past that **previous** boundary (time
|
|
247
|
+
actually crossed it, rather than the boundary being restamped by an
|
|
248
|
+
account switch).
|
|
249
|
+
|
|
250
|
+
Both firing disarms the reroute and the reading verdicts on its own merits.
|
|
251
|
+
This makes the verdict path a **reader** of the trend log it already
|
|
252
|
+
appends to; the read is taken before this run's own append, so the witness
|
|
253
|
+
is the previous reading and never this one. It falls open to the
|
|
254
|
+
unrefuted reroute whenever the log cannot answer — knob unset, file absent
|
|
255
|
+
or unreadable, or a tail carrying no numeric `resets_at` — which is the
|
|
256
|
+
pre-existing behavior, so an unconfigured consumer is unchanged. The
|
|
257
|
+
residual limit is honest and named: a rotation with **no** roll still
|
|
258
|
+
blinds the window, because no witness in hand contradicts it; closing that
|
|
259
|
+
needs an account-keyed check against the credential's own identity, not a
|
|
260
|
+
sharper time window.
|
|
261
|
+
|
|
262
|
+
Check order: parse → RESET-OK → age-STALE → pause axes → login-STALE → OK. The
|
|
263
|
+
RESET-OK branch is the same decision one step earlier and is ordering
|
|
264
|
+
precedent for the witnesses: the file already accepts that a demonstrated roll
|
|
265
|
+
outranks the reroute. It covers only a snapshot from an already-dead window;
|
|
266
|
+
the witnesses cover a window that rolled *between* samples, where the
|
|
267
|
+
re-polled snapshot carries a live `resets_at`.
|
|
268
|
+
|
|
269
|
+
Exit codes: **0** OK / RESET-OK, **1** PAUSE, **2** STALE or unreadable. Exit
|
|
270
|
+
2 is fail-closed on *trusting the number* and deliberately fail-open on
|
|
271
|
+
*refusing work* — budget-unknown never blocks delegation — so it is never the
|
|
272
|
+
code a reading that should refuse an expensive dispatch may land on. The bin's
|
|
273
|
+
`# exit:` header declares that mapping, stating exit 2's consequence rather
|
|
274
|
+
than labelling it a bare "fail-closed" (which named only the trust axis and
|
|
275
|
+
read as a claim about the blocking one). That declaration is **machine-read** by
|
|
276
|
+
`check-assertion-strength` (gate-sdk/SPEC.md), which derives the verdict
|
|
277
|
+
vocabulary from it rather than carrying a literal — so the header is a surface
|
|
278
|
+
with a consumer, not loose documentation, and rewording it reshapes what that
|
|
279
|
+
gate can discriminate.
|
|
280
|
+
Fail-closed throughout: missing keys and a non-numeric percentage route to
|
|
281
|
+
STALE; each threshold compare uses `awk`, not integer-only bash
|
|
282
|
+
arithmetic, so a fractional percentage cannot silently skip PAUSE; and both
|
|
283
|
+
pause compares are **at-or-over** (`>=`), so a reading exactly at
|
|
284
|
+
`DELEGATION_KIT_PAUSE_PCT` / `DELEGATION_KIT_PAUSE_PCT_7D` pauses — the
|
|
285
|
+
boundary reading is judged at the
|
|
286
|
+
limit, not under it.
|
|
287
|
+
|
|
288
|
+
**Demand-driven refresh.** The decision point triggers the poll: when
|
|
289
|
+
`DELEGATION_KIT_REFRESH_CMD` is non-empty, `usage-verdict` runs it before
|
|
290
|
+
reading the snapshot, so the budget guard and any verdict caller read live
|
|
291
|
+
data instead of whatever the last statusline render left behind. This closes
|
|
292
|
+
the push producer's blind spot at the point of use — a lead that delegates
|
|
293
|
+
stops rendering exactly when it goes static, and the first live poll proved
|
|
294
|
+
the gap: the snapshot said 2-5% while the endpoint said 28%. Empty (the
|
|
295
|
+
default) keeps the read-only behavior, so an unconfigured consumer's push and
|
|
296
|
+
timer producers are unchanged.
|
|
297
|
+
|
|
298
|
+
The refresh is **short-circuited** by `DELEGATION_KIT_REFRESH_MIN_AGE`: the
|
|
299
|
+
command runs only when the snapshot is missing, unreadable, or its
|
|
300
|
+
`updated_at` age is at least that value. The statusline calls `usage-verdict`
|
|
301
|
+
on every render for trend sampling; without the floor a configured refresh
|
|
302
|
+
would hammer the source on the render path. At dispatch-decision time a
|
|
303
|
+
stale-enough snapshot still polls.
|
|
304
|
+
|
|
305
|
+
It is **fail-soft**: a non-zero refresh exit leaves the snapshot untouched and
|
|
306
|
+
the verdict proceeds on the cached file — the staleness machinery above judges
|
|
307
|
+
its trust, turning a dead producer into a STALE verdict rather than a silent
|
|
308
|
+
green. Refresh diagnostics are suppressed rather than mixed into the verdict
|
|
309
|
+
output, which callers relay verbatim; the snapshot's age is the signal.
|
|
310
|
+
`usage.txt` survives as last-known-good cache, source-agnostic seam, and test
|
|
311
|
+
seam. A refresh inside the `DELEGATION_KIT_LOGIN_WINDOW` rewrites `updated_at` while the
|
|
312
|
+
server-fed percentage may still lag the login by about a minute — the reroute
|
|
313
|
+
correctly keeps those readings STALE for the window's duration, save the
|
|
314
|
+
at-or-over ones it is forbidden to suppress.
|
|
315
|
+
|
|
316
|
+
**The verdict-string contract.** Every line `usage-verdict` emits carries three
|
|
317
|
+
parts: the **reading** (the measured fields), the **epistemic status** of that
|
|
318
|
+
reading (how far to trust the number), and its **decision consequence** for
|
|
319
|
+
delegation (what the reading gates). A verdict string stating a status without
|
|
320
|
+
its consequence is incomplete by contract — the reader completes it by
|
|
321
|
+
inference, and the inference is unconstrained: a session reading a bare STALE
|
|
322
|
+
infers "do not trust the number" into "do not dispatch". That read is wrong
|
|
323
|
+
(STALE never blocks) and is structurally uncorrectable downstream, because the
|
|
324
|
+
budget guard fires *on* dispatch, the act a hesitating session has not yet
|
|
325
|
+
performed. STALE's status half is site-specific — each emission site names why
|
|
326
|
+
it is stale — while its consequence half is uniform, because the consequence is
|
|
327
|
+
uniform: STALE is budget-unknown at every site and never blocks delegation. The
|
|
328
|
+
consequence clause appends *after* the `` -> <verdict> `` arrow, leaving it
|
|
329
|
+
disjoint from the `width=<n>` invariant below.
|
|
330
|
+
|
|
331
|
+
**The `width=<n>` field.** Every emitted verdict line — OK, PAUSE, STALE (the
|
|
332
|
+
fail-closed diagnostics included), RESET-OK — carries a `width=<n>` field
|
|
333
|
+
immediately before the `` -> <verdict> `` arrow, read from
|
|
334
|
+
`DELEGATION_KIT_FAN_WIDTH` (§Layout and configuration). It is the knob's
|
|
335
|
+
mechanical reader: the budget check already runs before every dispatch, so the
|
|
336
|
+
read-only fan-out bound surfaces at exactly the wave-sizing decision point, and
|
|
337
|
+
`agent-budget-guard.sh` relays the verdict line verbatim (block on PAUSE, advise
|
|
338
|
+
otherwise) so the width rides into context with the budget verdict. *Verbatim*
|
|
339
|
+
governs the verdict line's own text, not the surrounding frame: the guard
|
|
340
|
+
prefixes the relayed line and the PAUSE arm appends its corrective, but no arm
|
|
341
|
+
restates the payload's content — there is exactly one advise arm and it adds
|
|
342
|
+
nothing. The field is
|
|
343
|
+
a config constant, not derived from the snapshot, so it is present even on an
|
|
344
|
+
unreadable-snapshot STALE. No exit-code or other-field change: existing callers
|
|
345
|
+
that key off the exit code or the `-> <verdict>` arrow are unaffected.
|
|
346
|
+
|
|
347
|
+
**Two pause axes.** The five-hour window is the always-on axis; the weekly
|
|
348
|
+
(7-day) window is a second axis, armed only when both `seven_day_used_pct`
|
|
349
|
+
and `seven_day_resets_at` are present (a three-line snapshot keeps today's
|
|
350
|
+
behavior — no retroactive contract break). The weekly limit can deplete
|
|
351
|
+
while the 5h window sits comfortable, and a weekly PAUSE costs days, not
|
|
352
|
+
hours, so it must gate delegation planning, not merely appear in a log —
|
|
353
|
+
delegation is the discretionary spend, the first thing to stop near the
|
|
354
|
+
weekly ceiling so the remaining week stays with the supervisor. The axes
|
|
355
|
+
are judged independently against `DELEGATION_KIT_PAUSE_PCT` and
|
|
356
|
+
`DELEGATION_KIT_PAUSE_PCT_7D`; either
|
|
357
|
+
firing is a PAUSE (exit 1), and the message names the axis that fired
|
|
358
|
+
(`PAUSE (7-day window)` vs `PAUSE (5h window)`, the weekly named when both
|
|
359
|
+
fire) because the operator's remediation differs by days. No caller
|
|
360
|
+
changes: the session-context hook and the per-dispatch Agent budget guard
|
|
361
|
+
already consume the exit code, so the weekly axis flows into every dispatch
|
|
362
|
+
decision the moment a producer supplies the keys.
|
|
363
|
+
|
|
364
|
+
**Usage-history sampling.** When `DELEGATION_KIT_USAGE_HISTORY` is non-empty,
|
|
365
|
+
`usage-verdict` appends one sample line (§The usage.txt contract) to that log
|
|
366
|
+
after every successfully parsed snapshot, whatever the verdict — the raw
|
|
367
|
+
harness-reported values verbatim; write-time smoothing or correction is
|
|
368
|
+
forbidden (a later corrective push is evidence about the earlier sample, and
|
|
369
|
+
only the reader has both). A STALE exit from an unreadable or unparseable
|
|
370
|
+
snapshot appends nothing — a sample the gate would not trust is not history.
|
|
371
|
+
`usage-trend` (§Trend reporter) reads the log, and so does `usage-verdict`
|
|
372
|
+
itself: the newest sample's `resets_at` is one of the two roll witnesses
|
|
373
|
+
(§usage-verdict). That read is the log's only in-verdict consumer and is
|
|
374
|
+
strictly fall-open, so the log stays an advisory trend surface rather than
|
|
375
|
+
becoming a correctness dependency — a consumer with sampling off gets the
|
|
376
|
+
same verdicts it always did.
|
|
377
|
+
|
|
378
|
+
### The usage.txt contract
|
|
379
|
+
|
|
380
|
+
The snapshot is the wire contract between any producer and the gate — three
|
|
381
|
+
`key=value` lines:
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
five_hour_used_pct=<float>
|
|
385
|
+
five_hour_resets_at=<epoch-seconds>
|
|
386
|
+
updated_at=<epoch-seconds>
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Beyond the three mandatory lines a producer may write optional keys when its
|
|
390
|
+
source exposes them; `usage-verdict` reads the ones it interprets and passes
|
|
391
|
+
the rest through: `seven_day_used_pct` / `seven_day_resets_at` (the weekly
|
|
392
|
+
window — read at the verdict transition to arm the second pause axis),
|
|
393
|
+
`account` (the logged-in account identity — `login_at` detects a switch,
|
|
394
|
+
`account` says to whom, which lets `usage-trend` group a multi-account
|
|
395
|
+
operator's segments per account), `tier` (subscription tier — the
|
|
396
|
+
denominator behind the percentages), and `tokens_in` / `tokens_out`
|
|
397
|
+
(cumulative token counts, the axis that binds API-billed consumers for whom
|
|
398
|
+
no subscription percentage applies). Optional keys are omitted when their
|
|
399
|
+
source has no value, never written empty; keys the verdict does not read
|
|
400
|
+
pass through unchanged.
|
|
401
|
+
|
|
402
|
+
The kit ships two reference producers — one push, one poll — and any producer
|
|
403
|
+
honoring the contract works beside them. `templates/statusline-usage.sh` is
|
|
404
|
+
the push producer: a statusline hook
|
|
405
|
+
that parses the harness's rate-limit JSON and atomically writes the
|
|
406
|
+
snapshot (`tmp` + `mv`) to `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/usage.txt`.
|
|
407
|
+
It also produces the weekly pair from the payload and `account` / `tier`
|
|
408
|
+
from the local account config (`.credentials.json` / `~/.claude.json`,
|
|
409
|
+
overridable via `DELEGATION_KIT_CRED_FILE` / `DELEGATION_KIT_ACCOUNT_CONFIG`).
|
|
410
|
+
It ships no `tokens_in` / `tokens_out` producer: this harness's payload
|
|
411
|
+
carries no cumulative token count, so under the dead-producer rule the keys
|
|
412
|
+
stay defined here for third-party producers but no dead producer is shipped.
|
|
413
|
+
Beyond the snapshot write it renders a status bar — model/effort, a context
|
|
414
|
+
gauge, the 5h and 7d windows with reset countdowns, and an `iteration@stage`
|
|
415
|
+
readout whose two halves come from two surfaces: the iteration from the queue
|
|
416
|
+
header, the stage from the lifecycle evidence file's **last data line**. Both
|
|
417
|
+
are repo-root-relative reads in the template's existing hardcode style — a
|
|
418
|
+
consumer-owned template adds no knob. With no cursor to read (no evidence file,
|
|
419
|
+
or one truncated to its preamble at an iteration boundary) the readout degrades
|
|
420
|
+
to the iteration alone rather than printing a dangling separator or a partial
|
|
421
|
+
parse — self-contained ANSI, no external asset
|
|
422
|
+
(§Out of scope). The snapshot write is the contract; the bar is
|
|
423
|
+
reference UX a consumer may restyle or discard. The source is pluggable
|
|
424
|
+
(`DELEGATION_KIT_USAGE_FILE`), so no
|
|
425
|
+
single-operator `CLAUDE_CONFIG_DIR` assumption is baked in.
|
|
426
|
+
|
|
427
|
+
`templates/usage-poller.sh` is the poll producer, closing the push producer's
|
|
428
|
+
blind spot: the statusline fires on the supervising session's own message
|
|
429
|
+
flow, so a lead that delegates stops producing exactly when it goes static —
|
|
430
|
+
a delegated build can run for hours with every per-dispatch budget verdict
|
|
431
|
+
reading a stale file. The poller is one poll cycle per invocation: read the
|
|
432
|
+
harness OAuth token from the credentials file the kit already knows
|
|
433
|
+
(`DELEGATION_KIT_CRED_FILE`; the token goes into the request header and
|
|
434
|
+
nowhere else — never logged, never echoed, never written to the snapshot),
|
|
435
|
+
query the account usage source, map the payload onto the contract (the three
|
|
436
|
+
mandatory lines plus whichever optional keys the source exposes; **no new
|
|
437
|
+
key**), and atomically rewrite the snapshot (`tmp` + `mv`, the same
|
|
438
|
+
discipline). No daemon, no loop: scheduling belongs to the consumer, and two
|
|
439
|
+
modes are sanctioned. **Demand-driven** (§usage-verdict): point
|
|
440
|
+
`DELEGATION_KIT_REFRESH_CMD` at the poller and the same one-cycle producer runs
|
|
441
|
+
at verdict time, which puts the freshest reading exactly at the decision point.
|
|
442
|
+
**Timer-driven**: a cron line such as `*/5 * * * * bash usage-poller.sh` or a
|
|
443
|
+
systemd timer, for consumers wanting continuous trend density independent of
|
|
444
|
+
verdict calls. Either entry is the enabling config; with neither, the producer
|
|
445
|
+
is dead. The usage endpoint is harness-account plumbing, not a
|
|
446
|
+
published contract, so the poller is **fail-soft**: a missing/unreadable
|
|
447
|
+
credentials file, a fetch failure, or an unparseable payload exits non-zero
|
|
448
|
+
with a `help:` line *without touching the snapshot* — a stale snapshot is
|
|
449
|
+
already the detected condition downstream (`usage-verdict`'s `updated_at`
|
|
450
|
+
staleness check turns it into a STALE verdict, never a silent green), and the
|
|
451
|
+
non-zero exit lands in the invoking timer's logging, deliberately nowhere
|
|
452
|
+
else. The endpoint URL is the `DELEGATION_KIT_USAGE_ENDPOINT` knob — both the
|
|
453
|
+
test seam (the smoke points it at a local `file://` stub) and the valve when
|
|
454
|
+
the source moves.
|
|
455
|
+
|
|
456
|
+
Both producers write the whole snapshot atomically from the same account
|
|
457
|
+
source; last-writer-wins is correct because the freshest write is the truest
|
|
458
|
+
and `updated_at` arbitrates downstream. Nothing serializes them and nothing
|
|
459
|
+
needs to. The trend log is unaffected: `usage-verdict` stays the single
|
|
460
|
+
append author (§usage-verdict); the poller writes the snapshot only.
|
|
461
|
+
|
|
462
|
+
Because the
|
|
463
|
+
statusline fires far more often than the per-session /
|
|
464
|
+
per-dispatch verdict calls, a consumer wanting a denser trend history can drive
|
|
465
|
+
sampling from the render path — `usage-verdict` stays the single append author
|
|
466
|
+
(§usage-verdict), so the statusline calls it (with `DELEGATION_KIT_USAGE_HISTORY`
|
|
467
|
+
set) rather than appending the log itself.
|
|
468
|
+
|
|
469
|
+
**The sample line.** With sampling enabled (§usage-verdict), `usage-verdict`
|
|
470
|
+
appends one line per parsed snapshot — the trend log's wire contract between
|
|
471
|
+
it and `usage-trend`:
|
|
472
|
+
|
|
473
|
+
```
|
|
474
|
+
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>]
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Space-separated `key=value`, order-insensitive; optional groups are omitted
|
|
478
|
+
(never written empty) when the snapshot lacks them. `login_at` is the
|
|
479
|
+
credentials-file mtime the post-login-lag check already reads, stamped per
|
|
480
|
+
sample so an account switch becomes data; `pct` / `resets_at` are the 5h
|
|
481
|
+
values verbatim and `pct_7d` / `resets_7d` the weekly ones. The log is
|
|
482
|
+
append-only (the tmp-prune / boundary-truncate conventions own cleanup), and
|
|
483
|
+
carries operator-local account identifiers, so it lives under the gitignored
|
|
484
|
+
measurement dir and never reaches a tracked file.
|
|
485
|
+
|
|
486
|
+
## Trend reporter
|
|
487
|
+
|
|
488
|
+
`bin/usage-trend.sh` reads the history log and reports how the footprint
|
|
489
|
+
evolves — advisory tooling, never a gate: exit **0** report emitted, **2**
|
|
490
|
+
knob unset or history missing/unreadable (fail-closed, mirroring the
|
|
491
|
+
verdict's STALE discipline), never **1** (it renders no verdict; the verdict
|
|
492
|
+
stays the sole pause authority). The source signal is known-noisy — a
|
|
493
|
+
rolling-window reading spikes and reverts-down when a harness over-report is
|
|
494
|
+
corrected by the next push — so the design separates signal from noise by
|
|
495
|
+
the window's one physical constraint: within a segment, true usage never
|
|
496
|
+
decreases.
|
|
497
|
+
|
|
498
|
+
1. **Segment** samples per axis by that axis's reset epoch, `login_at`,
|
|
499
|
+
`account`, and `tier`: the 5h axis keys on `resets_at`, the weekly axis
|
|
500
|
+
on `resets_7d` (the windows roll independently — a weekly segment spans
|
|
501
|
+
many 5h segments). A timer reset, a `/login`, or an account or tier
|
|
502
|
+
change each starts a segment; only within-segment comparisons are
|
|
503
|
+
meaningful, so an account switch is a boundary, not a flagged anomaly.
|
|
504
|
+
2. **Flag** any sample whose pct is below an earlier one in the same segment
|
|
505
|
+
as a monotonicity violation: the downward correction indicts the elevated
|
|
506
|
+
sample(s) before it as reader noise, and both sides are excluded from rate
|
|
507
|
+
math, never averaged in. Median-of-3 smoothing resolves single-sample
|
|
508
|
+
spikes; segment endpoints keep their own value (no 2-window averaging).
|
|
509
|
+
3. **Report** per segment and axis — first/last smoothed pct, pct-per-hour
|
|
510
|
+
rate, token deltas when token keys ride, tier, sample count, and
|
|
511
|
+
suspect-sample count (a high suspect ratio means the producer is
|
|
512
|
+
unreliable and no number from that segment is trusted). The weekly axis
|
|
513
|
+
additionally reports headroom against `DELEGATION_KIT_PAUSE_PCT_7D` at the current rate —
|
|
514
|
+
the planning number for how much delegation the week still affords — and,
|
|
515
|
+
when `account` is present, segments group under an account heading so a
|
|
516
|
+
rotating operator reads one weekly trajectory per account rather than an
|
|
517
|
+
interleaved stream.
|
|
518
|
+
|
|
519
|
+
## Layout and configuration
|
|
520
|
+
|
|
521
|
+
```
|
|
522
|
+
delegation-kit/
|
|
523
|
+
bin/usage-verdict.sh
|
|
524
|
+
bin/usage-trend.sh # footprint trend reporter over the history log
|
|
525
|
+
bin/run-usage-tests.sh # verdict decision-table runner
|
|
526
|
+
bin/run-budget-guard-tests.sh # budget-guard decision-table runner
|
|
527
|
+
bin/run-trend-tests.sh # trend-reporter assertion runner
|
|
528
|
+
usage-tests/cases.tsv # expected-verdict <TAB> scenario knobs
|
|
529
|
+
usage-tests/budget-guard-cases.tsv # expected-action <TAB> scenario knobs
|
|
530
|
+
usage-tests/trend-history.log # fixture history for the trend runner
|
|
531
|
+
checks/check-gate-tamper.sh
|
|
532
|
+
checks/check-rule-citation.sh
|
|
533
|
+
gate-tests/check-gate-tamper/{good,bad}/
|
|
534
|
+
gate-tests/check-rule-citation/{good,bad}/
|
|
535
|
+
templates/agent-execution.md # full protocol, bound as a skill shim
|
|
536
|
+
templates/dispatch-checklists.md # deletion/rename/audit pre-flight, reached by a pointer
|
|
537
|
+
templates/agent-budget-guard.sh # PreToolUse(Agent) budget guard
|
|
538
|
+
templates/statusline-usage.sh # push usage.txt producer (statusline hook) + status bar
|
|
539
|
+
templates/usage-poller.sh # poll usage.txt producer (timer-driven, fail-soft)
|
|
540
|
+
templates/delegation-config.sh # knob overrides (arrays live here)
|
|
541
|
+
smoke/install.sh
|
|
542
|
+
smoke/violation.sh
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
Config follows the established kit pattern: copy
|
|
546
|
+
`templates/delegation-config.sh` into the gates dir (or point
|
|
547
|
+
`DELEGATION_KIT_CONFIG_FILE` elsewhere) and override any knob; defaults
|
|
548
|
+
fill what the consumer left unset. The loader is fail-closed: a
|
|
549
|
+
`DELEGATION_KIT_CONFIG_FILE` named but absent, or a config leaving any knob
|
|
550
|
+
malformed, exits 2 (a broken machine gates nothing). Knobs (this repo's
|
|
551
|
+
layout as defaults):
|
|
552
|
+
|
|
553
|
+
- `DELEGATION_KIT_USAGE_FILE` — default
|
|
554
|
+
`${CLAUDE_CONFIG_DIR:-$HOME/.claude}/usage.txt`; positional `$1`
|
|
555
|
+
overrides (test injection).
|
|
556
|
+
- `DELEGATION_KIT_CRED_FILE` — default the usage file's sibling
|
|
557
|
+
`.credentials.json`; positional `$2` overrides.
|
|
558
|
+
- `DELEGATION_KIT_USAGE_ENDPOINT` — the poll producer's usage source; default
|
|
559
|
+
`https://api.anthropic.com/api/oauth/usage`. The test seam (a `file://` stub)
|
|
560
|
+
and the stability valve when the unpublished source moves (§The usage.txt
|
|
561
|
+
contract).
|
|
562
|
+
- `DELEGATION_KIT_PAUSE_PCT` — default `80`.
|
|
563
|
+
- `DELEGATION_KIT_PAUSE_PCT_7D` — weekly-axis pause threshold; default `95`,
|
|
564
|
+
deliberately looser than the 5h axis: a weekly PAUSE is remediated in days,
|
|
565
|
+
not hours, so pausing at the 5h conservatism would strand a fifth of the
|
|
566
|
+
week's budget — only the true red zone stops delegation on this axis.
|
|
567
|
+
- `DELEGATION_KIT_STALE_AGE` — default `600` (seconds).
|
|
568
|
+
- `DELEGATION_KIT_LOGIN_WINDOW` — default `600` (seconds).
|
|
569
|
+
- `DELEGATION_KIT_REFRESH_CMD` — the command `usage-verdict` runs before
|
|
570
|
+
reading the snapshot (§usage-verdict); default empty, which keeps the
|
|
571
|
+
read-only behavior. This repo points it at the poll producer, run in place
|
|
572
|
+
from its template path.
|
|
573
|
+
- `DELEGATION_KIT_REFRESH_MIN_AGE` — the refresh short-circuit (§usage-verdict);
|
|
574
|
+
default `60` (seconds), validated a non-negative integer by the loader. The
|
|
575
|
+
floor is set by the render path, not the dispatch path: the statusline calls
|
|
576
|
+
the verdict on every render, so the default bounds source traffic to roughly
|
|
577
|
+
one poll a minute while leaving any dispatch-time reading fresh enough to act
|
|
578
|
+
on.
|
|
579
|
+
- `DELEGATION_KIT_USAGE_HISTORY` — sample-log path; default empty (sampling
|
|
580
|
+
off). This repo sets `.metric/usage-history.log`, a gitignored persistent
|
|
581
|
+
measurement trend (drift-kit/SPEC.md §Layout and configuration owns the
|
|
582
|
+
metric-dir retention contract).
|
|
583
|
+
- `DELEGATION_KIT_FAN_WIDTH` — read-only-fan-out width bound; default `2`,
|
|
584
|
+
validated a positive integer by the loader. It bounds read-only fan-outs
|
|
585
|
+
only: a committing fan-out serializes or takes its own worktree regardless
|
|
586
|
+
(the template's **Serialize on shared files; ≤`DELEGATION_KIT_FAN_WIDTH`-wide
|
|
587
|
+
otherwise** rule), so this knob is never a licence to widen concurrent
|
|
588
|
+
committers.
|
|
589
|
+
The default is the loss-bounding invariant — bound the in-flight loss to
|
|
590
|
+
what the window can absorb when the wall fires mid-flight — at a Pro-class
|
|
591
|
+
subscription window; a Max-class window absorbs more, and an API-billed
|
|
592
|
+
operator has no mid-flight window wall at all, so there spend rate and the
|
|
593
|
+
provider's rate limits replace the rationale. A consumer retunes from the
|
|
594
|
+
invariant, not the number. **Supervision ceiling:** operator attention over
|
|
595
|
+
N concurrent reports does not scale with the budget window — a bigger
|
|
596
|
+
window raises the affordable width, not the reviewable one, so budget is
|
|
597
|
+
never the sole input to widening. `usage-verdict` surfaces the live value
|
|
598
|
+
as the `width=` field (§usage-verdict), the knob's mechanical reader.
|
|
599
|
+
- `DELEGATION_KIT_GATE_FILES` — globs naming gate files for tamper
|
|
600
|
+
assertion A; default
|
|
601
|
+
`("${GATE_SDK_GATES_DIR:-scripts}/check-*.sh")` plus the gate-sdk lib and
|
|
602
|
+
runners. A consumer declaration **replaces** this default outright rather
|
|
603
|
+
than extending it — the loader guards it with `declare -p … ||`, so the
|
|
604
|
+
default is the no-declaration fallback, not a base to append to. A consumer
|
|
605
|
+
adding kit-shipped globs must therefore restate any default glob it still
|
|
606
|
+
wants covered (this repo's config names `*/checks/*.sh` **and**
|
|
607
|
+
`scripts/check-*.sh`, because it has gates in both places). Contrast
|
|
608
|
+
`DELEGATION_KIT_META_PATHS` below, whose kit-root union *is* additive — the
|
|
609
|
+
two knobs do not behave alike.
|
|
610
|
+
- `DELEGATION_KIT_META_PATHS` — prefixes counted as meta-layer for
|
|
611
|
+
assertion A; default `("${GATE_SDK_GATES_DIR:-scripts}/"
|
|
612
|
+
"${GATE_SDK_WORKFLOW_DIR:-.workflow}/" ".claude/")`; root-level `*.md` is
|
|
613
|
+
always meta. When `gate.sh` is resolvable (`GATE_SDK_LIB`, else the vendored
|
|
614
|
+
sibling), the loader unions every `gate_kit_roots` member into this array as a
|
|
615
|
+
root-relative `dir/` prefix — a vendored kit's edits are meta-layer by
|
|
616
|
+
definition, so the consumer's config need not name kit dirs at all (this
|
|
617
|
+
repo's keeps only the non-kit prefixes). The union is additive, never a
|
|
618
|
+
filter: a
|
|
619
|
+
prefix the consumer declared cannot be lost, and without `gate.sh` the config
|
|
620
|
+
is used exactly as written.
|
|
621
|
+
|
|
622
|
+
`check-gate-tamper` registers in the consumer's `gates.list`
|
|
623
|
+
(tier: precommit) — in this repo's too; dogfooding is day-one, and agents
|
|
624
|
+
commit here.
|
|
625
|
+
|
|
626
|
+
`agent-budget-guard.sh` is not a gate — it is a hook, so it registers not in
|
|
627
|
+
`gates.list` but under `PreToolUse` matcher `Agent` in the consumer's
|
|
628
|
+
`.claude/settings.json` (beside the guard-kit Bash guard). Copy the template
|
|
629
|
+
into the gates dir and wire `bash scripts/agent-budget-guard.sh`; it resolves
|
|
630
|
+
`guard-kit/lib/guard.sh` and `bin/usage-verdict.sh` at their vendored paths,
|
|
631
|
+
overridable with `GUARD_KIT_LIB` / `DELEGATION_KIT_VERDICT_BIN`. Registration
|
|
632
|
+
is the whole opt-in: unwired, the guard is inert. This repo registers it, and
|
|
633
|
+
its consumer session brief (`scripts/session-context.sh`) additionally prints
|
|
634
|
+
the verdict line at SessionStart for planning-time visibility — a consumer-side
|
|
635
|
+
edit; the context-kit template stays uncoupled from delegation-kit.
|
|
636
|
+
|
|
637
|
+
**An `OK` verdict is a floor, not a recommendation.** The guard answers one
|
|
638
|
+
question — is there headroom in the window *right now* — and blocks only on
|
|
639
|
+
`PAUSE`. Everything else a dispatch decision turns on sits outside its reach:
|
|
640
|
+
how long the dispatched work runs, whether it fans out beneath the checkpoint
|
|
641
|
+
(the guard fires on the dispatch it gates, not on that dispatch's children),
|
|
642
|
+
and whether anything forces the dispatch now rather than after the window
|
|
643
|
+
resets. `OK` is therefore one input to that decision and never the decision
|
|
644
|
+
itself; a dispatcher reading `OK` as "go" has substituted the guard's question
|
|
645
|
+
for its own. The asymmetry is deliberate: a wrong `PAUSE` costs a delayed
|
|
646
|
+
dispatch, while an `OK` that is right about headroom and silent about duration
|
|
647
|
+
costs the work in flight.
|
|
648
|
+
|
|
649
|
+
## Testing
|
|
650
|
+
|
|
651
|
+
`check-gate-tamper` speaks the full gate contract (`GATE-TAMPER: clean
|
|
652
|
+
(…)` / findings + `help:` lines / exit 0-1-2) and ships the standard
|
|
653
|
+
`good/`+`bad/` fixture pair driven through `--fixture` by gate-sdk's
|
|
654
|
+
`run-gate-tests.sh`.
|
|
655
|
+
|
|
656
|
+
`check-rule-citation` speaks the same gate contract and ships the standard
|
|
657
|
+
`good/`+`bad/` fixture pair (a citation resolving to a template lead-in vs one
|
|
658
|
+
naming an absent lead-in), driven by `run-gate-tests.sh` over fixture-local
|
|
659
|
+
spec + template files passed as its two positional arguments.
|
|
660
|
+
|
|
661
|
+
`usage-verdict` does not fit the gate contract (a three-state verdict, not a
|
|
662
|
+
clean/violation pair), so — like guard-kit's guard-tests — the kit ships
|
|
663
|
+
its own decision-table runner: `usage-tests/cases.tsv` pairs an expected
|
|
664
|
+
verdict token (`OK`/`PAUSE`/`STALE`/`RESET-OK`) and exit code with scenario
|
|
665
|
+
knobs (percentage, snapshot age offset, reset offset, credential age);
|
|
666
|
+
`bin/run-usage-tests.sh` materializes each case as a generated snapshot
|
|
667
|
+
file (timestamps must be computed relative to *now* — static fixtures
|
|
668
|
+
would age into permanent STALE) and asserts verdict and exit code. Each
|
|
669
|
+
case runs in a throwaway sandbox with no consumer config on the lookup
|
|
670
|
+
path **and** with ambient `DELEGATION_KIT_*` exports stripped at each gate
|
|
671
|
+
invocation, so the gate exercises its own defaults hermetic to the host
|
|
672
|
+
repo — the decision table encodes those defaults, and a host override (a
|
|
673
|
+
raised pause threshold, say) must not reshape it. The trend and
|
|
674
|
+
budget-guard runners below share the strip, each runner under a deliberate
|
|
675
|
+
poison export that fails its own table loudly if the strip ever breaks;
|
|
676
|
+
`cases.tsv` columns are `verdict exit pct age_off reset_off cred_age pct_7d
|
|
677
|
+
reset7d_off append axis desc` (the offsets seconds from *now*; `pct_7d` `-`
|
|
678
|
+
omits the weekly keys, `append` is the expected sample-line count, `axis`
|
|
679
|
+
asserts which window a PAUSE names). Every verdict branch and both pause axes
|
|
680
|
+
carry a firing and a non-firing case — the fixture-pair discipline,
|
|
681
|
+
transplanted — covering a weekly PAUSE while 5h is comfortable, the axis
|
|
682
|
+
named in the output, absent keys disarming the weekly axis, a dead weekly
|
|
683
|
+
window not pausing, each axis's at-or-over boundary (a reading exactly at the
|
|
684
|
+
threshold pauses; just under does not), both directions of the login reroute
|
|
685
|
+
(an under-threshold percentage with a fresh login is STALE, not OK; an
|
|
686
|
+
at-or-over one on either axis is still PAUSE, not STALE — the asymmetry is
|
|
687
|
+
what keeps the reroute from waving an unaffordable dispatch through), and the
|
|
688
|
+
sample-append discipline (a parsed snapshot
|
|
689
|
+
appends one line whatever the verdict; a non-numeric snapshot appends none;
|
|
690
|
+
`pct_7d` present-vs-omitted in the passed-through line).
|
|
691
|
+
|
|
692
|
+
The demand-driven refresh needs a command seam the table's columns do not
|
|
693
|
+
carry, so it is asserted beside the table through a stub
|
|
694
|
+
`DELEGATION_KIT_REFRESH_CMD` (a real
|
|
695
|
+
poll would need the network): **armed** — a stale snapshot invokes the command
|
|
696
|
+
and the verdict reads the values the refresh wrote, not the cached ones;
|
|
697
|
+
**fail-soft** — a non-zero stub leaves the snapshot byte-identical, the verdict
|
|
698
|
+
proceeds and the cached reading is judged STALE by the existing staleness
|
|
699
|
+
machinery, and no refresh diagnostic leaks into the relayed verdict line;
|
|
700
|
+
**short-circuit** — a snapshot under `DELEGATION_KIT_REFRESH_MIN_AGE` never invokes the
|
|
701
|
+
command. Armed and short-circuit are the firing/non-firing pair over the same
|
|
702
|
+
stub, so the absence proves the floor rather than a broken stub.
|
|
703
|
+
|
|
704
|
+
The **roll witnesses** need a pre-seeded history tail the table's columns do
|
|
705
|
+
not carry, so they are asserted beside it too, over one fixed shape — a low
|
|
706
|
+
percentage with a credentials mtime inside the login window, which without a
|
|
707
|
+
witness is STALE. Both witnesses present verdicts OK; each of the four ways
|
|
708
|
+
the log can fail to answer holds the STALE — the boundary unmoved, the
|
|
709
|
+
previous boundary uncrossed, a tail with a non-numeric `resets_at`, and no
|
|
710
|
+
history at all. The two single-witness cases are the discriminating pair: they
|
|
711
|
+
prove the conjunction is load-bearing rather than either witness carrying it
|
|
712
|
+
alone. A sixth case asserts the read is not self-witnessing — a run with an
|
|
713
|
+
empty log still STALEs and leaves exactly its own sample behind, so the
|
|
714
|
+
witness can only ever be a previous reading.
|
|
715
|
+
|
|
716
|
+
`usage-trend` is likewise not a gate (it renders no clean/violation
|
|
717
|
+
verdict), so it ships an assertion runner, `bin/run-trend-tests.sh`, over a
|
|
718
|
+
static fixture history `usage-tests/trend-history.log` (static epochs are
|
|
719
|
+
safe — the reporter measures within-segment deltas, never against *now*). It
|
|
720
|
+
asserts per-axis segmentation at a reset boundary, a `login_at` change, and
|
|
721
|
+
an account change; per-account grouping reuniting a weekly trajectory across
|
|
722
|
+
a switch-back; a spike-then-correction flagged and excluded rather than
|
|
723
|
+
averaged; token deltas and weekly headroom on the report; and the
|
|
724
|
+
fail-closed exits (knob unset / history missing → 2). No fixture pair owed —
|
|
725
|
+
neither script is a gate.
|
|
726
|
+
|
|
727
|
+
`agent-budget-guard.sh` is a hook, not a gate, so it speaks exit-2 + hook
|
|
728
|
+
JSON rather than the gate output contract — and like the verdict it ships a
|
|
729
|
+
decision-table runner beside the verdict tests: `usage-tests/budget-guard-cases.tsv`
|
|
730
|
+
pairs an expected action (`block`/`advise`) with the same snapshot knobs
|
|
731
|
+
(`action pct age_off reset_off cred_age desc`, `pct=UNREADABLE` for the
|
|
732
|
+
no-snapshot case), and `bin/run-budget-guard-tests.sh` drives the *template*
|
|
733
|
+
with each injected snapshot — feeding an Agent hook JSON on stdin, pointing
|
|
734
|
+
`DELEGATION_KIT_USAGE_FILE` at the generated fixture — and classifies the
|
|
735
|
+
result: PAUSE → `block` (exit 2, verdict on stderr), OK/RESET-OK/STALE/unreadable
|
|
736
|
+
→ `advise` (exit 0, verdict in `additionalContext`). The block branch carries
|
|
737
|
+
its firing (PAUSE) and non-firing (the four advise cases) — the fixture-pair
|
|
738
|
+
discipline again — and every case asserts the live verdict text rides the
|
|
739
|
+
output so a memory-quoted percentage cannot be the acting source.
|
|
740
|
+
|
|
741
|
+
`smoke/install.sh` copies the templates and `bin/` tools into the scratch
|
|
742
|
+
consumer, registers the tamper gate, and drives one crafted snapshot
|
|
743
|
+
through `usage-verdict` asserting a verdict — self-verifying install. It opens
|
|
744
|
+
with **one hermetic env prelude covering the whole file**: it strips the whole
|
|
745
|
+
`DELEGATION_KIT_*` namespace and then sets the knobs with no per-call home —
|
|
746
|
+
sampling off, and both pause thresholds at the defaults the 95% reading is
|
|
747
|
+
judged against. A prelude rather than per-instance pins because
|
|
748
|
+
instance-pinning has already missed
|
|
749
|
+
once by construction: a pass that pinned the two knobs then biting left the
|
|
750
|
+
third, and the survivor was the one whose failure is **silent** — an
|
|
751
|
+
unpinned history path makes every smoke verdict append a synthetic sample
|
|
752
|
+
into whatever trend log the ambient config names, indistinguishable in shape
|
|
753
|
+
from a real operator reading. That this repo's runs happened not to pollute
|
|
754
|
+
was accidental, not designed: the harness runs the file with cwd = the
|
|
755
|
+
scratch consumer root and the configured history path is *relative*, so the
|
|
756
|
+
appends died with the scratch tree — hermeticity that evaporates the moment a
|
|
757
|
+
consumer configures an absolute path or the file is invoked from a real tree.
|
|
758
|
+
Stripping the whole namespace is the shape that cannot miss a third knob.
|
|
759
|
+
The credentials pin stays **at each invocation** rather than moving into the
|
|
760
|
+
prelude, because gate-sdk/SPEC.md §check-test-hermetic reads it there — a
|
|
761
|
+
line-local pin is evidence a reader and a gate can both see without tracing
|
|
762
|
+
file-level state — and the poller's own snapshot, credentials and endpoint
|
|
763
|
+
paths stay inline too, being genuine per-call arguments the prelude has no
|
|
764
|
+
business pre-empting. That
|
|
765
|
+
assertion is **code-specific**: the 95% guard captures the exit status and
|
|
766
|
+
compares it to the PAUSE code, reporting the status it observed rather than
|
|
767
|
+
claiming an outcome it did not establish, so a STALE regression cannot pass
|
|
768
|
+
under a "did not PAUSE" message (gate-sdk/SPEC.md
|
|
769
|
+
§check-assertion-strength, the gate for the class). It also
|
|
770
|
+
drives the poll producer through its `file://` stub seam: the happy path
|
|
771
|
+
writes a contract-valid snapshot (asserted by driving it through
|
|
772
|
+
`usage-verdict`), and a fetch failure exits non-zero leaving a pre-seeded
|
|
773
|
+
snapshot byte-identical — the fail-soft contract, exercised end to end.
|
|
774
|
+
`smoke/violation.sh` stages a gate edit co-staged with a product file in
|
|
775
|
+
the scratch consumer and asserts the battery reds (assertion A) — the
|
|
776
|
+
violation is craftable, so the file is mandatory
|
|
777
|
+
(gate-sdk/SPEC.md §Consumer smoke).
|
|
778
|
+
|
|
779
|
+
## Out of scope
|
|
780
|
+
|
|
781
|
+
A consumer's validate battery (its compile/lint/test command set and rename
|
|
782
|
+
corruption sweeps), its shared-file roster, and its width/burn anecdotes tied
|
|
783
|
+
to specific sweeps are rule content, referenced only as marked-section
|
|
784
|
+
examples. A task-output tailer is not shipped: such a tool hardcodes local
|
|
785
|
+
harness paths and exists to violate the template's **Background + notification,
|
|
786
|
+
never poll** rule for debugging. The
|
|
787
|
+
`usage.txt` write contract and a reference producer rendering the gauge bars
|
|
788
|
+
and `iteration@stage` readout do ship (the producer's ANSI is self-contained,
|
|
789
|
+
pulling no external asset); a consumer's *particular* statusline styling and
|
|
790
|
+
any asset its own gauges pull are not the rendering mechanism and stay with
|
|
791
|
+
it. The split is protocol and mechanisms here, a consumer's rosters,
|
|
792
|
+
batteries, and bespoke UX in its own copies.
|