gstack/sync-gbrain
harjoth ecd361c3ae fix(sync-gbrain): gate code-search guidance on real page_count, not the markdown capability check (#1844)
On a markdown-only brain (no registered code source), /sync-gbrain Step 4 wrote
the `## GBrain Search Guidance` block claiming working `.gbrain-source` pins and
`code-def`/`code-refs`/`code-callers` symbol search. None of that resolves —
the code source never registered (and structurally can't, when its path overlaps
the `default` markdown source). The block then instructs the agent to use tools
that return nothing, and silently overwrites any hand-corrected version on every
run.

Root cause: Step 4 gated the code-search template on the *markdown* capability
round-trip (`CAPABILITY_OK`), which only proves `put`/`search`/`delete` work —
nothing about symbol search. Step 3 already computes the code source page_count
but only used it to prompt for a `--full` reindex.

- Compute the cwd source's `CODE_PAGES` in Step 4's check and branch on it:
  `CAPABILITY_OK=1 AND CODE_PAGES>0` → full code+memory block (unchanged);
  `CAPABILITY_OK=1 AND CODE_PAGES==0/empty` → new markdown-only block that
  advertises semantic/keyword search + `~/.gstack/` memory and routes all
  code-symbol questions to Grep (no false `.gbrain-source`/`code-def` claims);
  `CAPABILITY_OK=0` → remove block (unchanged).
- Drop stale `gbrain autopilot --install` guidance: the command is gone in
  gbrain 0.42.x, and on pglite a background sync daemon can't coexist with an
  always-on MCP `gbrain serve`. The `/sync-gbrain`-after-changes guidance and
  the still-valid `sources add --path` safety note remain.

Edited the source-of-truth `SKILL.md.tmpl`; regenerated `SKILL.md` via
`bun run gen:skill-docs` (idempotent — re-run is a no-op).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 22:21:06 -07:00
..
SKILL.md fix(sync-gbrain): gate code-search guidance on real page_count, not the markdown capability check (#1844) 2026-06-02 22:21:06 -07:00
SKILL.md.tmpl fix(sync-gbrain): gate code-search guidance on real page_count, not the markdown capability check (#1844) 2026-06-02 22:21:06 -07:00