francisco.trejo.dev
← Back to projects

TScope

open-source

Terminal multiplexer in Rust with context-aware panels — knows when a pane is running Claude Code, an SSH session, or a port-bound service, and surfaces live state.

TScope TUI showing split panes with a Claude Code session on the left and a pane settings modal overlay on the right.
TScope TUI — split panes, real PTYs, with the Claude Code context panel and per-pane settings overlay.
TScope Telemetry web dashboard showing a connected Mac mini host with two live panes, OS/arch/version, uptime, and per-pane process activity.
Companion telemetry dashboard — live view of TScope hosts, panes, and process activity across machines.

Overview

Native Rust terminal multiplexer built on ratatui and alacritty_terminal — real PTYs, not line-buffered streams. Splits the screen into shell panes like tmux, but the focused pane gets a context panel that adapts to whatever is running inside it: a Claude Code session, an SSH connection, or a service listening on a port. A companion telemetry dashboard surfaces the same state across hosts.

Problem

Engineers running coding agents now keep 5–20 panes open, each with a different agent on a different task. tmux gives you the multiplexer but nothing about the panes themselves — you scroll back through transcripts to remember which agent was on what, which SSH session went stale, which dev server is bound to which port.

Why it matters

The terminal is the primary surface for agentic coding — Claude Code, Codex CLI, Aider, OpenAI agents. The bottleneck has shifted from running agents to keeping context across them. TScope ships that visibility layer, built native (single Rust binary, real PTYs) instead of as another Electron wrapper, so it's fast enough to live in the critical path of a real workflow.

Architecture

TUI: ratatui for layout and rendering, alacritty_terminal for per-pane PTY emulation. Context detection per pane: Claude Code sessions are surfaced by tailing the live JSONL transcript on disk (topic, turn count, last messages, in-flight tool + target, recent tool calls, git branch); SSH sessions by parent-process inspection (user, host, resolved IP, remote command, last output line, with editable aliases); services by scanning port-bound processes via lsof + libproc on macOS (PID, ports, RSS, CPU%, full cmdline). Per-pane scrollback is 10k lines with copy mode that yanks to the system clipboard via OSC 52 — works over SSH. State (pane names, accent colors, SSH aliases) persists to ~/.config/tscope/config.toml, keyed by working directory and user@host. A separate telemetry web dashboard subscribes to live TScope hosts and renders pane/process/activity state across machines.

Stack

Rust (2024 edition)ratatuialacritty_terminallibprocOSC 52cargo-dist

What I learned

Rust forced me to slow down and get the primitive right before chasing the feature. I had to throw away work I'd already shipped — line-buffered shortcuts that looked fine until vim or an SSH prompt hit them — which is humbling, but determination isn't grinding through bad foundations, it's having the patience to rebuild them. The same instinct applies with teams: short-term speed at the cost of correctness is a debt someone always pays.

Links

Livebuild: 0c87a2e