Skip to content

Decisions (ADR-lite)

The append-only log of every architecture and process decision (ADR-001…043) — what was decided, why, and the alternatives rejected.

Append entries; never rewrite history. Format: date, decision, why, alternatives.

2026-11-15 — ADR-043: Compiled agent lines are OAuth only for now; the ANTHROPIC_API_KEY fallback is disabled

On 2026-11-15 the maintainer switched Claude auth to OAuth only for the time being: the ANTHROPIC_API_KEY secret is being rejected (dead or out of credit). PR #177 removed the key from the hand-written workflows and patched the compiled factory--*.yml lines, but compile() still emitted the fallback, so any recompile (Deploy, compile-blueprint.ts, gen-docs-gardener.ts, gen-issue-factory.ts, gen-aosdlc-factory.ts) would have put it back. The compiler now emits only claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} (no anthropic_api_key input), and an agent line's gate.enablement job reads only CLAUDE_CODE_OAUTH_TOKEN (no KEY). This suspends the fallback half of ADR-012; the OAuth default stands. The Fleet Ops audit rule auth-oauth-first keeps its id but now publishes the OAuth-only standard and no longer tells anyone to keep the key; it still fires only on key-only workflows. Re-verified against claude-code-action@v1 action.yml (6a5ea47): both auth inputs stay optional, so the OAuth token alone is valid. No secret was changed. Not changed here: the app's power LED and Deploy modal still accept ANTHROPIC_API_KEY, and harness/lanes.ts still lists it in a lane's uses_tokens. To restore: revert this change, or re-add the ADR-012 expression at the agent step and KEY in the gate (both spots are commented in compile.ts), flip the auth tests and regenerate. Alt: keep emitting the empty-when-OAuth-is-set fallback (rejected — the maintainer asked for no key use, and the next recompile would silently undo the patched lines); a per-blueprint auth option (deferred — not needed while the key is dead).

2026-10-27 — ADR-042: Dispatch payloads are checked at the receiver — only the number crosses, and the sender says who it is

ADR-005 and ADR-029 kept the payload's free text out of prompts, but the one value that did cross, client_payload.number, reached the prompt unvalidated (PAYLOAD_NUMBER: ${{ github.event.client_payload.number }} interpolated whatever a sender put there), and nothing in the payload said which repo sent it — "only the number crosses" was prompt prose, not a check. Surfaced by the outbox platform e2e proof (2026-10-27), which drives scout → drafter lines across repos on exactly this belt. Decision: the receiver checks the payload before it does anything. Every line with a trigger.repository_dispatch now starts with a 🛂 dispatch.payload step (id: payload, run only on repository_dispatch events) that fails the run closed unless client_payload.number is a positive integer of at most ten digits or absent (an entity-less signal stays legal), and client_payload.source is a well-formed owner/name or absent. A new optional trigger field, sourceRepo, names the accepted sender: when every dispatch trigger on the line names one, the source must be present and one of them. Payload values reach the script only through env: (never ${{ }} inside run:), and the prompt reads the validated copies from steps.payload.outputs, so nothing but a checked number and a checked slug can enter it. The sending half stamps itself: sink.repository_dispatch sends client_payload[source]=${{ github.repository }} in both the deterministic step and the agent obligation. The check runs before the rate limiter and checkout, so a bad payload costs no agent turn, and deterministic sinks that read client_payload.number through the NUMBER chain sit behind it too. Verified beyond the YAML-text tests by executing the emitted script under Ubuntu bash against hostile payloads (0, -3, 4.5, 12; rm -rf /, a newline smuggling number=999 into GITHUB_OUTPUT, a JSON object, eleven digits, evil repo, o/*, an unlisted sender), each failing, and good payloads passing — the ADR-041 lesson that a generated safety step is untested until it executes. Alternatives: validate in the prompt (rejected — that is the prose this replaces); require sourceRepo on every dispatch trigger (rejected for now — it would break every existing receiver whose sender predates the stamp; an unset field stays permissive and is documented as such); a GitHub-side sender check (not available — repository_dispatch carries no sender repo, only the token's actor). ADR-040 and ADR-041 are taken by feature/land-issue-batcher, which was prepared alongside this change.

2026-10-27 — ADR-041: rate.limiter and fixer-budget fixes from the first live Issue Factory run (lifehacker.dev)

Ported to main on 2026-10-27 from feat/frontend-refactor (b233ec0), where this was recorded on 2026-07-06 as ADR-021. It settles BL-20261003-03: main still emitted -ge and no GH_REPO. Deploying ADR-040 live surfaced two compiler bugs in rate.limiter (both fixed + regression-tested) and one template sizing error: (1) Off-by-one: gh run list includes the currently executing run, so the N-th run of the day sees COUNT=N and -ge LIMIT stopped run N — maxPerDay: 2 permitted only ONE working run. Guard is now -gt (exactly maxPerDay working runs). Decision kept alongside: the count stays STRICT (failed runs count toward the cap) — excluding failures would weaken runaway-loop insurance for lines that fail after writing. (2) Missing repo context: the limiter step deliberately runs BEFORE actions/checkout (fail fast, before any cost), where gh has no git directory and dies with failed to determine base repo (live failure, run 28769878311). The step env now carries GH_REPO: ${{ github.repository }} like the deterministic sink steps always did. Both fixes regenerated into the dogfooded factory--docs-gardener.yml (which had the same latent failure and would have died on its next scheduled run) and the issue-factory example; shipped to lifehacker.dev as PR #162. (3) Fixer turn budget: the first fixer run died at error_max_turns(40) mid-work-order with nothing shipped — a batch fix is read work order + N members + edit files + run checks + PR + N member comments, and 40 was a guess, not a measurement. Template now sets 100 and the fixer prompt gains turn discipline (ship completed members with accurate Closes lines rather than nothing) — lifehacker.dev PR #174. Lesson recorded: a generated safety step that has never executed on a real runner is untested by definition — the invariant tests asserted the YAML text, not the runtime contract (gh needing repo context outside a checkout, an agent needing enough turns to finish its contract). The live batcher run itself was flawless: 11 work orders from 41 surveyed issues, including accept-ledger batches it inferred from the repo's own lint conventions, and one correct factory:needs-human route (an admin-only task).

Drain session follow-up (same day): driving the full queue surfaced a fourth lesson — an external one. After three work orders drained cleanly (WO #163→PR #175, WO #164→PR #177 filed autonomously by the 08:34 scheduled cron, WO #165→PR #194; 12 member issues closed), the fixer began failing every run at claude-code-action's Exchanging OIDC token for app token step (Failed to parse JSON, 3 internal retries) — a sustained ~25-min outage of the Claude GitHub App token-exchange service, upstream of the factory and unrelated to our code/prompt/quota. Decisions: (1) do NOT engineer around it by switching the compiled auth from the OIDC/app-token path to a PAT/github_token — that is a security-model change (golden rules #4/#7) not warranted by a transient outage; (2) do NOT hammer retries — each failed run still counts against the rate.limiter day budget (gh run list | length counts failures), so spamming a down service burns the very budget the real work needs; (3) the factory is armed and autonomous, so the daily crons resume the drain when the service recovers (limits reset at UTC midnight) — the 08:34 cron already proved unattended draining works. Operational rule recorded: when a live agent line fails, first classify infra-vs-ours (read the failing STEP, not just the conclusion) before changing anything; a sustained upstream outage is a wait, not a fix. Temporary drain-mode rate limits (6/15) were restored to the designed ⅔ afterward.

2026-10-27 — ADR-040: Issue processing — the batcher/fixer pipeline; the queue is GitHub itself

Ported to main on 2026-10-27 from feat/frontend-refactor (b233ec0), where this was decided on 2026-07-05 as ADR-020 — a number main has since given to Fleet Ops. Landed because lifehacker.dev's committed .factory/issue-factory.blueprint.json did not compile on main (Unknown machine type "processor.issue_batcher"). Shipped the issue-processing capability as two cooperating assembly lines (the Issue Factory template, worked example targeting bamr87/lifehacker.dev in examples/issue-factory/): a new processor.issue_batcher (specialised agent, built-in SURVEY → ASSESS → GROUP → FILE WORK ORDERS → MARK contract) reviews every open issue, groups related ones (≤ maxGroupSize, confirmed against the checked-out code) into work-order issues labeled factory:work-order, and marks members factory:queued; an hour later a plain agent.claude fix line picks the oldest work order and ships ONE PR whose body carries Closes #N per member. Three shape decisions: (1) The queue is GitHub issues, not a file. A .factory/workorders.yml queue (like the CMS backlog) would need contents: write on main for bookkeeping and hide state from the tracker; work-order issues are human-visible, human-editable, and deletable — and "GitHub is the database" (ADR-001). (2) Sorter/fixer separation is compiler-enforced: the batcher gets no file-edit/git/PR verbs, the fixer never gets gh pr merge — a human merge is the only landing path (extends the ADR-015/017 no-self-merge invariant). (3) Two lines, one kill switch (ISSUE_FACTORY_ENABLED on both gates) since arming intake without the fixer (or vice versa) is never useful. Also: survey-mode agents now get Bash(gh issue view:*) (they must READ the issues they discover — previously only list/search). Fan-out (one job per work order via a computed matrix) stays parked with the OODA dispatcher; the fix line drains the queue one order/run, rate-limited at 3/day. Alt considered: a single do-everything agent (rejected: one line can't separate the triage grants from the code-write grants — least privilege dies).

2026-10-03 — ADR-039: Agents never merge — the compiler refuses an agent merge obligation or grant

