# swarmops check runs

> Release: 0.13.0 · Last changed: 2026-11-30 · Source: https://github.com/KeiaiLab/SwarmOps/blob/stable/docs/reference/commands/check-runs.md

List the run lines of a workspace's or a directory's checks, newest first.

Each check a run of check run reaches leaves one run line on the host that ran it: its name, run, stage and tree, how long it waited and ran, how it ended and, on Linux, its sampled peak memory. This reads the lines of the workspace (--ws, --ws-path, else the one around the working directory) from its .swarmws/check-runs/, or those beside the runs of the directory --dir names, or the lines in the directory --run-lines names, else SWARMOPS\_CHECK\_RUN\_LINES\_DIR, whatever wrote them there. It gives those that match every filter given (--check and --outcome may be given several times), newest first by the time each check started, at most --limit of them, with a cursor when more match: pass it back as --cursor, with the same filters, for the page after. A line that does not read is passed over and counted in skipped. The lines are diagnostics, appended unsynced: nothing decides from them. Reads only: no identity, no lock, nothing written, no store operation.

--selection\[=WHICH\] keeps the lines of shadow runs (check run --shadow) and counts them: WHICH is all (the default), would\_skip (those the plan would have skipped) or misses (those of them that failed, timed out, or could not start for their program or directory). The answer's selection holds the counts of every shadow line the other filters take, whatever WHICH, the cursor and the limit are, in total and for each check (the 1,000 smallest names, the rest counted in checks\_omitted): lines read, not distinct keys.

```yaml
title: "swarmops check runs"
description: "List the run lines of a workspace's or a directory's checks, newest first."
group: "checks"
since: "0.13.0"
mutates: false
identity_required: false
mcp_tool: "check_runs"
envelope_op: "check_runs"
exit_codes: [0, 2]
errors: [E_INVALID_ARG]
syntax: "swarmops check runs [OPTIONS]"
```

## Syntax

```text
swarmops check runs [OPTIONS]
```

## Required arguments

None.

## Optional arguments

