/** * Artifacts-sync interpretation rules (token-reduction Phase 1). * * The ~6.8KB of artifacts-sync bash this generator used to inline (gbrain * availability hints, remote-MCP detection via claude.json, restore hint, * daily pull, queue-depth status) now runs inside `bin/gstack-skill-start` * (invoked by the Preamble fence above) and reports through the same STATUS * lines it always emitted: the GBrain hint text and the `ARTIFACTS_SYNC:` * line. What remains here is the prose the model acts on. The one-time * privacy stop-gate moved behind its runtime gate in Phase 2: it now arrives * as a GSTACK_INSTRUCTION block from gstack-skill-start when consent is * actually pending; this generator only carries the interpretation prose. * * Skill-END sync is no longer a separate fence: `bin/gstack-skill-end` * (invoked by the Telemetry step) drains the queue before logging. */ import type { TemplateContext } from '../types'; export function generateBrainSyncBlock(ctx: TemplateContext): string { const isBrainHost = ctx.host === 'gbrain' || ctx.host === 'hermes'; return `## Artifacts Sync (skill start) Skill-start already ran artifacts sync. GBrain hint text (if any) says when to prefer \`gbrain\` over Grep. \`ARTIFACTS_SYNC:\` reports sync health (\`off\`, \`mode=... | queue=N\`, \`remote-mode\`, or a \`gstack-brain-restore\` hint). On an \`attention:\` line, tell the user in one sentence what it says and the command it names, then continue. ${isBrainHost ? `If output shows \`ARTIFACTS_SYNC: artifacts repo detected\`, offer \`gstack-brain-restore\` via AskUserQuestion; otherwise continue. ` : ''}The one-time privacy stop-gate arrives as a \`GSTACK_INSTRUCTION\` block from skill-start when consent is pending; fire it via AskUserQuestion exactly as instructed.`; }