# Creating and Editing Files

> Use Poly's AI agent to create new documents and edit existing ones.

The Poly agent can write and edit files directly in your storage. When using a local agent to make desktop changes, the agent should be instructed to edit the files directly, rather than opening a browser window or using the MCP integration when possible. On the web, the agent *must* use the MCP integration to make changes.

## Creating a new file

Ask the agent to create a document:

```text
Create a meeting agenda for tomorrow's product review
Write a first draft of a proposal for the Henderson account
Create a template for weekly status updates
Draft a privacy policy for a B2B SaaS company
```

The agent writes the content, creates the file in your current folder (or a folder you specify), and shows you the result. You can ask it to revise, expand, or reformat before saving.

To specify where to save, just ask

<tip>

Drag a file or folder into the chat to reference it directly, making the agent's job easier. Dragging a file into the chat does **not** require the agent to read the file into context.

</tip>

## Editing an existing file

Select a file in the browser, open the agent (`⌘ /` (`Ctrl+/` on Windows and Linux)), and ask for edits:

```text
Rewrite this in a more formal tone
Add an executive summary at the top of this document
Fix the grammar and punctuation throughout
Translate this to Spanish
Expand the third section with more detail
```

The agent modifies the file content and saves the changes. The original version is preserved in [version history](/recovering-files/viewing-versions), so you can roll back if needed.

## Direct editing with the built-in editor

For hands-on editing of text and code files, Poly includes a built-in Monaco editor. Open any text file and click **Edit** to switch to edit mode. The editor supports:

- Syntax highlighting for dozens of languages
- Find and replace
- Multiple cursors
- Vim keybindings (enable in Settings)

Use the built-in editor when you want fine-grained control; use the agent when you want to describe a change in words and have it applied automatically.

## File types the agent can create and edit

The agent can create and edit:

- **Text documents**: Markdown, [plain text](/mime-types/text/plain), [RTF](/mime-types/text/rtf)
- **Structured documents**: [DOCX](/mime-types/application/vnd.openxmlformats-officedocument.wordprocessingml.document), PPTX, [XLSX](/mime-types/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) (via content manipulation)
- **Code files**: any text-based programming or markup language

The agent cannot directly edit binary formats like images, audio, or video files.

## Choosing an image model

The agent's image command sends the complete conversation transcript directly to the selected
image provider:

```sh
poly generate image --prompt "A glass city at sunset" --model nb2
```

Available values for `--model` are:

- `gemini-nanobanana2` — Gemini NanoBanana2. `nb2` and `default` are aliases, and this is the
default when `--model` is omitted.
- `chatgpt-image` — ChatGPT Image. `chatgpt` is an alias.

Use `poly generate image --help` to see the same list in the agent CLI.

<tip>

The agent is able to generate images, so it could generate images similar to a given reference image, or even generate an image with edits, but it cannot directly edit an existing image file.

</tip>

<note>

Editing a file with the agent always creates a new version. Nothing is permanently overwritten — you can always revert from [version history](/recovering-files/viewing-versions).

</note>