A review of .factory/blueprint.json at 6f81800 found Factory 3 (the Dependency Warden) still wired agent → sink.merge_pr, so the compiled line handed the agent Bash(gh pr merge:*) plus a merge obligation restrained only by prompt prose — on a main with no branch protection, where --auto has no required checks to wait for. That is exactly the ADR-015 incident shape (a grant and a prose guardrail disagree; a plausible agent reason wins), and the compiler explicitly allowed it ("an agent-obligated merge is fine on any line"). The house rule (here and on the bamr87 hub) is that agents never merge: they open draft PRs, comment, and label; a human decides. Decisions: (1) Refuse, don't warn (golden rule #6's posture): a sink.merge_pr downstream of a Claude agent is a compile error and the line emits no YAML; toolsFor no longer grants gh pr merge and the merge obligation template is gone. (2) Belt and braces on the grant itself: any --allowedTools entry that can merge — gh pr merge, a blanket prefix of it (gh, gh pr), gh api with no endpoint / graphql / a …/merge(s) endpoint, git merge, or bare Bash — is refused however it arose (today the only other path is a declared checks line, ADR-025). grantsMerge() is exported and unit-tested against the ordinary grant vocabulary so it cannot false-positive on gh pr list/gh pr edit/git merge-base/dispatch endpoints. (3) Factory 3 keeps reviewing and labelling but no longer merges; the merge moved to ADR-027's deterministic label-gated line (Factory 4: pull_request: [labeled] on dep:merge-approved → sink.merge_pr --squash --auto, no agent, no Claude secret), with a filter that requires the labeler to be a human (github.event.sender.type != 'Bot') and the PR to be Dependabot's — ADR-027 deliberately let the vetting bot be the labeler, but a bot label that triggers a merge is an agent merge with one extra hop, so on this repo the merge label is human-only. (4) Kill switches + rate limits on the scheduled agent lines with the existing gate.enablement/rate.limiter machines: NIGHTLY_GARDENER_ENABLED (Factory 2 — default-OFF until its 19 consecutive scheduled failures since 2026-09-15 are diagnosed), DEPENDENCY_WARDEN_ENABLED (Factory 3), DEPENDENCY_MERGE_ENABLED (Factory 4); crons moved off the top of the hour (17 3 * * *, 23 6 * * 1). The fleet.manifest.yml lanes were updated to match (switches, the warden's never_merges: true, the new engine lane). The dependency-warden gallery template dropped its merge sink. Alt: keep the merge sink with a stronger prompt (rejected — ADR-015 already proved prose loses); warn instead of refusing (rejected — a warning is how this shipped); let the warden's dep:safe-to-merge label drive the merge line (rejected — the agent would still be the decider); require branch protection first (out of scope for a repo PR — repo settings are the owner's call, filed as a follow-up).

The operator asked for a GitFactory instance that manages and orchestrates the loops of irony-works and lifehacker.dev. Surveyed first: everything an operator needs for a loop GitFactory did not compile — the Observe map with run beacons, facts/audit/metrics, ▶ Run now, ↻ Re-run, ✕ Cancel, ⚡ Arm / ○ Disarm any vars.*_ENABLED the workflow names, ⏻ enable/disable — already works on any roster repo from Fleet Command's Workflows board and its WorkflowDrawer, behind a confirm naming repo + workflow + consequence. What did not exist was an addressable roster: it lived only in localStorage['gitfactory.fleetops.v1'], so "the instance for these two repos" was a human typing two slugs into a box, per browser. Decision: a deep link. state/deeplink.ts parses ?roster= through the same parseRosterText the roster box uses (junk dropped, deduped) and App ADDS those repos to the persisted roster on load (idempotent; nothing a browser remembered is lost); ?tab=fleet lands on Command. The instance is therefore a URL on the existing Pages deployment — ?tab=fleet&roster=bamr87/lifehacker.dev,bamr87/irony-works — not a second deployment (two deployments under one Pages origin would share localStorage anyway). Why not a committed default roster: it would make every visitor's fleet the maintainer's; a link is per-audience. Why not compile the two repos' loops: ADR-017 — the compiler emits anthropics/claude-code-action only; lifehacker's lanes run the hub's claude-run by reference and irony-works runs a Node engine, so both are observed and operated, not compiled, until BL-20260908-01 lands. Also fixed on the way: the store tests had been red on main since the 2026-09-07 dependency bump because the typeof localStorage !== 'undefined' guards no longer hold on Node 22+ (the global exists but is unusable without --localstorage-file); storage is now probed for a working getItem, so Pages deploys — gated on green CI — resume.

2026-09-08 — ADR-037: The Fleet Ops facts read the fleet runner BY REFERENCE, and vendoring it is an audit finding

Round 2 of the cross-repo harmonization moved the fleet's AI runner into the hub (bamr87/bamr87#254: .github/actions/claude-run + the reusable ai-lane.yml, kit ai-runner), and lifehacker.dev, it-journey and zer0-mistakes now consume it as uses: bamr87/bamr87/.github/actions/claude-run@main. Fleet Ops already matched actions/claude-run in a uses: line, so those lanes stayed visible — but a caller of the reusable lane names no model, no CLI and no "claude" anywhere in its body and read as a non-AI workflow, and nothing distinguished a repo consuming the runner from one still carrying a copy. Decision: (1) AiFacts gains hubRunner (the owner/repo/.github/(actions/claude-run|workflows/ai-lane.yml)@ref reference, when present) and vendoredRunner (a local ./.github/actions/claude-run or scripts/ai/run.sh invocation), both derived from command lines only, so a comment naming the retired shape never counts; the ai-lane caller now counts as a claude-run workflow. (2) A new rulebook entry, vendored-runner (warn), fires on the local copy and names the hub reference as the fix — the fleet convention written down in the hub's kit README, ground-truthed by the three repos that just migrated. (3) Observe shows the reference on the passport. NOT done here, deliberately: emitting the hub runner from the compiler (BL-20260908-01 — reverses ADR-017 as an option and needs its own ADR + spec, likely specs/012). Alternatives: a runner: 'claude-run-hub' enum value (rejected: every runner switch in the app would grow a case for what is the same runtime at a different address); auditing the reference's pin (rejected: the fleet's own convention, audit.ts pin-branch, already lets hub reusable refs float on a branch).

2026-09-02 — ADR-036: The hub's harness is GitFactory's design model; parity is a ported engine and a golden file, not a copied page

The operator asked for GitFactory to have "the same style and features" as the hub's /harness/ page, for a harness built here to "render the same" there, and for the two to be tightly integrated — GitFactory as the design/model/deployment tool for GitHub agent harnesses, the bamr87 monorepo presenting and monitoring them on Jekyll. Verified first (golden rule #4) what the hub actually commits: _data/harness_health.yml is generated daily by dash-gen harness (.github/scripts/dash-gen/harness.py) from four committed signals (actions_usage, fleet_triage, issue_pipeline, token_rotation) with thresholds in _data/fleet.yml → harness:; the page is a Liquid template over that file plus five archify diagrams; there is no harness_registry.yml (specs/012's premise was stale). Decisions: (1) "Render the same" means the same anatomy, vocabulary, thresholds, statuses and numbers, drawn in the Evidence Console's tokens — not a pixel copy of Bootstrap's skin: air; the app already has a design system (ADR-034/035) and the hub's value is its data model, not its CSS. (2) Parity is proven, not asserted: app/src/harness/health.ts is a pure TypeScript port of harness.py (Python's half-even round, float formatting in the wire summaries, the rotation ledger's 10-day slack) and a golden test reproduces the hub's committed health file value-for-value from its committed inputs at bamr87/bamr87@00fa7ae — the pulse commit whose tree the generator actually read (HEAD's issue_pipeline.yml had been regenerated an hour later and would have broken it). The Harness tab re-runs the same engine over the hub's committed signals and prints a computed match-or-diff note beside the numbers. (3) fleet/v1 lanes are the interchange contract (wtd's FLEET-SPEC, which the hub already reads): blueprints compile to lanes (toFleetLanes), any repo's fleet.manifest.yml parses to lanes, one HarnessCard draws a lane identically on the floor, in Fleet Observe and in the Harness tab, and a parity test pins GitFactory's lanes to the manifest wtd fleet adopt wrote for this repo — id, harness, implementation, switch, guardrails, tokens; not kind/triggers, which wtd derives lossily from names. (4) The hub is a read-only source: one persisted slug (default bamr87/bamr87), an on-demand refresh of eight files through the GithubClient seam, no polling, no writes — the hub's own loops own its files and GitFactory never pushes there. (5) Design readiness is GitFactory's addition: the hub's six layers (guides, sensors, bounded loop, memory, permissions, observability) and its twelve-row production-readiness checklist are evaluated over a blueprint from the compiler's facts — a promptRef is a guide, checks/evidence/verified-fix are sensors, maxTurns plus a rate limiter bound the loop, the ledger is memory, the enablement gate and computed permissions are the boundary, the compiled line is what telemetry observes; id-token: write is claude-code-action's OIDC need, never a scope to question. (6) The engine ships in lazy chunks: the hub reader, the demo hub's tree, the manifest emitter and the passport's Lanes section are dynamic imports, so the eighth tab costs the first paint +6.4 kB raw / +1.4 kB gzip against a 12 kB budget — the first cut was +28 kB because state/hub.ts and the demo client imported the engine statically, and the lazy seeding then needed one shared promise so a fleet import's parallel reads all wait for the tree. Alternatives: iframe the hub's page (rejected — no thresholds, no live source, no design readiness, and Bootstrap inside the console); replicate Bootstrap's look (rejected — two design systems); write harness_health.yml from GitFactory (rejected — the hub's pulse owns it and a second writer is a race); a registry file (rejected — it does not exist).

2026-09-02 — ADR-035: The in-app map is GitFactory's view of the archify IR, not a second renderer of the graph — and the console replaces the columns

The operator asked to rebuild the repo so the GitFactory framework lives inside archify's UI/UX design. After specs/010 (maps) and 011 (tokens), four gaps remained: no delivered map was reachable from the app, Fleet Observe was a second React Flow renderer of the graph the architecture IR already describes, the Build tab was a three-column editor with two permanent side panels (the shape archify's DESIGN.md names as the anti-pattern), and the tabs shared colours but not archify's chrome. Decisions (specs/013-archify-console): (1) One IR, two views. The live surfaces render archify IR through a GitFactory-owned React/SVG view (app/src/map/layout.ts + MapView) that reuses archify's own geometry constants, so the in-app map and the delivered map share a coordinate frame; ADR-034's D-1 stands — archify's renderers never execute in the browser — and the in-app view is a deliberate subset (focus/passport, finder, reach, views, zoom, beacons) that links to the delivered HTML for route probe, exports and presentation. Rejected: iframing the delivered maps everywhere (only dogfood and demo sources have delivered maps, so live blueprints and observed repos would have had none) and porting render-workflow.mjs (a fork of module-scope Node code). (2) Retire the React Flow fleet canvas (ADR-011's FleetCanvas/WorkflowNode/fleet/layout.ts): Observe draws toArchitectureIR(fleet, { cap: every workflow }) — an in-app map has no 12-node story budget — with run status as text beacons and a workflow passport; the authoring canvas stays, because archify has no editing model. (3) Progressive disclosure over permanent chrome on the floor: the palette becomes a floating Machine Finder (/, docked open while the floor is empty) and the Inspector a floating Machine Passport (selection opens, Escape closes), with a Blueprint passport on the toolbar title — the canvas is dominant, per DESIGN.md. (4) The manifest is a build-time import, written by gen-maps beside the maps and byte-checked by maps:check; a runtime fetch was rejected because the demo's "zero network" claim would have had to explain it and jsdom tests would have needed a shim. (5) The chrome grammar ships as app/src/ui/ primitives (PageHeader, Panel, Cards, Chip, Kbd, Eyebrow, SearchField, Beacon — BL-20260828-13) applied to every tab, with a three-state theme toggle on the viewer's T key (two-state was rejected because it would drop the system preference specs/011 added). Alt considered and rejected: keeping the columns and adding a fourth "Map" column (more permanent chrome, the opposite of the design language); a dagre/elk layout (a dependency for a problem the IR has already solved by being placed).

2026-08-28 — ADR-034: Archify is the map renderer and the design language, not the UI framework

The user asked to rebuild the repo around tt-a1i/archify as "the main UI/UX library". Verified against its source before planning: archify is a Node CLI + agent skill (24k★, MIT, v2.16-dev, no npm package) that compiles a typed JSON IR — architecture / workflow / sequence / dataflow / lifecycle — into a self-contained interactive HTML/SVG map (search, focus, route tracing, reach, guided views, exports); it ships no components, no editing model ("not a general-purpose drawing editor"), and its renderers execute at module scope over process.argv + node:fs, so they cannot run in the static frontend. Decisions: (1) Three axes of adoption, one vocabulary. Its DESIGN.md ("The Evidence Console": midnight grounds, seven semantic node colours, mono-forward type, motion + a11y rules, light/dark parity) becomes the app's design system (companion spec); its renderers become the visualization layer for every read-only map — assembly lines as workflow IR, fleets as architecture IR — fed by a new pure app/src/archify/ir.ts (golden rule #3) and rendered by scripts and CI, never the browser (golden rule #1); its SKILL is installed for sessions and factory agents. The React Flow authoring canvas stays; the read-only React Flow fleet map is retired by the UI companion spec. (2) Vendor a pinned SHA under vendor/archify/ (7fe139e, 2.1 MB: bin, renderers, schemas, template, brand marks, recipes, references, example IR, LICENSE) — upstream has no releases to pin and CI must be reproducible and offline; VENDOR.md records the pin, a monthly drift check is a follow-up. (3) Pre-rendered only (plan decision D-1): maps live in app/public/maps/ with a GENERATED BY GITFACTORY header + blueprint hash, the Google Fonts link stripped so Pages serves them offline; verified archify check still passes. (4) Light theme ships as a peer in the design spec (D-3). Alt: swap React/xyflow for archify (rejected — nothing to swap to); shim node:* and bundle the renderers (rejected — a fork we would own; ~1 MB of source, script-shaped); npx skills add in CI (rejected — unpinned, network-dependent).

2026-08-28 — ADR-033: Dependabot bumps to generated workflows are compiler changes; unverified doc drafts are consolidated, not merged

A 28-PR sweep found three classes of open work. (1) Dependabot's github-actions ecosystem bumped actions/checkout 4→7 by editing the four factory--*.yml (#55) — the same bump had already landed once (#3) and was silently reverted by the next regen, because the emitter still said v4. Decision: a version bump to a generated file is a compiler change — update the emitted ref and the PINNED_ACTIONS SHA (upstream-verified per golden rule #4), regenerate every compiled artifact with the app's own compile(), and close the Dependabot PR with a pointer. The regen also flushed real drift (ADR-029/030 client_payload.number plumbing, the docs-gardener model refresh) that the committed artifacts had accumulated — evidence that regen-on-compiler-change must be habitual, not occasional (BL-20260818-05 would make the main blueprint's regen a script like the other two). (2) Eighteen wtd-fleet documentation drafts, each written without reading the repo and saying so — placeholders, invented gates (pin-check, an ignore list, a provenance sidecar), .factory/ mislabelled as output, three near-duplicate triplets. Decision: do not merge a doc whose facts the author could not verify, even a green one — the questions they raised were real, so they were answered once, against the code, in docs/GENERATED-FILES.md + a README layout/commands/cross-link map, and every draft closed with a pointer. Three Dependabot-config drafts that would have replaced .github/dependabot.yml wholesale (dropping the npm ecosystem) were closed on the same principle. (3) Two branches already adopted on main via #39 (#32, #37) closed as done. Alt: merge the drafts and fix later (rejected — false documentation of security gates is worse than none); ask the fleet agents to regenerate with repo access (rejected — the consolidation was cheaper than the round-trip, and the pattern "one verified page beats N speculative ones" is the reusable lesson); keep checkout@v4 and let Dependabot keep failing (rejected — the pin table's verification date was already ten days stale).

2026-08-18 — ADR-030: sink.repository_dispatch — the belt's sending end, with a self-dispatch refusal

ADR-029 shipped the socket; this ships the plug (BL-20260818-07): the 23rd machine, sink.repository_dispatch, POSTing gh api repos/<target>/dispatches with a scoped PAT secret (default FLEET_TOKEN, the sink.cross_repo_issue precedent), an event_type, and client_payload.number as the entity pointer — completing the numbers-not-bodies belt protocol end to end. Three points: (1) the agent grant is the exact endpoint — Bash(gh api repos/<target>/dispatches:*), added at the obligated-sink loop where the node's config is in scope, because a generic Bash(gh api:*) would be an any-endpoint token cannon (golden rule #5); toolsFor deliberately returns nothing for this type. (2) Deterministic emission exists (trigger→dispatch with no agent), mirroring the cross-repo-issue step: PAT via env GH_TOKEN, target/type as env, NUMBER from the shared fallback chain. (3) Self-dispatch loops are refused, not warned (golden rule #6): a line that listens for repository_dispatch type X and sends type X to its own meta.repo is an infinite loop the compiler rejects at compile time; same-repo with a different type warns (legitimate staged pipelines exist, but another line might listen). Alt: reuse sink.cross_repo_issue with a mode flag (rejected — different obligation, different grant, different loop semantics; a config flag hiding all three is how ADR-015-class incidents happen).

2026-08-18 — ADR-029: trigger.repository_dispatch — inter-repo belts get a receiving end

Fleet C's tail (BL-20260816-22): cross-repo automation could file issues into another repo (sink.cross_repo_issue, ADR-016) but no factory could receive a purpose-built signal — inter-repo belts had a sender pattern and no socket. Shipped the 22nd machine type: trigger.repository_dispatch with an eventType config → repository_dispatch: {types:[…]} (empty type = a loud warning, it would fire for every dispatch in the repo). Three design points: (1) entity plumbing over payload trust — github.event.client_payload.number joins the NUMBER env and concurrency fallback chains, so a sender can point the receiving line at an issue/PR and even deterministic sinks work; but per ADR-005 the payload's free text NEVER enters the prompt (senders hold repo-write tokens and are already privileged, yet numbers-not-bodies stays the invariant — the context lines carry DISPATCH_TYPE and PAYLOAD_NUMBER only, asserted by test). (2) Survey-mode membership: a dispatch line has no triggering entity, so agent lines get the discovery grant ceiling like cron/manual lines (ADR-013). (3) No bot guard: comment/label writes cannot re-emit a repository_dispatch, so the line is structurally loop-free like cron. The sending half (a sink.repository_dispatch POSTing /dispatches cross-repo with a scoped PAT) and the combined-canvas belt visualization are filed as sharpened follow-ups rather than bundled here. Alt: model the belt as one machine spanning repos (rejected — a blueprint compiles per-repo; the belt is two machines in two blueprints connected by convention, exactly like the proven gh --repo issue pattern).

2026-08-18 — ADR-028: Per-line names — lines are named by what they are, opt-in

Multi-line blueprints named files <meta.name> <index> (factory--gitorio-factory-3.yml) — meaningless in the Actions UI, unstable under line insertion, and the reason the Docs Gardener had to live in a standalone blueprint (BL-20260816-16, a "known rough edge" since ADR-018). Decision: meta.lineNaming: 'auto' derives each line's name from its agent's promptRef basename (.factory/prompts/docs-gardener.md → factory--docs-gardener.yml) — the prompt file is the line's identity in practice — falling back to <first-trigger>-<first-sink> types for deterministic lines, with deterministic numeric suffixes on collisions. Two invariants: single-line blueprints always keep meta.name (no churn for the standalone-blueprint pattern), and the naming lives in the shared lineNames() used by both compile() and assemblyLines(), so filenames and telemetry mapping are the same computation (the ADR-010 partition-sharing principle extended to naming). Opt-in with indexed as default because auto-renaming existing deployments would orphan the old workflow files and detach their run history — migrating gitorio's own factories 1–3 is follow-up work, done deliberately, not as a silent side effect. Alt: a lineName config field on trigger nodes (rejected — multi-trigger lines make it ambiguous and it spreads naming across 7 machine types); always-auto (rejected — silent renames of deployed files).

2026-08-18 — ADR-027: Label-gated merge lines — merge policy compiles to structure, not prose

ADR-015's live incident proved that when a capability grant and a prose guardrail disagree, a plausible-sounding agent reason wins often enough to be unsafe — and parked the structural fix. Shipped now (BL-20260816-06): trigger.pr_opened gains fireOn: labeled + an exact-label config, emitting pull_request: [labeled] with a job-level github.event.label.name == '<label>' guard; paired with the existing terminal sink.merge_pr, the whole merge policy is YAML — "merge what carries dep:safe-to-merge" involves zero agent judgment in the merge path. The pieces compose with two existing invariants rather than adding new ones: the ADR-014 terminal-sink relaxation drops the bot guard (the labeler SHOULD be allowed to be the vetting Warden bot — asserted by a regression test), and auto-merge (--auto) defers to branch-protection checks. New diagnostics logic: a label-scoped labeled trigger suppresses the unscoped-merge warning (the label IS the scope), while fireOn: labeled with no label warns loudly (fires on every label add). Shipped with a label-gated-automerge gallery template (2 nodes, fully deterministic, compiles clean with no agent). Default fireOn: opened keeps every existing blueprint byte-identical. Alt: a separate trigger.pr_labeled machine (rejected — a firing-mode of the PR trigger, not a new event source; 21 machine types stay 21); requiring a Filter node for the label (rejected — the trigger option is the ergonomic, single-node policy ROADMAP asked for, and the guard lands in the same job-level if).

2026-08-18 — ADR-026: SHA-pinned actions mode — a curated pin table, not an API lookup

The fleet's own audit engine rewards SHA-pinning (pin-sha, ADR-021) while GitFactory's compiler could only emit floating tags — the tool preached what it couldn't produce (BL-20260816-03). Decision: meta.pinActions: true on a blueprint (or the pinActions compile option) pins every emitted uses: ref to a commit SHA, with the original tag restored as a trailing YAML comment in a deterministic post-stringify pass (a scalar containing # would be quoted by the emitter, turning the comment into part of an invalid ref — so the annotation is textual, keyed on the exact SHA at end-of-line). The compiler stays pure (golden rule #3): pins live in the exported PINNED_ACTIONS table, verified against the live upstream tag refs on 2026-08-18 (golden rule #4 — actions/checkout@v4, dependabot/fetch-metadata@v2, and anthropics/claude-code-action@v1, the last dereferenced through its annotated tag). Two drift guards in one invariant test: every pinRef('…') call site's ref must exist in the table, and no bare uses: '<owner>/…' literal may bypass the wrapper. Default output is byte-identical to pre-feature output (opt-in, no churn for existing factories). Alt: resolve SHAs at deploy time via the API (rejected — breaks compiler purity and makes output nondeterministic); pin unconditionally (rejected — floating-tag repos like law-ai keep tags by convention; forcing pins would fight the target repo's own style, and the fleet audit's pin-sha rule is a convention detector, not an absolute).

2026-08-18 — ADR-025: checks — repo-declared verification commands as first-class agent grants

ADR-024's honest-grant posture left a real gap both repos filed independently (gitorio BL-20260817-04, law-ai BL-20260817-07): a factory agent that edits BACKLOG.md/specs/ could not run the very validators that gate those files — every check deferred to PR CI, so a broken edit round-tripped through a failed PR instead of being fixed in-run. Decision: an agent-config field, not a machine. agent.claude gains checks (textarea, one command per line); the compiler emits exactly Bash(<command>:*) per declared line — a narrow, blueprint-reviewed grant — plus a VERIFY prompt note ordering the agent to run each check and fix forward (prompt/grant coherence per ADR-023, extended to checks). Safety: a check containing a double quote, backtick, or $( ) is a compile error (it would break the --allowedTools string and invites substitution games); blank lines drop; the grant ceiling stays derived-from-config, never prompt-controlled, so injected issue text cannot mint grants (golden rule #9). law-ai's evolve-pilot and backlog-triage lines regenerated with the two stdlib validators declared; the issue-concierge deliberately gets none. Alt: a processor.verifier machine (rejected — checks run inside the agent's work loop, not as a pipeline stage); a blanket Bash(python3:*) grant (rejected — arbitrary interpreter, the opposite of golden rule #5); keep deferring to CI (rejected — a governed agent that cannot self-verify ships avoidably broken PRs).

2026-08-17 — ADR-024: GitFactory manages a sibling repo's orchestration via a target-dir generator (law-ai)

First real "GitFactory as a management tool for another repo's AI orchestration": law-ai's AO-SDLC had an automated deterministic half (its weekly audit) and a manual agentic half (a tracking issue asking a human to run /evolve). Decisions: (1) a target-dir generator, not cross-repo workflows — app/scripts/gen-aosdlc-factory.ts <target> compiles blueprints with gitorio's own compiler and writes blueprints + factory--*.yml into the target checkout; the lines run in law-ai under law-ai's own secrets/token (least privilege — no cross-repo PAT; rejected: gitorio-hosted workflows acting on law-ai). (2) One generic gallery template (ao-sdlc-autopilot: cron + plan-first manual → enablement gate → rate limiter → agent → open_pr) with script-side variants for the three law-ai lines — evolve-pilot, backlog-triage, issue-concierge (rejected: three templates — two are config variants; the gallery stays curated). (3) Default-OFF everywhere: EVOLVE_PILOT_ENABLED / BACKLOG_TRIAGE_ENABLED / ISSUE_CONCIERGE_ENABLED, PR-only outputs, no merge verb in any grant, concierge bot-guarded + marker-deduped. (4) Grant honesty in prompts: the compiled grant has no make/python3/pytest, so the pilot's prompt says so and defers every heavy gate to CI on its PR rather than pretending — the scoped "verification grant" machine is filed as follow-up (BL-20260817-04 here, BL-20260817-07 in law-ai). (5) Guest etiquette: the law-ai side ships under law-ai's own constitution — specs/037-gitfactory-orchestration + a claimed BL entry + its validators green. Incidental find: cross-repo editing exposed a gate-check.sh bug (repo root derived from shell cwd, so law-ai's specs/** got gated with gitorio's tool paths) — fixed by anchoring on CLAUDE_PROJECT_DIR and gating only files inside this repo. Alt: hand-author law-ai's YAML (rejected: loses computed grants, loop guards, drift hashes — the whole point of the factory).

2026-08-17 — ADR-023: If the compiler tells an agent to read its promptRef, it must grant the read (adopted from draft PR #37)

Live incident (2026-08-15, draft PR #37 by the fleet's own agent): Factory 3 (the dependency warden) starved at its turn cap on every scheduled run and never once posted a verdict — 26 turns, 12 of them permission denials, error_max_turns, zero obligations completed. The compiler emitted a self-contradicting workflow: intro orders every non-feedback agent to "Read and follow the operating instructions in <promptRef>", while Read/Glob/Grep were granted only inside the isFeedback branch and by toolsFor(sink.open_pr | sink.commit_files) — so any comment/label/merge line was told to read a file it could not open, and burned its budget retrying. Decision: prompt/grant coherence is an invariant, not a per-sink accident — if (promptRef) { Read, Glob, Grep } in the non-feedback branch, plus Bash(gh pr checks:*) under survey mode (a CI-gating warden's obvious verb). Both read-only; no write surface widens; the feedback controller's no-self-merge invariant untouched. Guarded by a Factory-3-shaped regression asserting the exact grant in Set-insertion order and a table-driven invariant test across five line shapes (prompt orders a read ⇒ grant contains Read). The defect was latent in three more lines (Factory 1, Factory 2, the docs gardener — Factory 2 succeeded only because its inline obligations never needed the file; luck, not safety). Alt: raise maxTurns (rejected — pays for the denial loop every run); inline prompt files into the workflow (rejected — ADR-005/§8 keeps attacker-controlled text out of workflow files); a hand-tunable allowedTools knob on the agent node (rejected — the grant is derived; a knob invites exactly this drift). Adopted into the working tree from the draft PR's diff (its ADR arrived numbered 022, which the AO-SDLC adoption below already claimed — renumbered here, content preserved).

2026-08-16 — ADR-022: Adopt AO-SDLC — merge law-ai's spec-driven backlog loop into gitorio's session framework

The seed system stopped being the intake path around seed 07 (Fleet Ops, the CMS, and the framework refactor all entered via ROADMAP sections + ADRs with no seed), the ROADMAP § Backlog had grown three tiers of un-IDed prose with an unbacked FF-00NN namespace, and nothing forced a session to record what it discovered. Meanwhile the sibling law-ai repo had evolved a mechanically-enforced AO-SDLC: an append-only BACKLOG.md (BL-YYYYMMDD-NN), spec packages (specs/NNN-slug/{spec,plan,tasks}.md), a /specify → /clarify → /plan → /tasks → /implement chain with an /evolve autopilot, and — the load-bearing part — three stdlib gates that make the loop self-sustaining (a spec validator that refuses a tasks.md without ## Follow-ups Discovered, a backlog lint that diffs against git show HEAD: so entries can never be deleted, and a PostToolUse hook that blocks the agent on a broken gate). Decision: merge that framework into gitorio, translated into gitorio's own conventions rather than transplanted — and carry one gitorio convention back onto it. Concretely: (1) validators + picker + id-minter + discovery audit live in tools/ (not scripts/), joining unwrap-prose.py; all imported markdown obeys the one-paragraph-per-line CI rule. (2) The golden rules ARE the constitution — no separate docs/constitution.md; the loop became golden rule #11 and the reviewer agent audits all 11 (golden-rules-reviewer, plus backlog-triager, both read-only). (3) Commands are self-contained with frontmatter per gitorio's house style — no separate prompts/ layer (rejected: collides conceptually with .factory/prompts/, the deployed agents' operating prompts; law-ai needs the split for Copilot-sharing, gitorio doesn't). (4) ADRs stay in docs/DECISIONS.md (rejected: law-ai's docs/adr/ directory — two decision logs is one too many). (5) The weekly discovery workflow (evolve.yml) is ported behind gitorio's own default-OFF *_ENABLED repo-variable convention (EVOLVE_AUDIT_ENABLED, manual dispatch always runs) — the honest "merge of both feature sets": law-ai's loop gains gitorio's kill-switch governance; also fixed law-ai's latent bug where the PR body interpolated a step output that was never set, and made the evolve label creation idempotent. (6) ROADMAP § Backlog migrated to BACKLOG.md as 35 seeded BL-20260816-NN items (stale claims corrected first — e.g. the drift-guard test and three of five "untested" machine types have shipped since the 2026-07-03 review) and frozen; seeds 00–07 closed as history. (7) BACKLOG.md (repo work register) is explicitly distinct from .factory/backlog.yml (the product's content queue, ADR-017) — documented in both places. Alt: keep seeds-only (rejected: already dead as intake); adopt law-ai's AGENTS.md-as-single-source pattern (rejected: CLAUDE.md is gitorio's established memory; two sources of truth invite drift); skip the hooks and rely on CI alone (rejected: the block-at-edit-time hook is what makes the loop unskippable for agents — CI catches, the hook teaches). Adversarially reviewed after the port (a 25-agent, five-lens workflow — cross-references, gate mechanics, Actions correctness, house conventions, port fidelity — each finding independently verified by a refuter): 16 confirmed findings, all fixed with regression proofs. The majors: the template-placeholder gate made the documented /specify lifecycle impossible (fresh template copies always failed; now byte-identical-to-template files are exempt, and requirement-coverage is stage-aware across draft/clarified/planned); the append-only backlog check was vacuous in CI (worktree == HEAD after checkout — the law-ai original has the same hole) — backlog_lint.py now takes BACKLOG_LINT_BASE, with CI passing HEAD^1, proven in a scratch repo to catch committed deletions; the audit's dedup key truncated titles at the first . (inside every file extension), re-appending the same items with fresh ids forever — also inherited from law-ai, fixed by splitting on '. '; and tee without pipefail masked audit crashes into green weekly runs. Incidental find during gate verification: fleetops.test.ts fixtures had aged out of the store's real-clock 14-day metrics window, turning CI on main red since 2026-07-30 — pinned the clock (vi.useFakeTimers({ toFake: ['Date'] })) and filed the pattern sweep as BL-20260817-01.

2026-08-22 — ADR-032: The demo is one substitution — a fixture GithubClient — not a mode threaded through the UI

GitFactory deploys to Pages, so anyone can open it, and five of its seven tabs were dead on arrival: Content, Monitor, Prompt Studio, both Fleet modes and Deploy all rendered "Connect a repo (top bar)" until a fine-grained PAT was pasted in (verified in the running app). The tool whose whole thesis is that a factory should be legible was illegible to every first-time visitor, and the same gap made every screenshot require a live token and a scratch repo. Decision (BL-20260822-02, specs/009-demo-environment): implement the existing GithubClient interface — all 22 methods plus login — over committed fixtures and put that object in the store. Nothing else changes: every panel already reads its client from state/github.ts, so all seven tabs come alive with no if (demo) branch anywhere in the UI, and — the load-bearing consequence — compile(), fleet/facts, fleet/metrics and fleet/audit run for real over the fixture data. A demo that reimplemented an engine would be worse than no demo (spec R-3), so the demo may only supply data to the shipping code, never stand in for it; engines.test.ts asserts exactly that, including that the factory--*.yml the client serves is byte-identical to what compile() emits. Four properties make it safe and durable. (1) No network, no credential: the client contains no fetch and no token — a test booby-traps globalThis.fetch to throw and calls every method, and a browser pass aborting every api.github.com request counted 0 attempts and 0 console errors. (2) Writes land in an in-memory overlay consulted first by every read, so Deploy, prompt edits and kill-switch toggles visibly persist for the tab's lifetime and no further; the banner names the count, because per spec section 11 the demo's one real risk is a visitor believing a write reached GitHub. (3) Mutually exclusive with a live session: entering calls disconnect(), which also clears the sessionStorage PAT, so a reload cannot reconnect the real session underneath the demo. (4) Nothing is hard-dated — run history generates backwards from an injected clock, because this repo has already shipped that exact bug (ADR-022's incidental find: fleetops.test.ts fixtures aged out of a 14-day metrics window and had CI on main red for three weeks). One deliberate choice that reads as a flaw until you see the boards: the demo fleet is imperfect on purpose — acme/storefront grades C behind an ungated nightly with blanket Bash and top-level write permissions, acme/infra B, acme/design-system A. A fleet where everything passes renders an empty Audit board and an empty Rankings board and teaches a visitor nothing about what the cockpit is for. Cost: +23.3 kB raw JS and +1.1 kB CSS against a 200 kB budget. Alt: a demo flag threaded through the panels with canned render paths (rejected — two rendering paths, and the demo drifts from the app the first time either changes); promote the DEV-only __fleetStore/__githubStore smoke hooks (rejected — they are stripped from the Pages build, which is the only place a visitor ever meets the tool); a public read-only PAT baked into the build (rejected outright — golden rule #7, and it would rate-limit into uselessness on the first busy day).

2026-08-22 — ADR-031: The perfection loop is four deterministic machines around the agent, not a smarter agent

Ported the framework behind it-journey's quest-perfection.yml into GitFactory as buildable machines: processor.ledger, gate.budget, processor.evidence, gate.verified_fix, plus a Perfection Loop template wiring them. The insight worth porting is not the agent — it is that every question an autonomous improvement loop could answer about itself is answered by a deterministic step instead. What to work on comes from a committed ledger (plan job, no model). How much comes from budget caps sized to human review speed, not machine capacity — measured on it-journey, patches were generated far faster than one reviewer could read them, so throughput pauses at maxOpenPrs. What actually happened is sealed before the agent runs, which also dodges a hard constraint: Claude Code scrubs auth from its Bash-tool subprocesses, so a measurement engine launched inside an agent can never authenticate. Whether an edit helped is an independent command's exit code, and a failing one reverts the tree. Whether the work is done is recomputed in a report job from the sealed evidence — the one field an agent may never write, because a model that can certify its own work stops converging and starts flattering itself. Compiler shape: the ledger machine emits plan before the line and report after (the existing gate → line pair becomes gate → plan → line → report), and the line gains strategy.matrix: fromJson(needs.plan.outputs.matrix) with max-parallel: 1 — the rotating window, because walking a whole backlog in one run exhausts the token's rate limit long before it finishes. Ten invariant tests assert these as properties of the emitted YAML rather than of a prompt, since a prompt-level promise is exactly what this design refuses to rely on. Also refreshed every model select to the current Claude family (claude-opus-5 default, replacing claude-sonnet-4-6/claude-opus-4-8). Boundary held deliberately: GitFactory compiles the workflow; the deterministic scripts it calls (selectCmd/measureCmd/verifyCmd/updateCmd) stay the target repo's own code, referenced by path — the same contract as promptRef. Alt considered: one omniscient agent that plans, measures, fixes and certifies in a single step (rejected — that is precisely the self-grading loop the deterministic bookends exist to prevent).

2026-07-17 — ADR-021: Adapt Fleet Ops to the #1 consumer (it-journey) — engine correctness + a workflow-management surface

Fleet Ops (ADR-020) was validated against zer0-mistakes and lifehacker.dev. Turned it on the fleet's actual heaviest consumer — it-journey, 44% of all fleet Actions minutes, 31 workflows (the most of any repo), home of the worst offender (Quest Perfection Loop, priority 1455) — and found the cockpit under-reported it. A full survey (every one of it-journey's 31 workflows + edgar-data-parse + law-ai, traced through the classifier/facts/audit by hand) produced a precise gaps report; this ADR implements it in three tracks (built in parallel, disjoint files, adversarially reviewed). Decisions:

  1. The dominant AI cost center was invisible; make it a first-class runner. it-journey's biggest compute is the agentic engine python3 test/quest-validator/agentic_validate.py --mode execute (and bare @anthropic-ai/claude-code + a claude CLI call) — matched by none of the four AI-runner patterns. agentic-quest-review even installs the agent and runs it with --max-cost-usd 3.00 yet read as non-AI. Added an agentic-engine runner (detected on command lines only — a new commandLines() helper strips # comments and name: labels, which also killed a false-positive where agent-plan-then-act referenced scripts/ai/run.sh in a comment), plus AiFacts.maxCostUsd — the fleet's only hard dollar cap, now surfaced. This one fix cascaded: it corrects archetype, un-hides the AI, and lets ai-timeout catch the un-bounded paid agent.

  2. Seven new archetypes for the quest- pipeline.* The classifier's 21 archetypes had no vocabulary for it-journey's flagship pipeline (quest-idea-intake → quest-forge → quest-walkthrough → quest-perfection → quest-fix → agentic-quest-review) — five of seven classified as other/degenerate. Added agent-gatekeeper (issue-triggered AI labeler), issue-to-content (issue→content-PR, e.g. quest-forge), agentic-validator (the agentic engine playing/validating content), perfection-loop (scheduled plan→fan-out→fix AI loop; beats dispatch-hub), pr-gate (PR-only deterministic lint/validate), pr-editor (PR-triggered AI reviewer), and autonomy-loop (scheduled self-audit/evolve → PR, e.g. law-ai's evolve/nightly-tests). Fixed precedence: deploy before auto-merge-bot (so sync-gh-pages, a Pages publisher that happens to gh pr merge, isn't mis-filed), issue-autopilot now requires a real issue sink and an issues/label trigger (so law-ai's "weekly autopilot" evolve isn't stolen by the name), pr-gate/pr-editor gated on !push so CI pipelines stay ci-gate, and ledger tightened to a real artifact-sweep signal. New facts too: matrixDynamic (matrix: fromJSON(plan) — unknown fan-out width vs a static list), localWorkflowCalls (intra-repo ./.github/workflows/*.yml belts), waitBound (a sleep+gh pr checks poll loop — minutes spent waiting, not computing), and github-script/embedded-script sinks (issues.createComment, --create-issue) that a gh-CLI grep missed.

  3. The audit was punishing sophistication it couldn't see; make loop-safety a real feedback-loop model. loop-safety (a FAIL, and the tool's core safety promise per golden rule #6) crudely failed any event-triggered writer with no detected guard — false-failing three of it-journey's safest workflows (a PR-triggered comment can't retrigger pull_request; a commit sink is safe when the trigger omits synchronize; the issue pipeline is gated by a gate job + singleton concurrency). Replaced it with a self-retrigger test: map each write sink to the event it emits (comment→issue_comment, label→issues, pr→pull_request, merge→∅, commit→push or pull_request only when synchronize is subscribed) and fail only when an emitted event is in the workflow's own subscribed set and there's no guard. Crucially, a pull_request: trigger with no types: defaults to including synchronize, so a commit sink there is still correctly flagged loopy — the rewrite tightens as well as loosens. Added gate-job and concurrency-singleton as recognized guards, widened synchronize-skip (types omitting synchronize) and sticky-marker (stable-title dedup, not just HTML comments), widened planApply (resolve/enable_*/substantive toggles), and added a pin-sha reward rule (in a repo that pins to SHAs by convention, flag the stragglers still on floating tags). Net: it-journey — the most disciplined repo in the fleet — stops being under-graded on guards the detector didn't understand.

  4. From read-only to a real workflow-management interface. ADR-020 shipped read + file-issue; the client had rerunRun/setWorkflowEnabled/dispatchWorkflow/cancelRun/setVariable but nothing wired them. Added store actions (rerunLatestFailed, dispatchWorkflowFile, cancelRunById, setKillSwitch, setWorkflowEnabledById, loadRunJobs; an actionBusy map) and a fifth Workflows board (per-workflow table with a cost-cap column surfacing maxCostUsd/waitBound, costliest-first) opening a WorkflowDrawer — a management slide-over showing every capability (the agentic engine + turn/cost caps, armed/disarmed kill switches, guards, permissions, metrics, this workflow's audit findings) with the maintain actions: Run now, Re-run last failure, Cancel, Arm/Disarm the *_ENABLED gate (the fleet's own idle-without-redeploy convention — distinct from disabling the file), Enable/Disable. Every mutation is gated behind an explicit confirm naming repo + workflow + consequence. Kill-switch toggling delivers roadmap spec FF-0013 early. Verified live in-browser against a seeded it-journey fleet (all five boards + the drawer + the confirm gate).

Ground-truthed against the real files (one deviation surfaced and honored: edgar-data-parse's refresh-data genuinely falls through the taxonomy to other — only a gh workflow run dispatch sink, no name signal — so the test asserts reality, not the survey's guess). Adversarially reviewed afterward (a multi-agent dimension review, each finding independently verified); the 5 confirmed defects fixed with regressions — the two majors were loop-safety false-negatives the self-retrigger rewrite itself introduced (a bare pull_request: with no types: defaults to include synchronize, so a self-push loop must still flag; a PR label re-emits pull_request(labeled), not issues; and synchronize-skip must not bless a non-commit loop), the rest a stale-run Cancel target, a cached-[]-on-error jobs bug, and confirm-dialog focus management. 35 test files, 443 tests (+73), typecheck + prod build green. Deferred to the roadmap (survey § D): a per-matrix-leg cost timeline, an expected-vs-real failure classifier (continue-on-error legs / rate-limit soft-skips / cancel-in-progress are intended outcomes the raw conclusion misreads), quest-ledger surfacing, and "re-run only the missing legs." Alt considered: a separate top-level Manage tab (rejected — management belongs next to the analysis that motivates it, under Fleet).

2026-07-17 — ADR-020: Fleet Ops — a game-like, fleet-wide workflow cockpit grounded in the real fleet's conventions

Observe mode (ADR-011) mapped one repo's workflows as a read-only graph. GitFactory needed the operational layer above it — a way to monitor, review, analyze, maintain, align, and improve an entire fleet of repos' GitHub Actions the way you would across a whole GitHub org, not one repo at a time. Built Fleet Ops / Fleet Command: a Fleet-tab "Command" mode (with the old single-repo map now under a "Observe" toggle) that scans a roster of repos and renders four game-like boards. Grounded in ground truth: three research passes read every workflow in zer0-mistakes (24) and lifehacker.dev (24) — the two validation targets — plus samples across it-journey, the bamr87/bamr87 hub, and cv-builder-pro, and the dash's own analytics/standards definitions, before any code. Five decisions:

  1. Three pure engines, ported from the dash's real definitions, not reinvented. (a) fleet/metrics.ts is an exact TypeScript port of the dash's actions_analytics.py — cost = wall-clock minutes (a shadow price; there is no runner-pricing table, matching the source), effectiveness = share of minutes ending in success, waste = minutes on failed/cancelled/timed-out runs, p95 = nearest-rank, and the flag thresholds (failing/flaky mutually exclusive, slow/cancel-heavy/cron-heavy/high-cost-low-value) + priority = waste + total×(1−effectiveness) triage score verbatim — so the cockpit's numbers reconcile with the dash's /actions/ page by construction. Two gitorio-only additions: rework (runs with run_attempt>1 — a re-run signal the dash lacks, needing a new FactoryRun.runAttempt) and queue latency (p50 created→started). (b) fleet/facts.ts is a deep per-workflow extractor that sees what the survey proved the naive parser misses: the fleet's dominant AI path is a local ./.github/actions/claude-run composite (invisible to a claude-code-action scan), kill switches live in env:/run:/if: alike, cross-repo sinks hide in gh … --repo inside prompt strings, token fallback chains (FLEET_TOKEN || github.token) encode the real privilege, some crons are commented out (dormant automation), and generated files carry a ⚙ GENERATED BY GITFACTORY provenance header. It also classifies each workflow into one of 21 archetypes (standard-ci-caller, mention-handler, content-factory, auto-merge-bot, self-repair, nightly-audit, cross-repo-filer, meta-loop, generated-line…) and the dash's ordered-substring cost type. © fleet/audit.ts is an alignment-rules engine whose 14 rules encode the fleet's own implicit conventions (OAuth-first Claude auth, default-OFF *_ENABLED kill-switch gates on scheduled AI, loop-safety guards, concurrency/permissions/timeout hygiene, action pinning, plan/apply duality, sticky-marker dedup, the standard CI+@claude+prose trio) into a 0–100 conformance score and an S–D certification grade. All three are pure + total (never throw; nowIso passed in, never Date.now()), per golden rule #3 — validated by asserting facts against 19 verbatim real-fleet workflow fixtures (fleet/fixtures/).

  2. The metric identity key is owner/name::path. A fleet-wide port of a single-repo analyzer has a collision no single-repo tool has: every repo has a .github/workflows/ci.yml. Runs and labels are namespaced with owner/name::path before they enter the pure metrics engine, then split back for display — so cross-repo rows never merge.

  3. Scanning is user-driven with a bounded worker pool, not a background poller. A 40-repo roster costs ~4 API calls per repo; a silent 15s poller across all of it would burn quota. scanFleet runs on an explicit "Scan fleet" action through a concurrency-3 worker pool, shows per-repo progress and the remaining rate budget, and each repo's poll stays ETag-conditional (304s are free). One repo failing becomes an error card, never an aborted sweep. This is the first multi-repo store in the app — Monitor/Telemetry are bound to the one connected repo, and Fleet's prior observedRepo decoupling was the closest precedent; the new fleetops store generalizes it to a persisted roster (slugs + hub slug + window only — never tokens, golden rule #7).

  4. The roster imports from a monorepo hub's .gitmodules. The natural fleet definition for this ecosystem already exists: bamr87/bamr87's submodule list. fleet/manifest.ts parses .gitmodules (and free-text owner/name input) into a roster, so "command my whole fleet" is one paste of a hub slug. The dash IS a fleet manifest; the cockpit reads it rather than reinventing one.

  5. Four game-like boards + read-mostly writes. The cockpit (FleetOpsPanel) renders a HUD (compute burned, waste, effectiveness, success, rework, alarms + a compute-share-by-type strip) over four boards: Districts (repo cards with LED walls, S–D grades, minute/waste bars, flag chips — the factory-floor overview), Rankings (offender/slowest/rework/hall-of-fame leaderboards from the metrics), Audit (certification table + expandable findings, each with a plain-language fix and one-click work-order issue filing carrying a <!-- gitorio-fleet-audit key=… --> dedup marker mirroring the dash's actions-review convention), and Schedule (a 24-hour UTC cron congestion histogram + scheduled lines with armed/disarmed kill-switch state + dormant/commented-out automation). Writes stay deliberate and few: filing an audit issue is the only mutation, and it's per-finding and explicit. Everything else is observe-and-analyze. New client methods (listRepoWorkflows, rerunRun, setWorkflowEnabled, createIssue) are added but only createIssue is wired to UI — rerunRun/setWorkflowEnabled are the API surface for the parked "maintain" actions (one-click re-run, kill-switch toggle) so the contract exists without the mutation UX yet. Validated live in-browser against a seeded 5-repo fleet (all four boards), then adversarially reviewed (a multi-agent dimension review with each finding independently verified — 10 confirmed defects, all fixed with regression tests: a work-order key collision that cross-wired sibling findings, three metrics-parity fixes incl. Python-matching banker's rounding + the rework/rollup denominators, a dormant-cron prose false positive, and four a11y/React-key fixes). Green: 370 tests / 34 files, typecheck + prod build. Alt considered: extend the Monitor tab (rejected — Monitor is single-repo and per-line, a different altitude); a separate top-level tab (rejected — this is fleet observation, it belongs under Fleet with the map as a drill-in). Parked to the roadmap (feature-scout specs FF-0010…FF-0016): composite/reusable-workflow recursion in the facts parser, persistent open-issue dedup sweep, scan-result caching, kill-switch toggling UX, generated-file drift board, a billable-cost pricing table, and auto-remediation PRs.

2026-07-03 — ADR-001: Blueprint lives in the target repo

.factory/blueprint.json in the repo it automates. Why: versioning, review, portability, shareability for free; the UI stays stateless. Alt: app-side storage (rejected: needs a backend, splits truth from the repo).

2026-07-03 — ADR-002: GitHub Actions is the runtime

Compile to workflows using anthropics/claude-code-action@v1 rather than running agents in a service. Why: zero infrastructure, secrets stay in GitHub, output is auditable YAML that works without GitFactory. Alt: hosted orchestrator (rejected for v1: cost, trust surface, defeats the static-site premise).

2026-07-03 — ADR-003: Integrated mode first, belt mode later

Sinks downstream of an agent become prompt obligations + scoped tool grants, not deterministic steps. Why: fewer moving parts; the action already excels at gh operations. Belt mode (typed JSON handoff) is Phase 6 once ergonomics are proven.

2026-07-03 — ADR-004: Static + fine-grained PAT first, App device flow second

PAT in sessionStorage unblocks everything with zero backend; device flow (no client secret needed) upgrades UX in Phase 7. Web-flow OAuth requires a token exchange secret → optional worker, never a core dependency.

2026-07-03 — ADR-005: Pass entity numbers, not bodies, into prompts

Generated workflow prompts reference issue/PR numbers; the agent fetches content via gh. Keeps attacker-controlled text out of workflow files; injection is then mitigated by capability containment (--allowedTools), not content trust.

2026-07-03 — ADR-006: Toolchain pinned at Vite 8 / plugin-react 6

@vitejs/plugin-react@6 peer-requires vite@^8, so the pair is vite ^8.1 + plugin-react ^6 (TS ~5.9, vitest ^4, React 19). Verified: install, 13/13 tests, typecheck, prod build, dev-server smoke all green on Node 22.

2026-07-05 — ADR-019: Frontend framework refactor — global chrome vs. per-view toolbar, token unification, capability drill-down

The top bar had grown to ~16 controls (7 nav tabs + 6 Build-only actions + Connect + Deploy + power) and newer panels had drifted off-palette. Refactored for a flexible, consistent shell: (1) Global chrome vs. per-view actions. The top bar is now only global chrome — logo · nav · connection · power. Build-context actions moved into a dedicated BuildToolbar (a per-view action bar): factory name + counts · undo/redo (now visible, not just ⌘Z) · Templates · a Blueprint ▾ dropdown collapsing the four import/export actions · LEDs · Deploy. Rationale: a view's actions belong to the view, so the global bar can't get crowded as tabs/actions grow. A new accessible Menu primitive (outside-click/Escape/select-close) backs the dropdown. Alt: overflow "⋯" menu on the single bar (rejected — hides primary actions); left sidebar nav (rejected — larger change, the tab bar is fine once decluttered). (2) Design-token unification. Panels shipped since ADR-016 referenced generic token names (--border, --muted, --accent, --input, --hover) that were undefined in the theme, so they silently fell back to off-palette GitHub colors. Added those as semantic aliases in :root mapping to the industrial palette (--border: var(--seam), --accent: var(--steel), …) — one change unifies Content/Docs/Monitor/Prompts/Settings with the control-room theme (verified: --border resolves to --seam). Alt: rewrite each panel's CSS to the canonical names (rejected — more churn, same result). (3) Capability drill-down. New pure describeWorkflow(yaml) parses a compiled workflow back into structured facts (triggers, schedule, permissions, kill-switch, rate limit, and the agent's model/tools/obligations) — parsing the real emitted YAML means the detail views can't drift from what ships. Feeds two surfaces: the Build Inspector gains a Capabilities · compiled section for a selected agent ("this agent may: comment on issues, apply labels…" + token permissions + obligations + kill-switch), and Monitor lines are now expandable to the same facts. describeTool turns raw --allowedTools grants into readable phrases. Verified: 220 tests / 28 files (+Menu, BuildToolbar, describe), typecheck + prod build green, browser-verified (slim bar, Blueprint menu, agent capabilities, palette consistency).

2026-07-05 — ADR-018: The Docs Gardener — a demonstrable daily content factory + a Docs view on Pages

Made the headless-CMS concrete on gitorio itself: a daily factory that reviews + improves the _docs collection, those docs rendered in the frontend (which Pages serves), and skill/config options. Decisions: (1) Docs Gardener factory — a template (cron 0 8 * * * + plan-first manual → gate.enablement DOCS_GARDENER_ENABLED → rate.limiter 2/day → agent.claude → sink.open_pr). A Claude agent scans config.docsDir, picks the config.itemsPerRun most-improvable docs, applies the configured review criteria + the matching skill specialization, edits them, and opens ONE PR (never merges; default-OFF). Dogfooded onto gitorio from the SAME sources the app uses via app/scripts/gen-docs- gardener.ts (template + compiler + config model), so the committed artifacts can't drift. (2) Docs rendered in the frontend, on Pages — gitorio's Pages IS the Vite app (not Jekyll), so "render docs on Pages" = a Docs view in the app. _docs/*.md bundle at build time via import.meta.glob('../../../_docs/*.md', {query:'?raw'}) (repo-root collection; server.fs.allow: ['..'] for dev), parsed by a dependency-free Markdown renderer (docs/markdown.ts → block AST → React elements, no dangerouslySetInnerHTML — kept the bundle lean vs. adding marked). The loop is visible: gardener improves a doc → merge → Pages redeploy → the Docs view updates. The factory that tends the docs and the site that renders them are one repo. (3) Skill specializations + content config — extended .factory/config.yml (FactoryConfig) with skills (named lenses: technical-writer / tutorial-author / api-reference — lifehacker's .claude/skills/ idea, but centrally configured so the app edits them), reviewCriteria (the reviewer's checklist), docsDir, and itemsPerRun. Editable from the Content tab (skills + criteria list editors, docs settings); read by the agent at runtime, so tuning needs no recompile. (4) Compiler blueprintPath option — the header's blueprint: line is now overridable, so a standalone/named factory (the docs gardener, kept separate from the repo's main blueprint) points drift detection at the right file (.factory/docs-gardener.blueprint.json). Also fixed a real latent gap: sink.open_pr/sink.commit_files didn't grant Read/Edit/Write, so an agent could never actually change the files it was told to commit — never hit before because no prior template edits files then opens a PR. Now granted. 21 machine types (unchanged); 7-tab shell (added Docs); +~35 tests (209 total across 25 files), typecheck + prod build green (the build validates the outside-root _docs glob); Docs view browser-verified live.

2026-07-05 — ADR-017: Headless-CMS primitives from lifehacker.dev, on the claude-code-action core

Studied the real bamr87/lifehacker.dev fleet (16 workflows, a claude-run composite action, a Ruby OODA dispatcher, a loop-tuner feedback controller, default-OFF *_ENABLED repo-variable gates) to make GitFactory configure "an autonomous, configurable, headless CMS with feedback loops." Decision: adopt its governance/feedback/queue patterns as new machines + app concepts, but keep anthropics/claude-code-action@v1 as the runtime (rejected: refactoring the compiler to emit lifehacker's CLI-runner + ai.yml + raw-API fallback — a big rewrite of a tested core for no capability GitFactory lacks; and a per-blueprint runner toggle — 2× the emit paths/tests). What shipped: (1) gate.enablement — a default-OFF kill switch. The compiler emits a tiny gate job that checks a repo variable (vars.<NAME>) — and, for agent lines, that Claude auth exists — and the line job needs: gate + runs only on needs.gate.outputs.go == 'true'. An unset variable reads as idle, never as "safe to run." Flipping the variable arms/disarms a line instantly with no redeploy; a compromised agent can't re-arm itself (setting a variable needs an admin scope the fleet token lacks). The app reads/writes these via new client methods listVariables/getVariable/setVariable (values are readable, unlike secrets — that's what lets the Content tab show a line as armed/idle). (2) processor.feedback_controller (the loop-tuner) — a specialised agent (reuses the claude-code-action step) carrying a built-in contract: MEASURE the factory's own telemetry over a window → VERIFY the last change against an improvements ledger (.factory/metrics/improvements.yml + history.jsonl) → DIAGNOSE the upstream cause → make the SMALLEST change to a prompt/config → RECORD a new pending ledger entry (so the next run verifies it) → open exactly ONE PR. It is granted telemetry-read (gh run list/view, gh pr list), file edit (Read/Glob/Grep/Edit/Write), and PR-open (git + gh pr create) — and deliberately NOT gh pr merge (the no-self-merge invariant) or gh workflow. This is the headline "feedback loop." (3) Dry-run/apply duality — a trigger.manual "plan-first" mode exposes an apply boolean input; a manual run PLANS only unless ticked, while every non-manual event (schedule, workflow_run) applies (github.event_name != 'workflow_dispatch' || inputs.apply). Deterministic mutating sink steps gate on it; agent lines get a PLAN/APPLY prompt note that flips them to report-only on a dry run. (4) Central config + content backlog — .factory/config.yml (model/budget/voice/paths the agents honor at runtime — lifehacker's ai.yml idea, one place) and .factory/backlog.yml (a typed work queue: kind/priority/status, with starvation detection). Pure parse/serialize (content/model.ts), a content/ store, and a new Content tab cockpit (config form + backlog table + kill-switch toggles). PR-by-default writes; variable flips are instant. (5) Headless CMS template — stamps the whole loop: a daily+plan-first-manual content writer behind CONTENT_FACTORY_ENABLED (rate-limited → open PR a human merges) + a weekly loop-tuner behind LOOP_TUNER_ENABLED. Also fixed a parked correctness bug (ROADMAP): sink.open_pr/sink.commit_files granted only gh pr create — no git add/commit/push — so the obligation couldn't actually be met. toolsFor now grants the git verbs. 19 → 21 machine types; +45 tests (193 total), typecheck + prod build green. Verified against the live lifehacker.dev fleet (a research subagent read every workflow + the composite action + the Ruby dispatcher before any machine was designed — golden rule #4).

2026-07-05 — ADR-016: Five-tab app shell; device flow stays parked (CORS)

The frontend graduated from a single canvas to a five-tab shell (Build · Prompts · Monitor · Fleet · Settings), driven by a tiny state/ui store so any panel can deep-link. Each tab is a self-contained panel over its own store; the compiler/telemetry/deploy cores are untouched. Shipped: Prompt Studio (Phase 5 — browse/edit/lint/diff/PR-writes + cron-aware scheduling in Monitor), Monitor (Phase-4 remainder — per-line stats, jobs+steps drill-down, ▶ Run now / ✕ Cancel via new client dispatchWorkflow/cancelRun/listRunJobs), three new machines (gate.approval, rate.limiter, sink.cross_repo_issue — Phase 6 gates + Fleet C), a template gallery, undo/redo (blueprint snapshots, edit-burst coalescing), palette search, and Fleet B (multi-repo observe switcher via settings.recentRepos — slugs only, never tokens). Device flow (Phase 7) stays parked: verified GitHub's login/device/code endpoint serves no CORS headers to a browser origin, so a pure-static SPA cannot run device flow without the optional worker (ADR-004 Phase 2). PAT-in-sessionStorage remains the auth path; the Settings tab now surfaces the live preflight + connection switcher instead. Also parked: belt-mode typed handoffs (ADR-003 Phase 6.1) and the §8 red-team pass — both want a live scratch repo and their own session. Alt: a routed multi-page app (rejected — the shell is one store field; routing adds a dep for no gain on a single-view-at-a-time tool).

2026-07-05 — ADR-015: Merge policy lives in instructions and structure, never in agent discretion

Live incident during the first automerge runs: the Warden merged PR #5 (typescript 5.9→6.0, labelled dep:needs-review with two explicit "hold for a human" verdicts) and an earlier run double-posted a verdict despite the idempotency marker. Root cause: the compiled merge obligation said "Only merge when your assessment says it is safe" — inviting the agent's judgment ("CI is green, typecheck passes — that's exactly what the hold asked a human to check") to override the label policy in the operating prompt. When a capability grant and a prose guardrail disagree, a plausible-sounding reason wins often enough to be unsafe. Fixes: (1) the compiler's merge_pr obligation now subordinates judgment ("their guardrails override your own judgment: if they say hold, you hold") + regression test; (2) the warden prompt makes the label THE decision (re-assessment never authorizes a merge; only a human removing the label does) and forbids second verdict comments outright; (3) added sibling-recompute retry guidance (GitHub briefly flips other PRs to UNKNOWN after each merge — the cause of the one-merge-per-run behaviour that took 4 runs to drain 4 PRs). Outcome kept (user decision): TS 6 was verifiably green (PR CI, post-merge main CI, local typecheck+tests). Parked in ROADMAP: a deterministic label-gated merge line (pull_request:[labeled] trigger + filter + terminal merge sink) so merge policy compiles to YAML instead of prose — structure beats instructions.

2026-07-04 — ADR-014: Granular components — workflow_run trigger, merge_pr sink, dependabot_meta processor

Added three machines so flows like "auto-merge low-risk Dependabot updates" and "act on a workflow's pass/fail" are expressible. Three decisions, each verified against GitHub's live behaviour (golden rule #4 — confirmed via the Dependabot-automation docs before templating): (1) trigger.workflow_run is the trusted keystone. It runs on the default branch with a write token + secrets and is not attacker-loopy, so it carries no bot-guard — the secure way to act on a PR's CI result (incl. Dependabot/forks). Entity = github.event.workflow_run.pull_requests[0].number. (2) sink.merge_pr (gh pr merge --<method> [--auto]) is a terminal sink — merging emits no new comment/issue/PR event, so it can't retrigger its line. Terminal-only lines therefore drop the mandatory bot loop-guard (ADR-009 stays intact for content-writing lines), which is the ONLY way a pull_request-triggered line can act on Dependabot's bot-authored PRs. Grants contents+pull-requests: write; the compiler errors if there's no PR-bearing trigger and warns on an unscoped pull_request merge. (3) processor.dependabot_meta wraps dependabot/fetch-metadata@v2. Because fetch-metadata reads the pull_request event, this path is pull_request-triggered (NOT workflow_run), and its update-type gate must be a step-level if: on the merge step — job-level guards evaluate before any step runs, so steps.*.outputs aren't available there. The processor auto-scopes the line to pull_request.user.login == 'dependabot[bot]' (fetch- metadata is Dependabot-only). Verified: Dependabot pull_request runs DO honour the permissions: block for the GITHUB_TOKEN, so no pull_request_target (and its checkout-of- untrusted-code risk) is needed. Alt: route auto-merge through workflow_run too (rejected — fetch-metadata has no PR event there); a pull_request_target machine (rejected — security- sensitive, deferred). 10 invariant tests; both example flows compile clean (100 tests total).

2026-07-04 — ADR-013: Scheduled/manual agent lines get "survey mode" PR-discovery grants

A Dependency Warden (review the open Dependabot PRs, comment a verdict, label the safe ones) exposed a real gap: a pull_request-triggered line is the wrong tool for Dependabot, because (1) the compiler's mandatory bot loop-guard (github.event.sender.type != 'Bot', ADR-009) correctly refuses to fire for a bot actor, and (2) GitHub gives Dependabot pull_request runs a read-only token with no secrets, so CLAUDE_CODE_OAUTH_TOKEN wouldn't even be present. The right shape is a cron + manual line that runs in the base-repo context (full secrets, writable token, no bot-guard) — the same OODA-warden pattern lifehacker.dev uses. But such a line has no triggering entity, so it must discover its own work, and the existing cron grants (gh issue list, gh search issues) cannot see PRs — verified empirically: gh search issues forces type:issue and gh issue list excludes PRs. So the compiler now recognises survey mode (an agent line fired only by cron/manual — !hasIssueish && !hasPr && !hasComment) and grants read-only PR discovery/inspection (gh pr list/view/diff) plus, when a comment/label sink is downstream, the PR-scoped write tools (gh pr comment, gh pr edit) and pull-requests: write (PR comments/labels are governed by the pull-requests scope, not issues, even though gh routes through the shared number space). Still least-privilege: no gh pr merge/create/close, contents stays read. Consequence (accepted): the compiler can't read prompts, so any cron/manual comment/label agent (e.g. the nightly gardener) gets the issue+PR survey+write ceiling — the prompt narrows actual behaviour, the grant is a ceiling. Alt: a pull_request_target machine (rejected — security-sensitive trigger, later phase); Dependabot secrets scope (rejected — doesn't help the read-only GITHUB_TOKEN comment/label).

2026-07-04 — ADR-012: Agent auth defaults to Claude Code OAuth token, ANTHROPIC_API_KEY fallback

GitFactory's generated workflows (and the power hookup) now default to CLAUDE_CODE_OAUTH_TOKEN (from claude setup-token — a Claude Code subscription token) with ANTHROPIC_API_KEY as the fallback, matching the claude-run convention proven in lifehacker.dev. Verified against the live claude-code-action@v1 action.yml (golden rule #4): both claude_code_oauth_token and anthropic_api_key are optional inputs; the former is "an alternative to" the latter. The compiler emits BOTH, but the API key uses the expression ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN == '' && secrets.ANTHROPIC_API_KEY || '' }} so it is non-empty ONLY when the OAuth secret is unset — exactly one auth input is ever populated, avoiding any action-side precedence ambiguity and never sending both. The power-hookup UI provisions either secret (OAuth default), the power LED lights when either exists, and dev .env gains VITE_CLAUDE_CODE_OAUTH_TOKEN (build-guarded like the other secrets). Alt: pass only the OAuth token (rejected — breaks API-key users); pass both unconditionally (rejected — relies on unverified action precedence).

2026-07-04 — ADR-011: Observe mode reverse-imports workflows as a fleet map, not authoring machines

To make GitFactory plug-and-play against ANY repo (starting with the real, hand-built lifehacker.dev), added a read-only Observe mode that reverse-imports .github/workflows/*.yml. Key decision: do NOT decompose arbitrary workflows into the 13 authoring machine types — they use workflow_run chains, matrix fan-out, gate jobs, and a custom claude-run runner that don't fit and would misrepresent. Instead render one node per workflow with belts for workflow_run chains (intra-repo) and --repo issue-filing (cross-repo to external-repo "station" nodes). Why: faithful to how a real fleet actually works (event-driven between workflows), and it generalizes to any repo. The parser (fleet/parse.ts) is pure and total (never throws) and mixes YAML-structure reads with raw-text regex scans (robust across the shapes real workflows take); it correctly recovered lifehacker's pipeline → auto-* hub and cross-repo edges to zer0-mistakes/it-journey. Telemetry run-polling was generalized with a pathPrefix param (authored factory--* default; observe passes .github/workflows/). Each canvas now owns its own ReactFlowProvider (the shared one bled machine nodes into the fleet flow). A DEV-only __fleetStore window hook (tree-shaken from prod) enables tokenless UI smoke tests. Read-only per the user's "decide writes per-action later"; write paths (multi-repo, cross- repo authoring) are Phases B/C. Alt: shoehorn into authoring types (rejected: lossy).

2026-07-04 — ADR-010: Telemetry is ETag-polled and follows the open panel (MVP / seed 04)

Built the Phase-4 telemetry MVP. Shape decisions: (1) Poll, don't push. No webhook worker — client.listFactoryRuns does a conditional GET on /actions/runs with If-None-Match; a 304 is free, so a 15s interval stays cheap. (2) Poll only the open factory. Polling starts when the telemetry panel opens and stops when it closes or the repo disconnects (ARCHITECTURE §6 rate-hygiene) — no background polling. (3) Pure mapping split from I/O. github/telemetry.ts (LED/stats, 11 tests) is pure; the store just wires runs → assemblyLines(blueprint) → per-node LEDs. To map a factory--<slug> run back onto its machines, refactored the compiler to export assemblyLines() — one partition helper now shared by compile() and telemetry so filenames line up exactly. Scope: run list (conclusion/duration/link) shipped; jobs drill-down + log-zip viewing (fflate) and per-line stat rows deferred to backlog. Alt: webhook→SSE push (rejected for MVP — needs the optional worker, breaks the zero-backend premise).

2026-07-04 — ADR-009: Loop guards check the event actor (sender), not the entity author

Fixed the flagged issue_labeled loop-guard bug by making the compiler's bot guard actor-based: one github.event.sender.type != 'Bot' clause per loopy line, replacing the three entity-author checks (issue.user / pull_request.user / comment.user). Why: the author is only incidentally the actor for issues.opened; on issues.labeled the actor is the labeller and on pull_request.synchronize the actor is the pusher, so an agent's own label/push would pass an author check and retrigger the line (golden rule #6). sender is the account that caused the event, so sender.type == 'Bot' blocks every agent-authored write; the three cases collapse to one clause (equivalent for opened/comment, strictly correct for labeled/synchronize). For non-event runs (merged cron) github.event.sender is null and null != 'Bot' is true, so those runs still proceed. Regression tests cover labeled + synchronize; the reference output in examples/compiled/ was updated. Alt: patch only the labeled path (rejected — leaves the identical PR-synchronize hole and makes the guard logic non-uniform).

2026-07-03 — ADR-008: GitHub I/O via a thin fetch client + tweetnacl sealed box (MVP / seed 03)

Implemented the Phase-3 MVP (connect → load/deploy → power). Two shape decisions: (1) fetch, not Octokit. The transport client (app/src/github/client.ts) is a thin typed wrapper over fetch against api.github.com, not @octokit/rest. Why: keeps the static bundle lean, avoids Octokit's browser/ESM friction, and makes the whole client trivially mockable via an injected fetchImpl (17 unit tests, zero network). Cost: we hand-roll pagination/retries if ever needed (backlog). (2) tweetnacl sealed box (tweetnacl + tweetnacl-sealedbox-js) for the power hookup, per ARCHITECTURE §2 — encrypt ANTHROPIC_API_KEY in-browser against the repo public key and PUT it; plaintext is read from an uncontrolled input and never enters React state or storage. Architecture: a fixed contract (github/types.ts) let the client/crypto/deploy modules be built in parallel by separate agents; the pure planner (deploy.ts) is split from the I/O executor (execute.ts). Preflight approximates Workflows-write as equal to Contents-write (REST can't cheaply distinguish them); a failed deploy surfaces the real gap. Prompt-file writing is deferred to Prompt Studio (Phase 5) — deploy only warns on missing prompt refs. Alt considered: Octokit + libsodium-wrappers (rejected: heavier, wasm, harder to mock for a zero-backend static app).

2026-07-03 — ADR-007: Repo root is gitorio/; scaffold flattened up one level

The starter unpacked into gitorio/gitfactory/, leaving a duplicate CLAUDE.md, the session-0 blog post, and gitfactory-starter.zip stranded in the outer folder. Flattened gitfactory/* up so the git root is gitorio/ with app/, docs/, seeds/ as direct children. Why: the CI and Pages workflows hard-assume working-directory: app / cache-dependency-path: app/package-lock.json, the CLAUDE.md repo map lists everything at root, and "Gitorio" (Git + Factorio) is the product name. Removed the duplicate CLAUDE.md (byte-identical) and the starter zip; routed the draft: true blog post into blog/drafts/. Alt: git init inside the nested gitfactory/ (rejected: leaves a stray parent folder and forces every CI path to carry a gitfactory/ prefix). Then git init (branch main) — the scaffold had never been under version control.