diff --git a/SKILL.md b/SKILL.md index aaa5612dd4..a0ad9536b1 100644 --- a/SKILL.md +++ b/SKILL.md @@ -356,10 +356,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/autoplan/SKILL.md b/autoplan/SKILL.md index 5346f1d437..c827dfcb9e 100644 --- a/autoplan/SKILL.md +++ b/autoplan/SKILL.md @@ -491,10 +491,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/benchmark-models/SKILL.md b/benchmark-models/SKILL.md index 6a9d62616d..52f27620d6 100644 --- a/benchmark-models/SKILL.md +++ b/benchmark-models/SKILL.md @@ -360,10 +360,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/benchmark/SKILL.md b/benchmark/SKILL.md index 9451d2d4f9..11f88093cd 100644 --- a/benchmark/SKILL.md +++ b/benchmark/SKILL.md @@ -360,10 +360,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/browse/SKILL.md b/browse/SKILL.md index a8138dbbc3..8703a26179 100644 --- a/browse/SKILL.md +++ b/browse/SKILL.md @@ -358,10 +358,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/canary/SKILL.md b/canary/SKILL.md index 08d4d7369e..d1022be95d 100644 --- a/canary/SKILL.md +++ b/canary/SKILL.md @@ -483,10 +483,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/codex/SKILL.md b/codex/SKILL.md index 33228ff9b8..e67fe92603 100644 --- a/codex/SKILL.md +++ b/codex/SKILL.md @@ -486,10 +486,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/context-restore/SKILL.md b/context-restore/SKILL.md index 59b40e82c2..eeb5ac318f 100644 --- a/context-restore/SKILL.md +++ b/context-restore/SKILL.md @@ -487,10 +487,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/context-save/SKILL.md b/context-save/SKILL.md index a1eb245950..166ac8cfe8 100644 --- a/context-save/SKILL.md +++ b/context-save/SKILL.md @@ -486,10 +486,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/cso/SKILL.md b/cso/SKILL.md index a08d7e9fe2..6d631e70f4 100644 --- a/cso/SKILL.md +++ b/cso/SKILL.md @@ -489,10 +489,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/design-consultation/SKILL.md b/design-consultation/SKILL.md index 83eed0a2d9..23f8ee69a7 100644 --- a/design-consultation/SKILL.md +++ b/design-consultation/SKILL.md @@ -509,10 +509,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/design-html/SKILL.md b/design-html/SKILL.md index a480bd62c4..2a0c62e2ae 100644 --- a/design-html/SKILL.md +++ b/design-html/SKILL.md @@ -490,10 +490,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/design-review/SKILL.md b/design-review/SKILL.md index 6454531625..47aaeca734 100644 --- a/design-review/SKILL.md +++ b/design-review/SKILL.md @@ -487,10 +487,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/design-shotgun/SKILL.md b/design-shotgun/SKILL.md index 3386d18fa5..07d0dd2d4c 100644 --- a/design-shotgun/SKILL.md +++ b/design-shotgun/SKILL.md @@ -504,10 +504,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/devex-review/SKILL.md b/devex-review/SKILL.md index 7ef324b3ec..333cd13804 100644 --- a/devex-review/SKILL.md +++ b/devex-review/SKILL.md @@ -489,10 +489,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/diagram/SKILL.md b/diagram/SKILL.md index 9e5a41066c..d306049bae 100644 --- a/diagram/SKILL.md +++ b/diagram/SKILL.md @@ -484,10 +484,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/document-generate/SKILL.md b/document-generate/SKILL.md index 30846fc4dd..f8df448bc1 100644 --- a/document-generate/SKILL.md +++ b/document-generate/SKILL.md @@ -489,10 +489,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/document-release/SKILL.md b/document-release/SKILL.md index b95873625b..095a72179f 100644 --- a/document-release/SKILL.md +++ b/document-release/SKILL.md @@ -487,10 +487,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/health/SKILL.md b/health/SKILL.md index e68199dec5..5c6e72a519 100644 --- a/health/SKILL.md +++ b/health/SKILL.md @@ -485,10 +485,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/investigate/SKILL.md b/investigate/SKILL.md index 5d54b42567..84492a2aeb 100644 --- a/investigate/SKILL.md +++ b/investigate/SKILL.md @@ -524,10 +524,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/ios-clean/SKILL.md b/ios-clean/SKILL.md index 6c466896be..302bdf119e 100644 --- a/ios-clean/SKILL.md +++ b/ios-clean/SKILL.md @@ -487,10 +487,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/ios-design-review/SKILL.md b/ios-design-review/SKILL.md index 904da7589b..b37fb287b7 100644 --- a/ios-design-review/SKILL.md +++ b/ios-design-review/SKILL.md @@ -489,10 +489,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/ios-fix/SKILL.md b/ios-fix/SKILL.md index 3ddae1ac0c..f92b08a3d8 100644 --- a/ios-fix/SKILL.md +++ b/ios-fix/SKILL.md @@ -490,10 +490,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/ios-qa/SKILL.md b/ios-qa/SKILL.md index 24624be5f2..0560dd304b 100644 --- a/ios-qa/SKILL.md +++ b/ios-qa/SKILL.md @@ -493,10 +493,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/ios-sync/SKILL.md b/ios-sync/SKILL.md index 95e0bca0a4..67d37d476a 100644 --- a/ios-sync/SKILL.md +++ b/ios-sync/SKILL.md @@ -487,10 +487,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/land-and-deploy/SKILL.md b/land-and-deploy/SKILL.md index 54ebf52c0f..cea7671391 100644 --- a/land-and-deploy/SKILL.md +++ b/land-and-deploy/SKILL.md @@ -482,10 +482,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/landing-report/SKILL.md b/landing-report/SKILL.md index 8f7e6e2103..03b20b0b8e 100644 --- a/landing-report/SKILL.md +++ b/landing-report/SKILL.md @@ -483,10 +483,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/learn/SKILL.md b/learn/SKILL.md index a0c6ae053b..c3707179b4 100644 --- a/learn/SKILL.md +++ b/learn/SKILL.md @@ -485,10 +485,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/make-pdf/SKILL.md b/make-pdf/SKILL.md index 600eb47ca4..7378a00f78 100644 --- a/make-pdf/SKILL.md +++ b/make-pdf/SKILL.md @@ -395,10 +395,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/office-hours/SKILL.md b/office-hours/SKILL.md index 83161b8ca9..f1350ae6a9 100644 --- a/office-hours/SKILL.md +++ b/office-hours/SKILL.md @@ -520,10 +520,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/open-gstack-browser/SKILL.md b/open-gstack-browser/SKILL.md index 28fb1ddb27..19672c78e3 100644 --- a/open-gstack-browser/SKILL.md +++ b/open-gstack-browser/SKILL.md @@ -482,10 +482,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/pair-agent/SKILL.md b/pair-agent/SKILL.md index eed9d171af..a59f3b874c 100644 --- a/pair-agent/SKILL.md +++ b/pair-agent/SKILL.md @@ -484,10 +484,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/plan-ceo-review/SKILL.md b/plan-ceo-review/SKILL.md index 3d3208bee6..8c58293c2b 100644 --- a/plan-ceo-review/SKILL.md +++ b/plan-ceo-review/SKILL.md @@ -514,10 +514,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/plan-design-review/SKILL.md b/plan-design-review/SKILL.md index e81f7f12af..a361b2c7a2 100644 --- a/plan-design-review/SKILL.md +++ b/plan-design-review/SKILL.md @@ -486,10 +486,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/plan-devex-review/SKILL.md b/plan-devex-review/SKILL.md index 20a32da8bb..1b64896d53 100644 --- a/plan-devex-review/SKILL.md +++ b/plan-devex-review/SKILL.md @@ -492,10 +492,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/plan-eng-review/SKILL.md b/plan-eng-review/SKILL.md index 5557a33fa0..365183694d 100644 --- a/plan-eng-review/SKILL.md +++ b/plan-eng-review/SKILL.md @@ -490,10 +490,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/plan-tune/SKILL.md b/plan-tune/SKILL.md index f49b66fac3..ead50e5172 100644 --- a/plan-tune/SKILL.md +++ b/plan-tune/SKILL.md @@ -495,10 +495,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/qa-only/SKILL.md b/qa-only/SKILL.md index 801a935c06..18ad89eae0 100644 --- a/qa-only/SKILL.md +++ b/qa-only/SKILL.md @@ -485,10 +485,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/qa/SKILL.md b/qa/SKILL.md index c1ac10253f..4c8f72b200 100644 --- a/qa/SKILL.md +++ b/qa/SKILL.md @@ -491,10 +491,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/retro/SKILL.md b/retro/SKILL.md index 3fbc447261..3ab7772491 100644 --- a/retro/SKILL.md +++ b/retro/SKILL.md @@ -502,10 +502,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/review/SKILL.md b/review/SKILL.md index 5f26e2e426..062ab7c88a 100644 --- a/review/SKILL.md +++ b/review/SKILL.md @@ -487,10 +487,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/scrape/SKILL.md b/scrape/SKILL.md index dc965ec5f7..bdb2b57eee 100644 --- a/scrape/SKILL.md +++ b/scrape/SKILL.md @@ -483,10 +483,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/scripts/resolvers/preamble/generate-brain-sync-block.ts b/scripts/resolvers/preamble/generate-brain-sync-block.ts index 1486f3c3f4..80558ca4dc 100644 --- a/scripts/resolvers/preamble/generate-brain-sync-block.ts +++ b/scripts/resolvers/preamble/generate-brain-sync-block.ts @@ -61,10 +61,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + \`--version\` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \\\`gbrain search\\\`/\\\`gbrain query\\\` over Grep for" echo "semantic questions; use \\\`gbrain code-def\\\`/\\\`code-refs\\\`/\\\`code-callers\\\` for" echo "symbol-aware code lookup. See \\"## GBrain Search Guidance\\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \\\`gbrain search\\\`/\\\`code-def\\\`" + echo "this session; use Grep instead. Diagnose with \\\`gbrain doctor --fast\\\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \\\`/sync-gbrain --full\\\`" echo "before relying on \\\`gbrain search\\\` for code questions in this worktree." diff --git a/setup-browser-cookies/SKILL.md b/setup-browser-cookies/SKILL.md index 77df27da2c..f2e1d35cb3 100644 --- a/setup-browser-cookies/SKILL.md +++ b/setup-browser-cookies/SKILL.md @@ -354,10 +354,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/setup-deploy/SKILL.md b/setup-deploy/SKILL.md index 3465dc564b..b988da37f1 100644 --- a/setup-deploy/SKILL.md +++ b/setup-deploy/SKILL.md @@ -486,10 +486,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/setup-gbrain/SKILL.md b/setup-gbrain/SKILL.md index a3892f1c90..9684f3eb2d 100644 --- a/setup-gbrain/SKILL.md +++ b/setup-gbrain/SKILL.md @@ -485,10 +485,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/ship/SKILL.md b/ship/SKILL.md index eadffaa8f6..433036d4c6 100644 --- a/ship/SKILL.md +++ b/ship/SKILL.md @@ -487,10 +487,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/skillify/SKILL.md b/skillify/SKILL.md index 7cb434d0ca..c7d725f240 100644 --- a/skillify/SKILL.md +++ b/skillify/SKILL.md @@ -483,10 +483,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/spec/SKILL.md b/spec/SKILL.md index 0894e98d18..1752de1f7d 100644 --- a/spec/SKILL.md +++ b/spec/SKILL.md @@ -484,10 +484,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." @@ -1554,10 +1573,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree." diff --git a/sync-gbrain/SKILL.md b/sync-gbrain/SKILL.md index 02055bb6f8..2f1481c664 100644 --- a/sync-gbrain/SKILL.md +++ b/sync-gbrain/SKILL.md @@ -485,10 +485,29 @@ if [ -f "$_GBRAIN_CONFIG" ] && command -v gbrain >/dev/null 2>&1; then _GBRAIN_PIN_PATH="$_REPO_TOP/.gbrain-source" fi if [ -n "$_GBRAIN_PIN_PATH" ]; then + # Liveness probe. A config file + `--version` + a pin only prove gbrain is + # INSTALLED; none of them prove its engine is reachable. When the engine is + # down (disk full, container stopped, pooler unreachable, autopilot wedged) + # this block would still tell the agent to "prefer gbrain search" — so the + # agent keeps reaching for a tool whose every query fails, instead of + # falling back to Grep. One bounded probe closes that gap; the timeout + # keeps a hung engine from stalling the preamble of every skill. + _GBRAIN_ALIVE=0 + if command -v timeout >/dev/null 2>&1; then + timeout 5 gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + else + gbrain sources list >/dev/null 2>&1 && _GBRAIN_ALIVE=1 + fi + if [ "$_GBRAIN_ALIVE" -eq 1 ]; then echo "GBrain configured. Prefer \`gbrain search\`/\`gbrain query\` over Grep for" echo "semantic questions; use \`gbrain code-def\`/\`code-refs\`/\`code-callers\` for" echo "symbol-aware code lookup. See \"## GBrain Search Guidance\" in CLAUDE.md." echo "Run /sync-gbrain to refresh." + else + echo "GBrain DOWN — this worktree is pinned, but a probe query failed, so" + echo "the engine is unreachable. Do NOT rely on \`gbrain search\`/\`code-def\`" + echo "this session; use Grep instead. Diagnose with \`gbrain doctor --fast\`." + fi else echo "GBrain configured but this worktree isn't pinned yet. Run \`/sync-gbrain --full\`" echo "before relying on \`gbrain search\` for code questions in this worktree."