diff --git a/setup-gbrain/SKILL.md.tmpl b/setup-gbrain/SKILL.md.tmpl index c24511099..c5d34c2eb 100644 --- a/setup-gbrain/SKILL.md.tmpl +++ b/setup-gbrain/SKILL.md.tmpl @@ -416,8 +416,9 @@ For Paths 1, 2a, 2b, 3, run the ingest gate: ## Step 8: Persist `## GBrain Configuration` in CLAUDE.md CLAUDE.md is the audit trail: after a successful setup, persist the -configuration block. The exact block formats (remote-http vs local-stdio) and -the post-Step-9 Search Guidance write live in the claude-md-persist section. +configuration block. The exact block formats (remote-http vs local-stdio) live +in the claude-md-persist section. The search-guidance block is written only by +`/sync-gbrain` (Step 10 offers it). {{SECTION:claude-md-persist}} @@ -610,6 +611,15 @@ There is no automatic restore: with brain-sync enabled, the brain remote holds curated artifacts as markdown + git, recoverable via `gbrain import` from a clone. +### Next: `/sync-gbrain` + +This skill does not write the `## GBrain Search Guidance` block in CLAUDE.md; +`/sync-gbrain` writes it once this repo's code index answers a read. Unless +the verdict is RED, AskUserQuestion: "Run `/sync-gbrain` now to index this +repo and add the search guidance to CLAUDE.md?" A) Run it now (read and +follow the sync-gbrain skill) B) Later. If B, or with `SESSION_KIND: spawned` +or `headless`, end by naming `/sync-gbrain` as the next step. + --- ## `/setup-gbrain --cleanup-orphans` diff --git a/setup-gbrain/sections/claude-md-persist.md.tmpl b/setup-gbrain/sections/claude-md-persist.md.tmpl index de6ad18b1..081ca0091 100644 --- a/setup-gbrain/sections/claude-md-persist.md.tmpl +++ b/setup-gbrain/sections/claude-md-persist.md.tmpl @@ -32,46 +32,7 @@ in to git in many projects). It lives only in `~/.claude.json` where - Current repo policy: {read-write|read-only|deny|unset} ``` -**After Step 9 (smoke test) passes, also write the `## GBrain Search Guidance` -block** so the coding agent learns when to prefer `gbrain` over Grep. This -block is gated on the smoke test passing — write the Configuration block -first (so the user knows what state they're in even if the smoke test fails), -then return here after Step 9 and write the guidance block only if smoke -test succeeded. - -When Step 9 passes, find-and-replace (or append) this block. Use HTML-comment -delimiters so removal regex is unambiguous and never eats user content. The -block content is machine-AGNOSTIC — no engine type, no page counts, no -last-sync time. Machine state stays in the Configuration block above. - -```markdown -## GBrain Search Guidance (configured by /sync-gbrain) - - -GBrain is set up and synced on this machine. The agent should prefer gbrain -over Grep when the question is semantic or when you don't know the exact -identifier yet. Two indexed corpora available via the `gbrain` CLI: -- This repo's code (registered as `gstack-code-` source). -- `~/.gstack/` curated memory (registered as `gstack-brain-` source via - the existing federation pipeline). - -Prefer gbrain when: -- "Where is X handled?" / semantic intent, no exact string yet: - `gbrain search ""` or `gbrain query ""` -- "Where is symbol Y defined?" / symbol-based code questions: - `gbrain code-def ` or `gbrain code-refs ` -- "What calls Y?" / "What does Y depend on?": - `gbrain code-callers ` / `gbrain code-callees ` -- "What did we decide last time?" / past plans, retros, learnings: - `gbrain search "" --source gstack-brain-` - -Grep is still right for known exact strings, regex, multiline patterns, and -file globs. The brain auto-syncs incrementally on every gstack skill start. -Run `/sync-gbrain` to force-refresh, `/sync-gbrain --full` for full reindex. - - -``` - -If Step 9 smoke test fails, skip the guidance block write entirely. The user's -next `/sync-gbrain` run will re-evaluate capability and write the block when -the round-trip works. +Do not write a `## GBrain Search Guidance` block here. `/sync-gbrain` is its +only writer: it writes the block after its read check confirms this repo's +code index answers, and replaces any older block under the same heading. +Step 10 offers to run `/sync-gbrain`. diff --git a/setup-gbrain/sections/manifest.json b/setup-gbrain/sections/manifest.json index 8c8744efe..6bcab5730 100644 --- a/setup-gbrain/sections/manifest.json +++ b/setup-gbrain/sections/manifest.json @@ -25,8 +25,8 @@ { "id": "claude-md-persist", "file": "claude-md-persist.md", - "title": "Step 8: persist the GBrain Configuration + Search Guidance blocks in CLAUDE.md", - "trigger": "persisting the Step 8 `## GBrain Configuration` block to CLAUDE.md (and the Search Guidance block after Step 9 passes)" + "title": "Step 8: persist the GBrain Configuration block in CLAUDE.md", + "trigger": "persisting the Step 8 `## GBrain Configuration` block to CLAUDE.md" } ] }