sync-gbrain

Synchronizes the gbrain code index with the repository and refreshes agent search guidance in CLAUDE.md.

1|Updated Jul 23, 2026
One-click install
npx skills add https://github.com/sanjanb/my-agent-harness --skill sync-gbrain-sanjanb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sync-gbrain
Source: https://github.com/sanjanb/my-agent-harness/tree/main/skills/sync-gbrain
Command: npx skills add https://github.com/sanjanb/my-agent-harness --skill sync-gbrain-sanjanb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Code search indexes drift out of date as a repository changes, causing semantic search tools like gbrain to return stale or missing results. This Skill re-indexes the repo against gbrain and updates the agent-facing search guidance in CLAUDE.md so AI agents know when and how to use gbrain search instead of plain grep. ## Core Features & Use Cases - Repo re-indexing: Wraps the gstack-gbrain-sync orchestrator to probe, register native code surfaces, run capability checks, and emit a verdict block; re-runnable and idempotent. - CLAUDE.md guidance refresh: Updates the GBrain Search Guidance section so agents prefer gbrain search/gbrain query for semantic questions and code-def/code-refs/code-callers for symbol-aware lookup. - Worktree pinning: Uses a per-worktree .gbrain-source pin at the git toplevel to scope queries, detecting unpinned worktrees and falling back to Grep until pinned. - Use Case: After a large refactor, an agent's semantic search stops finding new symbols. Invoke the skill to re-index the repo, pin the worktree, and restore accurate gbrain-powered code lookup. ## Quick Start Ask the agent to sync gbrain and re-index this repository so semantic code search reflects the latest changes.

Frequently Asked Questions about sync-gbrain

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I re-index a repository for gbrain semantic code search?

Invoke the sync-gbrain skill, which wraps the gstack-gbrain-sync orchestrator to probe the repo, register native code surfaces, run capability checks, and emit a verdict block. The operation is idempotent and safe to re-run after large changes.

Why is gbrain search not finding code in my repo?

Stale or missing index data is the usual cause, or the current worktree is not pinned. Run /sync-gbrain --full to re-index, and ensure a .gbrain-source pin exists at the git toplevel so queries are scoped to this worktree.

What is the .gbrain-source file used for?

The .gbrain-source file is a per-worktree pin placed at the git toplevel that scopes gbrain queries to that worktree. Without it, the skill reports the worktree as unpinned and agents fall back to Grep for code questions.

Does sync-gbrain work with remote MCP gbrain servers?

Yes. The preamble detects remote-MCP mode by reading the gbrain server transport in claude.json; in remote-http mode local artifact sync is a no-op because the brain server pulls from GitHub or GitLab on its own cadence.

When should I use gbrain search instead of Grep?

Use gbrain search and query for semantic questions about the codebase, and code-def, code-refs, or code-callers for symbol-aware lookup. Grep remains the fallback when the worktree is not pinned or gbrain is not configured.