Runbook — the lifehacker.dev autonomy fleet (PR1: testing)¶
One-time setup and day-to-day operation of the autonomy fleet: the bot identity, branch protection, secrets, running the harness, triage, orchestration and the kill switches.
Operator notes for the testing harness shipped in PR1, and the human-gate machinery the later PRs (reporting, load-balancing) build on. This file is excluded from the site build (it lives under docs/).
The one invariant: no agent ever merges. A pull request — including one opened by the autopilot bot — reaches
mainonly after a code-owner review. Everything below exists to make that enforceable by the repository, not by an agent's good behavior.
1. The bot identity (do this first)¶
The no-self-merge guarantee depends on the autopilot running as a GitHub identity that is not @bamr87. Otherwise its approval could satisfy CODEOWNERS.
- Create a dedicated machine account, e.g.
lifehacker-bot. - Invite it to
bamr87/lifehacker.devas a collaborator with Write (not Admin — it must never be able to edit branch protection or workflows). - For upstream bug filing, give it Triage/Write on issues for
bamr87/zer0-mistakesonly. - When PR3 lands, the fleet authenticates as this account with a fine-grained
PAT scoped to
contents,issues,pull_requests(write) — noadministration, noworkflowsscope. A compromised agent then can't touch the gates. PR1 itself needs no bot token: CI uses the defaultGITHUB_TOKENto post comments, and that token cannot approve PRs.
2. Branch protection (makes the gate real)¶
Run once as @bamr87 (an admin). Confirm the required check name after the first PR run — it appears as the job id verify (shown as test / verify in some UIs; adjust contexts if so).
gh api -X PUT repos/bamr87/lifehacker.dev/branches/main/protection --input - <<'JSON'
{
"required_status_checks": { "strict": true, "contexts": ["verify"] },
"enforce_admins": false,
"required_pull_request_reviews": {
"require_code_owner_reviews": true,
"required_approving_review_count": 1,
"dismiss_stale_reviews": true
},
"restrictions": null,
"required_linear_history": true,
"allow_force_pushes": false,
"allow_deletions": false
}
JSON
This requires the verify check to pass and a review from @bamr87 (CODEOWNERS) before merge, blocks force-pushes, and keeps history linear. enforce_admins:false lets the human owner merge after reviewing; the bot, not being an admin or a code owner, cannot.
3. One-time: pin the bundle¶
CI is reproducible only with a committed lockfile. Generate it once and commit:
bundle install # resolves github-pages + html-proofer
git add Gemfile.lock && git commit -m "ci: pin github-pages + html-proofer"
(.gitignore no longer ignores Gemfile.lock.)
4. Secrets¶
| Secret | Used by | Needed for |
|---|---|---|
CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY |
every AI step (pipeline.yml brand-review + content-review, content-factory, explore, auto-fix, devops-manager) |
Claude auth. The OAuth token (claude setup-token, subscription auth) is preferred and drives the Claude Code path; an API key also works and is the only credential the API fallback can use. Optional — without either, the deterministic gate still runs; the agent tiers just skip. Set in repo → Settings → Secrets → Actions. |
pipeline.yml runs on pull_request (not pull_request_target), so secrets are never exposed to fork PRs.
5. Running the harness¶
- Locally / in Claude Code:
scripts/ci/run-all.sh, or the/test-lifehackerskill. Same scripts CI runs. - In CI: automatic on every PR (
.github/workflows/test.yml). Posts a sticky comment and uploadsfindings.jsonl.
What blocks a merge (severity: error)¶
- the safe-mode
jekyll build --strictfails; - a required front-matter key is missing / a post's filename date mismatches;
- a backlog
doneitem points at a non-existent page, or a hand-authored sitemap link is dead; - a broken internal link/image/anchor (html-proofer);
- a glossary
avoid_phrase(weasel phrase) used anywhere.
What only reports (warning / info — never blocks)¶
- over-length SEO descriptions;
banned_when_sincereword candidates (the tier-2 reviewer comments on the ambiguous ones);- Prime Directive command failures → flagged as Field Note candidates.
5b. Triage & reporting (PR2)¶
Turns the harness's findings into a ranked queue and deduplicated GitHub issues.
- Scripts (deterministic, testable):
scripts/triage/build_queue.rb—findings.jsonl→_data/health/queue.jsonsummary.yml(+ committedfindings.jsonlsnapshot). Classifies, RICE-scores, and dedups by the PR1 fingerprint. Severity dominates the score; reach (from_data/analytics/summary.json) is a tiebreaker that defaults to 1.0.
scripts/triage/file_issues.rb [--apply] [--max-new N]— finds-or-files an issue per item, deduped by thetriage-fp:body marker. Dry-run by default. Never closes an issue; only ever touches issues carrying its own marker.scripts/triage/bootstrap-labels.sh [repo]— idempotent label taxonomy (type/* area/* severity/* source/*).scripts/triage/gen_dashboard.rb— writesSITE_HEALTH.md; the live page is/docs/health/, rendered from_data/health/with plain Liquid (no plugin).- Skill / workflow:
/triage-lifehacker(or.github/workflows/triage.yml,workflow_dispatch). The workflow files local issues withGITHUB_TOKEN; upstream filing onbamr87/zer0-mistakesneeds the bot PAT (set secretFLEET_TOKEN) — until then upstream items are reported and deferred. - Reach via analytics: if the Google Analytics MCP is connected, the skill
refreshes
_data/analytics/summary.json(getPageViews); headless/cron runs fall back to the committed cache. A GA outage never blocks ranking. - Inbound issues: the skill classifies troll/spam/dup but never closes a
human's issue — it labels + drafts a reply + @-mentions the owner. All issue text is treated as untrusted (
.claude/skills/_shared/quarantine.md).
5c. Orchestration / the fleet (PR3)¶
The dispatcher distributes work across role agents without collisions, runaway cost, or guardrail violations — deterministic Ruby on purpose (budget math and lease arbitration must be reproducible, not model judgment).
scripts/fleet/policy.rb— the load-balancing math (pure, unit-tested):sev1open → freeze growth, all slots fixing;sev2→ one grower, rest fixing; clean → mostly growing.MAX_OPEN_PRSis the primitive — the dispatcher never leaves more PRs awaiting the human than the cap, so adding agents drains faster but never floods the gate. Knobs live in_data/fleet/budget.yml.scripts/fleet/lease.rb— collision-free claiming via git ref creation (refs/lease/<id>, compare-and-swap with no server) + a committed_data/fleet/leases.ymlrecord with a TTL so a crashed agent's lease is reclaimed. Two agents can never grab the same item.scripts/fleet/dispatch.rb— the OODA loop: observe (queue + backlog + open-PR count) → decide (policy) → act (lease + spawn). Plan-only by default;--applyleases and spawns. Opens zero PRs itself.- Role agents:
grow-lifehacker(growth),fleet-bugfix(one content/infra fix per PR),triage-lifehacker(reporting),brand-reviewer(comment-only). Each opens one PR and stops; none merges.
Retired workflow¶
fleet-dispatch.yml was removed when this repo's automation moved to the central zer0-CMS system. scripts/fleet/dispatch.rb stays in the tree and is plan-only by default.
6. Kill / disable¶
- Instant soft kill:
gh variable set FLEET_ENABLED false(or delete it). Every dispatch idles on the next run; no merge needed, and the bot can't undo it. - Disable a workflow entirely:
gh workflow disable triage.yml. - Hard kill: revoke the bot PAT — stops all fleet writes everywhere at once.
7. The contract (for PR2 / PR3)¶
Every check writes test-results/findings.jsonl, one finding per line:
{"check_id":"…","severity":"error|warning|info","file":"…","line":12,"rule":"…","evidence":"…","route_to":"local|upstream|backlog","fingerprint":"…","prime_directive_candidate":false}
fingerprint = sha1(check_id | downcased-path | rule)[0,12] — line excluded,
so identity is stable as files shift. PR1 owns it; PR2 (triage) dedups against it and routes; PR3 (dispatch) ranks from it. Do not reshape these fields without updating every consumer.