Agent Skill

Use this skill when a task needs a terminal that stays open — an interactive installer, a REPL, a program that redraws its screen, a session a person may need to take over. A one-shot Bash call is the right tool for a command that runs and exits; reach for afterminal when the program’s state lives between calls.

For flag-level detail, ask the command itself: afterminal api --help returns every legal shape of the call at once. This skill covers behavior, decisions, and recovery only.

Core Rules

ui --mode session publishes the runtime without opening a browser here. Reach for it whenever the person is not at this machine and already uses AFUI. The command runs until stopped, so treat it like starting a server rather than like opening a window. With no explicit mode the command follows AFUI_DELIVERY and then defaults to window; never paper over an invalid environment value. The same modes apply with ui --api-url: the remote API supplies a private upstream capability, while AFUI still owns Window, Link, or Session delivery.

ui --mode link returns a direct trusted-LAN URL for a device that does not have AFUI. It is a bearer capability with control of every terminal session in the runtime. Share it only through a trusted channel, do not put it in logs or persistent notes, and do not expose the listener directly to the Internet. It is an AFUI-owned page governed by the global attention.idle_timeout_s and attention.grace_period_s policy, with the same warning and renew action as afui session serve.

Commands started inside either remote delivery receive AFUI_DELIVERY=session, so their own UIs join the existing registry instead of opening a local window or advertising another link.

The person who reaches a remote terminal can end it from there, exactly as if they had closed the window in the default mode. Ending it exits the command and kills whatever the PTY is running — including a long-running agent you started inside it. That is almost always what was wanted, but it happens on a single remote action, so do not treat an unexpected exit of a session you opened this way as a crash to diagnose before checking whether a person simply ended it.

A screen settles; it is not instant

Terminal programs redraw. A snapshot taken the moment after a keystroke shows the state before the program reacted, and that is a real reading, not a stale one. When a result depends on the program having caught up, wait for the event that says so rather than sampling the screen in a loop and hoping.

Input leases: the human wins

Multiple actors can hold input on one session, and a person can preempt the agent. Losing the lease is not an error to retry — it means someone took the keyboard deliberately. Stop writing input, report that control changed, and do not reclaim the lease to finish what you were doing unless you are asked to.

Secret input mode: stop, do not work around it

A session can be taking a secret — a password, a recovery phrase, a key. While it is, you cannot type into it, signal it, take a lease on it, or read its screen, and its output produces no events. This is not a fault and not a rate limit: a person is deliberately entering something you must not see.

Signals go to the foreground process group

Interrupting means signalling the group the terminal is actually running, not the session host. Send the signal and then read the screen to learn what it did: a program may trap, prompt, or ignore it. Treating “signal sent” as “program stopped” is how a task reports success against something still running.

Recovery

Setup Checklist

afterminal --version || cargo install agent-first-terminal --locked --features api
afterminal skill install       # installs this skill for codex, claude-code, opencode, hermes