> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cerulion.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Inspect topics

> Discover and watch live topics, open the TUI, and inspect recorded trace bags.

<Frame>
  <img src="https://mintcdn.com/cerulion-5327fd47/lTRLJjqSsKCVFhMl/images/pub-sub-hero.webp?fit=max&auto=format&n=lTRLJjqSsKCVFhMl&q=85&s=16aede6d730bcd220f891748695f58c3" alt="The Cerulion lion at a DJ-style control panel with LIVE camera icons — broadcasting topics" width="1200" height="675" data-path="images/pub-sub-hero.webp" />
</Frame>

While a graph runs, every wired port becomes a topic you can observe. This guide covers listing and watching live topics, the interactive dashboard, and reading trace bag files after a run.

<Info>
  The `topic` commands use iceoryx2 service discovery, so they work from any
  directory, no workspace required. Run them in a second terminal while a graph
  is running.
</Info>

## List and inspect live topics

`cerulion topic list` enumerates active topics, sorted by name.

```bash theme={null}
cerulion topic list
```

```text theme={null}
TOPIC
perception/camera/image
perception/detector/detections
```

If nothing is publishing, it prints `No active topics.`

`cerulion topic info <topic>` prints details for a single topic:

```bash theme={null}
cerulion topic info perception/camera/image
```

## Watch messages with echo

`cerulion topic echo <topic>` subscribes and prints each message until you press Ctrl+C.

```bash theme={null}
cerulion topic echo perception/camera/image
```

Echo pretty-prints `std_msgs/String` and `sensor_msgs/Image` messages (identified by their schema hash). For any other schema, it prints a hex preview of the payload.

## Measure publish rate

`cerulion topic hz <topic>` measures how often a topic publishes, until Ctrl+C.

```bash theme={null}
cerulion topic hz perception/camera/image
```

<Check>
  For the periodic camera created with `--policy period_ms=33`, `topic hz`
  should report roughly 30 Hz.
</Check>

## Open the interactive dashboard

`cerulion tui` launches an interactive terminal dashboard. Logging is suppressed while the TUI is open.

```bash theme={null}
cerulion tui
```

## Inspect recorded traces

`cerulion trace inspect <dir>` reads `trace_*.jsonl` bag files from a directory (in lexicographic order) and prints one line per record:

```text theme={null}
<topic> seq=<N> t=<ts>ns schema=0x<HASH>
```

| Flag               | Value   | Effect                                  |
| ------------------ | ------- | --------------------------------------- |
| `-t` / `--filter`  | `TOPIC` | Show only records for this exact topic. |
| `-n` / `--limit`   | `N`     | Print at most N records.                |
| `-r` / `--reverse` | None    | Reverse order (most recent first).      |

```bash theme={null}
cerulion trace inspect ./traces -t perception/camera/image -n 20 -r
```

<Info>
  Tracing is built into the runtime: every graph run automatically produces
  `trace_*.jsonl` bag files via the publish trace, so there's nothing extra to
  start or configure. `cerulion trace inspect` reads those bags afterward.
</Info>

## Clean up stale services

iceoryx2 keeps on-disk bookkeeping for each node. When a graph's topology changes between runs, stale entries from dead nodes can cause discovery errors.

`cerulion clean` removes bookkeeping for **dead** nodes only; live sibling processes are left untouched. It prints cleanup counts and per-cause remediation.

```bash theme={null}
cerulion clean
```

<Warning>
  Run `cerulion clean` if you rewire a graph and then see stale-service errors on
  the next `graph run`. It will not disturb a graph that is currently running.
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Wire and run a graph" icon="diagram-project" href="/cerulion/guides/wire-and-run-a-graph" color="#0080FF">
    Produce the topics you inspect here.
  </Card>

  <Card title="Messages and schemas" icon="message" href="/cerulion/guides/messages-and-schemas" color="#0080FF">
    Understand the message shapes that echo prints.
  </Card>
</CardGroup>
