Expand description
MainBrain / SubBrain workspace scopes (multi-crate / multi-root).
Default is single-brain: every node owns scope MAIN_SCOPE (main).
Multi-brain is opt-in via enable_multi / rustbrain scopes enable.
Design rules:
- Flat sibling SubBrains only (no nested brains).
- One canonical owner scope per node.
- Cross-scope WikiLinks / symbols stay in one workspace graph.
- Distinct from
--all-workspaces(machine-global registry of projects).
Structs§
- Absorb
AllReport - Report for absorb-all.
- Absorb
Report - Report from absorb.
- Cargo
Member - One discovered Cargo workspace member.
- Detect
Report - Report from
detect_path— what id to use for import/attach. - Discovery
Options - How scopes were / should be discovered.
- Import
Brain Options - Options for importing one workspace brain into another.
- Import
Brain Report - Result of importing a brain.
- Reconcile
Report - Report from
reconcile_scopes. - Scope
Def - One SubBrain (or extra root) under the MainBrain.
- Workspace
Manifest - Versioned
.brain/workspace.jsonmanifest.
Enums§
- Brain
Mode - Workspace brain mode.
- Scope
Source - How a scope entry was created.
Constants§
- IMPORT_
DEFAULT_ MAX_ BYTES - Default max total bytes copied in one import.
- IMPORT_
DEFAULT_ MAX_ FILES - Default max Markdown files copied in one import (DoS guard).
- MAIN_
SCOPE - Canonical MainBrain scope id.
Functions§
- absorb_
all_ to_ main - Absorb all SubBrains into main and set single mode.
- absorb_
scope - Absorb a SubBrain into MainBrain: reassign nodes + drop scope def.
- add_
scope - Add or replace a SubBrain root.
- apply_
cargo_ discovery - Apply Cargo members into manifest scopes (replaces prior cargo-workspace sources).
- attach_
subbrain - Attach an existing directory under the workspace as a SubBrain without copying.
- count_
nodes_ by_ scope - Counts of nodes per scope (from SQLite).
- detect_
path - Detect how a path should be attached/imported as a SubBrain.
- disable_
multi - Disable multi-brain (single mode). Does not change node scopes until absorb/re-sync.
- discover_
cargo_ members - Discover
[workspace].membersfrom rootCargo.toml(no recursion into nested workspaces). - enable_
multi - Enable multi-brain mode. Optionally discover Cargo members.
- ensure_
manifest - Ensure a workspace.json exists (single mode) without enabling multi.
- format_
scopes_ text - Human-readable scopes listing.
- import_
brain - Import knowledge from
source_workspaceintotarget_workspace. - load_
manifest - Load manifest if present; otherwise single-mode default (does not write).
- manifest_
path - Path to
.brain/workspace.json. - reassign_
node_ scopes - Reassign all nodes with
from_scope→to_scopein SQLite. - reconcile_
scopes - Recompute every node’s owner scope from the current manifest (+ optional frontmatter).
- remove_
scope_ def - Remove a SubBrain from the manifest (does not rewrite nodes).
- rewrite_
wikilinks_ for_ import - Prefix path-like WikiLink targets so they resolve after copy under
dest_prefix. - sanitize_
scope_ id - Sanitize a user-provided scope id.
- save_
manifest - Write manifest (pretty JSON). Creates
.brain/if needed. - scope_
for_ cwd - If
cwdsits under a SubBrain root ofworkspace, return that scope id. - suggest_
scope_ id - Suggest a path-stable SubBrain id for a directory name or path.