Feature: Load Context from File CLI Feature As a user of CleverAgents I want to load context from a JSON file via the CLI So that I can quickly restore a saved context state Background: Given I have a temporary test directory for contexts And I have a test configuration file Scenario: Load context transiently with run command Given I have a context JSON file with sample data When I run the CLI with --load-context pointing to the JSON file Then the command should execute successfully And the global context should be applied to the app And the context should not be persisted after the run Scenario: Load context into named context with run command Given I have a context JSON file with sample data And I have a target context name "test_import_context" When I run the CLI with both --load-context and --context flags Then the command should execute successfully And the JSON context should be imported into the named context And the named context should be persisted And changes during the run should be saved to the named context Scenario: Load context with interactive command Given I have a context JSON file with messages and global context When I start an interactive session with --load-context Then the interactive session should start successfully And the loaded context should be available in the session And the context should be transient (not persisted after exit) Scenario: Verify global context is applied from loaded file Given I have a context JSON file with specific global context values When I run the CLI with --load-context Then the application should have access to the global context values And the global context keys should be available during execution Scenario: Load context file that doesn't exist Given I specify a non-existent context file path When I try to run the CLI with --load-context Then the command should fail with an appropriate error And the error should indicate the file was not found Scenario: Load invalid JSON context file Given I have a malformed JSON context file When I try to run the CLI with --load-context Then the command should fail with a JSON parsing error Scenario: Load context replaces existing named context Given I have an existing named context "replace_test" And the existing context has different data And I have a new context JSON file When I run the CLI with --load-context and --context "replace_test" Then the named context should be replaced with the new data And the old data should no longer be present Scenario: Load context with messages and state Given I have a context JSON file with messages, state, and metadata When I run the CLI with --load-context and --context "full_context_test" Then all context components should be imported And the messages should be accessible And the state should be accessible And the metadata should be preserved Scenario: Transient load doesn't create context directory Given I have a context JSON file When I run the CLI with only --load-context (no --context) Then the command should complete successfully And no context directory should be created And changes should not persist after the run Scenario: Load context file matches export format Given I have an existing context "export_test" When I export the context to a file And I delete the original context And I load the exported file into a new context "import_test" Then the new context should match the original data And all fields should be preserved