Skip to content

Phase 1: Location State Foundation #10

@discreteds

Description

@discreteds

Overview

Implement the foundation for location-specific mutable state, enabling scenarios to track per-location flags and properties.

Deliverables

State Model

  • Add world.location_state{} dict to game state model in kleene-play/SKILL.md
  • Hybrid approach: static definitions in initial_world.locations[], mutable state in separate dict

Location Consequences

  • set_location_flag - Set boolean flag on specific location
  • clear_location_flag - Clear boolean flag on location
  • modify_location_property - Modify numeric property (delta)
  • set_location_property - Set property to absolute value

Location Preconditions

  • location_flag_set - Check if location flag is true
  • location_flag_not_set - Check if location flag is false/missing
  • location_property_minimum - Check location property >= value
  • location_property_maximum - Check location property <= value

Save System

  • Update save format to v4 in saves.md
  • Handle migration from v2/v3 saves (default location_state to {})

Schema Definition

  • Create JSON Schema at lib/schema/scenario-schema.json
  • Include all existing + new types
  • Enable IDE autocomplete and validation

Validation

  • Create test scenario demonstrating location state features
  • Verify all existing scenarios load without errors
  • Confirm location state persists across save/load

Files to Modify

  • kleene/skills/kleene-play/SKILL.md (state model, consequence/precondition logic)
  • kleene/lib/framework/scenario-format.md (consequence/precondition docs)
  • kleene/lib/framework/saves.md (save format v4 spec)
  • kleene/lib/schema/scenario-schema.json (NEW)

Acceptance Criteria

  • All existing scenarios work without modification (100% backwards compatible)
  • Location state operations function correctly
  • Save/load preserves location state
  • Schema validation catches invalid scenarios

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions