checkwright 0.17.0 → 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.
Files changed (78) hide show
  1. package/package.json +2 -2
  2. package/payload/canon-kit/README.md +1 -0
  3. package/payload/canon-kit/SPEC.md +162 -16
  4. package/payload/canon-kit/checks/check-amendment-queue.sh +17 -16
  5. package/payload/canon-kit/checks/check-install-claim.sh +146 -0
  6. package/payload/canon-kit/gate-tests/check-amendment-queue/good/TASK-QUEUE.md +1 -1
  7. package/payload/canon-kit/gate-tests/check-deprecation-task/good/TASK-QUEUE.md +1 -1
  8. package/payload/canon-kit/gate-tests/check-install-claim/bad/README.md +12 -0
  9. package/payload/canon-kit/gate-tests/check-install-claim/bad/expect.txt +1 -0
  10. package/payload/canon-kit/gate-tests/check-install-claim/bad/install.md +24 -0
  11. package/payload/canon-kit/gate-tests/check-install-claim/bad/posts/note.md +7 -0
  12. package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.sh +10 -0
  13. package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/install-transports.sh +7 -0
  14. package/payload/canon-kit/gate-tests/check-install-claim/good/README.md +12 -0
  15. package/payload/canon-kit/gate-tests/check-install-claim/good/expect.txt +1 -0
  16. package/payload/canon-kit/gate-tests/check-install-claim/good/install.md +24 -0
  17. package/payload/canon-kit/gate-tests/check-install-claim/good/posts/note.md +7 -0
  18. package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.sh +10 -0
  19. package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/install-transports.sh +7 -0
  20. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/TASK-QUEUE.md +1 -1
  21. package/payload/canon-kit/lib/spec.sh +32 -2
  22. package/payload/context-kit/SPEC.md +5 -0
  23. package/payload/context-kit/checks/check-footprint-fresh.sh +1 -1
  24. package/payload/delegation-kit/SPEC.md +12 -0
  25. package/payload/drift-kit/README.md +4 -4
  26. package/payload/drift-kit/SPEC.md +58 -5
  27. package/payload/drift-kit/bin/drift-report.sh +14 -11
  28. package/payload/drift-kit/bin/overhead-meter.sh +1 -1
  29. package/payload/drift-kit/kpis/kpi-deferred-age.sh +7 -5
  30. package/payload/drift-kit/kpis/kpi-queue-net-delta.sh +74 -0
  31. package/payload/drift-kit/smoke/install.sh +1 -1
  32. package/payload/gate-sdk/SPEC.md +17 -2
  33. package/payload/lifecycle-kit/README.md +2 -2
  34. package/payload/lifecycle-kit/SPEC.md +57 -34
  35. package/payload/lifecycle-kit/bin/enter-stage.sh +1 -1
  36. package/payload/lifecycle-kit/checks/check-shim-restatement.sh +1 -1
  37. package/payload/lifecycle-kit/checks/check-skill-binding.sh +1 -1
  38. package/payload/lifecycle-kit/templates/{skills → stages}/close.md +8 -8
  39. package/payload/lifecycle-kit/templates/{skills → stages}/scope.md +1 -1
  40. package/payload/queue-kit/README.md +26 -10
  41. package/payload/queue-kit/SPEC.md +463 -32
  42. package/payload/queue-kit/bin/queue-index.sh +62 -11
  43. package/payload/queue-kit/bin/roadmap.sh +76 -0
  44. package/payload/queue-kit/checks/check-queue-entry-budget.sh +104 -0
  45. package/payload/queue-kit/checks/check-roadmap-fresh.sh +110 -0
  46. package/payload/queue-kit/checks/check-tag-lead-line.sh +12 -8
  47. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +33 -0
  48. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +4 -0
  49. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.sh +6 -0
  50. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +35 -0
  51. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.sh +6 -0
  52. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/TASK-QUEUE.md +24 -0
  53. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/args +5 -0
  54. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/emit.txt +8 -0
  55. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/expect.txt +1 -0
  56. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/projection.txt +16 -0
  57. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.sh +6 -0
  58. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/TASK-QUEUE.md +22 -0
  59. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/args +5 -0
  60. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/emit.txt +7 -0
  61. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/expect.txt +1 -0
  62. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/projection.txt +16 -0
  63. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.sh +6 -0
  64. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/TASK-QUEUE.md +3 -0
  65. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/expect.txt +1 -0
  66. package/payload/queue-kit/gate-tests/check-tag-lead-line/good/TASK-QUEUE.md +2 -1
  67. package/payload/queue-kit/gate-tests/queue-index.test.sh +45 -4
  68. package/payload/queue-kit/gate-tests/roadmap.test.sh +197 -0
  69. package/payload/queue-kit/lib/queue.sh +87 -1
  70. package/payload/queue-kit/smoke/install.sh +1 -0
  71. package/payload/queue-kit/templates/TASK-QUEUE.md +1 -1
  72. package/payload/site-kit/SPEC.md +6 -0
  73. /package/payload/lifecycle-kit/templates/{skills/release-sweep.md → release-sweep.md} +0 -0
  74. /package/payload/lifecycle-kit/templates/{skills → stages}/align.md +0 -0
  75. /package/payload/lifecycle-kit/templates/{skills → stages}/build.md +0 -0
  76. /package/payload/lifecycle-kit/templates/{skills → stages}/spec.md +0 -0
  77. /package/payload/lifecycle-kit/templates/{skills → stages}/validate.md +0 -0
  78. /package/payload/lifecycle-kit/templates/{skills/upgrade.md → upgrade.md} +0 -0