The command also takes the [global options](../cli.md#global-options).

### `--ws`

Syntax: `--ws <NAME>`.

The workspace, by its name in the store's registry (default: the one around the working directory).

### `--ws-path`

Syntax: `--ws-path <DIR>`.

The workspace's directory.

### `--dir`

Syntax: `--dir <DIR>`.

Read the lines beside the runs of the checks of DIR on this host.

### `--run-lines`

Syntax: `--run-lines <DIR>`.

Read the lines in DIR, whatever run wrote them there.

### `--check`

Syntax: `--check <NAME>...`.

Only the lines of this check; repeatable.

### `--tree`

Syntax: `--tree <TREE>`.

Only the lines of the tree whose id starts with these 12 to 64 hex digits.

### `--outcome`

Syntax: `--outcome <OUTCOME>...`.

Only the lines that ended this way; repeatable. Values: `passed`: It exited 0; `failed`: It exited with another code, or a signal ended it; `timed_out`: It ran past its timeout; `cancelled`: A signal stopped the run while it ran; `not_started`: Its directory is missing, or its program did not start.

### `--run`

Syntax: `--run <RUN>`.

Only the lines of this run, by its id.

### `--since`

Syntax: `--since <MS>`.

Only the checks that started at or after this time, in Unix milliseconds.

### `--until`

Syntax: `--until <MS>`.

Only the checks that started before this time, in Unix milliseconds.

### `--selection`

Syntax: `--selection [<WHICH>]`.

List the lines of shadow runs only and count them: all (the default), would\_skip, misses. Values: `all`: Every line of a shadow run; `would_skip`: The lines whose plan would have skipped the check; `misses`: The lines that showed the plan wrong.

### `--limit`

Syntax: `-n, --limit <N>`.
Default: `100`.

The most lines to list, 1 to 1,000.

### `--cursor`

Syntax: `--cursor <CURSOR>`.

Resume a list: the previous page's cursor, exactly as it was returned.

## Examples

### CLI

```sh
swarmops check runs --run-lines [tmp]/lines --outcome passed -n 2
```

```json
{
  "ok": true,
  "op": "check_runs",
  "api": 1,
  "result": {
    "vouched": true,
    "source": "run_lines",
    "dir": "[tmp]/lines",
    "runs": [
      {
        "at": "[at]",
        "run": "0193f1e2-0000-7000-8000-0000000000a3",
        "check": "unit",
        "attempt": 1,
        "stage": "manual",
        "vouched": true,
        "definition_digest": "[id1]",
        "wait_ms": 3000,
        "duration_ms": "[duration_ms]",
        "outcome": "passed",
        "exit_code": 0,
        "run_dir": "/runs/5f2c/0193f1e2-0000-7000-8000-0000000000a3"
      },
      {
        "at": "[at]",
        "run": "0193f1e2-0000-7000-8000-0000000000a3",
        "check": "lint",
        "attempt": 1,
        "stage": "manual",
        "vouched": true,
        "definition_digest": "[id2]",
        "wait_ms": 10,
        "duration_ms": "[duration_ms]",
        "outcome": "passed",
        "exit_code": 0,
        "run_dir": "/runs/5f2c/0193f1e2-0000-7000-8000-0000000000a3"
      }
    ],
    "cursor": "r1.1700000200010.0193f1e2-0000-7000-8000-0000000000a3.1.lint",
    "scanned": 17,
    "skipped": 3
  },
  "meta": {
    "elapsed_ms": "[elapsed_ms]",
    "resolved": {},
    "auth": "trust"
  }
}
```

Exit code 0. Recorded by the CLI tests. A name in square brackets, such as `[tmp]` or `[c1]`, stands for what differs from run to run: the test's temporary directory, an id, a time.

### MCP

No recorded example yet.

## Details

`check runs` lists the run lines of a workspace's or a directory's checks, newest first: what
ran lately, how long each check waited and ran, and how it ended. It reads only: no identity, no
lock, no store operation, and it writes nothing.

### What a run line is

Each check a run of [`check run`](../commands/check-run.md) reaches appends one line of
diagnostics, a JSON object, to `run-lines.jsonl` on the host that ran it; that page has the keys,
where the file is and how it rotates. A line is not a record of the store: the file is not
synced, anything that can write the directory can write it, and nothing decides from it. No gate
and no land reads a run line, and a line says nothing a later check may rest on. From M33-1 the
store's own run records are to be what this command reads; `source` says which it read, and is
`run_lines` today.

### Which lines

- `check runs` with `--ws NAME`, `--ws-path DIR`, or the workspace around the working directory:
  the lines in that workspace's `.swarmws/check-runs/`. The workspace is found as the `ws`
  commands find it, with no store opened. `vouched` is `false`.
- `check runs --dir DIR`: the lines beside the runs of `DIR`, below the runs root, as `check run
  --dir` keeps them. `vouched` is `true`, and the envelope has no `meta.repo`.
- `--run-lines DIR`, else `SWARMOPS_CHECK_RUN_LINES_DIR` (absolute; else `E_INVALID_ARG`,
  `details.reason: run_lines_dir`): the lines in that directory, whatever run wrote them there,
  of every directory and workspace that sent its lines to it. `vouched` is `true`. Something
  there that is no directory is `run_lines_dir` too.

`dir` names the directory read, absolute. Both files there are read, `run-lines.1.jsonl` and
`run-lines.jsonl`, each opened before either is read and never through a symbolic link. A file
that is not there holds no line: a workspace or directory that has run nothing answers an empty
page, exit 0. A file that does not open, or is anything but a regular file, is `E_IO` with
`details.path`.

### Filters

A line is listed when it matches every filter given.

| Flag | Request | Matches | Refused (`E_INVALID_ARG`, `details.reason`) |
| --- | --- | --- | --- |
| `--check NAME`, repeatable | `checks` | A line whose check is one of them. | `check`: not a check's name. |
| `--tree TREE` | `tree` | A line whose tree starts with these 12 to 64 lowercase hex digits. A line of the directory form, which has no tree, never matches. | `tree` |
| `--outcome OUTCOME`, repeatable | `outcomes` | A line that ended as one of `passed`, `failed`, `timed_out`, `cancelled`, `not_started`. | The command line takes no other word; the tool refuses `not_run` and `skipped`, which leave no line, with `outcome`. |
| `--run RUN` | `run` | The lines of that run. | `run`: not a run's id. |
| `--since MS`, `--until MS` | `since`, `until` | A line whose check started at or after `since` and before `until`, in Unix milliseconds. | `time`: `since` after `until`. |

### Shadow lines

`--selection[=WHICH]` keeps only the lines of shadow runs (`check run --shadow`) and counts them.
`WHICH` is `all` (the default when the flag has no value), `would_skip` (the lines whose plan
would have skipped the check) or `misses` (those that showed the plan wrong: the check failed or
timed out, or did not start for its program or its directory; the rule is
[`check run`'s](../commands/check-run.md#shadow-selection)). The answer gains `selection`:

```json
{"lines": 412, "would_skip": 96, "misses": 1,
 "checks": [{"check": "site-check", "lines": 103, "would_skip": 80, "misses": 1}],
 "checks_omitted": 0}
```

- The counts are over every shadow line the other filters take (`--check`, `--tree`,
  `--outcome`, `--run`, `--since`, `--until`), whatever `WHICH`, the cursor and the limit are, so
  every page of one listing gives the same counts.
- They count lines read, not distinct keys: a key the two files both hold counts twice, so `lines`
  can exceed what the pages list.
- `checks` holds the 1,000 bytewise smallest names, sorted; the lines of the others are counted
  in `checks_omitted`. The answer is the same in any order of the lines. Memory stays the page
  and that map.
- `plan`, `plan_reason` and `not_started` of a line are the words its writer wrote: a word a later
  release added (`reused`, a new reason) still reads, counts in `lines`, and is no would-be skip.
- The lines are diagnostics, unsynced: nothing decides from them. The number of lands with no
  miss is not read from them; the run records of M33-1 are to carry it.

### Order, pages and the cursor

Lines come newest first by when each check started (`at`), then by run, check and attempt: the
order is the lines' own, not the files', so lines that several runs appended at once, and a
rotation, change no page. Two lines of the same check, run, attempt and time are listed once.

A page holds at most `--limit` lines (`-n`; 1 to 1,000, 100 by default; another is
`details.reason: limit`). When more lines match, the page carries a `cursor`: give it back as
`--cursor`, with the same filters, for the page after. A page with no `cursor` is the last. Pass
a cursor back as it was returned and do not build one: it names a place in the order, not a
position in a file. Lines appended since the first page appear only on a new first page; lines
rotated away are no longer listed; a later page repeats nothing and loses nothing that is still
kept. A cursor pins no filter: with other filters it goes on from the same place under them. One
that no page gave is `details.reason: cursor`.

### Lines that do not read

A line longer than 4 KiB, one that is not UTF-8 or not JSON, one that is not a run line or whose
values a run does not write (a run that is no id, a name that is no check's, a tree that is not
64 hex digits, `not_run` or `skipped`, a run directory that is relative or past 1,024 bytes), and a last line
with no line end (a writer in the middle of its append) are passed over and counted in
`skipped`. `scanned` counts every line read, matching or not.

### Bounds

Each page reads both files whole, at most 128 MiB, as a stream: memory holds one line and the
page, never a file. How long a page takes on full files is not measured.

### The MCP tool

`swarmops mcp` serves the workspace form as the tool `check_runs`, whose arguments are
`CheckRunsReq` (`workspace`, `checks`, `tree`, `outcomes`, `run`, `since`, `until`,
`selection`, `limit`, `cursor`) and whose result is the command's. It reads the directory the server's
`SWARMOPS_CHECK_RUN_LINES_DIR` names, else the workspace's own state; there is no directory form
there.

## Return information

`result` is a `CheckRunsResp` (`swarmops schema CheckRunsResp` prints its JSON Schema).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cursor` | `string or null` | no | The cursor of the next page; omitted when no more lines match. |
| `dir` | `string` | yes | The directory the lines were read from, on this host, absolute. |
| `runs` | `array of CheckRunLine` | yes | The page: the lines that match, newest first, by the time each check started. |
| `scanned` | `integer` | yes | The lines read from the files, matching or not. |
| `selection` | `CheckSelectionOut or null` | no | The counts of the shadow lines, when `selection` was asked. Omitted otherwise. |
| `skipped` | `integer` | no | The lines among them that did not read as a run line, each passed over. Omitted when 0. |
| `source` | `CheckRunsSource` | yes | What the lines were read from. |
| `vouched` | `boolean` | yes | Whether only the caller stands behind where the lines were read from: `true` for a directory's lines (`check runs --dir`) and for a directory the caller named; `false` for a workspace's own state. |

Envelope `op`: `check_runs`.

Exit codes:

- `0`: Success.
- `2`: The request or the command line is malformed.

## Errors

- [`E_INVALID_ARG`](../errors.md#e_invalid_arg) (exit 2): A malformed argument or request, including a command-line usage error.

Any command that opens a store may also fail with a store error, such as [`E_NOT_A_REPO`](../errors.md#e_not_a_repo), [`E_IO`](../errors.md#e_io) or [`E_STORE_CORRUPT`](../errors.md#e_store_corrupt); a command line the grammar refuses is [`E_INVALID_ARG`](../errors.md#e_invalid_arg) (exit 2).

## See also

- [`swarmops check list`](check-list.md)
- [`swarmops check lint`](check-lint.md)
- [`swarmops check plan`](check-plan.md)
- [`swarmops check run`](check-run.md)
- [`swarmops check log`](check-log.md)
- [CLI reference](../cli.md)
- [Error codes](../errors.md)
