# Shell and Migration Scopes

These scopes are used for administrative tasks, interactive shell sessions (via the UI), and data migrations.

# Shell Scope

Used for executing dynamic code strings against the graph, typically by an Admin. This is the most powerful scope, often referred to as the "Admin Shell".

Property/Method Type Description
Graph / G Mosaik.GraphDB.Safe.Graph Full access to the graph.
Query() / Q() IQuery Creates a new query instance.
Logger ILogger Logger instance.
ProgressReporter IUserProgressReporter Reports progress to the UI.
CancellationToken CancellationToken Token for cancellation.
ChatAI ChatAI Helper for Chat AI operations.
UID(string) UID.UID128 Helper to parse a UID string.
RunEndpointAsync<T> Task<T> Executes a code endpoint.
RunToolAsync Task<ToolCallResult> Runs a tool.

# Shell Query Scope

Used for executing read-only query strings in the "Query" tab of the Shell.

Property/Method Type Description
Graph / G SimpleGraph Simplified graph wrapper (read access).
Run(...) IQueryResults Executes a query action.
UID(string) Node Parses a UID string into a Node object.
Key(type, key) Node Creates a Node reference from type and key.
GetNodeType(node) string Gets the type name of a node.
GetNodeTimestamp(node) Time Gets the timestamp of a node.

# Migrations

Migrations are specialized scripts used to evolve the data or schema in your graph. They can report progress and are typically executed via the management interface.

Migrations are useful for:

  • Propagating schema changes from development to production.
  • Bulk updating data (e.g., reformatting phone numbers).
  • Seeding initial data.

You can export migrations from your development environment and import them into production to ensure consistent state changes.

For more details and examples, see the Workspace Migrations section.