@@ -0,0 +1,24 @@
1
+ # Install widget
2
+
3
+ The npm package is an installer rather than a dependency channel, and `npx
4
+ widget init` is what it runs. This preamble sits under the H1 alone, so no
5
+ section scope reaches it.
6
+
7
+ ## Install
8
+
9
+ <!-- install-primary: tarball -->
10
+
11
+ Download the asset and its checksum, verify, extract, run:
12
+
13
+ ```bash
14
+ curl -fsSL -o widget.tgz \
15
+ https://example.invalid/widget/releases/download/vX.Y.Z/widget.tgz
16
+ ```
17
+
18
+ If Node is already on your machine the same install is `npx widget init`. Same
19
+ payload, same result; only the fetch differs.
20
+
21
+ ## Requirements
22
+
23
+ A section the configured regex does not select. `npx widget init` here is out of
24
+ scope entirely.
@@ -0,0 +1,7 @@
1
+ # widget vX.Y.Z
2
+
3
+ ## Install
4
+
5
+ `npx widget init` is what this release announced, and a published note is an
6
+ immutable record of what was true when it shipped. The path valve keeps it out
7
+ of the scanned set rather than forcing an edit to history.
@@ -0,0 +1,10 @@
1
+ # shellcheck shell=bash
2
+ # spec: canon-kit/SPEC.md §check-install-claim — fixture consumer config: two transports, an anchored install-section regex, and the published-notes valve the pair proves is load-bearing
3
+ # shellcheck disable=SC2034 # consumed by canon-kit/lib/spec.sh after sourcing
4
+ CANON_KIT_MANIFEST_FILES=("*.md" "posts/*.md")
5
+ # shellcheck disable=SC2034 # consumed by canon-kit/lib/spec.sh after sourcing
6
+ CANON_KIT_INSTALL_TRANSPORTS_CMD="bash scripts/install-transports.sh"
7
+ # shellcheck disable=SC2034 # consumed by canon-kit/lib/spec.sh after sourcing
8
+ CANON_KIT_INSTALL_SECTION_RE='^(Quick start|Install)'
9
+ # shellcheck disable=SC2034 # consumed by canon-kit/lib/spec.sh after sourcing
10
+ CANON_KIT_INSTALL_CLAIM_EXCLUDE=("posts/*")
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+ # spec: canon-kit/SPEC.md §check-install-claim — fixture transport vocabulary: recipe form and prose form per transport, neither pattern reaching into the other's sentences
3
+ set -uo pipefail
4
+
5
+ printf '%s\t%s\n' \
6
+ tarball 'releases/download/|[Rr]elease tarball' \
7
+ npm 'npx( -y)? widget|npm (install|i)( -g)? widget'
@@ -14,7 +14,7 @@
14
14
 
15
15
  ## Deferred
16
16
 
17
- - **later-thing** [needs-spec] — a deferred design.
17
+ - **later-thing** [design-pending] — a deferred design.
18
18
 
19
19
  ## Done
20
20
 
@@ -29,6 +29,7 @@ declare -p CANON_KIT_FEATURE_SECTIONS &>/dev/null || CANON_KIT_FEATURE_SECTIONS=
29
29
  declare -p CANON_KIT_ACTIVE_SECTIONS &>/dev/null || CANON_KIT_ACTIVE_SECTIONS=("New Features" "Technical Debt")
30
30
 
31
31
  [[ -v CANON_KIT_DEFERRED_SECTION ]] || CANON_KIT_DEFERRED_SECTION="Deferred"
32
+ [[ -v CANON_KIT_ICEBOX_SECTION ]] || CANON_KIT_ICEBOX_SECTION=""
32
33
 
33
34
  [[ -v CANON_KIT_DOD_HEADING ]] || CANON_KIT_DOD_HEADING="Definition of Done"
34
35
  [[ -v CANON_KIT_DOD_MODE ]] || CANON_KIT_DOD_MODE="exactly-one"
@@ -92,6 +93,10 @@ declare -p CANON_KIT_COUNT_ALLOWED_PHRASES &>/dev/null || CANON_KIT_COUNT_ALLOWE
92
93
 
93
94
  [[ -v CANON_KIT_ENUM_SETS_CMD ]] || CANON_KIT_ENUM_SETS_CMD=""
94
95
 
96
+ [[ -v CANON_KIT_INSTALL_TRANSPORTS_CMD ]] || CANON_KIT_INSTALL_TRANSPORTS_CMD=""
97
+ [[ -v CANON_KIT_INSTALL_SECTION_RE ]] || CANON_KIT_INSTALL_SECTION_RE=""
98
+ declare -p CANON_KIT_INSTALL_CLAIM_EXCLUDE &>/dev/null || CANON_KIT_INSTALL_CLAIM_EXCLUDE=()
99
+
95
100
  declare -p CANON_KIT_COMMENT_MACHINE &>/dev/null || CANON_KIT_COMMENT_MACHINE=()
96
101
  declare -p CANON_KIT_COMMENT_REASON &>/dev/null || CANON_KIT_COMMENT_REASON=()
97
102
  declare -p CANON_KIT_COMMENT_SURFACE &>/dev/null || CANON_KIT_COMMENT_SURFACE=()
@@ -129,8 +134,12 @@ spec_alt() { local IFS='|'; printf '%s' "$*"; }
129
134
  SPEC_FEATURE_RE="^## ($(spec_alt "${CANON_KIT_FEATURE_SECTIONS[@]}"))[[:space:]]*$"
130
135
  # shellcheck disable=SC2034 # consumed by sourcing gates, never within this lib
