Instructions for coding agents
This page is written for a coding agent that a person has asked to put a project online with Tori: Claude Code, Codex, Cursor, Gemini CLI, or any other. It does not depend on which one you are. The guides linked from it say more; this page says what to do, in order.
To hand it to an agent, paste this:
Read https://docs.tori.host/agents.md and put this project online with Tori.That address serves this page as Markdown.
1. Reach Tori
Section titled “1. Reach Tori”Tori has two clients over the same API. Use whichever you already have.
- You can run shell commands. Use the CLI.
npx tori.hostneeds Node.js 20 or newer and nothing installed. Everything on this page can be done this way. - You already have tools whose names start with
tori_. Tori’s MCP server is connected. Use the tools; MCP for coding agents says what each input means.
If your host speaks MCP and the server is not connected, you may add it, when the person asked for that or agrees to it: a stdio server named tori, command npx, arguments -y, tori.host, mcp. Connect a host has the exact command or file for the hosts that document one. Most hosts start a new server only after a restart or a reload, so say so, and deploy with the CLI now instead of waiting. The MCP interface is a preview.
2. Sign-in is the person’s step
Section titled “2. Sign-in is the person’s step”This is about the CLI. The MCP server signs in on its own: it uses TORI_TOKEN from its own environment if the host set one, and the CLI’s saved sign-in otherwise. So what whoami prints in your shell is not always the account the tools act on, and a host with no shell cannot run it at all: there, tori_account reports the account the tools act on. With MCP, a tool that is refused for lack of a token says so; Authenticate has the two ways the person can fix that.
With the CLI, check first:
npx tori.host whoamiIt prints the account’s email and plan, then what the plan allows, or exits 1 and says why, usually not signed in. Check before deploying: a deploy with nobody signed in starts the same sign-in and waits for it.
Two refusals are not a missing sign-in, and login repairs neither, because TORI_TOKEN is used before a saved sign-in.
If whoami says the API refused TORI_TOKEN, the token was revoked, has expired or is wrong. Tell the person, who replaces it or unsets it. Do not sign in: the token in the environment would still be sent.
If TORI_TOKEN holds a deploy token, whoami is refused and says that such a token cannot read the account. That token deploys the one app in tori.json and reads its deploys, and nothing else on these pages. Go on with that deploy; do not sign in over it or ask for a wider token.
If nobody is signed in, run:
npx tori.host loginOn the person’s own machine it opens their browser, and they sign in there. It also prints a link with a short code in it; anywhere without a browser it prints only the link and the code. Give the person both exactly as printed and tell them the command is waiting: they open the link on a device where they are signed in to the console, check that the code matches, and approve. Signing up is the same step, because a person with no account creates one on that page.
The command waits five minutes. If your shell stops commands sooner than that, run it in the background or with a longer limit, or the approval arrives after the command is gone.
- Only the person signs in or approves. Do not open the link yourself.
- Never ask for a token in the conversation, and never print one. No tool or command on this page takes a token as an argument.
- Where nobody can approve (CI, a sandbox with no person), the person sets
TORI_TOKENin the environment. Sign in describes the tokens.
3. Decide what you are deploying
Section titled “3. Decide what you are deploying”An app is a static site or a service. A static site can later become a service, keeping its address and domains, but only when you say so (--convert, or convert: true in MCP), and a service never becomes a static site. Decide before the first deploy.
-
Static site: files, nothing runs. Build first, then deploy the output directory, the one that holds
index.html:Terminal window npm run buildnpx tori.host deploy --static ./dist -
Service: a container Tori runs. Once you have decided it is a service, say so:
Terminal window npx tori.host deploy --servicePlain
npx tori.hostalso builds aDockerfileor a server framework it recognises, but where the project holds a static site as well it will not guess, and with no terminal to ask on it stops. Two things make a service fail to start that are easy to miss:- The port. The process must listen on 8080, or on the port the deploy names.
--port 3000names it for that one deploy only; a later deploy without it expects 8080 again. So after the first deploy, add"port": 3000to thetori.jsonit wrote. Every later CLI deploy uses it, and so does an MCP deploy fromsource; an MCP deploy of animagereads nothing from that file, so passporteach time. - The user. A
Dockerfile, or an image you bring, must declare a numeric non-rootUSER, for exampleUSER 1000. A build Tori detects without aDockerfileis arranged that way for you.
- The port. The process must listen on 8080, or on the port the deploy names.
Never publish as static files a directory that holds server code or a .env file. The CLI refuses the cases it can see and prints the command to run instead; run that one, and do not work around the refusal.
You are not at a terminal, so the CLI does not ask questions. Where it would ask, it stops and prints the choices as commands.
tori.json is how the CLI remembers which app a project is. The first CLI deploy writes it. If it exists, the project already has an app, and a CLI deploy updates that app. Leave the file in place and suggest committing it.
The MCP tools do not take the app from that file and do not write it. tori_deploy creates a new app every time app is left out. So with MCP:
- If
tori.jsonexists, pass itsslugasapp. - After a first deploy, keep the
appthe result returns and pass it to every later call. That holds for a first deploy that failed too: the app was created before the deploy ran, and the error names its slug. Retry with that slug asapp, or the retry creates a second app. Write it totori.jsonas{ "slug": "<that slug>" }, so that a later CLI deploy, and the CLI commands on the task pages, find the same app and do not create another.
Deploy a static site and Deploy a container service cover the details, including environment variables, release commands and ports.
4. Report what happened
Section titled “4. Report what happened”A deploy waits until the app serves. Run from a shell that is not a terminal, as yours is, its last line is:
✓ live: https://plucky-wren.tori.cloud (8s)On a terminal the same line reads [oo it's live. } and then the address. With MCP, the result’s status is live and url is the address. Report the address Tori gave, not one you composed.
One success is not the end state. If the CLI says the deploy went live, and has already been replaced by a newer deploy, or the MCP result’s status is superseded, somebody deployed after you. The address now serves their deploy and not yours. Say that, and do not report your changes as what is online. If the deploy failed, the CLI prints the stored reason; pass it on as it is, then fix the cause and deploy again. Deploy status and recovery lists the states.
5. Ask the person before you
Section titled “5. Ask the person before you”- Create a second app when the project already has a
tori.json, or deploy to a different slug than the one in it. - Delete anything. That includes a managed database or a restored copy of one.
- Free room on a full plan. A deploy that would exceed the plan is refused with
app limit reachedand names the limit. Which app to give up, or whether to change the plan, is the person’s decision. - Spend money. A plan change, a domain purchase and a renewal are the person’s decisions. Do not start one unless they asked for exactly that, and leave the paying to them.
- Set a secret.
npx tori.host env set KEY=VALUEstores an environment variable for a service. Ask for the value to be set by the person, or use one already in the project’s environment; do not echo it back.
6. When the project needs more
Section titled “6. When the project needs more”Each of these has a page of its own, with the same shape as this one: when it applies, the steps, how to check, what to ask first. Read the page before you start the task, not instead of asking.
| When | Read |
|---|---|
| The app has to keep data, and is a service | A Postgres database |
| The person wants the app at a hostname they own | A custom domain |
After a first successful deploy you may offer the custom domain once, in one sentence. Propose a database when the code needs one. Do neither until the person agrees.
7. What not to promise
Section titled “7. What not to promise”- Apps run in the EU (Prague). There is no other location.
- An idle service sleeps, and the first request after a nap waits for it to wake, unless it is always-on. Always-on (
tori_always_on,tori always-on) is available on plans that include it, and a switch-on can be refused (the plan’s count, the region’s capacity), in which case the tool says why and nothing changes. Switch it on only when the person asks. - The MCP interface is a preview. What is available is the list to quote from.
- In the upcoming CLI and MCP release,
npx tori.host whoamiandtori_accountwill report a billing hold. If you see one, tell the person before deploying. Share what the hold already restricts and the date of the next change, if reported. Direct them to Settings → Billing in the console and leave payment and any other billing action to them. - Quote the plan’s limits only from what
npx tori.host whoamior thetori_accounttool printed for this account (fromtori.host0.21.2), never from memory or from a pricing page. They are limits, not usage: neither counts the apps or domains the account already holds, so “the plan allows 10” does not mean there is room for one more. When they say the limits are not available, say that you do not know them. A refusal still has the last word: if the API refuses with a limit, relay that sentence, even if it disagrees with whatwhoamiprinted.