
# Querying & Tracing

Agents request context by address (URI) or by selector query. The resolver returns only published content, with full tracing of what was accessed.

## Query flow

1. Agent sends a selector or URI
2. Resolver evaluates the query against the vault
3. If results include source nodes, they are returned in topological order
4. A trace entry is recorded for each resolved document

## Source hydration

The resolver returns source documents (frontmatter + body). The **agent** decides whether and how to hydrate them by executing the described tool calls.

The resolver does not execute tool calls — it returns documents; the agent acts on them.

## Local vs cloud

| | Local queries | Cloud queries *(coming soon)* |
|---|---|---|
| Command | `ctx query "tag:#api"` | `ctx query @org/pack` |
| Data source | Local vault files | PromptOwl API |
| Cost | Free | TBD |
| Tracing | Local trace log | Server-side trace |