131
136
  SPEC_ACTIVE_RE="^## ($(spec_alt "${CANON_KIT_ACTIVE_SECTIONS[@]}"))[[:space:]]*$"
137
+ # spec: canon-kit/SPEC.md §The amendment lifecycle — the design-pending regex is the section *set*, deferred plus a configured icebox, so the tag's section-wide rule and the queue-resolution walk reach both with no per-gate edit; the icebox term is omitted when the knob is empty
138
+ _sk_dp=("$CANON_KIT_DEFERRED_SECTION")
139
+ [[ -n "$CANON_KIT_ICEBOX_SECTION" ]] && _sk_dp+=("$CANON_KIT_ICEBOX_SECTION")
132
140
  # shellcheck disable=SC2034 # consumed by sourcing gates, never within this lib
133
- SPEC_DEFERRED_RE="^## ${CANON_KIT_DEFERRED_SECTION}[[:space:]]*$"
141
+ SPEC_DEFERRED_RE="^## ($(spec_alt "${_sk_dp[@]}"))[[:space:]]*$"
142
+ unset _sk_dp
134
143
  # shellcheck disable=SC2034 # consumed by sourcing gates, never within this lib
135
144
  SPEC_SECTION_RE="^## "
136
145
 
@@ -187,7 +196,7 @@ spec_amendments() { gate_find "$1" -name "$CANON_KIT_AMENDMENT_GLOB" -type f 2>/
187
196
 
188
197
  # spec: canon-kit/SPEC.md §check-spec-pointer — a prose-surface candidate joins the
189
198
  # manifest set iff slot-free: no `*<name: …>*` binding slot (the grammar
190
- # lifecycle-kit/SPEC.md §templates/skills/ owns), no `CONSUMER BINDING` header.
199
+ # lifecycle-kit/SPEC.md §templates/stages/ owns), no `CONSUMER BINDING` header.
191
200
  _spec_slot_free() { ! grep -qE '\*<[a-z][a-z0-9-]*:|^CONSUMER BINDING' -- "$1"; }
192
201
 
193
202
  # spec: canon-kit/SPEC.md §lib/spec.sh — the manifest set shared by the manifest-narration gate family: canonical specs (kit-root pruned per CANON_KIT_SCAN_KIT_ROOTS) plus README.md at any depth and CLAUDE.md; explicit globs when CANON_KIT_MANIFEST_FILES is set. Amendments are excluded by construction — a transition artifact describes change. Slot-free CANON_KIT_PROSE_SURFACE_GLOBS candidates join the set (canon-kit/SPEC.md §check-spec-pointer).
@@ -442,12 +451,33 @@ spec_enum_sets() {
442
451
  return 0
443
452
  }
444
453
 
454
+ # spec: canon-kit/SPEC.md §check-install-claim — run the consumer's transport command and echo its validated <transport-id><TAB><ERE> lines; a command that fails, a line that does not parse, or a duplicate id returns 2 (fail-closed), the same contract spec_enum_sets carries. Empty CANON_KIT_INSTALL_TRANSPORTS_CMD is the caller's clean-skip signal, handled before this is called.
455
+ spec_install_transports() {
456
+ local out st line id ere seen=""
457
+ out="$(bash -c "$CANON_KIT_INSTALL_TRANSPORTS_CMD")"; st=$?
458
+ [[ $st -eq 0 ]] || { echo "spec_install_transports: CANON_KIT_INSTALL_TRANSPORTS_CMD exited $st" >&2; return 2; }
459
+ while IFS= read -r line; do
460
+ [[ -n "$line" ]] || continue
461
+ [[ "$line" == *$'\t'* ]] || { echo "spec_install_transports: line has no tab: '$line'" >&2; return 2; }
462
+ id="${line%%$'\t'*}"; ere="${line#*$'\t'}"
463
+ [[ -n "$id" && -n "$ere" ]] || { echo "spec_install_transports: empty id or pattern: '$line'" >&2; return 2; }
464
+ [[ "$ere" == *$'\t'* ]] && { echo "spec_install_transports: extra tab in line: '$line'" >&2; return 2; }
465
+ [[ "$id" =~ ^[a-z0-9][a-z0-9-]*$ ]] || { echo "spec_install_transports: id is not slug-shaped: '$id'" >&2; return 2; }
466
+ [[ " $seen " == *" $id "* ]] && { echo "spec_install_transports: duplicate transport id: '$id'" >&2; return 2; }
467
+ seen="$seen $id"
468
+ printf '%s\t%s\n' "$id" "$ere"
469
+ done <<< "$out"
470
+ return 0
471
+ }
472
+
445
473
  _sk_errs=()
446
474
  [[ -n "$CANON_KIT_SPEC_NAME" ]] || _sk_errs+=("CANON_KIT_SPEC_NAME is empty")
447
475
  [[ -n "$CANON_KIT_AMENDMENT_GLOB" ]] || _sk_errs+=("CANON_KIT_AMENDMENT_GLOB is empty")
448
476
  [[ ${#CANON_KIT_FEATURE_SECTIONS[@]} -gt 0 ]] || _sk_errs+=("CANON_KIT_FEATURE_SECTIONS is empty")
449
477
  [[ ${#CANON_KIT_ACTIVE_SECTIONS[@]} -gt 0 ]] || _sk_errs+=("CANON_KIT_ACTIVE_SECTIONS is empty")
450
478
  [[ -n "$CANON_KIT_DEFERRED_SECTION" ]] || _sk_errs+=("CANON_KIT_DEFERRED_SECTION is empty")
479
+ [[ "$CANON_KIT_ICEBOX_SECTION" != "$CANON_KIT_DEFERRED_SECTION" ]] \
480
+ || _sk_errs+=("CANON_KIT_ICEBOX_SECTION must not name the deferred section")
451
481
  [[ -n "$CANON_KIT_DOD_HEADING" ]] || _sk_errs+=("CANON_KIT_DOD_HEADING is empty")
452
482
  [[ "$CANON_KIT_DOD_MODE" == "exactly-one" || "$CANON_KIT_DOD_MODE" == "at-most-one" ]] \
453
483
  || _sk_errs+=("CANON_KIT_DOD_MODE must be exactly-one|at-most-one (got '$CANON_KIT_DOD_MODE')")
@@ -88,6 +88,11 @@ session. Steps, in order:
88
88
  cursor-lag rule below — firing on close is what hands the full board to
89
89
  the first scope session, which reads `close` at session start. On any
90
90
  other stage the full listing is pure recurring cost.
91
+ A configured icebox tier rides **both** branches as a one-line tally, so
92
+ this step needs no new stage routing: a dormant entry is already one line,
93
+ so there is no full listing of it to withhold, and the eviction work that
94
+ reads the tier reads `queue-index.sh --icebox-candidates` rather than this
95
+ index.
91
96
  2. **Dirty-surface pre-run** — for each component with uncommitted
92
97
  changes, pre-run the matching surface index (default: `pub-index` over
93
98
  top-level dirs containing `src/`), so a resumed session's editing
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # graph: couples=docs/footprint.md,CLAUDE.md,kit:templates/*.md,lifecycle-kit/templates/skills/*.md dir=one valve=none tier=precommit trigger=docs/footprint.md,CLAUDE.md,kit:templates/*.md,lifecycle-kit/templates/skills/*.md
2
+ # graph: couples=docs/footprint.md,CLAUDE.md,kit:templates/*.md,lifecycle-kit/templates/stages/*.md dir=one valve=none tier=precommit trigger=docs/footprint.md,CLAUDE.md,kit:templates/*.md,lifecycle-kit/templates/stages/*.md
3
3
  # spec: context-kit/SPEC.md §check-footprint-fresh — docs/footprint.md is the byte-fresh projection of footprint.sh --emit
4
4
  #
5
5
  # usage: check-footprint-fresh.sh [projection-file] [emit-file]
@@ -634,6 +634,18 @@ its consumer session brief (`scripts/session-context.sh`) additionally prints
634
634
  the verdict line at SessionStart for planning-time visibility — a consumer-side
635
635
  edit; the context-kit template stays uncoupled from delegation-kit.
636
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
+
637
649
  ## Testing
638
650
 
639
651
  `check-gate-tamper` speaks the full gate contract (`GATE-TAMPER: clean
@@ -103,10 +103,10 @@ A KPI plugin is `kpi-<name>.sh`, resolved through `kpis.list` against your KPI
103
103
  dirs then each vendored kit's `kpis/`. Add your own by dropping a plugin in your
104
104
  gates dir and naming it in the registry; shadow a bundled one with a same-named
105
105
  file. The bundled set (drift-kit/SPEC.md §Bundled KPIs) covers, as lead KPIs, the
106
- queue split, the gate backlog, amendment/deferred age, prompt friction, the
107
- always-loaded surface, the local permission overlay, gate runtime, session
108
- overhead, and the price table's age and expiry; and one lag KPI,
109
- `kpi-knowledge-friction`, fed by the loop below.
106
+ queue split and its per-iteration net delta, the gate backlog, amendment/deferred
107
+ age, prompt friction, the always-loaded surface, the local permission overlay,
108
+ gate runtime, session overhead, and the price table's age and expiry; and one lag
109
+ KPI, `kpi-knowledge-friction`, fed by the loop below.
110
110
 
111
111
  ## Test
112
112
 
@@ -28,14 +28,24 @@ lives in a plugin:
28
28
  consumer KPI dir first, then each vendored kit's `kpis/` (the gate-sdk
29
29
  resolution pattern: a consumer shadows a bundled KPI by dropping a
30
30
  same-named file in its own dir).
31
- 2. Run each plugin, collect its rows, and group them into the two labeled
31
+ 2. Derive the iteration-start commit **before** the plugin export loop, not at
32
+ print time, and assign it to `DRIFT_KIT_ITERATION_START` so the loop carries
33
+ it to every plugin. Both the derivation and its invocation sit above the
34
+ loop — relocating the call alone would leave it undefined — and its inputs
35
+ are already set by that point. The report header keeps reading the same
36
+ value. **Priced, because the position is not free:** deriving it above the
37
+ loop runs it in `--trend` mode as well as in the full report, so one `grep`
38
+ and one single-file `git log -S` run on every session start through the
39
+ context hook. Accepted — a pickaxe over a file of a few dozen lines — but it
40
+ is a per-session cost rather than a per-report one.
41
+ 3. Run each plugin, collect its rows, and group them into the two labeled
32
42
  sections — the honesty labels are the frame's contract:
33
43
  - header: `=== Drift KPIs (advisory — trend, not level) ===`, plus the
34
44
  iteration-start commit when derivable;
35
45
  - `--- Lead (weighted high — act before drift compounds) ---`;
36
46
  - `--- Lag (weighted low — undercounts by construction) ---`;
37
47
  - footer: `Read trend across sessions; lag KPIs lower-bound only.`
38
- 3. `--trend` emits a single compact line instead — the fragment each plugin
48
+ 4. `--trend` emits a single compact line instead — the fragment each plugin
39
49
  volunteers, joined with `·` — consumed by context-kit's session-context
40
50
  hook (`CONTEXT_KIT_DRIFT_REPORT`, already wired in its template).
41
51
 
@@ -73,6 +83,14 @@ roster, and falls back to its own derivation when run standalone without it.
73
83
  The driver's handoff, not a consumer knob: `drift-report.sh` recomputes it
74
84
  every run.
75
85
 
86
+ `DRIFT_KIT_ITERATION_START` is the same *class* of handoff as
87
+ `DRIFT_KIT_KIT_ROOTS` — computed by the driver every run, reaching every plugin
88
+ as exported environment, never a consumer knob. What it does not share is the
89
+ parity hazard: it introduces no fixed export list that could drift out of step
90
+ with the knob set it travels beside. A plugin reading it gets the empty string
91
+ when no baseline is derivable and degrades to `n/a` on its own rows rather than
92
+ dying.
93
+
76
94
  Plugins never block and never write outside `$DRIFT_KIT_TMP_DIR` scratch;
77
95
  a measurement needing state (a baseline, a log) reads a file some
78
96
  *other* mechanism owns and stamps its reading-age caveat when the file is a
@@ -101,9 +119,38 @@ The generic set — each coupled to a kit-governed surface, each degrading to
101
119
  (`SPEC-*.md`, git add-date; fixture and template paths excluded, matching the
102
120
  published-evidence extractor's amendment-latency harvest); the pressure gauge
103
121
  behind canon-kit's short-lived-amendment rule.
104
- - **kpi-deferred-age** — age of the oldest `Surfaced <date>` mark
105
- (queue-kit's ungated convention) in the queue's deferred section:
106
- premise-rot pressure on design-pending work.
122
+ - **kpi-deferred-age** — age of the oldest **defer date** in the queue's
123
+ deferred section: premise-rot pressure on design-pending work. The defer
124
+ date is queue-kit/SPEC.md §The queue format's definition — the `Surfaced`
125
+ mark where an entry carries one, else the `Filed` provenance date — which
126
+ this plugin re-implements rather than sourcing, because a dependency on
127
+ queue-kit's lib would close a cross-kit cycle. Accepted residual: one owner
128
+ doc, two implementations, both carrying a `spec:` line citing the owner.
129
+ Both marks count, because a pool whose entries carry provenance lines rather
130
+ than `Surfaced` marks would otherwise leave the input covering a fraction of
131
+ it. The KPI de-duplicates the dates it finds and reports the oldest, so it
132
+ trends dates rather than counting entries. Its unknown-heading reset drops an
133
+ icebox placed after the deferred section out of the input **by
134
+ construction**, which is wanted: an evicted entry's age is not the thing this
135
+ KPI trends. gate-sdk's `check-gate-exemption-tasks` carries the
136
+ same-shaped scan with the opposite behavior, deliberately (gate-sdk/SPEC.md
137
+ §check-gate-exemption-tasks) — recorded so a later reader does not "fix" one
138
+ into agreement with the other.
139
+ - **kpi-queue-net-delta** — the design-pending pool at the iteration-start
140
+ commit against the worktree, as **two rows, because one number would be
141
+ gameable**: *entry net delta* (`filed − drained`, where filed is a slug now
142
+ deferred that was in neither section at the baseline and drained is a slug
143
+ that has left the pool entirely) and *carry weight* (the two sections' line
144
+ count now against the baseline). An icebox move counts as **neither** — it is
145
+ compression, not intake and not closure. The two axes move independently:
146
+ intake pressure moves the first, compression the second, so a session that
147
+ mass-evicted to flatter the delta row moves the weight row instead and the
148
+ gaming is visible rather than hidden — the argument `kpi-price-table-age`
149
+ makes for carrying two rows that point different ways. `--trend` volunteers
150
+ one fragment, `qnet <±N>`, per the one-per-plugin rule; the weight row
151
+ volunteers none, because intake is the axis a filing session can act on
152
+ inside the session. With no baseline (a standalone run, a fresh clone) both
153
+ rows degrade to `n/a (no iteration baseline)`.
107
154
  - **kpi-prompt-friction** — distinct/total prompting calls via guard-kit's
108
155
  `scan-prompts.sh --count`; `n/a` when guard-kit or its log is absent.
109
156
  - **kpi-always-loaded** — the standing per-session surface: level and
@@ -699,6 +746,12 @@ Knobs (this repo's layout as defaults):
699
746
  - `DRIFT_KIT_DONE_SECTION` / `DRIFT_KIT_DEFERRED_SECTION` — queue section
700
747
  headings the task-split and deferred-age KPIs scan; defaults `Done` /
701
748
  `Deferred` (queue-kit's).
749
+ - `DRIFT_KIT_ICEBOX_SECTION` — the design-pending pool's second section,
750
+ queue-kit's optional icebox tier; default **empty**, meaning the pool is the
751
+ deferred section alone. Read by `kpi-queue-net-delta` so an eviction reads as
752
+ compression rather than as closure. The same independent-knob shape
753
+ queue-kit and canon-kit carry: a consumer enabling the tier sets each, and
754
+ one left unset degrades that kit to "no icebox".
702
755
  - `DRIFT_KIT_TRAJECTORY_SURFACES` — the state-file paths the trajectory
703
756
  extractor harvests, given as `<state-file> <evidence-file>`; default
704
757
  `${GATE_SDK_WORKFLOW_DIR:-.workflow}/WORKFLOW-STATE.txt` and its
@@ -41,8 +41,21 @@ unset _ds_cfg
41
41
  : "${DRIFT_KIT_METRIC_DIR:=.metric}"
42
42
  : "${DRIFT_KIT_DONE_SECTION:=Done}"
43
43
  : "${DRIFT_KIT_DEFERRED_SECTION:=Deferred}"
44
+ : "${DRIFT_KIT_ICEBOX_SECTION:=}"
44
45
  declare -p DRIFT_KIT_KPI_DIRS >/dev/null 2>&1 || DRIFT_KIT_KPI_DIRS=("${GATE_SDK_GATES_DIR:-scripts}")
45
46
 
47
+ iteration_start() {
48
+ local state="${GATE_SDK_WORKFLOW_DIR:-.workflow}/WORKFLOW-STATE.txt" iter
49
+ [[ -f "$DRIFT_KIT_QUEUE_FILE" ]] || return 0
50
+ iter="$(grep -m1 '^## Iteration:' "$DRIFT_KIT_QUEUE_FILE" 2>/dev/null \
51
+ | sed -E 's/^## Iteration:[[:space:]]*//; s/[[:space:]]*\[stage:.*$//')"
52
+ [[ -n "$iter" ]] || return 0
53
+ git log --format='%h' -S"$iter scope " -- "$state" 2>/dev/null | tail -1
54
+ }
55
+
56
+ # spec: drift-kit/SPEC.md §The KPI plugin contract — a driver handoff, not a consumer knob: derived here so the compgen export below carries it to plugins with no new export list to drift out of parity. Priced: hoisting it above the loop runs it in --trend too, putting one grep and one single-file git pickaxe on every session start via the context hook.
57
+ DRIFT_KIT_ITERATION_START="$(iteration_start)"
58
+
46
59
  # spec: drift-kit/SPEC.md §The KPI plugin contract — export every scalar DRIFT_KIT_* (arrays skipped: unexportable, collator-internal), so a config override reaches plugins with no fixed list to drift
47
60
  for _dv in $(compgen -v DRIFT_KIT_); do
48
61
  [[ "$(declare -p "$_dv" 2>/dev/null)" == "declare -a"* ]] && continue
@@ -81,15 +94,6 @@ registry_members() {
81
94
  grep -Ev '^[[:space:]]*(#|$)' "$DRIFT_KIT_KPIS_FILE" || true
82
95
  }
83
96
 
84
- iteration_start() {
85
- local state="${GATE_SDK_WORKFLOW_DIR:-.workflow}/WORKFLOW-STATE.txt" iter
86
- [[ -f "$DRIFT_KIT_QUEUE_FILE" ]] || return 0
87
- iter="$(grep -m1 '^## Iteration:' "$DRIFT_KIT_QUEUE_FILE" 2>/dev/null \
88
- | sed -E 's/^## Iteration:[[:space:]]*//; s/[[:space:]]*\[stage:.*$//')"
89
- [[ -n "$iter" ]] || return 0
90
- git log --format='%h' -S"$iter scope " -- "$state" 2>/dev/null | tail -1
91
- }
92
-
93
97
  if [[ "${1:-}" == "--trend" ]]; then
94
98
  frags=()
95
99
  while IFS= read -r name; do
@@ -137,9 +141,8 @@ print_section() {
137
141
  done
138
142
  }
139
143
 
140
- start="$(iteration_start)"
141
144
  header="=== Drift KPIs (advisory — trend, not level) ==="
142
- [[ -n "$start" ]] && header="$header [iteration start $start]"
145
+ [[ -n "$DRIFT_KIT_ITERATION_START" ]] && header="$header [iteration start $DRIFT_KIT_ITERATION_START]"
143
146
  printf '%s\n\n' "$header"
144
147
 
145
148
  printf -- '--- Lead (weighted high — act before drift compounds) ---\n'
@@ -68,7 +68,7 @@ read -r total gate hook stage govdoc < <(
68
68
  { b = length($0); total += b }
69
69
  /PASS: check-|FAIL: check-|===== check|: clean \(|run-gate/ { gate += b; next }
70
70
  /<system-reminder>|PreToolUse|PostToolUse|SessionStart|bash-guard|hook error/ { hook += b; next }
71
- /lifecycle-kit\/templates\/skills|enter-stage|WORKFLOW-STATE|Execute the template at/ { stage += b; next }
71
+ /lifecycle-kit\/templates\/stages|enter-stage|WORKFLOW-STATE|Execute the template at/ { stage += b; next }
72
72
  /SPEC\.md|SPEC-|CLAUDE\.md|DOCTRINE\.md|BRIEF\.local/ { govdoc += b; next }
73
73
  END { printf "%d %d %d %d %d\n", total+0, gate+0, hook+0, stage+0, govdoc+0 }
74
74
  ' "$transcript"
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # spec: drift-kit/SPEC.md §Bundled KPIs — kpi-deferred-age: age of the oldest Surfaced mark in the deferred section
2
+ # spec: drift-kit/SPEC.md §Bundled KPIs — kpi-deferred-age: age of the oldest defer date in the deferred section, the Surfaced mark where one exists and the Filed provenance date otherwise (queue-kit/SPEC.md §The queue format owns the definition; the second implementation is accepted residual — drift-kit cannot source queue-kit's lib without a cross-kit cycle)
3
3
  set -uo pipefail
4
4
 
5
5
  QUEUE="${DRIFT_KIT_QUEUE_FILE:-TASK-QUEUE.md}"
@@ -7,17 +7,19 @@ SECTION="${DRIFT_KIT_DEFERRED_SECTION:-Deferred}"
7
7
 
8
8
  [[ -f "$QUEUE" ]] || { [[ "${1:-}" == "--trend" ]] || printf 'lead\tdeferred age\tn/a (no queue file)\n'; exit 0; }
9
9
 
10
+ # spec: drift-kit/SPEC.md §Bundled KPIs — the unknown-heading reset drops an icebox placed after the deferred section out of this input by construction, which is wanted: an evicted entry's age is no longer the thing this KPI trends
10
11
  mapfile -t dates < <(
11
12
  awk -v sec="$SECTION" '
12
13
  $0 ~ "^## "sec"[[:space:]]*$" { inx=1; next }
13
14
  /^## / { inx=0 }
14
15
  inx { print }
15
- ' "$QUEUE" 2>/dev/null | grep -oE 'Surfaced [0-9]{4}-[0-9]{2}-[0-9]{2}' | awk '{print $2}' | sort -u
16
+ ' "$QUEUE" 2>/dev/null \
17
+ | grep -oE '(Surfaced|Filed) [0-9]{4}-[0-9]{2}-[0-9]{2}' | awk '{print $2}' | sort -u
16
18
  )
17
19
 
18
20
  if [[ ${#dates[@]} -eq 0 ]]; then
19
21
  [[ "${1:-}" == "--trend" ]] && exit 0
20
- printf 'lead\tdeferred age\tn/a (no Surfaced mark)\n'
22
+ printf 'lead\tdeferred age\tn/a (no defer date)\n'
21
23
  exit 0
22
24
  fi
23
25
 
@@ -31,7 +33,7 @@ done
31
33
 
32
34
  if [[ -z "$oldest_date" ]]; then
33
35
  [[ "${1:-}" == "--trend" ]] && exit 0
34
- printf 'lead\tdeferred age\tn/a (no parseable Surfaced date)\n'
36
+ printf 'lead\tdeferred age\tn/a (no parseable defer date)\n'
35
37
  exit 0
36
38
  fi
37
39
 
@@ -40,5 +42,5 @@ if [[ "${1:-}" == "--trend" ]]; then
40
42
  printf 'defer %dd\n' "$days"
41
43
  exit 0
42
44
  fi
43
- printf 'lead\tdeferred age\toldest %dd (Surfaced %s)\n' "$days" "$oldest_date"
45
+ printf 'lead\tdeferred age\toldest %dd (deferred %s)\n' "$days" "$oldest_date"
44
46
  exit 0
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env bash
2
+ # spec: drift-kit/SPEC.md §Bundled KPIs — kpi-queue-net-delta: the design-pending pool at the iteration-start commit against the worktree, two rows because one number would be gameable
3
+ set -uo pipefail
4
+
5
+ QUEUE="${DRIFT_KIT_QUEUE_FILE:-TASK-QUEUE.md}"
6
+ DEFERRED="${DRIFT_KIT_DEFERRED_SECTION:-Deferred}"
7
+ ICEBOX="${DRIFT_KIT_ICEBOX_SECTION:-}"
8
+ BASE="${DRIFT_KIT_ITERATION_START:-}"
9
+
10
+ na() {
11
+ [[ "${1:-}" == "--trend" ]] && exit 0
12
+ printf 'lead\tqueue net delta\t%s\n' "$2"
13
+ printf 'lead\tqueue carry weight\t%s\n' "$2"
14
+ exit 0
15
+ }
16
+
17
+ [[ -f "$QUEUE" ]] || na "${1:-}" "n/a (no queue file)"
18
+ [[ -n "$BASE" ]] || na "${1:-}" "n/a (no iteration baseline)"
19
+
20
+ # spec: drift-kit/SPEC.md §Bundled KPIs — one walk per revision emitting "<section>\t<slug>" for a bold lead-in bullet plus a trailing line count, so the entry axis and the weight axis are read off the same parse
21
+ pool() {
22
+ awk -v def="$DEFERRED" -v ice="$ICEBOX" '
23
+ /^## / {
24
+ sec = ""
25
+ if ($0 ~ "^## "def"[[:space:]]*$") sec = "deferred"
26
+ else if (ice != "" && $0 ~ "^## "ice"[[:space:]]*$") sec = "icebox"
27
+ next
28
+ }
29
+ sec == "" { next }
30
+ { n++ }
31
+ /^[[:space:]]*-[[:space:]]+\*\*[a-z0-9][a-z0-9-]*\*\*/ {
32
+ match($0, /\*\*[a-z0-9][a-z0-9-]*\*\*/)
33
+ printf "%s\t%s\n", sec, substr($0, RSTART + 2, RLENGTH - 4)
34
+ }
35
+ END { printf "#lines\t%d\n", n + 0 }
36
+ '
37
+ }
38
+
39
+ base_pool="$(git show "$BASE:$QUEUE" 2>/dev/null | pool)" || true
40
+ [[ -n "$base_pool" ]] || na "${1:-}" "n/a (queue absent at $BASE)"
41
+ now_pool="$(pool < "$QUEUE")"
42
+
43
+ base_lines="${base_pool##*$'\n'#lines }"
44
+ now_lines="${now_pool##*$'\n'#lines }"
45
+
46
+ declare -A was=() now=()
47
+ while IFS=$'\t' read -r sec slug; do
48
+ [[ "$sec" == "#lines" ]] && continue
49
+ was["$slug"]="$sec"
50
+ done <<< "$base_pool"
51
+ while IFS=$'\t' read -r sec slug; do
52
+ [[ "$sec" == "#lines" ]] && continue
53
+ now["$slug"]="$sec"
54
+ done <<< "$now_pool"
55
+
56
+ # spec: drift-kit/SPEC.md §Bundled KPIs — an icebox move counts as neither filed nor drained: it is compression, not intake and not closure, so a session that mass-evicted to flatter the delta row moves the weight row instead and the gaming is visible
57
+ filed=0; drained=0
58
+ for s in "${!now[@]}"; do
59
+ [[ "${now[$s]}" == "deferred" && -z "${was[$s]:-}" ]] && filed=$((filed + 1))
60
+ done
61
+ for s in "${!was[@]}"; do
62
+ [[ -z "${now[$s]:-}" ]] && drained=$((drained + 1))
63
+ done
64
+
65
+ delta=$((filed - drained))
66
+ weight=$((now_lines - base_lines))
67
+
68
+ if [[ "${1:-}" == "--trend" ]]; then
69
+ printf 'qnet %+d\n' "$delta"
70
+ exit 0
71
+ fi
72
+ printf 'lead\tqueue net delta\t%+d (%d filed, %d drained since %s)\n' "$delta" "$filed" "$drained" "$BASE"
73
+ printf 'lead\tqueue carry weight\t%+d lines (%d now, %d at %s)\n' "$weight" "$now_lines" "$base_lines" "$BASE"
74
+ exit 0
@@ -20,7 +20,7 @@ cat > "$work/TASK-QUEUE.md" <<'EOF'
20
20
  # TASK-QUEUE.md
21
21
  ## Iteration: smoke
22
22
  ## Deferred
23
- - **foo** [needs-spec] — a thing. Surfaced 2025-01-01.
23
+ - **foo** [design-pending] — a thing. Surfaced 2025-01-01.
24
24
  ## Done
25
25
  EOF
26
26
 
@@ -501,7 +501,8 @@ CI entry point (wiring CI is out of scope here).
501
501
 
502
502
  The family's single sourced library — values + adapters, never gate structure.
503
503
  It gives a gate author the fail-closed guard `fail_closed`, the walk adapters
504
- (`gate_find` / `GATE_GREP_EXCLUDES` / `gate_path_pruned` over `GATE_PRUNE_DIRS`),
504
+ (`gate_find` / `GATE_GREP_EXCLUDES` / `gate_path_pruned` over the dirs
505
+ `GATE_SDK_PRUNE_DIRS` names),
505
506
  the registry helpers that resolve a check consumer-first across kit dirs
506
507
  (`gate_resolve`, `gate_kit_roots` / `gate_kit_roots_rel`, `gate_check_dirs` —
507
508
  the multi-kit resolution path other kits' gates ride), and the `# graph:`
@@ -681,7 +682,7 @@ version, parsed for the bullet lead tokens docs/install.md owns. A new N+1 gate
681
682
  is *not* in this consumer's `gates.list` (the phase-A sync never re-runs the
682
683
  installer, so it does not run in phase B); the smoke asserts the declaration's
683
684
  sufficiency for the gates that *do* run, and the upgrade skill
684
- (lifecycle-kit/SPEC.md §templates/skills/) is the executor that registers the
685
+ (lifecycle-kit/SPEC.md §templates/upgrade.md) is the executor that registers the
685
686
  new ones. When TO is unreleased — the `HEAD` default resolving no version — no
686
687
  note names it and the red set must be empty: every run is then the standing
687
688
  pre-release assertion that the working tree upgrades cleanly from the last tag. A
@@ -965,6 +966,20 @@ violations. Scope is in-script exemption arrays only; inline per-site
965
966
  directives (`# fail-closed-exempt:`, `# no-fixture:`) stay out — they are
966
967
  local and self-evident via their adjacent comment.
967
968
 
969
+ **The live-section span is positional, and a consumer's optional queue tiers
970
+ ride on that.** The scan opens on the first of those headings and closes on the
971
+ done or lessons heading, with **no reset on an unknown heading**, so any
972
+ section a consumer places *between* the deferred and done sections is swept
973
+ into the live set. queue-kit's optional icebox tier (queue-kit/SPEC.md §The
974
+ icebox tier) states its position as a contract for exactly this reason: an
975
+ exemption backed by an iceboxed task keeps resolving, because an iceboxed task
976
+ is unbuilt. gate-sdk cannot depend on queue-kit for the section set, so the
977
+ coupling is carried by both SPECs rather than by code, and **nothing enforces
978
+ section order** — an icebox placed after the done section silently drops those
979
+ slugs from the live set. The same-shaped scan in drift-kit's `kpi-deferred-age`
980
+ *does* reset on an unknown heading and so excludes the tier; same shape,
981
+ opposite behavior, both wanted.
982
+
968
983
  ### check-graph
969
984
 
970
985
  Invariant: the `# graph:` manifest on every `gates.list` member is well-formed
@@ -65,9 +65,9 @@ Vendor the kit beside [gate-sdk](../gate-sdk/) (required), then:
65
65
 
66
66
  # contract: lifecycle-kit/SPEC.md §check-lesson-disposition
67
67
 
68
- 3. Adopt `templates/skills/*.md` in your agent-skill directory (e.g.
68
+ 3. Adopt `templates/stages/*.md` in your agent-skill directory (e.g.
69
69
  `.claude/commands/`): by default make each skill a binding shim that
70
- references the template (SPEC.md §templates/skills/) — it tracks the kit, so
70
+ references the template (SPEC.md §templates/stages/) — it tracks the kit, so
71
71
  a re-vendor reaches it and the shim gates hold it thin. Or, as the sanctioned
72
72
  fork, copy each in and fill its named slots (`*<slot-name: …>*`) with your
73
73
  project's ritual — you then own the ritual prose, upgrades don't reach it,