import json
import shutil
from datetime import datetime

config_path = '/Users/harvey/.openclaw/openclaw.json'

# Read current config
with open(config_path) as f:
    config = json.load(f)

# Update askFallback for main agent
agents = config.get('agents', {})
main = agents.get('main', {})
old_fallback = main.get('askFallback', 'not set')
main['askFallback'] = 'allow'
config['agents']['main'] = main

# Write updated config
with open(config_path, 'w') as f:
    json.dump(config, f, indent=2)

# Verify
with open(config_path) as f:
    verified = json.load(f)

new_fallback = verified['agents']['main']['askFallback']
print(f"askFallback: {old_fallback} -> {new_fallback}")
print("JSON valid" if new_fallback == 'allow' else "ERROR: change not applied")
