gitorio¶
GitFactory's direction is to become the ultimate open home for all things GitHub automation: data, tools, resources and transparency, with visual blueprints that compile to auditable Actions workflows, a confirm-gated Harness Studio, and inspectable source for everyone (constitution §1).
What this repo is¶
Users drag machines onto a canvas, connect them with belts, and Deploy compiles the blueprint into factory--<slug>.yml workflows in the target repo. The frontend is fully static (GitHub Pages); GitHub is the database, the event bus and the compute layer. The app also observes and operates a fleet (Fleet Ops, the Harness tab against the bamr87 hub) and runs tokenless with ?demo=1. This repo dogfoods itself in .factory/. A change is done when it meets its spec's acceptance criteria, the gates below are green, generated files are regenerated rather than hand-edited, and the docs that describe it are updated in the same PR. Read docs/ARCHITECTURE.md before touching the compiler or auth.
Stack & commands¶
Node 22 (.nvmrc), Vite + React + @xyflow/react, TypeScript, Vitest, ESLint; stdlib Python 3 gates in tools/. All application code lives in app/.
cd app
npm install
npm run dev # vite dev server + HMR → http://localhost:5173
npm test # vitest — compiler invariant tests
npm run typecheck # tsc --noEmit
npm run lint # eslint
npm run build # typecheck + production build → app/dist
Repo gates (from the root; CI runs each of them):
python3 tools/spec_validator.py && python3 tools/backlog_lint.py # AO-SDLC gates (CI spec-gate)
python3 tools/unwrap-prose.py --check --exclude '(^|/)SCHEMA\.md$' --exclude '(^|/)CHANGELOG\.md$' --exclude '^vendor/'
python3 tools/docs_index.py --check # docs/README.md index is fresh
(cd app && npm run maps:check) # delivered maps match the IR (CI diagram-gate)
(cd app && npm run reference:check) # docs/reference/ matches the registry (also in npm test)
docker compose up dev # the same dev server in a container
Regenerate with cd app && npm run maps (maps), npm run reference (machine reference), npx vite-node scripts/regen-examples.ts (examples/compiled/), npx vite-node scripts/gen-docs-gardener.ts (the docs-gardener trio) and python3 tools/docs_index.py --write (docs index). docs/GENERATED-FILES.md lists every generated file.
Layout¶
| Path | What lives there |
|---|---|
app/ |
The static frontend. src/: compiler/ (pure compiler), machines/ (registry), github/ (client, deploy, telemetry), fleet/ (Fleet Ops engines + verbatim fixtures), archify/ (IR + colour vocabulary), map/ (in-app maps), ui/ (console primitives), harness/ (hub harness engine), demo/ (fixture client), state/. Also scripts/ (generators) and public/maps/ (generated) |
.factory/ |
This repo's own blueprints, prompts and config.yml — source, not output |
.github/workflows/ |
Hand-written CI/Pages/release/evolve workflows plus the compiled factory--*.yml lines |
schema/ |
blueprint.schema.json, drift-guarded against the registry |
examples/ |
Example blueprints and the compiled/ golden anchors |
docs/ |
Contributor docs, indexed in docs/README.md; reference/ is generated |
_docs/ |
The user-facing collection rendered in the app's Docs tab and tended by the Docs Gardener |
specs/ |
AO-SDLC spec packages NNN-slug/{spec,plan,tasks}.md + _template/ |
tools/ |
Stdlib gates: spec validator, backlog lint, picker, id-minter, evolve audit, unwrap-prose, docs index |
.claude/ |
Slash commands (AO-SDLC chain, /add-machine, /compile-check, /session-log), review agents, skills (archify, verify-feature), hooks |
vendor/archify/ |
Pinned tt-a1i/archify renderer (VENDOR.md records the commit) — never edit |
packages/ |
Two imported repos (git-with-the-program, gitnexus) with their own tooling; run commands inside each |
seeds/, blog/drafts/ |
Closed bootstrap-era prompts (history); session-log drafts headed for it-journey |
docs/DOCUMENTATION-MAP.md says which of docs/, _docs/, specs/ and blog/ new writing belongs in.
Conventions¶
- Backlog of record:
BACKLOG.md— append-onlyBL-YYYYMMDD-NNitems (mint withpython3 tools/next_backlog_id.py), declared asbacklog.mode: filein.github/sdlc.yml. Items move Open → Claimed → Done, never deleted. Not to be confused with.factory/backlog.yml, the product's content queue. - Definition of Done: the checklist in
.github/pull_request_template.mdplus golden rule #8 for a new machine type. - Decisions: ADR-lite entries appended to
docs/DECISIONS.md(ADR-001…043; date, decision, why, alternatives). The fleet-format ADR directorydocs/adr/(theadr_pathin.github/sdlc.yml) holds ADR 0001 and its index. - Session workflow: pick work with
python3 tools/pick_backlog_item.py(or file the user's request as aBL-*item), run/specify→/clarify→/plan→/tasks→/implementone task at a time (or/evolvefor a whole cycle), work to the acceptance criteria and nothing more, then/session-log.docs/AO-SDLC.mdhas the stages and gates. - Commits: Conventional Commits (
feat fix docs style refactor test chore perf ci build). Branches:feature/,fix/,docs/,refactor/,test/orchore/offmain. - Changelog:
CHANGELOG.mdis written by release-please (.github/workflows/release.yml); don't edit it by hand. - Markdown: one paragraph per line;
markdown-oneline.ymlrepairs a PR branch and fails a push tomain. - Never: push to
maindirectly, hand-edit a generated file, commit secrets, suppress type errors, or leave empty exception handlers.
The metaphor (use it consistently in code, UI copy and docs)¶
| Factory term | GitHub reality |
|---|---|
| Machine | A node: trigger, processor (Claude agent, filter, gate), or sink (comment, label, PR…) — every type is in docs/reference/machines.md |
| Belt | An edge: event/data flow between machines |
| Blueprint | The graph, stored as .factory/blueprint.json in the target repo (versioned, shareable as an encoded string) |
| Assembly line | One connected subgraph → one workflow file factory--<slug>.yml |
| Power | The Claude auth repo secret — CLAUDE_CODE_OAUTH_TOKEN (default) or ANTHROPIC_API_KEY (fallback); agent machines are greyed out without it |
| Telemetry | Actions run data polled from the API, rendered as machine status LEDs |
| Map | A rendered archify diagram of a line or a fleet — delivered under app/public/maps/ (npm run maps, ADR-034) and drawn live by app/src/map/ from the same IR |
| Passport | archify's Semantic Passport: the one proof surface a focused machine or workflow opens; there are no permanent side panels |
| Finder | archify's Node Finder: / opens it on the floor (add a machine) and on every map (focus a node) |
| Harness | The hub's six-layer model (guides, sensors, bounded loop, memory, permissions, observability). GitFactory designs it; the hub monitors it (_data/harness_health.yml); the Harness tab renders the hub's page from the same engine (ADR-036) |
| Lane | A fleet/v1 record of one line in fleet.manifest.yml — the interchange contract with the hub and wtd (packages/wtd/, spec in packages/wtd/docs/FLEET-SPEC.md); one HarnessCard draws it everywhere |
| Trip wire | One of the hub's six alarms (stale-data, pass-rate-floor, waste-ceiling, cost-spike, standing-failures, credential-overdue) — an attention item, never an action |
| Hub | The bamr87/bamr87 monorepo that presents and monitors the fleet; read-only from GitFactory — one persisted slug, never a token, never a write |
Architecture in ten lines¶
- Static React app (Vite +
@xyflow/react) — deployable to GitHub Pages, zero backend. - The canvas edits a Blueprint (JSON, schema in
schema/blueprint.schema.json). - The compiler (
app/src/compiler/compile.ts) is a pure function: Blueprint →{filename, yaml, diagnostics}[]. - Compiled workflows use
anthropics/claude-code-action@v1, authenticated byCLAUDE_CODE_OAUTH_TOKENonly for now — theANTHROPIC_API_KEYfallback is disabled (ADR-043). - Downstream sinks of an agent become its obligations (prompt contract) plus scoped
--allowedToolsgrants. - Trigger→sink chains with no agent compile to deterministic
ghCLI steps. - The app reads and writes blueprints, prompts and workflow files in target repos through the GitHub REST API (fine-grained PAT; GitHub App device flow is parked).
- Prompts live in the target repo at
.factory/prompts/*.md— reviewable, versioned, hot-editable without recompiling. - Monitoring polls workflow runs and issue/PR timelines with conditional requests (ETags); no server.
- Loop guards are compiler-enforced: an agent that writes comments never retriggers itself.
Golden rules¶
- The frontend stays static. No servers unless a spec introduces the optional webhook worker (Phase 7+). Everything works from GitHub Pages + APIs.
- The blueprint is the source of truth. Generated YAML carries a
GENERATED BY GITFACTORYheader + blueprint hash. Never hand-edit generated files; fix the compiler (or the generator) and regenerate. - The compiler is pure and tested. No I/O, no globals. Every machine type has invariant tests in
compile.test.tsthat assert critical YAML fragments, not full golden strings. - Verify, don't recall. Before changing anything that touches
anthropics/claude-code-action, fetch its currentaction.ymland docs from https://github.com/anthropics/claude-code-action (direct_prompt/allowed_toolsare deprecated →prompt/claude_args). Check https://docs.github.com/en/rest for Octokit endpoints when unsure. - Least privilege, always. Compiled workflows get a computed
permissions:block — only what the sinks need. Agent tools are narrow--allowedToolspatterns likeBash(gh issue comment:*), never blanket Bash. - Loop guards are mandatory. A workflow triggered by comments/issues that can also write comments/issues guards on the event actor (
github.event.sender.type != 'Bot', ADR-009). The compiler refuses to emit an unguarded feedback loop. - Secrets never touch the blueprint, the code, or localStorage. PATs live in
sessionStorageat most (or a DEV-only.envthe build refuses to bundle). Claude auth secrets are only${{ secrets.* }}in generated YAML, or provisioned through the encrypted-secret API (libsodium sealed box). - Definition of done for a new machine type: registry entry (
app/src/machines/registry.ts) + config fields + compiler emitter + invariant test + one sentence in thedocs/ARCHITECTURE.md§4 catalog +cd app && npm run reference+ it renders on the canvas./add-machinewalks the checklist. - Untrusted content is untrusted. Issue bodies, PR diffs and comments are attacker-controlled input to agents: pass entity numbers, not bodies (ADR-005); never widen tool grants to make a prompt work — tighten the prompt. Fork PRs get no secrets (ARCHITECTURE §8).
- End every session with
/session-log: a draft post inblog/drafts/(draft: true, with a Working-with-AI tip section) and a dateddocs/DECISIONS.mdentry if a decision was made or reversed. - The factory always grows forward (AO-SDLC). Non-trivial work enters as a
BL-*item, graduates to aspecs/NNN-slug/package, and every implement cycle ends with## Follow-ups Discoveredmirrored intoBACKLOG.md.tools/spec_validator.py+tools/backlog_lint.pyenforce this in CI (spec-gate) and through a blocking edit hook.
Invariants worth knowing¶
- Agents never merge (ADR-039):
sink.merge_prdownstream of an agent, or any merge-capable grant, is a compile error; merges are deterministic, label-gated lines (ADR-027). - Autonomous lines are default-OFF: each scheduled agent line sits behind a
gate.enablementrepo variable (*_ENABLED); unset means idle (ADR-017). The same convention gatesevolve.yml(EVOLVE_AUDIT_ENABLED). - Action versions are a compiler change: bump
PINNED_ACTIONSincompile.tsand regenerate; never accept a Dependabot edit to afactory--*.yml(ADR-033). - The demo is one substitution, not a mode:
app/src/demo/implementsGithubClientover fixtures; noif (demo)branch anywhere (ADR-032). - Design tokens live in
theme.cssonly: no colour literals elsewhere (theme.test.tsenforces it); machine tones come fromapp/src/archify/vocabulary.ts. - The hub is read-only: GitFactory persists the hub slug, never a token, and never writes to it (ADR-036).
Current status¶
Pre-alpha and dogfooding itself: canvas, compiler (28 machine types), GitHub connect + deploy, telemetry, Prompt Studio, the headless-CMS cockpit, Fleet Ops, the archify console and maps, the tokenless demo, and harness parity with the hub have shipped. Phase status and acceptance history are in docs/ROADMAP.md; every decision is in docs/DECISIONS.md; open work is in BACKLOG.md. Parked: the OODA dispatcher, belt mode (Phase 6.1) and the GitHub App device flow (Phase 7, blocked on browser CORS). Update this paragraph only when the headline status changes — history goes to ROADMAP and DECISIONS.
Fleet context¶
Member of the bamr87 fleet. The standards live in the hub: https://github.com/bamr87/bamr87/tree/main/specs (the Universal Project Standard). The repo's SDLC declaration is .github/sdlc.yml. gitorio is a submodule of bamr87/bamr87: commit and push here first; the hub bumps its pointer afterwards. Loops that act on this repo: the hub's fan-outs (standardize, sdlc and harness kits arrive as PRs), the shared standard-ci.yml and fleet-conformance.yml gates called from CI, the hub's daily fleet-pulse doctor (draft fix PRs for failing workflows), and this repo's own @claude handler, evolve.yml and kill-switched factory--* lines.
Standard deviations¶
none
Governance¶
Read docs/constitution.md before changing anything: it is the highest-precedence rule set here and wins over this file when they disagree. It changes only through a numbered record in docs/amendments/, ratified by the maintainer merging the PR; agents propose, never merge. Every user-facing feature has a stable id in features/features.yml with status, location and the PRD requirement ids it serves; the PRD's "Feature catalog" block is generated from it (python3 <bamr87/bamr87>/tools/governance_lint.py prd-sync . --write; check with … check .). Never hand-edit that block or CHANGELOG.md.