Files
storybook/examples/baker-family
Sienna Meridian Satterwhite 16deb5d237 release: Storybook v0.2.0 - Major syntax and features update
BREAKING CHANGES:
- Relationship syntax now requires blocks for all participants
- Removed self/other perspective blocks from relationships
- Replaced 'guard' keyword with 'if' for behavior tree decorators

Language Features:
- Add tree-sitter grammar with improved if/condition disambiguation
- Add comprehensive tutorial and reference documentation
- Add SBIR v0.2.0 binary format specification
- Add resource linking system for behaviors and schedules
- Add year-long schedule patterns (day, season, recurrence)
- Add behavior tree enhancements (named nodes, decorators)

Documentation:
- Complete tutorial series (9 chapters) with baker family examples
- Complete reference documentation for all language features
- SBIR v0.2.0 specification with binary format details
- Added locations and institutions documentation

Examples:
- Convert all examples to baker family scenario
- Add comprehensive working examples

Tooling:
- Zed extension with LSP integration
- Tree-sitter grammar for syntax highlighting
- Build scripts and development tools

Version Updates:
- Main package: 0.1.0 → 0.2.0
- Tree-sitter grammar: 0.1.0 → 0.2.0
- Zed extension: 0.1.0 → 0.2.0
- Storybook editor: 0.1.0 → 0.2.0
2026-02-13 21:52:03 +00:00
..

Baker Family Example

A comprehensive example demonstrating Storybook v0.2.0 features through a realistic multi-character scenario.

Features Demonstrated

Resource Linking

  • Templates with behaviors: Baker template specifies BakingSkills and CustomerService
  • Templates with schedules: Baker template uses BakerSchedule
  • Multi-level inheritance: BakerWorkerPerson template chain
  • Character inheritance: Characters automatically inherit behaviors and schedules from templates

Schedule Composition

  • Schedule inheritance: BakerSchedule extends WorkWeek
  • Override blocks: Modify inherited time blocks with override work { ... }
  • Named blocks: All blocks have names for the override system
  • Action references: Schedule blocks reference behavior trees via action: BehaviorName
  • Recurrence patterns: Market day repeats on Saturday

Behavior Trees

  • Comprehensive behavior definitions for all activities
  • Referenced from schedule blocks showing integration
  • Hierarchical behaviors (sequences, selectors, repeaters)

File Structure

baker-family/
├── README.md                           # This file
├── schema/
│   └── templates.sb                    # Template definitions with resource linking
├── schedules/
│   └── work_schedules.sb               # Composable schedules
├── behaviors/
│   └── baker_behaviors.sb              # Behavior tree definitions
└── characters/
    ├── martha.sb                       # Master baker (uses Baker template)
    ├── john.sb                         # Pastry chef (uses Baker template)
    └── emma.sb                         # Daughter (uses Child template)

Template Hierarchy

Person (behaviors: BasicNeeds, SocialInteraction)
  └─> Worker (schedule: WorkWeek)
       └─> Baker (behaviors: +BakingSkills, +CustomerService, schedule: BakerSchedule)

  └─> Child (behaviors: PlayBehavior, LearnBehavior, no schedule)

Schedule Inheritance

WorkWeek
  ├─ morning_prep (08:00-09:00)
  ├─ work (09:00-17:00)
  └─ evening_rest (18:00-22:00)

BakerSchedule extends WorkWeek
  ├─ pre_dawn_prep (04:00-05:00) [NEW]
  ├─ work (05:00-13:00) [OVERRIDE] → action: BakingWork
  ├─ evening_rest (18:00-22:00) [INHERITED]
  └─ recurrence MarketDay on Saturday
       └─ market (06:00-14:00) → action: SellAtMarket

Key Integration Points

  1. Martha (character) → inherits from Baker (template)

    • Gets behaviors: BakingSkills, CustomerService, BasicNeeds, SocialInteraction
    • Gets schedule: BakerSchedule (which extends WorkWeek)
  2. BakerSchedule (schedule) → references BakingWork (behavior)

    • action: BakingWork in the work block
    • Creates link between scheduling and behavior systems
  3. Template chain → cascading resource inheritance

    • Baker includes Worker includes Person
    • All behaviors and schedules flow down the hierarchy

Usage

This example shows how to:

  • Build reusable templates with attached behaviors and schedules
  • Create character hierarchies representing different roles
  • Compose schedules through inheritance and overrides
  • Link schedules to behaviors through action references
  • Model realistic daily routines with time-of-day variations
  • Handle special events (market days) with recurrence patterns

Narrative Implications

The Baker family example demonstrates:

  • Daily rhythms: Early morning routine for bakers vs. normal schedule for child
  • Weekly patterns: Special market day on Saturdays
  • Role-based behaviors: Bakers have different skill sets than children
  • Family dynamics: Multiple characters with interrelated but distinct routines
  • Business operations: Work schedule tied to specific behaviors (baking, selling)

This is the kind of rich, time-based character modeling that makes Storybook ideal for narrative simulations and game design.