Skip to main content

Module scopes

Module scopes 

Source
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§

AbsorbAllReport
Report for absorb-all.
AbsorbReport
Report from absorb.
CargoMember
One discovered Cargo workspace member.
DiscoveryOptions
How scopes were / should be discovered.
ImportBrainOptions
Options for importing one workspace brain into another.
ImportBrainReport
Result of importing a brain.
ReconcileReport
Report from reconcile_scopes.
ScopeDef
One SubBrain (or extra root) under the MainBrain.
WorkspaceManifest
Versioned .brain/workspace.json manifest.

Enums§

BrainMode
Workspace brain mode.
ScopeSource
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).
disable_multi
Disable multi-brain (single mode). Does not change node scopes until absorb/re-sync.
discover_cargo_members
Discover [workspace].members from root Cargo.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_workspace into target_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_scopeto_scope in 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).
sanitize_scope_id
Sanitize a user-provided scope id.
save_manifest
Write manifest (pretty JSON). Creates .brain/ if needed.