State Machine

Understanding the Invisible Weave and state management in MiniStudio

The Invisible Weave

The Invisible Weave is MiniStudio's proprietary state machine algorithm that ensures temporal continuity and environmental consistency across multiple shots in a sequence.

The Invisible Weave automatically extracts key frames from each shot and uses them as conditioning inputs for subsequent shots, creating smooth transitions and consistent environments.

How State Management Works

Shot State

Each shot maintains state information including:

  • Final frame data for continuity
  • Environmental context (lighting, camera position, etc.)
  • Character positions and poses
  • Object locations and states

State Extraction

# State is automatically extracted after each shot
result = await orchestrator.generate_shot(request)

# Access state information
state = orchestrator.get_state()
print(f"Last frame shape: {state.last_frame.shape}")
print(f"Environment context: {state.environment_context}")
print(f"Character positions: {state.character_positions}")

Best Practices

Maintain Continuity

Write your prompts with awareness of the previous shot:

# Shot 1: Establish the scene
shots = [
    VideoGenerationRequest(
        prompt="A wide shot of a modern office building exterior at sunset",
        duration_seconds=6
    ),
    # Shot 2: Reference the environment from shot 1
    VideoGenerationRequest(
        prompt="Inside the office, a woman walks toward a window overlooking the sunset",
        duration_seconds=5
    ),
    # Shot 3: Continue the established environment
    VideoGenerationRequest(
        prompt="Close-up of the woman at the desk, the sunset visible in the window behind her",
        duration_seconds=4
    )
]

State Reset

When starting a new sequence or changing location, reset the state:

# Complete first sequence
results1 = await orchestrator.generate_sequence(indoor_shots)

# Reset state for outdoor sequence
orchestrator.reset()

# Generate new sequence without interference from previous state
results2 = await orchestrator.generate_sequence(outdoor_shots)