Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
fix(sync-gbrain): point curated-memory search at gstack-artifacts-<user> (#3810)
Garry Tan46c9f612c099
diff --git a/CLAUDE.md b/CLAUDE.mdindex 6e5de2143..bb2d196cd 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -600,8 +600,9 @@ match the actual code on disk in this worktree.Two indexed corpora available via the `gbrain` CLI:- This worktree's code (auto-pinned via `.gbrain-source`).-- `~/.gstack/` curated memory (registered as `gstack-brain-<user>` source via- the existing federation pipeline).+- `~/.gstack/` curated memory: the `gstack-artifacts-<user>` source, named after+ the repo `gstack-artifacts-init` creates (lowercased and cut to 32 characters;+ `gbrain sources list` shows the exact id).Prefer gbrain when:- "Where is X handled?" / semantic intent, no exact string yet:@@ -611,7 +612,7 @@ Prefer gbrain when:- "What calls Y?" / "What does Y depend on?":`gbrain code-callers <symbol>` / `gbrain code-callees <symbol>`- "What did we decide last time?" / past plans, retros, learnings:- `gbrain search "<terms>" --source gstack-brain-<user>`+ `gbrain search "<terms>" --source gstack-artifacts-<user>`Grep is still right for known exact strings, regex, multiline patterns, andfile globs. Run `/sync-gbrain` after meaningful code changes; for ongoingdiff --git a/changelog.d/fix-3799-sync-gbrain-artifacts-source.md b/changelog.d/fix-3799-sync-gbrain-artifacts-source.mdnew file mode 100644index 000000000..f1836bbdf--- /dev/null+++ b/changelog.d/fix-3799-sync-gbrain-artifacts-source.md@@ -0,0 +1 @@+- `/sync-gbrain`'s GBrain Search Guidance block now tells agents to search past plans, retros and learnings with `--source gstack-artifacts-<user>`, the source named after the repo `gstack-artifacts-init` creates. It still said `gstack-brain-<user>`, the name from before the v1.27.0.0 rename, so every agent following the block got `unknown_source`, and a hand fix to CLAUDE.md reverted on the next `/sync-gbrain`. This repo's own CLAUDE.md copy and the write-surfaces checklist are fixed too. `test/regression-3799-sync-gbrain-artifacts-source.test.ts` pins the block to the name `gstack-artifacts-init` uses. Reported in #3799 by @extremenelson.diff --git a/docs/gbrain-write-surfaces.md b/docs/gbrain-write-surfaces.mdindex 0f9a777a6..59e93e6ed 100644--- a/docs/gbrain-write-surfaces.md+++ b/docs/gbrain-write-surfaces.md@@ -197,7 +197,7 @@ should have saved):```bashgbrain get "<prefix>/<slug>" # expect markdown + frontmattergbrain search "<slug fragment>" # expect slug in top results-gbrain sources list # confirm gstack-brain-<user> source+gbrain sources list # confirm gstack-artifacts-<user> sourcegbrain get "entities/<person>" # expect stub per named person```diff --git a/sync-gbrain/SKILL.md b/sync-gbrain/SKILL.mdindex 7b9c4ff20..b4d6ebfe4 100644--- a/sync-gbrain/SKILL.md+++ b/sync-gbrain/SKILL.md@@ -555,8 +555,9 @@ extraction.Two indexed corpora available via the `gbrain` CLI:- This worktree's code (auto-pinned via `.gbrain-source`).-- `~/.gstack/` curated memory (registered as `gstack-brain-<user>` source via- the existing federation pipeline).+- `~/.gstack/` curated memory: the `gstack-artifacts-<user>` source, named after+ the repo `gstack-artifacts-init` creates (lowercased and cut to 32 characters;+ `gbrain sources list` shows the exact id).Prefer gbrain when:- "Where is X handled?" / semantic intent, no exact string yet:@@ -566,7 +567,7 @@ Prefer gbrain when:- "What calls Y?" / "What does Y depend on?":`gbrain code-callers <symbol>` / `gbrain code-callees <symbol>`- "What did we decide last time?" / past plans, retros, learnings:- `gbrain search "<terms>" --source gstack-brain-<user>`+ `gbrain search "<terms>" --source gstack-artifacts-<user>`Grep is still right for known exact strings, regex, multiline patterns, andfile globs. Run `/sync-gbrain` after meaningful code changes; for ongoingdiff --git a/sync-gbrain/SKILL.md.tmpl b/sync-gbrain/SKILL.md.tmplindex a822ee481..3612a62da 100644--- a/sync-gbrain/SKILL.md.tmpl+++ b/sync-gbrain/SKILL.md.tmpl@@ -483,8 +483,9 @@ extraction.Two indexed corpora available via the `gbrain` CLI:- This worktree's code (auto-pinned via `.gbrain-source`).-- `~/.gstack/` curated memory (registered as `gstack-brain-<user>` source via- the existing federation pipeline).+- `~/.gstack/` curated memory: the `gstack-artifacts-<user>` source, named after+ the repo `gstack-artifacts-init` creates (lowercased and cut to 32 characters;+ `gbrain sources list` shows the exact id).Prefer gbrain when:- "Where is X handled?" / semantic intent, no exact string yet:@@ -494,7 +495,7 @@ Prefer gbrain when:- "What calls Y?" / "What does Y depend on?":`gbrain code-callers <symbol>` / `gbrain code-callees <symbol>`- "What did we decide last time?" / past plans, retros, learnings:- `gbrain search "<terms>" --source gstack-brain-<user>`+ `gbrain search "<terms>" --source gstack-artifacts-<user>`Grep is still right for known exact strings, regex, multiline patterns, andfile globs. Run `/sync-gbrain` after meaningful code changes; for ongoingdiff --git a/test/regression-3799-sync-gbrain-artifacts-source.test.ts b/test/regression-3799-sync-gbrain-artifacts-source.test.tsnew file mode 100644index 000000000..04ccec9a0--- /dev/null+++ b/test/regression-3799-sync-gbrain-artifacts-source.test.ts@@ -0,0 +1,43 @@+/**+ * Regression for #3799: the GBrain Search Guidance block /sync-gbrain writes+ * into CLAUDE.md named the curated-memory source `gstack-brain-<user>`, but+ * the v1.27.0.0 rename made bin/gstack-artifacts-init register+ * `gstack-artifacts-<user>`. Every agent following the block ran+ * `gbrain search ... --source gstack-brain-<user>` and got unknown_source.+ * Pins the block's source name to the one gstack-artifacts-init registers, in+ * the template, the generated skill and this repo's own CLAUDE.md copy.+ */+import { describe, test, expect } from 'bun:test';+import * as fs from 'fs';+import * as path from 'path';++const ROOT = path.resolve(import.meta.dir, '..');+const read = (rel: string) => fs.readFileSync(path.join(ROOT, rel), 'utf-8');++const START = '<!-- gstack-gbrain-search-guidance:start -->';+const END = '<!-- gstack-gbrain-search-guidance:end -->';++function guidanceBlock(rel: string): string {+ const text = read(rel);+ const start = text.indexOf(START);+ const end = text.indexOf(END, start);+ if (start < 0 || end < 0) throw new Error(`${rel}: GBrain Search Guidance markers not found`);+ return text.slice(start, end + END.length);+}++const registered = read('bin/gstack-artifacts-init').match(/^SOURCE_ID="([a-z0-9-]+-)\$\{USER:-\$\(whoami\)\}"$/m)?.[1];++describe('#3799 /sync-gbrain guidance names the source gstack-artifacts-init registers', () => {+ test('gstack-artifacts-init registers a per-user source id', () => {+ expect(registered).toBe('gstack-artifacts-');+ });++ for (const rel of ['sync-gbrain/SKILL.md.tmpl', 'sync-gbrain/SKILL.md', 'CLAUDE.md']) {+ test(`${rel}: curated-memory search uses ${registered}<user>`, () => {+ const block = guidanceBlock(rel);+ expect(block).toContain(`--source ${registered}<user>`);+ expect(block).not.toContain('gstack-brain-<user>');+ for (const m of block.matchAll(/--source ([a-z-]+)<user>/g)) expect(m[1]).toBe(registered!);+ });+ }+});