/livebook

Operations L2+ Production low usage

/livebook

Overview

/livebook is a production command in the Operations category of the Prismatic Platform that manages the integration between the platform and Livebook, the interactive notebook environment for Elixir. Livebook provides a web-based interface for writing and executing Elixir code in an interactive, cell-by-cell fashion with rich output rendering, Mermaid diagram support, and real-time collaboration. The /livebook command handles Livebook server lifecycle management, notebook generation from platform data, and bidirectional synchronization between Livebook notebooks and platform components.

This command operates under the L2+ authority level and is executed by the elixir-core-specialist agent. It is part of the platform's 216-command slash command registry, built on the AIAD (Autonomous Intelligence Agent Design) standard. Livebook integration is particularly valuable for exploratory data analysis, interactive debugging, documentation with executable examples, and training materials that combine explanation with live code.

In the context of the Prismatic Platform's nearly 100 umbrella applications, Livebook serves as an interactive exploration tool that allows developers to experiment with modules, test hypotheses about system behavior, and visualize data flows without the overhead of writing full test suites or Mix tasks. The /livebook command streamlines this workflow by managing server instances, generating contextual notebooks, and ensuring that Livebook sessions have access to the platform's compiled modules.

The interactive notebook paradigm represents a fundamentally different interaction model from traditional command-line tooling. Where most platform commands execute and produce static output, Livebook sessions create living documents where code, output, and documentation coexist. This makes Livebook particularly valuable for onboarding, where new team members can explore the platform interactively rather than reading static documentation.

Syntax and Usage

/livebook <action> [options]

The command accepts a required action parameter: start, stop, status, generate, open, list, import, or validate.

# Start Livebook server attached to platform runtime
/livebook start

# Start in standalone mode
/livebook start --mode=standalone

# Start on custom port
/livebook start --port=8090

# Stop the running Livebook server
/livebook stop

# Check Livebook server status
/livebook status

# Generate an explorer notebook for a specific module
/livebook generate --type=explorer --module=PrismaticPerimeter

# Generate a debugging notebook
/livebook generate --type=debugger --target=prismatic_web

# Generate a data analysis notebook
/livebook generate --type=analyzer --query="from p in PrismaticStorage.Schema.Asset"

# Open a specific notebook
/livebook open path/to/notebook.livemd

# List available notebooks
/livebook list

# Import a notebook from URL
/livebook import https://example.com/notebook.livemd

Parameters and Options

OptionTypeDefaultDescription
actionstringstatusAction: start, stop, status, generate, open, list, import, validate
--modestringattachedServer mode: attached, standalone
--portinteger8080HTTP port for Livebook web interface
--typestringexplorerNotebook type: explorer, debugger, analyzer, documentation, training
--modulestringnoneTarget module for notebook generation
--targetstringnoneTarget application for debugging notebooks
--querystringnoneEcto query for analysis notebooks
--outputstringautoOutput path for generated notebooks
--passwordstringauto-generatedAccess password for Livebook web interface
--auto-openflagtrueAutomatically open browser after start
--verboseflagfalseShow detailed server output
--includestringnoneAdditional modules to include in generation scope

The --mode parameter controls the level of platform access. Attached mode connects the Livebook instance to the running platform's BEAM node, providing direct access to all compiled modules, running GenServers, ETS tables, and the supervision tree. Standalone mode launches an independent BEAM instance with no platform access, suitable for experimentation without risk of affecting the running system.

Implementation Architecture

The Livebook integration operates through a managed server process that connects to the platform's BEAM runtime.

Server Architecture

/livebook command -> Server Manager -> Livebook Instance
                          |                  |
                          v                  v
                    Process Monitor     Web Interface (port 8080)
                    Health Checker      Notebook Storage
                    Config Manager      Runtime Attachment
                          |                  |
                          v                  v
                    Platform BEAM        File System
                    (attached node)      (.livemd files)

Runtime Modes

ModeConfigurationUse CaseRisk Level
AttachedConnects to running platform nodeFull access to all compiled modules and running processesMedium (read-only recommended)
StandaloneIndependent BEAM instanceIsolated experimentation without affecting running systemLow

Notebook Types

TypePurposeGenerated Content
ExplorerCodebase explorationModule documentation, function examples, type specifications
DebuggerInteractive debuggingProcess inspection, state examination, ETS table browsing
AnalyzerData analysisQuery execution, result visualization, statistical summaries
DocumentationLiving docsExecutable examples with explanations, API walkthroughs
TrainingOnboarding materialStep-by-step tutorials with exercises and validation checks

Notebook Generation Pipeline

