MCPcopy Create free account
hub / github.com/garrytan/gstack / generateBrainCacheRefresh

Function generateBrainCacheRefresh

scripts/resolvers/gbrain.ts:195–210  ·  view source on GitHub ↗
(ctx: TemplateContext)

Source from the content-addressed store, hash-verified

193 * Subordinate to {{TELEMETRY}} — runs after. Doesn't block the user.
194 */
195export function generateBrainCacheRefresh(ctx: TemplateContext): string {
196 if (!isPreflightSkill(ctx.skillName)) return '';
197 const binDir = ctx.paths.binDir;
198 return `## Brain Cache Background Refresh
199
200After the skill's work completes (and telemetry has logged), kick a
201background refresh of any cache digest that's getting close to its TTL.
202This is non-blocking — the user doesn't wait. Next invocation benefits
203from the warm cache.
204
205\`\`\`bash
206eval "$(${binDir}/gstack-slug 2>/dev/null)" 2>/dev/null || true
207(${binDir}/gstack-brain-cache refresh --project "$SLUG" 2>/dev/null &) || true
208\`\`\`
209`;
210}
211
212/**
213 * Renders the calibration write-back block. ONLY emits when the skill makes

Callers 2

totalBrainBytesFunction · 0.90

Calls 1

isPreflightSkillFunction · 0.85

Tested by 1

totalBrainBytesFunction · 0.72