checkwright 0.21.0 → 0.22.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 +385 -19
- package/lib/common/digest.sh +18 -0
- package/lib/common/lock.sh +11 -0
- package/lib/common/recipe.sh +8 -11
- package/lib/doctor.sh +49 -0
- package/lib/init.sh +152 -29
- package/package.json +2 -2
- package/payload/artifact/targets.list +30 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
- package/payload/canon-kit/README.md +1 -0
- package/payload/canon-kit/SPEC.md +279 -24
- package/payload/canon-kit/checks/check-comment-tier.sh +7 -2
- package/payload/canon-kit/checks/check-docs-link-convention.sh +11 -4
- package/payload/canon-kit/checks/check-payload-claim.sh +133 -0
- package/payload/canon-kit/checks/check-prose-enum.sh +1 -1
- package/payload/canon-kit/checks/check-spec-pointer.sh +9 -2
- package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
- package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +26 -3
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -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/good/OUTSIDE.md +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
- package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +5 -3
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
- package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +24 -1
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
- package/payload/canon-kit/lib/spec.sh +22 -12
- package/payload/canon-kit/smoke/install.sh +20 -1
- package/payload/canon-kit/templates/SPEC-amendment.md +5 -1
- package/payload/context-kit/SPEC.md +25 -1
- package/payload/context-kit/lib/toolfloor.sh +1 -1
- package/payload/context-kit/smoke/install.sh +3 -1
- package/payload/delegation-kit/SPEC.md +383 -13
- package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
- package/payload/delegation-kit/checks/check-gate-tamper.sh +1 -1
- package/payload/delegation-kit/lib/delegation.sh +1 -0
- package/payload/delegation-kit/smoke/install.sh +2 -1
- package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
- package/payload/delegation-kit/templates/agent-execution.md +103 -12
- package/payload/delegation-kit/templates/delegation-config.sh +4 -0
- package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
- package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
- package/payload/doctrine-kit/DOCTRINE.md +27 -0
- package/payload/doctrine-kit/README.md +5 -0
- package/payload/doctrine-kit/SPEC.md +62 -3
- package/payload/doctrine-kit/bin/install-doctrine.sh +84 -4
- package/payload/doctrine-kit/smoke/install.sh +77 -1
- package/payload/drift-kit/README.md +3 -2
- package/payload/drift-kit/SPEC.md +253 -20
- package/payload/drift-kit/bin/stage-economics.sh +157 -3
- package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
- package/payload/drift-kit/smoke/install.sh +155 -1
- package/payload/drift-kit/templates/economics.md +9 -0
- package/payload/drift-kit/templates/kpis.list +6 -1
- package/payload/evidence-kit/README.md +20 -6
- package/payload/evidence-kit/SPEC.md +355 -17
- package/payload/evidence-kit/bin/run-validate.sh +51 -9
- package/payload/evidence-kit/checks/check-battery-roster.sh +86 -0
- package/payload/evidence-kit/checks/check-producer-liveness.sh +34 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
- package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
- package/payload/evidence-kit/lib/evidence.sh +18 -0
- package/payload/evidence-kit/smoke/install.sh +17 -3
- package/payload/gate-sdk/README.md +4 -1
- package/payload/gate-sdk/SPEC.md +1949 -74
- package/payload/gate-sdk/bin/gen-pre-commit.sh +12 -2
- package/payload/gate-sdk/bin/run-consumer-smoke.sh +121 -1
- package/payload/gate-sdk/bin/run-gate-tests.sh +40 -9
- package/payload/gate-sdk/bin/run-gates.sh +31 -2
- package/payload/gate-sdk/bin/upgrade-smoke.sh +3 -3
- package/payload/gate-sdk/checks/check-action-gh-repo.gate +2 -0
- package/payload/gate-sdk/checks/check-action-pinning.gate +2 -0
- package/payload/gate-sdk/checks/check-action-run-shell.sh +3 -1
- package/payload/gate-sdk/checks/check-core-files.sh +27 -4
- package/payload/gate-sdk/checks/check-exec-bit.sh +20 -1
- package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +106 -0
- package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +6 -7
- package/payload/gate-sdk/checks/check-gate-output.sh +9 -1
- package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +302 -0
- package/payload/gate-sdk/checks/check-graph.sh +4 -5
- package/payload/gate-sdk/checks/check-readme-roster.sh +5 -0
- package/payload/gate-sdk/checks/check-reads-couples.sh +70 -21
- package/payload/gate-sdk/checks/check-template-registry-parity.sh +81 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
- package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +123 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
- package/payload/gate-sdk/gate-tests/lib-gate.test.sh +41 -1
- package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
- package/payload/gate-sdk/lib/consumer-smoke.sh +26 -1
- package/payload/gate-sdk/lib/gate.sh +75 -0
- package/payload/gate-sdk/lib/inject.sh +21 -1
- package/payload/gate-sdk/smoke/install.sh +19 -1
- package/payload/guard-kit/README.md +4 -3
- package/payload/guard-kit/SPEC.md +88 -10
- package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
- package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
- package/payload/guard-kit/lib/guard.sh +1 -0
- package/payload/guard-kit/templates/close-triage.md +35 -7
- package/payload/guard-kit/templates/guard-config.sh +3 -0
- package/payload/lifecycle-kit/README.md +1 -0
- package/payload/lifecycle-kit/SPEC.md +575 -29
- package/payload/lifecycle-kit/bin/enter-stage.sh +13 -3
- package/payload/lifecycle-kit/bin/file-gap.sh +42 -1
- package/payload/lifecycle-kit/bin/file-survey.sh +50 -0
- package/payload/lifecycle-kit/checks/check-merge-attrs.sh +1 -1
- package/payload/lifecycle-kit/checks/check-skill-binding.sh +1 -1
- package/payload/lifecycle-kit/checks/check-survey-record.sh +102 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +84 -0
- package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +94 -0
- package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
- package/payload/lifecycle-kit/lib/stages.sh +8 -2
- package/payload/lifecycle-kit/smoke/install.sh +17 -1
- package/payload/lifecycle-kit/templates/consult.md +73 -0
- package/payload/lifecycle-kit/templates/lead.md +103 -7
- package/payload/lifecycle-kit/templates/stages/align.md +12 -0
- package/payload/lifecycle-kit/templates/stages/build.md +8 -0
- package/payload/lifecycle-kit/templates/stages/close.md +25 -4
- package/payload/lifecycle-kit/templates/stages/scope.md +34 -0
- package/payload/lifecycle-kit/templates/stages/spec.md +8 -0
- package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
- package/payload/queue-kit/README.md +4 -1
- package/payload/queue-kit/SPEC.md +230 -6
- package/payload/queue-kit/bin/queue-edges.sh +78 -0
- package/payload/queue-kit/checks/check-queue-entry-budget.sh +5 -3
- package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
- package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
- package/payload/queue-kit/smoke/install.sh +4 -1
- package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
- package/payload/site-kit/SPEC.md +41 -27
- package/payload/site-kit/smoke/install.sh +9 -1
- package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
- package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
|
@@ -8,6 +8,8 @@ SDK="$SMOKE_KIT_ROOT/../gate-sdk" # the vendored gate-sdk beside this kit
|
|
|
8
8
|
cat >> scripts/gates.list <<'EOF'
|
|
9
9
|
# context-kit
|
|
10
10
|
check-brevity
|
|
11
|
+
check-memory-off
|
|
12
|
+
check-settings-pins
|
|
11
13
|
EOF
|
|
12
14
|
|
|
13
15
|
cp "$SMOKE_KIT_ROOT/templates/context-config.sh" scripts/context-config.sh
|
|
@@ -35,7 +37,7 @@ qtpl="$SMOKE_KIT_ROOT/../queue-kit/templates/TASK-QUEUE.md"
|
|
|
35
37
|
[[ -f TASK-QUEUE.md || ! -f "$qtpl" ]] || cp "$qtpl" TASK-QUEUE.md
|
|
36
38
|
|
|
37
39
|
bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
|
|
38
|
-
bash "$SDK/checks/check-graph.sh" --emit >
|
|
40
|
+
bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html
|
|
39
41
|
|
|
40
42
|
hook_out="$(bash scripts/session-context.sh 2>/dev/null)"; rc=$?
|
|
41
43
|
if [[ "$rc" -ne 0 ]]; then
|
|
@@ -182,6 +182,144 @@ than left out — an omitted `model:` resolves to the literal `inherit`, so
|
|
|
182
182
|
omission spells the dispatcher's tier rather than a neutral absence, and
|
|
183
183
|
`check-agent-tier-explicit` is that clause's oracle over the tracked surface.
|
|
184
184
|
|
|
185
|
+
**The dispatch-shape rules are one mechanism, seen from several sides.** The template's **Never dispatch
|
|
186
|
+
a fork to narrow a child**, **A read-only claim is made by isolation, not by
|
|
187
|
+
sentence**, and **A child's only upward route is a durable artifact** rules are
|
|
188
|
+
one defect seen from three sides: each governs the *shape of a dispatch call*,
|
|
189
|
+
and each failed the same way — the prose did not reach the reader it binds.
|
|
190
|
+
One attested surface per rule: a fork dispatched as a read-only audit completed
|
|
191
|
+
a whole stage, commits included; four forks dispatched with prose-only
|
|
192
|
+
"read-only, no edits" briefs, one of which committed unreviewed on the shared
|
|
193
|
+
branch; and repeated fan-outs, across stages and across iterations, messaged the top-level
|
|
194
|
+
session instead of their dispatcher, which no prompt wording could have fixed.
|
|
195
|
+
|
|
196
|
+
**Why an oracle is owed here and not for the turn-ending rule.** §Operative
|
|
197
|
+
residency closes on the finding that a restated rule is reachable, not obeyed,
|
|
198
|
+
and owes no gate because no check can read a session's choice to end a turn —
|
|
199
|
+
the act leaves no tracked artifact. A dispatch leaves no tracked artifact
|
|
200
|
+
either, so the distinguishing axis is not durability but interception:
|
|
201
|
+
|
|
202
|
+
> Where a rule binds an act that leaves no tracked artifact, the enforcement
|
|
203
|
+
> question is whether the act passes a **chokepoint** — not whether it reaches
|
|
204
|
+
> the tree. A dispatch does. A turn-end does not.
|
|
205
|
+
|
|
206
|
+
**The chokepoint — what a `PreToolUse` hook can actually read.** The payload
|
|
207
|
+
carries `session_id`, `prompt_id`, `transcript_path`, `cwd`, `permission_mode`,
|
|
208
|
+
`hook_event_name`, `tool_name`, `tool_input`, and `tool_use_id`; and, **only
|
|
209
|
+
when the hook fires inside a subagent**, `agent_id` and `agent_type`. For the
|
|
210
|
+
dispatch tool, `tool_input` carries the dispatch's own parameters —
|
|
211
|
+
`subagent_type`, `isolation`, `model`, `description`, `prompt`. Three
|
|
212
|
+
consequences carry the guard below: the fork ban has an exact trigger
|
|
213
|
+
(`tool_input.subagent_type`), the read-only claim has an exact trigger
|
|
214
|
+
(`tool_input.isolation`), and depth has an exact, *documented* discriminator —
|
|
215
|
+
`agent_id` is present iff the dispatching session is itself a subagent, so its
|
|
216
|
+
presence means the call about to be made creates a grandchild.
|
|
217
|
+
|
|
218
|
+
**Honest limit on that roster.** It is sourced from the harness's own published
|
|
219
|
+
hook contract, fetched rather than recalled, and from nothing in this tree —
|
|
220
|
+
the same footing as `CLAUDE_CODE_CHILD_SESSION`'s "verified, not trusted"
|
|
221
|
+
treatment (lifecycle-kit/SPEC.md §bin/session-id.sh). A future harness revision
|
|
222
|
+
reshaping the payload is drift this SPEC cannot self-detect; only re-reading the
|
|
223
|
+
hook contract catches it.
|
|
224
|
+
|
|
225
|
+
**Two depth routes ruled out**, both being the obvious move.
|
|
226
|
+
`CLAUDE_CODE_CHILD_SESSION` is set in top-level sessions too, and
|
|
227
|
+
`CLAUDE_CODE_SESSION_ID` carries the *root* id for a child, so a depth-1 and a
|
|
228
|
+
depth-2 dispatcher are indistinguishable by environment alone — that route
|
|
229
|
+
ships a rule silently mis-firing at the top level. The meta record beside a
|
|
230
|
+
transcript does carry an exact spawn depth, and that route works and is
|
|
231
|
+
deliberately not taken: it couples a hook to an *uncontracted* harness artifact
|
|
232
|
+
to answer a question one *contracted* boolean already answers. The
|
|
233
|
+
stage-economics meter accepts that same coupling (drift-kit/SPEC.md §The
|
|
234
|
+
stage-economics meter, the fan-out row) because it needs the whole spawn forest
|
|
235
|
+
and no contracted field supplies it; a hook needs one bit and gets it under
|
|
236
|
+
contract. The axis is what the contract supplies, not appetite for risk.
|
|
237
|
+
|
|
238
|
+
`templates/agent-dispatch-guard.sh` is that oracle — a second `PreToolUse` hook
|
|
239
|
+
on matcher `Agent`, beside the budget guard, composed from
|
|
240
|
+
`guard-kit/lib/guard.sh` primitives. It reads the payload once and runs the
|
|
241
|
+
rules below, in order:
|
|
242
|
+
|
|
243
|
+
| # | rule | trigger | decision |
|
|
244
|
+
| --- | --- | --- | --- |
|
|
245
|
+
| D1 | fork ban | `tool_input.subagent_type` is `fork` | block |
|
|
246
|
+
| D2 | isolation claim | `tool_input.subagent_type` ∈ `DELEGATION_KIT_READONLY_TYPES` and `tool_input.isolation` is not `worktree` | block |
|
|
247
|
+
| D3 | depth advisory | payload carries `agent_id` | advise |
|
|
248
|
+
|
|
249
|
+
Order is load-bearing only between D1/D2 and D3 — a blocked dispatch needs no
|
|
250
|
+
advisory, so D3 runs last. D1 precedes D2 because the fork ban is unconditional
|
|
251
|
+
and its message is the more specific one for a dispatch violating both.
|
|
252
|
+
|
|
253
|
+
**Why a second guard rather than more rules in the budget guard.** Four
|
|
254
|
+
reasons, each independently sufficient: the budget guard blocks on a
|
|
255
|
+
**transient** condition and is deliberately knob-overridable, while these block
|
|
256
|
+
on a **permanent** doctrine violation that must not be per-dispatch
|
|
257
|
+
overridable; the budget guard reads no stdin at all; a consumer may want either
|
|
258
|
+
enforcement without the other, and hook registration is the only opt-in valve
|
|
259
|
+
there is; and their test lanes take different payload grammars. The harness
|
|
260
|
+
fires every hook registered on a matcher and any exit 2 blocks, so the two
|
|
261
|
+
compose with no dispatcher between them.
|
|
262
|
+
|
|
263
|
+
**D1 blocks unconditionally**, which the template's own boundary does not — a
|
|
264
|
+
fork stays correct where the child does the same job at the same authority, and
|
|
265
|
+
a hook cannot read intent. The block is ruled unconditional on the ground that
|
|
266
|
+
no sanctioned fork use exists in this doctrine, and the valve is **unwiring the
|
|
267
|
+
hook**, never a knob: a per-dispatch override is exactly the honour system
|
|
268
|
+
these rules exist to end, and a knob would restore it under a better
|
|
269
|
+
name. The block message names the two lawful alternatives, as guard-kit
|
|
270
|
+
requires of every block message.
|
|
271
|
+
|
|
272
|
+
**D2 is inert until configured**, by construction — the default roster is empty
|
|
273
|
+
and the kit ships no agent-type names. An inert D2 reports nothing; it is a
|
|
274
|
+
hook, not a gate, so there is no clean line to print. Stated here so a consumer
|
|
275
|
+
does not infer coverage it has not configured.
|
|
276
|
+
|
|
277
|
+
**D3 advises rather than blocks**, and both halves are deliberate. It cannot
|
|
278
|
+
block: a nested dispatch is legitimate and common — a stage session's own
|
|
279
|
+
read-only fan-out *is* a grandchild dispatch — so blocking would remove a
|
|
280
|
+
capability rather than confine one. It must not be silent: this is the one rule
|
|
281
|
+
whose bound reader provably never loads the protocol template (§One template, a
|
|
282
|
+
resident pointer), so the advisory is the *only* delivery of it, which is
|
|
283
|
+
§Operative residency's (a)–(c) shape applied at a hook instead of a doc. Ruled
|
|
284
|
+
out for D3: keying on whether the prompt text "names a path" — that fires on
|
|
285
|
+
the word and teaches dispatchers to game the wording, buying a green hook and
|
|
286
|
+
no channel. The `agent_id` trigger is exact and unforgeable; the message
|
|
287
|
+
carries the judgment the trigger cannot.
|
|
288
|
+
|
|
289
|
+
**Degradation — fail-open, but loud**, the posture guard-kit/SPEC.md §The guard
|
|
290
|
+
framework names for a deny-guard whose matcher proves the tool but whose rule
|
|
291
|
+
turns on a payload field:
|
|
292
|
+
|
|
293
|
+
| what is missing | behavior |
|
|
294
|
+
| --- | --- |
|
|
295
|
+
| `jq` absent | allow; one advisory naming the unenforced rules |
|
|
296
|
+
| payload unparseable, or `tool_input` absent | allow; same advisory |
|
|
297
|
+
| `subagent_type` absent from a parseable payload | D1 and D2 do not fire (nothing to match); D3 unaffected |
|
|
298
|
+
| `DELEGATION_KIT_READONLY_TYPES` unset or empty | D2 inert, and silently so; D1 and D3 unaffected |
|
|
299
|
+
| `DELEGATION_KIT_CONFIG_FILE` set but naming no file | allow; advisory naming D2 unenforced |
|
|
300
|
+
| `guard-kit/lib/guard.sh` not vendored | the guard exits 0 before sourcing, as both shipped guards already do |
|
|
301
|
+
|
|
302
|
+
Two implementation facts those rows force, recorded because the obvious build
|
|
303
|
+
gets each of them wrong:
|
|
304
|
+
|
|
305
|
+
- **The `jq`-absent arm cannot deliver through `guard_advise`.** That primitive
|
|
306
|
+
is itself jq-backed, and measuring it rather than assuming settles what
|
|
307
|
+
happens: with `jq` off `PATH` it writes an empty stdout and leaves a shell
|
|
308
|
+
"command not found" on stderr, which names none of the unenforced rules — the
|
|
309
|
+
silent success these rules exist to end, arriving inside the mechanism meant
|
|
310
|
+
to prevent it. The guard therefore emits the advisory envelope itself on that
|
|
311
|
+
arm, and every advisory literal it carries is kept free of the characters
|
|
312
|
+
JSON must escape, since that fallback carries no escaper.
|
|
313
|
+
- **The guard does not source delegation-kit's validating config loader**, only
|
|
314
|
+
the consumer config file, for the one array it reads. The loader exits 2 on
|
|
315
|
+
any malformed knob and a hook that exits 2 blocks, so routing the fork ban
|
|
316
|
+
through a validator for `DELEGATION_KIT_FAN_WIDTH` would let an unrelated
|
|
317
|
+
typo wedge every dispatch in the consumer whose primary token lever is
|
|
318
|
+
delegation — the fail-closed posture this guard is specified against,
|
|
319
|
+
arriving through the config door. The distinction the last two table rows
|
|
320
|
+
draw is this kit's standing one: a roster **configured to nothing** is
|
|
321
|
+
silent, a roster that **could not be read** is loud.
|
|
322
|
+
|
|
185
323
|
### One template, a resident pointer
|
|
186
324
|
|
|
187
325
|
`templates/agent-execution.md` is the single source for the protocol — a
|
|
@@ -217,11 +355,112 @@ The consumer's CLAUDE.md carries no digest of the bullets, only a resident
|
|
|
217
355
|
pointer: the pre-authorization sentence (consumer judgment on what delegation
|
|
218
356
|
needs no ask) and `/agent-execution`. Rationale: a rule is resident only when it
|
|
219
357
|
has no load trigger (the load-trigger-residency doctrine), and every protocol
|
|
220
|
-
bullet triggers at `Agent` dispatch
|
|
358
|
+
bullet triggers at `Agent` dispatch **for the role that dispatches** — which
|
|
359
|
+
already has a mechanical seam, the
|
|
221
360
|
per-dispatch budget guard, whose block message names `/agent-execution`. The
|
|
222
|
-
doctrine lives behind the trigger, not in the always-loaded file. Honest limit
|
|
223
|
-
|
|
224
|
-
|
|
361
|
+
doctrine lives behind the trigger, not in the always-loaded file. Honest limit,
|
|
362
|
+
tightened now that a second hook rides the same matcher: the guards enforce
|
|
363
|
+
mechanically exactly the rules that pass a chokepoint — the budget check, and
|
|
364
|
+
the dispatch-shape rules (§The delegation model) — and protocol literacy
|
|
365
|
+
beyond those stays unenforced. A session that dispatches without invoking the
|
|
366
|
+
skill still carries only the resident pointer for everything else.
|
|
367
|
+
|
|
368
|
+
**That role qualifier is load-bearing rather than hedging.** Stated without it,
|
|
369
|
+
the rationale is role-blind: a *dispatched* role fires no such trigger — it is
|
|
370
|
+
not dispatching at all, it is executing a stage, and no stage skill or stage
|
|
371
|
+
template loads this protocol — so for that reader the pointer posture leaves the
|
|
372
|
+
rule unreached, which is how a posture nobody disputes produced three incidents.
|
|
373
|
+
§Operative residency governs that case, and the bounded imperative it sanctions
|
|
374
|
+
in a consumer's always-loaded agent definition is this same doctrine applied at a
|
|
375
|
+
different reader, not an exception carved out of this paragraph.
|
|
376
|
+
|
|
377
|
+
### Operative residency
|
|
378
|
+
|
|
379
|
+
A rule may be **restated as an imperative in a surface that does not own it**
|
|
380
|
+
when all three of these hold:
|
|
381
|
+
|
|
382
|
+
- **(a) Unreachable trigger.** The actor the rule binds never fires a trigger
|
|
383
|
+
that loads the rule's owning doc. This is a property of the *reader*, settled
|
|
384
|
+
by asking which triggers that reader actually fires.
|
|
385
|
+
- **(b) Imperative only.** What is restated is the instruction. The reasoning,
|
|
386
|
+
the failure analysis, and the mechanism stay with the owner.
|
|
387
|
+
- **(c) Adjacent citation.** The restatement names the owning surface beside
|
|
388
|
+
itself, so the owner stays the single place the rule is explained and changed.
|
|
389
|
+
|
|
390
|
+
Each condition has a reader at a transition rather than being self-evident: (a)
|
|
391
|
+
and (b) are read by whoever authors a restatement, at authoring, and again by a
|
|
392
|
+
reviewer or an authoring stage assessing an existing one; (c) is the pointer any
|
|
393
|
+
later reader — and any content-tiering check — follows back to the owner. The
|
|
394
|
+
reader the sanction exists for is the third and never inspects a condition at
|
|
395
|
+
all: the bound actor, which receives the imperative at the tier it always loads,
|
|
396
|
+
which is the whole point.
|
|
397
|
+
|
|
398
|
+
**The anti-licence clause is part of the rule, not commentary.** The sanction is
|
|
399
|
+
keyed on (a): a rule that the bound actor's own skill or template already loads
|
|
400
|
+
fails (a) and stays a pointer. Without that clause this reads as "duplicate when
|
|
401
|
+
it feels important", which is the failure content-tiering exists to prevent and
|
|
402
|
+
would cost more than the gap it closes.
|
|
403
|
+
|
|
404
|
+
**This is load-trigger residency's own logic, not an exception to it.** That
|
|
405
|
+
doctrine earns a rule a place in an always-loaded file only when no stage, skill,
|
|
406
|
+
or tool-call trigger exists to load it, and the decisive question is *exists for
|
|
407
|
+
whom*. A trigger that exists but that the bound actor never fires is, for that
|
|
408
|
+
actor, no trigger. The doctrine's stated justification — a rule a stage or a tool
|
|
409
|
+
call would load anyway costs nothing to defer and everything to keep resident —
|
|
410
|
+
does not merely fail for such an actor, it inverts: nothing loads it anyway, so
|
|
411
|
+
deferring costs everything.
|
|
412
|
+
|
|
413
|
+
**Content-tiering is satisfied by bounding what is copied, which is what (b) is
|
|
414
|
+
for.** The restatement is still a restatement, which is why it needs this
|
|
415
|
+
sanction rather than an argument; but its drift surface is one instruction rather
|
|
416
|
+
than a slab, and the place the rule is explained and changed stays single.
|
|
417
|
+
|
|
418
|
+
The attested subjects are the template's **Background + notification, never
|
|
419
|
+
poll** rule and its **Findings you will act on are durable before you act on
|
|
420
|
+
them** rule, both of which bind a dispatched session. Three such sessions read a
|
|
421
|
+
*descriptive* pointer to them at the always-loaded tier and derived no constraint
|
|
422
|
+
from it. The derivations were easy, which is what makes the failure instructive:
|
|
423
|
+
under load a descriptive sentence reads as background about one's situation
|
|
424
|
+
rather than as a constraint on the next action. The defect this rule names is
|
|
425
|
+
therefore pointer-versus-operative-statement, never absence.
|
|
426
|
+
|
|
427
|
+
**Operative is not obeyed, and a fourth firing is the attestation.** A dispatched
|
|
428
|
+
session ended its turn on work still running while the waiting rule sat in that
|
|
429
|
+
session's own agent definition as a bare imperative, restated under (a)–(c) —
|
|
430
|
+
the compliant form this sanction licenses. So the diagnosis above names a cause
|
|
431
|
+
*removed*, not the defect *closed*: residency makes a rule reachable at the point
|
|
432
|
+
of use, and reachable is not obeyed. Every restatement this sanction licenses is
|
|
433
|
+
a request delivered where it is read. Weigh it as one — worth its small drift
|
|
434
|
+
surface for the failure mode it does remove, and never a substitute for an
|
|
435
|
+
oracle where one is buildable. In the attested instance what caught the
|
|
436
|
+
consequence was the artifact-side oracle below, with the prose already in its
|
|
437
|
+
strengthened form.
|
|
438
|
+
|
|
439
|
+
**No gate is owed, and not for budget.** No check can read a session's choice to
|
|
440
|
+
end a turn — the act leaves no tracked artifact. The anti-restatement gates were
|
|
441
|
+
checked against a sanctioned restatement rather than assumed inert, since a
|
|
442
|
+
sanction that required weakening a gate would be the wrong sanction:
|
|
443
|
+
`check-shim-restatement` scans binding shims under the skills directory against a
|
|
444
|
+
corpus of the consumer's always-loaded file plus kit templates, so a consumer's
|
|
445
|
+
agent definition is neither its scanned surface nor its corpus, and
|
|
446
|
+
`check-surface-duplication`'s predicate is a glossary term's definition on a
|
|
447
|
+
canonical SPEC surface, which reaches no agent definition either. The sanction
|
|
448
|
+
therefore ships with **no gate exemption** — and the honest converse ships with
|
|
449
|
+
it: nothing in the battery would catch a *non*-compliant restatement, so (a)–(c)
|
|
450
|
+
are review-enforced. The nearest buildable oracle detects a *consequence* rather
|
|
451
|
+
than the act — `check-producer-liveness` reads a producer still running at the
|
|
452
|
+
next stage's entry (evidence-kit/SPEC.md §check-producer-liveness).
|
|
453
|
+
|
|
454
|
+
**A case where an oracle *was* buildable now sits beside this one, and the two
|
|
455
|
+
are not each other's contradiction.** The dispatch-shape rules bind acts
|
|
456
|
+
that leave no tracked artifact either, yet they are gated. The axis that
|
|
457
|
+
separates them is **interception, not durability**: a dispatch passes a
|
|
458
|
+
chokepoint the harness fires a hook on, and a turn-end passes none (§The
|
|
459
|
+
delegation model, which owns the generalization). So "no tracked artifact" is
|
|
460
|
+
why neither rule gets a *gate* over the tree, and it is not by itself a reason
|
|
461
|
+
to stop looking for an oracle. Recorded here for the same reason §The
|
|
462
|
+
delegation model records the durability rule beside the read-only-fan-out
|
|
463
|
+
caveat: otherwise the next reader re-litigates one of the two paragraphs.
|
|
225
464
|
|
|
226
465
|
## Resume journal — agent writes, scratch reset sweeps
|
|
227
466
|
|
|
@@ -244,7 +483,7 @@ break when the supervisor deletes on its own schedule instead, and both appear
|
|
|
244
483
|
only once a dispatched agent is **resumable** rather than one-shot: a resumed
|
|
245
484
|
agent is still writing to the file, and a supervisor treating the journal as
|
|
246
485
|
its **pull channel** (lifecycle-kit/templates/lead.md §Channel design)
|
|
247
|
-
destroys at the first
|
|
486
|
+
destroys at the first verified commit the channel it is supposed to keep
|
|
248
487
|
reading. A one-shot sweep hides both, which is why an eager deletion chore
|
|
249
488
|
read as correct for as long as it did.
|
|
250
489
|
|
|
@@ -266,7 +505,7 @@ file's last line**, since a session resumed past its own marker appends after
|
|
|
266
505
|
it, and a mid-file `DONE` claims a completion the later content contradicts.
|
|
267
506
|
Whether a *missing* marker signals interruption still turns on whether the
|
|
268
507
|
supervisor consumed the agent's return. On the ordinary completion path it
|
|
269
|
-
did, and that return plus its post-commit verification (§
|
|
508
|
+
did, and that return plus its post-commit verification (§Verify after every
|
|
270
509
|
agent commit) *is* the recovery contract, so the marker is redundant there.
|
|
271
510
|
Only in a **cold read** — a journal found with no return ever consumed, the
|
|
272
511
|
agent's session having died before returning (a background sandbox died, a
|
|
@@ -293,7 +532,25 @@ rule's duty falls on **the parent**, which has already demonstrated it can
|
|
|
293
532
|
write, being the session that granted the path. The two are disjoint
|
|
294
533
|
readings of one contract, not each other's contradiction.
|
|
295
534
|
|
|
296
|
-
|
|
535
|
+
**Journalling is a discharge path, not a dispatched session's privilege.** The
|
|
536
|
+
template's durability rule turns on **capability, never role** — a session
|
|
537
|
+
journals when it cannot commit and commits when it can — and this section owns
|
|
538
|
+
why the earlier role-keyed reading failed. That reading granted the journal to a
|
|
539
|
+
dispatched session and denied it to a top-level one, on the premise that a
|
|
540
|
+
top-level session is by construction able to commit. The premise is false
|
|
541
|
+
whenever another session holds the shared index, which is the *normal* condition
|
|
542
|
+
while a work unit is in flight rather than an edge case: the supervising role
|
|
543
|
+
improvised scratch notes on three separate occasions in one iteration, each time
|
|
544
|
+
because a live dispatched session held the index. Improvised scratch is the
|
|
545
|
+
journal mechanism with none of its contract — no granted path inside the sweep's
|
|
546
|
+
reach, no inline landing, no marker — so the failure was silent and the
|
|
547
|
+
reconstruction cost was paid per occurrence. Widening by capability rather than
|
|
548
|
+
carving out a second surface per role is what keeps the reclaim story unchanged:
|
|
549
|
+
every discharge path still lands in the same scratch directory the consumer's
|
|
550
|
+
own work-unit boundary already sweeps, so no new lifetime, keep-list entry, or
|
|
551
|
+
inbound-triage surface is created by the widening.
|
|
552
|
+
|
|
553
|
+
## Verify after every agent commit
|
|
297
554
|
|
|
298
555
|
Re-run the relevant gates plus the consumer's validate battery (for this
|
|
299
556
|
repo and any gate-sdk consumer: `bash gate-sdk/bin/run-gates.sh` and the
|
|
@@ -304,8 +561,49 @@ agent commit before accepting**: an agent blocked by a gate will weaken it
|
|
|
304
561
|
(a false exemption) rather than fix the code — "the gate is in my way"
|
|
305
562
|
almost always means the code doesn't fit the convention.
|
|
306
563
|
|
|
307
|
-
|
|
308
|
-
|
|
564
|
+
**The act is `verify`; the artifact stays the `validate battery`.** The
|
|
565
|
+
discipline is an act a supervisor performs; the battery is the command set
|
|
566
|
+
that act runs. One word for both made *completing the act* read as completing
|
|
567
|
+
whatever else the consumer names with that word — attested where a consumer's
|
|
568
|
+
stage roster carries it, and the near-miss was a skipped stage. Renaming the
|
|
569
|
+
act rather than the artifact is the cheap side: the battery is a binding-slot
|
|
570
|
+
name every consumer's shim carries (§One template, a resident pointer, read by
|
|
571
|
+
`check-skill-binding`), while the act is named only in prose. The result reads
|
|
572
|
+
coherently — *you verify an agent's commit by re-running the relevant gates and
|
|
573
|
+
the consumer's validate battery* — and the act and the artifact having
|
|
574
|
+
different names is the distinction that was missing.
|
|
575
|
+
|
|
576
|
+
**A verify step never runs the producer of what it is verifying.** Re-running
|
|
577
|
+
is safe and idempotent exactly when the dispatched unit's output is *work* and
|
|
578
|
+
the check's output is *a verdict about that work*; it stops being safe the
|
|
579
|
+
moment those coincide. Where a unit's deliverable **is** an evidence artifact,
|
|
580
|
+
the verify is a **read of the committed artifact**, never a re-execution of
|
|
581
|
+
what wrote it: re-running the producer mutates or duplicates the very record
|
|
582
|
+
the check exists to confirm.
|
|
583
|
+
|
|
584
|
+
**The two wrong re-runs are not equally harmful, and a supervisor needs the
|
|
585
|
+
split.** A check that writes nothing the artifact depends on is *inert* on it —
|
|
586
|
+
misrouted and wasted work, with nothing lost. Re-running the artifact's **sole
|
|
587
|
+
writer** is *destructive*. The routing defect is the same in both; only the
|
|
588
|
+
second leaves evidence to restore, and the supervisor that has already run the
|
|
589
|
+
wrong one reads this split to learn which one it is holding. Collapsing them
|
|
590
|
+
would either overstate the harm of a wasteful re-run or understate the harm of
|
|
591
|
+
the destructive one.
|
|
592
|
+
|
|
593
|
+
**Honest limit — this rule installs no oracle**, and recurrence is what
|
|
594
|
+
establishes it matters rather than a projection: the misrouting fired in two
|
|
595
|
+
consecutive iterations and an operator caught it both times. The check class
|
|
596
|
+
that would catch it is a gate over a *supervisor's choice of command*, and no
|
|
597
|
+
scanner is buildable — the choice leaves no tracked artifact to read, the same
|
|
598
|
+
structural reason §Operative residency owes no gate. A consumer whose evidence
|
|
599
|
+
producer claims a liveness lock has a partial artifact-side proxy; its coverage
|
|
600
|
+
boundary is that consumer's own mechanism to state, not this section's. So
|
|
601
|
+
detection stays human, and it is stated here rather than left implicit because
|
|
602
|
+
an unstated limit reads as an oversight for a later session to close with a
|
|
603
|
+
gate that cannot exist.
|
|
604
|
+
|
|
605
|
+
`check-gate-tamper` is the mechanical floor under the diff-every-gate-change
|
|
606
|
+
duty. Two assertions, blocking the two attested tamper shapes:
|
|
309
607
|
|
|
310
608
|
- **A — gate-edit isolation.** A commit that touches a gate file (the
|
|
311
609
|
`DELEGATION_KIT_GATE_FILES` globs) may touch only meta-layer paths
|
|
@@ -680,9 +978,12 @@ delegation-kit/
|
|
|
680
978
|
bin/usage-trend.sh # footprint trend reporter over the history log
|
|
681
979
|
bin/run-usage-tests.sh # verdict decision-table runner
|
|
682
980
|
bin/run-budget-guard-tests.sh # budget-guard decision-table runner
|
|
981
|
+
bin/run-dispatch-guard-tests.sh # dispatch-guard decision-table runner (D1/D2/D3)
|
|
683
982
|
bin/run-trend-tests.sh # trend-reporter assertion runner
|
|
983
|
+
lib/delegation.sh # shared helpers for the usage tools and the kit's gates
|
|
684
984
|
usage-tests/cases.tsv # expected-verdict <TAB> scenario knobs
|
|
685
985
|
usage-tests/budget-guard-cases.tsv # expected-action <TAB> scenario knobs
|
|
986
|
+
usage-tests/dispatch-guard-cases.tsv # expected-outcome <TAB> scenario knobs
|
|
686
987
|
usage-tests/trend-history.log # fixture history for the trend runner
|
|
687
988
|
checks/check-gate-tamper.sh
|
|
688
989
|
checks/check-rule-citation.sh
|
|
@@ -693,6 +994,7 @@ delegation-kit/
|
|
|
693
994
|
templates/agent-execution.md # full protocol, bound as a skill shim
|
|
694
995
|
templates/dispatch-checklists.md # deletion/rename/audit pre-flight, reached by a pointer
|
|
695
996
|
templates/agent-budget-guard.sh # PreToolUse(Agent) budget guard
|
|
997
|
+
templates/agent-dispatch-guard.sh # PreToolUse(Agent) dispatch-shape guard (D1/D2/D3)
|
|
696
998
|
templates/statusline-usage.sh # push usage.txt producer (statusline hook) + status bar
|
|
697
999
|
templates/usage-poller.sh # poll usage.txt producer (timer-driven, fail-soft)
|
|
698
1000
|
templates/delegation-config.sh # knob overrides (arrays live here)
|
|
@@ -762,13 +1064,23 @@ layout as defaults):
|
|
|
762
1064
|
reports its counted-inert clean line (§check-agent-tier-explicit).
|
|
763
1065
|
- `DELEGATION_KIT_GATE_FILES` — globs naming gate files for tamper
|
|
764
1066
|
assertion A; default
|
|
765
|
-
`("${GATE_SDK_GATES_DIR:-scripts}/check-*.sh")`
|
|
766
|
-
|
|
1067
|
+
`("${GATE_SDK_GATES_DIR:-scripts}/check-*.sh" "${GATE_SDK_GATES_DIR:-scripts}/check-*.gate")`
|
|
1068
|
+
plus the gate-sdk lib and
|
|
1069
|
+
runners. **Both declaration spellings are on the default**, because a gate's
|
|
1070
|
+
declaration path is `<name>.sh` *or* `<name>.gate`
|
|
1071
|
+
(gate-sdk/SPEC.md §The `# graph:` manifest)
|
|
1072
|
+
and a consumer on the default would otherwise receive a
|
|
1073
|
+
ported gate whose edits escape the isolation rule entirely — the widening the
|
|
1074
|
+
`check-gate-tamper` row of
|
|
1075
|
+
gate-sdk/SPEC.md §Meta-gate conservation for the binary substrate
|
|
1076
|
+
mandates, come due at the first live descriptor.
|
|
1077
|
+
A consumer declaration **replaces** this default outright rather
|
|
767
1078
|
than extending it — the loader guards it with `declare -p … ||`, so the
|
|
768
1079
|
default is the no-declaration fallback, not a base to append to. A consumer
|
|
769
1080
|
adding kit-shipped globs must therefore restate any default glob it still
|
|
770
|
-
wants covered (this repo's config names `*/checks/*.sh`
|
|
771
|
-
`scripts/check
|
|
1081
|
+
wants covered (this repo's config names `*/checks/*.sh` and `*/checks/*.gate`
|
|
1082
|
+
**and** their `scripts/check-*` counterparts, because it has gates in both
|
|
1083
|
+
places). Contrast
|
|
772
1084
|
`DELEGATION_KIT_META_PATHS` below, whose kit-root union *is* additive — the
|
|
773
1085
|
two knobs do not behave alike.
|
|
774
1086
|
- `DELEGATION_KIT_META_PATHS` — prefixes counted as meta-layer for
|
|
@@ -782,6 +1094,23 @@ layout as defaults):
|
|
|
782
1094
|
filter: a
|
|
783
1095
|
prefix the consumer declared cannot be lost, and without `gate.sh` the config
|
|
784
1096
|
is used exactly as written.
|
|
1097
|
+
- `DELEGATION_KIT_READONLY_TYPES` — agent-type names the consumer dispatches for
|
|
1098
|
+
read-only work; D2's only trigger (§The delegation model). Default empty, in
|
|
1099
|
+
which case D2 is inert by construction. Every entry is the consumer's own
|
|
1100
|
+
agent roster, never the kit's (CLAUDE.md §The provenance seam) — the same
|
|
1101
|
+
reasoning that ships `GUARD_KIT_BREADTH_PROBES` with no default probes.
|
|
1102
|
+
Deliberately not knobbed alongside it, each ruled out for a stated reason: a
|
|
1103
|
+
fork-type-name knob and an accepted-isolation-values knob — `fork` and
|
|
1104
|
+
`worktree` are the **harness's** dispatch vocabulary, and a guard template
|
|
1105
|
+
carries its harness's tool vocabulary as literals the same way
|
|
1106
|
+
`wakeup-guard.sh` matches `ScheduleWakeup`/`CronCreate` literally, so
|
|
1107
|
+
knobbing them would imply a portability the mechanism does not have; a
|
|
1108
|
+
warn-only or per-rule opt-out — a doctrine downgradable per session is the
|
|
1109
|
+
honour system these rules exist to end, so the valve stays the whole guard's
|
|
1110
|
+
registration, never a finer one; and accepting `isolation: remote` as
|
|
1111
|
+
satisfying D2 — plausibly correct (a remote agent cannot touch the local
|
|
1112
|
+
index) but unverified from here, and remote availability is gated, so it is
|
|
1113
|
+
excluded with its reason recorded rather than admitted on plausibility.
|
|
785
1114
|
|
|
786
1115
|
`check-gate-tamper` registers in the consumer's `gates.list`
|
|
787
1116
|
(tier: precommit) — in this repo's too; dogfooding is day-one, and agents
|
|
@@ -798,6 +1127,17 @@ its consumer session brief (`scripts/session-context.sh`) additionally prints
|
|
|
798
1127
|
the verdict line at SessionStart for planning-time visibility — a consumer-side
|
|
799
1128
|
edit; the context-kit template stays uncoupled from delegation-kit.
|
|
800
1129
|
|
|
1130
|
+
`agent-dispatch-guard.sh` is a second hook on that same matcher, registered the
|
|
1131
|
+
same way and **independently**: the harness fires every hook a matcher carries
|
|
1132
|
+
and any exit 2 blocks, so neither guard knows about the other and a consumer
|
|
1133
|
+
may wire either one alone (§The delegation model owns why they are two scripts
|
|
1134
|
+
rather than one). It resolves `guard-kit/lib/guard.sh` at its vendored path,
|
|
1135
|
+
overridable with `GUARD_KIT_LIB`, and reads the consumer's delegation config for
|
|
1136
|
+
D2's roster and nothing else. Registration is again the whole opt-in: unwired,
|
|
1137
|
+
it is inert — and an unwired dispatch guard is the exact failure shape it
|
|
1138
|
+
exists to catch, so wiring it is not optional dogfooding for a consumer that
|
|
1139
|
+
delegates.
|
|
1140
|
+
|
|
801
1141
|
**An `OK` verdict is a floor, not a recommendation.** The guard answers one
|
|
802
1142
|
question — is there headroom in the window *right now* — and blocks only on
|
|
803
1143
|
`PAUSE`. Everything else a dispatch decision turns on sits outside its reach:
|
|
@@ -910,6 +1250,36 @@ its firing (PAUSE) and non-firing (the four advise cases) — the fixture-pair
|
|
|
910
1250
|
discipline again — and every case asserts the live verdict text rides the
|
|
911
1251
|
output so a memory-quoted percentage cannot be the acting source.
|
|
912
1252
|
|
|
1253
|
+
`agent-dispatch-guard.sh` takes its own decision-table lane rather than
|
|
1254
|
+
guard-kit's `guard-tests/` (keyed on a command, or a to+message — neither can
|
|
1255
|
+
express a dispatch's parameters, the same reason the budget guard has its own
|
|
1256
|
+
runner) or the budget guard's table (a different payload grammar again):
|
|
1257
|
+
`usage-tests/dispatch-guard-cases.tsv` pairs an expected outcome
|
|
1258
|
+
(`block`/`advise`/`fallthrough`) with `subagent_type isolation nested desc`,
|
|
1259
|
+
and `bin/run-dispatch-guard-tests.sh` drives the *template* with a built Agent
|
|
1260
|
+
hook payload — `tool_input.subagent_type`/`.isolation`, and, for a nested case,
|
|
1261
|
+
the top-level `agent_id`/`agent_type` the harness only sets inside a subagent —
|
|
1262
|
+
classifying block (exit 2) / advise (exit 0, `additionalContext` present) /
|
|
1263
|
+
fallthrough (exit 0, empty stdout). The table fixes one roster for its whole
|
|
1264
|
+
run, `DELEGATION_KIT_READONLY_TYPES=(ro-type)`, supplied through a generated
|
|
1265
|
+
config file and `DELEGATION_KIT_CONFIG_FILE`; a `subagent_type` prefixed
|
|
1266
|
+
`noroster:` runs instead with no config file at all (an empty declare),
|
|
1267
|
+
stripped before it reaches the guard — the row that proves D2 is inert on the
|
|
1268
|
+
roster's *absence*, not merely on this dispatch's type missing from a
|
|
1269
|
+
populated one. Every rule carries a firing and a non-firing case (the
|
|
1270
|
+
fixture-pair discipline, transplanted): D1 — a fork blocks, a typed dispatch
|
|
1271
|
+
under an empty roster does not; D2 — a rostered type without isolation blocks,
|
|
1272
|
+
the same type with `isolation: worktree` does not, an unrostered type under a
|
|
1273
|
+
populated roster does not, and the empty-roster case does not; D3 — a payload
|
|
1274
|
+
carrying `agent_id` advises, one without it falls through. The degradation
|
|
1275
|
+
posture gets its own case rather than being asserted only in prose: an
|
|
1276
|
+
unparseable payload (`subagent_type` `UNPARSEABLE`, sent as invalid JSON on
|
|
1277
|
+
stdin) advises rather than blocks — the assertion that makes delta 6's
|
|
1278
|
+
fail-open-but-loud posture testable, not merely stated, and the one case this
|
|
1279
|
+
lane must not drop for brevity. The runner strips ambient `DELEGATION_KIT_*` at
|
|
1280
|
+
every invocation, the discipline `run-budget-guard-tests.sh` already uses, so a
|
|
1281
|
+
consumer's live roster or config-file pointer cannot leak into the fixture.
|
|
1282
|
+
|
|
913
1283
|
`smoke/install.sh` copies the templates and `bin/` tools into the scratch
|
|
914
1284
|
consumer, registers the tamper gate, and drives one crafted snapshot
|
|
915
1285
|
through `usage-verdict` asserting a verdict — self-verifying install. It opens
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# spec: delegation-kit/SPEC.md §Testing — decision-table runner for the Agent dispatch-shape guard (D1 fork ban, D2 read-only isolation claim, D3 nested-dispatch advisory)
|
|
3
|
+
#
|
|
4
|
+
# usage: run-dispatch-guard-tests.sh [cases.tsv]
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
|
|
7
|
+
KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
8
|
+
GUARD="$KIT/templates/agent-dispatch-guard.sh"
|
|
9
|
+
LIB="$KIT/../guard-kit/lib/guard.sh"
|
|
10
|
+
CASES="${1:-$KIT/usage-tests/dispatch-guard-cases.tsv}"
|
|
11
|
+
|
|
12
|
+
for f in "$GUARD" "$LIB" "$CASES"; do
|
|
13
|
+
[[ -f "$f" ]] || { echo "run-dispatch-guard-tests: missing $f" >&2; exit 2; }
|
|
14
|
+
done
|
|
15
|
+
command -v jq >/dev/null 2>&1 || { echo "run-dispatch-guard-tests: jq not found on PATH" >&2; exit 2; }
|
|
16
|
+
|
|
17
|
+
# spec: delegation-kit/SPEC.md §Testing — strip ambient DELEGATION_KIT_* at every guard invocation, the discipline run-budget-guard-tests.sh already uses, so a consumer's live roster or config-file pointer cannot leak into the fixture
|
|
18
|
+
DK_UNSET=()
|
|
19
|
+
while IFS= read -r name; do DK_UNSET+=(-u "$name"); done < <(env | grep -o '^DELEGATION_KIT_[A-Za-z0-9_]*')
|
|
20
|
+
|
|
21
|
+
SANDBOX="$(mktemp -d)"
|
|
22
|
+
trap 'rm -rf "$SANDBOX"' EXIT
|
|
23
|
+
ROSTER_CFG="$SANDBOX/roster-config.sh"
|
|
24
|
+
ERR="$SANDBOX/err"
|
|
25
|
+
printf '%s\n' 'DELEGATION_KIT_READONLY_TYPES=(ro-type)' > "$ROSTER_CFG"
|
|
26
|
+
|
|
27
|
+
classify() {
|
|
28
|
+
local rc="$1" out="$2"
|
|
29
|
+
if [[ "$rc" -eq 2 ]]; then echo block; return; fi
|
|
30
|
+
if [[ "$rc" -ne 0 ]]; then echo "exit$rc"; return; fi
|
|
31
|
+
if grep -q '"additionalContext"' <<<"$out"; then echo advise; return; fi
|
|
32
|
+
if [[ -z "$out" ]]; then echo fallthrough; return; fi
|
|
33
|
+
echo unknown
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# spec: delegation-kit/SPEC.md §Testing — builds a real hook payload (tool_input plus, for a nested case, the top-level agent_id/agent_type the harness only sets inside a subagent), so the guard's own jq extraction is exercised rather than a hand-rolled shortcut
|
|
37
|
+
build_payload() {
|
|
38
|
+
local type="$1" isolation="$2" nested="$3" nb='false'
|
|
39
|
+
[[ "$nested" == yes ]] && nb='true'
|
|
40
|
+
jq -nc --arg t "$type" --arg iso "$isolation" --argjson nested "$nb" '
|
|
41
|
+
{tool_name: "Agent",
|
|
42
|
+
tool_input: (
|
|
43
|
+
(if $t != "" then {subagent_type: $t} else {} end)
|
|
44
|
+
+ (if $iso != "" then {isolation: $iso} else {} end)
|
|
45
|
+
)}
|
|
46
|
+
+ (if $nested then {agent_id: "agent_child", agent_type: "stage-session"} else {} end)
|
|
47
|
+
'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
fails=0
|
|
51
|
+
ran=0
|
|
52
|
+
|
|
53
|
+
while IFS=$'\t' read -r want rawtype isolation nested desc; do
|
|
54
|
+
[[ -z "${want// }" ]] && continue
|
|
55
|
+
[[ "$want" == \#* ]] && continue
|
|
56
|
+
|
|
57
|
+
type="$rawtype"
|
|
58
|
+
cfg_file="$ROSTER_CFG"
|
|
59
|
+
case "$rawtype" in
|
|
60
|
+
noroster:*) type="${rawtype#noroster:}"; cfg_file="" ;;
|
|
61
|
+
esac
|
|
62
|
+
|
|
63
|
+
iso="$isolation"; [[ "$iso" == "-" ]] && iso=""
|
|
64
|
+
nst="$nested"; [[ "$nst" != "yes" ]] && nst="no"
|
|
65
|
+
|
|
66
|
+
if [[ "$rawtype" == "UNPARSEABLE" ]]; then
|
|
67
|
+
payload='this is not { json'
|
|
68
|
+
else
|
|
69
|
+
payload="$(build_payload "$type" "$iso" "$nst")"
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
envargs=(GUARD_KIT_LIB="$LIB")
|
|
73
|
+
[[ -n "$cfg_file" ]] && envargs+=(DELEGATION_KIT_CONFIG_FILE="$cfg_file")
|
|
74
|
+
|
|
75
|
+
out="$( cd "$SANDBOX" && printf '%s' "$payload" \
|
|
76
|
+
| env "${DK_UNSET[@]}" "${envargs[@]}" bash "$GUARD" 2>"$ERR" )"
|
|
77
|
+
rc=$?
|
|
78
|
+
err="$(cat "$ERR" 2>/dev/null)"
|
|
79
|
+
got="$(classify "$rc" "$out")"
|
|
80
|
+
ran=$((ran + 1))
|
|
81
|
+
|
|
82
|
+
if [[ "$got" != "$want" ]]; then
|
|
83
|
+
echo " FAIL [$desc]: want '$want', got '$got' (rc=$rc) -- out=$out err=$err"
|
|
84
|
+
fails=$((fails + 1))
|
|
85
|
+
fi
|
|
86
|
+
done < "$CASES"
|
|
87
|
+
|
|
88
|
+
if [[ "$ran" -eq 0 ]]; then
|
|
89
|
+
echo "run-dispatch-guard-tests: no cases parsed from $CASES" >&2
|
|
90
|
+
exit 2
|
|
91
|
+
fi
|
|
92
|
+
if [[ "$fails" -gt 0 ]]; then
|
|
93
|
+
echo "run-dispatch-guard-tests: $fails/$ran case(s) failed"
|
|
94
|
+
exit 1
|
|
95
|
+
fi
|
|
96
|
+
echo "run-dispatch-guard-tests: ok ($ran cases across D1/D2/D3 and the degradation posture)"
|
|
97
|
+
exit 0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# graph: couples=kit:*.sh dir=one valve=none tier=precommit
|
|
3
|
-
# spec: delegation-kit/SPEC.md §
|
|
3
|
+
# spec: delegation-kit/SPEC.md §Verify after every agent commit — a gate-weakening commit is blocked by shape (A gate edits stay meta-isolated; B a new path-exemption can't excuse a co-staged file)
|
|
4
4
|
#
|
|
5
5
|
# --fixture <dir> injects staged-files / added-exemptions lists; live mode reads git diff --cached.
|
|
6
6
|
set -uo pipefail
|
|
@@ -31,6 +31,7 @@ unset _dk_cfg
|
|
|
31
31
|
|
|
32
32
|
declare -p DELEGATION_KIT_GATE_FILES &>/dev/null || DELEGATION_KIT_GATE_FILES=(
|
|
33
33
|
"${GATE_SDK_GATES_DIR:-scripts}/check-*.sh"
|
|
34
|
+
"${GATE_SDK_GATES_DIR:-scripts}/check-*.gate"
|
|
34
35
|
"${GATE_SDK_GATES_DIR:-scripts}/lib/gate.sh"
|
|
35
36
|
"${GATE_SDK_GATES_DIR:-scripts}/run-gate-tests.sh"
|
|
36
37
|
)
|
|
@@ -15,6 +15,7 @@ cat >> scripts/gates.list <<'EOF'
|
|
|
15
15
|
# delegation-kit
|
|
16
16
|
check-gate-tamper
|
|
17
17
|
check-agent-tier-explicit
|
|
18
|
+
check-rule-citation
|
|
18
19
|
EOF
|
|
19
20
|
|
|
20
21
|
snap="$(mktemp)"
|
|
@@ -59,4 +60,4 @@ cmp -s "$pp/usage.before" "$pp/usage.txt" || {
|
|
|
59
60
|
rm -rf "$pp"
|
|
60
61
|
|
|
61
62
|
bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
|
|
62
|
-
bash "$SDK/checks/check-graph.sh" --emit >
|
|
63
|
+
bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html
|