Reference claude ai code sessions api
Confirmed via live probe: GET https://api.anthropic.com/v1/code/sessions, authenticated with the claudeAiOauth token in ~/.claude/.credentials.json (scope user:sessions:claude_code), returns every claude.ai/code session with a status field of literally "active" or "archived". Each row also carries title (matches the tmux session name), id (cse_..., same suffix as the local bridge id session_...), worker_status, last_event_at, and next_cursor for pagination.
Why: Justin's workflow is to keep claude.ai/code web UI cleaned up by archiving finished sessions there, then periodically purge chat.justin's "unlinked & ended" drawer to match. Today chat.justin's active/unlinked split is derived purely from local tmux process state (forge_session_launcher_api.py:279-300), not from claude.ai's archive flag, so archiving on the web UI only clears a session from chat.justin if it also happens to kill the underlying tmux process (which it does when the tab is still bridge-linked, but not otherwise). This caused a mismatch he noticed (3 open web-UI chats vs many more showing in chat.justin).
How to apply: This is the confirmed technical basis for rebucketing chat.justin's launcher UI: join local sessions to claude.ai sessions via bridge id suffix or title match, then set Active = status=="active", Unlinked/archived = status=="archived", with a residual bucket for local-only sessions (workers/pool) that never had a claude.ai tab. The OAuth access token expires ~hourly, so a long-running launcher service needs its own refresh via the stored refreshToken rather than reading a possibly-stale credentials file. This was queued for /feature-plan as of 2026-07-05, not yet implemented.
[auto-memory session f7a2c956-394a-461d-9680-bd1434d69be4, confidence 0.85, mode direct]