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 Rendered 1 # Repository topology: many small repos, one monorepo, or a hybrid 2 3 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)? 4 5 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/`. 6 7 ## 1. What "Unix-style" actually means 8 9 - 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](https://archive.org/details/bstj57-6-1899)). 10 - 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](http://harmful.cat-v.org/cat-v/unix_prog_design.pdf); this is a hosted copy of the original paper, bibliographic record at [Princeton](https://collaborate.princeton.edu/en/publications/the-unix-system-program-design-in-the-unix-environment/)). 11 - 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](https://github.com/freebsd/freebsd-src/blob/main/README.md)). 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](https://github.com/torvalds/linux/blob/master/Documentation/process/stable-api-nonsense.rst)). 12 - Early research Unix as one source tree: UNVERIFIED (I did not find a first-party statement). 13 14 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. 15 16 ## 2. Monorepo: stated benefits and costs 17 18 - 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](https://research.google/pubs/why-google-stores-billions-of-lines-of-code-in-a-single-repository/); I could not retrieve the paper's full text, so the paper's own numbers and trade-off list are UNVERIFIED here). 19 - 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](https://abseil.io/resources/swe-book/html/ch16.html)). 20 - rust-lang/rust is a mixed model. Its [`.gitmodules`](https://github.com/rust-lang/rust/blob/master/.gitmodules) lists submodules such as cargo, the language book, and llvm-project, while [`src/tools`](https://github.com/rust-lang/rust/tree/master/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](https://rustc-dev-guide.rust-lang.org/external-repos.html)). 21 - 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](https://chromium.googlesource.com/chromium/src/+/main/docs/dependencies.md); [gclient](https://chromium.googlesource.com/chromium/tools/depot_tools/+/HEAD/README.gclient.md): "The URL typically contains a specific revision"). This is a hybrid, not a pure monorepo. 22 - Nixpkgs: one repository of "over 140,000 software packages," while Nix itself, NixOps and nixos-hardware are separate repositories ([nixpkgs README](https://github.com/NixOS/nixpkgs/blob/master/README.md)). Also a hybrid. 23 24 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. 25 26 ## 3. Mechanisms and their documented limits 27 28 - Submodules record a commit of another repository inside a superproject ([git-submodule](https://github.com/git/git/blob/master/Documentation/git-submodule.adoc)). Subtree copies another project into a subdirectory, optionally with history, and `--squash` imports one commit instead ([git-subtree](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.adoc)). 29 - 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](https://github.com/git/git/blob/master/Documentation/git-sparse-checkout.adoc)). Partial clone skips objects you do not need ([partial-clone design notes](https://github.com/git/git/blob/master/Documentation/technical/partial-clone.adoc)). Neither is needed at my size (section 4). 30 - Cargo: all workspace members share one `Cargo.lock` and one `target` directory ([Workspaces](https://doc.rust-lang.org/cargo/reference/workspaces.html)). Git dependencies take a `rev` ([Specifying dependencies](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html)). `cargo vendor` copies "all crates.io and git dependencies" into a local folder ([cargo vendor](https://doc.rust-lang.org/cargo/commands/cargo-vendor.html)). `--locked` demands the exact versions in `Cargo.lock`; `--offline` forbids network access; `--frozen` is both ([cargo build](https://doc.rust-lang.org/cargo/commands/cargo-build.html)). 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). 31 - 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](https://github.com/github/docs/blob/main/content/repositories/creating-and-managing-repositories/transferring-a-repository.md)). 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](https://github.com/github/docs/blob/main/content/repositories/creating-and-managing-repositories/renaming-a-repository.md)). Whether a rename retires the old name: UNVERIFIED. 32 - GitHub, checks and paths. Required status checks must be successful, skipped or neutral to merge ([protected branches](https://github.com/github/docs/blob/main/content/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches.md)). 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](https://github.com/github/docs/blob/main/data/reusables/actions/workflows/triggering-a-workflow-paths2.md)). 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](https://github.com/github/docs/blob/main/content/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets.md)). CODEOWNERS files must stay under 3 MB ([About code owners](https://github.com/github/docs/blob/main/content/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners.md)); with one human owner it adds little. 33 - 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](https://github.com/github/docs/blob/main/content/repositories/creating-and-managing-repositories/repository-limits.md)). The same page warns each merge triggers mergeability checks for all open PRs. 34 - History import: `git filter-repo --to-subdirectory-filter