Cotty (collaborative + tty) is a multiplayer terminal: host your shell,
let teammates join over the network, watch together — and, when you allow
it, type together. It targets the gap between screen-sharing hacks
(tmate, sshx, "look at my Zoom") and what real-time collaboration
should feel like in a terminal: first-class sessions with per-guest
permissions, presence, accountability, and end-to-end encryption.
Features
- Host anywhere —
cotty host spawns your shell in a PTY and serves
it over a websocket; your local terminal stays attached as usual
- Join from any terminal —
cotty join -name alice mirrors the
session, with a display name everyone sees
- Join from a browser — every relay and locally hosted session serves
an embedded xterm.js client; no install needed for guests
- NAT-friendly relay —
cotty relay + cotty host --relay <server>:
the host dials out, so no port forwarding on either side
- Per-guest permissions — guests are view-only by default; grant,
revoke, and kick live:
cotty ctl allow alice, deny, kick, list
- End-to-end encrypted by default — relayed sessions use
AES-256-GCM; the relay forwards ciphertext it cannot read
- Recording & replay —
-record session.cast writes asciicast v2,
playable with cotty replay or asciinema
- Audit trail —
-audit trail.jsonl logs who typed what: every
applied keystroke attributed by participant, plus joins, leaves,
permission changes, and kicks
- Live presence — everyone sees who joins, leaves, and is typing
- Session codes — every session is protected by a random join code
- Market desk —
cotty desk is a read-only Robinhood Chain dashboard
(Stock Token quotes, Chainlink feeds, session gaps, Lighter perp basis
and funding) to watch together
- AI arena —
cotty arena: AI models compete at paper trading
Robinhood Chain Stock Tokens on live prices, on one shared leaderboard
- Multisig for agents —
cotty host -quorum 2 -approvers host,alice,bob:
an agent's commands wait until 2 of 3 people approve them
- AI agent —
cotty agent brings a model into the session as a
guest: it reads the shared screen and answers cotty ask, view-only
until you cotty ctl allow agent, every keystroke in the audit trail
Install
go install github.com/tylerbroqs/cotty/cmd/cotty@latest
Or build from source:
git clone https://github.com/tylerbroqs/cotty
cd cotty
go build -o cotty ./cmd/cotty
Requires Go 1.24+. Linux and macOS; Windows guests should work (join
uses no PTY), Windows hosting is untracked for now.
Quick start
# On the host machine
cotty host # view-only guests
cotty host --write # guests can type too
# Cotty prints something like:
# cotty: session code XJ4K2P
# cotty: guests join with: cotty join ws://<this-host>:7373/ws?code=XJ4K2P
# On a guest machine
cotty join -name alice "ws://192.168.1.10:7373/ws?code=XJ4K2P"
Guests press Ctrl-] to leave. The session ends when the host's shell
exits.
Managing guests
Guests join view-only under the name they picked (-name, defaulting to
$USER). The host manages them live from any other terminal on the host
machine — or straight from inside the hosted shell, since every session
exports $COTTY_SESSION:
cotty ctl list # who's here, and who can type
cotty ctl allow alice # let alice type
cotty ctl deny alice # back to view-only
cotty ctl kick bob # disconnect bob
Starting with --write makes new guests writable by default instead.
Everyone gets join/leave notices, and permission changes are announced to
the affected guest.
Recording, replay, and the audit trail
# record the session and keep a "who did what" trail
cotty host -record pairing.cast -audit pairing.jsonl
# play it back later (2x speed, long pauses capped at 2s by default)
cotty replay -speed 2 pairing.cast
Recordings are standard asciicast v2, so asciinema and its web player
work too. The audit trail is JSON lines: every keystroke that reached the
shell, attributed to the participant who typed it (the host included, and
guests are attributed correctly through a relay), plus joins, leaves,
permission grants, and kicks. Input that was rejected — a view-only guest
typing — never reaches the shell and is deliberately absent: the trail
records what actually ran.
Across networks: hosting through a relay
Direct hosting requires guests to reach your machine. When you're behind
NAT (home network, office, coffee shop), run a relay on any machine with a
public address and host through it — the host connects outward, so no
port forwarding is needed on either side:
# On a public server
cotty relay -addr :7374
# behind TLS? tell it the public base URL guests should use:
cotty relay -addr :7374 -public-url wss://relay.example.com
# On your machine (anywhere)
cotty host --relay relay.example.com:7374
# prints: cotty join "ws://relay.example.com:7374/ws?code=XJ4K2P"
# Guests, from anywhere
cotty join "ws://relay.example.com:7374/ws?code=XJ4K2P"
The relay forwards frames and enforces the session's read-only setting;
the host additionally enforces it locally.
End-to-end encryption
Relayed sessions are encrypted end-to-end by default. The host generates
a 256-bit session key and puts it in the join URL's fragment:
cotty join "ws://relay.example.com:7374/ws?code=XJ4K2P#k=8D0Uy-5ugL..."
└── never sent over
the network
URL fragments are stripped by clients before any request is made, so
guests receive the key from the host (through however the URL was shared)
while the relay never sees it. Terminal output and guest input are sealed
with AES-256-GCM; a guest joining without the key is refused with an
explanation, and a wrong key fails loudly rather than showing garbage.
Opt out with cotty host --relay ... -plain.
What the relay can still see: guest names, join/leave events, the session
code, terminal size, and traffic timing/volume. Share the join URL over a
channel you trust — anyone with the full URL has the key.
Joining from a browser
The host prints a browser link next to the CLI one:
cotty: guests join with: cotty join "ws://relay:7374/ws?code=XJ4K2P#k=..."
cotty: or in a browser: http://relay:7374/join#code=XJ4K2P&k=...
The page is an xterm.js terminal served by the relay (or by the host
itself for local sessions) speaking the same websocket protocol as the
CLI client. Encryption and decryption happen in the page via WebCrypto;
the session code and key live in the URL fragment, which browsers never
send to any server. Assets are embedded in the cotty binary — the page
makes no CDN or third-party requests. Opening the bare page (no fragment)
shows a join form instead.
Market desk: Robinhood Chain, together
cotty desk is a live, read-only dashboard for
Robinhood Chain mainnet. Run it in a
hosted session and everyone watches the same screen:
cotty host -audit desk.jsonl # then, inside the hosted shell:
cotty desk # default watch list
cotty desk -symbols TSLA,NVDA,SPY -alert 0.5
cotty desk -symbols all # every Stock Token with a Chainlink feed
cotty desk -once # one snapshot, no screen clearing
SYMBOL BID ASK SPREAD CHAINLINK Δ FEED FEED AGE GAP FLAGS
TSLA 367.00 367.38 0.10% 365.91 +0.35% 3h20m +2.00%
NVDA 216.62 216.66 0.02% 217.07 -0.20% 8h17m +0.06% x1.0008
! TSLA has moved +2.00% since the regular session (Mon 15:59)
- BID / ASK — live Stock Token quotes from Robinhood's read-only API
(
api.robinhood.com/rhj), per token, i.e. multiplier-adjusted
- CHAINLINK / FEED AGE — the token's Chainlink feed, read on-chain;
feed addresses come from Chainlink's directory, token addresses from
Robinhood's asset list, so nothing is hardcoded
- Δ FEED — how far the live quote is from the feed
- GAP — outside the regular US session (overnight, weekends), how far
the quote has moved from the last regular-session price the desk saw;
those prices are kept in your config directory between runs, so leave
the desk running through a close to arm it
- FLAGS —
HALT, ORACLE-PAUSED (corporate action in progress),
STALE (feed older than its heartbeat while its market is open), and
the corporate-action multiplier when it isn't 1
Below the table, a Lighter section lines each watched symbol up
against its perpetual on Lighter, the perps venue
that launched with Robinhood Chain, read from Lighter's public API:
LIGHTER PERP MARK SPOT BASIS FUNDING/8H APR CARRY
NVDA 216.63 216.55 +0.04% +0.0032% +3.50% longs pay: long spot + short perp collects (1 token = 1.0008 perp)
ETH 2,387.19 2,383.52 +0.15% -0.0096% -10.51% shorts pay: long perp collects
- SPOT is per share: stock perps track the underlying, while a
Stock Token is worth
multiplier shares, so the token price is divided
by its on-chain multiplier first (crypto uses its Chainlink price).
Hedging one token takes multiplier perp units, shown when it isn't 1
- BASIS — perp mark vs. that spot
- FUNDING/8H / APR — Lighter's current rate (settled hourly, an
eighth each hour) and its annualized carry;
-carry 10 alerts at
±10% APR. Funding is variable and this ignores fees, slippage, and
margin; it is a monitor, not a signal. -no-perps hides the section
It holds no keys, signs nothing, and deploys nothing. The public RPC is
rate limited with no SLA; pass -rpc to use a provider endpoint.
Exchange holidays are not modeled. Stock Tokens are not available to US
persons and are restricted in other jurisdictions; the desk only reads
public data.
AI arena: which model trades best?
cotty arena runs a live paper-trading competition between AI models on
Robinhood Chain Stock Tokens. Host it and the whole session watches the
leaderboard:
export ORBIO_API_KEY=... # one Orbio key reaches every lab's models
cotty arena # Claude Opus 5.5 vs GPT-6 Astra vs Gemini 3.8 Flash
cotty arena -models anthropic/claude-opus-5.5,anthropic/claude-sonnet-5.5 -round 15m
COTTY ARENA Robinhood Chain · round 2 · running 5m · US market: PRE-MARKET
paper trading · $10,000 each · buys at ask, sells at bid, marked at mid · not financial advice
# CONTESTANT EQUITY RETURN TRADES TOP POSITIONS
1 gemini-3.8-flash $10,000 +0.00% 0 cash 100%
2 HODL SPY $10,000 +0.00% 1 SPY $10,000
3 claude-opus-5.5 $9,997 -0.03% 2 NVDA $3,999 · COIN $1,998 · cash 40%
4 gpt-6-astra $9,995 -0.05% 3 MSTR $2,999 · cash 70%
[claude-opus-5.5] Overweight AI compute; COIN funding is rich but spot still lags BTC.
round 1: BUY NVDA $4,000 · BUY COIN $2,000
[gpt-6-astra] Took TSLA off: gap faded.
round 2: SELL TSLA $5,997
Every round (default 5 minutes), each model gets the same live market,
the same data cotty desk shows (quotes, day range, Chainlink feed,
shares-per-token multiplier, Lighter perp basis and funding), plus its
own portfolio and the standings. It answers with up to three trades and
one sentence of reasoning, shown live. The rules:
- Paper only. Each contestant starts with virtual cash ($10,000 by
default). Nothing is signed, sent, or deployed.
- Realistic fills. Long only; buys fill at the token's ask, sells at
its bid, positions are marked at the mid, so churning costs spread.
Halted symbols don't trade.
- A bar to clear.
HODL SPY buys the benchmark once and holds; a
model that can't beat it isn't adding anything.
- It keeps score across runs. The competition is saved
(
<config dir>/cotty/arena.json, or -state) and resumes where it
left off, so you can run it for weeks. One day of results is mostly
luck; the leaderboard means something only over many rounds.
Each round costs one model call per contestant, so three models at the
default 5-minute rounds make about 36 calls an hour on your Orbio
balance; lengthen -round to spend less. Like cotty agent, it works
with -provider anthropic or any OpenAI-compatible endpoint too.
Multisig for agents: M of N people approve every command
cotty ctl allow agent lets an agent type; multisig decides whether
what it types runs. Host with a quorum and every keystroke from the
agent is held as a proposal until enough of the named approvers vote
for it, like an M-of-N multisig wallet:
cotty host -relay relay.example.com:7374 -audit trail.jsonl \
-quorum 2 -approvers host,alice,bob
cotty ctl allow agent
[multisig] #1 agent wants to run: cotty desk -symbols NVDA,COIN⏎ (needs 2 of host, alice, bob; vote with: cotty approve 1 / cotty reject 1)
[multisig] #1 approved by alice (1/2)
[multisig] #1 approved 2/2 by alice, host; running: cotty desk -symbols NVDA,COIN⏎
- Everyone sees the proposal, in the shared terminal itself (so it is
in recordings), with Enter and control keys spelled out (
⏎, ^C).
- Voting: the host runs
cotty approve N / cotty reject N
(cotty pending lists what's waiting); terminal guests press
Ctrl-\ and type approve N; browser guests get Approve / Reject
buttons.
- It runs at the quorum, and dies when it can't reach it: as soon
as too many approvers reject, the proposal is rejected. Unvoted
proposals expire after 10 minutes. Only the named approvers count,
each once, and a supervised participant can't approve itself.
- Enforced by the host, not the agent. Held keystrokes never reach
the shell until the vote passes, whatever the agent does. Through a
relay, proposals and votes are sealed with the session key: the relay
can't read the command or forge a vote.
- The audit trail keeps the whole decision:
propose, each
approve / reject with who cast it, execute with the approvers,
then the keystrokes themselves as {"kind":"input","who":"agent"}.
-supervise names whose keystrokes need approval (default agent).
Approvers are matched by session name, so give people names when they
join (cotty join -name alice), and share the join URL only with them.
AI agent: an agent on a leash
cotty agent joins a session as an ordinary guest named agent, backed
by the model of your choice. It reads the shared screen and answers
questions anyone asks from inside the hosted shell:
cotty host -relay relay.example.com:7374 -audit trail.jsonl
# anywhere, with the join URL the host printed:
export ORBIO_API_KEY=... # from your dashboard at orbio.so
cotty agent "ws://relay.example.com:7374/ws?code=XJ4K2P#k=..."
# inside the hosted shell:
cotty ask "why is TSLA flagged on the desk?"
agent: TSLA's quote is 2% above its last regular-session price ...
The answer is printed by cotty ask itself, inside the shell, so every
participant sees it (browser guests too) and it lands in recordings.
Like any guest, the agent starts view-only: it explains what it would
run but cannot type. Grant it the keyboard and take it back the same way
as for people:
cotty ctl allow agent # it may now type commands into the shell
cotty ask "add NVDA and COIN to the desk"
agent: restarting the desk with NVDA and COIN
cotty ctl deny agent # view-only again
cotty ctl kick agent # gone
Once allowed, it types one command line at a time, reads the result, and
reports back (up to -steps model calls per question). Everyone watches
it happen, and the audit trail attributes its keystrokes:
{"kind":"input","who":"agent","data":"cotty desk -symbols NVDA,COIN\r"}.
Questions and answers are logged too (ask, say).
By default the agent runs on Orbio, whose gateway
serves Claude and hundreds of other models from one CREDIT balance
(ORBIO_API_KEY). Pick any model, or another provider:
cotty agent URL # Orbio, anthropic/claude-opus-5.5
cotty agent -model anthropic/claude-sonnet-5.5 URL # another model on Orbio
cotty agent -provider anthropic URL # Anthropic directly (ANTHROPIC_API_KEY)
cotty agent -provider openai -model gpt-5 URL # OpenAI (OPENAI_API_KEY)
cotty agent -provider openai -model llama3.3 \
-base-url http://localhost:11434/v1 URL # Ollama, no key needed
cotty agent -provider openai -model some/model \
-base-url https://openrouter.ai/api/v1 -key-env OPENROUTER_API_KEY URL
-provider openai speaks the OpenAI chat-completions format, so it covers
any compatible endpoint (OpenRouter, Groq, Together, Ollama, LM Studio,
vLLM, ...).
What to know before you invite one:
- The screen leaves the session. Questions and screen snapshots go to
the model provider you chose (by default Orbio, which forwards them to
the model's maker). End-to-end encryption keeps the relay
out; it does not keep out a participant you invited, and the agent is
one. Use a local model if the session must stay on your machines.
- It is view-only until you say otherwise. An allowed agent can type
anything you could. Allow it for a task, watch it, and deny it after.
- Text on screen is not an instruction. The agent is told to treat the
screen as data, but models can be fooled by output crafted to look like
instructions (prompt injection). Another reason to keep it view-only
around untrusted output.
- Orbio Incognito isn't supported yet. If Incognito is turned on for
your Orbio account, the gateway only accepts requests encrypted with
Orbio's own adapter; the agent says so instead of answering.
- Commands are limited to one printable line per step; it cannot send
other control keys except Ctrl-C to stop a running program.
How it works
host terminal ──┐
├── PTY (your shell)
guest ws ───────┤ │
guest ws ───────┘ ▼
output fan-out to local stdout + all guests
The host process owns the PTY. Local keystrokes and (if --write) guest
keystrokes are written to it; everything the PTY emits is fanned out to the
local terminal and every connected guest. Frames are JSON over websocket —
see internal/protocol. v0 is
deliberately debuggable; a binary protocol comes later.
With a relay, the fan-out moves server-side — the host holds one outbound
connection and the relay maintains the guest hub:
host terminal ── PTY ── ws (outbound) ──► relay ──► guest ws
│ ────► guest ws
Contributing
Issues and pull requests are welcome. Keep changes small and focused, and
make sure the tree stays clean before sending a PR:
go vet ./...
go build ./...
The codebase is deliberately compact — a handful of small packages under
internal/, no framework, minimal dependencies. Please keep
it that way.
License
MIT — see LICENSE.