Nothing in skill start runs gstack-brain-context-load, though memory.md and the 1.26.0.0 notes say skills auto-load brain context
What happened
Three places say skills get the context of bin/gstack-brain-context-load.ts at skill start, but on main (4414f4cc9377a9df06c7847433fe567ba6398aa8) I found no code path that runs the helper:
bin/gstack-brain-context-load.ts:5: "Called from the gstack preamble at every skill start."setup-gbrain/memory.md:264-271: "At every gstack skill start, the preamble runsgstack-brain-context-loadwhich: ..." and:273-282: when you run/office-hours, "the model context automatically includes"## Prior office-hours sessions in this repoand three more sections.CHANGELOG.md:15495-15497(1.26.0.0): "Every gstack skill auto-loads what you actually did.", and the six skills "now declare what they want gbrain to surface in the preamble at every invocation" (/investigatewas retired in #4110; five remain).
What I checked:
- Callers. The steps below show every reference to the helper and to its off switch outside the changelog, tests and docs; none is a call. The
## Preamble (run first)fence runsbin/gstack-skill-start, and neither that script nor any renderedSKILL.mdorsections/*file names the helper.context_queriesis read only by the helper and byparseSkillManifestinlib/gstack-memory-helpers.ts. - History. This does not look like a regression from moving the preamble into
bin/gstack-skill-start. The v1.26.0.0 commit (bf654871, #1298) added the helper, thegbrain:blocks andmemory.md, changed no file underscripts/orhosts/, and its test plan runs the helper by hand. Over the full history,git log main -S'brain-context-load' -- . ':!CHANGELOG.md' ':!test' ':!docs'returns three commits:bf654871(adds the helper),394db326(adds the comment athosts/claude.ts:17) andb1485d88(adds the test duration). This literal-string history shows no commit that adds a call. - What does run at skill start is different.
{{GBRAIN_CONTEXT_LOAD}}(scripts/resolvers/gbrain.ts:54-68) renders a## Brain Context Loadblock that tells the model to rungbrain search "<keywords>"and read the top 3 results withgbrain get. It does not readcontext_queries, and/design-shotgundoes not have it (that template has no{{GBRAIN_CONTEXT_LOAD}}). The closing comments on #2114 describe this block as the context-load mechanism ("skills load and save GBrain context through the generated {{GBRAIN_CONTEXT_LOAD}} resolver").bin/gstack-skill-startalso prints a "GBrain configured. Prefergbrain search..." hint (:404), which is a third thing and not this helper.
Consequences I can see in the code:
- I found no automatic run that evaluates the 16 queries declared in five skills (
/office-hours4,/plan-ceo-review3,/design-shotgun3,/design-consultation3,/retro3). Thegbrain:block still ships in every renderedSKILL.mdof those skills, andhosts/claude.ts:11-20keeps it unstripped specifically because "bin/gstack-brain-context-load reads gbrain:". setup-gbrain/memory.md:259documentsgstack-config set gbrain_context_load off # also disables retrieval. Nothing onmainreadsgbrain_context_load(step 3 below).gstack-config set gbrain_context_load offsucceeds silently, as it does for any unknown key, andgstack-config get gbrain_context_loadthen printsoff, so the switch looks like it worked.- Earlier reports describe the helper as part of every skill run: #1687 says its queries run "at skill startup", and #2883 reports "0 bytes of brain context in every skill". Each of #1559, #1687 and #2883 reproduces its bug by running the helper or its manifest parser by hand.
What I expected: either skill start runs the helper as the three places say, or those places, the gbrain: frontmatter and the off switch are corrected to match the {{GBRAIN_CONTEXT_LOAD}} block. Run by hand, the helper evaluates the four /office-hours queries and returns content (step 4), so what is missing is a caller, not the loader. I do not know which direction you want. If the prose block is the intended mechanism, memory.md:262-286, the helper's header (:5) and the gbrain_context_load line are stale, and the manifests are read only when someone runs the helper by hand. If the helper should run, bin/gstack-skill-start already has --skill and the repo slug, but I have not tried a call there or measured its cost against the 500 ms per-query cap.
Steps to reproduce
git clone https://github.com/garrytan/gstack && cd gstack
git checkout 4414f4cc9377a9df06c7847433fe567ba6398aa8
# 1. No call site outside docs, tests and comments
git grep -n 'brain-context-load' -- . ':!CHANGELOG.md' ':!test' ':!docs' ':!bin/gstack-brain-context-load.ts'
# hosts/claude.ts:17, lib/gstack-memory-helpers.ts:7, :462,
# scripts/free-test-durations.json:774, setup-gbrain/memory.md:265
# 2. Neither the preamble command nor any rendered skill or section names it
git grep -n -E 'brain-context-load' -- bin/gstack-skill-start ':(glob)*/SKILL.md' ':(glob)*/sections/*'
# (no output)
# 3. The documented off switch has no reader
git grep -n 'gbrain_context_load' -- . ':!CHANGELOG.md'
# setup-gbrain/memory.md:259
# 4. Run by hand, the helper evaluates the manifest (output on a real install; OK or SKIP and the durations depend on its data)
bun bin/gstack-brain-context-load.ts --skill-file office-hours/SKILL.md --repo example-repo --explain >/dev/null
# [brain-context-load] mode=manifest queries=4
# SKIP prior-sessions kind=list bytes= 0 dur=363ms (no matches)
# OK builder-profile kind=filesystem bytes= 152 dur=7ms
# SKIP design-doc-history kind=filesystem bytes= 0 dur=6ms (no matches)
# OK prior-eureka kind=filesystem bytes= 134 dur=8ms
# [brain-context-load] total bytes=286 dur=384ms
Readiness report
Home path shortened to ~:
gstack doctor 1.99.2.0
ok install root ~/.claude/skills/gstack: claude global current (1.99.2.0), agy global current (1.99.2.0), codex global current (1.99.2.0)
ok rescue refs none in ~/.claude/skills/gstack
ok state root ~/.gstack durable=yes (selected by default)
ok bun 1.4.4 at /usr/local/bin/bun (floor 1.3.3, tested 1.4.2)
ok hooks 15 hook(s) parse
ok codex codex-cli 0.160.1; self-locate ok; model gpt-6.1-sol (source: GSTACK_CODEX_MODEL)
ok codex probe cached MODEL_OK, 1h ago (not re-run; --live probes now)
ok artifacts sync status ok (mode full; queue 0)
ok browse bundle browse/dist built
ok binaries find-browse, design, pdf, gstack-global-discover launch (4 of 4)
ok cso native helper 1.99.2.0 (bc858ffc659b)
ok claude code 2.1.309 (Claude Code) at /usr/local/bin/claude
ok session journal no session journals for this project
ok guard log 97 decisions (5 denied)
ok CLAUDE.md no gstack section lists skills (~/.claude/CLAUDE.md)
15 ok, 0 warn, 0 not configured, 0 fail
Environment
- Host: Claude Code 2.1.309
- OS: Linux
- gstack: installed 1.99.2.0 (
bc858ffc659b); every claim above was also read onmainat4414f4cc9377a9df06c7847433fe567ba6398aa8, three commits ahead, and none of those commits changes a file cited here - Related, closed: #1559, #1687, #2883 (fixes to the helper), #2114 (PR closed as superseded by
{{GBRAIN_CONTEXT_LOAD}})
Thorough trace. We hit the same shape twice in our own agent setup, so two things that might help whichever direction you pick.
1. "Loader exists, caller doesn't" survives because every test calls the loader directly. Ours was a weekly job whose engine (cultivate + report scripts) was fully built and unit-tested, but nothing scheduled it, so it never ran. Each test exercised the engine by hand, the same way #1559, #1687 and #2883 reproduce here by running the helper by hand, so the suite stayed green the whole time. What caught it for good was a wiring test that asserts the entry point reaches the component, not that the component works:
// test/wiring.test.ts: fails if the documented auto-run has no caller
import { execSync } from "node:child_process";
test("skill start invokes gstack-brain-context-load", () => {
const hits = execSync(
`git grep -l 'brain-context-load' -- bin/gstack-skill-start ':(glob)*/SKILL.md' ':(glob)*/sections/*' || true`,
).toString().trim();
expect(hits).not.toBe(""); // docs say "at every skill start"; this keeps them honest
});
It's crude (grep, not a call graph), but it's the test that would have gone red on bf654871. If you go the other way and keep {{GBRAIN_CONTEXT_LOAD}} as the mechanism, flip it into a negative test that fails when memory.md or the helper header claims a preamble call.
2. The silent gbrain_context_load off is the more dangerous half. Our version: a settings UI wrote subscriptions to one store and the job read a different one, so edits "saved" and changed nothing. No error anywhere, and it went unnoticed much longer than the missing trigger, because the user saw the change reflected on read-back, just like gstack-config get gbrain_context_load printing off here. Whatever you decide about the helper, it seems worth having gstack-config set warn on keys that no code reads (a small allowlist of known keys is enough). Then the next documented-but-unread switch shows up the first time someone uses it, not after an audit like this one.
On direction: if the per-skill gbrain: manifests are meant to stay, wiring the helper into bin/gstack-skill-start (it already has --skill and the slug) keeps the 16 declared queries meaningful. The --explain run above (~384 ms for 4 queries, with most of it in one list query) suggests a per-skill budget, not per-query, is the cap to measure against.
Wiring-test lesson from SwarmAI's scheduled-job pipeline. Discussion: Mechanical Gate vs Ceremonial Gate
Thanks for the careful trace, @exGeni. I confirmed it on main at 1d3c63c: nothing outside docs, tests and comments calls gstack-brain-context-load, and nothing reads gbrain_context_load. This is on our list. The open question is which way to go (wire the helper into skill start, or correct memory.md, the helper header and the off switch to match the {{GBRAIN_CONTEXT_LOAD}} block), and we'll post here once that's decided.
Following up with a decision. Wiring the loader into every skill start would be new behaviour, so we won't do that from this report. We're taking the small fix: correct setup-gbrain/memory.md, the helper's header comment and the off switch's description so they match what main actually does. It will be rebuilt on current main and linked here after November 21.
Picking this up. A maintainer agent working through a batch of fixes (our tracking thread GSTA-804) will first reproduce this on current main. If it reproduces, the agent fixes it on main and we'll close this issue with a link when the change lands. If it no longer reproduces, we'll close it and say what changed. Details from the duplicate #4614 (robbiesierra) carried over here: the docs at setup-gbrain/memory.md and the header of bin/gstack-brain-context-load.ts both say skill start runs the loader; gstack-skill-start wires only gstack-brain-sync; five skills still declare gbrain.context_queries. The two possible fixes are to wire the loader back into skill start, or to drop the promise from the docs and the unused queries. We lean toward wiring it back in.
Fixed in #4687, now merged. Skills that declare gbrain.context_queries (office-hours, plan-ceo-review, design-shotgun, design-consultation, retro) now load them at skill start when gbrain is configured. gstack-config set gbrain_context_load off now turns that off, and deny-policy repos are skipped. Thanks for the thorough investigation.