feat(brief): render the nightly cross-repo briefing without a model
The operator has more repos than they can hold in their head, and the question that actually costs them is "who is waiting on me, and what does answering cost". board.sh already scans for it; nothing rendered it in a form an unattended job could leave behind. --brief is a second RENDERING of that scan, never a second scan. It prints NESTE uncut, because the 38-character cut is the table column's property and not the record's - the value used to be truncated at record-build time, which left the cut string as the only copy. Each startup command is derived by CALLING route.sh with that repo's own four traits; next-cost alone cannot produce it, since the advisor flag is a property of the ROW and two rows can share a model/effort pair while differing on it. A repo with no route line is told so rather than handed a guess. It cross-checks itself against coord-count.sh, and that is the substance of the change rather than a nicety. The repo scan and the mailbox are two different populations: a mailbox can carry a name no scan will ever produce - a declared non-git surface (CLAUDE_COORD_REPO, e.g. ~/repos) or a checkout outside the roots. Measured on the real mailbox: 11 repos / 21 messages in the briefing against coord-count's 12 / 22, the missing one being the declared surface `repos`. A briefing that only walked the scan would answer "who is waiting on you" with a number it quietly knew was short. Zero model calls, which was the deciding property. Measured against 2.1.220 under subscription auth: --max-budget-usd DOES bite (terminal_reason budget_exhausted, exit 1), but it aborts AFTER turn one - floor ~0.25 USD-equivalent per turn on claude-opus-5[1m]. It is a runaway brake, not a pre-flight gate, so a nightly claude -p job would draw on the same quota pool as interactive work every night. Determinism removes the question. board.sh stays read-only: the file write lives in brief-nightly.sh, which renders to a temp file and renames it into place, and treats an EMPTY render as a FAILED one - board prints nothing when its scan roots do not exist, which is what a mistyped path or a moved home looks like, and a plain `> file` redirect would destroy yesterday's briefing on a bad launchd environment. The launchd template carries placeholders, not absolute paths: this repo is mirrored publicly and a plist is the one file here that would need a home directory in it. It points at a checkout rather than the plugin cache, which is version-pinned and would break silently on the next bump. board-selftest 36 -> 49. One check pins a defect caught only by eye against the real tree: fold copies its input's missing trailing newline, which ran the command onto the tail of the NESTE prose and produced a briefing whose commands could not be copied. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017orCFDkmp88fLnqDR3chdJ
This commit is contained in:
parent
459c9feec0
commit
9dd24c3446
11 changed files with 435 additions and 18 deletions
|
|
@ -183,6 +183,22 @@ mkdir -p "$CLAUDE_COORD_DIR/repo-a/inbox" "$CLAUDE_COORD_DIR/repo-a/archive"
|
|||
for n in 1 2 3; do echo "msg" > "$CLAUDE_COORD_DIR/repo-a/inbox/2026-msg$n-from-x.md"; done
|
||||
echo "old" > "$CLAUDE_COORD_DIR/repo-a/archive/2026-old-from-x.md"
|
||||
|
||||
# repo-owes: unhandled inbox AND a route line, so the briefing can derive the
|
||||
# EXACT startup command - advisor flag included - from the repo's own four
|
||||
# traits instead of guessing from next-cost alone. Its NESTE runs deliberately
|
||||
# past the table's 38-character column: carrying that line whole is the reason
|
||||
# the briefing exists at all.
|
||||
mkrepo "$ROOT/repo-owes"
|
||||
{
|
||||
echo "# STATE - repo-owes"
|
||||
printf '## %s NESTE %s START HER\n' "$HAND" "$EMDASH"
|
||||
echo "<!-- board: status=in-progress; blocked-on=-; next-cost=Sonnet 5/high -->"
|
||||
echo "<!-- route: path=known; verification=strong; reversibility=cheap; scope=local; rationale=x -->"
|
||||
echo "Svar org-ops om badge-formatet, deretter bump katalogens ref og verifiser check-versions."
|
||||
} > "$ROOT/repo-owes/STATE.md"
|
||||
mkdir -p "$CLAUDE_COORD_DIR/repo-owes/inbox"
|
||||
echo "msg" > "$CLAUDE_COORD_DIR/repo-owes/inbox/2026-msg1-from-y.md"
|
||||
|
||||
OUT="$("$BOARD" --roots "$ROOT" 2>/dev/null)"
|
||||
|
||||
# --- 1. Discovery ---------------------------------------------------------
|
||||
|
|
@ -296,6 +312,96 @@ n_stale="$(printf '%s\n' "$OUT" | grep -n '^repo-stale ' | cut -d: -f1)"
|
|||
[ -n "$n_old" ] && [ -n "$n_stale" ] && [ "$n_old" -lt "$n_stale" ]
|
||||
check "SISTE is evidence, not a ranking input (order still follows ALDER)" $?
|
||||
|
||||
# --- 8. Briefing rendering (--brief) --------------------------------------
|
||||
# A second rendering of the SAME scan, never a second scan: the briefing
|
||||
# answers "who is waiting on me and what does answering cost", where the table
|
||||
# answers "what is the state of every repo".
|
||||
BRIEF="$("$BOARD" --roots "$ROOT" --brief 2>/dev/null)"
|
||||
|
||||
printf '%s' "$BRIEF" | grep -q 'repo-owes'
|
||||
check "brief includes a repo with an unhandled inbox" $?
|
||||
|
||||
printf '%s' "$BRIEF" | grep -q 'repo-b'; [ $? -ne 0 ]
|
||||
check "brief excludes a repo that owes nothing" $?
|
||||
|
||||
# The table cuts NESTE at 38 characters. The briefing carries the whole line,
|
||||
# so the tail past the cut is the thing being proved here.
|
||||
printf '%s' "$BRIEF" | grep -q 'check-versions'
|
||||
check "brief prints the full NESTE line, not the 38-char table excerpt" $?
|
||||
|
||||
# Derived by CALLING route.sh with the repo's own four traits - deliberately
|
||||
# not spelled out in board.sh - so the rubric keeps exactly one copy. Row 1
|
||||
# carries the advisor, which is what makes the quota fallback safe to take.
|
||||
printf '%s' "$BRIEF" | grep -q 'claude --model sonnet --effort high --advisor opus'
|
||||
check "brief derives the exact startup command from the repo's route line" $?
|
||||
|
||||
# The command must start its OWN line. `fold` copies its input's missing
|
||||
# trailing newline, which ran the command onto the tail of the NESTE prose and
|
||||
# produced a briefing whose commands could not be copied - caught by eye
|
||||
# against the real tree, which is exactly what a check is for.
|
||||
printf '%s' "$BRIEF" | grep -qE '^ \$ claude --model'
|
||||
check "startup command starts on its own line, not appended to NESTE prose" $?
|
||||
|
||||
# repo-a owes 3 messages and has no route line. A fabricated command would be
|
||||
# worse than none: it would read as authoritative while being a guess.
|
||||
printf '%s' "$BRIEF" | grep -A4 'repo-a' | grep -qi 'route'
|
||||
check "repo owing mail but lacking a route line is marked, never guessed at" $?
|
||||
|
||||
# Read-only by construction, and the briefing must not erode it. Reading IS
|
||||
# delivering in this engine, so a survey that consumed a backlog would be
|
||||
# precisely the defect the whole design forbids.
|
||||
snap() { find "$1" -type f -exec stat -f '%N %m %z' {} \; 2>/dev/null | sort; }
|
||||
b4="$(snap "$CLAUDE_COORD_DIR")"
|
||||
"$BOARD" --roots "$ROOT" --brief >/dev/null 2>&1
|
||||
[ "$b4" = "$(snap "$CLAUDE_COORD_DIR")" ]
|
||||
check "brief writes nothing to the mailbox (reading is delivering)" $?
|
||||
|
||||
# A mailbox can carry a name the repo scan will NEVER produce: a declared
|
||||
# non-git surface (CLAUDE_COORD_REPO, e.g. ~/repos itself) or a checkout
|
||||
# outside the scan roots. board.sh discovers git repos, so such a mailbox is
|
||||
# invisible to every column it prints - and the briefing exists to answer "who
|
||||
# is waiting on you", where dropping one silently is the loss-wearing-the-
|
||||
# shape-of-normal class this engine keeps naming. Measured against the real
|
||||
# mailbox before this check existed: 11 repos / 21 messages in the briefing
|
||||
# against 12 mailboxes / 22 pending in coord-count.
|
||||
mkdir -p "$CLAUDE_COORD_DIR/orphan-surface/inbox"
|
||||
echo "msg" > "$CLAUDE_COORD_DIR/orphan-surface/inbox/2026-msg1-from-z.md"
|
||||
BRIEF2="$("$BOARD" --roots "$ROOT" --brief 2>/dev/null)"
|
||||
|
||||
printf '%s' "$BRIEF2" | grep -q 'orphan-surface'
|
||||
check "brief surfaces a pending mailbox that has no repo in the scan tree" $?
|
||||
|
||||
# It must be reported as its own class, not silently folded in among repos the
|
||||
# scan actually found - there is no STATE.md behind it and so no next step.
|
||||
printf '%s' "$BRIEF2" | grep -qi 'utenfor repo-skannen\|uten repo'
|
||||
check "orphan mailbox is reported as its own class, not as a scanned repo" $?
|
||||
|
||||
# --- 9. brief-nightly.sh: the only writer, and it writes atomically -------
|
||||
# board.sh stays read-only, so the file write lives in a separate wrapper.
|
||||
# Unattended overwrite must never expose a half-written briefing: the wrapper
|
||||
# renders to a temp file in the same directory and renames it into place.
|
||||
NIGHTLY="$DIR/brief-nightly.sh"
|
||||
OUTFILE="$ROOT/briefing.md"
|
||||
CLAUDE_BRIEF_FILE="$OUTFILE" BOARD_ROOTS="$ROOT" bash "$NIGHTLY" >/dev/null 2>&1
|
||||
check "brief-nightly exits 0" $?
|
||||
|
||||
[ -f "$OUTFILE" ] && grep -q 'repo-owes' "$OUTFILE"
|
||||
check "brief-nightly writes the briefing to CLAUDE_BRIEF_FILE" $?
|
||||
|
||||
ls "$OUTFILE".tmp.* >/dev/null 2>&1; [ $? -ne 0 ]
|
||||
check "brief-nightly leaves no temp file behind" $?
|
||||
|
||||
# An EMPTY render is a failed render, and must leave the previous briefing
|
||||
# standing rather than truncating it to nothing - the failure mode a plain
|
||||
# `> file` redirect has, and the reason the temp-then-rename exists. A repo
|
||||
# tree where nobody owes anything is NOT this case: that renders a valid,
|
||||
# non-empty briefing saying so, and is written normally.
|
||||
echo "FORRIGE BRIEFING" > "$OUTFILE"
|
||||
CLAUDE_BRIEF_FILE="$OUTFILE" BOARD_ROOTS="$ROOT/does-not-exist" \
|
||||
bash "$NIGHTLY" >/dev/null 2>&1
|
||||
grep -q 'FORRIGE BRIEFING' "$OUTFILE"
|
||||
check "empty render never overwrites the previous briefing" $?
|
||||
|
||||
echo ""
|
||||
echo "board-selftest: $PASS passed, $FAIL failed"
|
||||
[ "$FAIL" -eq 0 ] || exit 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue