--- title: CLI Reference description: Command syntax, subcommands, options, providers, selectors, and examples. --- This page documents the public CLI surface. The source of truth is `src/cli/`; run `sivtr --help` and `sivtr --help` for installed-version help. ## Top-level ```bash sivtr [COMMAND] sivtr --all # with bare TTY: also select remote mounts on open ``` With no command: - **TTY** → multi-source workspace browser (Source / Sessions / Dialogues / Content). - **Piped stdin** → single-buffer browser (same as `sivtr pipe`). ## run ```bash sivtr run [ARGS...] ``` Runs a command, captures combined stdout/stderr, reports the exit status, saves history when enabled, and opens the captured output. ```bash sivtr run cargo test sivtr run git status --short ``` ## pipe ```bash sivtr pipe ``` Reads stdin and opens it. Piping directly to `sivtr` is equivalent: ```bash cargo build 2>&1 | sivtr ``` ## import ```bash sivtr import ``` Opens the current structured shell session log. Requires shell integration. ## init ```bash sivtr init ``` Supported targets: | Target | Purpose | | --- | --- | | `powershell` | Install Windows PowerShell hook | | `pwsh` | Alias for PowerShell integration | | `bash` | Install Bash hook | | `zsh` | Install Zsh hook | | `nushell` / `nu` | Install Nushell hook | | `tmux` | Install tmux picker binding | | `linux-shortcut` | Generate Linux desktop/terminal picker launcher | | `macos-shortcut` | Generate macOS Terminal/LaunchAgent picker launcher | ## copy ```bash sivtr copy [MODE] [SELECTOR] [OPTIONS] ``` Command-block modes: | Mode | Meaning | | --- | --- | | no mode | Copy input plus output | | `in` | Copy input | | `out` | Copy output | | `cmd` | Copy bare command | Aliases: | Alias | Expands to | | --- | --- | | `sivtr c` | `sivtr copy` | | `sivtr ci` | `sivtr copy in` | | `sivtr co` | `sivtr copy out` | | `sivtr cc` | `sivtr copy cmd` | Common options: | Option | Meaning | | --- | --- | | `--ansi` | Copy ANSI-decorated text when available | | `--pick` | Open the interactive picker | | `--print` | Print copied text after copying | | `--regex ` | Keep lines matching regex | | `--lines ` | Keep selected 1-based lines | Input-capable modes also support: | Option | Meaning | | --- | --- | | `--prompt ` | Rewrite the copied input prompt | Examples: ```bash sivtr copy sivtr copy 3 --print sivtr copy --prompt ":" sivtr copy in 2..4 sivtr copy out --pick --regex panic sivtr copy cmd --pick ``` ## copy agent provider sessions ```bash sivtr copy [MODE] [SELECTOR] [OPTIONS] ``` Providers come from the `AgentProvider` registry (not a hand-written CLI list): | Provider | Command | | --- | --- | | Codex | `sivtr copy codex` | | Claude Code | `sivtr copy claude` | | Cursor | `sivtr copy cursor` | | OpenCode | `sivtr copy opencode` | | OpenClaw | `sivtr copy openclaw` | | Hermes | `sivtr copy hermes` | | Grok | `sivtr copy grok` | | Pi | `sivtr copy pi` | Modes: | Mode | Meaning | | --- | --- | | no mode | Last completed user + assistant turn | | `in` | Last user message | | `out` | Last assistant reply | | `tool` | Last tool output | | `all` | Whole parsed session | Agent copy options include all common copy options plus: | Option | Meaning | | --- | --- | | `--session ` | Select the Nth newest selectable session, or match an id/id prefix | Examples: ```bash sivtr copy claude sivtr copy claude out --print sivtr copy cursor out --print sivtr copy hermes out --print sivtr copy grok out --print sivtr copy claude --session 2 sivtr copy codex 2..4 sivtr copy codex out --pick sivtr copy opencode all --lines 1:20 sivtr copy pi tool --regex error ``` ## diff ```bash sivtr diff [OPTIONS] ``` Compares two recent command blocks from the current shell session. Each selector must resolve to exactly one block. Content options: | Option | Meaning | | --- | --- | | `--output` | Compare output text. This is the default. | | `--block` | Compare input plus output | | `--input` | Compare input with prompt | | `--cmd` | Compare bare command text | View option: | Option | Meaning | | --- | --- | | `--side-by-side` | Show a two-column text view | Examples: ```bash sivtr diff 1 2 sivtr diff 3 1 --block sivtr diff 2 1 --side-by-side ``` ## search ```bash sivtr search [QUERY] [OPTIONS] ``` Searches captured terminal records and supported AI workspace sessions. The target chooses where to search; filters choose which records match. A plain-text positional `QUERY` (no regex) ranks the source by BM25 relevance and becomes the default sort; `--match` optionally bounds the set with a regex first. Targets: | Target | Meaning | | --- | --- | | `terminal[/[/[/p]]]` | Terminal command records | | `agent[/[/[/p]]]` | All registered AI/agent records | | `codex` / `claude` / `cursor` / `opencode` / `openclaw` / `grok` / `hermes` / `pi` / `qoder` `[/[/[/p]]]` | One provider's records | | `:` | Named remote or other local workspace origin, for example `desk:terminal` or `docs:codex/4` | Use `*` for wildcard path segments, for example `terminal/*/3` or `pi/*/*`. Origins come from `sivtr remote add ...` or local workspace names listed by `sivtr ws list`. Options: | Option | Meaning | | --- | --- | | `QUERY` | Plain-text search query; BM25 ranks the source by these terms (no regex). Default sort becomes `relevance`. | | `--match `, `-m ` | Case-insensitive regex that bounds the set before relevance ranking | | `--exclude `, `-v ` | Case-insensitive exclusion filter applied after matches are found | | `--in `, `-i ` | `content`, `title`, `session`, `input`, `output`, `command`, or `all`; default is `content` | | `--kind ` | Part kind filter: `prompt`, `command`, `user`, `assistant`, `tool`, `tool_call`, `tool_result`, `skill`, `thinking`, `output`, or `error` | | `--status ` | `success`, `failure`, or `unknown` | | `--exit-code ` | Exact terminal process exit code | | `--min-duration ` | Minimum command duration, e.g. `500ms`, `2s`, `1m` | | `--max-duration ` | Maximum command duration | | `--sort ` | `newest` (default), `relevance` (default with a `QUERY` or `--match`), `oldest`, `duration`, `duration-asc`, `exit-code`, or `exit-code-asc` | | `--cwd ` | Workspace directory used to resolve records | | `--since