@iceinvein/agent-skills 0.27.0 → 0.28.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.
@@ -7,7 +7,8 @@
7
7
  # past pre-flight, has tasks still to go, and nothing is marked blocked or
8
8
  # paused, the stop is refused with a reason saying what to do instead.
9
9
  #
10
- # Every stop that is a real stop is let through: no run, a channel other than
10
+ # Every stop that is a real stop is let through: no run (a deep session with
11
+ # none answers to the unopened-run gate first), a channel other than
11
12
  # deep, pre-flight not yet answered (that stop is owed), a blocked task, a run
12
13
  # paused on purpose with `status.sh pause --reason`, a task `active` or in
13
14
  # `review` (an agent is out and will report back), every task done (the
@@ -16,12 +17,13 @@
16
17
  # fired this turn, which is what keeps this from looping. One refusal per turn, then:
17
18
  # a nudge with the state in it rather than a wall.
18
19
  #
19
- # Three checks run ahead of the run guard, all keyed on the tree having moved
20
+ # Four checks run ahead of the run guard, all keyed on the tree having moved
20
21
  # since the session opened: an entry check for a session that never routed, a
21
22
  # verification gate refusing a fast or main handback with no passing check
22
- # recorded against the tree as it stands, and a test gate refusing a handback
23
- # that weakened an existing test with no record of why (see their own
24
- # sections).
23
+ # recorded against the tree as it stands, a test gate refusing a handback
24
+ # that weakened an existing test with no record of why, and an unopened-run
25
+ # gate refusing a deep session that changed more than its design and plan
26
+ # before any run opened (see their own sections).
25
27
  #
26
28
  # Reads the harness's stop JSON on stdin for `cwd` and `stop_hook_active`. To
27
29
  # refuse, prints {"decision":"block","reason":...} on stdout, or on Antigravity
@@ -280,6 +282,21 @@ fi
280
282
  # counts has to be a route here too. One copy in this file, used by both.
281
283
  route_def='def route: "(?:^|[;&|(])[[:space:]]*(?:(?:bash|sh|zsh)[[:space:]]+)?(?:\"[^\"]*|\u0027[^\u0027]*|[^[:space:];&|\"\u0027]*)status\\.sh[\"\u0027]?[[:space:]]+route[[:space:]]+(fast|main|deep)(?:[[:space:];&|]|$)";'
282
284
 
