The Site Factory System Architecture,
Resources & Rule Guide

How Cloudflare D1 serves as our central Source of Truth and fenced service-lease coordinator while a home cluster of 3 Macs (Mac mini, Studio 1, Studio 2) autonomously researches, builds, tests, merges, deploys, and patrols 14 public websites local-AI first. Deep-dive explanations of all the concepts are in the Technology Glossary.

Four Departments and Their Roles

The Site Factory is organised like a company that collects and uses data to build and run several sites and services.

OperatorSets the purpose, the priorities and the policy

Planning

  • Director

    Turns policy and research results into what to work on next

  • Researcher

    Looks into user problems, new ideas and useful source material

Data

  • Data Collector

    Fetches source material, then stores and updates it together with its source and retrieval time

  • Data Curator

    Extracts, translates, classifies and normalises it into a reusable form

Development and Operations

  • Operations Coordinator

    Manages assignment, progress, stalls and the merging of changes across departments

  • Developer

    Implements, fixes and tests sites, features and the collection and curation programs

  • Release Manager

    Applies changes to the published sites and running systems

Quality

  • Reviewer

    Checks the content, sources, evidence and implementation of data and deliverables

  • QA

    Checks that systems work, and checks each site’s display, interactions, links and search-engine settings

Departments are a division of roles. The Operations Coordinator coordinates progress across departments. Several AIs or programs may share one role, but a ticket has one owner at a time. This does not add any new department heads, AIs or always-running processes.

Flow of data

Collect → store the source → curate → accumulate

The data lake is the shared store for source material and processed results. Data is collected independently of site production and used by both planning and development.

Flow of a product

Research and planning → development → review and QA → release → checks and improvement after publication

The Quality department checks data as well. Problems go back to the Developer or to a role in the Data department, and new improvement ideas go to the Director.

This chart shows areas of responsibility, not how many processes are running or whether a plan is finished. The terms are defined in Departments and Roles.

1. Overall System Architecture Diagram

