Skip to content

Linked Repos

Mehmet Nuraydın edited this page Jul 19, 2026 · 1 revision

Linked Repos

Federation reads across brains; Brain Cloud Sync shares one brain. Linked Repos is the third collaboration axis, and it points the other way — at code. A brain often coordinates a family of products that each live in their own repository, cloned to different paths on each person's machine (and sometimes not cloned at all). Linked Repos lets one brain govern those repos without owning or syncing them: it is a registry of pointers, not a pipe. link add runs no network at all — it never clones, pushes, pulls, or commits the target.

The design follows the same shared-vs-machine-local split as everything else. The shared half — {name, gitRemoteUrl} per repo — lives in .config.json and travels with the brain, so every teammate learns that a governed repo exists and what its canonical GitHub URL is. The machine-local half — a url → absolute path map — lives in ~/.dreamcontext/linked-repos.json, in your home directory outside every repo, so a per-machine path can never be committed or pushed (the same reason the vault registry lives there). The join key is the canonical GitHub URL, globally unique, so two projects can each govern a repo named api without colliding. The session snapshot resolves each pointer locally and hands present repos' paths to the agent so it can read and edit the governed code, while a missing repo is simply flagged, not fetched.

The one networked verb, link clone, is where a team-writable value meets git, so it is hardened accordingly. The gitRemoteUrl is never handed to git raw — it is re-parsed to an owner/repo slug and the clone URL is rebuilt from a fixed https://github.com/… template, so a hostile ext::sh -c … or a leading-dash transport trick in a pushed config can never reach git's argv; the clone also runs with protocol.ext.allow=never and a -- end-of-options terminator, its destination is sanitized and containment-checked against its parent directory, and a human trust-gate confirms before the fetch. Linking an existing checkout likewise requires it to be a real git repo whose own origin matches the governed URL, so a pointer can never be silently aimed at an unrelated directory.


Part of the dreamcontext deep dive — Home · README

Clone this wiki locally