Index
compose
¶
Composition compiler — turns semantic agent definitions into Mozart scores.
The compiler takes high-level descriptions (agent identities, patterns, techniques, instrument assignments) and produces complete Mozart score YAML.
Classes¶
FleetGenerator
¶
Generates fleet configuration from a compiler config.
Takes the full compiler config with agent roster and produces a fleet YAML that references individual agent scores with group dependencies for startup ordering.
Functions¶
generate
¶
Generate a fleet config from the compiler config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any]
|
Full compiler config with project, agents, groups. |
required |
scores_dir
|
Path
|
Directory where individual agent scores will be written. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Fleet config dict suitable for YAML serialization. |
Source code in src/marianne/compose/fleet.py
write
¶
Generate and write a fleet config to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any]
|
Full compiler config. |
required |
scores_dir
|
Path
|
Directory where agent scores live. |
required |
output_path
|
Path
|
Path to write the fleet YAML. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the written fleet config. |
Source code in src/marianne/compose/fleet.py
IdentitySeeder
¶
Creates the L1-L4 identity stack for agents.
The seeder is idempotent: running it on an existing agent directory updates files without corrupting existing identity data. Existing content in L3 (recent) and L4 (growth) is preserved if present.
Source code in src/marianne/compose/identity.py
Functions¶
seed
¶
Create the full identity store for an agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_def
|
dict[str, Any]
|
Agent definition dict with keys: name, voice, focus, and optionally: role, meditation, a2a_skills, techniques. |
required |
existing_memory_path
|
Path | None
|
Path to existing memory file for migration (distilled into L3 recent.md). |
None
|
existing_meditation_path
|
Path | None
|
Path to existing meditation file for migration (distilled into L1 stakes/identity). |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the agent's identity directory. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If agent_def is missing required fields. |
Source code in src/marianne/compose/identity.py
seed_all
¶
Seed identity for all agents in a roster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agents
|
list[dict[str, Any]]
|
List of agent definition dicts. |
required |
migration_memory_dir
|
Path | None
|
Directory containing existing memory files
named |
None
|
migration_meditation_dir
|
Path | None
|
Directory containing existing meditation
files named |
None
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
List of paths to agent identity directories. |
Source code in src/marianne/compose/identity.py
InstrumentResolver
¶
Resolves per-sheet instrument assignments with deep fallback chains.
Produces a matrix of primary instruments and fallback chains for every sheet in the cycle. Free-tier models are the defaults; paid models are power-ups available in the fallback chain.
Functions¶
resolve
¶
Resolve instrument assignments for an agent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_def
|
dict[str, Any]
|
Agent definition with optional instrument overrides. |
required |
defaults
|
dict[str, Any]
|
Global defaults with instrument definitions per tier. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with keys:
|
Source code in src/marianne/compose/instruments.py
PatternExpander
¶
Expands named patterns into sheet sequence modifiers.
Patterns inject additional prompt context and structural guidance into specific phases of the agent cycle. Two expansion modes:
expand()— prompt extensions (per-phase text additions).expand_stages()— concrete stage sequence with purposes, instrument guidance, and validation shapes.
Initialize with optional custom patterns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
custom_patterns
|
dict[str, dict[str, Any]] | None
|
Additional patterns to register beyond builtins. |
None
|
Source code in src/marianne/compose/patterns.py
Functions¶
expand
¶
Expand named patterns into per-phase prompt extensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern_names
|
list[str]
|
List of pattern names to apply. |
required |
agent_def
|
dict[str, Any]
|
Agent definition for context. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with keys:
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If a pattern name is not recognised. |
Source code in src/marianne/compose/patterns.py
expand_stages
¶
Expand a pattern into a concrete stage sequence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern_name
|
str
|
Name of the pattern to expand. |
required |
params
|
dict[str, Any] | None
|
Optional parameters to customise expansion.
Supported keys:
|
None
|
Returns:
| Type | Description |
|---|---|
list[PatternStage]
|
Ordered list of :class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the pattern is unknown or has no stage definition. |
Source code in src/marianne/compose/patterns.py
expand_stages_with_validations
¶
Expand a pattern into stages and generate validation shapes.
Validation shapes are derived from each stage's declared artifacts.
Each artifact produces a file_exists validation template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern_name
|
str
|
Name of the pattern to expand. |
required |
params
|
dict[str, Any] | None
|
Optional expansion parameters (see :meth: |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with keys:
|
Source code in src/marianne/compose/patterns.py
list_patterns
¶
List all available patterns with descriptions.
Returns:
| Type | Description |
|---|---|
list[dict[str, str]]
|
List of dicts with |
Source code in src/marianne/compose/patterns.py
get_pattern
¶
Get a pattern definition by name.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
Pattern dict or |
load_rosetta_corpus
¶
Load patterns from a Rosetta corpus directory.
Reads *.md files in corpus_dir, parses YAML frontmatter,
and registers patterns that contain a stages field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
corpus_dir
|
str | Path
|
Directory containing pattern markdown files. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Any]]
|
Dict of loaded pattern slug → pattern data. Only patterns |
dict[str, dict[str, Any]]
|
with parseable frontmatter and a |
Source code in src/marianne/compose/patterns.py
PatternStage
dataclass
¶
A single stage within an expanded pattern.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Stage identifier (e.g. |
sheets |
int | str
|
Number of sheets — an |
purpose |
str
|
What this stage accomplishes. |
instrument_guidance |
str
|
Advice on which instrument fits the stage. |
fallback_friendly |
bool
|
Whether cheaper fallback instruments are viable. |
artifacts |
tuple[str, ...]
|
Tuple of expected output file paths/globs. |
CompilationPipeline
¶
Top-level compilation pipeline.
Coordinates all compiler modules to produce complete Mozart scores from a semantic agent configuration.
Usage::
pipeline = CompilationPipeline()
scores = pipeline.compile("config.yaml")
# Returns: list of score file paths + identity directories created
# Or programmatically:
pipeline.compile_agent(agent_def, defaults, output_dir)
pipeline.seed_identity(agent_def, agents_dir)
Source code in src/marianne/compose/pipeline.py
Functions¶
compile
¶
Compile a config file into Mozart scores.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str | Path
|
Path to the semantic agent config YAML. |
required |
output_dir
|
str | Path | None
|
Output directory for generated scores. Defaults
to |
None
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
List of generated score file paths. |
Source code in src/marianne/compose/pipeline.py
compile_config
¶
Compile a config dict into Mozart scores.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any]
|
Parsed compiler config dict. |
required |
output_dir
|
Path
|
Directory to write generated scores. |
required |
Returns:
| Type | Description |
|---|---|
list[Path]
|
List of generated score file paths. |
Source code in src/marianne/compose/pipeline.py
compile_agent
¶
Compile a single agent definition into a Mozart score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_def
|
dict[str, Any]
|
Agent definition dict. |
required |
defaults
|
dict[str, Any]
|
Global defaults from compiler config. |
required |
output_dir
|
Path
|
Directory to write the score. |
required |
workspace
|
str
|
Workspace path for the agent. |
''
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the generated score file. |
Source code in src/marianne/compose/pipeline.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 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 | |
seed_identity
¶
Seed identity for a single agent.
Convenience method that delegates to IdentitySeeder.
Source code in src/marianne/compose/pipeline.py
resolve_instruments
¶
Resolve instruments for a single agent.
Convenience method that delegates to InstrumentResolver.
Source code in src/marianne/compose/pipeline.py
SheetComposer
¶
Composes the sheet structure for an agent score.
Takes agent definitions and default config, produces the sheet section of a Mozart score YAML including fan-out, dependencies, cadenzas, and instrument assignments.
Source code in src/marianne/compose/sheets.py
Functions¶
compose
¶
Compose the sheet configuration for an agent score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_def
|
dict[str, Any]
|
Agent definition dict. |
required |
defaults
|
dict[str, Any]
|
Global defaults from the compiler config. |
required |
agents_dir
|
Path | None
|
Path to agents identity directory. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict representing the |
Source code in src/marianne/compose/sheets.py
get_phase_for_sheet
¶
get_sheets_for_phase
¶
is_cli_sheet
¶
TechniqueWirer
¶
Wires technique declarations into per-sheet cadenza context.
Reads agent technique configs and produces: 1. Technique manifests (markdown) per phase 2. Per-sheet cadenza injections referencing technique docs 3. A2A agent card config for registration
Initialize the technique wirer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
techniques_dir
|
Path | None
|
Directory containing technique module documents. Falls back to searching common locations if not specified. |
None
|
Source code in src/marianne/compose/techniques.py
Functions¶
wire
¶
Wire techniques for an agent, returning cadenza additions and A2A config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_def
|
dict[str, Any]
|
Agent definition with optional |
required |
defaults
|
dict[str, Any]
|
Global defaults with technique declarations. |
required |
workspace
|
str
|
Workspace path for manifest output. |
''
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with keys:
|
Source code in src/marianne/compose/techniques.py
ValidationGenerator
¶
Generates per-sheet validation rules for agent scores.
Produces structural validations (file exists, content checks), CLI instrument validations (temperature/maturity/budget checks), and allows injection of custom validations from the compiler config.
Functions¶
generate
¶
Generate validation rules for an agent score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_def
|
dict[str, Any]
|
Agent definition dict. |
required |
defaults
|
dict[str, Any]
|
Global defaults from compiler config. |
required |
agents_dir
|
str
|
Path to agents identity directory. |
''
|
instruments_dir
|
str
|
Path to shared instruments directory. |
''
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of validation rule dicts for the score YAML. |
Source code in src/marianne/compose/validations.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
generate_structural
¶
Generate structural validations for a specific phase.
Used when building validations for a single phase rather than the full lifecycle. Returns rules appropriate for the phase.