sheet
sheet
¶
Sheet entity model — the first-class execution unit in Marianne.
A Sheet carries everything a musician needs to execute: identity, instrument, prompt, context injection, validations, and timeout. Sheets are constructed at setup time from the parsed score and handed to the baton for dispatch.
The music metaphor: sheet music contains everything the musician needs to play their part — the notes, the key, the tempo, the dynamics. They don't need to see the full score. They need their sheet.
What's NOT on the Sheet: dependencies, skip_when, retry policy, execution state, cost limits. Those belong to the baton and state systems. The Sheet is execution data; the baton owns coordination logic.
Prompt rendering is deferred. The template stays unrendered because cross-sheet context ({{ previous_outputs[2] }}) only exists after earlier sheets complete. The baton renders at dispatch time.
Attributes¶
Classes¶
Sheet
¶
Bases: BaseModel
A fully self-contained execution unit. Everything a musician needs.
Constructed at setup time from the parsed score YAML. Immutable after construction — the baton dispatches Sheet entities as-is.
Identity
num: Concrete sheet number (1-indexed, globally unique within a job) movement: Which movement this sheet belongs to (was: stage) voice: Which voice in a harmonized movement (was: instance), None if solo voice_count: Total voices in this movement (was: fan_count)
Execution
instrument_name: Resolved instrument name (e.g. 'gemini-cli') instrument_config: Overrides for instrument defaults (model, timeout, etc.) prompt_template: Raw Jinja2 template (rendered at dispatch time) template_file: External template file (alternative to inline) variables: Static template variables from the score timeout_seconds: Per-sheet execution timeout
Context injection
prelude: Shared context injected into all sheets
cadenza: Per-sheet context injection — this sheet's movement cadenza
items (every voice of its stage, or one voice via voice:)
read first, then its sheet.cadenzas items
prompt_extensions: Additional prompt directives
Acceptance criteria
validations: What "done" means for this sheet
Methods:¶
template_variables
¶
Build the full template variable dict for Jinja2 rendering.
Merges built-in variables (identity, workspace, instrument) with the score's custom variables. Built-in variables take precedence over custom variables to prevent accidental overrides.
New and old terminology aliases are both provided — old names (stage, instance, fan_count, total_stages) are kept forever for backward compatibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
total_sheets
|
int
|
Total concrete sheet count in the job. |
required |
total_movements
|
int
|
Total movement count in the job. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict of all template variables for Jinja2 rendering. |
Source code in src/marianne/core/sheet.py
Functions:¶
order_alias_entries
¶
The alias's entries in the order this use of the alias should try them.
use_index counts every sheet that binds the alias (score order);
movement_use_index counts uses within the sheet's movement. Modifiers
compose in the order written: cheapest/widest sort, cycle/
spread rotate the sorted order by the matching index, balance is
left to dispatch. Entries whose metric is unknown keep their authored
position after the known ones (a missing profile never reorders silently
into first place).
Source code in src/marianne/core/sheet.py
build_sheets
¶
Construct Sheet entities from a JobConfig.
This bridges the old scattered-dict model (SheetConfig with separate dicts for descriptions, cadenzas, prompt_extensions, etc.) to the new first-class Sheet entity. Each concrete sheet in the job gets a fully self-contained Sheet object.
The music metaphor: this is the librarian distributing parts to musicians before the concert. Each musician gets their own sheet with everything they need — they don't need to consult the full score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
JobConfig
|
Parsed and validated JobConfig from the score YAML. |
required |
Returns:
| Type | Description |
|---|---|
list[Sheet]
|
List of Sheet entities, one per concrete sheet, in sheet_num order. |
Source code in src/marianne/core/sheet.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | |