Streaming Sessions

Everything you need to know about streaming terminal sessions.

Basic Usage

The afk wrap command wraps any terminal command and streams it:

afk wrap <your-command>

Whatever you'd normally run in your terminal, just prefix it with afk wrap.

Common Examples

Interactive Shell

Stream a bash or zsh session for general use:

afk wrap bash

Claude Code

Monitor and interact with Claude Code sessions:

afk wrap claude

Long-running Processes

Monitor builds, tests, or deploys:

afk wrap npm run build

afk wrap cargo test

afk wrap kubectl logs -f deployment/api

Development Servers

Keep an eye on server logs from your phone:

afk wrap npm run dev

afk wrap python manage.py runserver

How It Works

  1. 1
    Wrapper starts

    AFK creates a pseudo-terminal (PTY) and runs your command inside it

  2. 2
    Output captured

    Everything the command outputs is captured by AFK

  3. 3
    Encrypted & streamed

    Output is encrypted with your session key and sent to connected devices

  4. 4
    Input sent back

    When you type on mobile, keystrokes are encrypted and sent back to the PTY

Session Lifecycle

Active

Command is running, connected devices can view and interact

Idle

Command waiting for input (e.g., bash prompt)

Closed

Command exited, session ends

Sessions end when the wrapped command exits (e.g., typing exit in bash).

Tips

  • Use afk wrap bash for general shell access - you can run any commands inside
  • Session names help identify multiple sessions - use --name "my-build"
  • The daemon mode (afk daemon) lets you start sessions from mobile