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