# Use Dryv with AI agents

Dryv and AI agents fit together well. An agent is good at reading intent and editing
contracts; Dryv is deterministic code generation, so the same contracts and packs always
produce the same files. The agent changes the meaning, Dryv renders the code, and every
generated file can be explained with `dryv why`.

This page shows how to give an agent what it needs. The short version:

1. Install the [Dryv agent skill](agent-skill.md) so the agent knows the loop and the rules.
2. Keep the Dryv block in your project's `AGENTS.md` (`dryv init` writes it).
3. Point the agent at the docs as Markdown: [llms.txt](#docs-for-language-models).

## What an agent should do

An agent working in a Dryv project follows the same loop as a person, without prompts:

```bash
dryv validate --json --no-input
dryv plan --json --no-input
dryv generate --dry-run --json --no-input
dryv generate --yes --json --no-input
```

- **Branch on JSON.** With `--json` every command prints one result document. On failure,
  read its `code` (for example `DRYV_MANAGED_CONFLICT`) and look it up with `dryv docs errors`.
- **Preview first.** `generate --dry-run` (or `-n`) shows the diff and writes nothing.
- **Never hand-edit managed files.** Change the contracts in `dryv/contracts`, `dryv.yaml`
  or the pack, then regenerate. `dryv why <path>` explains where a file came from.
- **Ask before deciding.** Names, structure and behaviour belong to the user. An agent should
  ask instead of inventing an entity, a route or a pack choice.
- **Find packs, don't guess.** `dryv pack search <query>` and `dryv pack info <id>` read the
  catalogue; `dryv pack add <id> --dry-run` previews the `dryv.yaml` edit.

[Agents and CI](../usage/agents-and-ci.md) covers the same rules for scripts and CI.

## Project instructions

`dryv init` writes `dryv/README.md` and a Dryv block in the project's `AGENTS.md`.
Refresh both with `dryv docs --write`. If you keep your own `AGENTS.md` or `CLAUDE.md`,
this block is enough:

```markdown
## Dryv

This project generates code with [Dryv](https://dryvcode.com). Read `dryv/README.md` first, or run `dryv docs`.

- Meaning lives in `dryv/contracts`; configuration in `dryv.yaml`. Do not hand-edit managed generated files.
- Loop: `dryv validate` -> `dryv plan` -> `dryv generate --dry-run` -> `dryv generate`.
- Use `--json --no-input` in scripts. On failure read the `code` and run `dryv docs errors`.
- Ask the user before choosing names, structure or behaviour.
```

## Docs for language models

The documentation is published for agents as well as people:

- [llms.txt](https://docs.dryvcode.com/llms.txt) lists every docs page with a link to its Markdown.
- [llms-full.txt](https://docs.dryvcode.com/llms-full.txt) is the whole documentation in one file.
- Every page is plain Markdown at its URL plus `.md`, for example
  `https://docs.dryvcode.com/docs/getting-started.md`. Section homes are `/docs/index.md`.
- The pack registry has its own index at [packs.dryvcode.com/llms.txt](https://packs.dryvcode.com/llms.txt).

Offline, the CLI carries the essentials: `dryv docs` lists the built-in guides and
`dryv docs agents` prints the agent rules.

## MCP

Dryv Platform serves an MCP endpoint at `https://api.dryvcode.com/mcp` (Streamable HTTP).
It needs a Dryv account: the client signs in through the browser with OAuth the first time.
For example, in Claude Code:

```bash
claude mcp add --transport http dryv https://api.dryvcode.com/mcp
```

You don't need MCP to generate code. The CLI, the engine and the agent skill work locally
without an account; MCP adds access to your Platform workspace from the agent.

## Next

- [Install the Dryv agent skill](agent-skill.md)
- [CLI reference](../usage/cli.md)
- [Find packs](https://packs.dryvcode.com)
