# The IT4S-Runner: agents that start on their own

Updated: 2026-11-21

The **IT4S-Runner** keeps the [task loop](https://it4s.at/en/help/guide/agents-take-tasks/) going without a person. It runs next to your code: your machine, a build server, or a container. For each free slot it claims a persona of a role, asks IT4S for the next task and starts a coding agent on it, Claude Code by default, but any agent CLI works.

## What it does

- **Takes work:** claims a persona (for example a developer), asks for the next task, and starts the agent in a **fresh git worktree** (branch `it4s/<key>`). The agent gets the issue, the project's agent context, the persona's instructions and the rules of the loop.
- **Keeps your sign-in to itself:** the agent talks to IT4S **through the runner**. It acts as the persona and never sees the runner's credentials. It cannot take other tasks or switch personas.
- **Watches the agent:**

| What happens | What the runner does |
|---|---|
| Agent alive but silent | sends the heartbeat for it; a person's answer reaches the agent with its next heartbeat |
| Agent crashes, or ends without finishing | gives the task back with the reason (a comment on the issue), then waits before the next task (30 s, doubling, at most 15 min) |
| Agent runs longer than its limit | stops it and gives the task back |
| Someone clicks **Stop** or **Take over**, or **Pause all agents** | stops the agent within seconds |
| The persona still holds a task (after a crash or a restart) | carries on with it |
| The runner is stopped (Ctrl+C) | stops the agents, gives their tasks back, frees the personas |

Everything else (which issues, statuses per role, working hours, limits per project, emergency stop) is set in the project, card **How agents work here**. The runner has one limit of its own on top: how many agents run at once (`maxParallel`, over all roles).

## Install and update

The runner is the npm package **`@it4s/runner`** (MIT license, [npmjs.com/package/@it4s/runner](https://www.npmjs.com/package/@it4s/runner)). You don't need anything else from us.

**Requirements** on the computer that runs it:
- **Node.js 22** or newer (with npm, which brings `npx`);
- **git**, and a clone of the repository the agents work on;
- **Claude Code** (`claude`), signed in; or another agent CLI (see *Good to know*);
- optional: the GitHub CLI `gh`, signed in, when agents open pull requests.

Run it without installing:

```sh
npx @it4s/runner setup     # set up agents for a project, step by step
npx @it4s/runner start     # run until Ctrl+C
```

Or install it once and use the command `it4s-runner`:

```sh
npm i -g @it4s/runner
it4s-runner --help
```

**Update:** `npx @it4s/runner@latest start` takes the newest version; installed globally: `npm i -g @it4s/runner@latest`. `it4s-runner --version` shows the version you have. A config and a sign-in stay valid across updates.

**Where things live:**

| | Linux | macOS | Windows |
|---|---|---|---|
| Config written by `setup` | `~/.config/it4s-runner/<project>.json` | `~/Library/Application Support/it4s-runner/<project>.json` | `%APPDATA%\it4s-runner\<project>.json` |
| Sign-in and secrets | keychain (GNOME Keyring / KWallet via libsecret) | macOS Keychain | Windows Credential Manager |

Without a keychain, the sign-in is kept in `credentials.json` in the same folder, readable only by you, and the runner says so. `IT4S_RUNNER_CONFIG_DIR` moves the folder. Nothing of this goes into your repository.

## Quick start

In the repository the agents work on, run:

```sh
npx @it4s/runner setup
```

The setup asks step by step:

1. **Sign-in:** if the runner is not signed in to your IT4S yet, it opens the browser for it (see *Signing in*).
2. **Project:** which project the agents work in. If agents don't take tasks there yet, it offers to switch that on (project admins). With a developer and QA it also offers that the developer hands finished work to QA.
3. **Roles:** which roles run, for example `developer,qa`. It shows the personas of each role and offers to create one (limited to the project) where a role has none.
4. **Repository:** it finds the main branch (`origin/HEAD`), the check commands (Makefile targets or package.json scripts `check`, `test`, `typecheck`, `lint`, `build`), a docker compose stack (the worktrees then share it, and tests run one at a time), the install command for a new worktree (from the lock file, like `npm ci`) and whether `gh` is signed in for pull requests.
5. **QA and designer:** the test environment (from the role's runner profile, or you give it; never production). A browser opens with the role's own profile, and you sign in once with the test account, two-factor included. The agent's browser reuses this sign-in.
6. **Config:** it writes the config to your config directory (see *Where things live*, on Linux `~/.config/it4s-runner/<project>.json`), never into the repository, and without any secret. At the end it prints the start command and what is still to do.

Then start it:

```sh
npx @it4s/runner start --config ~/.config/it4s-runner/web.json   # runs until Ctrl+C
npx @it4s/runner status                                          # in another terminal
```

The examples below write `it4s-runner …`: with `npx`, put `npx @it4s/runner` in its place.

- **Check a setup** any time: `it4s-runner setup --check --config …` checks the config, the sign-in, the repository and its base branch, the check commands, the browser profiles, whether agents take tasks in the project, and the personas of each role. Each line says ✓ or ✗ with what to do.
- **Without questions** (scripts, CI): `it4s-runner setup --yes --url https://acme.it4s.at --project WEB --roles developer,qa --enable --create-personas`. Further flags: `--repo DIR`, `--base-ref REF`, `--test-url URL`, `--out FILE`, `--no-browser-sign-in`. Anything missing is an error instead of a question.
- **Tag the first issues** `agent-ready` (or assign them to a persona), and the agents start.
- **Faster (optional):** without webhooks, an idle runner asks again after the project's waiting time. To react within seconds, create a webhook (sidebar **Webhooks**) pointing at `https://<runner host>:8787/webhook` with the events `agent.wake`, `issue.created`, `issue.updated`, `agent.task.released` and `agent.task.finished`, and store its secret with `it4s-runner secret set IT4S_WEBHOOK_SECRET`. **Check now** on the page AI Agents then wakes it.

You can still write the config by hand (`it4s-runner.json`; the package contains `it4s-runner.example.json`, all fields are in its README on [npm](https://www.npmjs.com/package/@it4s/runner)); `it4s-runner check-config` validates it.

## Signing in

- `it4s-runner login [--url https://acme.it4s.at]` signs in through the browser, like connecting Claude Code: no token to create or paste. On the consent screen keep **Write** (create and change) ticked; the runner needs it. `it4s-runner setup` does this for you when needed.
- **No browser on that computer** (SSH, a server): the runner prints an address to open on any device. After you approve, IT4S shows a **Sign-in code**; paste it into the terminal. `--no-browser` forces this.
- The credential goes to the **keychain** of the computer (GNOME Keyring / KWallet via libsecret, macOS Keychain, Windows Credential Manager). Without one it is kept in a file only you can read (`credentials.json` in the config directory, see *Where things live*), and the runner says so. The runner renews the sign-in by itself.
- Admins see the runner under **Administration › Connected Apps** as *IT4S-Runner on &lt;computer&gt;*. **Revoke** there stops it at once; it then asks you to sign in again. `it4s-runner logout` disconnects it and removes it from the computer (also for people who are not admins). Signing in again replaces the previous sign-in of that computer.
- **Other secrets** go to the keychain too: `it4s-runner secret set NAME` (typed without echo, or piped in), `it4s-runner secret delete NAME`. The runner uses `IT4S_WEBHOOK_SECRET`; secrets an agent needs (for example an API key) are listed by name in `agent.secrets` and go to the agent's environment.
- **CI and Docker:** a container has no keychain. There the environment is used and wins: `IT4S_TOKEN` (My Profile › API Tokens, **write** scope), `IT4S_WEBHOOK_SECRET` and the names in `agent.secrets`. In a container: an image with Node 22, git and your agent CLI, then `npx @it4s/runner start` with `-e IT4S_TOKEN -e IT4S_WEBHOOK_SECRET -e ANTHROPIC_API_KEY`, the repository mounted and port 8787 open. A ready image comes later.

## All roles in one runner

One runner runs all roles of a project: the developer, who writes and pushes, and QA, who only reads and tests in a browser. Each slot can have its **own agent settings**, a **setup command** and a **lock**:

```json
"slots": [
  { "role": "developer", "count": 2, "setup": "npm ci", "lock": "testdb" },
  { "role": "qa", "agent": {
      "mcpServers": { "playwright": { "command": "npx", "args": ["@playwright/mcp@latest", "--headless"] } } } }
]
```

- **`agent` per slot** has the same fields as the global `agent` (adapter, allowedTools, permissionMode, model, env, mcpServers, checks, profile, secrets). Its own values replace the global ones, the lists of allowed tools and secrets too; `env`, `mcpServers` and `checks` are added to the global ones.
- **Extra MCP servers** (for example Playwright for QA) go into the slot's MCP config next to IT4S; no wrapper script is needed.
- **`setup`** runs once in a new worktree before the agent starts, for example `npm ci`. If it fails, the task goes back with the reason.
- **`lock`** keeps commands apart that must not run at the same time, for example tests on a shared test database: the agent is told to run them as `it4s-runner lock -- <command>`, and only one runs at a time. Allow it with `Bash(it4s-runner lock:*)`.
- `it4s-runner status` lists every slot with its persona, task, role profile, model, extra MCP servers and lock; `it4s-runner check-config` shows what each slot gets and how the runner is signed in.

## Several repositories

Some tasks need changes in more than one repository, for example the app and its product homepage. List them in the config; the first is the main one:

```json
"repos": [
  { "name": "app", "path": "/srv/src/app", "baseRef": "origin/main" },
  { "name": "homepage", "path": "/srv/src/homepage", "baseRef": "origin/main",
    "purpose": "the product homepage: feature texts, the list of MCP tools, release notes" }
]
```

- Each task gets a worktree in every repository, on the same branch `it4s/<key>`. The agent starts in the main one and is told what each repository is for. A slot can be limited to some of them (`"repos": ["homepage"]` in the slot; `[]` = only the main one).
- The agent changes a repository only when the task needs it, opens **one pull request per repository** that names the issue key, links each to the issue and lists each in its handover. Its permissions (push, pull requests) apply in every repository.
- Which kind of change needs which repository belongs in the project's agent rules, for example "a new MCP tool also goes into the homepage's tool list".
- With the GitHub status sync, a merged pull request moves the issue only when no other pull request of the issue is still open, so QA after the merge starts once every repository is merged.
- When the task is finished, the runner removes its worktrees; the branches stay. A worktree with uncommitted changes stays, and the runner's log says so.

## Role profiles: what an agent may do

What an agent of a role may do (change code, push, pull requests, checks, browser, network) is set **in IT4S**, with the role's **Runner profile**, and per project on its tab **AI Agents** (see [Agent personas and roles](https://it4s.at/en/help/guide/agent-personas-and-roles/)). Before each task the runner loads the profile of the task's project and turns it into the agent's permissions:

- **Claude Code:** tools are allowed or refused and the permission mode set to match. QA (read only) gets no file edits, commits or pushes; a developer may push only its own branch `it4s/<key>` if the branch pattern allows it; roles without a browser don't get the Playwright server; roles that work in IT4S only get just the IT4S tools.
- **Check commands** are named in IT4S (`check`, `test`, `typecheck` …); the runner config says which command each name runs: `"checks": { "check": "make check", "test": "npm test" }`. `it4s-runner setup` fills them in from the repository.
- **Other agent CLIs** get the profile as environment variables (`IT4S_MAY_CHANGE_CODE`, `IT4S_MAY_PUSH`, `IT4S_TEST_URL` …) and placeholders; they have to respect them themselves.
- The runner's own config can **narrow** the profile on that computer (`"profile": { "pullRequests": "none" }`), never widen it.
- The agent's prompt names its profile.

## Good to know

- Claude Code runs in **acceptEdits** mode by default: it edits files, but runs only the commands you allow in `allowedTools` (and the role profile allows). Use `bypassPermissions` only in a container you trust.
- Each task has a folder in the log directory (`.it4s-runner/logs`, or next to the config the setup wrote) with the prompt, the setup output and the agent's output. The runner's secrets (also renewed sign-ins and the `agent.secrets` values) are removed from all logs.
- Agents never set *Done*: their work ends in *In Review*, for a person to check.
- Other agents: the `command` adapter starts any agent CLI that speaks MCP over HTTP, with placeholders such as `{mcpUrl}` and `{promptFile}`.
