factory: level 0 — the night shift merges tier-1 PRs under a lease - #491
Merged
Conversation
Three scripts and a skill: factory-lease (the standing merge grant, machine- local), factory-tier (tier 1 decided by a reviewed path filter, never by model judgement), factory-shift (one deterministic pass: budget line, merge, lock ripple, CI-RED sensing), and /nightshift (the foreman loop that spawns capped fixer lanes and throttles against the aiusage feed's pace line). The failure mode of all of it is the status quo: no lease, and every PR waits at 'PR open' exactly as before. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016WZg7vtYTqsXrVixrSSY3G
Renames refused outright (a rename is a delete wearing a docs name, and GraphQL's files list never says so), the file list read paginated from REST and cross-checked against changedFiles, merges pinned to the vetted head SHA (--match-head-commit fails closed on a race), the steering-file deny tests case-insensitive because APFS is, content/ out of tier 1 (hausfold.co main deploys the public site — a publish stays gated), the fixer spawn rerouted through the handoff skill's background-lane path, the budget line guarded against a reordered usage feed, red runs widened to timed_out and startup_failure, and /nightshift added to CLAUDE.md's skills row. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016WZg7vtYTqsXrVixrSSY3G
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The factory, level 0 — a night shift that merges tier-1 (docs-only) PRs across the org while a user-granted lease is live, watches main CI, and reports every act to a shift log. Three scripts + one skill, no daemon, no webhook, no new repo:
script/factory-lease— the standing merge grant (grant 12h/status/revoke), one TSV line under~/.cache/hausfold-factory/, machine-local so no PR can grant itself authority.script/factory-tier— tier 1 decided by a reviewed path filter, never by model judgement:*.md/docs/only, no renames, no agent-steering files (any case), owner-authoredworktree-*→main, green, ≤2000 lines, file list read paginated.script/factory-shift— one deterministic pass: budget line from the aiusage feed, tier check on every open org PR, head-SHA-pinnedgh pr merge --squashunder a live lease,bench pull+bench shipripple,CI-REDsensing (+ trill cards,--source factory).--dry-runsenses only./nightshift— the foreman: loops the shift, spawns capped fixer lanes onCI-RED(through the handoff skill, background lanes), throttles against the token pace line, hands over a shift report at lease end.Docs:
docs/factory.md; AGENTS.md gains the night-shift routing row and the lease exception to "merging waits for the user".Why
The org lands ~100 PRs a week and every one waits for a human merge. The user approved tier-1 auto-merge under a lease; this is the narrowest implementation that fails closed — no lease (expired, revoked, or never granted) is exactly today's workflow.
Verify
./script/factory-lease grant 90m && ./script/factory-lease status && ./script/factory-lease revoke./script/factory-shift --dry-run— senses the real org, merges nothing.tier: 1 … head=<sha>); refuse paths proven on real merged PRs (docs: step 9 — haus draws through snug; and bench never reaped its coprocess #485 AGENTS.md, docs: state the layout, not how it got that way #487 SKILL.md, haus#562 workflows) and on test: factory tier proof (will be closed) #490's rename commit.Watch out
factory-tier's filter is the whole definition of tier 1. Widening it (e.g. re-admittingcontent/, which auto-publishes hausfold.co) is a reviewed edit to that script +docs/factory.md.usage-claude.tsv's column order (written by haus'sstatusline-refresh.sh); implausible percentages degrade it to "unreadable" rather than mis-throttling, but a same-order semantic change over there would not be caught.pmset -a disablesleep(lid-closed running) is documented indocs/factory.mdbut not yet a haus option — follow-up belongs in haus.🤖 Generated with Claude Code
https://claude.ai/code/session_016WZg7vtYTqsXrVixrSSY3G