job
job
¶
Job and sheet configuration models.
Defines the top-level JobConfig, SheetConfig, and PromptConfig models.
Classes¶
InjectionCategory
¶
Bases: str, Enum
Category for injected content in prelude/cadenza system.
Determines WHERE in the prompt the injected content appears: - context: Background knowledge, after template body - skill: Methodology/instructions, after preamble - tool: Available actions, after preamble
InjectionItem
¶
Bases: BaseModel
A single injection item referencing a file or directory with a category.
Used in prelude (all sheets) and cadenzas (per-sheet) to inject file content into prompts at category-appropriate locations.
Supports two mutually exclusive modes:
- file: inject a single file's content
- directory: inject all files in a directory (directory cadenza)
Functions¶
exactly_one_source
¶
Ensure exactly one of file or directory is specified.
Source code in src/marianne/core/config/job.py
InstrumentDef
¶
Bases: BaseModel
A named instrument definition within a score.
Allows a score to declare reusable instrument aliases that reference registered instrument profiles with optional configuration overrides. These aliases can then be referenced by name in per-sheet or per-movement instrument assignments.
Example YAML::
instruments:
fast-writer:
profile: gemini-cli
config:
model: gemini-2.5-flash
timeout_seconds: 300
deep-thinker:
profile: claude-code
config:
timeout_seconds: 3600
MovementDef
¶
Bases: BaseModel
Declaration of a movement within a score.
Movements are sequential execution phases. Each movement can specify a name, an instrument (overriding the score default), instrument config, and a voice count (shorthand for fan-out).
Example YAML::
movements:
1:
name: Planning
instrument: claude-code
2:
name: Implementation
voices: 3
instrument: gemini-cli
3:
name: Review
SheetConfig
¶
Bases: BaseModel
Configuration for sheet processing.
In Marianne's musical theme, a composition is divided into sheets, each containing a portion of the work to be performed.
Fan-out support: When fan_out is specified, stages are expanded into
concrete sheets at parse time. For example, total_items=7, fan_out={2: 3}
produces 9 concrete sheets (stage 2 instantiated 3 times). After expansion,
total_items and dependencies reflect expanded values, and fan_out
is cleared to {} to prevent re-expansion on resume.
Attributes¶
total_stages
property
¶
Return the original stage count.
After fan-out expansion, total_items reflects expanded sheet count. total_stages preserves the original logical stage count from fan_out_stage_map. When no fan-out was used, total_stages == total_sheets (identity).
Functions¶
strip_computed_fields
classmethod
¶
Strip computed properties that users may include in YAML.
total_sheets is computed from size/total_items, not configurable. Accept it silently for backward compatibility — rejecting it would break existing scores that include it.
Source code in src/marianne/core/config/job.py
validate_per_sheet_instruments
classmethod
¶
Validate per-sheet instrument assignments.
Source code in src/marianne/core/config/job.py
validate_per_sheet_fallbacks
classmethod
¶
Validate per-sheet fallback chain keys are positive integers.
Source code in src/marianne/core/config/job.py
validate_instrument_map
classmethod
¶
Validate instrument_map: no duplicate sheets, valid names.
Source code in src/marianne/core/config/job.py
get_fan_out_metadata
¶
Get fan-out metadata for a specific sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheet_num
|
int
|
Concrete sheet number (1-indexed). |
required |
Returns:
| Type | Description |
|---|---|
FanOutMetadata
|
FanOutMetadata with stage, instance, and fan_count. |
FanOutMetadata
|
When no fan-out is configured, returns identity metadata |
FanOutMetadata
|
(stage=sheet_num, instance=1, fan_count=1). |
Source code in src/marianne/core/config/job.py
validate_fan_out
classmethod
¶
Validate fan_out field values.
Source code in src/marianne/core/config/job.py
validate_dependencies
classmethod
¶
Validate dependency declarations.
Note: Full validation (range checks, cycle detection) happens when the DependencyDAG is built at runtime, since total_sheets isn't available during field validation.
Source code in src/marianne/core/config/job.py
expand_fan_out_config
¶
Expand fan_out declarations into concrete sheet assignments.
This runs after field validators. When fan_out is non-empty: 1. Validates constraints (size=1, start_item=1) 2. Calls expand_fan_out() to compute concrete sheet assignments 3. Overwrites total_items and dependencies with expanded values 4. Stores metadata in fan_out_stage_map for resume support 5. Clears fan_out={} to prevent re-expansion on resume
Source code in src/marianne/core/config/job.py
validate_dependency_range
¶
Validate that dependency sheet numbers are within the valid range.
Runs after fan-out expansion so total_sheets reflects the final count.
Source code in src/marianne/core/config/job.py
PromptConfig
¶
Bases: BaseModel
Configuration for prompt templating.
Functions¶
at_least_one_template
¶
Warn when no template source is provided (falls back to default prompt).
Source code in src/marianne/core/config/job.py
JobConfig
¶
Bases: BaseModel
Complete configuration for an orchestration job.
Functions¶
to_yaml
¶
Serialize this JobConfig to valid score YAML.
The output is semantically equivalent to the original config:
from_yaml_string(config.to_yaml()) produces an equivalent config
(compared via model_dump()). String-level identity with the
original YAML file is NOT guaranteed because workspace paths are
resolved to absolute at parse time and fan-out configs are expanded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exclude_defaults
|
bool
|
If True, omit fields that match their default values for cleaner output. Defaults to False (lossless). |
False
|
Returns:
| Type | Description |
|---|---|
str
|
A valid YAML string that |
Source code in src/marianne/core/config/job.py
from_yaml
classmethod
¶
Load job configuration from a YAML file.
Source code in src/marianne/core/config/job.py
from_yaml_string
classmethod
¶
Load job configuration from a YAML string.
Source code in src/marianne/core/config/job.py
get_state_path
¶
Get the resolved state path.
Source code in src/marianne/core/config/job.py
get_outcome_store_path
¶
Get the resolved outcome store path for learning.