## ADDED Requirements ### Requirement: Per-step timeline persistence The system SHALL persist a record for every step of a task, containing the screenshot, the Scene JSON, the prompt/goal context, the tool call issued, and its result, written to local storage under a task-specific path. #### Scenario: Step record written after each action - **WHEN** the Executor completes a step (successful or failed) - **THEN** the system writes that step's screenshot and a JSON record (Scene, prompt, tool call, result) to the task's timeline directory before proceeding to the next step #### Scenario: Timeline survives process restart - **WHEN** the process running a task restarts after a step has already been persisted - **THEN** the previously persisted steps for that task remain readable from disk ### Requirement: Task metadata storage The system SHALL store task-level metadata (task id, target device id, status, start/end timestamps) in a local database (SQLite for this change), separate from the per-step image/JSON artifacts on the filesystem. #### Scenario: Task status queryable during execution - **WHEN** a caller queries a task by id while it is still running - **THEN** the system returns its current status (e.g. `running`) and metadata without needing to scan the filesystem timeline #### Scenario: Task status reflects completion - **WHEN** a task finishes (successfully or with failure) - **THEN** its stored metadata status is updated accordingly and its end timestamp is recorded ### Requirement: Timeline retrievable for future replay The system SHALL store each task's steps in a way that preserves their order and completeness, so that a future replay feature can reconstruct the full sequence of screenshots/Scenes/actions for a task without additional data collection. #### Scenario: Steps retrievable in order - **WHEN** a caller requests the full timeline for a completed task - **THEN** the system returns all persisted steps in the order they occurred, each with its screenshot and JSON record