# Synopsis: Resets active session state to Idle.
# Description: Wipes memory registers and updates active_state.json with blank values.

$BaseDir = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
$ConfigDir = Join-Path $BaseDir "Config"
$StatePath = Join-Path $ConfigDir "active_state.json"

$State = @{
    timestamp = (Get-Date).ToString("yyyy-MM-ddTHH:mm:ssZ")
    current_project = "Idle"
    current_goal = "None"
    last_action = "Cleared memory."
    pending_verification = $false
    blockers = "None"
}

$State | ConvertTo-Json | Set-Content -Path $StatePath -Force
Write-Output "=== ACTIVE MEMORY CLEARED ==="
Write-Output "State reset to Idle at: $StatePath"

