lua build-session opens a live build session from your terminal: Claude works on your agent in the cloud while you chat with it. These are the same sessions the Lua desktop app opens, so you can start a session in one and carry on in the other. You can chat, send files, try the session’s version of the agent, release it, and answer whatever the session asks of you, such as an approval or a secret.
Build sessions must be on for your organization. They are on for every organization from 25 October 2026. An organization that turns off its
buildSessions.enabled feature has opted out; there, every command fails with build_sessions_disabled and does nothing else.lua --help does not list build-session unless LUA_BUILD_SESSIONS_ENABLED=true is set in your own environment. The value must be exactly true. The commands work either way, and lua build-session --help always prints their help.Synopsis
--json, and every command that works on one session takes --session <sessionId>.
Description
A build session belongs to one agent and to the person who started it. One agent has at most one open session at a time. A session id looks likebs_<uuid>.
The current session
Afterstart, attach, chat, use or resume, the CLI remembers the session as the current one, so the other commands need no id. It keeps it in ~/.lua-cli/build-sessions.json, which every terminal of your user account on this computer shares. A command picks its session in this order:
- the id given as an argument or with
--session <sessionId>; LUA_BUILD_SESSION_IDin the environment;- the current session the CLI remembers.
LUA_BUILD_SESSION_ID in each terminal.
end and kill without an id let you pick one of your open sessions when you run them in a terminal, with the current one listed first. Outside a terminal (a script or CI) they use the current session only while it is your one open session; with two or more open they stop with exit code 2 and list them, so pass --session.
Sessions and their states
An ended, failed or killed session can’t be resumed; start a new one. Work you did not save stays in the session’s checkpoints for 7 days. There is no delete: ended sessions are removed automatically after the retention period.
Chat
In a terminal,lua build-session with no command, lua build-session start, chat and resume open a chat once the session is ready. Type a message and press Enter. Replies stream in as they are written and render as Markdown. A message you type while a turn runs is queued, and the chat shows its place, for example queued #1.
When the chat opens on a session that already has history, it does not replay it. It prints a short summary of where you left off instead, then only what happens next.
Re-enter the chat later with
lua build-session chat.
Slash commands
/switch and /new need a terminal; elsewhere, use resume and start.
Approvals in the chat
When the session asks you for something, the chat offers to answer it there:- An action, such as a command that changes the agent:
Approve … now? [y/N]. It runs with your rights./deny <id>declines it. - A release card:
Approve release brc_… now? [y/N]. The card is in the Lua desktop app too. See who can approve a release. - A secret: you type the value with the input hidden. It goes to the agent’s environment variables, never to the session; the session only learns that it is set. For a key you pasted, the chat asks
Save the key you pasted (…6Hs1) as NAME? [y/N]and there is nothing to type. - Adding an agent to a fleet session:
Approve … now? [y/N]adds it, where your organization allows approving from the CLI; elsewhere confirm it in the Lua desktop app. Declining is done in the Lua desktop app.
n, or anything that is not y, to leave it for later; a line that is not y or n is sent as a message. Whatever you don’t answer stays in lua build-session approvals and in the Lua desktop app.
Drop files on the terminal
Drag a file onto the terminal, or paste its path, and it goes with the message on the same line. A file dropped on its own waits for your next message. A path counts when it is absolute, starts with~/ or is a file:// URL, and the file exists; a word like notes.txt stays part of the message, and so does anything inside backticks. The chat asks before it attaches a file over 5 MB or outside your home folder.
Files Claude shares show up in the chat with their number, for example /save 2 to download. chat --auto-save <dir> saves each one as it arrives instead.
File limits
The CLI checks the type and size before uploading. The platform checks the contents too and refuses a file whose contents do not match its type (
attachment_rejected).
Pick an organization and agent
start, chat and bare lua build-session without --agent, in a terminal, ask which agent to build:
- The organization. This step is skipped when you belong to only one.
- The agent. The agent in this project’s
lua.skill.yamlcomes first, marked[this project]. Each agent shows your open or parked session, if it has one.- Picking an agent with your session offers to resume it or to start a session on another agent.
- An agent another person is building is refused, because an agent has one session at a time. Pick another agent.
- The last entry, Fleet session: pick a supervisor…, starts a fleet session on the supervisor agent you pick next, with its fleet members loaded too.
lua build-session with an open current session first asks whether to continue it, pick another of your sessions, or start a new one.
Outside a terminal, with --json, with --no-chat or --no-wait, or under --ci or with CI set to 1 or true, nothing is asked. start then uses --agent or the agent in lua.skill.yaml, and bare lua build-session prints its help.
Commands
start
Opens a build session on the agent and waits until it is ready, then opens the chat in a terminal. Without--agent, a terminal gets the picker; elsewhere the agent comes from lua.skill.yaml.
chat
Opens the chat on the current session, on--session, or on the agent’s open or parked session. A parked session is resumed first. When the agent has no session, a terminal starts one. Without any of these, a terminal gets the picker.
chat is interactive and refuses --json; use send and attach --json in scripts.
attach
Prints the session’s activity as it happens: Claude’s text, a line per tool step, file change, command, checkpoint, test and approval, and the credits spent.Ctrl-C stops following; the session keeps running.
send
Sends a message and prints its turn until the session is idle again.Ctrl-C stops following and exits 130; the turn keeps running. Stop it with lua build-session stop.
stop
Stops the running turn now. A queued message, if there is one, runs next.try
Sends a message to the session’s version of the agent, the way an end user would, and prints the reply. Writes go to separate test data, and outbound calls are recorded instead of made.release
Builds the release candidate: what the session changes, its tests and its risk. The approval card opens in the Lua desktop app, and the command prints the candidate’s state as it changes.
With
--wait, the command prints each agent’s version change once the release is live, and exits 1 when the candidate is denied, fails, is rolled back or is superseded.
--cancel stops a release that is still being prepared: it prints Cancelled release brc_… while it was being built; nothing went live. The session keeps its work. Only the session owner can cancel, signed in with lua auth or with an API key where the organization allows approving from the CLI. A release already waiting for your decision cannot be cancelled; deny it instead. A server that does not offer cancelling yet answers cancel is not available on this server.
Who can approve a release
Approving a release from the CLI, withrelease --approve, approve brc_… or y in the chat, needs a person signed in with lua auth. An API key can approve only when the organization has turned on its buildSessions.cliReleaseApprove setting. Otherwise approve the card in the Lua desktop app.
end, remove
Ends the session. Without an id, a terminal lets you pick one of your open sessions.remove (alias rm) does the same and says that ended sessions are removed automatically; there is no delete.
When a release from the session is still open, end deals with it first:
- Waiting for your decision: it prints the release card and asks what to do: Keep working (the default), Deny it and end the session, or Approve it (it goes live, then the session ends). The menu starts on Keep working and does not wrap around.
- Still being prepared: it asks whether to end the session, which cancels the release, or keep working.
- Already going live: it waits for the release to finish, up to 10 minutes, then ends the session.
Ctrl-Cstops waiting and leaves the session open.
end prints the card, ends the session and says the release was cancelled: nothing went live, and the session’s changes were not saved to your agent. With --json, the result carries cancelledRelease.
kill
Stops a session hard, without saving. Without an id, a terminal lets you pick one of your open sessions.list
Your build sessions across every organization and agent you can see, newest activity first. Each line shows the session id, its state, the organization and agent,[fleet] for a fleet session, when it was last active and the credits it spent today. * marks the current session.
use
Makes the session the current one. Nothing changes on the server.resume
Resumes a parked session, or re-attaches to an open one, and opens the chat. Without an id, a terminal lets you pick one of your sessions; elsewhere the command exits2 and lists the sessions you can resume.
approvals
Lists everything waiting on you across your open sessions: action requests (bsa_…), secret requests (bss_…), release cards (brc_…) and requests to add an agent to a fleet session (bsa_add_…). Each line shows the kind, the id, the session and agent, what it is, its risk, and how long ago it was asked.
A release that is still being built is not a decision yet: it is shown as an information line, building brc_… … nothing to decide yet, with how long it has waited. With --json, such releases are under building, not items.
Release cards and add-agent requests are listed once the CLI on this computer has seen them, in
chat, attach, send or release.
approve, deny
approve <id> approves an action request (bsa_…), which then runs with your rights, or a release card (brc_…). deny <id> declines an action request or denies a release card; a denied release changes nothing, and the session keeps its work. The platform decides who may approve. deny takes --reason <text>, kept with a release decision.
approve bsa_add_… adds the agent with the name and purpose on the card, where your organization allows approving from the CLI; elsewhere nothing is sent and the CLI points you to the Lua desktop app. You can confirm only cards from your own build sessions, an agent already added is not added again, and an agent whose access waits for an org admin joins once they approve. deny bsa_add_… sends nothing: declining is done in the Lua desktop app, or tell Claude in the session that you do not want the agent.
approve or deny on a release that is still being built sends nothing: the CLI says Release brc_… is still building (…); nothing to decide yet. and exits 1. Wait for its card, or use release --cancel.
A release decision is bound to the version of the card you saw. deny works from any terminal signed in as you; with an API key, only where your organization enabled deciding releases from the CLI (elsewhere it says so, denies nothing and exits 10: sign in with lua auth configure, or deny in the Lua desktop app). Approving a release card needs a card the CLI on this computer has printed (in approvals, release or the chat); if it has not, approve prints the card and stops, and running it again approves that card.
From lua-cli 3.67.0, approving a release card follows the release until it is live, for up to 10 minutes. It prints each agent’s new version once live. If the release does not go live, it prints why and that nothing went live, and exits 1. If it is still going live after 10 minutes, it says so and names the command to check later. Ctrl-C stops the waiting, and the release keeps going.
undo
undo <n> puts the session’s files back to checkpoint n (lua-cli 3.67.0 and later). Before sending, it prints what changes: the files put back, the deleted files that come back, and the new files that are removed. It also prints what is kept: the backup section of lua.skill.yaml, and files a checkpoint never saves. The session first saves your current files as a checkpoint, so an undo can itself be undone. undo then waits for the session’s report, up to 180 seconds (--timeout <s>; --no-wait returns at once). If the undo worked, it prints the files it changed, plus any it left as they were because no checkpoint holds their current content. If the undo is refused or fails, it prints the reason, leaves the files unchanged and exits 1. If no report comes in time, it says the undo could not be confirmed. Without n it lists the session’s checkpoints, and a number the session does not have is refused with that list. --agent picks the agent in a session with several. The chat’s /undo [n] does the same, and the report also shows in the session stream.
secret
Answers a secret request (bss_…). In a terminal you type the value with the input hidden; it is never a command-line argument. The value goes to the agent’s environment variables, never to the session, and it is never printed.
Outside a terminal,
secret needs --from-stdin, --from-pasted or --decline.
A key pasted into a message
If you paste a key into a message, the session takes it out before saving the message or showing it to Claude. Right under your message the CLI says so, with the key’s last four characters:🔒 Your message had a key in it (…6Hs1). When Claude asks for that key, secret <id> --from-pasted (or /secret <id> in the chat) saves it with nothing to type.
not-a-key
If what was taken out of your message was not a key,not-a-key <bsp_id> sends it to Claude as you wrote it. The id is on the 🔒 line. In the chat, use /notakey <bsp_id>.
files, download
files lists the session’s files: the ones you sent and the ones Claude shared. download saves one by its id, or all of them with --all, into ./build-session-files/<sessionId>/.
status
Shows the session: its state, the agent version and source it started from, the credits spent today and in total, the latest checkpoint and what is staged for testing. With--agent <agentId> and no session, it lists that agent’s sessions instead.
Output
--json prints one JSON object per line, each with a kind. The stream of a session arrives as {"kind":"event", …}, {"kind":"state", …}, {"kind":"ack", …} and {"kind":"error", …} lines; a command that follows the stream ends with a {"kind":"result", "verb", "outcome", …} line. One-shot commands print a single line of their own kind, such as session, started, session-list, approvals, files, downloaded, release, try, ended or killed.
Out of credits
When your organization runs out of credits, the session stops withcredits_exhausted, the message Your organization is out of credits. Top up to keep building. and a link to top up your balance. The command exits 13. A daily credit cap on the session is a different refusal, budget_exhausted; it resets at midnight UTC.
Examples
Chat with the current session, or pick an agent:Common refusals
Exit codes
The full table is in Errors and exit codes.
Environment variables
See also
lua chat— talk to the agent in sandbox or productionlua auth— sign in, which a release approval from the CLI needslua version— the agent versions a release promotes- Errors and exit codes — every exit code, including
13

