#!/usr/bin/env python3
"""Force disable checkpoint loading by patching the load method."""
from pathlib import Path

# Delete all conversation states
for p in [
    Path('c:/MONIKA/conversation_state.json'),
    Path('c:/Users/shank/AppData/Local/Programs/Windsurf/conversation_state.json'),
]:
    if p.exists():
        p.unlink()
        print(f"Deleted: {p}")

# Patch the load_checkpoint method to always return False
patch_file = Path('c:/MONIKA/salience_os_seed/proto_lm/_torch_impl.py')
content = patch_file.read_text()

# Add early return to load_checkpoint
if 'def load_checkpoint(self, path: Optional[str] = None) -> bool:\n        return False  # FORCE DISABLE' not in content:
    content = content.replace(
        'def load_checkpoint(self, path: Optional[str] = None) -> bool:',
        'def load_checkpoint(self, path: Optional[str] = None) -> bool:\n        return False  # FORCE DISABLE - START FRESH'
    )
    patch_file.write_text(content)
    print("Patched load_checkpoint to force fresh start")
else:
    print("Already patched")
