WSL in agterm-win
WSL is where agterm-win differs most from agterm on macOS. Linux shells run beside PowerShell in the same sidebar, and agterm-server keeps Linux sessions alive inside a distribution, where coding agents usually run on Windows.
Two ways to run Linux · Local WSL sessions · AGTERM variables in WSL bash · agterm-server · Working in a server session · Commands · Troubleshooting
Two ways to run Linux
A distribution can be a plain shell in the main window, or a server whose sessions outlive the app.
| Local WSL session | agterm-server session | |
|---|---|---|
| Start it from | File ▸ New Session ▸ WSL <distribution> | File ▸ New Session ▸ Start agterm-server in ▸ <distribution> |
| Shows up in | The main window, next to PowerShell and Command Prompt | A window of its own, one per distribution |
| Runs as | wsl.exe -d <distribution> --cd ~ in a local pane |
A shell in the distribution's own session daemon, under agterm-server's systemd user service |
| When agterm-win closes | Ends with the app, like any local session, unless Settings ▸ General ▸ Restore sessions keeps it | Keeps running; the next start attaches to it again |
| agtermctl from Linux | agtermctl.exe, the Windows CLI, through WSL interop |
agtermctl, the Linux CLI agterm-server installs |
| Agent status and skill | Not installed in Linux; an agent there reports no status | Installed for Claude Code, Codex and others in the distribution |
| Needs | Any WSL distribution | WSL 2 with systemd, x86_64 or arm64 |
Run coding agents in server sessions: their status reaches the sidebar and they survive closing the app. A local session suits a quick shell.
Local WSL sessions
Each installed distribution is a launch profile named WSL <distribution>.
- Open one from File ▸ New Session or a session's menu ▸ Local Profiles. Make it the default with File ▸ Default Profile, so new sessions open it.
- The sidebar follows the folder. agterm-win hands bash a
PROMPT_COMMANDthat reports the current folder, so the session is named after it and Reveal in Explorer opens it as\\wsl.localhost\…. - Drop files on the session and they are typed as Linux paths,
/mnt/c/…. - Your own profile, such as another user or a start folder, goes in
profiles.properties(File ▸ Settings ▸ Edit Launch Profiles…), for exampleUbuntu as root = wsl.exe -d Ubuntu -u root --cd ~.
Gallery: New Session with the WSL profiles · Settings ▸ General.
AGTERM variables in WSL bash
agtermctl.exe works from WSL bash as it is. To see the session's identity in bash itself, export it once with WSLENV.
Every pane gets the AGTERM_* variables that tell agtermctl which agterm-win and
which session it runs in. wsl.exe passes Windows variables into Linux only when
WSLENV names them, so by default bash in a local WSL session has none of them. Windows programs
started from that bash, however, run with the pane's full Windows environment.
| Variable | In bash, by default | In bash, with the WSLENV below | In a Windows program run from bash |
|---|---|---|---|
AGTERM_SESSION_ID, AGTERM_PANE_ID, AGTERM_PANE | no | yes | yes |
AGTERM_WINDOW_ID, AGTERM_WORKSPACE_ID, AGTERM_ENABLED | no | yes | yes |
AGTERM_SOCKET, AGTERM_STATE_DIR | no | as /mnt/c/… paths | yes |
Drive agterm-win from WSL bash
Call the Windows CLI, agtermctl.exe. It runs with the pane's Windows environment, so it reaches
the agterm-win that owns the pane and acts on this session by default, exactly as in PowerShell. No setup.
$ agtermctl.exe session rename "build in WSL" $ agtermctl.exe session status blocked $ agtermctl.exe session context "waiting for review" $ agtermctl.exe notify "tests done" $ agtermctl.exe tree --json | jq '.result.tree.workspaces[].sessions[].name'
agtermctl.exe is found by name while the distribution appends the Windows PATH
(appendWindowsPath in /etc/wsl.conf, on by default). The installer and Chocolatey
put agterm-win's folder on the user PATH, and the Store app adds an agtermctl.exe alias.
To type agtermctl as on the other platforms, alias it:
$ echo 'alias agtermctl=agtermctl.exe' >> ~/.bashrc
Export the agterm-win environment to WSL bash
For a Linux script that needs its session id, such as --target "$AGTERM_SESSION_ID" or a
message to another pane, name the variables in your Windows user's WSLENV once, then restart
agterm-win so its sessions start with it. /u passes a variable from Windows into Linux,
and /up also turns a Windows path into a /mnt/c/… one:
PS> setx WSLENV "AGTERM_ENABLED/u:AGTERM_SESSION_ID/u:AGTERM_PANE/u:AGTERM_PANE_ID/u:AGTERM_WINDOW_ID/u:AGTERM_WORKSPACE_ID/u:AGTERM_SOCKET/up:AGTERM_STATE_DIR/up"
If WSLENV already holds entries, append these to them with : rather than replace
them; check with echo $env:WSLENV. agterm-win adds its own PROMPT_COMMAND/u to
whatever you set. A Linux program cannot connect to the Windows control socket, so keep calling
agtermctl.exe; the paths in bash are for scripts that log or pass them on.
agterm-server
The server agterm uses for Linux hosts, installed in a WSL distribution and attached from a window of its own.
Start it
- Choose File ▸ New Session ▸ Start agterm-server in ▸ <distribution>.
- The first time, agterm-win asks whether to start it whenever agterm-win opens. Change this later under Settings ▸ General ▸ Start agterm-server at launch in.
- A window titled after the distribution opens. Its sidebar holds the server's workspaces and sessions; Ctrl+N in it starts a Linux session there.
What the install does
When the distribution has no agterm-server, or another version, agterm-win installs the one built for its own release, showing each step in the window:
- asks the distribution for its architecture, downloads that release's tarball from GitHub and checks it against the sha256 built into agterm-win;
- unpacks it into
~/.local/lib/agterm-serverand runs its installer as your user: a systemd user service, the Linuxagtermctlin~/.local/bin, agent status hooks for Claude Code and Codex (and others it finds), the agterm skill for agents, and a line in~/.bashrcand~/.zshrcthat loads them; - on a distribution WSL has just booted, waits for its systemd user manager and retries a failed install.
Nothing needs root. Offline, download the tarball yourself and run
agtermctl server install <name> --from <file>; it must still match the sha256.
Which distributions it offers
Every distribution wsl.exe --list shows, through remote.properties
(File ▸ Settings ▸ Edit Remotes…), which agterm-win fills with one line per distribution:
Ubuntu = wsl.exe -d Ubuntu -e Debian = wsl.exe -d Debian -e
The name on the left is what menus, the window title and --remote use.
Lifetime
Each session lives in its own daemon inside the distribution, so closing agterm-win, or its server window,
leaves the sessions running, and the next start attaches to them. A session whose shell exits stays in the
sidebar as ended until you close it. Shutting the distribution down (wsl --shutdown, a Windows
restart) ends its sessions.
Gallery: an editor in a server session · two agents in server sessions.
Working in a server session
A server session is a Linux login shell with the Linux agtermctl and the AGTERM variables set.
- agtermctl is the Linux build on
PATH. It talks to agterm-server, which passes what needs a screen, such as a notification, a HUD or a question, on to agterm-win. - Agents report status. Claude Code and Codex started in a server session set the session's dot through the hooks the install added; no setup in Windows.
- The agterm skill is installed for Claude Code, so an agent there can rename its session, message another session or ask you a question.
- Sessions talk to each other with
agtermctl msg send --to SESSION:PANEandagtermctl msg read --wait; the demo shows two agents doing it.
$ agtermctl session rename "fix login test" --target "$AGTERM_SESSION_ID" $ agtermctl session status active --target "$AGTERM_SESSION_ID" $ agtermctl ask "Deploy?" --button y=Yes --button n=No --target "$AGTERM_SESSION_ID" $ echo "tests passed" | agtermctl msg send --to "$OTHER_SESSION:$OTHER_PANE" --stdin
Known gaps in 0.45.1
Commands
The same as in the menus, from PowerShell or from WSL with agtermctl.exe.
| Command | Does |
|---|---|
agtermctl window remote open Ubuntu | Starts agterm-server in that distribution, installing it when needed, and opens its window |
agtermctl window list | Lists windows; a server window shows remote.host and remote.state (connected once attached) |
agtermctl session new --remote Ubuntu | Starts a session on that server; name it afterwards with session rename, since --remote takes no --name |
agtermctl tree --window <id> | The server window's workspaces and sessions |
agtermctl server install Ubuntu [--from FILE] | Installs or upgrades agterm-server there without opening a window |
agtermctl session new --command "wsl.exe -d Ubuntu --cd ~" | A local WSL session from a script |
Every other command is shared with agterm; see the command reference.
Troubleshooting
The server window's notice bar says what failed; its Open Log opens agterm-win.log.
- systemd is off. agterm-server is a systemd user service. Enable systemd in the
distribution, then restart it from PowerShell:
$ printf '[boot]\nsystemd=true\n' | sudo tee -a /etc/wsl.conf PS> wsl --terminate Ubuntu
- “WSLg hides the systemd user bus”. The install finished but the service could not start;
use the notice's Restart Distribution, or
wsl --terminate <distribution>. - “agent hooks are incomplete”. Run
agterm-server install-hooksin the distribution once the agent has been started there. - The download fails. agterm-win needs github.com once per release; behind a proxy, use
agtermctl server install <name> --from <file>. agtermctl.exe: command not foundin a local session. The distribution does not append the Windows PATH; call it by its full path or alias it, as above.- 32-bit or another architecture. agterm-server is built for x86_64 and arm64 only.
More: Windows troubleshooting · report an issue.