# What I Took From Garry Tan's gbrain and gstack

*I read both repos end to end, moved 14 ideas into my markdown second brain, and left 6 behind on purpose.*

> Garry Tan's gbrain and gstack repos, read end to end: the 14 ideas I moved into COG, my markdown second brain, the 6 I skipped, and what broke on the way.

Published: 2026-12-03 · Reading time: 6 min · Tags: ai-agents, second-brain, claude-code, agent-skills, gbrain, gstack, obsidian, markdown, personal-ai-system, open-source
Canonical URL: https://huytieu.com/blog/what-i-took-from-gbrain-and-gstack/
Author: Huy Tieu (huytieu.com)

---

<style>
:root{--gb-ground:#ffffff;--gb-ink:#111827;--gb-soft:#334155;--gb-muted:#64748b;--gb-quiet:#94a3b8;--gb-line:#e6e8ee;--gb-accent:#c15f3c;--gb-node:#d97757;--gb-sans:Inter,ui-sans-serif,system-ui,sans-serif;--gb-mono:"JetBrains Mono",ui-monospace,"SF Mono",Menlo,monospace}
:root[data-theme="dark"]{--gb-ground:#171b22;--gb-ink:#f1f5f9;--gb-soft:#cbd5e1;--gb-muted:#8b95a5;--gb-quiet:#5b6472;--gb-line:#262c36;--gb-accent:#e0885f;--gb-node:#e0885f}
.gb{margin:40px 0;padding:22px 22px 16px;border:1px solid var(--gb-line);background:var(--gb-ground);color:var(--gb-ink);box-shadow:0 1px 2px rgba(16,24,40,.04)}
.gb figcaption{margin-top:18px;padding-top:12px;border-top:1px solid var(--gb-line);font:500 9px/1.6 var(--gb-mono);letter-spacing:.1em;text-transform:uppercase;color:var(--gb-muted)}
.gb__k{font:500 9px/1 var(--gb-mono);letter-spacing:.12em;text-transform:uppercase;color:var(--gb-quiet);margin-bottom:14px}
.gb-page{border:1px solid var(--gb-ink);font:400 13px/1.6 var(--gb-mono);color:var(--gb-soft)}
.gb-zone{padding:14px 16px}
.gb-zone + .gb-zone{border-top:1px dashed var(--gb-node)}
.gb-zone .lbl{display:block;font:500 9px/1.3 var(--gb-mono);letter-spacing:.1em;text-transform:uppercase;color:var(--gb-accent);margin-bottom:8px}
.gb-zone p{margin:0 0 4px;font:400 13px/1.6 var(--gb-mono);color:var(--gb-soft)}
.gb-new{animation:gbin 5s ease-in-out infinite;color:var(--gb-ink)}
@keyframes gbin{0%,35%{opacity:0}50%,90%{opacity:1}100%{opacity:0}}
.gb-steps{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.gb-step{border:1px solid var(--gb-line);padding:12px;animation:gbstep 8s linear infinite}
.gb-step b{display:block;font:600 13px/1.3 var(--gb-sans);color:var(--gb-ink);margin-bottom:6px}
.gb-step span{font:400 12px/1.45 var(--gb-sans);color:var(--gb-muted)}
.gb-step .n{display:block;font:500 9px/1 var(--gb-mono);letter-spacing:.1em;color:var(--gb-quiet);margin-bottom:8px}
.gb-step:nth-child(1){animation-delay:0s}.gb-step:nth-child(2){animation-delay:1s}.gb-step:nth-child(3){animation-delay:2s}.gb-step:nth-child(4){animation-delay:3s}.gb-step:nth-child(5){animation-delay:4s}.gb-step:nth-child(6){animation-delay:5s}.gb-step:nth-child(7){animation-delay:6s}.gb-step:nth-child(8){animation-delay:7s}
@keyframes gbstep{0%,10%{border-color:var(--gb-node)}14%,100%{border-color:var(--gb-line)}}
.gb-cols{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.gb-col{border:1px solid var(--gb-line);padding:14px}
.gb-col--took{border-color:var(--gb-ink)}
.gb-col .lbl{display:block;font:500 9px/1.3 var(--gb-mono);letter-spacing:.1em;text-transform:uppercase;color:var(--gb-quiet);margin-bottom:10px}
.gb-col ul{margin:0;padding-left:16px;font:400 13px/1.6 var(--gb-sans);color:var(--gb-soft)}
@media (max-width:640px){.gb-steps{grid-template-columns:1fr 1fr}.gb-cols{grid-template-columns:1fr}}
@media (prefers-reduced-motion:reduce){.gb-new,.gb-step{animation:none}}
</style>

A pull request sat in my repo for four months. Mamdouh Aboammar opened it on August 7 to harden the update script in [COG](https://github.com/huytieu/COG-second-brain), my open-source second brain. It had 15 tests in it. I left one comment in August and then let it rot while I added skills.

That is the state I was in when I sat down to read [Garry Tan](https://x.com/garrytan)'s two repos. [gbrain](https://github.com/garrytan/gbrain) is his agent memory. [gstack](https://github.com/garrytan/gstack) is his skill pack for coding agents. Both get commits most days. I wanted to know what a person with far more users than me does differently, and what of it fits a vault that is only markdown and shell.

## He deletes his own skills

The file that stopped me was [`docs/cut-skills.md`](https://github.com/garrytan/gstack/blob/main/docs/cut-skills.md) in gstack. In November he deleted two of his own skills, `/investigate` and `/cso`, because his tests could not show that they beat a plain request. The numbers are in the file. `/investigate` passed 50.0% of 18 real bugs against 47.2% for a plain prompt, a gap the test cannot tell from zero, at about 43% more cost. `/cso` named 8 of 51 security advisories; the plain prompt named 12.

The rule he wrote down: "A gstack skill stays only while it beats asking the agent plainly."

I have never deleted a skill. COG had 43 of them and I could not tell you which ones still earn their place. Every skill costs tokens in every session, because its name and description load at start. I had no number for that cost either.

gbrain has the same habit on the memory side. Its README has a section on when not to use it. It reports losing to an agent with plain grep on very long chat logs, 55.2% against 67.4%. One research note tests an idea, finds it moved made-up answers only from 22.7% to 20.7%, and ends with a decision not to build it.

So the first thing I took was the habit of measuring before adding.

## What I took

I read both repos through a fan of agents, got back about 60 candidate ideas, and judged 21 of them properly. Fourteen went into COG.

<figure class="gb" role="img" aria-label="Two lists. Taken: two-zone pages, back-link rule, nightly maintenance pass, quote check by script, context bill, context audit, skillify, reference drift check, safety hooks. Skipped: embedding search, skill packs, skill generator, deterministic router, action ledger">
<div class="gb__k">21 ideas judged</div>
<div class="gb-cols">
<div class="gb-col gb-col--took"><span class="lbl">Taken</span><ul><li>Two-zone pages</li><li>Back-link rule</li><li>Maintenance pass with a fixed order</li><li>Quote check by script</li><li>Context bill and audit</li><li>Skillify with trigger tests</li><li>Reference drift check</li><li>Opt-in safety hooks</li></ul></div>
<div class="gb-col"><span class="lbl">Skipped</span><ul><li>Embedding search</li><li>Skill packs</li><li>Skill generator</li><li>Deterministic skill router</li><li>Action ledger</li></ul></div>
</div>
<figcaption>Most of what I skipped needs a database or a build step. COG is markdown and shell.</figcaption>
</figure>

### Two zones per page

gbrain splits every entity page in two. The top is a summary that the agent may rewrite. Below a marker line sits a dated timeline that is only ever appended. Every claim in the summary must trace to a line in the timeline.

<figure class="gb" role="img" aria-label="A note about a person. The top zone is a rewritable summary. Below a dashed line is an append-only timeline with dated entries, and a new entry appears at the bottom">
<div class="gb__k">One page, two rules</div>
<div class="gb-page">
<div class="gb-zone"><span class="lbl">Summary · rewrite freely</span><p>Runs platform at a 40-person startup. Cares about test flakiness. Prefers async.</p></div>
<div class="gb-zone"><span class="lbl">Timeline · append only</span><p>2026-09-14 | Met at a meetup, talked about flaky tests</p><p>2026-10-02 | Sent the CI article, replied same day</p><p class="gb-new">2026-12-01 | Referenced in [[weekly-notes]], asked for a follow-up</p></div>
</div>
<figcaption>The summary gives the answer in 30 seconds. The timeline keeps the evidence.</figcaption>
</figure>

My people notes already had a timeline. What I lacked was the second rule, which gbrain calls the Iron Law: a note that mentions a person adds a dated line to that person's page. Obsidian shows backlinks in a panel, but an agent reads the file. The line has to be in the file.

### A maintenance pass with a written order

gbrain runs a nightly cycle and the code has a comment next to each phase saying why it sits where it does. I had `/knowledge-consolidation` and `/memory-hygiene` as separate skills that I ran when I remembered, which was rarely.

COG now has `/dream`. It runs eight phases in one order and the first run only proposes.

<figure class="gb" role="img" aria-label="Eight phases in order: lint, file inbox, back-links, consolidate, patterns, quote check, orphans, morning note">
<div class="gb__k">/dream, in order</div>
<div class="gb-steps">
<div class="gb-step"><span class="n">01</span><b>Lint</b><span>Count what is wrong before touching anything</span></div>
<div class="gb-step"><span class="n">02</span><b>File inbox</b><span>Captures leave the inbox</span></div>
<div class="gb-step"><span class="n">03</span><b>Back-links</b><span>Dated lines on entity pages</span></div>
<div class="gb-step"><span class="n">04</span><b>Consolidate</b><span>Only now, on filed notes</span></div>
<div class="gb-step"><span class="n">05</span><b>Patterns</b><span>Needs 3 dated sources</span></div>
<div class="gb-step"><span class="n">06</span><b>Quote check</b><span>Script, no model</span></div>
<div class="gb-step"><span class="n">07</span><b>Orphans</b><span>Report only</span></div>
<div class="gb-step"><span class="n">08</span><b>Morning note</b><span>Every change has an id to undo</span></div>
</div>
<figcaption>Patterns need three sources so one vivid day does not become a theme.</figcaption>
</figure>

The part I like most is phase six. After a model writes a summary, a Python script checks that every quoted span is a verbatim slice of the source file. A quote that fails moves to an `unverified_claims` list in the frontmatter. No model is asked whether the model was right.

### A bill for context

gstack publishes a token cost per skill and fails CI when the always-loaded part grows. I wrote the same thing as `scripts/context-bill.py` and ran it on COG. The always-loaded layer came to about 26,700 estimated tokens. `AGENTS.md` alone was about 14,000. One skill body was 18,000.

I did not fix those numbers in this release. I set the CI budget about 10% above them, so the next person who adds 2,000 tokens to a file that loads every session has to raise a limit on purpose. That person is usually me.

## What I skipped

gbrain's core is search: embeddings, hot and cold memory, recall at session boundaries. I skipped all of it. COG has no database and I do not want one. The honest consequence went into the README as a section named "When COG Is the Wrong Tool". If your notes fit in one context window, grep and a plain prompt will do, and you do not need my repo.

I also skipped gstack's skill generator and its deterministic router. The router ships off by default in gstack itself after it added noise. That was enough for me.

## What broke on the way

The reference checker found 18 places where a COG skill named a file, script or command that does not exist. I shipped those. Then I ran the same script on my private vault and it found 69.

Three reviewer agents read the release before I pushed. They returned 27 findings. One was a real blocker: the quote check ignored blockquotes, which is where most quotes live. The docs said a script could verify quotes, and for the most common case it could not.

Then CI failed on its first Linux run. Two tests left Python bytecode inside a folder that another check compares byte for byte. It passed on my Mac every time.

And the four-month pull request finally landed, along with [Caio Barbosa](https://github.com/barcx)'s change that lets the notes live outside the repo. Both conflicted with releases I had cut while they waited, so the conflicts were my doing. Mamdouh's 15 tests are the reason CI exists at all. Users on an older version have to run the updater twice, because the old script cannot restart itself. That is in the changelog.

## Still unmeasured

I took the rule that a skill must beat a plain prompt, and I have not yet run that comparison for a single one of my 49 skills. The policy is written. The cut list is an empty table.

That is the next thing to do, and I expect it to cost me a few skills I am fond of.

The release is [COG v3.18.0](https://github.com/huytieu/COG-second-brain/releases/tag/v3.18.0). The [changelog](https://github.com/huytieu/COG-second-brain/blob/main/CHANGELOG.md) credits each idea to the repo it came from.
