# `jadpo ai`

Show prompts, record, usage.

`show` prints what a prompt sends a model (area 21): its type, its file and its version, the first 8 hex characters of a SHA-256 over its two files, then the instructions as the system message, the conversation's turns, and the request as the user message. Placeholders are shown as the prompt's file writes them, each free-text one inside the tagged data block it is sent in. `record` asks the configured model the prompt once, with the values of its last `jadpo dev` call or a fixture's, and keeps the answer beside it as recordings/<prompt>/<name>.json for a test's recorded("<name>"), its plain values placeholders; never through a live connection. `usage` shows the tokens the app's calls used today and this month (UTC) and their estimated cost, by prompt and model, against the daily limit, from the counts `ai: { limits: }` keeps; never a prompt or an answer. Its database is the one its store's connection's setting gives, or a running jadpo dev's, or the one --url names.

```text
jadpo ai <action> [prompt]
```

## Arguments

- `action`: What to do: show, record or usage
- `prompt` (optional): The prompt's name, such as summarise_ticket

## Flags

- `--as <name>`: For record: the recording's name
- `--fixture <fixture>`: For record: a fixture to ask with
- `--url <url>`: For usage: the database it reads

## On every command

- `--json`: Print data for tools instead of text
- `--help`: Show every flag, with examples
- `--color <when>`: Choose when to use colour

`jadpo ai --json` writes one JSON document to standard output instead of text, with the same exit code. The document has `schemaVersion`, `command` (`"ai"`), `ok`, `data` (what the command produced, `null` when it failed) and `diagnostics` (each error with its `rule`, `reason`, `next` and `help`). A command that needs a terminal refuses `--json` and names the flags that do the same job.

## Examples

```text
# See what the summarise_ticket prompt sends
jadpo ai show summarise_ticket
# Print it as data for tools
jadpo ai show summarise_ticket --json
# Record the model's answer to the last jadpo dev call
jadpo ai record summarise_ticket --as long_thread
# See the tokens and cost models used today and this month
jadpo ai usage
```

## Errors

- [`cli.ai_arguments`](../errors/cli.ai_arguments.md): AI command has invalid arguments
- [`ai.usage_unavailable`](../errors/ai.usage_unavailable.md): AI usage's database couldn't be read
- [`recording.failed`](../errors/recording.failed.md): Sandbox or model gave no answer to record
- [`recording.refused`](../errors/recording.refused.md): Answer can't be recorded through this connection
- [`toolchain.project_not_found`](../errors/toolchain.project_not_found.md): Project could not be found
