taikutaiku
User GuidePluginsAPI Reference

Remote Commands

Control a live taiku session from the CLI, scripts, or AI agents.

Remote Commands let you control a live taiku session from outside the browser.

Use them when you want to:

  • drive a session from taiku func, curl, or automation scripts
  • inspect layouts, shells, chat, or agent state
  • build AI agent integrations that interact with terminal sessions

Quick start

# Run from inside a taiku shell (auto-detects session + client)
taiku func list-tiles
taiku func run "ls -la"
taiku func get-layout

# Run from outside (specify session explicitly)
taiku func --session <name> list-users
taiku func --session <name> --client <id> split-h

Client targeting

Many commands operate on a specific browser client's state (layout, workspace, focus). taiku resolves the target client automatically:

ScenarioBehavior
Running inside a taiku shellAuto-routes to the client that owns the shell via TAIKU_SHELL_ID
One browser client connectedAuto-targets that client
Multiple clients, no --clientReturns an error listing available client IDs
--client <id> specifiedTargets that specific client

Use taiku func list-users to see connected clients and their IDs.

Authentication

All remote commands require authentication as the session owner. The CLI uses your login credentials from taiku login, or you can pass --token <api_key>.

REST API

You can also send remote commands directly via HTTP:

curl -X POST https://taiku.live/api/v1/sessions/{session_id}/remote/command \
  -H "X-Taiku-Token: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"method": "getLayout", "params": {}}'

Request body

FieldTypeDescription
methodstringMethod name (e.g. getLayout, splitShell)
paramsobjectMethod-specific parameters
target_client_idnumber?Target a specific browser client
source_shell_idnumber?Shell ID for auto-routing (set automatically by the CLI)

Response

{ "result": { ... } }

On error, returns an HTTP error status with a text body.

GET shortcuts

Common read commands have GET shortcuts:

EndpointMethod
GET .../remote/layout?client=<id>getLayout
GET .../remote/tiles?client=<id>getTiles
GET .../remote/workspaces?client=<id>getWorkspaces
GET .../remote/shells?client=<id>getShells
GET .../remote/users?client=<id>getUsers
GET .../remote/agents?client=<id>getAgents
GET .../remote/chat?client=<id>getChat
GET .../remote/tunnels?client=<id>getTunnelPorts

Command reference

Layout

Commands that manipulate or read the target client's tiled terminal layout.

split-h / split-v

Split a tile horizontally or vertically, creating a new shell.

taiku func split-h              # Split focused tile
taiku func split-v --tile 3     # Split specific tile
OptionTypeDescription
--tilenumber?Tile key to split (default: focused tile)

close-tile

Close a tile from the layout.

taiku func close-tile --tile 3
OptionTypeDescription
--tilenumber?Tile key to close (default: focused tile)

reset-layout

Reset the layout to a balanced grid of all current tiles.

taiku func reset-layout

toggle-direction

Toggle a split's direction between horizontal and vertical.

taiku func toggle-direction --tile 3
OptionTypeDescription
--tilenumber?Tile key whose parent split to toggle

set-ratio

Set a split ratio (controls how space is divided between two tiles).

taiku func set-ratio 0.7 --tile 3
ArgTypeDescription
ratiofloatRatio between 0.1 and 0.9
OptionTypeDescription
--tilenumber?Tile key (default: focused tile)

swap-tiles

Swap the positions of two tiles.

taiku func swap-tiles 1 2
ArgTypeDescription
key_anumberFirst tile key
key_bnumberSecond tile key

maximize

Maximize a tile to fill the entire workspace.

taiku func maximize              # Maximize focused tile
taiku func maximize --tile 3     # Maximize specific tile
OptionTypeDescription
--tilenumber?Tile key (default: focused tile)

focus-tile

Focus a specific tile.

taiku func focus-tile 3
ArgTypeDescription
keynumberTile key to focus

focus-direction

Focus the neighboring tile in a direction.

taiku func focus-direction left
ArgTypeDescription
directionenumleft, right, up, or down

rename-tile

Rename a tile (sets a custom label in the titlebar).

taiku func rename-tile "logs" 3
ArgTypeDescription
namestringNew display name
keynumber?Tile key (default: focused tile)

get-layout

Get the current layout with tile positions and sizes.

taiku func get-layout

Returns:

{
  "tiles": [
    { "key": 1, "type": "shell", "id": 1, "x": 0, "y": 44, "w": 756, "h": 813 },
    {
      "key": 2,
      "type": "shell",
      "id": 2,
      "x": 756,
      "y": 44,
      "w": 756,
      "h": 813
    }
  ]
}

list-tiles

List tiles on the current workspace (lighter than get-layout).

taiku func list-tiles

get-tab-groups

List tab groups (tiles with multiple tabbed items).

taiku func get-tab-groups

Tabs

Commands for switching tabs inside a tabbed tile.

select-tab

Switch to a tab by zero-based index.

taiku func select-tab 1
taiku func select-tab 2 --tile 3
ArgTypeDescription
indexnumberZero-based tab index
OptionTypeDescription
--tilenumber?Tile key (default: focused tile)

next-tab

Switch to the next tab in a tile.

taiku func next-tab
taiku func next-tab --tile 3
OptionTypeDescription
--tilenumber?Tile key (default: focused tile)