285
+ # The channel the session is in now: its last route call, not its first, so a
286
+ # session rerouted partway answers to the gate of the channel it moved to.
287
+ # Prints nothing for a session that never made a route call. Unparseable lines
288
+ # are dropped for the reason the entry check gives: the harness is still
289
+ # appending to the transcript as this reads it.
290
+ last_route() {
291
+ jq -r -n -R "$route_def"'
292
+ [ inputs | fromjson? // empty
293
+ | select((.type == "assistant") and (((.isMeta == true) or (.isSidechain == true)) | not))
294
+ | .message.content[]? | select(.type == "tool_use" and .name == "Bash")
295
+ | (.input.command // "") | match(route; "g") | .captures[0].string ]
296
+ | last // empty
297
+ ' "$transcript" 2>/dev/null
298
+ }
299
+
283
300
  # ---- entry check --------------------------------------------------------
284
301
  # The run guard below only arms once .sluice/run.json exists, and that file
285
302
  # only exists once the skill has been invoked. So the session that never
@@ -378,15 +395,7 @@ verify_gate() {
378
395
  [ -z "$unread" ] || return 0
379
396
  [ -f "$transcript" ] || return 0
380
397
 
381
- # Unparseable lines are dropped for the reason the entry check gives: the
382
- # harness is still appending to the transcript as this reads it.
383
- channel="$(jq -r -n -R "$route_def"'
384
- [ inputs | fromjson? // empty
385
- | select((.type == "assistant") and (((.isMeta == true) or (.isSidechain == true)) | not))
386
- | .message.content[]? | select(.type == "tool_use" and .name == "Bash")
387
- | (.input.command // "") | match(route; "g") | .captures[0].string ]
388
- | last // empty
389
- ' "$transcript" 2>/dev/null)" || return 0
398
+ channel="$(last_route)" || return 0
390
399
  case "$channel" in fast | main) ;; *) return 0 ;; esac
391
400
 
392
401
  # Unreadable content is unknown, not changed, as for the entry check.
@@ -486,6 +495,94 @@ fi
486
495
  [ -f "$STATUS" ] || exit 0
487
496
 
488
497
  resolve_run_tree
498
+
499
+ # ---- unopened-run gate ------------------------------------------------------
500
+ # Deep's two stops both come before any code, and the run guard below reads
501
+ # run.json, which only exists once both are behind the session. So the stretch
502
+ # where those stops are owed is the one stretch nothing held: a deep session
503
+ # that edits source before sign-off, or builds without ever opening a run,
504
+ # reached no gate at all. So does a session that closed its run and went on to
505
+ # other work under the same route.
506
+ #
507
+ # Until a run opens, a deep session writes its spec and its plan and nothing
508
+ # else, and both are new Markdown files. Anything else it changed and has not
509
+ # committed is refused: a file that is not Markdown, or a Markdown file that
510
+ # was already there, which is an edit rather than a design being written. New
511
+ # means absent from the session's base or never committed: a resume takes a
512
+ # fresh base with the unsigned spec already in it, and the revision that
513
+ # follows is still the design being written.
514
+ #
515
+ # Two things pass that a reader might expect held. Source committed before
516
+ # sign-off, because committed work cannot be told from a merged run's. And any
517
+ # change while a run is open in this tree, another session's included, because
518
+ # that run's guard is the one that answers there.
519
+ #
520
+ # Changed means against line 3 of the stamp, the commit of the tree as the
521
+ # session found it, so work in progress it opened on is never charged to it.
522
+ # Uncommitted means against HEAD: a run that merged and closed leaves its work
523
+ # committed, and its handback is not this gate's to refuse. A stamp with no
524
+ # base, or one gc has pruned, is unknown and stays silent, as in the test
525
+ # gate.
526
+ #
527
+ # Refused once per session, as the entry check is and for its reason: nothing
528
+ # in a tree says who changed it, and a design conversation runs several turns,
529
+ # so a wrong refusal repeated on each would teach its partner to ignore it.
530
+ unopened_gate() {
531
+ local base now uncommitted session offending marker
532
+ [ -z "$run_tree" ] || return 0
533
+ [ -n "$moved_tree" ] || return 0
534
+ [ -z "$unread" ] || return 0
535
+ [ -f "$transcript" ] || return 0
536
+ marker="$state_root/unopened/$sid"
537
+ [ -f "$marker" ] && return 0
538
+ [ "$(last_route)" = deep ] || return 0
539
+
540
+ base="$(sed -n '3p' "$moved_stamp" 2>/dev/null)"
541
+ [ -n "$base" ] || return 0
542
+ base="$(git -C "$moved_tree" rev-parse --verify --quiet "$base^{commit}" 2>/dev/null)" || return 0
543
+ [ -n "$base" ] || return 0
544
+ now="$(bash "$here/content-digest.sh" "$moved_tree" 2>/dev/null)" || return 0
545
+ [ -n "$now" ] || return 0
546
+
547
+ # quotepath off so a path outside ASCII is compared and matched as itself.
548
+ # git still quotes a path holding a control byte, a quote or a backslash,
549
+ # the same way in both lists, so the two still meet on it and the closing
550
+ # quote is allowed for after the extension.
551
+ uncommitted="$(git -C "$moved_tree" -c core.quotepath=false diff --name-status --no-renames HEAD "$now" 2>/dev/null)" || return 0
552
+ [ -n "$uncommitted" ] || return 0
553
+ # --raw for the modes: a nested repository, a submodule or a worktree cut
554
+ # under this tree, is one entry of mode 160000, and it is where work went
555
+ # rather than an edit to a file here.
556
+ session="$(git -C "$moved_tree" -c core.quotepath=false diff --raw --no-renames "$base" "$now" 2>/dev/null)" || return 0
557
+ offending="$(
558
+ {
559
+ printf '%s\n' "$uncommitted" | sed 's/^/U /'
560
+ printf '%s\n' "$session"
561
+ } | awk -F '\t' '
562
+ $1 == "U" { uncommitted[$3] = $2; next }
563
+ { split($1, entry, " ") }
564
+ entry[1] == ":160000" || entry[2] == "160000" { next }
565
+ ($2 in uncommitted) && !($2 ~ /\.md"?$/ && (entry[5] == "A" || uncommitted[$2] == "A")) { print $2 }
566
+ '
567
+ )"
568
+ [ -n "$offending" ] || return 0
569
+
570
+ mkdir -p "$state_root/unopened" 2>/dev/null || true
571
+ : >"$marker" 2>/dev/null || true
572
+ refuse "$(jq -rn --arg paths "$offending" '
573
+ ($paths | split("\n") | map(select(. != "") | gsub("[\u0000-\u001f\u007f]"; ""))) as $p
574
+ | "sluice: this session is routed deep, no run is open in this tree, and it has changed more than a new design or plan: "
575
+ + ($p[0:8] | join(", "))
576
+ + (if ($p | length) > 8 then ", and \(($p | length) - 8) more" else "" end)
577
+ + ". Until a run opens a deep session writes only its spec and its plan, as new Markdown files, because the design sign-off and pre-flight both come before any code. If either stop is still owed, take it now: end the turn on the sign-off or on the pre-flight questions, and make no further edits outside the design and plan until the answer is in. If both are behind you, open the run before Task 1 goes on: status.sh init, plan.sh import, then status.sh preflight with the answers. If this is work outside a deep run, route it as what it is, status.sh route fast or status.sh route main, and that channel checks it. If the change is not yours, say so and stop; this will not ask twice."
578
+ ')"
579
+ return 1
580
+ }
581
+
582
+ if ! unopened_gate; then
583
+ exit 0
584
+ fi
585
+
489
586
  [ -n "$run_tree" ] || exit 0
490
587
  tree="$run_tree"
491
588
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sluice",
3
- "version": "0.32.0",
4
- "description": "Routes work by change shape into four channels (bypass, fast, main, deep) and applies only the rules each channel needs, so a one-line fix does not pay the cost of a multi-subsystem build. Carries nine rules as one-liners in the router and the full treatment in references read only on friction. Deep runs read the repo before designing, map the spec's intent to its decisions, and check spec against intent and plan against spec with a fresh reader, with plan.sh validate enforcing that every decision is covered. Checks the finished plan with plan.sh validate rather than trusting it to memory, seeds the run state from it, keeps a deep run's task breakdown in .sluice/run.json so an opt-in statusline segment, the harness task list where the session has one, one status command and a SessionStart hook can answer where the run is (the hook prints a live run at every session start, compaction included), lists every live deep run and routed fast or main session on the machine in one board.sh view (drawn once, watched, or as JSON), and closes each run with a ledger read out of the session transcript: elapsed, tools, tokens, and what each dispatched agent cost where the transcript recorded it. Two Stop hooks hold a handback: one refuses a tree that moved since its last recorded check, the other refuses a changed existing test not proven to fail on the session's starting code (or recorded with a reason). Runs on Claude Code, Codex and Antigravity; stands down where the superpowers pipeline governs the repo.",
3
+ "version": "0.33.0",
4
+ "description": "Routes work by change shape into four channels (bypass, fast, main, deep) and applies only the rules each channel needs, so a one-line fix does not pay the cost of a multi-subsystem build. Carries nine rules as one-liners in the router and the full treatment in references read only on friction. Deep runs read the repo before designing, map the spec's intent to its decisions, and check spec against intent and plan against spec with a fresh reader, with plan.sh validate enforcing that every decision is covered. Checks the finished plan with plan.sh validate rather than trusting it to memory, seeds the run state from it, keeps a deep run's task breakdown in .sluice/run.json so an opt-in statusline segment, the harness task list where the session has one, one status command and a SessionStart hook can answer where the run is (the hook prints a live run at every session start, compaction included), lists every live deep run and routed fast or main session on the machine in one board.sh view (drawn once, watched, or as JSON), and closes each run with a ledger read out of the session transcript: elapsed, tools, tokens, and what each dispatched agent cost where the transcript recorded it. Two Stop hooks hold a handback: one refuses a tree that moved since its last recorded check, the other refuses a changed existing test not proven to fail on the session's starting code (or recorded with a reason). The Stop hook also holds deep's two stops: a deep session with no run open and uncommitted changes to anything but a new Markdown file is refused once. Runs on Claude Code, Codex and Antigravity; stands down where the superpowers pipeline governs the repo.",
5
5
  "author": "iceinvein",
6
6
  "type": "prompt",
7
7
  "tools": [