From 3f09ae19612f830a542097d2d5df7c7b3da8c72c Mon Sep 17 00:00:00 2001 From: Alex Wegener Date: Mon, 16 Nov 2026 22:04:02 +0100 Subject: [PATCH 1/4] fix: teammate-idle counts only the lane's own scope and says it once (#97, #98) The hook counted the open tasks of STATE.md's current_milestone and exited 2 at every idle turn while any was open, so coordinator lanes looped on an old open milestone (M034) outside their brief. It now counts only the lane the teammate holds (its claimed or running LANES.md row, else the M###-S##[-T##] in its name), skips done, dropped, shipped-informally and backlog milestones, stays silent without a known scope, and says the same teammate, lane and count once per session (idle-said in the session home). Co-Authored-By: Claude Opus 5.5 --- .ytstack/DECISIONS.md | 17 ++++ .ytstack/spec/hooks-and-state.md | 9 ++- CHANGELOG.md | 13 ++++ hooks/teammate-idle | 108 ++++++++++++++++++-------- skills/spawn-milestone-team/SKILL.md | 4 +- tests/hooks-readonly.test.sh | 6 +- tests/hooks-teammate-idle.test.sh | 112 +++++++++++++++++++++++++++ tests/hooks-worktree.test.sh | 11 +-- 8 files changed, 232 insertions(+), 48 deletions(-) create mode 100644 tests/hooks-teammate-idle.test.sh diff --git a/.ytstack/DECISIONS.md b/.ytstack/DECISIONS.md index 88256e9..62c4588 100644 --- a/.ytstack/DECISIONS.md +++ b/.ytstack/DECISIONS.md @@ -1565,3 +1565,20 @@ Plus: ops-layer split during the same session (yopstack created as own public re **How to apply:** While the ready-for-review count is at the cap, the coordinator dispatches no new implement lane. **Supersedes:** Narrows "2026-11-15: Hooks read a stale checkout from origin ..." (the behind conditions; "the `open-prs` gate counts pull requests ready for review" becomes the cap on opening). + +## 2026-11-16: TeammateIdle counts the teammate's own lane, read from LANES.md or its name, and says it once (issues #97, #98) + +**Context:** `hooks/teammate-idle` counted the open tasks of `current_milestone` in `STATE.md` and exited 2 at every idle turn while any was open. In a coordinator session the pointer named an old open milestone (M034) while the lanes worked on M046, so every lane got "13 task(s) still open in milestone M034" about 30 times, also after its report and after the lead confirmed. The payload has `teammate_name` and no loop guard like `stop_hook_active`. + +**Options considered:** +- A) Keep the pointer, add a dedupe only. +- B) The lane's scope: its held `LANES.md` row, else a slice ref in the teammate name; silent without one; once per teammate, lane and count. +- C) Read the host's team task list under `~/.claude/tasks/` for the teammate's owned tasks. + +**Chose:** B. A row counts only while `claimed` or `running`; any other status of the teammate's row means its work is in. Without a row (team mode claims no lanes) the `M###-S##[-T##]` in the name counts, and `spawn-milestone-team` names team-mode teammates after their slice. With held lanes in `LANES.md`, a name ref outside their milestones is ignored. A milestone whose roadmap is `done`, `dropped`, `shipped-informally` or `backlog` never counts. The record is `//idle-said`; a new count after progress is said once more. + +**Reason:** A teammate can only act on its own lane; the pointer is the lead's position, not the lane's. A count that did not change since the last message carries nothing new, so repeating it only costs turns. C reads an undocumented host format. + +**How to apply:** A lane that should get the reminder holds its row in `LANES.md` (`ytstack-frontier claim --by `) or carries its slice in its name. + +**Supersedes:** None. diff --git a/.ytstack/spec/hooks-and-state.md b/.ytstack/spec/hooks-and-state.md index b4972ea..27b01a9 100644 --- a/.ytstack/spec/hooks-and-state.md +++ b/.ytstack/spec/hooks-and-state.md @@ -80,12 +80,12 @@ Every hook except `pr-watch` sources the library and resolves from the payload ` | `post-tool-use-bash` | PostToolUse on `Bash` | `cwd`, command, exit code, `tool_response.stdout` | creates a draft task summary once; with the coordinate marker, a `gh run list --branch ` (or `-b`) whose output has a failed run (tab-separated `completed`/`failure`, `timed_out` or `startup_failure`, or a JSON array with `conclusion` and `workflowName`), counting only the newest run of each workflow and, with `--repo`/`-R`, only the repository of `origin`, gets one `additionalContext` note to run `ytstack:lesson`, once per distinct set of those runs (`red-main-said`; issue #83) | 0 | | `task-created` | TaskCreated | `cwd`, subject, description | prints a scope warning on stderr | 2 on drift, else 0 | | `task-completed` | TaskCompleted | `cwd`, subject | writes an auto summary, ticks the slice plan checkbox | 0 | -| `teammate-idle` | TeammateIdle | `cwd` | prints the open task count on stderr | 2 while tasks are open, else 0 | +| `teammate-idle` | TeammateIdle | `cwd`, `session_id`, `teammate_name` | prints the open task count of the teammate's own lane on stderr, once per teammate, lane and count (`idle-said`; issues #97, #98) | 2 when it says so, else 0 | - `pre-tool-use-edit` skips paths under `.ytstack/` and the artifact file names listed in the script. Scope drift means: the active task has a plan, and neither the checkout-relative path nor its basename occurs anywhere in that plan. Schema drift means: the target matches a model or schema pattern from the script and the plan names no migration path. - `post-tool-use-bash` acts only when all of this holds: the call succeeded, the command contains a real `git commit` (after a command separator, optionally behind the wrapper tokens the script lists), `STATE.md` names an active slice and task, HEAD's subject matches the task's commit pattern, and no summary file exists. The stub carries `closed: draft`. - `task-created` runs only with an active milestone. It extracts file-like paths from subject and description. Drift is a path that occurs in no slice plan of the current milestone and not in its roadmap. -- `task-completed` needs an `M###-S##-T##` id in the task subject. It never overwrites an existing summary. `teammate-idle` counts unchecked `T##` checkboxes across the slice plans of the current milestone. +- `task-completed` needs an `M###-S##-T##` id in the task subject. It never overwrites an existing summary. `teammate-idle` counts only the lane the teammate holds: the `LANES.md` row whose `Claimed by` starts with its `teammate_name`, counted only while that row is `claimed` or `running` (any other status of its row: silent); without a row, an `M###-S##[-T##]` ref in the name (team mode), and with held lanes in `LANES.md` only for a milestone among theirs. A slice counts its plan's unchecked `T##` boxes, a task its own box. It never reads the `STATE.md` pointer, never counts a milestone whose roadmap `status` is `done`, `dropped`, `shipped-informally` or `backlog`, and stays silent with no scope, no session id or no teammate name. It says the same teammate, lane and count once per session (`//idle-said`; the payload carries no loop guard), and stays silent when it cannot record that. - `stop` speaks only when milestone, slice and task are all set and the task's summary is missing or a draft (once per session and pointer, not in a coordinate session, not for a W10 pointer), when the checkout is behind origin, when a coordinator should rotate, or when the standing check or a coordinate lint speaks. It stays silent when `stop_hook_active` is true. The standing check counts an entry whose name time is in or after the minute of the first unhandled flagged prompt, in the working tree's `standing/` or in `git log --all --since= --diff-filter=A` of the repository; local git only, no host call. ### SessionStart injection @@ -120,7 +120,7 @@ See `docs/statusline.md`. It was read against `bin/ytstack-status` at `verified_ - Volatile state (automatic handoff, journal, Kimi pending context, the session's plugin version, the phase snapshot and denominator log of `ytstack-status --phases`, the first time `ytstack-frontier check` saw a lane ready) is written outside the tree. `version-notice` writes only `plugin-version` and `notified-` under `/sessions//`, keyed by the session and not by the checkout, and only for a session id of letters, digits, `.`, `_` and `-`. The only in-tree location is the `.ytstack/.local` fallback. - No hook creates or changes `.ytstack/HANDOFF.md` or `STATE.md`. - Two hooks write deliberate artifacts into the resolved `.ytstack`: `post-tool-use-bash` (the draft stub) and `task-completed` (auto summary, checkbox). Both write into the checkout the payload names, so a session that works in a linked worktree leaves the main checkout unchanged. -- `standing-prompt` writes only `prompts`, `reports` and `standing-flags`, `pre-tool-use-agent` only `dispatches`, `pre-compact` there only `compactions`, `post-tool-use-bash` there only `red-main-said`, and `stop` only `standing-stop`, `rotate-said`, `lint-warned-` and `lint-blocked-` under `//` plus the `coordinate-lints` counter under the state base, and only when the coordinate marker is there; the one exception is `stop-said`, which `stop` keeps for every session (what it said once, issue #82); a session id with other characters than letters, digits, `.`, `_` and `-` is ignored. No hook runs the `until-check` or `check` command of a standing entry (`docs/ux/coordinator-format.md`, "Where the commands of an entry run"). `session-start`, `pre-tool-use-edit`, `task-created` and `teammate-idle` write no files. Plain mode does not change this; the Kimi helper owns the pending write. +- `standing-prompt` writes only `prompts`, `reports` and `standing-flags`, `pre-tool-use-agent` only `dispatches`, `pre-compact` there only `compactions`, `post-tool-use-bash` there only `red-main-said`, and `stop` only `standing-stop`, `rotate-said`, `lint-warned-` and `lint-blocked-` under `//` plus the `coordinate-lints` counter under the state base, and only when the coordinate marker is there; the exceptions are `stop-said`, which `stop` keeps for every session (what it said once, issue #82), and `idle-said`, which `teammate-idle` keeps the same way (issues #97, #98); a session id with other characters than letters, digits, `.`, `_` and `-` is ignored. No hook runs the `until-check` or `check` command of a standing entry (`docs/ux/coordinator-format.md`, "Where the commands of an entry run"). `session-start`, `pre-tool-use-edit` and `task-created` write no files. Plain mode does not change this; the Kimi helper owns the pending write. - Files under `sessions//` have one writer. There is no locking. Kimi's consume-by-rename is atomic even when two prompt hooks race. - The payload is trusted as coming from the host. Its fields are shell-quoted before evaluation, but `session_id` is used as a directory name without sanitising. @@ -154,7 +154,7 @@ See `docs/statusline.md`. It was read against `bin/ytstack-status` at `verified_ - `hooks/session-start`, `hooks/version-notice`, `hooks/standing-prompt`, `hooks/pre-tool-use-agent`, `hooks/pre-compact`, `hooks/session-end`, `hooks/stop`, `hooks/pre-tool-use-edit`, `hooks/post-tool-use-bash`, `hooks/task-created`, `hooks/task-completed`, `hooks/teammate-idle` - `bin/ytstack-status` -- status line segment, and progress per phase (`--phases`) - `bin/ytstack-check` (`check_resolver_contract`) -- banned patterns -- Tests: `tests/git-ctx.test.sh`, `tests/hooks-json.test.sh`, `tests/hooks-readonly.test.sh`, `tests/hooks-stop.test.sh`, `tests/hooks-standing.test.sh`, `tests/hooks-coordinate.test.sh`, `tests/hooks-worktree.test.sh`, `tests/hooks-concurrency.test.sh`, `tests/post-tool-use-bash.test.sh`, `tests/pre-compact.test.sh`, `tests/session-end.test.sh`, `tests/session-notices.test.sh`, `tests/ytstack-status.test.sh`, `tests/kimi_lifecycle_test.py` +- Tests: `tests/git-ctx.test.sh`, `tests/hooks-json.test.sh`, `tests/hooks-readonly.test.sh`, `tests/hooks-stop.test.sh`, `tests/hooks-standing.test.sh`, `tests/hooks-coordinate.test.sh`, `tests/hooks-worktree.test.sh`, `tests/hooks-teammate-idle.test.sh`, `tests/hooks-concurrency.test.sh`, `tests/post-tool-use-bash.test.sh`, `tests/pre-compact.test.sh`, `tests/session-end.test.sh`, `tests/session-notices.test.sh`, `tests/ytstack-status.test.sh`, `tests/kimi_lifecycle_test.py` ## How to verify @@ -168,6 +168,7 @@ bash tests/hooks-stop.test.sh bash tests/hooks-standing.test.sh bash tests/hooks-coordinate.test.sh bash tests/hooks-worktree.test.sh +bash tests/hooks-teammate-idle.test.sh bash tests/hooks-concurrency.test.sh bash tests/post-tool-use-bash.test.sh bash tests/pre-compact.test.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index c10d77a..2850133 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- **TeammateIdle no longer loops on an unrelated milestone** (issues #97, + #98): the hook counted the open tasks of the `STATE.md` pointer's + milestone and fired at every idle turn, so coordinator lanes were asked + about 30 times each to claim tasks of an old open milestone outside their + brief. It now counts only the lane the teammate holds (its claimed or + running `LANES.md` row, else the `M###-S##[-T##]` in its name), never a + done, dropped, shipped-informally or backlog milestone, and stays silent + without a known lane or after the lane reported. It says the same lane and + count once per session (`idle-said` in the session home). + `spawn-milestone-team` 0.5.3 names team-mode teammates after their slice. + ## [0.12.0] - 2026-11-16 A coordinator stays on its operating path: standing instructions recorded diff --git a/hooks/teammate-idle b/hooks/teammate-idle index b135636..249b594 100644 --- a/hooks/teammate-idle +++ b/hooks/teammate-idle @@ -1,11 +1,23 @@ #!/usr/bin/env bash -# ytstack TeammateIdle hook +# ytstack TeammateIdle hook (issues #97, #98) # -# Fires when a Claude Code Agent Teams teammate is about to go idle. -# Checks whether the teammate has unfinished work in the shared task list -# and, if so, emits feedback (exit 2) to keep them working. +# Fires when a Claude Code Agent Teams teammate (also a named subagent while +# Agent Teams are on) is about to go idle. When the teammate's own lane still +# has open tasks, it says so once (exit 2 + stderr keeps the teammate working). # -# Idempotent: safe to re-fire; doesn't double-count. +# The lane's scope, M###-S## (a slice) or M###-S##-T## (a task): +# 1. the LANES.md row whose "Claimed by" names the teammate. Only a claimed +# or running row counts; a row in any other status (reported, merged, +# ...) means the lane's work is in, and the hook stays silent. +# 2. no row: the M###-S##[-T##] ref in the teammate's name (team mode names +# a teammate after its slice, impl-M004-S02). With held lanes in LANES.md +# only a milestone among theirs counts. +# Nothing else: never the STATE pointer, no scope known means silence. +# A milestone whose roadmap says done, dropped, shipped-informally or backlog +# is never counted. Said once per teammate, scope and open count in +# //idle-said: the payload has no loop guard, so a +# repeat idle with no progress stays quiet; progress gives one new message. +# No session id, no teammate name, no jq or python: silent. Fails open. set -uo pipefail trap '' PIPE @@ -14,41 +26,69 @@ trap '' PIPE # DECISIONS 2026-11-07). . "$(cd "$(dirname "$0")" && pwd)/lib/git-ctx.sh" yt_read_stdin +case "${YT_SESSION_ID:-}" in ''|.|..|*[!A-Za-z0-9._-]*) exit 0 ;; esac +TM="" +if [ -n "$(yt_jq)" ]; then + TM=$(printf '%s' "$YT_STDIN" | "$(yt_jq)" -r '.teammate_name // "" | tostring' 2>/dev/null) +elif [ -n "$(yt_python)" ]; then + TM=$(printf '%s' "$YT_STDIN" | "$(yt_python)" -I -c ' +import json, sys +try: + d = json.load(sys.stdin) +except Exception: + d = {} +print(d.get("teammate_name") or "" if isinstance(d, dict) else "")' 2>/dev/null) +fi +case "$TM" in ''|*[!A-Za-z0-9._-]*) exit 0 ;; esac + yt_git_ctx "${YT_CWD:-$PWD}" YT_DIR=$(yt_resolve_yt_dir) +[ -n "$YT_DIR" ] || exit 0 -# Silent exit if not a ytstack project -[ -z "$YT_DIR" ] && exit 0 - -STATE_FILE="$YT_DIR/STATE.md" -[ ! -f "$STATE_FILE" ] && exit 0 - -# Determine current milestone + its slice-plans -CURRENT_MILESTONE=$(sed -n 's/^current_milestone: *//p' "$STATE_FILE" | head -1) -[ -z "$CURRENT_MILESTONE" ] || [ "$CURRENT_MILESTONE" = "none" ] && exit 0 - -# Count unfinished tasks across all slice-plans for this milestone -OPEN_TASK_COUNT=0 -# Every layout, one file per name: plans that landed flat before the milestone -# moved to milestones/M###/ count too (#70). -while IFS= read -r plan; do - [ -f "$plan" ] || continue - # grep -c prints 0 itself and exits 1; `|| echo 0` would yield "0\n0". - count=$(grep -c '^- \[ \] T[0-9][0-9]' "$plan" 2>/dev/null); count=${count:-0} - OPEN_TASK_COUNT=$((OPEN_TASK_COUNT + count)) -done <= 11 { l = t($2); s = t($4); c = t($5); split(c, w, " ") + if (l != "" && l != "Lane" && l !~ /^-+$/) print l "\t" s "\t" w[1] }' "$YT_DIR/LANES.md" 2>/dev/null) +MINE=$(printf '%s\n' "$ROWS" | awk -F '\t' -v n="$TM" '$3 == n') +if [ -n "$MINE" ]; then + SCOPE=$(printf '%s\n' "$MINE" | awk -F '\t' '$2 == "claimed" || $2 == "running" { print $1; exit }') +else + SCOPE=$(printf '%s\n' "$TM" | grep -oE 'M[0-9]{3}-S[0-9]{2}(-T[0-9]{2})?' | head -1) + ACTIVE=$(printf '%s\n' "$ROWS" | awk -F '\t' '$3 != "" && $3 != "-" && $2 != "merged" && $2 != "dropped" { print substr($1, 1, 4) }') + if [ -n "$SCOPE" ] && [ -n "$ACTIVE" ]; then + printf '%s\n' "$ACTIVE" | grep -qxF "${SCOPE%%-*}" || exit 0 + fi +fi +case "$SCOPE" in M[0-9][0-9][0-9]-S[0-9][0-9]|M[0-9][0-9][0-9]-S[0-9][0-9]-T[0-9][0-9]) ;; *) exit 0 ;; esac +M=${SCOPE%%-*}; REST=${SCOPE#*-}; S=${REST%%-*}; T="" +[ "$REST" = "$S" ] || T=${REST#*-} -# If everything done, let teammate idle (exit 0, no feedback) -if [ "$OPEN_TASK_COUNT" -eq 0 ]; then - exit 0 +ROAD=$(yt_artifact_path "$YT_DIR" "$M-ROADMAP.md") +case "$(sed -n 's/^status:[ ]*\([^ ]*\).*/\1/p' "$ROAD" 2>/dev/null | head -1)" in + done|dropped|shipped-informally|backlog) exit 0 ;; +esac +PLAN=$(yt_artifact_path "$YT_DIR" "$M-$S-PLAN.md") +[ -f "$PLAN" ] || exit 0 +# grep -c prints 0 itself and exits 1; `|| echo 0` would yield "0\n0". +if [ -n "$T" ]; then + N=$(grep -cE "^- \[ \] $T([^0-9]|\$)" "$PLAN" 2>/dev/null) +else + N=$(grep -c '^- \[ \] T[0-9][0-9]' "$PLAN" 2>/dev/null) fi +case "$N" in ''|*[!0-9]*) N=0 ;; esac +[ "$N" -gt 0 ] || exit 0 + +# Once per teammate, scope and count; silent when it cannot be recorded. +SAID="$(yt_session_home)/$YT_SESSION_ID/idle-said" +KEY="$TM $SCOPE $N" +grep -qxF -- "$KEY" "$SAID" 2>/dev/null && exit 0 +mkdir -p "${SAID%/*}" 2>/dev/null && printf '%s\n' "$KEY" >> "$SAID" 2>/dev/null || exit 0 -# Otherwise emit feedback via exit 2 + stderr (lead gets the message) cat >&2 </dev/null -eq "ti: open tasks -> exit 2" 2 "$EC" -has "ti: reports open count" "$(cat "$ERR")" "2 task(s) still open" +run teammate-idle "{\"session_id\":\"ti1\",\"cwd\":$(jstr "$MAIN"),\"teammate_name\":\"impl-M999-S01\"}" XDG_STATE_HOME="$TMP/xdg" >/dev/null +eq "ti: open tasks of its slice -> exit 2" 2 "$EC" +has "ti: reports open count" "$(cat "$ERR")" "2 task(s) still open in M999-S01" run teammate-idle "{\"cwd\":$(jstr "$PLAIN")}" >/dev/null eq "ti: no .ytstack -> exit 0" 0 "$EC" run task-created "{\"cwd\":$(jstr "$MAIN"),\"tool_input\":{\"subject\":\"touch foo/bar.ts\",\"description\":\"edit foo/bar.ts\"}}" >/dev/null diff --git a/tests/hooks-teammate-idle.test.sh b/tests/hooks-teammate-idle.test.sh new file mode 100644 index 0000000..c1de09d --- /dev/null +++ b/tests/hooks-teammate-idle.test.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash +# Tests for the TeammateIdle hook (issues #97, #98). +# +# - counts only the lane's own scope: the LANES.md row the teammate holds +# (claimed or running), else an M###-S##[-T##] ref in its name; never the +# STATE pointer's milestone, never a done, dropped, shipped-informally or +# backlog milestone, never one outside the held lanes when LANES.md has any +# - no scope known, no session id, a reported row: silent +# - said once per teammate, scope and count (//idle-said) +# - writes nothing into the checkout +# +# Run: /bin/bash tests/hooks-teammate-idle.test.sh (exit 0 = all pass) + +set -uo pipefail +ROOT="$(cd "$(dirname "$0")/.." && pwd -P)" +HOOK="$ROOT/hooks/teammate-idle" +[ -f "$HOOK" ] || { echo "FATAL: hook not found at $HOOK"; exit 2; } + +PASS=0; FAIL=0 +ok() { PASS=$((PASS+1)); echo " ok - $1"; } +bad() { FAIL=$((FAIL+1)); echo " FAIL - $1${2:+ ($2)}"; } +eq() { if [ "$2" = "$3" ]; then ok "$1"; else bad "$1" "expected '$2' got '$3'"; fi; } +has() { case "$2" in *"$3"*) ok "$1";; *) bad "$1" "missing '$3' in: $2";; esac; } +lacks() { case "$2" in *"$3"*) bad "$1" "found '$3' in: $2";; *) ok "$1";; esac; } + +TMP=$(mktemp -d "${TMPDIR:-/tmp}/ytidle.XXXXXX"); TMP=$(cd "$TMP" && pwd -P) +trap 'rm -rf "$TMP"' EXIT +export XDG_STATE_HOME="$TMP/state" +unset CLAUDE_PLUGIN_DATA PLUGIN_DATA 2>/dev/null +ELSEWHERE="$TMP/elsewhere"; mkdir -p "$ELSEWHERE" +jstr() { printf '%s' "$1" | jq -Rs .; } + +# The issue's shape: STATE points at an old open milestone M034 with 13 open +# tasks; the lanes were dispatched for M046. +MAIN="$TMP/main"; Y="$MAIN/.ytstack"; mkdir -p "$Y/milestones/M046" +( cd "$MAIN" || exit 2; git init -q && git config user.email t@t.t && git config user.name t && git config commit.gpgsign false + printf 'current_milestone: M034\nactive_slice: S01\nactive_task: T01\n' > .ytstack/STATE.md + printf -- '---\nmilestone: M034\nstatus: in-progress\n---\n- [ ] S01\n' > .ytstack/M034-ROADMAP.md + { printf -- '---\nslice: S01\n---\n'; for i in 01 02 03 04 05 06 07 08 09 10 11 12 13; do printf -- '- [ ] T%s -- old\n' "$i"; done; } > .ytstack/M034-S01-PLAN.md + printf -- '---\nmilestone: M046\nstatus: in-progress\n---\n- [ ] S01\n- [ ] S02\n' > .ytstack/milestones/M046/M046-ROADMAP.md + printf -- '---\nslice: S01\n---\n- [x] T01 -- a\n- [x] T02 -- b\n- [ ] T03 -- c\n' > .ytstack/milestones/M046/M046-S01-PLAN.md + printf -- '---\nslice: S02\n---\n- [ ] T01 -- d\n- [ ] T02 -- e\n' > .ytstack/milestones/M046/M046-S02-PLAN.md + printf -- '---\nmilestone: M040\nstatus: done\n---\n' > .ytstack/M040-ROADMAP.md + printf -- '---\nslice: S01\n---\n- [ ] T01 -- left over\n' > .ytstack/M040-S01-PLAN.md + cat > .ytstack/LANES.md <<'EOF' +--- +updated: 2026-11-16T10:00:00Z +--- + +# Lanes + +| Lane | Kind | Status | Claimed by | Branch | Worktree | PR | Reviewed head | Round | Next action | +|---|---|---|---|---|---|---|---|---|---| +| M046-S01-T02 | implement | running | lane-done 2026-11-16T09:00Z | b1 | - | - | - | 0 | - | +| M046-S02 | implement | running | lane-s02 2026-11-16T09:00Z | b2 | - | - | - | 0 | - | +| M046-S01-T03 | implement | claimed | lane-t03 2026-11-16T09:00Z | b3 | - | - | - | 0 | - | +| M046-S01 | implement | reported | lane-rep 2026-11-16T09:00Z | b4 | - | - | - | 0 | - | +| M040-S01 | implement | running | lane-old 2026-11-16T09:00Z | b5 | - | - | - | 0 | - | +| review-pr-12 | review | running | lane-review 2026-11-16T09:00Z | - | - | 12 | - | 0 | - | +EOF + git add -A; git commit -qm seed ) >/dev/null 2>&1 || { echo FATAL fixture; exit 2; } + +# idle [session]: fire once; EC and ERR hold the result +idle() { + printf '{"session_id":"%s","cwd":%s,"hook_event_name":"TeammateIdle","teammate_name":"%s","team_name":"session-x"}' "${2:-s1}" "$(jstr "${CWD:-$MAIN}")" "$1" \ + | ( cd "$ELSEWHERE" && CLAUDE_PROJECT_DIR="$ELSEWHERE" bash "$HOOK" >/dev/null 2>"$TMP/err" ); EC=$? + ERR=$(cat "$TMP/err") +} + +echo "# #97/#98: the lane's own task is done, an unrelated milestone is open" +idle lane-done; eq "own task done -> exit 0" 0 "$EC"; eq "own task done -> silent" "" "$ERR" +idle nobody; eq "no lane scope -> exit 0" 0 "$EC"; eq "no lane scope -> silent, M034 not counted" "" "$ERR" +idle lane-review; eq "a lane outside the plan (review-pr-12) -> silent" "" "$ERR" +idle lane-rep; eq "a reported lane -> silent" "" "$ERR" +idle lane-old; eq "a lane in a done milestone -> silent" "" "$ERR" + +echo "# the useful case: the held slice still has open tasks" +idle lane-s02; eq "held slice with open tasks -> exit 2" 2 "$EC" +has "names the count" "$ERR" "2 task(s) still open"; has "names the lane" "$ERR" "M046-S02" +lacks "never names M034" "$ERR" "M034" +idle lane-s02; eq "#98: the same idle again -> exit 0" 0 "$EC"; eq "#98: said once" "" "$ERR" +idle lane-s02; eq "#98: a third idle -> silent" "" "$ERR" +printf -- '---\nslice: S02\n---\n- [x] T01 -- d\n- [ ] T02 -- e\n' > "$Y/milestones/M046/M046-S02-PLAN.md" +idle lane-s02; eq "progress, still open -> said again" 2 "$EC"; has "the new count" "$ERR" "1 task(s) still open" +idle lane-s02; eq "and then once only" "" "$ERR" +idle lane-s02 s2; eq "another session -> said again" 2 "$EC" +idle lane-t03; eq "held task still open -> exit 2" 2 "$EC"; has "task lane counts one" "$ERR" "1 task(s) still open in M046-S01-T03" + +echo "# team mode: no row, the ref in the teammate name" +idle impl-M046-S02 s3; eq "name names a held milestone's slice -> exit 2" 2 "$EC" +idle impl-M034-S01 s3; eq "name outside the held lanes' milestones -> silent" "" "$ERR" +mv "$Y/LANES.md" "$TMP/LANES.md" +idle impl-M034-S01 s3; eq "no LANES.md: the named slice counts" 2 "$EC"; has "its count" "$ERR" "13 task(s) still open in M034-S01" +printf -- '---\nmilestone: M034\nstatus: backlog\n---\n' > "$Y/M034-ROADMAP.md" +idle impl-M034-S01 s4; eq "a backlog milestone -> silent" "" "$ERR" +idle impl-M040-S01 s4; eq "a done milestone -> silent" "" "$ERR" +mv "$TMP/LANES.md" "$Y/LANES.md" +printf -- '---\nmilestone: M034\nstatus: in-progress\n---\n- [ ] S01\n' > "$Y/M034-ROADMAP.md" +printf -- '---\nslice: S02\n---\n- [ ] T01 -- d\n- [ ] T02 -- e\n' > "$Y/milestones/M046/M046-S02-PLAN.md" + +echo "# guards" +printf '{"cwd":%s,"hook_event_name":"TeammateIdle","teammate_name":"lane-s02"}' "$(jstr "$MAIN")" \ + | ( cd "$ELSEWHERE" && bash "$HOOK" >/dev/null 2>"$TMP/err" ); EC=$? +eq "no session id -> exit 0" 0 "$EC"; eq "no session id -> silent" "" "$(cat "$TMP/err")" +printf '{"session_id":"s9","cwd":%s,"hook_event_name":"TeammateIdle"}' "$(jstr "$MAIN")" \ + | ( cd "$ELSEWHERE" && bash "$HOOK" >/dev/null 2>"$TMP/err" ); EC=$? +eq "no teammate name -> silent" "" "$(cat "$TMP/err")" +eq "checkout untouched" "" "$(git -C "$MAIN" status --porcelain)" + +echo +echo "$PASS passed, $FAIL failed" +[ "$FAIL" -eq 0 ] diff --git a/tests/hooks-worktree.test.sh b/tests/hooks-worktree.test.sh index 0022fc8..0a3d38a 100644 --- a/tests/hooks-worktree.test.sh +++ b/tests/hooks-worktree.test.sh @@ -24,6 +24,7 @@ eq() { if [ "$2" = "$3" ]; then ok "$1"; else bad "$1" "expected '$2' got '$3'" TMP=$(mktemp -d "${TMPDIR:-/tmp}/ytwt.XXXXXX"); TMP=$(cd "$TMP" && pwd -P) trap 'rm -rf "$TMP"' EXIT PD="$TMP/plugin-data" +export XDG_STATE_HOME="$TMP/state" # session home (teammate-idle's idle-said) ELSEWHERE="$TMP/elsewhere"; mkdir -p "$ELSEWHERE" in_fixture() { case "$1" in "$TMP"/*) return 0 ;; *) echo "FATAL: non-fixture path '$1'" >&2; exit 2 ;; esac; } jstr() { printf '%s' "$1" | jq -Rs .; } @@ -134,14 +135,14 @@ fire task-completed "$MV" "$MV" ',"tool_input":{"subject":"M050-S01-T02 -- two"} [ -f "$MV/.ytstack/milestones/M050/M050-S01-T02-SUMMARY.md" ] && ok "d: task-completed writes the summary into milestones/M050/" || bad "d: summary in milestones/M050/" [ -e "$MV/.ytstack/M050-S01-T02-SUMMARY.md" ] && bad "d: no flat summary" || ok "d: no flat summary" grep -F -- '- [x] T02 -- two' >/dev/null "$MV/.ytstack/milestones/M050/M050-S01-PLAN.md" && ok "d: checkbox ticked in the moved slice plan" || bad "d: checkbox ticked in the moved slice plan" -fire teammate-idle "$MV" "$MV" '' -case "$(cat "$TMP/err.teammate-idle")" in *"1 task(s) still open in milestone M050"*) ok "d: teammate-idle counts the moved slice plan";; *) bad "d: teammate-idle counts the moved slice plan" "$(cat "$TMP/err.teammate-idle")";; esac +fire teammate-idle "$MV" "$MV" ',"teammate_name":"impl-M050-S01"' +case "$(cat "$TMP/err.teammate-idle")" in *"1 task(s) still open in M050-S01"*) ok "d: teammate-idle counts the moved slice plan";; *) bad "d: teammate-idle counts the moved slice plan" "$(cat "$TMP/err.teammate-idle")";; esac # ---- (e) split state: roadmap moved, a slice plan still flat (#70) ----------- echo "# (e) split state" printf -- '---\nslice: S02\n---\n- [ ] T01 -- three (src/flat.ts)\n- [ ] T02 -- four\n' > "$MV/.ytstack/M050-S02-PLAN.md" -fire teammate-idle "$MV" "$MV" '' -case "$(cat "$TMP/err.teammate-idle")" in *"3 task(s) still open in milestone M050"*) ok "e: teammate-idle counts the flat straggler too";; *) bad "e: teammate-idle counts the flat straggler too" "$(cat "$TMP/err.teammate-idle")";; esac +fire teammate-idle "$MV" "$MV" ',"teammate_name":"impl-M050-S02"' +case "$(cat "$TMP/err.teammate-idle")" in *"2 task(s) still open in M050-S02"*) ok "e: teammate-idle finds the flat straggler plan too";; *) bad "e: teammate-idle finds the flat straggler plan too" "$(cat "$TMP/err.teammate-idle")";; esac printf '{"session_id":"se","cwd":%s,"hook_event_name":"TaskCreated","tool_input":{"subject":"touch src/flat.ts"}}' "$(jstr "$MV")" \ | ( cd "$MV" && env CLAUDE_PLUGIN_DATA="$PD" CLAUDE_PROJECT_DIR="$MV" bash "$H/task-created" >/dev/null 2>"$TMP/err.tc" ); EC=$? eq "e: task-created finds the file in the flat slice plan (no drift)" 0 "$EC" @@ -150,7 +151,7 @@ eq "e: task-created finds the file in the flat slice plan (no drift)" 0 "$EC" echo "# (f) all done" printf -- '---\nslice: S01\n---\n- [x] T01 -- one\n- [x] T02 -- two\n' > "$MV/.ytstack/milestones/M050/M050-S01-PLAN.md" printf -- '---\nslice: S02\n---\n- [x] T01 -- three\n' > "$MV/.ytstack/M050-S02-PLAN.md" -printf '{"session_id":"sf","cwd":%s,"hook_event_name":"TeammateIdle"}' "$(jstr "$MV")" \ +printf '{"session_id":"sf","cwd":%s,"hook_event_name":"TeammateIdle","teammate_name":"impl-M050-S01"}' "$(jstr "$MV")" \ | ( cd "$MV" && env CLAUDE_PLUGIN_DATA="$PD" CLAUDE_PROJECT_DIR="$MV" bash "$H/teammate-idle" >/dev/null 2>"$TMP/err.ti" ); EC=$? eq "f: no open task -> exit 0" 0 "$EC" eq "f: no open task -> no message" "" "$(cat "$TMP/err.ti")" From e07d06168e9d84475ad8fb3b0c57d01f68b4d01a Mon Sep 17 00:00:00 2001 From: Alex Wegener Date: Mon, 16 Nov 2026 22:04:35 +0100 Subject: [PATCH 2/4] docs: spec areas skills and checks-and-evals after the teammate-idle fix (#97, #98) Co-Authored-By: Claude Opus 5.5 --- .ytstack/spec/checks-and-evals.md | 2 +- .ytstack/spec/skills.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ytstack/spec/checks-and-evals.md b/.ytstack/spec/checks-and-evals.md index 1fb9f6d..27ed140 100644 --- a/.ytstack/spec/checks-and-evals.md +++ b/.ytstack/spec/checks-and-evals.md @@ -32,7 +32,7 @@ sources: - docs/ux/signal-format.md - docs/ux/external-plans.md - docs/ux/upstream-feedback.md -verified_at: 53a0f84 +verified_at: 3f09ae1 --- # checks-and-evals diff --git a/.ytstack/spec/skills.md b/.ytstack/spec/skills.md index a5101ce..810d47c 100644 --- a/.ytstack/spec/skills.md +++ b/.ytstack/spec/skills.md @@ -58,7 +58,7 @@ Read from `PREFERENCES.md` in the resolved `.ytstack` directory by `yt_prefs` in | `autonomy` | `loop`: inside a slice, `plan-task` continues into `test-driven-development`, `verification-before-completion` and `summarize-task`, and `summarize-task` continues with the next `plan-task`, without asking. It stops at the slice boundary and at every gate. `step`: every skill returns control. `slice-milestone` never chains. | `using-ytstack`, `plan-task`, `summarize-task` | | `quick_lane` | `off`: `quick-task` stops at its gate and points at `plan-task`. `on`: `using-ytstack` routes one-sentence changes with a known cause to `quick-task`. | `quick-task`, `using-ytstack` | | `minimal_code` | `on`: `hooks/session-start` adds a pointer that tells the agent to load `minimal-code` before writing code or adding a check, and the TDD wrapper applies its ladder in the GREEN step. `off`: no pointer. A rendered brief carries the contract in both cases. | `hooks/session-start`, `test-driven-development`, `bin/ytstack-brief` | -| `team` | `off`: `spawn-milestone-team` dispatches worktree subagents. `on`: it emits an Agent Teams instruction and requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`. | `spawn-milestone-team` | +| `team` | `off`: `spawn-milestone-team` dispatches worktree subagents. `on`: it emits an Agent Teams instruction and requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`; each teammate is named after its slice (`impl-M004-S02`), which `hooks/teammate-idle` reads as the teammate's lane. | `spawn-milestone-team` | | `merge_by` | `risk` (default): the coordinator merges when `bin/ytstack-risk route` says `unattended` and the host's gates hold, otherwise a person. `human`: always a person. `coordinator`: always the coordinator, except that a `reason: spec` line of the route sends the lane back to the worker first. A value outside the three reads as `human`. | `finish-lane` | | `evidence_dir` | Where a visual review stores its screenshots, default `.ytstack/evidence`, relative to the main checkout. | `visual-review`, `bin/ytstack-risk`, `bin/ytstack-finish-lane` | | `escalate` | What a coordinator brings to a person (`docs/ux/coordinator-format.md`, "Who decides"): a comma separated subset of `violation`, `deviation`, `irreversible`, `secret`, `spend`, default all five; `reserved` (a plan line that says verdict, approval or sign-off, or a standing entry) always holds. Everything else the coordinator decides and records in `DECISIONS.md`. A value with an item outside the five reads as all five. | `coordinate` (preamble `ESCALATE`, Step 8), `bin/ytstack-questions new` | From e04ddc81e140475076d03ae15857d68e91834c6c Mon Sep 17 00:00:00 2001 From: Alex Wegener Date: Mon, 16 Nov 2026 22:25:44 +0100 Subject: [PATCH 3/4] fix: teammate-idle review: foreign lane rows, main checkout LANES.md, last said count (#97, #98) - the name fallback stays silent when the named lane has any row in LANES.md (another holder, released, dropped), and the ref must stand alone in the name - LANES.md is read from the main checkout through yt_lanes_file, shared with ytstack-upkeep - speaks when the count differs from the last one said (2 -> 1 -> 2 is said) - stop prunes 14-day-old session dirs holding only idle-said and/or stop-said - spec text matches the code (first word, yt_artifact_path) Co-Authored-By: Claude Opus 5.5 --- .ytstack/DECISIONS.md | 2 +- .ytstack/spec/hooks-and-state.md | 8 +++--- CHANGELOG.md | 10 ++++--- bin/ytstack-upkeep | 2 +- hooks/lib/git-ctx.sh | 9 +++++++ hooks/stop | 9 ++++--- hooks/teammate-idle | 45 ++++++++++++++++++------------- tests/hooks-readonly.test.sh | 2 +- tests/hooks-stop.test.sh | 6 ++++- tests/hooks-teammate-idle.test.sh | 18 ++++++++++++- 10 files changed, 77 insertions(+), 34 deletions(-) diff --git a/.ytstack/DECISIONS.md b/.ytstack/DECISIONS.md index 62c4588..1a34662 100644 --- a/.ytstack/DECISIONS.md +++ b/.ytstack/DECISIONS.md @@ -1575,7 +1575,7 @@ Plus: ops-layer split during the same session (yopstack created as own public re - B) The lane's scope: its held `LANES.md` row, else a slice ref in the teammate name; silent without one; once per teammate, lane and count. - C) Read the host's team task list under `~/.claude/tasks/` for the teammate's owned tasks. -**Chose:** B. A row counts only while `claimed` or `running`; any other status of the teammate's row means its work is in. Without a row (team mode claims no lanes) the `M###-S##[-T##]` in the name counts, and `spawn-milestone-team` names team-mode teammates after their slice. With held lanes in `LANES.md`, a name ref outside their milestones is ignored. A milestone whose roadmap is `done`, `dropped`, `shipped-informally` or `backlog` never counts. The record is `//idle-said`; a new count after progress is said once more. +**Chose:** B. A row counts only while `claimed` or `running`; any other status of the teammate's row means its work is in. Without a row of its own (team mode claims no lanes) the `M###-S##[-T##]` that stands alone in the name counts, and `spawn-milestone-team` names team-mode teammates after their slice; a lane that has any row (another holder, released, dropped) is not the teammate's, so an old worker of a re-claimed lane is not pushed back to it. With held lanes in `LANES.md`, a name ref outside their milestones is ignored. `LANES.md` is the main checkout's (`yt_lanes_file`). A milestone whose roadmap is `done`, `dropped`, `shipped-informally` or `backlog` never counts. The record is `//idle-said`; the hook speaks when the count differs from the last one it said for that teammate and lane. **Reason:** A teammate can only act on its own lane; the pointer is the lead's position, not the lane's. A count that did not change since the last message carries nothing new, so repeating it only costs turns. C reads an undocumented host format. diff --git a/.ytstack/spec/hooks-and-state.md b/.ytstack/spec/hooks-and-state.md index 27b01a9..b92029c 100644 --- a/.ytstack/spec/hooks-and-state.md +++ b/.ytstack/spec/hooks-and-state.md @@ -35,7 +35,7 @@ The lifecycle hooks under `hooks/` and the shared library `hooks/lib/git-ctx.sh` - `yt_epoch` turns an ISO time into seconds with BSD `date -j`, GNU `date -d`, or, for BusyBox, `date -d` on the form `YYYY-MM-DD HH:MM:SS`. - `yt_brownfield_signals` counts up to six signs of an existing codebase and names which file would feed which artifact. The comment above the function lists the counted signals and the hint-only ones. - `yt_commit_ref_pattern` renders a task's commit pattern from `commit_ref_pattern` in `PREFERENCES.md`, or from the default. `yt_task_commits` lists commits whose subject matches it. When none match, it falls back to the commits on the current branch after the merge-base with the default branch, and reports which source it used. -- `yt_find_artifacts` lists artifacts newest first from the flat layout and from the alternative layouts named in its comment. Reading tolerates those layouts. `yt_artifact_dir` and `yt_artifact_path` say where a milestone's files live and where its new ones go: the directory that already holds its roadmap or files, else flat ([artifacts.md](artifacts.md), "Location and scope"). `post-tool-use-bash`, `task-completed`, `stop`, `pre-tool-use-edit` and `session-start` find the milestone's files through them; `task-created` and `teammate-idle` list its slice plans in every layout through `yt_find_artifacts`, one per name, so a plan that landed flat before the milestone moved counts too. +- `yt_find_artifacts` lists artifacts newest first from the flat layout and from the alternative layouts named in its comment. Reading tolerates those layouts. `yt_artifact_dir` and `yt_artifact_path` say where a milestone's files live and where its new ones go: the directory that already holds its roadmap or files, else flat ([artifacts.md](artifacts.md), "Location and scope"). `post-tool-use-bash`, `task-completed`, `stop`, `pre-tool-use-edit`, `session-start` and `teammate-idle` find the milestone's files through them; `task-created` lists its slice plans in every layout through `yt_find_artifacts`, one per name, so a plan that landed flat before the milestone moved counts too. `yt_lanes_file ` (call `yt_git_ctx` first) is the `LANES.md` to read: the main checkout's `.ytstack/LANES.md` when it exists (a linked worktree carries a stale copy), else `/LANES.md`; `teammate-idle` and `bin/ytstack-upkeep` read it through this one function. - `yt_factory_notices` returns one line per factory tool that is off although the project would use it, from local files only: risk routing (`spec/` without `REVIEW.md` or without an area whose frontmatter allows `auto_merge: low|normal`, quotes allowed, read with `yt_fm`, the reader `bin/ytstack-risk` uses; while `merge_by` is `risk`), the PR watch on a GitHub `origin` (no line in `~/.ytstack/config` that turns the hook on, read as `hooks/pr-watch` does: any `pr_watch=on` line; or `on` with a heartbeat missing or 10 minutes old; `yt_pr_watch_heartbeat` reads `watch.sqlite3`, else the time of `worker.lock`), and `RUNTIME.md` without "Release" or "Signals" while deploy or signal evidence exists (`ytstack-runtime sections`). `merge_by: human|coordinator` and `pr_watch=off` are choices and stay silent. `yt_read_stdin` also sets `YT_SOURCE`. - `yt_standing` lists the standing instructions in force from `.ytstack/standing/` (name, `given`, `scope`, tab separated), newest first by the time in the name (missing seconds count as `00`), without the entries another entry names in `supersedes`, without entries of `kind: end` and without entries whose `until` has passed. It prints nothing without the directory; `STANDING.md` is read by the skills themselves. `yt_standing_fields` prints the same entries with every key, the first sentence of the body, `active` or `expired`, the source and the whole body on one line (`-` for an empty value); with `pending` as third argument also the entries of `yt_standing_pending` (on a local `standing/*` branch or the upstream it tracks, not in the working tree, not on `yt_standing_default_ref`), read with `git show`, source `pending:`. `yt_standing_default_ref` is `origin/HEAD`, else `origin/main`, `origin/master`, `main`, `master`. `yt_standing_lines [max] [full]` prints the active ones for a role (with `full` the whole body, for briefs) (`docs/ux/coordinator-format.md`, "Scope and roles"), pending ones included and marked, as `- (): `, with a pointer line past `max`. None of them runs a command of an entry. `yt_latest_handoff` (for skill preambles) finds the newest `latest-handoff` of the worktree under every base a hook may have used: `CLAUDE_PLUGIN_DATA`, `PLUGIN_DATA`, each `~/.claude/plugins/data/ytstack*` and the XDG base. `coordinate` and `resume-session` use it; before, they looked under `yt_state_base` only, which in the Bash tool is not where the hook wrote. `yt_session_home` is `${XDG_STATE_HOME:-~/.local/state}/ytstack/sessions`: per-session state that a hook and the Bash tool of the same session both find (`CLAUDE_PLUGIN_DATA` reaches hooks only). It holds the coordinate marker (the resolved `.ytstack` on line 1, the repository key on line 2, which keys the lint counter also in user scope), the prompt counter and the standing flags of a session. `yt_behind_origin ` (issue #82) says whether the checkout is on the default branch (`yt_standing_default_ref`, only when that is an `origin` ref) and behind it, from local refs only, never a fetch (an `origin/` that was never fetched counts as current), and only for a `.ytstack` inside the checkout whose `STATE.md` that ref has (else all 0 and empty: user scope, an untracked `STATE.md`): `YT_BEHIND_N`, `YT_AHEAD_N`, `YT_BEHIND_REF` (`origin/`), `YT_BEHIND_CHANGED` (`yes` when origin changed `STATE.md` since the merge base) and `YT_BEHIND_STATE`, origin's `STATE.md` only when it is the one to read: strictly behind (not diverged), changed, and the working tree's `STATE.md` is HEAD's (PR #94 review). @@ -74,18 +74,18 @@ Every hook except `pr-watch` sources the library and resolves from the payload ` | `standing-prompt` | UserPromptSubmit (second entry) | `session_id`, `prompt` | only with the coordinate marker `//coordinate`: appends the epoch of every human prompt (not one that starts with `<`) to `prompts`; a prompt that reads like a standing instruction (instruction phrases in the script, English and German; a prompt that is only one question never) goes into `standing-flags` and gets one line of `additionalContext`: record it with `ytstack-standing add` before the next dispatch | 0 | | `pre-compact` | PreCompact | `cwd`, `session_id`, `trigger` | writes `HANDOFF.auto.md` into the session state directory, renames a fresh `latest-handoff` symlink into the worktree state directory, prints compaction guidance on stdout; with the coordinate marker appends the epoch to `compactions` beside it, also without a `.ytstack` (issue #83) | 0 | | `session-end` | SessionEnd | `cwd`, `session_id`, `reason` | appends one JSON line to `session.jsonl` in the session state directory | 0 | -| `stop` | Stop | `cwd`, `session_id`, `stop_hook_active` | prints a `systemMessage` when the active task has no summary or only a draft, once per session and pointer (`stop-said`), not with the coordinate marker and not for a pointer the lint reports as W10; when `yt_behind_origin` gives origin's `STATE.md` instead one message per origin head with the count and its pointer (issue #82); when a new session dir is made, dirs of sessions untouched for 14 days that only hold `stop-said` are removed; with the coordinate marker from the second compaction one reminder per compaction to rotate (Step 12, `rotate-said`; issue #83); with the coordinate marker and flagged prompts not handled yet, `decision: block` once when no standing entry exists since the first of them (working tree, or added on any ref after it), then writes `standing-stop`; with the marker also the coordinate lints: a `systemMessage` once per session when `LANES.md` lags the session's dispatches and reports by more than five minutes or the STATE pointer is behind (W2), and a block once when the same lint came in `YT_LINT_STREAK_N` (3) sessions in a row, a session counting once when the lint was there at any of its stops, overlapping sessions once each (counter `/repos//coordinate-lints`) | 0 | +| `stop` | Stop | `cwd`, `session_id`, `stop_hook_active` | prints a `systemMessage` when the active task has no summary or only a draft, once per session and pointer (`stop-said`), not with the coordinate marker and not for a pointer the lint reports as W10; when `yt_behind_origin` gives origin's `STATE.md` instead one message per origin head with the count and its pointer (issue #82); when a new session dir is made, dirs of sessions untouched for 14 days that only hold `stop-said` and/or `idle-said` are removed; with the coordinate marker from the second compaction one reminder per compaction to rotate (Step 12, `rotate-said`; issue #83); with the coordinate marker and flagged prompts not handled yet, `decision: block` once when no standing entry exists since the first of them (working tree, or added on any ref after it), then writes `standing-stop`; with the marker also the coordinate lints: a `systemMessage` once per session when `LANES.md` lags the session's dispatches and reports by more than five minutes or the STATE pointer is behind (W2), and a block once when the same lint came in `YT_LINT_STREAK_N` (3) sessions in a row, a session counting once when the lint was there at any of its stops, overlapping sessions once each (counter `/repos//coordinate-lints`) | 0 | | `pre-tool-use-agent` | PreToolUse on `Agent`, `Task`, `SendMessage`, `Bash` | `session_id`, `tool_name`, the prompt or message, `subagent_type`, `isolation`, the command | only with the coordinate marker: appends every `Agent` call to `dispatches` except a lookup type (`Explore`, `Plan`, `claude-code-guide`, `statusline-setup`, a type naming search or explore) without a brief; a prompt without a line starting with `# Brief: ` (a `SendMessage` only above 400 characters) gets one line of `additionalContext` naming claim, render, dispatch; an `Agent` call that is no lookup and has no `isolation` one line naming `isolation: "worktree"`; a `Bash` command that runs `gh pr merge` or `gh pr close` as a command (per line and segment, after assignments, `if`/`then`/`!`, wrappers, `env`, `xargs` and `gh -R`; not in quotes or after `#`) one line naming `ytstack-finish-lane merge`, or `parked` and `gh run rerun` (issue #83); never a permission decision | 0 | | `pre-tool-use-edit` | PreToolUse on `Edit`, `Write`, `MultiEdit` | `cwd`, target path | prints a drift warning on stderr | 0 | | `post-tool-use-bash` | PostToolUse on `Bash` | `cwd`, command, exit code, `tool_response.stdout` | creates a draft task summary once; with the coordinate marker, a `gh run list --branch ` (or `-b`) whose output has a failed run (tab-separated `completed`/`failure`, `timed_out` or `startup_failure`, or a JSON array with `conclusion` and `workflowName`), counting only the newest run of each workflow and, with `--repo`/`-R`, only the repository of `origin`, gets one `additionalContext` note to run `ytstack:lesson`, once per distinct set of those runs (`red-main-said`; issue #83) | 0 | | `task-created` | TaskCreated | `cwd`, subject, description | prints a scope warning on stderr | 2 on drift, else 0 | | `task-completed` | TaskCompleted | `cwd`, subject | writes an auto summary, ticks the slice plan checkbox | 0 | -| `teammate-idle` | TeammateIdle | `cwd`, `session_id`, `teammate_name` | prints the open task count of the teammate's own lane on stderr, once per teammate, lane and count (`idle-said`; issues #97, #98) | 2 when it says so, else 0 | +| `teammate-idle` | TeammateIdle | `cwd`, `session_id`, `teammate_name` | prints the open task count of the teammate's own lane on stderr, again only when the count differs from the last one said for that teammate and lane (`idle-said`; issues #97, #98) | 2 when it says so, else 0 | - `pre-tool-use-edit` skips paths under `.ytstack/` and the artifact file names listed in the script. Scope drift means: the active task has a plan, and neither the checkout-relative path nor its basename occurs anywhere in that plan. Schema drift means: the target matches a model or schema pattern from the script and the plan names no migration path. - `post-tool-use-bash` acts only when all of this holds: the call succeeded, the command contains a real `git commit` (after a command separator, optionally behind the wrapper tokens the script lists), `STATE.md` names an active slice and task, HEAD's subject matches the task's commit pattern, and no summary file exists. The stub carries `closed: draft`. - `task-created` runs only with an active milestone. It extracts file-like paths from subject and description. Drift is a path that occurs in no slice plan of the current milestone and not in its roadmap. -- `task-completed` needs an `M###-S##-T##` id in the task subject. It never overwrites an existing summary. `teammate-idle` counts only the lane the teammate holds: the `LANES.md` row whose `Claimed by` starts with its `teammate_name`, counted only while that row is `claimed` or `running` (any other status of its row: silent); without a row, an `M###-S##[-T##]` ref in the name (team mode), and with held lanes in `LANES.md` only for a milestone among theirs. A slice counts its plan's unchecked `T##` boxes, a task its own box. It never reads the `STATE.md` pointer, never counts a milestone whose roadmap `status` is `done`, `dropped`, `shipped-informally` or `backlog`, and stays silent with no scope, no session id or no teammate name. It says the same teammate, lane and count once per session (`//idle-said`; the payload carries no loop guard), and stays silent when it cannot record that. +- `task-completed` needs an `M###-S##-T##` id in the task subject. It never overwrites an existing summary. `teammate-idle` counts only the lane the teammate holds, read from `yt_lanes_file`: the `LANES.md` row whose `Claimed by` has the `teammate_name` as its first word (exact match), counted only while that row is `claimed` or `running` (any other status of its row: silent). Without a row of its own, an `M###-S##[-T##]` ref in the name that stands alone (no letter or digit right before or after it; team mode), silent when that lane, its slice or a task of it has any row in `LANES.md` (another holder, released, dropped), and with held lanes in `LANES.md` only for a milestone among theirs. A slice counts its plan's unchecked `T##` boxes, a task its own box. It never reads the `STATE.md` pointer, never counts a milestone whose roadmap `status` is `done`, `dropped`, `shipped-informally` or `backlog`, and stays silent with no scope, no session id or no teammate name. It speaks when the count differs from the last one it said for this teammate and lane in this session (`//idle-said`, lines ` `; the payload carries no loop guard), and stays silent when it cannot record that. - `stop` speaks only when milestone, slice and task are all set and the task's summary is missing or a draft (once per session and pointer, not in a coordinate session, not for a W10 pointer), when the checkout is behind origin, when a coordinator should rotate, or when the standing check or a coordinate lint speaks. It stays silent when `stop_hook_active` is true. The standing check counts an entry whose name time is in or after the minute of the first unhandled flagged prompt, in the working tree's `standing/` or in `git log --all --since= --diff-filter=A` of the repository; local git only, no host call. ### SessionStart injection diff --git a/CHANGELOG.md b/CHANGELOG.md index 2850133..ff0dda7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,10 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 milestone and fired at every idle turn, so coordinator lanes were asked about 30 times each to claim tasks of an old open milestone outside their brief. It now counts only the lane the teammate holds (its claimed or - running `LANES.md` row, else the `M###-S##[-T##]` in its name), never a - done, dropped, shipped-informally or backlog milestone, and stays silent - without a known lane or after the lane reported. It says the same lane and - count once per session (`idle-said` in the session home). + running row in the main checkout's `LANES.md`, else the `M###-S##[-T##]` + in its name when that lane has no row of someone else), never a done, + dropped, shipped-informally or backlog milestone, and stays silent without + a known lane or after the lane reported. It speaks again only when the open + count changed since it last spoke (`idle-said` in the session home, pruned + by `stop` after 14 days like `stop-said`). `spawn-milestone-team` 0.5.3 names team-mode teammates after their slice. ## [0.12.0] - 2026-11-16 diff --git a/bin/ytstack-upkeep b/bin/ytstack-upkeep index 3b49f3c..42e3a19 100755 --- a/bin/ytstack-upkeep +++ b/bin/ytstack-upkeep @@ -160,7 +160,7 @@ worktrees() { fi # Branches a held lane names: " ()", from the # LANES.md of the main checkout (a linked worktree carries a stale copy). - lanes="$top/.ytstack/LANES.md"; [ -f "$lanes" ] || lanes="$YT_DIR/LANES.md" + lanes=$(yt_lanes_file "$YT_DIR") [ ! -f "$lanes" ] || held=$(awk -v tab="$TAB" ' /^\|/ && ++n > 2 { split($0, c, "|"); for (i = 2; i <= 6; i++) gsub(/^[ \t]+|[ \t]+$/, "", c[i]) diff --git a/hooks/lib/git-ctx.sh b/hooks/lib/git-ctx.sh index 310c036..ab17ae3 100644 --- a/hooks/lib/git-ctx.sh +++ b/hooks/lib/git-ctx.sh @@ -889,6 +889,15 @@ yt_standing_lines() { return 0 } +# yt_lanes_file -> the LANES.md to read (call yt_git_ctx first): the +# main checkout's .ytstack/LANES.md when it exists (a linked worktree carries a +# stale copy), else /LANES.md. The one place that says where it lives. +yt_lanes_file() { + local top="${YT_MAIN_TOPLEVEL:-${YT_TOPLEVEL:-}}" + if [ -n "$top" ] && [ -f "$top/.ytstack/LANES.md" ]; then printf '%s\n' "$top/.ytstack/LANES.md" + else printf '%s\n' "$1/LANES.md"; fi +} + # yt_session_home -> the directory of per-session state that a hook and the # Bash tool of the same session both find: ${XDG_STATE_HOME:-~/.local/state}/ # ytstack/sessions. Not yt_state_base: Claude Code sets CLAUDE_PLUGIN_DATA for diff --git a/hooks/stop b/hooks/stop index 2a6d5d9..b481a7e 100644 --- a/hooks/stop +++ b/hooks/stop @@ -181,9 +181,12 @@ said() { # said : 0 when this session said it already; records it otherwise grep -qxF -- "$1" "$f" 2>/dev/null && return 0 if [ ! -d "${f%/*}" ]; then # A new session dir: prune the dirs of old sessions that only ever held - # stop-said (14 days untouched); a coordinate session's dir stays. - find "$(yt_session_home)" -mindepth 2 -maxdepth 2 -name stop-said -mtime +14 2>/dev/null | while IFS= read -r o; do - [ "$(ls -A "${o%/*}" 2>/dev/null)" = stop-said ] && rm -f "$o" && rmdir "${o%/*}" 2>/dev/null + # stop-said and/or idle-said (hooks/teammate-idle), all 14 days + # untouched; a coordinate session's dir stays. + find "$(yt_session_home)" -mindepth 2 -maxdepth 2 \( -name stop-said -o -name idle-said \) -mtime +14 2>/dev/null | while IFS= read -r o; do + o=${o%/*}; [ -d "$o" ] || continue + case "$(ls -A "$o" 2>/dev/null | tr '\n' ' ')" in "stop-said "|"idle-said "|"idle-said stop-said ") ;; *) continue ;; esac + [ -z "$(find "$o" -type f ! -mtime +14 2>/dev/null)" ] && rm -f "$o/stop-said" "$o/idle-said" && rmdir "$o" 2>/dev/null done mkdir -p "${f%/*}" 2>/dev/null || return 1 fi diff --git a/hooks/teammate-idle b/hooks/teammate-idle index 249b594..6a29f5e 100644 --- a/hooks/teammate-idle +++ b/hooks/teammate-idle @@ -6,17 +6,20 @@ # has open tasks, it says so once (exit 2 + stderr keeps the teammate working). # # The lane's scope, M###-S## (a slice) or M###-S##-T## (a task): -# 1. the LANES.md row whose "Claimed by" names the teammate. Only a claimed -# or running row counts; a row in any other status (reported, merged, -# ...) means the lane's work is in, and the hook stays silent. -# 2. no row: the M###-S##[-T##] ref in the teammate's name (team mode names -# a teammate after its slice, impl-M004-S02). With held lanes in LANES.md -# only a milestone among theirs counts. +# 1. the LANES.md row whose "Claimed by" names the teammate (its first +# word). Only a claimed or running row counts; a row in any other status +# (reported, merged, ...) means the lane's work is in: silent. +# 2. no row: the M###-S##[-T##] ref in the teammate's name, ending at a +# non-word character (team mode names a teammate after its slice, +# impl-M004-S02). Silent when that lane has any row in LANES.md (another +# holder, released, dropped: it is not this teammate's). With held lanes +# in LANES.md only a milestone among theirs counts. # Nothing else: never the STATE pointer, no scope known means silence. -# A milestone whose roadmap says done, dropped, shipped-informally or backlog -# is never counted. Said once per teammate, scope and open count in -# //idle-said: the payload has no loop guard, so a -# repeat idle with no progress stays quiet; progress gives one new message. +# LANES.md is the main checkout's (yt_lanes_file). A milestone whose roadmap +# says done, dropped, shipped-informally or backlog is never counted. Said +# when the open count differs from the last one said for this teammate and +# scope (//idle-said): the payload has no loop +# guard, so a repeat idle with no change stays quiet. # No session id, no teammate name, no jq or python: silent. Fails open. set -uo pipefail @@ -47,15 +50,20 @@ YT_DIR=$(yt_resolve_yt_dir) # LANES.md rows: lane TAB status TAB holder (first word of "Claimed by"). ROWS="" -[ -f "$YT_DIR/LANES.md" ] && ROWS=$(awk -F '|' ' +LANES=$(yt_lanes_file "$YT_DIR") +[ -f "$LANES" ] && ROWS=$(awk -F '|' ' function t(s) { gsub(/^[ \t]+|[ \t]+$/, "", s); return s } /^\|/ && NF >= 11 { l = t($2); s = t($4); c = t($5); split(c, w, " ") - if (l != "" && l != "Lane" && l !~ /^-+$/) print l "\t" s "\t" w[1] }' "$YT_DIR/LANES.md" 2>/dev/null) + if (l != "" && l != "Lane" && l !~ /^-+$/) print l "\t" s "\t" w[1] }' "$LANES" 2>/dev/null) MINE=$(printf '%s\n' "$ROWS" | awk -F '\t' -v n="$TM" '$3 == n') if [ -n "$MINE" ]; then SCOPE=$(printf '%s\n' "$MINE" | awk -F '\t' '$2 == "claimed" || $2 == "running" { print $1; exit }') else - SCOPE=$(printf '%s\n' "$TM" | grep -oE 'M[0-9]{3}-S[0-9]{2}(-T[0-9]{2})?' | head -1) + # The ref stands alone in the name: impl-M046-S023 names no lane. + SCOPE=$(printf '%s\n' "$TM" | grep -oE '(^|[^A-Za-z0-9])M[0-9]{3}-S[0-9]{2}(-T[0-9]{2})?([^A-Za-z0-9]|$)' | head -1 | grep -oE 'M[0-9]{3}-S[0-9]{2}(-T[0-9]{2})?') + # A lane with a row is not this teammate's (another holder, released, dropped). + [ -z "$SCOPE" ] || ! printf '%s\n' "$ROWS" | awk -F '\t' -v s="$SCOPE" ' + { sl = substr(s, 1, 8) } $1 == s || $1 == sl || index($1, s "-") == 1 { f = 1 } END { exit !f }' || exit 0 ACTIVE=$(printf '%s\n' "$ROWS" | awk -F '\t' '$3 != "" && $3 != "-" && $2 != "merged" && $2 != "dropped" { print substr($1, 1, 4) }') if [ -n "$SCOPE" ] && [ -n "$ACTIVE" ]; then printf '%s\n' "$ACTIVE" | grep -qxF "${SCOPE%%-*}" || exit 0 @@ -80,15 +88,16 @@ fi case "$N" in ''|*[!0-9]*) N=0 ;; esac [ "$N" -gt 0 ] || exit 0 -# Once per teammate, scope and count; silent when it cannot be recorded. +# Said when the count differs from the last one said for this teammate and +# scope (lines " "); silent when it cannot be recorded. SAID="$(yt_session_home)/$YT_SESSION_ID/idle-said" -KEY="$TM $SCOPE $N" -grep -qxF -- "$KEY" "$SAID" 2>/dev/null && exit 0 -mkdir -p "${SAID%/*}" 2>/dev/null && printf '%s\n' "$KEY" >> "$SAID" 2>/dev/null || exit 0 +LAST=$(awk -v t="$TM" -v s="$SCOPE" '$1 == t && $2 == s { n = $3 } END { print n }' "$SAID" 2>/dev/null) +[ "$LAST" != "$N" ] || exit 0 +mkdir -p "${SAID%/*}" 2>/dev/null && printf '%s %s %s\n' "$TM" "$SCOPE" "$N" >> "$SAID" 2>/dev/null || exit 0 cat >&2 </dev/null eq "ti: open tasks of its slice -> exit 2" 2 "$EC" has "ti: reports open count" "$(cat "$ERR")" "2 task(s) still open in M999-S01" -run teammate-idle "{\"cwd\":$(jstr "$PLAIN")}" >/dev/null +run teammate-idle "{\"session_id\":\"ti2\",\"cwd\":$(jstr "$PLAIN"),\"teammate_name\":\"impl-M999-S01\"}" XDG_STATE_HOME="$TMP/xdg" >/dev/null eq "ti: no .ytstack -> exit 0" 0 "$EC" run task-created "{\"cwd\":$(jstr "$MAIN"),\"tool_input\":{\"subject\":\"touch foo/bar.ts\",\"description\":\"edit foo/bar.ts\"}}" >/dev/null eq "tcr: drifted path -> exit 2" 2 "$EC" diff --git a/tests/hooks-stop.test.sh b/tests/hooks-stop.test.sh index 52110ac..3193806 100644 --- a/tests/hooks-stop.test.sh +++ b/tests/hooks-stop.test.sh @@ -126,10 +126,14 @@ case "$OUT" in *"behind"*|*" / / "*) bad "user scope: no empty origin pointer"; echo "# old session dirs that only held stop-said are pruned (PR #94 review)" SHM="$XDG_STATE_HOME/ytstack/sessions" mkdir -p "$SHM/old1" "$SHM/oldc"; : > "$SHM/old1/stop-said"; : > "$SHM/oldc/stop-said"; : > "$SHM/oldc/coordinate" -touch -t 202001010000 "$SHM/old1/stop-said" "$SHM/oldc/stop-said" +mkdir -p "$SHM/oldi" "$SHM/oldb" "$SHM/newi"; : > "$SHM/oldi/idle-said"; : > "$SHM/oldb/idle-said"; : > "$SHM/oldb/stop-said"; : > "$SHM/newi/idle-said" +touch -t 202001010000 "$SHM/old1/stop-said" "$SHM/oldc/stop-said" "$SHM/oldi/idle-said" "$SHM/oldb/idle-said" "$SHM/oldb/stop-said" SID=fresh2; printf 'current_milestone: M042\nactive_slice: S09\nactive_task: T09\n' > "$WT/.ytstack/STATE.md"; OUT=$(fire "$WT"); has "a new session's reminder" "$OUT" "M042-S09-T09" eq "an old stop-said-only dir is gone" no "$([ -d "$SHM/old1" ] && echo yes || echo no)" eq "an old dir with a coordinate marker stays" yes "$([ -d "$SHM/oldc" ] && echo yes || echo no)" +eq "an old idle-said-only dir is gone (teammate-idle)" no "$([ -d "$SHM/oldi" ] && echo yes || echo no)" +eq "an old dir with idle-said and stop-said is gone" no "$([ -d "$SHM/oldb" ] && echo yes || echo no)" +eq "a fresh idle-said dir stays" yes "$([ -d "$SHM/newi" ] && echo yes || echo no)" echo echo "$PASS passed, $FAIL failed" diff --git a/tests/hooks-teammate-idle.test.sh b/tests/hooks-teammate-idle.test.sh index c1de09d..4188a74 100644 --- a/tests/hooks-teammate-idle.test.sh +++ b/tests/hooks-teammate-idle.test.sh @@ -42,6 +42,7 @@ MAIN="$TMP/main"; Y="$MAIN/.ytstack"; mkdir -p "$Y/milestones/M046" printf -- '---\nslice: S02\n---\n- [ ] T01 -- d\n- [ ] T02 -- e\n' > .ytstack/milestones/M046/M046-S02-PLAN.md printf -- '---\nmilestone: M040\nstatus: done\n---\n' > .ytstack/M040-ROADMAP.md printf -- '---\nslice: S01\n---\n- [ ] T01 -- left over\n' > .ytstack/M040-S01-PLAN.md + printf -- '---\nslice: S03\n---\n- [ ] T01 -- f\n' > .ytstack/milestones/M046/M046-S03-PLAN.md cat > .ytstack/LANES.md <<'EOF' --- updated: 2026-11-16T10:00:00Z @@ -83,11 +84,18 @@ idle lane-s02; eq "#98: a third idle -> silent" "" "$ERR" printf -- '---\nslice: S02\n---\n- [x] T01 -- d\n- [ ] T02 -- e\n' > "$Y/milestones/M046/M046-S02-PLAN.md" idle lane-s02; eq "progress, still open -> said again" 2 "$EC"; has "the new count" "$ERR" "1 task(s) still open" idle lane-s02; eq "and then once only" "" "$ERR" +printf -- '---\nslice: S02\n---\n- [ ] T01 -- d\n- [ ] T02 -- e\n' > "$Y/milestones/M046/M046-S02-PLAN.md" +idle lane-s02; eq "2 -> 1 -> 2: the count differs from the last said one -> said again" 2 "$EC" +idle lane-s02; eq "and once only again" "" "$ERR" idle lane-s02 s2; eq "another session -> said again" 2 "$EC" idle lane-t03; eq "held task still open -> exit 2" 2 "$EC"; has "task lane counts one" "$ERR" "1 task(s) still open in M046-S01-T03" echo "# team mode: no row, the ref in the teammate name" -idle impl-M046-S02 s3; eq "name names a held milestone's slice -> exit 2" 2 "$EC" +idle impl-M046-S03 s3; eq "name names an unclaimed slice of a held milestone -> exit 2" 2 "$EC"; has "its count" "$ERR" "1 task(s) still open in M046-S03" +idle impl-M046-S02 s3; eq "review: the named slice is held by another teammate -> silent" "" "$ERR" +idle impl-M046-S01 s3; eq "review: the named slice has a row (reported) -> silent" "" "$ERR" +idle impl-M046-S03-x s5; eq "a ref followed by a non-word character counts" 2 "$EC" +idle impl-M046-S031 s5; eq "review: M046-S031 is no ref to M046-S03 -> silent" "" "$ERR" idle impl-M034-S01 s3; eq "name outside the held lanes' milestones -> silent" "" "$ERR" mv "$Y/LANES.md" "$TMP/LANES.md" idle impl-M034-S01 s3; eq "no LANES.md: the named slice counts" 2 "$EC"; has "its count" "$ERR" "13 task(s) still open in M034-S01" @@ -98,6 +106,14 @@ mv "$TMP/LANES.md" "$Y/LANES.md" printf -- '---\nmilestone: M034\nstatus: in-progress\n---\n- [ ] S01\n' > "$Y/M034-ROADMAP.md" printf -- '---\nslice: S02\n---\n- [ ] T01 -- d\n- [ ] T02 -- e\n' > "$Y/milestones/M046/M046-S02-PLAN.md" +echo "# a linked worktree reads the main checkout's LANES.md (its own copy is stale)" +git -C "$MAIN" worktree add -q --detach "$TMP/wt" HEAD >/dev/null 2>&1 || { echo FATAL worktree; exit 2; } +cp "$Y/LANES.md" "$TMP/LANES.keep" +printf '| M046-S03 | implement | running | lane-wt 2026-11-16T11:00Z | b6 | - | - | - | 0 | - |\n' >> "$Y/LANES.md" +CWD="$TMP/wt" idle lane-wt s6; eq "review: the claim in the main checkout counts" 2 "$EC"; has "its lane" "$ERR" "in M046-S03" +CWD="$TMP/wt" idle impl-M046-S03 s6; eq "review: and the row there silences another teammate" "" "$ERR" +cp "$TMP/LANES.keep" "$Y/LANES.md" + echo "# guards" printf '{"cwd":%s,"hook_event_name":"TeammateIdle","teammate_name":"lane-s02"}' "$(jstr "$MAIN")" \ | ( cd "$ELSEWHERE" && bash "$HOOK" >/dev/null 2>"$TMP/err" ); EC=$? From 41cf11f78f8b17d12df8abfc7689b15eef168a12 Mon Sep 17 00:00:00 2001 From: Alex Wegener Date: Mon, 16 Nov 2026 22:26:06 +0100 Subject: [PATCH 4/4] docs: spec verified_at for checks-and-evals and dependencies after yt_lanes_file Co-Authored-By: Claude Opus 5.5 --- .ytstack/spec/checks-and-evals.md | 2 +- .ytstack/spec/dependencies.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ytstack/spec/checks-and-evals.md b/.ytstack/spec/checks-and-evals.md index 27ed140..98a3126 100644 --- a/.ytstack/spec/checks-and-evals.md +++ b/.ytstack/spec/checks-and-evals.md @@ -32,7 +32,7 @@ sources: - docs/ux/signal-format.md - docs/ux/external-plans.md - docs/ux/upstream-feedback.md -verified_at: 3f09ae1 +verified_at: e04ddc8 --- # checks-and-evals diff --git a/.ytstack/spec/dependencies.md b/.ytstack/spec/dependencies.md index 25b04f1..7788cff 100644 --- a/.ytstack/spec/dependencies.md +++ b/.ytstack/spec/dependencies.md @@ -7,7 +7,7 @@ paths: - NOTICE - hooks/lib/git-ctx.sh - bin/ytstack-gstack-diff -verified_at: f7c0e3c +verified_at: e04ddc8 --- # dependencies