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

# How Doppels Works: Freeze Once, Replay Forever

> Understand the Doppels execution model: agent exploration, the freeze step, YAML manifests committed to Git, and zero-token local replay.

Doppels turns a successful AI agent session into a deterministic, locally-executable automation. You explore a problem with your agent — deploying a service, running a migration, packaging a release — and when it works, you invoke the `doppel freeze` skill. The skill writes two YAML manifests into your repository: a Capability that declares the public contract (inputs and outputs) and a Recipe that describes exactly how to execute it. From that point on, every replay runs locally on your machine at zero token cost.

## The core problem

Coding agents are excellent at exploration: they discover the right command sequence, figure out the flags, handle the edge cases. But agents have no memory between sessions. The working solution lives in a chat window. The next time you need that migration script or that release pipeline, you start over — re-explaining context, burning tokens, hoping the agent finds the same path.

Scripts pasted into documentation drift. Chat histories are not executable. Re-running "that prod fix" means starting over from scratch.

## The solution: freeze the working session

Doppels introduces a single inflection point called the freeze step. When your agent has solved the problem, you say something like:

```text theme={null}
doppel freeze — turn what we just did into a Capability
```

The `doppel-freeze` skill (installed once into Cursor, Claude, Codex, or OpenCode) reads the session, extracts what varied (inputs), what was produced (outputs), and what steps ran. It writes that knowledge as plain YAML into your repository. No proprietary format. No cloud dependency. Just files you commit like any other source.

## The execution model

```text theme={null}
Cursor / Claude / Codex       Your repo
        │                           │
        │  explore, fix, ship once  │
        ▼                           │
   doppel freeze (skill)            │
        │                           │
        │  writes YAML              ▼
        └─────────────► capabilities/<name>.yaml
                        recipes/<name>.yaml
                                     │
                                     ▼
                        doppels validate
                        doppels run capability/<name>
                                     │
                                     ▼
                        .doppels/runs/<id>/  (logs, artifacts)
```

## Each stage explained

### 1. Agent session

You work with your agent as you normally would — fixing a bug, automating a deploy, writing a data pipeline. The agent explores, iterates, and eventually reaches a working solution. This is the only stage that costs tokens.

### 2. `doppel freeze` writes YAML

When you invoke the freeze skill, the agent:

1. Runs `doppels spaces init` if your project doesn't have a `.doppels/` directory yet.
2. Identifies the distinct outcomes from the session — one Capability per outcome.
3. Writes `capabilities/<name>.yaml` declaring the typed inputs and outputs.
4. Writes `recipes/<name>.yaml` declaring the shell steps, required tools, approval rules, and output mappings.
5. Loops `doppels validate` until the manifests are clean.
6. Shows you the result and waits for your approval before treating it as done.

You commit the YAML when you're happy. That commit is the repeatable asset — versioned in Git, reviewable in pull requests, forkable by teammates.

### 3. `doppels validate`

Before you run anything, `doppels validate` checks every manifest under your `capabilities/` and `recipes/` directories. It verifies schema correctness, expression syntax, step ordering, approval coverage, output type compatibility, and Capability–Recipe linkage. Run it in CI to catch regressions before they reach production.

```shell theme={null}
doppels validate
```

### 4. `doppels run`

To execute a Capability, pass its name and supply the declared inputs:

```shell theme={null}
doppels run capability/<name> --input version=1.4.2 --yes
```

The CLI resolves the Recipe that `provides` the Capability, checks that every `requires.commands` entry is on your `PATH`, injects inputs as environment variables, and runs each step in order. No agent involved. No network call to execute your code.

### 5. Results in `.doppels/runs/<id>/`

Every run produces a timestamped directory under `.doppels/runs/<id>/` containing logs, produced artifacts, and the final returns mapped back to the Capability's declared outputs. You can inspect any run with:

```shell theme={null}
doppels runs list
doppels runs show <run-id>
doppels runs logs <run-id>
```

## Execution stays on your machine

Cloud coordination (when enabled) handles identity, sharing, and audit. It never executes your steps. Every shell command runs on your host with your credentials — your `aws-cli` configuration, your `gcloud` auth, your SSH keys, your VPN. If the network goes down, `doppels run` still works.

## Zero-token replay

After freeze, every subsequent run costs exactly zero tokens. The agent's exploration was a one-time investment. The Recipe is deterministic: same inputs produce the same steps and the same outputs, every time. Your library of Capabilities grows with each freeze, compounding the value of past agent sessions without compounding the token bill.

***

<CardGroup cols={2}>
  <Card title="Capabilities" icon="file-contract" href="/concepts/capabilities">
    Learn how Capability manifests define the public contract for your automations.
  </Card>

  <Card title="Recipes" icon="scroll" href="/concepts/recipes">
    Understand how Recipes declare shell steps, required tools, and output mappings.
  </Card>

  <Card title="Spaces" icon="folder-tree" href="/concepts/spaces">
    See how Spaces scope Capability and Recipe discovery within your project.
  </Card>

  <Card title="Freeze with an Agent" icon="snowflake" href="/guides/freeze-with-agent">
    Step-by-step guide to freezing your first agent session into a Doppel.
  </Card>
</CardGroup>
