brain_deer.commands.session

Session provenance, reproducible macros, and methods-text generation.

Two ideas that turn BrainDeer’s command system into a reproducibility engine:

  • Provenance journal — every state-changing command (whether run from the palette or by the AI) is recorded with a timestamp. From that log we can regenerate a human-readable methods paragraph and export the full session as JSON, so a figure or finding is always traceable to the exact steps that produced it.

  • Macros / recipes — record a sequence of commands, name it, and replay it later (or on another dataset). This is the “save a workflow and re-run it” primitive that neuroimaging viewers usually lack.

Classes

SessionJournal

Append-only in-memory log of dispatched commands (newest last).

MacroRecorder

Captures state-changing commands while recording, for later replay.

MacroStore

Persists named macros as JSON files in the command data directory.

Functions

register_session_commands(→ SessionServices)

Create session services, wire observers, and register session/macro commands.

Module Contents

class brain_deer.commands.session.SessionJournal(max_entries: int = 2000)

Append-only in-memory log of dispatched commands (newest last).

methods_text() → str

A plain-language methods paragraph from the state-changing history.

class brain_deer.commands.session.MacroRecorder

Captures state-changing commands while recording, for later replay.

class brain_deer.commands.session.MacroStore(directory: pathlib.Path)

Persists named macros as JSON files in the command data directory.

brain_deer.commands.session.register_session_commands(registry: brain_deer.commands.registry.CommandRegistry, api: Any) → SessionServices

Create session services, wire observers, and register session/macro commands.