---
name: zyte
description: Retrieve repo code by meaning instead of grepping. Ranks files and symbols against a question over a code graph, reads one symbol at a time, walks callers and callees, and records notes that outlive the session. The context block attached at the start of a turn comes from this same index, so read that first and use this skill to widen.
---

# Byte repository retrieval

## Search policy

1. **Start from attached context.** A turn may open with a `<zyte_context>` block.
   Everything inside it is already in your context. Never re-read a file or symbol
   that appears there.
2. **Widen by asking a question**, not by naming a file:

       hits = await zyte.retrieve("where is the retry backoff computed")

   `hits["items"]` is ranked, each with `path`, `symbol`, `lines`, and `text`.
   `hits["confidence"]` is `high`, `medium`, or `low`; on `low`, treat the hits as
   guesses and confirm before acting on them.
3. **Pull one thing** when you need the full body:

       body = await zyte.read("src/core/retry.ts::computeBackoff")

4. **Walk the graph** to find callers and callees:

       await zyte.neighbors("src/core/retry.ts::computeBackoff", depth=1)

5. **Reach for `rg` only when** you need an exhaustive literal enumeration (every
   call site before a rename), the file is one the graph cannot parse (generated
   code, data, lockfiles, non-source assets), or `await zyte.status()` reports
   `has_graph` is false.

## API

Every call resolves the repo root from the working directory, so no path argument
is needed, and every call records what you touched so later ranking improves
without extra bookkeeping.

- `await zyte.status()` - `has_graph`, `stale`, `files`, `symbols`, `generated_at`.
- `await zyte.scan(force=False)` - build or refresh the graph. Only needed when
  `status()` reports no graph; staleness is picked up automatically.
- `await zyte.retrieve(query, budget_chars=18000, max_read_chars=4000, limit=12)`
- `await zyte.read(ref, max_chars=4000)` - `ref` is `"path"` or `"path::symbol"`.
- `await zyte.neighbors(ref, depth=1, limit=20)`
- `await zyte.write(path, content)` - write a whole file and register the edit.
  Prefer `edit` for targeted replacements inside an existing file.
- `await zyte.remember(type, content, tags=None, files=None)` - record a durable
  note (a convention, a gotcha, a decision) keyed to this repo.
- `await zyte.prime(limit=12)` - read back the most relevant recorded notes.

If the engine is unavailable, these raise with a short message. Fall back to `rg`
and direct file reads and carry on; retrieval is an accelerator, not a gate.
