#!/usr/bin/env python3
"""Find ALL cached state files and destroy them"""
from pathlib import Path
import json

search_locations = [
    Path("c:/MONIKA"),
    Path.home() / "AppData/Local/Programs/Windsurf",
    Path.home() / "AppData/Roaming",
]

print("Searching for cached state files...")
found = []

for location in search_locations:
    if not location.exists():
        continue
    
    # Find all JSON files that might contain state
    for json_file in location.rglob("*.json"):
        try:
            if json_file.stat().st_size > 100000:  # Skip very large files
                continue
            
            content = json_file.read_text(encoding='utf-8', errors='ignore')
            
            # Check if it contains step 330 or proto_lm state
            if 'step": 330' in content or '"step":330' in content:
                found.append(json_file)
                print(f"FOUND cached state: {json_file}")
                
        except Exception as e:
            pass

print(f"\nFound {len(found)} files with step 330")

if found:
    print("\nDeleting cached files...")
    for f in found:
        try:
            f.unlink()
            print(f"  ✓ Deleted: {f}")
        except Exception as e:
            print(f"  ✗ Failed to delete {f}: {e}")
    
print("\nDone!")
