# Search

> Find local traces from the terminal.

`traces search` runs against your local database of sessions, not against the server. For server-side full-text search use the web search at `https://adtraces.adfactory.app/search` or the [MCP tools](/docs/mcp).

```bash
traces search sidebar
traces search 'timeout|connection refused' --result-level event
traces search 'build failed' --event-type tool_result --tool bash --result-level event
traces show <trace-id> --around-event 63 --before 3 --after 8
```

## How matching works

- Patterns are case-insensitive regular expressions. Use `--literal` for a fixed substring.
- By default the CLI searches trace metadata and the event types `user_message`, `agent_text` and `error`.
- Tool calls, tool results and thinking are excluded unless you ask for them with `--event-type`.

## A cheap workflow for agents

```bash
traces list --dir . --limit 20
traces search migration --dir . --since 7d --limit 20
traces show <trace-id> --event-type user_message,agent_text --offset 1 --limit 40
```

`traces search-instructions` prints compact guidance that keeps context usage low.
