Remocode
Telegram Remote7 min read

The Via Command: Bidirectional Terminal Sessions Over Telegram

Deep dive into Remocode's via command — the killer feature that streams terminal output to Telegram and sends your messages back to the terminal in real time.

via-modebidirectionalterminaltelegramstreamingremocode

What Makes Via Mode Special

The via <name> command is Remocode's signature feature. It creates a live, bidirectional link between your Telegram chat and a specific terminal session. Terminal output streams to Telegram, and your Telegram messages are typed into the terminal. It turns your phone into a remote terminal client.

How Via Mode Works Under the Hood

When you send via my-project to your Remocode bot, several things happen:

  • Session binding — Remocode locates the terminal session named "my-project" and attaches a streaming listener.
  • Delta detection — Every 1 second, the system polls the terminal buffer and compares it against the last snapshot. Only new content is sent to Telegram, keeping messages compact and readable.
  • ANSI stripping — Raw terminal output contains ANSI escape codes for colors, cursor movement, and formatting. Remocode strips all of these along with control characters and UI chrome from Ink-based apps, delivering clean text to your chat.
  • Input routing — Any message you send in the Telegram chat is forwarded to the terminal as keystrokes.

Ink App Detection

Remocode automatically detects when you are running an Ink-based application — this includes Claude Code, Gemini CLI, and OpenAI Codex. These apps use a reactive terminal UI framework that behaves differently from standard shell programs.

For Ink apps, Remocode uses smart typing: it sends the text content, waits 1 second for the app to register the input, then sends an Enter keypress. If no output appears after 8 seconds, it retries. Further retries occur at 18 and 28 seconds. This graduated retry system handles the variable response times of AI agents without flooding the terminal with duplicate input.

Entering and Exiting Via Mode

Starting a session:

via backend-api

This connects you to the terminal named "backend-api." You will immediately start seeing output.

Exiting via mode:

!exit

or

release via

Both commands disconnect you from the streaming session and return your bot to normal command mode.

Escaping to Bot Commands

While in via mode, every message you send normally goes to the terminal. But sometimes you need to run a bot command without leaving via mode. Prefix any bot command with ! to escape:

!status
!peek
!reply_5

These execute as bot commands and do not get sent to the terminal. This is essential for checking things without disrupting your AI agent's workflow.

Practical Via Mode Workflow

A typical session looks like this: you start Claude Code on a refactoring task, use via refactor from your phone while commuting, and monitor the output. When Claude asks "Should I also update the tests?", you type "yes" and it goes straight to Claude. If you need to check something, you type !status to get a progress summary without Claude seeing that message.

Performance Considerations

The 1-second polling interval strikes a balance between responsiveness and resource usage. Delta detection means that even verbose terminal sessions produce manageable Telegram messages. The ANSI stripping ensures that the content you receive is readable plain text, not garbled escape sequences.

Via mode transforms Telegram from a notification channel into a genuine remote terminal interface, making it possible to maintain full interactive control over your AI coding agents from anywhere.

Ready to try Remocode?

Start with a 7-day Pro trial — no credit card required. Download now and start coding with AI from anywhere.

Download Remocodefor macOS

Related Articles