Docs

tillie / CLI / tillie CLI guide for AI agents

tillie CLI guide for AI agents

The steps an AI agent (Claude Code, Codex, and others) follows when it installs the tillie CLI, gets it signed in, and uses it on a user’s behalf. The CLI must be installed on the computer the user works on, where the user’s own terminals can find it, and the user decides on the sign-in approval and on spending credits.

Check where you are running

An install stays only on the machine where the command ran. Before installing, work out where your commands run.

Where commands run Where the install stays What to do
A cloud session (Claude Code web session, Codex cloud task) The session’s remote VM or container Nothing is installed on the user’s computer. Hand the install command to the user to run in their own terminal
The user’s computer, inside a sandbox Only where the sandbox allows writes Follow Install outside the sandbox
The user’s computer, no sandbox The user’s computer Follow Install the tillie CLI as written

Cloud sessions run in a managed remote environment, not on the user’s computer. Each Claude Code cloud session is an isolated VM (Claude Code on the web), and a Codex cloud task runs in a container that checks out the repository (Cloud environments).

The tillie CLI has executables for macOS, Linux, and Windows (x64). If the user is on Windows, use the PowerShell install line (irm https://tillie.club/download/cli/install.ps1 | iex).

Install outside the sandbox

A local agent’s sandbox limits where it can write and what it can reach on the network.

  • Claude Code: The sandbox is off by default; turn it on with /sandbox. When it is on, commands can write only to the working directory, a temporary directory, and directories you added, and network traffic goes only to allowed domains (Sandboxing).
  • Codex: In the default mode (workspace-write), writes are limited to the workspace (the current directory and temporary directories) and network access is off. Commands that write outside the workspace or need the network ask for approval (Agent approvals & security).

So an install run inside the sandbox is either blocked when it downloads or writes to ~/.local/bin, or, if it is not blocked, it ends up somewhere the user’s other terminals cannot find.

Don’t:

  • Don’t point TILLIE_INSTALL_DIR at the working directory or a temporary directory to get past the sandbox. That executable is not on the PATH of the user’s terminals.

Do:

  • Show the install command to the user and have them run it in their own terminal.

    curl -fsSL https://tillie.club/download/cli/install.sh | sh
  • In Claude Code, the user can run a command directly by prefixing it with ! in the prompt. A command the user types this way runs outside the sandbox even when sandboxing is on (except in strict sandbox mode) (Interactive mode).

    ! curl -fsSL https://tillie.club/download/cli/install.sh | sh
  • If the user is on Windows, hand them the PowerShell line to run in a PowerShell window. A command prefixed with ! runs in that Claude Code session’s shell — if that shell is Git Bash, install.sh shows this line and stops, so have the user run it in PowerShell.

    irm https://tillie.club/download/cli/install.ps1 | iex
  • If you must run it yourself, get the user’s approval to run it outside the sandbox through that tool’s approval flow.

Verify the install

After installing, check that the executable is visible from the user’s shell.

command -v tillie
tillie --version
  • With the install script, it should print ~/.local/bin/tillie.
  • If command -v tillie prints nothing, the install directory is not on PATH. Have the user add the PATH line the install script printed to their shell startup file (~/.zshrc or ~/.bashrc).
  • Claude Code’s Bash tool runs each command in a separate process, so an export PATH=… in one command does not carry over to the next. Shell startup files are read when the session starts (Tools reference). In the current session, run it by its full path (~/.local/bin/tillie).

If the user is on Windows, check in PowerShell.

Get-Command tillie
tillie --version
  • It should show %LOCALAPPDATA%\Programs\tillie-cli\tillie.exe.

  • The install script adds that folder to the user PATH, but a session started before the install does not see it. In the current session, run it by its full path.

    & "$env:LOCALAPPDATA\Programs\tillie-cli\tillie.exe" --version

Hand the sign-in to the user

tillie login opens the dillie approval screen in a browser, and the user chooses the workspace and approves. It is the same dillie account as tillie POS.

  • Have the user run tillie login in their own terminal.
  • Where no browser can open, run tillie login --device and pass the printed URL and code to the user as they are. The user enters the code in a browser on another device.
  • Don’t take the user’s password or verification code to sign in for them.

The session is stored on the machine that signed in, at ~/.config/tillie/cli-tillie/credentials. A session signed in inside a sandbox or a cloud session does not reach the user’s computer, and a session signed in on the user’s computer does not reach a cloud session.

Check whether you are signed in like this. If you are not, it exits with code 1.

tillie --agent whoami

Use the CLI as an agent

  • Add --agent to every command. A successful response is JSON on stdout, errors go to stderr as { "error": { … } }, and update notices go to stderr as { "advisory": { … } }.
  • At the start of each session, read the commands, options, the output, list, store and credit conventions, and the CLI version with tillie --agent describe. It is large, so read only what you need, e.g. --fields conventions,examples. The human-readable list is in tillie CLI commands.
  • Don’t guess store ids. First read the stores you can work with and the data you can read for each store (reads) with tillie --agent stores list.
  • Choose the workspace with tillie workspace list and tillie workspace use <tenantId>. If the tillie CLI has not been approved in that workspace, have the user run tillie login --workspace <tenantId>.

Handle commands that use credits

tillie menu photos generate spends AI credits. Run it only when the user asked for photos. One run makes them and adds them to the gallery — there is no separate quote step and no credit count to pass. A local --source file is uploaded to the server.

tillie --agent menu photos generate <itemId> --source ./real.jpg

The credits used are in the result’s settlement, and tillie --agent menu photos status <requestId> shows them too. If the run stopped before you got the result, run the --request-id command from the error to pick up the same request — do not start a new one.

Register a purchase ledger as materials

When you register the items of a purchase ledger as materials, check the shared catalog first so each company does not create the same product again.

  1. Turn the ledger into a JSON array of {"name","barcode"} rows and check them. They are sent 100 rows at a time.

    tillie --agent menu catalog resolve --data-file rows.json
  2. Each row’s result decides what to do. Follow only the first case that applies, in this order — the barcode verdict comes before name matches.

    • Barcode TENANT or INHERITED: the item already exists (the item in barcode.lookup) — skip it.
    • Barcode PLATFORM: import that shared item.
    • Barcode TAKEN_OUT_OF_SCOPE: the company has the item but the user cannot see it — hand it to the user.
    • Barcode NONE, or a row without a barcode: go by name. Any tenant_items means the item already exists. A platform_items entry with projected_item_id is a copy you already imported (that id) — importing again is a 409. A platform_items entry without projected_item_id: import that shared item. No match at all: create the material yourself.

    Import with tillie --agent menu catalog import <platformItemId> --measure-unit <G|ML|EA> — choose the unit per material (weight G, volume ML, count EA) from the candidate’s material profile or packaging or the ledger’s size, and ask the user if it is unclear. Create with tillie --agent menu items create --data-file item.json (["MATERIAL"] in item.roles, measure_unit and yield_rate in material_profile, and the ledger’s barcode in barcodes of a packagings[] entry so the next ledger finds it by barcode). If the user only has store-level permission, create it as that store’s material with --store <storeId>; hand company-wide materials to a user who has permission.

    Group lines that point to the same product — the same barcode, or the same shared item (a unit and a case barcode can lead to one platformItemId) — and write once (keep each line’s packaging and quantity separate), reusing the item id the first write returns for the rest — the check reflects the catalog before any write, so writing each line separately creates the same material twice or makes the second import a 409. Lines that share only a name may be different products, so confirm with the user before grouping them.

    A name-only match means the same name, not the same product — compare maker and size, and ask the user before skipping or importing when it is unclear. Also check that an existing item is usable (tillie --agent menu items get <itemId>): it is not archived (ARCHIVED), it has a stock role and material profile, and its owner (the company, the store’s brand, or the ledger’s store) lets the ledger’s store use it. Otherwise hand it to the user.

  3. Company-wide materials you created can be proposed as shared items (store- or brand-owned items cannot) (tillie --agent menu catalog promote <itemId>). One ledger can turn into hundreds of proposals, so ask the user once before proposing and send only the approved ones together. A proposal becomes shared only after the operators approve it. An item already waiting for review returns already_pending.

A name that does not match means no item has that name, not that the product does not exist — names in a language without a translation do not match.

Troubleshooting

tillie: command not found in the user’s terminal after installing

The install ran inside a sandbox or a cloud session, or the install directory is not on PATH. In the user’s terminal, check whether the file exists with ls ~/.local/bin/tillie. On Windows, check in PowerShell with Test-Path "$env:LOCALAPPDATA\Programs\tillie-cli\tillie.exe". If it does not exist, have the user install again from their own terminal.

The download fails during install

The sandbox is blocking the network. Hand the install command to the user.

Not signed in. Run `tillie login`.

There is no session on this machine. Have the user run tillie login.

Store <storeId> is not visible to you.

The store is outside the user’s store assignments. Use only the stores from tillie --agent stores list.