Skip to content
All posts
Article

We forked GBrain in July. Was it worth it?

Four months on the foundations of Cortex, our fork of GBrain: what we built, what it cost us, and what we take back from upstream now.

In this article

If you read Dom's article (in French), I guess you already know why we built a company brain, and how we came to GBrain, Garry Tan's open source project. Cortex is our fork of it: the same brain, made to run for a team. Dom ended on a promise: to come back to how a shared brain is fed and who may write to it. Part of the answer is here.

Let me tell you what is under the hood, what we did with it over the last four months, and what it cost us. Short version: we spent those four months on the foundations, and today GBrain is ahead of us on features. Now we turn to the engine.

In July, GBrain knew perfectly well how to authenticate an agent: OAuth, scopes, isolation per source, it was all there. What it did not know was who the person behind the agent was. No user table, and an authorization page that granted access without asking anyone anything. For a team trusting it with clients, candidates and decisions, that is the first thing to settle.

What GBrain gets right

We kept the ideas behind GBrain.

  • One page per entity, in Markdown, in a git repo: a person, a company, a project. At the top, what we know today, rewritten when our understanding changes. Below, the dated entries it came from. Garry's docs credit the idea to Andrej Karpathy.
  • The repo is the system of record, and the database is an index you can rebuild at will.
  • Search lets four methods vote: vectors, keywords, titles, relationships.
  • At night, a cycle does the housekeeping: it extracts facts, spots contradictions, flags orphan pages.

Garry ships all of this with his agents and a handful of contributors: about eight hundred releases and more than a thousand merged pull requests in four months. Keep that number in mind, it will come back.

July 24

We started from version 0.42.66. The first commit of the fork, four days later, is a Dockerfile and a pipeline. Phase one was the foundations: the backend and everything a team needs around Garry's engine.

We removed nothing that was wired in. The server and its OAuth, the scopes, the job supervisor, both database engines, the model gateway, the hundred and two operations, the fifty-two skills: everything is still there.

What we built

The GBrain engine inside Cortex: every request from a person or an agent goes through Cortex, which runs it, knows who is asking, refuses some writes and chooses the models

The engine is GBrain. Cortex is everything we built around it.

Four months, one priority: turning a personal tool into a product a company can run.

First, being able to run it

An image with separate roles: one container serves the agents, another runs the jobs, a third one is for administration. All three run on AWS Fargate, so there is no server of ours to maintain. A managed database where every connection gets a token valid for fifteen minutes, and where whoever reads the data is not whoever changes the schema. A CI of twenty-four jobs that refuses by default, with a rule written in black and white: "never mark an incomplete gate successful".

And then the ratchets. A codebase this size carries debt, and we don't pretend it isn't there. For each pattern we want gone, an unused import or a swallowed error, a script counts every occurrence and pins the number. One more, the build breaks. One less, you lower the pin: unused imports went from 462 to 200 in a single sweep. The count can only go down. As one of the scripts puts it, "adding one is a decision somebody makes on purpose and writes down".

Inside, we split things up. The migrations file was six thousand lines long, the operations file five thousand seven hundred. Today they are a few hundred lines each, with one folder per domain. Core depended on the command layer in sixteen places; they went one merge request at a time, in three days of August. Forty-nine modules that nothing called are gone. Maintainability is precious to us.

Five hundred and ten merge requests merged in sixteen weeks, two of us, plus the agents. Over the same period, GBrain merged one thousand three hundred and forty-nine pull requests. Our merge requests say what we tried, what we rejected and why, and what the test proves. That is what made this article possible to check.

Then, knowing who

Identity is verified at the edge, before the request ever reaches the brain. A rule per address or per group decides what the person sees and where they write, and when someone leaves a group, their access goes with it. Everyone gets their own brain, which no other user reads, and teams get theirs. And anyone on the team can open their brain in a browser: the page tree, rendered pages, backlinks, the graph. A UI still matters. Agents are the first consumers of the brain, but people are the ones who have to trust it, and that takes seeing what each write changed. Every page shows its timeline and its links to other pages. We already have too many black boxes.

The brain reader, centred on one page, with its links highlighted in the graph of the whole brain

The brain reader: a page and the pages it mentions, one hop away.

We did not get it right the first time. In November we found a way for a request to reach the authorization step without passing the identity check. We closed it on November 9, then spent the week rebuilding authorization so that an application, an employee's authorization and a session are three separate things, each one revocable on its own.

Next, refusing

Security is job zero. A shared brain is the last place where sensitive information should land by mistake, so every write is screened first, and the brain refuses to write certain things. A secret, special-category personal data under article 9 of GDPR, a payslip: the write is rejected before anything reaches a page.

That covers new writes. Since November, the brain can also list the pages it already stores that hold a credential or sensitive personal data.

Finally, sharing personal brain data

Say I have information that can help the sales team. I click, or prompt "promote this to the sales brain", and a curator of the sales brain, a person or an agent, reviews it before it lands. We also have a mechanism that suggests promotions for personal brain data, based on related information already in a shared brain.

Sharing between personal brains is not supported yet: we are still looking for the best way to do it.

What it cost us

Was forking a good idea?

Yes, because in July what a team needs, identity, refusal at write time, control over the models, operations, was not there. No, because from July 24 until this month we did not take a single line back from GBrain. Meanwhile, Garry tripled his codebase, rewrote the memory layer, added connectors to Gmail, Slack and GitHub, and is rebuilding the write path so that git becomes the system of record for real.

Two timelines leaving version 0.42.66 on July 24: GBrain above, Cortex below, with their milestones up to November 17

Two trajectories since July 24.

So where does that leave Cortex today? I listed the gaps in an internal document this week, and here they are. On features, GBrain is ahead. It registers a hundred and ninety-five operations, we register a hundred and fifteen.

The one that bothers Dom the most: today Cortex does not ingest anything by itself, where his article describes a brain that fetches part of its sources on its own. When an article or a meeting goes in, the reading, the extraction and the writing happen in an agent on someone's laptop, with whatever skills that laptop has, and the server only stores the result. The result depends on the skills of whoever runs it. For a shared brain, that is a problem. That is changing: since late October, links and timeline entries are extracted on the server every hour, the same way for everyone. Reading the source and writing the page still happen on the laptop.

One story says it all. In the July version, fact extraction only ran if you had an Anthropic key, and our models go through a gateway. Garry fixed it on August 18. We found it again in November. Three months for a bug that already had its fix, on the other side of the fork.

This was foreseeable. We chose to take our time to make GBrain our own, with our mindset and our biases. Now that we understand it deeply, we can move forward with both Cortex and GBrain.

So, now what?

As suggested in David Crawshaw's "Devtools must be open source", we will set up a nightly cron job that runs a prompt along these lines: "Fetch upstream changes from GBrain. If there are new commits and our changes rebase onto them without conflicts, check that the software works as intended and open a merge request. If not, stop and open an issue listing what conflicted."

We have already started by hand. The first things we are taking back from GBrain are its search-quality improvements, ported one merge request at a time and measured on our own queries before they ship. Catching up on four months will take a while, because the two codebases have drifted apart. Once we are level, the nightly diff stays small and an upstream fix reaches us the next morning instead of three months later.

Phase two is about what the engine does: deep evals at every stage, cost efficiency and simplicity. It has already begun: since late October the reranker has its own evaluation harness, and reranking was only enabled on November 10, once it had passed its gates.

So, would we fork again? Yes. Taking features back from GBrain is the easy part. The real work is making each of them run by our principles.

© 2026 Seven Mile. All rights reserved. · dom@sevenmile.tech

Drawings, page transitions and the theme wipe are still.