import json
import sqlite3
import base64
WORKING_DB = r'C:\Users\adamm\AppData\Roaming\Code\User\workspaceStorage\82cdabb21413f2ff42168423e82c8bdf\state.vscdb'
BROKEN_DB = r'C:\Users\adamm\AppData\Roaming\Code\User\workspaceStorage\5ec71800c69c79b96b06a37e38537907\state.vscdb'
def dump_keys(label, db_path, patterns=None):
print(f"\n{'='*60}")
print(f" {label}")
print(f"{'='*60}")
conn = sqlite3.connect(db_path)
cur = conn.cursor()
cur.execute("SELECT key, length(value) FROM ItemTable ORDER BY key")
rows = cur.fetchall()
chat_keys = []
for key, vlen in rows:
k_lower = key.lower()
if any(p in k_lower for p in ['chat', 'session', 'agent', 'copilot', 'model.cache']):
chat_keys.append((key, vlen))
print(f"\nChat/session-related keys ({len(chat_keys)} total):")
for key, vlen in chat_keys:
print(f" {key}: {vlen} bytes")
important_keys = [
'agentSessions.model.cache',
'chat.ChatSessionStore.index',
'chat.editor.ChatSessionStore.index',
'interactive.sessions',
]
for key, vlen in chat_keys:
if key not in important_keys and vlen < 5000:
important_keys.append(key)
for key in important_keys:
cur.execute("SELECT value FROM ItemTable WHERE key=?", (key,))
row = cur.fetchone()
if row:
val = row[0]
try:
parsed = json.loads(val)
formatted = json.dumps(parsed, indent=2)
if len(formatted) > 2000:
formatted = formatted[:2000] + "\n... (truncated)"
print(f"\n--- {key} ---")
print(formatted)
except:
print(f"\n--- {key} ---")
print(f" (raw, {len(val)} bytes): {val[:500]}")
conn.close()
dump_keys("WORKING (chasm)", WORKING_DB)
dump_keys("BROKEN (Agentic)", BROKEN_DB)