# Cortad commands and flags

The Cortad commands you type in a shell, the flags that change how your app connects, and the two commands that make it part of your repository.

The commands below run in a shell, in your app's folder. `status` prints what the [`status`](https://cortad.com/docs/tools.md#status) tool gives when asked about `repository`.

## Connect your app

```sh
npx cortad@2.1.1 <code> -- npm run dev
```

`<code>` is the code in the prompt you copy on **Set up Cortad**. A folder that connected before reconnects without one. After `--` goes the command that starts your app in any language, such as `python app.py`, `go run .` or `dotnet run`.

| Flag | What it does |
| --- | --- |
| `-- <command>` | How your app starts. Everything after `--` is run as you typed it. |
| `--start "<command>"` | The same, as one quoted flag. |
| `--port 3000` | Uses an app that is already running, as it is. Cortad sees its replies and not the calls it makes to its model. |
| `--port 3000 -- <command>` | Starts an app in a container and watches the port it publishes. The model setting to give the container is printed. |
| `--verbose` | Prints your app's own output. |
| `--explain` | Lists every file a connect would send and why each was picked. It connects to nothing and writes nothing. |
| `--samples` | Opens your app's search and vector stores for samples of their content, so simulated users ask about it. Without it, none is opened. |
| `--agent-picks` | Sends no file by itself. Your coding agent picks the files and sends them with `send`, below. |

## Choose the files yourself

```sh
npx cortad@2.1.1 <code> --agent-picks -- npm run dev
npx cortad@2.1.1 send src/agent.ts src/prompts/system.ts
npx cortad@2.1.1 send --yes src/agent.ts src/prompts/system.ts
```

`send` shows the files that would go and which of Cortad's needs each one covers: prompts, model calls, the routes that reach them, tools and evals. `send --yes` sends them, and a later `send` adds to the set. Env files, keys, files git ignores and data files are refused.

## Run and read from a shell

```sh
npx cortad@2.1.1 status
npx cortad@2.1.1 test "<what you built>"
npx cortad@2.1.1 behavior
npx cortad@2.1.1 verify <findingId>
npx cortad@2.1.1 wait
```

- `status rules`, `status journeys` and `status endpoints` list in full the rules, journeys and endpoints Cortad found in your code.
- `test --conversations 10 "<what you built>"` starts an automated audit capped at ten conversations. `test --features "POST /api/chat"` records which AI features to test and starts nothing.
- `behavior` prints how your app behaved in the latest automated audit, persona by persona. `behavior <audit id or commit>` reads another one, and `--persona "<name>"`, `--against previous` and `--history` do what the [`behavior`](https://cortad.com/docs/tools.md#behavior) tool's `persona`, `against` and `history` do.
- `verify` takes the id `behavior` names, such as `finding:1`.
- `wait` returns when the next automated audit or verify ends, with what it found. A coding agent starts it in the background so the end of an automated audit wakes it.

An automated audit needs your app up. If nothing on your machine is running it, the command starts it with the start command it kept, and stops it ten minutes after the last automated audit.

## Make Cortad part of your repository

This step is optional.

```sh
npx cortad@2.1.1 stick
npx cortad@2.1.1 unstick
```

`stick` adds one line to `AGENTS.md`, `CLAUDE.md`, the Cursor rules and `.github/copilot-instructions.md`, and two hooks for Claude Code and Codex. The first hook names the prompt and tool files you changed since the last automated audit, and both tell your coding agent what is new since its last call, such as an automated audit that ended.

`unstick` takes them out. Both commands print every file they change. Neither touches git.
