Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-architecture-mv/blob/main/docs/research/repo-topology-unix-vs-monorepo-vs-hybrid.md # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-architecture-mv / docs / research / repo-topology-unix-vs-monorepo-vs-hybrid.md` 77 lines ยท 16025 bytes Raw Blame History Source # Repository topology: many small repos, one monorepo, or a hybrid Date: 2026-10-16. Question from Drake: is a Unix-style GitHub setup (many small repositories, one per tool) more efficient long term, or a monorepo, or a hybrid (one core repo with adapters and modules in separate repos)? Labels: claims marked UNVERIFIED could not be confirmed from a primary source. "Inference" means my reasoning from the cited facts. Local facts come from the read-only clones under `~/workspace/pipeline/clones/`. ## 1. What "Unix-style" actually means - The authors state the style as rules about programs, not repositories. The 1978 foreword says: "Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new features," and "Expect the output of every program to become the input to another, as yet unknown, program" (McIlroy, Pinson, Tague, BSTJ 57(6), p. 1902 ). - Pike and Kernighan (1984) say the same: the power comes from programs "easy to combine with other programs," and they complain that old programs became "encrusted with dubious features" (Program Design in the UNIX Environment ; this is a hosted copy of the original paper, bibliographic record at Princeton ). - The systems that carry this tradition ship as one tree. FreeBSD's top-level README describes "the top level of the FreeBSD source directory" with `bin`, `lib`, `sbin`, `stand` and more in one repository (freebsd-src README ). The Linux kernel documentation tells driver authors to get their code into the main tree: if an interface changes "it will be fixed up by the person who did the kernel change in the first place," and Linux deliberately has no stable in-kernel interface (stable-api-nonsense.rst ). - Early research Unix as one source tree: UNVERIFIED (I did not find a first-party statement). Settled point: Unix-style means small composable programs with clean interfaces. It does not require one repository per program. The two best-known Unix descendants keep everything in one tree on purpose, and the kernel doc argues that a stable boundary is exactly what you do not want between pieces you control. ## 2. Monorepo: stated benefits and costs - Google: one repository, built with custom tools. The 2016 paper by Potvin and Levenberg weighs "advantages and trade-offs" of a single repository (Google Research page and abstract ; I could not retrieve the paper's full text, so the paper's own numbers and trade-off list are UNVERIFIED here). - Google's later first-party book states the benefit and cost I can verify. The "One-Version Rule" says "for every dependency in our repository, there must be only one version of that dependency to choose," and violations "lead to merge strategy discussions, diamond dependencies." Cost: Google runs an in-house centralized system (Piper) at "more than 80 TB," "60,000 to 70,000 commits to the repository per work day," and says "most existing tools don't scale well with 50,000 engineers and tens of millions of commits." It also says the monorepo is not "the perfect answer for everyone" and that fine-grained repositories "are easier to deal with in terms of scale" (Software Engineering at Google, ch. 16 ). - rust-lang/rust is a mixed model. Its `.gitmodules` lists submodules such as cargo, the language book, and llvm-project, while `src/tools` holds many tools in-tree. The compiler team's rule: "use subtrees for tools that depend on compiler internals and need to be updated if there are breaking changes," submodules for tools independent of the compiler. Clippy uses git subtree; Miri, rust-analyzer, rustfmt and others use josh, which "scales better to larger repositories" but needs special tooling. Subtrees can go wrong with a wrong prefix, and rebasing a subtree pull is "a bad idea in general" (rustc-dev-guide, External Repos ). - Chromium: a core repository plus pinned external dependencies. Root `DEPS` holds URLs and hashes, `gclient` fetches them, new dependencies must be mirrored on Google-hosted git, and there is no built-in delete command (Chromium: Managing dependencies ; gclient : "The URL typically contains a specific revision"). This is a hybrid, not a pure monorepo. - Nixpkgs: one repository of "over 140,000 software packages," while Nix itself, NixOps and nixos-hardware are separate repositories (nixpkgs README ). Also a hybrid. Pattern across all four: the big projects keep the tightly coupled body in one tree and put loosely coupled or independently released things outside, tied by pins. ## 3. Mechanisms and their documented limits - Submodules record a commit of another repository inside a superproject (git-submodule ). Subtree copies another project into a subdirectory, optionally with history, and `--squash` imports one commit instead (git-subtree ). - Sparse checkout narrows the working tree, but git's own page says the command is experimental and its behavior "will likely change" (git-sparse-checkout ). Partial clone skips objects you do not need (partial-clone design notes ). Neither is needed at my size (section 4). - Cargo: all workspace members share one `Cargo.lock` and one `target` directory (Workspaces ). Git dependencies take a `rev` (Specifying dependencies ). `cargo vendor` copies "all crates.io and git dependencies" into a local folder (cargo vendor ). `--locked` demands the exact versions in `Cargo.lock`; `--offline` forbids network access; `--frozen` is both (cargo build ). My judge sandbox cannot fetch git dependencies, so any git dependency needs vendoring. Path dependencies inside one workspace need none of that (inference; sovereign-core already uses `path =` dependencies between its crates). - GitHub, retired names. Transfer docs: if the repository "had more than 100 clones or more than 100 uses of GitHub Actions in the week prior to the transfer" (or contains a Marketplace action), GitHub "permanently retires the owner name and repository name combination," and reuse gives "has been retired and cannot be reused" (Transferring a repository ). The rename page says old names redirect, and creating a new repository with the old name breaks the redirect, but it does not mention retirement (Renaming a repository ). Whether a rename retires the old name: UNVERIFIED. - GitHub, checks and paths. Required status checks must be successful, skipped or neutral to merge (protected branches ). A workflow skipped by a `paths` filter leaves its checks "Pending" and "a pull request that requires those checks to be successful will be blocked" (workflow trigger reference ). Required checks are configured per branch; I found no per-path required check in the docs (UNVERIFIED that none exists). Rulesets layer on a branch, and "the most restrictive version of the rule applies" (About rulesets ). CODEOWNERS files must stay under 3 MB (About code owners ); with one human owner it adds little. - GitHub, size guidance: on-disk size 10 GB, push size enforced at 2 GB, one merged PR per minute, 1,000 open PRs against the same branch (Repository limits ). The same page warns each merge triggers mergeability checks for all open PRs. - History import: `git filter-repo --to-subdirectory-filter ` rewrites a repository so its root sits under a directory (git-filter-repo manual ); git's own docs now point to filter-repo instead of filter-branch (README ). `git subtree add` joins imported history to yours. - Moving open PRs: GitHub documents transfer for issues only (transfer an issue ). I found no documented way to move a pull request to another repository, so PRs must be re-pushed and reopened (inference; UNVERIFIED that no tool exists). ## 4. What my own judge already does (local facts) - Per-path gating already exists. Each `tests/gates/*.gate` declares `inputs:` (repo-relative paths) and `cache_scope`. The cache key covers "git blob ids of every file under inputs" (aien-architecture `docs/adr/0033-aien-verification-pipeline.md`, Decision 3 "Check identity"; ADR 0028 covers cache reuse). The planner maps changed paths to manifests and a path that matches nothing gives NOT_RUN, never PASS (ADR 0033 Decision 12 and the later corrections). So a monorepo needs no new path-gating idea. - Where it leaks: siblings. `tools/aien-local-ci/siblings` in aien-sovereign-core has 14 sibling lines. Each checks out another repository at a branch tip ("the worker takes refs/remotes/origin/ as the clone has it at run start"), mostly `main`. A moving branch is outside the cache key unless a `*.lock` pin changes (ADR 0033 Decision 12). That is the drift source, in the design itself. - The coupling graph from that file: architecture, omega, physics, aienos, sovereign-core and protocols depend on each other, including a loop (architecture needs omega, omega needs architecture). aegis-runtime, spark-rsi and benchmarks depend one way on that core and nothing in the map depends on them. interplane has no entry. Synapse is pinned by architecture through a `HARD_PIN` (reported by Drake; I did not find that file in the local clones, UNVERIFIED). - A change that spans a loop needs two pull requests in two repositories, merged in the right order (inference). In one repository it is one pull request judged once. - Size is tiny for git: the 11 local clones hold 2491 commits (calc:`6747ead3d012cc303231fc0e4ceb38e48205115090773d52322f7e8ef7ecc986`) and about 234 MB of `.git` data (calc:`57b996def26f85400c5d687a3a9437eae80be7c9426e9191f98a7037f4c0218f`), against GitHub's 10 GB guidance. The other repositories (for example open-humanity) are not cloned locally, so those figures are partial. - What a monorepo would break: pipeline configuration is read from the repo-root `tests/gates/` (`tools/aien-test/src/plan.rs`), and each repository has its own `tests/gates/run.sh`. Eleven repositories moved into subdirectories would collide on that name, or the runner would need nested gate roots. I did not read the discovery code, so whether nested roots work today is UNVERIFIED. Expect a code change in aien-test. ## 5. The three options for me A. Many repositories, as today. - Migration: none. - Ongoing: pin drift, the siblings map, vendoring scripts (the synapse-coord copy), two-PR changes across the core loop. - Risk: the drift days continue. The core loop gets worse as more cross-repo gates are added. - Simpler: independent history and permissions, one clear name per tool, no names burned. B. One monorepo. - Migration: `filter-repo --to-subdirectory-filter` per repository, then merge the unrelated histories; history is preserved. The roughly 60 open PRs are re-pushed and reopened. Gate roots, `siblings` paths, `omega.lock`-style pins and CI contexts are redone. - Ongoing: one required check gates everything (fine, because the judge computes the plan; do not use GitHub `paths` filters, which leave required checks Pending). All PR traffic lands on one `main`, so the one-merge-per-minute and merge-triggers-rechecks guidance matters if "up to date" is required. - Risk: one name chosen forever (retirement rule), a bigger blast radius for a bad merge, outside contributors to INTERPLANE and benchmarks face a large repo, and every repository's AGPL and ownership history is merged together. - Simpler: pins, siblings map, vendoring and cross-repo ordering disappear for everything inside. C. Hybrid: core monorepo plus attachments. - Core (the loop): aien-architecture, omega, physics, aienos, aien-sovereign-core, aien-protocols. Attachments: interplane, benchmarks, spark-rsi, synapse, open-humanity; aegis-runtime is a judgment call (one-way dependency on protocols, so it can go either way). - Migration: B's work for six repositories only; attachments keep their history and PRs. Attachment pins to the core stay, but only at the boundary, one pin file per attachment. - Ongoing: the siblings map shrinks from 14 lines to the attachment edges (aegis-runtime, spark-rsi, benchmarks: three one-way lines). This matches how Rust, Chromium and Nixpkgs are organized (section 2). - Risk: choosing a wrong boundary; the cure is cheap because attachments are leaves. - Simpler: the cyclic part, where days were lost, becomes one atomic change. ## 6. Recommendation Option C, staged, and decided before the `-mv` suffixes are dropped: the retirement rule makes names the one irreversible thing, so fix the final names first (inference from the transfer doc; whether rename also retires is UNVERIFIED). Smallest reversible first step: build the core monorepo locally only, in a scratch directory, with `filter-repo` on throwaway copies of the six core clones. Run `aien-test plan` against it and record what breaks (gate roots, sibling paths, run.sh collisions). Nothing is pushed, no GitHub name is used, and deleting the directory undoes it. The result is a measured migration cost to put in front of Drake. Until then, the cheap fix for option A pain is to make every sibling a pinned commit instead of `main`, so the cache key moves when a sibling moves (ADR 0033 Decision 12 already invalidates on a moved pin). ## Sources All links are inline above. Secondary or partial: the Google CACM paper (only the abstract page was retrievable; paper figures not used). The Pike and Kernighan PDF is a third-party hosted copy of the original.