|
1 | 1 | // SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | +// Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
2 | 3 | = Gitbot Fleet — Show Me The Receipts |
3 | 4 | :toc: |
| 5 | +:toclevels: 3 |
4 | 6 | :icons: font |
| 7 | +:author: Jonathan D.A. Jewell |
5 | 8 |
|
6 | | -The README makes claims. This file backs them up. |
| 9 | +The README makes claims. This file backs them up with architecture detail, |
| 10 | +code paths, and honest caveats sufficient for an external reviewer to trace |
| 11 | +what each bot does and how its work is gated. |
| 12 | + |
| 13 | +== Claim 1: "Automated, confidence-gated fixes across 500+ repositories" |
7 | 14 |
|
8 | 15 | [quote, README] |
9 | 16 | ____ |
10 | 17 | Bot fleet for repository quality enforcement across the Hyperpolymath ecosystem. |
11 | 18 | ____ |
12 | 19 |
|
| 20 | +=== How it works |
| 21 | + |
| 22 | +The fleet operates through a three-stage pipeline: |
| 23 | + |
| 24 | +[source] |
| 25 | +---- |
| 26 | +hypatia (scanner) → findings JSONL → fleet-coordinator.sh → dispatch-runner.sh |
| 27 | + ↓ |
| 28 | + ┌──────────┼──────────┐ |
| 29 | + ▼ ▼ ▼ |
| 30 | + rhodibot echidnabot sustainabot |
| 31 | + (git ops) (quality) (deps) |
| 32 | + ↓ |
| 33 | + robot-repo-automaton |
| 34 | + (scan → fix → commit → PR) |
| 35 | +---- |
| 36 | + |
| 37 | +`fleet-coordinator.sh` (root, 27K) is the execution layer. It reads findings |
| 38 | +JSONL from `shared-context/findings/`, determines the confidence tier for |
| 39 | +each finding, and dispatches accordingly. High-confidence patterns go to |
| 40 | +`dispatch-runner.sh` for automatic fix; lower-confidence patterns go to |
| 41 | +`process-review-findings.sh` for GitHub issue creation. |
| 42 | + |
| 43 | +=== Safety triangle |
| 44 | + |
| 45 | +The confidence thresholds that gate automated action are: |
| 46 | + |
| 47 | +[cols="1,2,2"] |
| 48 | +|=== |
| 49 | +| Tier | Threshold | Action |
| 50 | + |
| 51 | +| *Eliminate* |
| 52 | +| `auto_execute >= 0.95` |
| 53 | +| Direct fix applied, committed, no review gate |
| 54 | + |
| 55 | +| *Substitute* |
| 56 | +| `review >= 0.85` |
| 57 | +| Proven module replacement proposed; requires human review |
| 58 | + |
| 59 | +| *Control* |
| 60 | +| `< 0.85` |
| 61 | +| Human review required; issue created, no auto-change |
| 62 | +|=== |
| 63 | + |
| 64 | +The `confidence.rs` module in `robot-repo-automaton/src/` computes these |
| 65 | +scores. The design means the fleet will never auto-apply a fix it is less |
| 66 | +than 95% certain about. |
| 67 | + |
| 68 | +=== Code path for rhodibot |
| 69 | + |
| 70 | +`bots/rhodibot/src/main.rs` starts an Axum HTTP server on port 3000. GitHub |
| 71 | +sends webhook events; `webhook.rs` verifies the HMAC-SHA256 signature before |
| 72 | +dispatching. `rsr.rs` encodes the RSR (Rhodium Standard Repository) policy |
| 73 | +packs — Minimal / Standard / Strict / Enterprise / Custom — each with |
| 74 | +`Required`, `Recommended`, and `Optional` severity tiers. A check that is |
| 75 | +`Required` in the `Strict` pack blocks merge; the same check as `Recommended` |
| 76 | +in `Standard` only influences the score. |
| 77 | + |
| 78 | +=== Honest caveat |
| 79 | + |
| 80 | +The safety triangle is only as good as the confidence scores in |
| 81 | +`confidence.rs`. The scores are heuristic (pattern-matching-based), not |
| 82 | +formally verified. High-confidence fixes (>=0.95) can still be wrong if the |
| 83 | +pattern detector misfires. The `robot-repo-automaton` creates pull requests |
| 84 | +for review-tier findings rather than pushing directly to `main`, but the |
| 85 | +Eliminate tier applies fixes immediately. Any reviewer auditing this should |
| 86 | +inspect the pattern catalog in `robot-repo-automaton/src/catalog.rs` before |
| 87 | +trusting an automated fix. |
| 88 | + |
| 89 | +== Claim 2: "Each bot specializes in a specific aspect of repository health" |
| 90 | + |
| 91 | +[quote, README] |
| 92 | +____ |
| 93 | +Each bot specializes in a specific aspect of repository health and compliance. |
| 94 | +Six bots, six domains. |
| 95 | +____ |
| 96 | + |
| 97 | +=== How it works |
| 98 | + |
| 99 | +Each bot is a separate Rust binary in `bots/`. They share the `shared-context/` |
| 100 | +Rust crate for inter-bot communication (findings JSONL, session metadata, fix |
| 101 | +batches, learning state). |
| 102 | + |
| 103 | +[cols="1,3,2"] |
| 104 | +|=== |
| 105 | +| Bot | Specialisation | Implementation |
| 106 | + |
| 107 | +| *rhodibot* |
| 108 | +| RSR structural compliance: required files, workflows, SPDX headers, directory |
| 109 | +layout. Runs as a GitHub App (webhook listener + Axum server). Policy packs |
| 110 | +allow per-repo tuning. |
| 111 | +| `bots/rhodibot/src/rsr.rs` + `webhook.rs` |
| 112 | + |
| 113 | +| *echidnabot* |
| 114 | +| Formal proof CI: verifies Coq/Lean/Agda/Isabelle proofs on every push. |
| 115 | +Bridges code forges to the ECHIDNA theorem proving platform. Also runs |
| 116 | +security fuzzing as a secondary function. |
| 117 | +| `bots/echidnabot/` (full Rust workspace with benches, fuzz, tests) |
| 118 | + |
| 119 | +| *sustainabot* |
| 120 | +| Ecological + economic + quality analysis. Computes a multi-dimensional |
| 121 | +Health Index covering energy heuristics, cost signals, and maintainability. |
| 122 | +Outputs SARIF for toolchain integration. |
| 123 | +| `bots/sustainabot/` (modular Rust workspace) |
| 124 | + |
| 125 | +| *glambot* |
| 126 | +| Presentation quality: visual polish, WCAG accessibility, SEO, machine |
| 127 | +readability for AI/bots. Checks alt text, heading hierarchy, colour contrast, |
| 128 | +Open Graph metadata. |
| 129 | +| `bots/glambot/` |
| 130 | + |
| 131 | +| *seambot* |
| 132 | +| Integration health: cross-component communication, API contracts, end-to-end |
| 133 | +flows. Verifies that advertised integrations are actually wired. |
| 134 | +| `bots/seambot/` |
| 135 | + |
| 136 | +| *finishingbot* |
| 137 | +| Release readiness: placeholder removal, license validation, claim verification, |
| 138 | +execution testing. Gates the path from draft to publishable. |
| 139 | +| `bots/finishingbot/` |
| 140 | +|=== |
| 141 | + |
| 142 | +Additional bots present in `bots/`: `accessibilitybot`, `cipherbot`, `panicbot` |
| 143 | +(pre-commit gate wrapping panic-attacker), `gsbot` (game-server integration), |
| 144 | +`the-hotchocolabot` (onboarding/warmth checks). |
| 145 | + |
| 146 | +== Dogfooded Across The Account |
| 147 | + |
| 148 | +[cols="1,2,2"] |
| 149 | +|=== |
| 150 | +| Technology | Role in Gitbot Fleet | Also Used In |
| 151 | + |
| 152 | +| *Rust* (rhodibot, echidnabot, sustainabot, shared-context, robot-repo-automaton) |
| 153 | +| Primary implementation language for all bots |
| 154 | +| protocol-squisher, verisimdb, ephapax, Stapeln FFI |
| 155 | + |
| 156 | +| *Hypatia* |
| 157 | +| External scanner whose JSONL findings feed fleet-coordinator.sh |
| 158 | +| Every RSR repo in the account; gitbot-fleet is a primary consumer |
| 159 | + |
| 160 | +| *Axum* |
| 161 | +| HTTP server for GitHub App webhook handlers (rhodibot, echidnabot) |
| 162 | +| Shared pattern with burble, boj-server |
| 163 | + |
| 164 | +| *Bash* (`fleet-coordinator.sh`, `dispatch-runner.sh`, 7 fix scripts) |
| 165 | +| Execution glue; `set -euo pipefail` throughout |
| 166 | +| infrastructure-automation, git-scripts |
| 167 | + |
| 168 | +| *ECHIDNA* (proof verification platform) |
| 169 | +| echidnabot's backend prover |
| 170 | +| `echidna` repo; neural-foundations neurosymbolic layer |
| 171 | + |
| 172 | +| *robot-repo-automaton* |
| 173 | +| Rust CLI: scan → detect → fix → PR (lives inside this repo) |
| 174 | +| Shared by all bots for automated fix application |
| 175 | + |
| 176 | +| *Stapeln containers* |
| 177 | +| `stapeln.toml` + Containerfile for bot deployment |
| 178 | +| All containerised services in the account |
| 179 | + |
| 180 | +| *Contractile.just* |
| 181 | +| `contractile.just` + `contractiles/` — shared build recipes |
| 182 | +| Universal across hyperpolymath repos |
| 183 | + |
| 184 | +| *jq* |
| 185 | +| All JSON construction in shell scripts uses jq (never string interpolation) |
| 186 | +| git-scripts, infrastructure-automation |
| 187 | +|=== |
| 188 | + |
13 | 189 | == File Map |
14 | 190 |
|
15 | | -[cols="1,2"] |
| 191 | +[cols="1,3"] |
16 | 192 | |=== |
17 | | -| Path | What's There |
| 193 | +| Path | What It Proves |
| 194 | + |
| 195 | +| `fleet-coordinator.sh` |
| 196 | +| 27K Bash entry point. Reads `shared-context/findings/` JSONL, computes |
| 197 | +confidence tiers, dispatches to `dispatch-runner.sh` (Eliminate tier) or |
| 198 | +`process-review-findings.sh` (Substitute tier), or creates issues (Control |
| 199 | +tier). The orchestration logic lives entirely here. |
| 200 | + |
| 201 | +| `run-fleet.sh` |
| 202 | +| 24K Bash launcher for running the full fleet in sequence or parallel. |
| 203 | +Wraps `fleet-coordinator.sh` with setup, teardown, and reporting. |
| 204 | + |
| 205 | +| `bots/rhodibot/src/` |
| 206 | +| `main.rs` — Axum server, CLI parse. |
| 207 | +`rsr.rs` — Policy packs (Minimal/Standard/Strict/Enterprise/Custom) and |
| 208 | +severity (Required/Recommended/Optional). The RSR rule definitions. |
| 209 | +`webhook.rs` — HMAC-SHA256 verification of GitHub events. |
| 210 | +`github.rs` — GitHub API client. |
| 211 | +`sanitize.rs` — Input sanitisation before any repo operation. |
| 212 | + |
| 213 | +| `bots/echidnabot/` |
| 214 | +| Full Rust workspace. `src/` contains the prover bridge and CI integration. |
| 215 | +`fuzz/` contains fuzzing targets. `benches/` benchmarks proof verification. |
| 216 | +Proof verification is the critical path for formally verified repos. |
| 217 | + |
| 218 | +| `bots/sustainabot/` |
| 219 | +| Modular Rust workspace. CLI → static analysis engine → metrics/scoring → |
| 220 | +SARIF output → policy integration. Health Index computation lives in the |
| 221 | +metrics module. |
| 222 | + |
| 223 | +| `bots/glambot/` |
| 224 | +| Accessibility and presentation checks. WCAG contrast, alt text, heading |
| 225 | +hierarchy, Open Graph, machine-readability for AI indexers. |
| 226 | + |
| 227 | +| `bots/seambot/` |
| 228 | +| Integration health checks. Verifies API contracts and end-to-end wiring. |
| 229 | + |
| 230 | +| `bots/finishingbot/` |
| 231 | +| Release gate: placeholder scanning, license validation, execution tests. |
| 232 | + |
| 233 | +| `robot-repo-automaton/src/` |
| 234 | +| `main.rs` — CLI entry (scan/fix/PR subcommands). |
| 235 | +`detector.rs` — Pattern detection against the catalog. |
| 236 | +`catalog.rs` — Authoritative list of auto-fixable patterns with confidence. |
| 237 | +`confidence.rs` — Confidence score computation (the safety gate). |
| 238 | +`fixer.rs` — Applies fixes to filesystem. |
| 239 | +`github.rs` — PR creation. |
| 240 | +`hypatia.rs` — Reads Hypatia JSONL findings as additional signal. |
| 241 | + |
| 242 | +| `shared-context/` |
| 243 | +| Rust crate providing inter-bot communication primitives: findings JSONL |
| 244 | +schema, session metadata, fix batches, learning state, deployment status. |
| 245 | +All bots import this crate. |
| 246 | + |
| 247 | +| `shared-context/findings/` |
| 248 | +| Live JSONL findings from the most recent Hypatia scan. Fleet-coordinator |
| 249 | +reads this directory. |
| 250 | + |
| 251 | +| `shared-context/learning/` |
| 252 | +| Accumulated pattern data used to refine confidence scores over time. |
| 253 | + |
| 254 | +| `campaigns/` |
| 255 | +| Batch-mode campaign definitions for scanning entire repo subsets at once. |
| 256 | + |
| 257 | +| `dashboard/` |
| 258 | +| Completion dashboard and fleet status views. |
| 259 | + |
| 260 | +| `hooks/` |
| 261 | +| Git hooks installed into repos by the fleet to enforce pre-commit checks. |
| 262 | + |
| 263 | +| `scripts/` |
| 264 | +| `dispatch-runner.sh` — Eliminate-tier fix execution. |
| 265 | +`process-review-findings.sh` — Substitute-tier issue creation. |
| 266 | +`fix-*.sh` — Seven idempotent fix scripts for specific patterns. |
| 267 | + |
| 268 | +| `deploy/` |
| 269 | +| Deployment manifests and container launch configs. |
| 270 | + |
| 271 | +| `tasks/` |
| 272 | +| Scheduled task definitions. |
| 273 | + |
| 274 | +| `tests/` |
| 275 | +| Integration tests for the fleet coordinator and individual bots. |
| 276 | + |
| 277 | +| `.machine_readable/` |
| 278 | +| A2ML checkpoint files. Canonical AI session state. |
| 279 | + |
| 280 | +| `.hypatia/` |
| 281 | +| Hypatia rule overrides and scan configuration. |
| 282 | + |
| 283 | +| `TOPOLOGY.md` |
| 284 | +| Visual architecture map with completion dashboard. Start here for the |
| 285 | +big-picture relationship between bots. |
| 286 | + |
| 287 | +| `BOT-OPERATIONS.md` |
| 288 | +| Operational runbook for running the fleet in production. |
18 | 289 |
|
19 | | -| `test(s)/` | Test suite |
| 290 | +| `DOGFOODING-ANALYSIS.md` |
| 291 | +| Record of where each bot has been run against the hyperpolymath estate |
| 292 | +and what patterns it found. |
20 | 293 | |=== |
21 | 294 |
|
22 | 295 | == Questions? |
23 | 296 |
|
24 | | -Open an issue or reach out directly — happy to explain anything in more detail. |
| 297 | +Start with `TOPOLOGY.md` for the big picture, then `fleet-coordinator.sh` |
| 298 | +for the execution logic, and `robot-repo-automaton/src/confidence.rs` for |
| 299 | +the safety gate. For individual bot details, each `bots/<name>/README.adoc` |
| 300 | +has its own explanation. |
0 commit comments