Architecture diagram showing the Operator/MacBook, Cloudflare Workers/D1 Source of Truth and Private GitHub repos, the D1-leased Active-Standby management and inspection processes, the 3-Mac cluster and K104 3-tier AI execution pipeline, and the production websites. ① Operator, Dev & Dashboard Entry Operator / MacBook Policy & local dev Dashboard Zero Trust · static page AI Pre-Review (operator_review) Escalates to human only after frontier AI verification ② Central Source of Truth (Cloudflare Workers / D1 Database & Private GitHub Repos) Cloudflare Workers + D1 (honbu-dispatcher) • Source of Truth ledger (work_items), fenced leases & receipts • Service leases for the management and inspection processes • Local A2A stage tracking & direct-upload publication proofs • GitHub Webhook receiver & PR signal recording GitHub (All Repositories Private — Rule K96) • Factory repo: tickets, D1 projection, hand-offs • Site repos: PR branches → auto squash merge • Grok Bot: submits X test-taker voices via PRs (Issue #111) • Cloud Hand (Claude routine): stopped (a past path) ③ Management and Inspection Processes (on all 3 Macs · Active-Standby via D1 Service Leases) Operations Coordinator (patrol · 15m) • Deterministic traffic controller (no AI) • Reclaims stale tickets, merges PRs • Post-merge live URL check (deploy_check) Director (macgakari · 15m) • Planning & task queue dispatcher • Reads instructions & site plans • Queues jobs in D1; never runs AI itself Release Manager (unkou · 30m) • New site builder & Wrangler Direct Upload • Builds & deploys from ops/builds/ • Lists new sites on memocho.dev QA (site patrol & SEO) (6h / Weekly) • Health & SEO check of all sites • Rule checks + local LLM review • Weekly robots/sitemap/canonical ④ AI Escalation Order (Rule K104: Free Local Mac AI → Lightweight Cloud AI → Frontier Models Only with Evidence) Tier 1: Single-Shot Local AI All 3 Macs: Ollama (chosen by K100) Tier 2: Multi-Agent Local AI Studio 1⇄2: checks + Hermes review Tier 3: Lightweight Cloud AI Cursor Auto / Flash(low) / Codex Luna / Haiku Frontier (evidence only) Opus/high · Sol/high · Flash/high ⑤ 3-Mac Execution, Inference & Benchmark Cluster (1GbE Wired Switch + Wi-Fi Fallback · Restricted SSH) Mac mini (16GB · 256GB SSD) • mini-queue (heavy/light): daily site updates & AI island • Offloads heavy LLM inference to idle Studios via SSH • Small model benchmarks (6/day) & MLX Whisper ASR • 15 GitHub Self-hosted Runners (isolated $HOME) • 5 developer AIs resident (local/cursor/agy/codex/claude) * Excludes Tier 2 (Hermes A2A) to protect 16GB RAM Mac Studio 1 (M5 Max · 36GB · 512GB SSD) • Main benchmark rig (mac.lock pauses AI jobs) • Runs research & ticket reviews between benchmarks • Accepts borrowed jobs & remote inference from Mac mini • Tier 2 Hermes A2A host (27B–35B) + 5 developer AIs • Operational mail watcher & 3-Mac thermal/SSD monitor ★ Supports all AI tiers (Tier 1 through Tier 3) Mac Studio 2 (M5 Ultra · 96GB · 1TB SSD) • 96GB large-model benchmarks (up to 120B parameters) • step.lock keeps benchmarks apart from AI jobs • Tier 2 Hermes A2A host (cross-reviews with Studio 1) • 5 developer AIs resident (isolated honbu-agent-work dir) • Local inference engine for new-site research (Researcher) ★ 96GB: large LLMs & peer review ⑥ Production Websites (Global Edge Delivery via Cloudflare Workers → Live Verification & Evals Loop) Portal, Benchmarks & AI Island memocho.dev · llmonmac.com · town Public Data & Administrative Guide Sites (*.memocho.dev) hojokin · shikaku · furusato · kyoka · tsuri · wahori and more Live Verification & Evals Loop HTTP 200 · hash → traffic & revenue

2. The 6-Step End-to-End Task & Publication Loop

STEP 1

Discovery & Queueing

From operator instructions, site patrol findings, SEO audits, the Researcher’s findings, and benchmark queues, Director (macgakari) and the Operations Coordinator (patrol) register work items in the Cloudflare D1 Source of Truth (work_items) and Git tickets (ops/cloud/).

STEP 2

Fenced Reservation & Dispatch

Cloudflare Workers/D1 (honbu-dispatcher) checks machine availability, active benchmark locks (mac.lock / step.lock), and remaining AI quotas, assigning each task to a single Developer via a generation-numbered lease.

STEP 3

Local AI Execution First

Tasks are attempted first by free local LLMs on our Macs (Tier 1: direct Ollama calls or Tier 2: Hermes A2A across Studio 1 & 2). The model is selected automatically from the latest benchmark results for that specific Mac and task type (Rule K100).

STEP 4

Cloud Escalation & Receipt Verification

Only if local AI cannot solve the task does it escalate—with prior attempt logs attached—to Tier 3 lightweight cloud models (Cursor Auto / Gemini Flash low / Codex Luna / Claude Haiku). Upon completion, a deterministic script verifies artifact content hashes and records a receipt in D1.

STEP 5

Automated CI, Squash Merge & Deploy

When a pull request is opened, Mac mini’s isolated Self-hosted Runners execute the test suite. Once all checks pass, the Operations Coordinator (patrol) automatically squash-merges the PR into main and triggers production deployment.

STEP 6

Live Verification & Effect Measurement

A task transitions to done only after a script verifies HTTP 200 and content hashes on the live public URL. Newly launched sites are automatically added to memocho.dev, and post-launch traffic/revenue evaluations feed the next improvement cycle.

3. Five Key Architectural Innovations

To prevent common failure modes in autonomous multi-agent systems—single-machine bottlenecks, runaway API quota burn, and hallucinated “done” reports—the Site Factory is built around five core mechanisms:

① Active-Standby Resident Services via D1 Service Leases

Previously, over 40 launchd jobs ran solely on Mac mini (16GB), creating a single point of failure. Today, all 3 Macs (Mac mini, Studio 1, Studio 2) install the same resident services, and only the Mac that acquires the time-bounded D1 Service Lease runs that cycle. If one Mac is rebooting, sleeping, or running benchmarks, another idle Mac seamlessly takes over.

② Asymmetric 3-Tier AI Routing & Remote Inference Offloading

Running heavy 64K-context agent loops on a 16GB Mac mini causes swap thrashing. We separate execution into Tier 1 (fast single-shot Ollama across all Macs), Tier 2 (Hermes multi-agent A2A on 36GB/96GB Studios only), and Tier 3 (cloud AI). When a light job on Mac mini needs heavy LLM inference, it offloads just the inference call to an idle Studio over restricted SSH.

③ Deterministic Verification & Content-Hash Receipts

AI agents occasionally claim “tests passed” or “fixed” inaccurately. The Site Factory enforces deterministic Python verification for JSON schemas, row counts, math, forbidden link checks, and test suites. Even if an agent exits with code 0, the task cannot complete unless its cryptographic content-hash receipt passes verification.

④ Mutex Lock Coordination Between Benchmarks & Operations

Our Macs also serve as the hardware testbed for llmonmac.com. Because background AI jobs would skew tokens-per-second and memory measurements, active benchmarks acquire mac.lock (Studio 1) or step.lock (Studio 2) to pause other heavy AI workers cleanly until the measurement finishes.

⑤ Free-Tier Preservation & AI Pre-Screened Operator Escalation

To stay within GitHub Actions’ 2,000 free minutes/month and Cloudflare D1’s free tier, CI runs on 15 isolated self-hosted runners on Mac mini, and the dashboard is served as static Markdown without live DB queries on page view. When errors or holds occur, operator_review uses a frontier model to verify whether human action (such as entering a password or signing a contract) is truly unavoidable before notifying the operator.

4. Roles

Conversations, tickets and reports use these role names. The Reviewer checks content, evidence and implementation; QA checks actual behaviour and display.

DepartmentRoleWhat it does
—OperatorSets the purpose, the priorities and the policy
PlanningDirectorTurns policy and research results into what to work on next
PlanningResearcherLooks into user problems, new ideas and useful source material
DataData CollectorFetches source material, then stores and updates it together with its source and retrieval time
DataData CuratorExtracts, translates, classifies and normalises it into a reusable form
Development and OperationsOperations CoordinatorManages assignment, progress, stalls and the merging of changes across departments
Development and OperationsDeveloperImplements, fixes and tests sites, features and the collection and curation programs
Development and OperationsRelease ManagerApplies changes to the published sites and running systems
QualityReviewerChecks the content, sources, evidence and implementation of data and deliverables
QualityQAChecks that systems work, and checks each site’s display, interactions, links and search-engine settings

Even when the existing management processes of the Director, the Operations Coordinator and the Release Manager are placed on several Macs, only one runs per role at a time. A management process is distinct from the AI it asks to do the work. Example: Developer: Codex / runtime: Mac mini.

5. Hardware, Cloud & Model Resources

5-1. Hardware Cluster (4 Macs)

Machine (Host) Specs Primary Role Resident Services
Mac mini 16GB RAM · 256GB SSD
1GbE + Wi-Fi
24/7 shared queue, daily site updates & CI base. Runs daily data collection, AI Island progression, 15 self-hosted GitHub runners, small LLM benchmarks (6/day), and MLX Whisper speech recognition. mini-queue (heavy/light), Ollama, 15 GitHub Runners, D1-leased management and inspection processes, 5 developer AIs
Mac Studio 1 Apple M5 Max
36GB RAM · 512GB SSD
Primary LLM benchmark rig & mid-size local AI host. Runs 24/7 benchmarks for llmonmac.com, accepts offloaded inference from Mac mini, runs Hermes A2A with Studio 2, and monitors operational mail and hardware health. mac-llm-bench, mini-queue, Hermes A2A, mail-watch, hardware-watch, D1-leased management and inspection processes, 5 developer AIs
Mac Studio 2 Apple M5 Ultra
96GB RAM · 1TB SSD
Ultra-memory local AI & 120B benchmark powerhouse. Runs 96GB large-model benchmarks, Hermes A2A code generation and peer review, and the Researcher’s investigations. Large-model bench (step.lock), Hermes A2A, Researcher inference, D1-leased management and inspection processes, 5 developer AIs
MacBook
(Operator laptop)
Apple A18 Pro
8GB RAM · 512GB SSD
Operator console & key distribution entry point. Used by the human operator for instructions and registering new API keys into macOS Keychain for secure SSH sync. Runs zero local LLMs or background workers to prevent swap wear on 8GB RAM (Rule K04).

5-2. AI Model Cascade (Rule K104)

Tier (Priority Order) Models & Tools Where It Runs & Cost Selection & Escalation Rule
Tier 1
Single-Shot Local AI
Ollama (gemma4:12b, qwen3.5:4b/9b, MiniCPM5-2B, etc.) + mlx-whisper Mac mini / Studio 1 / Studio 2
(Electricity only · No quota limit)
Data extraction, classification, short summaries, structured JSON output, and ASR. Automatically selects the top-scoring model from recent benchmarks on that Mac (Rule K100).
Tier 2
Multi-Agent Local AI
Hermes Agent + 27B–120B models (qwen3.6:35b-a3b, qwen3.8:27b, gpt-oss:120b) Studio 1 (36GB) & Studio 2 (96GB)
(No quota limit)
Multi-file coding and cross-machine peer review (A2A), gated by deterministic Python checks first.
Tier 3
Lightweight Cloud AI
① Cursor (Auto)
② Antigravity (Gemini Flash low)
③ Codex (gpt-6-luna)
④ Claude Code (Haiku)
CLI runners across the 3 Macs
(Within flat-rate plan quotas)
Handles tasks unresolved by local AI or complex cross-repo changes, inheriting local attempt logs.
Frontier Tier
High-Capability Cloud AI
• Antigravity (Gemini Flash high)
• Codex (Sol high+)
• Claude Code (Opus high)
Available Mac runners
(Quota-protected)
Never used on the first try. Reserved strictly for: (1) verified escalations where Tier 3 failed, (2) new-site go/no-go reviews, and (3) final human-action screening (operator_review).

6. K-Numbers & Core Architecture Terms (All Terms →)

The Site Factory numbers its operational rules from K01 upward (K = “Kimari” [Rule], indexed in ops/rules_index.json) so the operator and agents can reference or revise rules by number. Deep-dive articles on all the concepts are available in our Technology Glossary.

Local LLM first → Lightweight cloud model → Frontier model only with verified evidence. Prevents burning cloud token quotas on tasks that local hardware can solve.

Selects local LLMs dynamically based on the latest empirical benchmark scores for that specific Mac and task category rather than hardcoding model names.

Cloudflare D1 is the single authoritative database for task state and leases. Files like ops/work/tasks.json and README tables in Git are read-only projections.

Time-bounded locks in D1 that determine which Mac runs the Operations Coordinator (patrol) and the other management processes. Each acquisition increments a monotonic generation number so stale writers are deterministically rejected.

A role that finishes a job must submit a cryptographic content-hash receipt and PR reference to complete a job, updated via CAS so concurrent writes never overwrite each other.

Before escalating an error or hold to the human operator, a frontier model inspects the logs to verify whether AI can resolve it autonomously or if human credentials/contracts are required.