Docs
How to set up a server, every command, what an agent can do, how sign-ins work, and the limits.
Quick start
From a server that is already set up to the first fork. To set up a server, see Set up a server.
lui new <project> --repo <owner/name> lui push <project> . lui fork <project> try --ttl 2h lui exec <project>-try --cwd /home/dev/<project> -- pnpm test lui ls
The first line makes the project machine and clones the repository. The second carries what is not on GitHub. The third copies the machine into
the fork <project>-try, which removes itself after two hours. The fourth runs the tests in the fork, and the last shows both
machines.
Set up a server
Do the steps by hand, or give them to an agent. Both ways end with the same server.
- A server with Ubuntu 24.04, two disks, a public IPv4 address and SSH access with sudo.
- A Mac with Node.js 24 or newer and Git.
- Accounts for GitHub and for the agents that you use: Claude Code, Codex or both.
By hand
- Partition the disks. In the installer of your provider, choose Ubuntu 24.04 and custom partitioning. On both disks make a small system partition, joined in a RAID 1 of about 60 GB, and one partition with the rest of the disk and no file system. lui makes a ZFS mirror on the two empty partitions.
-
Install the newer kernel and restart once. Incus 7.0 needs kernel 6.12 or newer, and Ubuntu 24.04 starts with 6.8.
sudo apt-get install -y linux-generic-hwe-24.04 sudo reboot
-
Run the install script on the server. It prints one line per step and skips every step that is already done, so you can
run it again. It installs Incus, ZFS, the firewall rules, Caddy, Node.js and luid, and builds the base machine that every project machine
copies.
git clone <repository> lui-run cd lui-run sudo LUI_DISKS=<disk 1>,<disk 2> \ LUI_SERVER_ADDRESS=<server address> \ ./install/install.sh
-
Set up your Mac. The last three lines give your agent on the Mac the skill and the MCP server.
Then add this line at the top of
git clone <repository> lui-run cd lui-run npm link mkdir -p ~/.lui echo '<user>@<server address>' > ~/.lui/server mkdir -p ~/.claude/skills cp -R skill/lui ~/.claude/skills/ claude mcp add --scope user lui -- lui mcp
~/.ssh/config, sossh <machine>reaches every machine through the server:Include ~/.lui/ssh_config
-
Sign in. For Claude Code, run
claude setup-tokenon the Mac and copy the token. Then run the command below. It says what it stores and asks for the token with a prompt that does not show it.For GitHub, make your own GitHub app. The command opens GitHub in your browser two times: you press "Create GitHub App", then you choose the repositories and press "Install". After that, each machine gets a key for the repository of its own project only.lui secret set claude
You can also sign in once in the base machine withlui github setup
gh auth login. That is one sign-in for all machines, and it opens every repository of your account. The README has the steps. -
Make the first project machine.
lui pushcarries what is not on GitHub: the branch that is not pushed, changes that are not committed,.envfiles and local data.The third line signs Codex in for this machine. It prints a code that you confirm in the browser. Your ChatGPT account must allow sign-in with a device code, which you turn on in its security settings.lui new <project> --repo <owner/name> lui push <project> . lui exec <project> -- codex login --device-auth lui ssh <project>
With an agent
Give this to Claude Code or Codex on your Mac. Replace the two values in angle brackets first.
Set up lui on my server <user>@<server address>. It is a fresh Ubuntu 24.04 server with two disks. Clone <repository> and read its README.md first. Follow sections 1 to 5 in order. The install script prints one line per step and skips the steps that are already done. Before each step that changes the server, tell me in one sentence what it does. Stop and ask me before the restart for the new kernel, before a firewall reset, and at every sign-in, because I confirm those in my browser. For GitHub, run lui github setup and tell me when to click. When you are done, run lui status and lui ls and show me the output. Then make a project machine for <owner/name> and tell me how to open a shell in it.
Commands
Every command runs on your Mac. A command that can destroy work says what it would destroy and asks first. lui help lists the
commands and lui help <command> shows one.
Machines
- lui new <project> [--repo <owner/name>] [--memory 8GiB] [--cpus 4]
- Makes a project machine and clones the repository into
/home/dev/<project>. - lui ls [--json]
- Lists the machines with their state, memory, time left, sessions and addresses, and the free memory of the server.
- lui stop <machine> [--force]
-
Stops a machine and keeps its disk. If a session, an exec or a long-running process has work, lui lists it. An unreadable work check also
stops the request. Review the warning before using
--force. The older--yesspelling cannot override this guard. - lui start <machine>
- Starts a stopped machine.
- lui set <machine> [--memory ..] [--cpus ..] [--repo <owner/name>]
- Changes the memory cap, the number of processors or the repository of a machine.
- lui rm <machine> [--yes] [--force]
-
Removes a machine and its disk.
--yesconfirms ordinary removal. If the work guard reports active or unreadable work, only the owner’s--forceoverrides it. A project with forks still has to keep its disk. - lui logs [<machine>]
- Reads recent luid journal lines. Give a machine to filter the lines and read its Incus log tail when available. Give a session as well to read that session’s output.
- lui doctor
- Checks the owner socket, Incus, network and firewall, disk, memory and running machines. Each check reports ok, failed or skipped. A failed check returns exit status 1.
- lui status
- Shows the memory of the server: the total, the part kept back, the part promised to machines and the free part. It also shows the disk pool.
Forks
- lui fork <project> [name] [--ttl 2h] [--memory ..] [--cpus ..]
- Copies the running project machine into a new machine named
<project>-<name>. - lui ttl <machine> <duration|off>
- Sets or clears the time after which lui removes a fork, such as
30m,2hor1d. - lui snapshot <machine> [<name>] [--rm]
- Takes a snapshot of the disk of a machine, or with
--rmremoves one. - lui restore <machine> <snapshot> [--yes]
- Puts the disk of a machine back to a snapshot. It first says what would be lost, the newer snapshots it removes and the sessions that end. It refuses while a fork made after the snapshot exists, because the fork shares that disk.
Reach a machine
- lui ssh <machine>
- Opens a shell in the machine as the user
dev. - lui exec <machine> [--cwd <dir>] -- <command>
- Runs one command in the machine and returns its exit code. One quoted word runs as a shell line, so a pipe works. To leave a service running, start it in a session.
- lui expose <machine> <port> [--public]
-
Gives a port an HTTPS address such as
shop-3000.203-0-113-10.nip.io. Only your network can open it. With--public, everybody can. - lui unexpose <machine> <port>
- Takes the address away from a port.
- lui egress <machine> [<domain>...] [--open | --inherit]
-
Limits a project or a single fork to these domains and their subdomains. Use
--inheriton a fork to follow its project again. Without domains it shows the list, and--opentakes the limit off. Only you change it. The lui tools and Claude Code keep working, because they go through the server. - lui forward <machine> <port> [<local port>]
-
Makes a port of a machine answer on your Mac, so the app opens on
http://localhost:<port>as if it ran there. It lasts until you press ctrl+C.
Sessions
A session is a terminal that keeps running in a machine after you leave it. A dev server, a database or an agent runs in one.
- lui run <machine> <session> -- <command>
- Starts a command in a new session of a machine.
- lui attach <machine> [<session>]
- Enters a session, as if its terminal were on your Mac. ctrl+\ leaves it, and the session keeps running.
- lui logs <machine> <session> [--lines 50] [--screen]
-
Prints the last lines of a session. With
--screenit prints what the session shows now, which suits a program that draws its own screen, such as an agent. - lui logs <machine> <session> --follow
- Shows the output of a session as it comes, until you press ctrl+C. The session keeps running.
- lui kill <machine> <session> [--yes]
- Stops a session and the program in it. It asks first when a program runs there.
lui ls names the sessions of each machine. It adds * to a session that a terminal is attached to and
(idle) to one where no program runs, as after a server fell. For a session where Claude Code runs it adds (working) or
(waiting), so you see which agent waits for you.
To start the services of a project by themselves, list them in the file .lui/services of the project, one per line as a session
name, a colon and a command, such as web: pnpm dev. lui starts each line in a session when the machine starts and when a fork is
made. Do not list a program that acts on a real outside account, because every fork would run it too.
Files
- lui push <machine> [<folder>] [--yes]
-
Copies a folder on the Mac over the project folder in the machine. It leaves out
node_modules, build output and the lines of the folder's.luiignore. It first checks the machine and warns about commits the Mac does not have, files that changed there and files that a running program holds open. - lui rules <machine> [--yes]
-
Copies your own rules for agents from the Mac into the machine:
~/.claude/CLAUDE.mdfor Claude Code and~/.codex/AGENTS.mdfor Codex. It says what it found and asks first.lui newmakes the same offer for a new machine.
Sign-ins
- lui secret set <name>
-
Stores a sign-in on the server. The value comes from a prompt that does not show it, or from standard input. The only name today is
claude. - lui secret ls
- Lists the names that are set. It never prints a value.
- lui secret rm <name>
- Removes a sign-in from the server.
- lui github setup [--org <organization>]
- Makes your own GitHub app with two clicks in the browser and puts its private key on the server.
- lui github status [--json]
- Shows the app, where it is installed, and which project machines get a key.
- lui github rm
- Takes the app off the server. Machines then use the sign-in from
gh auth login, when there is one.
For agents
- lui mcp
- Runs the lui MCP server for an agent on your Mac. Add it with
claude mcp add --scope user lui -- lui mcp.
What an agent can do
Every machine has the lui MCP server and a skill that explains it. lui knows which machine a call comes from by its network address, so an agent cannot claim to be another machine.
| Tool | What it does | What it refuses |
|---|---|---|
list |
Lists the machines of the agent's project and the free memory. | Other projects. |
fork |
Copies the running project machine into a new fork. | A project at its fork limit, memory that does not fit, a call from a fork. |
exec |
Runs a shell command in a fork and returns the exit code and the end of the output. | The project machine and the machines of other projects. |
expose |
Gives a port of a fork an address and returns its URL. | The project machine. It never makes an address public. |
unexpose |
Takes the address away from a port of a fork. | The project machine and other projects. |
snapshot |
Takes a snapshot of the disk of a machine. An agent keeps at most 5 of one machine. | Other projects. In a fork, every machine but the fork. |
ttl |
Gives a fork that has a time limit a new one, counted from now. | The project machine and a fork without a time limit. Only you take a limit off. |
delete |
Removes a fork that has a time limit. If it finds running sessions, execs or long-running guest processes, it names the work and waits for confirmation. | The project machine and a fork without a time limit. |
session_start |
Starts a command in a new session of the agent's own machine or of a fork. | The machines of other projects. |
session_list |
Lists the sessions of a machine. It says where no program runs, and whether an agent in a session works or waits. | The machines of other projects. |
session_read |
Returns the last lines of a session, or what it shows now. | The machines of other projects. |
session_send |
Types a line into a session or presses a key, such as enter or ctrl+c. | The machines of other projects. |
session_wait |
Waits until the command of a session ends, for at most 10 minutes, and returns its exit code. | The machines of other projects. |
diagnose |
Reads machine state, recent starts and stops, running and overdue execs, out-of-memory kills and recent scoped luid messages. | Only machines the caller can inspect in its project. |
session_stop |
Stops a session. When a program runs in it, it first says so and stops nothing. | The machines of other projects. |
- A project has at most 2 forks, unless you change the setting.
- A fork cannot be forked.
-
A tool that would end a running program asks first.
stop,session_stopanddeletename the affected work and do nothing, until the agent calls again withconfirmed. The agent is told to send it only after you agree, or for a session or a fork that it made itself for its task. - An agent in a fork may list and diagnose machines in its project, open or close its own ports and use its own sessions.
-
An agent on your Mac has the same tools for the project it names, and it may run commands and sessions in the project machine. It also has
seven tools of its own.
createmakes a project machine.restoreputs a machine back to a snapshot, and only after you agree to what it would lose.start,stopandresizestart, stop and resize a machine of that project. When the guard finds active work or cannot read it,stopwaits for your confirmation.pushcarries a folder of the Mac into a machine, and it overwrites work there only after you agree.rulescopies your rules for agents, and it first says what it would copy. The agent cannot remove a project machine or touch the base machine.
The panel
Open a session for a live terminal. Press Escape, then Tab to leave it with the keyboard. On a machine, Running now lists execs, sessions with a
program and guest processes. Diagnose reads the latest evidence from luid. The connector offers the same read-only diagnose tool
for one machine on one server.
Select rows in the Machines table to start or stop machines, extend fork time limits or delete forks. Review the named work before confirming. Batches run one machine at a time. A project’s Egress tab lists which forks follow its policy. A fork follows project changes until you set its own domains or explicitly leave it open. Choose Use the project's policy on the fork to follow the project again.
-
diskUsedis the space used on the guest’s root filesystem, including inherited files. It is unavailable when the guest is stopped or cannot report. diskTotalis the capacity of that same filesystem. The panel shows it alongside used space when available.-
diskOwnis the live space a fork owns on the server’s pool, including while stopped. Unchanged blocks are shared with its project.
An example
You have a plan for a feature and say to the agent on your Mac: "Run this plan in its own machine with the code and the database." The agent
carries your folder with push and forks the project machine with a time limit. The services of .lui/services start in
the fork by themselves. The agent starts a second agent with the plan in a session of the fork, and waits for it with session_wait.
The second agent commits and pushes a branch. The fork removes itself.
Sign-ins
A sign-in that is copied with the disk reaches every fork, and a copy can sign the original out. lui handles each program in the way its maker supports.
| Program | Where the sign-in is | What a fork gets |
|---|---|---|
| Claude Code | On the server, in a file that only root reads. No machine gets it. Claude Code in a machine sends its model calls to the server, and the server puts the sign-in on each call. | Nothing. Its model calls go through the server like those of every machine. |
| Codex | In each project machine. You sign in once per machine with a code that you confirm in the browser. | A copy without the key that renews it. It works for at most 10 days and cannot sign the project machine out. |
| GitHub, with your own app | The private key of the app is on the server. A machine asks for a key each time git or gh starts. |
A key for the repository of its project only, good for one hour. |
| GitHub, with one sign-in | In the base machine, from gh auth login. Every machine copies it. |
The same sign-in, with no time limit, for every repository of your account. |
An agent in a machine cannot read the Claude Code sign-in, because the machine holds only a placeholder word. The server passes on model calls
only, not the other pages of your account. Anthropic documents such a proxy for API keys and does not mention the token of a subscription, so
this was tested with Claude Code 2.1.334. A token that a machine held before this change stays valid until you make a new one with
claude setup-token. With the GitHub app, a pull request that an agent opens shows the app as its author.
Your computers
Each of your computers signs in to your servers with its own SSH key. Run lui setup <user>@<server> --name laptop once
per computer and server. Setup makes the key in ~/.lui/computer_ed25519, registers it under the name and checks a fresh login. The
key's SHA256 fingerprint is the computer's ID, the same on every server.
The activity record names the computer: "You on laptop" for your own commands and "Agent on laptop" for an agent working from it. Keys you added
before show as unregistered keys and keep working. lui computers lists both on one server; the panel's Account page lists them
across all your servers.
To retire a computer, choose Remove on the Account page, or run lui computers rm <name> on each server from another computer.
The key leaves the server and every machine, and its open connections end. A stopped machine loses the key at its next start. A server that is
offline keeps the key until you remove it there again. If the key of the computer you use was removed, run lui setup again.
Troubleshooting
The install script stops before it changes anything when a check fails, and its message says what to do. These are the ones you meet most.
- Kernel … is older than 6.12, which Incus 7.0 needs.
-
Install the newer kernel with
apt-get install -y linux-generic-hwe-24.04, restart, and run the script again. Nothing was changed. - ufw already holds rules, and the bridge rules are not before the public ones
-
A machine could then reach the SSH of the server. Only a reset of ufw fixes the order, and it drops every rule. To allow it, run the script
again with
LUI_FIREWALL_RESET=yes. - Set LUI_DISKS to the two data partitions
-
Give the two empty partitions, one on each disk, such as
LUI_DISKS=/dev/sda5,/dev/sdb4. The script also stops when a partition holds a file system. - The base machine exists but was not finished.
- A run stopped halfway. Remove the base machine with the command in the message, then run the script again.
- luid did not stay up.
- Read why with
journalctl -u luid. - Codex sign-in does not accept the code
-
Your ChatGPT account must allow sign-in with a device code. Turn it on in the security settings of the account, then run
lui exec <machine> -- codex login --device-authagain. - lui exec does not return after it starts a service
-
The service keeps the input or output of the call open. Start it in a session instead:
lui run <machine> <session> -- <command>. Read its output withlui logs.
Update and remove
To update lui, pull the new code and run the install script again with the same values. It copies the new code to /opt/lui and
restarts luid. The machines keep running.
cd lui-run git pull sudo LUI_DISKS=<disk 1>,<disk 2> \ LUI_SERVER_ADDRESS=<server address> \ ./install/install.sh
On the Mac, git pull in the lui-run folder updates the lui command, because npm link points to that
folder.
lui rm <machine> removes one machine and its disk. There is no script that removes lui from a server yet. To start clean,
install the server again from the panel of your provider.
Limits
lui is new and runs on one test server today. The install on a fresh server is the part we ask you to try.
- The server must run Ubuntu 24.04 and have two disks. lui manages one server for one owner.
- The lui command is tested on macOS.
-
A fork copies the disk, not the memory. A fork starts the services that
.lui/serviceslists. A program that you started by hand does not run in the fork until you or the agent start it. - Remote Control of Claude Code does not work in a machine, because its model calls go through the server.
(working)and(waiting)show for Claude Code only. Codex in a session has no such mark.- Machines start with a kernel that the server loads, so they have no Secure Boot.
-
lui pushadds and overwrites, and removes only unchanged files of the branch that the machine had before. A file that you deleted on the Mac but did not commit as deleted stays in the machine. -
lui egresslimits by address. Another site on the address of a listed domain, such as one behind the same CDN, is reachable too. A connection that was open before the limit stays open. - Codex in a fork works for at most 10 days. After that, make a new fork.
- The GitHub app is one per person who installs lui. One shared app would give its owner a way into every user's repositories.