whoami
Who Am I
Report how another session can reach this one: harness, session ID, working directory, transcript, resume command, PID, and git branch.
Rules
-
Read the ID from the environment, never guess it. Each harness sets it in the shell tool's env:
Harness Detect by Session ID Transcript Resume PID Claude Code CLAUDECODE=1$CLAUDE_CODE_SESSION_ID~/.claude/projects/*/<id>.jsonlclaude -r <id>$CLAUDE_PIDpi PI_CODING_AGENT=true$PI_SESSION_ID$PI_SESSION_FILEpi --session <id>none OpenCode OPENCODE=1none — see rule 2 none (stored in SQLite) opencode -s <id>$OPENCODE_PIDResolve the Claude Code transcript with the glob rather than rebuilding the encoded directory name. Omit any field marked none, and omit the pi transcript when
PI_SESSION_FILEis unset (ephemeral session). -
For OpenCode, take the newest session for the current directory. OpenCode sets no session-ID env var. Run
opencode session list --format json -n 10and pick the most recentlyupdatedentry whosedirectoryequals$PWD. The live session updates on every turn, so it is usually the newest. If two sessions in this directory updated within the last few minutes, say the ID is ambiguous and list both. -
Print only the env vars you need. Never dump the whole environment; it holds API keys.