chasm-cli 1.5.4

Universal chat session manager - harvest, merge, and analyze AI chat history from VS Code, Cursor, and other editors
Documentation
import json, os

# Check the working session structure
path = r"C:\Users\adamm\AppData\Roaming\Code\User\workspaceStorage\82cdabb21413f2ff42168423e82c8bdf\chatSessions\44f0cf62-331e-43c9-b32c-25d91ebab0b8.jsonl"
with open(path, 'r', encoding='utf-8') as f:
    content = f.read()

decoder = json.JSONDecoder()
obj, _ = decoder.raw_decode(content)

# Print the top-level structure
print("TOP LEVEL KEYS:", list(obj.keys()))
print()

# The outer kind=0 wrapper
val = obj.get("value", obj)
print("VALUE KEYS:", list(val.keys()) if isinstance(val, dict) else type(val))
print()

# Check 'v' - this might be the actual session data
v = val.get("v")
if v is not None:
    print("V TYPE:", type(v).__name__)
    if isinstance(v, dict):
        print("V KEYS:", list(v.keys()))
        reqs = v.get("requests", v.get("r", []))
        print(f"REQUESTS (from v): {len(reqs)}")
        if reqs:
            print(f"FIRST REQ KEYS: {list(reqs[0].keys())}")
            msg = reqs[0].get("message", reqs[0].get("m"))
            print(f"MESSAGE TYPE: {type(msg).__name__}")
            print(f"MESSAGE: {str(msg)[:300]}")
    elif isinstance(v, list):
        print(f"V is a list with {len(v)} items")
        if v:
            print(f"First item type: {type(v[0]).__name__}")
            if isinstance(v[0], dict):
                print(f"First item keys: {list(v[0].keys())}")

# Print first 2000 chars of the raw JSON to inspect
print("\n\nRAW JSON (first 2000 chars):")
print(content[:2000])