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

# Search in the CLI

> Search past agent work or indexed source code from the Entire CLI.

## Run Search

First, [log in to Entire](/cli-reference/login):

```shell theme={null}
entire login
```

Run Search from a Git repository:

```shell theme={null}
entire search
```

By default, the CLI searches the current repository. Running the command without a query opens the interactive search.

Search reads pushed content from Entire's indexes. It does not search uncommitted changes or commits that exist only in your local clone. See [What Is Indexed and When](/guides/search/what-is-indexed).

## Enter a Query

The example queries below come from the indexed [Entire CLI repository](https://entire.io/gh/entireio/cli). They show how Search behaves, and you need access to that repository to reproduce them.

### Find Past Work

To find related checkpoints, sessions, and commits, enter a short phrase or ask a natural-language question:

```shell Short phrase example theme={null}
entire search "history import when enabling Entire"
```

```shell Natural-language question example theme={null}
entire search "how did we decide to make history import explicit when enabling Entire?"
```

Semantic search matches meaning and keywords, so describe what you are looking for rather than giving an instruction. See [Find Past Work](/guides/search/search-in-entire-io#find-past-work) for how wording changes the match.

### Find Text in Source Code

Add `--code` to find literal text in indexed source files:

```shell Literal text example theme={null}
entire search --code "import-history"
```

## Review Results

Interactive search runs the query against history and source code. Enter a query, press Enter, and use the number keys to move between result types:

* `1`: **Commits**, history results
* `2`: **Sessions**, history results
* `3`: **Code**, literal matches grouped by file

Search folds checkpoint matches into their owning sessions. You can still open a checkpoint directly by ID:

```shell theme={null}
entire checkpoint explain CHECKPOINT_ID
```

For a checkpoint from another GitHub repository, add `--repo OWNER/REPO` and use the full checkpoint ID.

Use `Up` and `Down` or `k` and `j` to move through results, and press `Enter` to open the selected result. Press `/` to edit the query, and use `n` and `p` or `Right` and `Left` to change pages. In a detail view, press `Esc` to return to the results. From the results, `Esc` or `q` closes Search.

## Filter Results

Filter past-work results by author, branch, or date. For example:

```shell theme={null}
entire search "history import when enabling Entire" branch:cli-onboard
```

To search a repository other than the current one, use `--repo`:

```shell theme={null}
entire search "history import when enabling Entire" --repo entireio/cli
```

For all supported flags, inline filters, and repository formats, see the [`search` command reference](/cli-reference/search).

## Use Search in Scripts

Add `--json` to return machine-readable results for scripts, automation, or agent instructions:

```shell theme={null}
entire search "history import when enabling Entire" --repo entireio/cli --json
```

For agent workflows, combine `--compact` and `--limit` to reduce the response size:

```shell theme={null}
entire search "history import when enabling Entire" --compact --limit 5
```

`--compact` implies `--json` and returns identifiers, ranking metadata, and truncated titles instead of full prompts. Results also include repository, branch, author, date, files touched, and match snippets when available. The flag applies to semantic search only and cannot be combined with `--code`. `--limit` sets the maximum results per page for semantic search, or the maximum total results with `--code`.

## Continue With

<CardGroup cols={2}>
  <Card title="Search in entire.io" icon="globe" href="/guides/search/search-in-entire-io">
    Browse history and code results visually.
  </Card>

  <Card title="Use Search with Your Coding Agent" icon="robot" href="/guides/search/search-from-your-agent">
    Let a Skill run these queries on your agent's behalf.
  </Card>

  <Card title="Search Command Reference" icon="terminal" href="/cli-reference/search">
    See search syntax, filters, and output options.
  </Card>

  <Card title="What Is Indexed and When" icon="database" href="/guides/search/what-is-indexed">
    Check availability, timing, and repository scope.
  </Card>
</CardGroup>
