# How it works

Zhanla reads your agent's code, asks what a good result looks like, runs the real agent against test conversations, and tries to fix what fails.

**Diagram: The path from an agent to a fix**

```text
Find → Set up → Interview → Rubric → Eval and dataset → Run → Tune the judge → Refine → Draft PR
```

## An example

Take a refund support agent. During set-up, you say a wrong refund status is the worst mistake it can make.

The **rubric** gets a rubric item: "gives the correct refund status for the customer's order." The **dataset** gets a dataset item where a simulated customer corrects their order number on turn three. Your agent runs it locally, and an LLM **judge** gives it a verdict.

The agent gave the old order's status, so the judge failed it and pointed to the step that caused it:

**Diagram: Example trajectory**

```text
1  handle_request
  2  model call: plan the answer
  3  tool: search_orders (searched the old order number)
  4  model call: write the reply
```

To fix it, a **refinement** patches a separate worktree and reruns the eval. If the score rose, it offers a draft PR.

## Guarantees

Zhanla asks before it publishes, runs your agent or edits code. Yolo mode answers permission cards for you, such as a file edit or a command in chat. Publishing, starting a run and other decisions still ask.

Published versions are immutable, and each run records the ones it used. Editing a rubric marks its evals out of sync until you run `/sync`.

A resumed run skips work already saved, so you don't pay twice.

## Where data lives

Your agent runs locally. Everything Zhanla produces is stored in its hosted backend under your organization, where the terminal and the web app read it. Some code does leave your machine. See [what leaves it](https://zhanla.vercel.app/docs#does-my-code-leave-my-machine).

---

Source: https://zhanla.vercel.app/docs/how-it-works
Updated 2026-11-24. Checked against release candidate b60cdc94.
