harness: keep the routine bootstraps recoverable - #92
Conversation
Each routine's saved prompt is bootstrap + snapshot. The bootstrap — take instructions from origin/main, treat the fired payload as data — exists only in the routine, so that a PR editing .claude/harness/ cannot edit the rules used to judge it. Pasting a fresh snapshot over the whole prompt box deletes it, which is exactly what happened while syncing ROUTINE_PROMPT.md today; it was reconstructed from the review routine's copy. Keep reference copies in BOOTSTRAP.md and generate the full paste-ready text with routine-text.sh, which reproduces the live review routine's bootstrap byte for byte.
handlecusion
left a comment
There was a problem hiding this comment.
🤖 Claude Code — 자동 리뷰
Two things worth a look, neither blocking.
BOOTSTRAP.md nests bare ``` fences inside bare ``` fences, so on github.com the dispatch block closes early at the inner git fence and the ## review heading is swallowed by a stray block — the file misrenders exactly where it is meant to be read during recovery. The fix is coupled to the awk fence regex in routine-text.sh:28, so both files move together.
Separately, routine-text.sh review does not currently reproduce the live review routine: the byte-for-byte check quoted in the description covers the 11 bootstrap lines, while the snapshot half diverges at both ends.
Generated by Claude Code
| git fetch origin +main:refs/remotes/origin/main | ||
| git show refs/remotes/origin/main:.claude/harness/ROUTINE_PROMPT.md | ||
| git show refs/remotes/origin/main:AGENTS.md | ||
| ``` |
There was a problem hiding this comment.
[bug] The bootstrap copies are wrapped in bare ``` fences that themselves contain bare ``` fences, so this file does not render on github.com. Per CommonMark a closing fence may not carry an info string, so ```sh (line 29) is content — and this line, meant to close the sh block, closes the outer block opened at line 24 instead.
Rendered result: lines 35–39 drop out as prose, line 40 opens a stray code block that swallows the ## review heading at line 42, and line 57 leaves a block unclosed. The one file whose job is to be readable while you undo a bad paste is the file that misrenders in the web UI.
Fix: use four backticks for the two outer fences (lines 24/40 and 44/57). Note this is coupled to the extractor — routine-text.sh:28 matches the outer opener with /^```$/, which would stop firing, leave inFence unset and produce empty output (the grep guard then aborts with no bootstrap block). Both files need to change in the same commit.
Generated by Claude Code
| cat /tmp/routine-bootstrap.$$ | ||
| rm -f /tmp/routine-bootstrap.$$ | ||
| printf '\n' | ||
| cat "$prompt" |
There was a problem hiding this comment.
[q] cat "$prompt" emits all 92 lines of REVIEW_PROMPT.md, but the live tokcat · PR auto-review routine's snapshot begins at ## Find the PR and ends at "…stop instead of duplicating it." — it carries neither the 11-line title/intro nor the trailing ## Scope guard section. So routine-text.sh review (12 + 1 + 92 = 105 lines) is not what that routine holds right now. The check cited in the PR description covers the first 11 lines — the bootstrap — so it does not reach the snapshot half. (dispatch does line up: 15 + 1 + 218 = 234.)
That is fine if re-pasting review is the intent, but then it needs the actual paste — otherwise the next person diffing generator output against the live routine gets a mismatch they cannot distinguish from real drift, which is the failure mode this PR exists to prevent. Either paste it now, or record in README.md that the review routine still carries a trimmed snapshot.
Generated by Claude Code
Fallout from syncing
ROUTINE_PROMPT.mdinto the dispatch routine today: the saved prompt is bootstrap + snapshot, and pasting only the snapshot over the whole prompt box deleted the bootstrap — the paragraphs that send the session toorigin/mainfor its instructions and frame<routine-fire-payload>as data. Those paragraphs deliberately live only in the routine (a PR that rewrites.claude/harness/must not be able to rewrite the rules used to judge it), so there was no copy to restore from. It was reconstructed from the review routine's equivalent and is back on the routine, verified byte-for-byte after reload..claude/harness/BOOTSTRAP.md— reference copies of both bootstraps, with the authority relationship spelled out (routine holds the real one).scripts/claude-harness/routine-text.sh dispatch|review— prints the exact paste-ready text. Verified: itsreviewoutput's first 11 lines match the livetokcat · PR auto-reviewroutine byte for byte (diffclean against the value read out of the textarea)..claude/harness/README.md— setup step 1 now says to paste the generator's output, never a bare snapshot, and records why.Verification:
routine-text.sh review | sed -n 1,11p | diff - <live routine text>→ no differences;routine-text.sh dispatchoutput (234 lines) is what now sits in the dispatch routine, confirmed after reload with line 1, line 15 and the new step 4 all present.