← The archive
04KriyāFiled under Tech. 3 min.

The Repo-as-Bridge Second Brain

For years my best thinking lived in a notes tool my AI couldn't see. Every session started with a paste-a-wall-of-context ritual, and the quality of the output…


For years my best thinking lived in a notes tool my AI couldn't see. Every session started with a paste-a-wall-of-context ritual, and the quality of the output was capped by how much context I could be bothered to carry over by hand. I was the integration layer between my own notes and my own tools.

The fix turned out to be an architecture pattern, not a product: use a private git repository as the bridge between a local-first vault and a hosted AI. Here's the generalizable version.

The three constraints that force the design

Any "AI second brain" setup worth trusting has to satisfy three constraints at once.

First, local-first ownership. The notes live on your machine, in plain Markdown you'll still be able to open in twenty years. No proprietary silo gets to be the canonical copy of your thinking.

Second, no babysitting. The AI must reach the notes without you running and securing a server. The obvious-looking option - a local server plus a tunnel to the internet - fails this test: it exposes your filesystem, makes you manage auth, and requires a process that's always alive. Too much surface area for something you want to trust with unedited thinking.

Third, two-way sync. If the model writes a note, it should appear in your vault; if you write one, the model should see it. A read-only export is a backup, not a brain.

The pattern

Mirror the vault to a private repo, and let the AI talk to the repo through a hosted connector. The repo becomes the bridge; nothing on your machine is ever exposed. A sync plugin on the vault side commits and pulls on a timer, so changes flow in both directions with no manual step. The hosted AI reads and writes via the platform's API, and your local vault picks up those commits automatically.

The elegance is that every component is doing the one job it's already good at: the vault handles editing and permanence, git handles history and conflict-free transport, the hosted connector handles auth and uptime.

Curate on the way in

The migration itself matters more than it looks. Don't dump - curate. Sort everything into four buckets: evergreen, active project, archive, and noise - and leave the noise behind. Dead brainstorms and old standups don't earn a place in a second brain. A clean import is a one-time tax you pay so every future session is cheaper.

The failure modes worth knowing

Three things broke in my build, and each carries a lesson bigger than the fix.

Wrong git root. The folder I thought was the vault was actually its parent; the real vault (the one holding the app's config directory) was nested a level deeper, so the first push committed junk. If your first push looks weird, check that you're committing from the folder that contains the config, not the folder that contains the folder.

OS-level permission walls. Sandboxed shells often can't write into protected user folders. The workaround: let the app's own plugin do the committing, because it runs with the app's file permissions. The terminal scaffolds the plumbing; the app does the pushing.

OAuth scope is account-wide by default. The convenient authorization grant covers the whole account, not one repo. If you want tight scoping, a fine-grained token locked to a single repo is the stricter path. Trade scope for convenience knowingly, not by accident.

Prove the loop, then trust it

A second brain you don't trust is just anxiety with extra steps. Test the round trip in both directions - AI writes a note, watch it land in the vault; edit a note locally, watch it land in the repo - before you rely on it.

Why this matters

A model is only as good as the context you can hand it. Most people spend their best thinking inside tools their AI can't see, then wonder why the output feels generic. Once the repo bridge is live, the context tax disappears: the model pulls up a framework written months ago, references a project brief nobody re-explains, and writes new material straight back to where it belongs. The question worth sitting with: is your second brain working for you, or are you still working as the wire between your tools?

insighttechaiknowledge-managementmcp