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

# Query

> Retrieve relevant project memory before work starts.

Use the Query skill before non-trivial work so your agent can align with existing project decisions, patterns, and gotchas.

The normal workflow is agent-driven: ask the agent to check ByteRover, then let it use the retrieved memory while it works.

<Note>
  Run Query from inside the project folder. If the project should use a named space, bind it first with [Bind](/v4/skill/bind).
</Note>

## Ask your agent to query

Use natural language. Include the area of the codebase or decision you are about to touch.

```text theme={null}
Before changing authentication, query ByteRover for the current desktop auth and daemon sync decisions.
```

Other examples:

```text theme={null}
Check ByteRover for testing conventions before adding these tests.
```

```text theme={null}
Query ByteRover for deployment gotchas related to the desktop app.
```

The agent should run the query from inside the project folder so ByteRover can resolve the correct space.

## Review the answer

The agent should summarize the relevant memory and show the source when ByteRover returns one.

Use the answer as project context, not as a blind command. If the recorded memory conflicts with the current task, ask the agent to explain the conflict before changing direction.

## Narrow the query

If the answer is too broad, ask a more specific follow-up:

```text theme={null}
Narrow that to auth token storage and browser approval only.
```

If the answer misses a topic you expected, mention the likely area:

```text theme={null}
Search ByteRover again, focused on the desktop daemon auth flow.
```

## Record what is missing

If nothing useful appears, continue the work. When the decision becomes clear, ask the agent to record it:

```text theme={null}
Record the auth token storage decision we just made, including why we rejected pasted tokens.
```

## Manual reference

Most users do not need to run the script directly. The connected agent runs it from the installed ByteRover skill directory.

The script shape is:

```bash theme={null}
node scripts/query.mjs "desktop auth daemon sync" --limit 5
```

The command returns JSON with:

| Field            | Meaning                                                        |
| ---------------- | -------------------------------------------------------------- |
| `hits`           | Ranked matching topics with path, title, score, and snippet.   |
| `query`          | The resolved query text.                                       |
| `should_cite`    | Whether the result set is strong enough for the agent to cite. |
| `citation_block` | A ready-to-share citation block for the matching memories.     |

## Read a full topic

When a hit looks useful, read the full topic:

```bash theme={null}
node scripts/brv.mjs read "architecture/auth.html"
```

The agent should treat recorded decisions and rules as constraints unless it explains why the current task needs to diverge.
