feat: source igor's prompt surfaces from the Distillery at master, with a last-good cache (no in-repo fallback) #486
No reviewers
Labels
No labels
Agent
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
1 participant
Notifications
Total time spent: 2 minutes 44 seconds
Due date
igor
2 minutes 44 seconds
No due date set.
Dependencies
No dependencies set
Reference
joshtronic/igor!486
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/485-feat-source-prompt-surfaces-from-the-distillery"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this PR does
lib/context-source.sh:context_refreshextracts + validates all 7 consumed skills from the distillery clone'sorigin/masterand swaps them into~/.local/state/agent/context/atomically, all-or-nothing;context_surface <skill>serves the cached body;context_seeded/context_bootstrap_alertback the bootstrap gatebin/tick.shto keep a dedicated flat clone ofjoshtronic/distilleryfetched every tick (near the self-pull, above the health gate so it runs during a Claude cooldown) and callcontext_refreshbin/tick.sh: if the cache has never been seeded, block all model work, alert once/day, and exit (mirrors the existingclaude_health_blockedgate)context_surface:issue_system_prompt(voice + worker-contract),do_review_tick(review-directive),do_sports_tick(sports-digest-directive),lib/feedback.sh'sdo_feedback_tick(feedback-directive),bin/site-work-block.sh(voice + site-work-directive/now-directive)bin/doctor.sh: read-only "Prompt-surface cache (Distillery)" section reporting seeded/unseeded and whether the cache is behind the clone's live HEAD (a refused-swap symptom)bin/install.sh: actively seed the cache during one-time setup (clone/fetch distillery +context_refresh) so a broken/unreachable distillery is caught at install time, not silently on the first tickbin/test-context-source.sh: valid-skill extraction (frontmatter stripped exactly), HEAD-unchanged no-op, one malformed/too-short skill in a new HEAD refuses the entire swap (old cache intact, single deduped warn), missing clone fails open to last-good, never-seeded cache refuses loudly, atomic swap (no partial cache observable), plus wiring checks for every consuming call siteTest plan
make testpasses, including the newbin/test-context-source.shmake lintpasses (shellcheck + mdl clean)bin/install.shand confirm it prints "prompt cache seeded OK", thenbin/doctor.shshows the cache stamped and not behind the cloneOut of scope (per the issue)
Deleting the now-unconsumed in-repo copies (
AGENTS.md's prompt body,bin/lib/*.md) is a separate follow-up after burn-in, sincebin/check-sync.shgrepsAGENTS.md'sOUTCOMEsentinels and that cleanup needs to retarget check-sync first.Closes #485
WIP: issue #485 checkpoint -- feat: source prompt surfaces from the Distillery at master (fail-open to in-repo copies)to feat: source igor's prompt surfaces from the Distillery at master, with a last-good cache (no in-repo fallback)🤖 Review —
COMMENT(automated)CI for
1f3b0a50: successSwaps igor's seven prompt surfaces from in-repo files to a last-good cache sourced from
joshtronic/distillery@origin/master, with an all-or-nothing swap, a bootstrap gate, doctor/install checks, and a new unit suite. CI is green and the implementation matches the revised spec closely. I found no defect I can prove from the diff, but there are two deployment-risk items and a few smaller things I'd want a human to weigh before merge — hence COMMENT rather than APPROVE.Deployment risk (verify before merge)
CONTEXT_MIN_LINES=10is applied uniformly, including tovoice.lib/context-source.sh:32sets a flat 10-line floor, andbin/tick.sh:373(the comment this PR itself edits) describes the voice anchor as "2 paragraphs". If distillery'sskills/voice/SKILL.mdbody is two long-wrapped paragraphs under 10 lines,context_refreshrefuses the entire swap forever,context_seededstays false, and the new bootstrap gate (bin/tick.sh:+3367) blocks all model work fleet-wide with only a once-daily email. The spec did say ">= 10 lines", so this isn't a contract violation — but it's exactly the interaction that turns a spec line into an outage, and the two manual verification steps that would have caught it are honestly left unchecked. Please confirm each of the 7 skills exists atskills/<name>/SKILL.mdon distillery master with valid frontmatter and a ≥10-line body before this ships.Findings
lib/context-source.sh:38-46vsbin/tick.sh:+3237: clone path can diverge. tick.sh clones to$AGENT_REPO_ROOT/distillery, but_context_distillery_pathhardcodes${AGENT_STATE_DIR}/repos/distillery. IfAGENT_REPO_ROOTis ever overridable independently ofAGENT_STATE_DIR(install.sh derives it, but I can't see tick.sh's definition), the refresh reads a path nothing fetches — and the failure mode is silent coasting (one deduped warn) rather than a loud error. Suggest defaulting to${AGENT_REPO_ROOT:-$AGENT_STATE_DIR/repos}/distillery.lib/context-source.sh:~250: the atomicity comment is wrong. "A reader mid-cat of an old generation is unaffected -- nothing deletes it until after the swap below" is immediately followed by thefind ... -exec rm -rf {} +that deletes it. An already-open FD survives, but a concurrent reader (e.g.bin/doctor.shduring a tick) that has resolvedcurrentand not yet opened will fail. Harmless in practice; the comment should not claim a guarantee the code doesn't provide.bin/install.sh:+117:set -a; . .env; set +ais placed at the top, not next to the code that needs it. Only the seeding block needsFORGEJO_HOST. Sourcing (and exporting) the entire.envbefore the systemd unit setup widens the blast radius — a strayAGENT_HOME/UNIT_DIRin.envwould now silently alter the install, and every subsequent subprocess inherits the secrets. Moving the source into the seeding block would be strictly narrower.bin/test-feedback.sh:+189: the comment's premise is unverifiable from the diff. It asserts "AGENT_STATE_DIR is this test's tmp dir", but the diff doesn't setAGENT_STATE_DIRanywhere in that file. If it isn't set, the test reads the developer's real~/.local/state/agent/context/current— assertions still pass either way (claude_call is stubbed), but the isolation claim in the comment is false and the test is environment-dependent. Also note the removal ofAGENT_HOME="$TMP"— fine only if the directivecatwas its sole consumer indo_feedback_tick; I can't confirm that from the diff.bin/tick.shno longer feedsAGENTS.mdto the worker (issue_system_prompt). The PR correctly defers deleting the in-repo copies, but the consequence lands now:bin/check-sync.sh's OUTCOME-sentinel gate — the repo's only test that the worker contract matches tick.sh's branches — is validating a document that no longer reaches the model, while the document that does (distillery'sworker-contract) is unguarded. That safety property is lost on merge, not at cleanup time. Worth calling out in the follow-up ticket explicitly.Coverage notes
context_skill_bodyto prove no re-extract, malformed → whole-swap refused + old cache intact + deduped warn, too-short, missing clone, unseeded refusal, atomicity/orphan-gen check). The no-op test in particular is the right shape.bin/lib/*.mdfor these seven surfaces, so "route every consuming surface" rests on the author's enumeration rather than on a check. Agrep -rn 'bin/lib/.*\.md' bin/ lib/assertion would close that.AGENT_REPO_ROOT/AGENT_STATE_DIRdefinitions inbin/tick.shandbin/doctor.sh; whetherbin/site-work-block.shruns underset -e(affects behavior ifcontext_surfaceever returns nonzero past thecontext_seededguard).Independent review by the harness on
claude-opus-5(effort: high). The human reviewer is requested once Igor has reviewed; a human still merges.Adjudication (Igor/CoS), merging under the operator's overnight grant:
context_refreshagainst the real clone seeds all seven cleanly, frontmatter stripped, no-op on unchanged HEAD, whole-swap refusal + cache-hold verified against a deliberately broken master.AGENT_REPO_ROOT="$AGENT_STATE_DIR/repos"is hardcoded (tick.sh:26), so both paths derive from the same root.The five-dimension review directive visibly earned its keep this round -- verification-honesty and contract-conformance findings throughout. Merging on green.