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

# capy agents: Add Capy Instructions for Coding Agents

> Write, preview, or remove the Capy instructions block in a repository's AGENTS.md or CLAUDE.md.

## Synopsis

```bash theme={null}
capy agents --print
capy agents --yes
capy agents --remove --yes
capy agents --dry-run --json
```

## Description

`capy agents` adds a marked **Secrets (Capy)** section to the repository's existing `AGENTS.md` and `CLAUDE.md`. If neither file exists, it creates `AGENTS.md`. The section tells an agent to use `capy help --json`, use error codes rather than message text, and avoid printing or passing secret values as command arguments.

The command finds the Git repository root. Outside a Git repository, it uses the current directory. It updates an existing Capy section in place and preserves content outside the markers.

Use `--print` to inspect the block without writing. Use `--remove` to remove only the marked Capy section. If removal leaves a file exactly empty, Capy removes that file.

Writing or removing asks for confirmation in a terminal. In automation, pass `--yes`; `--non-tty` prevents prompts and therefore requires `--yes` for either operation. `--dry-run` calculates the changes without writing and never prompts.

## Flags

| Flag | Description |
| - | - |
| `--print` | Print the instructions block without changing files. |
| `--remove` | Remove the Capy block. |
| `-y, --yes` | Skip the write or removal confirmation. |
| `--non-tty` | Never prompt. Pair with `--yes` to write or remove. |
| `--json` | Emit machine-readable output. With `--print`, wraps the block in JSON. |

`--dry-run` is a global option, so use either `capy --dry-run agents` or `capy agents --dry-run`.

## See also

* [`capy help`](/docs/cli/help)
* [`capy add`](/docs/cli/add)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.