session-switch-test

A browser-based self-test for switching between two concurrently active DorkOS chat sessions. It checks whether each session keeps its own live conversation state while you move between them.

In plain words
What is it for?
Use it after changing session switching, live event streams, session state, approval displays, or message queueing, with optional URLs and session topics.
Why use it?
It exposes state leaks or lost activity involving streaming responses, subagents, queued messages, task lists, and permission prompts.

Command for Claude Code

Part of the flow plugin — 17 skills, 37 commands, 5 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/dork-labs/dorkos/session-switch-test
Clone the repo
git clone --depth 1 https://github.com/dork-labs/dorkos

Made for: Claude Code.

Or install flow, the plugin that ships this one along with the rest of its 17 skills, 37 commands, 5 agents.

Per session 54 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,455 The whole file, excluding the scripts and references it only reads on demand.
Security scan E 3 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00054 $0.05455
Opus 5 $0.00027 $0.02728
Sonnet 5 $0.00011 $0.01091
Haiku 4.5 $0.00005 $0.00545

Measured 3d ago against content hash 3bcd81d096f9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade E, and why

session-switch-test scanned grade E with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

curl -s "http://localhost:$API_PORT/api/models" | python3 -c "import sys,json;[print(m['value']) for m in json.load(sys.stdin)['models']]"

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

dotenv -- sh -c 'rm -rf /tmp/dorkos-test-mode-4243 && turbo run build --filter=@dorkos/server && pnpm --filter @dorkos/server exec tsx src/index.ts'

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -sf -X PATCH http://localhost:4248/api/config -H 'content-type: application/json' \
.claude/commands/chat/session-switch-test.md · 262 lines

How it starts

The opening of the file, as written. The whole thing — 262 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Self-test the DorkOS chat UI under the hardest real-world condition: two sessions of the same agent doing long, tool-heavy work at the same time, while the operator toggles between them in the sidebar. This is the flow where session-scoped live state (streaming, pending permission prompts, queued messages, running subagents, todos) tends to leak or get lost. The command drives the browser, cross-checks the on-disk JSONL transcripts and the server API, and writes an evidence-based report.

This complements /chat:self-test (which exercises a single session in depth). Use this one whenever you touch session switching, the SSE stream lifecycle, useSessionId, the session-chat store, tool-approval rendering, or message queueing.


Argument Parsing

Parse $ARGUMENTS:

  1. URL — any arg starting with http. Default (expand $HOME to the actual home directory; mkdir -p the dir if missing): http://localhost:6241/session?dir=$HOME/Keep/temp/empty (Extract the dir query param as TEST_DIR for JSONL resolution. The empty temp dir keeps file side-effects isolated.)
  2. topics:a,b — two unambiguous, distinct topics for sessions A and B. Default: lakes,fruit. Pick concrete nouns (cars, fruit, lakes, clothes) so A and B content is trivially distinguishable on disk and on screen.
  3. perm:<mode> — permission mode for both sessions. Default: default.
    • defaultprompts on tool use. Use this to reproduce/regress the permission-prompt-on-switch bug (checks #6). The downstream checks (#2–#4) will be blocked if that bug is present, because the agents stall at the first tool gate.
    • bypassPermissions / acceptEdits — no blocking gate. Use this to exercise subagents, queued messages, and file ops end-to-end (checks #2–#4).
    • Run both variants for full coverage.
  4. model:<id> — default claude-haiku-4-5 (fastest, cheapest; this tests UI plumbing, not model capability). Ignored under mode:sandbox, where no model answers.
  5. mode:sandbox|live — which stack the run drives (meta/chat-capabilities.md §11).
    • mode:sandbox — the test-mode runtime: throwaway data dir, deterministic, no model spend. Verifies UI plumbing: switching, queueing, stream lifecycle.
    • mode:live — the dev stack with a real runtime. Verifies streaming feel, real tool loops, timing, and permission gates as they actually behave.
    • If the invocation does not state a mode, ASK the user before spending anything (AskUserQuestion, offering both, with the cost of each). Never assume live.

Store as TEST_URL, TOPIC_A, TOPIC_B, PERM_MODE, MODEL, MODE.

Read the full file on GitHub · 262 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 262 lines · 54 tokens per session scan E 3bcd81d096f9

Subscribe to this mod's changes

session-switch-test is a command published in the GitHub repository dork-labs/dorkos (9 stars, last pushed 3d ago), licensed MIT. It adds 54 tokens to every session and 5,455 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it E with 3 findings (downloads and executes remote code, recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.