The generation process follows a structured pipeline that produces contextually rich notebooks:

  1. Module Introspection: The target module is introspected using Code.fetch_docs/1 and Module.__info__/1 to extract function signatures, documentation strings, type specifications, and callback definitions.

  2. Example Synthesis: For each public function, the generator creates executable example cells with realistic data derived from the function's type specifications and documentation.

  3. Dependency Resolution: The generator identifies module dependencies and creates setup cells that configure the necessary aliases, imports, and runtime connections.

  4. Visualization Integration: Where applicable, VegaLite chart cells and Kino interactive widget cells are added to visualize data structures and process relationships.

  5. Validation Cells: Each notebook includes assertion cells that verify the examples produce expected results, transforming the notebook into a self-validating document.

Examples

Platform-Aware Module Explorer

/livebook generate --type=explorer --module=PrismaticPerimeter \
  --include="PrismaticPerimeter.SecurityRating,PrismaticPerimeter.AssetDiscovery"

Generates a notebook that explores the Perimeter module's public API with executable examples for security rating calculation, asset discovery, and compliance assessment. Each function is demonstrated with realistic input data and annotated output.

Interactive Process Debugging

/livebook generate --type=debugger --target=PrismaticAgents.Supervisor

Creates a debugging notebook pre-configured with cells for inspecting the agent supervisor's child processes, their states, message queue depths, and memory consumption. Includes cells for sending test messages and observing state transitions.

Onboarding Training Suite

/livebook generate --type=training --modules="PrismaticStorage,PrismaticWeb,PrismaticAgents" \
  --output-dir=training/onboarding/

Produces a series of progressive training notebooks that walk new team members through the platform's core systems, starting with basic concepts and building to advanced usage patterns.

Integration with Platform

ComponentRelationshipDetails
Prismatic AgentsExecuted by elixir-core-specialistServer management and notebook generation
Elixir RuntimeBEAM attachmentDirect access to compiled modules
OTP SupervisionProcess managementLivebook runs under supervision
Quality GatesDocumentation qualityNotebooks validated for completeness
TelemetryUsage metricsServer uptime and notebook activity
/codeDevelopment workflowInteractive prototyping before formal implementation
/testTest explorationInteractive test development and debugging
/analyzeData analysisInteractive analysis workflows
VegaLiteVisualizationChart rendering in notebook cells
KinoInteractive widgetsDynamic UI components in notebooks

Workflow Integration

The /livebook command integrates into several platform workflows:

  1. Exploratory Development: Before implementing a new feature, developers use Livebook to explore existing module APIs, test hypotheses about data structures, and prototype algorithms. Successful prototypes are then formalized through /code.

  2. Interactive Debugging: When investigating complex issues, attached-mode Livebook provides direct access to running processes, enabling real-time state inspection and message tracing without restarting the application.

  3. Documentation Maintenance: Generated documentation notebooks serve as living documentation that validates itself on execution. Notebooks committed to the repository ensure that documentation examples remain accurate as the codebase evolves.

  4. Team Onboarding: Training notebooks provide structured, interactive learning paths for new team members. The progressive disclosure of platform concepts, combined with hands-on exercises, accelerates the onboarding process.

  5. CI Integration: Notebooks can be validated in CI to ensure all example cells execute successfully, catching documentation drift early in the development cycle.

NABLA Compliance

All commands operate under the NO MERCY, NO DOUBTS doctrine:

  • NO MERCY: Zero tolerance for incomplete execution or quality violations. Generated notebooks contain working, tested code examples. Non-functional examples are not permitted. Every generated notebook must execute cleanly from start to finish.
  • NO DOUBTS: Full investigation before action, evidence-based results. Notebooks provide interactive verification of claims through executable code cells. Assertions in validation cells provide empirical evidence for documented behavior.

NABLA axiom compliance:

AxiomEnforcement
Provenance MandatoryGenerated notebooks include generation metadata (source module, timestamp)
Signal PluralityMultiple example cells demonstrate the same concept from different angles
Time DecayNotebooks include version stamps; stale notebooks flagged during validation
Evidence-BasedEvery claim in documentation notebooks is backed by executable code

Performance

MetricTargetTypical
Server start (attached)< 10s~5s
Server start (standalone)< 15s~8s
Notebook generation (explorer)< 10s~4s
Notebook generation (training suite)< 60s~25s
Module introspection< 1s per module~200ms per module
Notebook validation< 30s per notebook~10s per notebook
Memory overhead (attached)< 100MB~50MB
Memory overhead (standalone)< 200MB~80MB

The server startup time includes BEAM node connection (attached mode) or compilation (standalone mode). Notebook generation speed depends on the number of public functions in the target modules and the complexity of the type specifications being used for example synthesis.

  • /code - Core coding implementation and feature development
  • /test - Comprehensive test generation and verification
  • /analyze - System architecture analysis with dependency mapping
  • /agents - List and manage agent ecosystem with status monitoring
  • /fix - Bug fix implementation with mandatory regression tests
  • /refactor - Safe refactoring with zero-regression guarantee
  • /quickstart - Project quickstart scaffolding and boilerplate generation

Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL