job
job
¶
Job and sheet configuration models.
Defines the top-level JobConfig, SheetConfig, and PromptConfig models.
Attributes¶
MAX_VARIABLE_FAN_OUT_WIDTH
module-attribute
¶
Upper bound on a fan-out width resolved from a prompt variable (#569).
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)
Methods:¶
exactly_one_source
¶
Ensure exactly one of file or directory is specified.
Source code in src/marianne/core/config/job.py
MovementCadenzaItem
¶
Bases: InjectionItem
A cadenza declared on a movement, so it reaches every voice of that stage (#571).
Same shape as an :class:InjectionItem (file or directory,
as, required, max_bytes), plus voice to narrow the item
to one voice of the fan-out instead of every voice. Legal only under
movements.<n>.cadenzas; a voice spelled under sheet.prelude
or sheet.cadenzas is an unknown field there: it is stripped and
reported as V010 (a warning that names movements.cadenzas.voice).
AliasEntry
¶
Bases: BaseModel
One entry of a multi-entry alias chain: a profile and its settings.
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.
An alias binds ONE profile (profile + config) or an ordered
chain of entries with select modifiers that decide which entry a
given sheet starts on; the rest of the chain follows as that sheet's
fallbacks. Build-time modifiers order the chain per sheet; balance is
applied by the conductor at dispatch.
Example YAML::
instruments:
fast-writer:
profile: gemini-cli
config:
model: gemini-2.5-flash
timeout_seconds: 300
reviewer:
chain:
- {profile: codex-cli, config: {model: gpt-6-astra}}
- {profile: claude-code, config: {model: claude-opus-5-5}}
- {profile: opencode, config: {model: zai-coding-plan/glm-5.3-flash}}
select: [spread, balance]
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). A movement can also declare cadenzas — context injected into every voice of the movement (GH #571).
Example YAML::
movements:
1:
name: Planning
instrument: claude-code
2:
name: Implementation
voices: 3
instrument: gemini-cli
cadenzas:
- {file: "{{ workspace }}/shared-plan.md", as: context}
- {voice: 2, file: "{{ workspace }}/only-voice-2.md", as: context}
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.
A count may name a prompt.variables entry instead of a literal
('{{ chapter_count }}'). It is resolved to an integer before this
model validates, by :func:resolve_fan_out_width through
JobConfig. Resolved references enter this class as integers; the
field's own type remains dict[int, int]. This
class does not resolve anything itself: built directly with a
'{{ name }}' count, it refuses it as a non-integer. A reference
that cannot be resolved is V338, raised while the JobConfig loads.
A loop's max_iterations or count may likewise name a
prompt.variables entry ('{{ max_passes }}', dotted paths
allowed). JobConfig resolves it to an integer in 1..10000
before this model validates, exactly as it resolves a fan-out width;
this class resolves nothing itself, and built directly with a
reference it refuses it as a non-integer. A reference that cannot be
resolved is V351, raised while the JobConfig loads.
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).
Methods:¶
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.
119 migration guidance: skip_when_command was renamed to¶
skip_when (the old expression-based skip_when was never
evaluated at runtime and is removed). Both legacy shapes fail
LOUDLY with the fix, instead of a generic pydantic error.
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
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 | |
validate_flow
¶
Collect flow load errors once, after stage keys are concrete.
Source code in src/marianne/core/config/job.py
1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 | |
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.
Methods:¶
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
ValidateConfig
¶
Bases: BaseModel
Score-local acknowledgement of advisory validator findings.
JobConfig
¶
Bases: BaseModel
Complete configuration for an orchestration job.
Attributes¶
workspace_auto_managed
property
¶
Whether the loader derived workspace from name (#58).
True only when the score file omits workspace:. A run named with
mzt run --job-id (GH #505) then gets ~/workspaces/<job-id>
instead, so two runs of one shipped score never share a workspace.
tick_wall_seconds
property
¶
The tick cap, with the legacy root spelling as a one-release alias.
effective_instrument_name
property
¶
Return the name used to resolve this score's execution instrument.
The explicit instrument: field wins when set; otherwise the
default instrument (claude-code, Marianne's reference instrument)
is returned. Display and dispatch paths rely on this single
identifier.
Methods:¶
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_bytes
classmethod
¶
Load job configuration from exact bytes, attributed to source_path.
Semantics match :meth:from_yaml (workspace pre-resolution relative
to the score file's parent, default workspace for omitted workspace,
source_path attribution), but the parsed YAML comes from the
provided bytes rather than a fresh read of the path. Used by the
daemon's pinned-schedule admission so the config a job executes is
derived from exactly the bytes whose digest was verified against the
daemon-owned pin.
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.
Source code in src/marianne/core/config/job.py
Functions:¶
resolve_variable_integer
¶
Resolve one integer field that may be a bare {{ name }} reference (#569, #568).
A literal integer is returned unchanged and is left for the model field's
own validation. The caller's bound applies only to variable
references. A boolean or any other non-string value returns an issue
saying the value is not a noun.
A string must be exactly one bare {{ name }} reference, optionally
dotted ({{ a.b }}) and padded with whitespace. The variables
mapping is walked along that name; a missing step, or a step whose value
is None, is _not_declared. What is found must be an integer or a
string of ASCII digits (no sign), in 1..bound:
- an integer is echoed in the out-of-range message when its absolute
value is below
10**10; - a digit string is judged by its significant digits, so leading zeroes never count against it. Surrounding whitespace is ignored. Up to the bound's own digit count it is converted and echoed like an integer; longer values return an out-of-range issue without conversion or echoing the value. This avoids CPython's integer-conversion limit.
- any other value (a float, a
bool, other text, an empty string) is_not_a_whole_number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
object
|
One field value, e.g. from |
required |
variables
|
Mapping[str, object]
|
The declared |
required |
bound
|
int
|
The inclusive upper bound for a resolved value. |
required |
noun
|
str
|
What the field is called in messages ("width", "loop cap"). |
required |
check
|
str
|
The flow check id stamped on every issue. |
required |
Returns:
| Type | Description |
|---|---|
int | FlowIssue
|
The integer, or one |
int | FlowIssue
|
carries no span: the caller supplies it. Invalid values return |
int | FlowIssue
|
issues rather than raising validation errors. |
Source code in src/marianne/core/config/job.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
resolve_fan_out_width
¶
Resolve one sheet.fan_out value to an integer width (#569).
A literal integer is returned unchanged and is left for SheetConfig
to validate. The 1..MAX_VARIABLE_FAN_OUT_WIDTH bound applies only
to variable references. A boolean or any other non-string value returns
an invalid-width issue.
A string must be exactly one bare {{ name }} reference, optionally
dotted ({{ a.b }}) and padded with whitespace. The variables
mapping is walked along that name; a missing step, or a step whose value
is None, is _not_declared. What is found must be an integer or a
string of ASCII digits (no sign), in 1..MAX_VARIABLE_FAN_OUT_WIDTH:
- an integer is echoed in the out-of-range message when its absolute
value is below
10**10; - a digit string is judged by its significant digits, so leading zeroes never count against it. Surrounding whitespace is ignored. Up to the cap's own digit count it is converted and echoed like an integer; longer values return an out-of-range issue without conversion or echoing the value. This avoids CPython's integer-conversion limit.
- any other value (a float, a
bool, other text, an empty string) is_not_a_whole_number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
object
|
One value from |
required |
variables
|
Mapping[str, object]
|
The declared |
required |
Returns:
| Type | Description |
|---|---|
int | FlowIssue
|
The width, or one |
int | FlowIssue
|
The issue carries no span: the caller supplies the stage. Invalid |
int | FlowIssue
|
widths return issues rather than raising validation errors. |
Source code in src/marianne/core/config/job.py
movement_cadenzas
¶
Stage-keyed cadenza declarations, as authored (#571).
Returns the map of stage number to that movement's cadenza items,
stages ascending, listing only the movements that declare items. The
movement number is the stage — the same namespace as sheet.fan_out
keys and loop spans. Nothing is copied into sheet.cadenzas: the
items are resolved per sheet by :func:cadenzas_for_sheet.
Source code in src/marianne/core/config/job.py
cadenzas_for_sheet
¶
The cadenza items one concrete sheet reads, in delivery order (#571).
The movement cadenza items whose voice is None or equals the
sheet's fan-out instance (1 on a solo movement), then the sheet's
own sheet.cadenzas[sheet_num] items. Pure: it never writes to
config, so a re-validated dump (resume) never delivers them twice.
Source code in src/marianne/core/config/job.py
stage_sheets
¶
The concrete sheets of a stage, lowest first (#571).
Read from fan_out_stage_map after expansion; a stage without
fan-out is the sheet of that number; a stage that has no sheet (for
example a movement number past the last stage) returns [].
Source code in src/marianne/core/config/job.py
merge_runtime_variables
¶
Merge per-invocation --var variables into prompt.variables (#359).
CLI variables override YAML on key collision (the documented
make/terraform contract). No-op when empty. The daemon applies this at
submit and resume; mzt run --dry-run applies the same seam so the
preview renders the score the conductor would run (examples QA, 21 Oct:
the preview ignored --var and showed [CHANGE THIS] placeholders).