prev-tab

Switch to the previous tab in a tile.

taiku func prev-tab
taiku func prev-tab --tile 3
OptionTypeDescription
--tilenumber?Tile key (default: focused tile)

show-layout / show-tree

ASCII visualization of the current layout.

taiku func show-layout    # JSON pretty-print
taiku func show-tree      # Indented tree view

Workspaces

Commands for managing workspaces (virtual desktops).

list-workspaces

List workspaces.

taiku func list-workspaces

create-workspace

Create a new workspace.

taiku func create-workspace

switch-workspace

Switch to a workspace by index.

taiku func switch-workspace 0
ArgTypeDescription
indexnumberWorkspace page index

list-user-tiles

List tiles for a specific connected client. Automatically targets the requested client.

taiku func list-user-tiles 2
ArgTypeDescription
user_idnumberClient ID from list-users

setup

Set up a grid layout with specific tile types.

taiku func setup --grid 2x2
taiku func setup --grid 2x2 --tiles "shell,shell,tunnel:3000,shell"
taiku func setup --grid 1x3 --tiles "shell,shell,shell" --commands "htop,git log,npm start"
OptionTypeDescription
--gridstringGrid dimensions (e.g. 2x2, 1x3)
--tilesstring?Comma-separated cell specs. Use + for tabbed items. Forms: shell[:command], tunnel:<port>, browser[:url]
--commandsstring?Comma-separated commands for shell tiles

Shells

Commands for creating, reading, and writing to terminal shells.

list-shells

List all shells in the session.

taiku func list-shells

create-shell

Create a new shell. Waits for server confirmation and returns the real shell ID.

taiku func create-shell
taiku func create-shell --cwd /tmp
OptionTypeDescription
--cwdstring?Working directory for the new shell

close-shell

Close a shell. Non-admin users can only close their own shells.

taiku func close-shell 3
ArgTypeDescription
idnumberShell ID

write-to-shell

Write data to a shell. When run from inside a taiku shell without specifying an ID, writes to the current shell.

taiku func write-to-shell 3 "ls -la\n"
ArgTypeDescription
idnumberShell ID
datastringData to write (use \n for enter)

run

Execute a command (shorthand for write-to-shell with a newline appended).

taiku func run "ls -la"
taiku func run "npm start" --tile 2
ArgTypeDescription
commandstringCommand to execute
OptionTypeDescription
--tilenumber?Target tile (default: focused tile or source shell)

get-shell-output

Get terminal output from a shell.

taiku func get-shell-output 3
taiku func get-shell-output 3 --chunks 5
ArgTypeDescription
idnumberShell ID
OptionTypeDescription
--chunksnumber?Number of output chunks

get-terminal-names

Get shell names/titles as seen by the target client.

taiku func get-terminal-names

Session info

Commands for reading session metadata and user state.

get-session

Get session metadata (ID, name, user count, shell count).

taiku func get-session

list-users

List connected users/clients. Use this to find client IDs for --client.

taiku func list-users

Returns:

[
  {
    "id": 1,
    "name": "nathanz",
    "canWrite": true,
    "device": "Mac Web",
    "clientKind": "browser"
  },
  {
    "id": 2,
    "name": "nathanz",
    "canWrite": true,
    "device": "Desktop App",
    "clientKind": "desktop"
  }
]

get-role

Get the executing client's role (admin, writer, or reader).

taiku func get-role

get-ownership

Get shell ownership info: which shells this client owns, which are owned by others, and which are unowned.

taiku func get-ownership

adopt-shell

Adopt a shell into the target client's workspace. Admins adopt directly; regular writers send a request to the current owner.

taiku func adopt-shell 5
ArgTypeDescription
idnumberShell ID to adopt

Chat

get-chat

Get chat history.

taiku func get-chat

send-chat

Send a chat message.

taiku func send-chat "hello everyone"
ArgTypeDescription
messagestringMessage text

broadcast-event

Broadcast a plugin event to all connected clients. Cannot be targeted to a single client.

taiku func broadcast-event myevent --data '{"key": "value"}'
ArgTypeDescription
typestringEvent type name
OptionTypeDescription
--datastring?JSON payload

Agents

Commands for inspecting AI agent activity.

list-agents

List active AI agents detected in the session.

taiku func list-agents

get-agent-cost

Get token usage and cost summary across all agents.

taiku func get-agent-cost

list-agent-sessions

List agent sessions (distinct agent runs).

taiku func list-agent-sessions

get-agent-events

Get events from a specific agent session.

taiku func get-agent-events abc123 --types tool_call,user_message --limit 20
ArgTypeDescription
session_idstringAgent session ID
OptionTypeDescription
--typesstring?Comma-separated event types to filter
--limitnumber?Max events to return

Tunnels

list-tunnels

List active tunnel ports.

taiku func list-tunnels

Notifications

toast

Show a toast notification on the target client.

taiku func toast "Build complete" --kind success
ArgTypeDescription
messagestringNotification text
OptionTypeDescription
--kindstringinfo, success, or error (default: info)

notify

Send a browser/desktop notification on the target client.

taiku func notify "Alert" --body "Something happened"
ArgTypeDescription
titlestringNotification title
OptionTypeDescription
--bodystring?Notification body text

On this page