feat(sync): GBRAIN_NO_PRUNE_DIRS — un-prune a content dir (e.g. an ops/ KB)#2259
Open
donogeme wants to merge 1 commit into
Open
feat(sync): GBRAIN_NO_PRUNE_DIRS — un-prune a content dir (e.g. an ops/ KB)#2259donogeme wants to merge 1 commit into
donogeme wants to merge 1 commit into
Conversation
PRUNE_DIR_NAMES (node_modules, .raw, ops) is hardcoded. A brain that legitimately uses one of those names as a content tree — e.g. an `ops/` knowledge base rather than throwaway operational files — has no way to sync it. GBRAIN_NO_PRUNE_DIRS (comma-separated) removes names from the prune set. Dot-dirs + git submodules stay pruned regardless. Pinned by test/sync-no-prune-dirs.test.ts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
GBRAIN_NO_PRUNE_DIRS(comma-separated env var) that removes directory names fromPRUNE_DIR_NAMESat walk time, so a brain can sync a tree whose top-level name happens to collide with a pruned name.Why
PRUNE_DIR_NAMES = {node_modules, .raw, ops}is hardcoded.opsin particular is a semantic prune ("operations, not knowledge") — great for repos that useops/for throwaway operational files. But some brains useops/as a genuine knowledge base (e.g.ops/_kb/{compliance,finance,partners,...}). For them, the entire tree is silently invisible to search with no opt-out — a single hardcoded name decides it.This gives an escape hatch without changing any default: set
GBRAIN_NO_PRUNE_DIRS=opsand that tree syncs.Behavior
PRUNE_DIR_NAMES(and the*.rawsuffix rule)..git,.obsidian, …) and git submodules stay pruned regardless — those are never content.pruneDir, so every walker (sync, extract, transcript-discovery) honors it consistently.Example
Tests
test/sync-no-prune-dirs.test.ts— parser contract + prune/un-prune matrix (ops un-pruned, node_modules still pruned, dot-dirs always pruned).bun run typecheckclean.Context
Env-var form mirrors the existing
GBRAIN_SOURCE/GBRAIN_SOURCESconvention. Happy to reshape as async.*config key instead if you'd prefer config-driven over env.