Skip to content

workspace

workspace

Workspace and environment configuration models.

Defines models for isolation, workspace lifecycle, cross-sheet context, logging, AI review, and feedback.

Classes

IsolationMode

Bases: str, Enum

Isolation method for parallel job execution.

IsolationConfig

Bases: BaseModel

Configuration for execution isolation.

Worktree isolation creates a separate git working directory for each job, enabling safe parallel execution where multiple jobs can modify code without interfering with each other.

Example YAML

isolation: enabled: true mode: worktree branch_prefix: marianne cleanup_on_success: true

Methods:
get_worktree_base
get_worktree_base(workspace)

Get the directory where worktrees are created.

Source code in src/marianne/core/config/workspace.py
def get_worktree_base(self, workspace: Path) -> Path:
    """Get the directory where worktrees are created."""
    if self.worktree_base:
        return self.worktree_base
    return workspace / ".worktrees"
get_branch_name
get_branch_name(job_id)

Generate branch name for a job.

Source code in src/marianne/core/config/workspace.py
def get_branch_name(self, job_id: str) -> str:
    """Generate branch name for a job."""
    return f"{self.branch_prefix}/{job_id}"

WorkspaceLifecycleConfig

Bases: BaseModel

Configuration for workspace lifecycle management.

Controls how workspace files are handled across job iterations, particularly for self-chaining jobs that reuse the same workspace.

When archive_on_fresh is True and --fresh is used, Marianne moves non-essential workspace files to a numbered archive subdirectory before clearing state. This prevents stale file_exists and command_succeeds validations from passing on previous iteration's artifacts.

Example YAML

workspace_lifecycle: archive_on_fresh: true archive_dir: archive max_archives: 10 preserve_patterns: - ".iteration" - ".marianne-*" - ".coverage" - "archive/" - ".worktrees/"

LogConfig

Bases: BaseModel

Configuration for structured logging.

Controls log level, output format, and file rotation settings.

AIReviewConfig

Bases: BaseModel

Configuration for AI-powered code review after batch execution.

Enables automated quality assessment of code changes with scoring.

CrossSheetConfig

Bases: BaseModel

Configuration for cross-sheet context passing.

Enables templates to access outputs from previous sheets, allowing later sheets to build on results from earlier ones without manual file reading. This is useful for multi-phase workflows where each sheet needs context from prior execution.

FeedbackConfig

Bases: BaseModel

Configuration for developer feedback collection (GH#15).

When enabled, Marianne extracts structured feedback from agent output after each sheet execution. Feedback is stored in SheetState.agent_feedback.

Example YAML

feedback: enabled: true pattern: '(?s)FEEDBACK_START(.+?)FEEDBACK_END' format: json

Functions:

resolve_workspace_root

resolve_workspace_root()

Root directory for conductor-managed workspaces (#58).

Defaults to ~/workspaces — the convention that every Marianne score's workspace lives under one home-rooted tree, never scattered beside the score file or inside a repo. An operator may override the root via the MARIANNE_WORKSPACE_ROOT env var; the test suite uses this to redirect auto-derived workspaces into a temp dir instead of a real home.

Source code in src/marianne/core/config/workspace.py
def resolve_workspace_root() -> Path:
    """Root directory for conductor-managed workspaces (#58).

    Defaults to ``~/workspaces`` — the convention that every Marianne score's
    workspace lives under one home-rooted tree, never scattered beside the
    score file or inside a repo. An operator may override the root via the
    ``MARIANNE_WORKSPACE_ROOT`` env var; the test suite uses this to redirect
    auto-derived workspaces into a temp dir instead of a real home.
    """
    override = os.environ.get(WORKSPACE_ROOT_ENV)
    if override:
        return Path(override).expanduser()
    return Path.home() / "workspaces"

sanitize_workspace_name

sanitize_workspace_name(name)

Reduce a score name to a single filesystem-safe path segment.

Collapses any run of characters outside [A-Za-z0-9._-] to a single hyphen and trims separators from the ends, so "DJ GestAIt v2" becomes "DJ-GestAIt-v2" and "fix/emzihypno" becomes "fix-emzihypno". Falls back to "job" if nothing usable remains.

Source code in src/marianne/core/config/workspace.py
def sanitize_workspace_name(name: str) -> str:
    """Reduce a score ``name`` to a single filesystem-safe path segment.

    Collapses any run of characters outside ``[A-Za-z0-9._-]`` to a single
    hyphen and trims separators from the ends, so ``"DJ GestAIt v2"`` becomes
    ``"DJ-GestAIt-v2"`` and ``"fix/emzihypno"`` becomes ``"fix-emzihypno"``.
    Falls back to ``"job"`` if nothing usable remains.
    """
    safe = re.sub(r"[^A-Za-z0-9._-]+", "-", name).strip("-._")
    return safe or "job"

default_workspace_for

default_workspace_for(name)

The auto-derived workspace for a score that omits workspace: (#58).

<workspace-root>/<sanitized-name> — e.g. ~/workspaces/my-score.

Source code in src/marianne/core/config/workspace.py
def default_workspace_for(name: str) -> Path:
    """The auto-derived workspace for a score that omits ``workspace:`` (#58).

    ``<workspace-root>/<sanitized-name>`` — e.g. ``~/workspaces/my-score``.
    """
    return resolve_workspace_root() / sanitize_workspace_name(name)

scratch_root

scratch_root(workspace)

The per-job scratch root every instrument is told about (GH #460).

Source code in src/marianne/core/config/workspace.py
def scratch_root(workspace: Path) -> Path:
    """The per-job scratch root every instrument is told about (GH #460)."""
    return workspace / SCRATCH_DIR_NAME

mailbox_root

mailbox_root(workspace)

The job mailbox is scratch data, removed with the scratch root.

Source code in src/marianne/core/config/workspace.py
def mailbox_root(workspace: Path) -> Path:
    """The job mailbox is scratch data, removed with the scratch root."""
    return scratch_root(workspace) / MAILBOX_DIR_NAME