dwgx@blog:~$dwgx
> cd ../posts

AgentScope: A Local Console for Monitoring Codex and Claude Code Sessions

// created

AgentScope is a Windows desktop console that finds the Codex and Claude Code sessions on your machine, indexes them, makes them searchable, and explains exactly how each process-to-session link was derived. It’s not a chat UI or a dashboard, it does this one thing only.

It started because I was running two jobs at once on Windows, and the machine quickly filled up with invisible clutter: a pile of node processes, transcripts under .claude\projects, versioned SQLite files and rollout JSONL under .codex. Which process maps to which session, where a half-edited session got saved, which ones I wanted to delete but was afraid of taking down something still running, browsing the directories just doesn’t line up.

How it’s built

TypeScript + Electron, split into three parts.

apps/desktop        Electron + React desktop shell
packages/core       Windows process/session indexing core
packages/shared     Shared models and IPC safety types

The main process holds the local privileges, the preload exposes just one narrow IPC channel, and the React/TS render layer draws the UI. On the process side it pulls Codex, Claude, node, and app-server out via Win32_Process, then fills in start time and window title with Get-Process. On the session side there are two tracks: Claude parses the PID files in .claude\sessions and then looks up transcripts under .claude\projects; Codex is trickier, requiring you to chew through versioned SQLite files like state_*.sqlite and also scan the JSONL under rollouts.

Evidence, not guesswork

Matching processes to sessions is done by scoring, where PID, cwd, transcript path, session id, window title, and time are each a piece of evidence. Results are labeled in four tiers: exact, indexed, heuristic, unknown. When only the time lines up and nothing else does, I collapse it straight to unknown, never faking a real match. Codex still has no reliable PID-to-thread mapping, so I just label it honestly.

The delete path is built very conservatively, because deleting local sessions really can hurt. Before deleting, it backs up to .agentscope\backups, moves whatever it’s about to touch into a quarantine zone, and writes journal.json for every step so you can trace back through the log if something goes wrong. Anything still running, holding a high-confidence candidate, or carrying sub-sessions gets blocked from deletion outright. It doesn’t kill processes, doesn’t decrypt any vendor state, only touches local plaintext, and even when searching JSONL it queries metadata only, never returning transcript bodies.