> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/maiagent-user-guide/en/work/file-library/ai-edit.md).

# Let AI Edit and Organize Files

In a MaiGPT conversation with a workspace attached, ask AI to edit file contents, rename files in batches, move files, or delete them. AI lists the changes first and waits for your confirmation before

AI can read files and directly edit, rename, move, or delete files in a workspace. For every change, **AI first lists what will change and waits for your confirmation before proceeding**. Writing a file creates a new version, and deleted files can be restored within 30 days.

## Use Case <a href="#use-case" id="use-case"></a>

The day before a product announcement, the warranty policy changes from one year to two years. In a conversation with the product workspace attached, a marketing specialist says, “Change the warranty in the third question of FAQ.md to two years for the main unit and three years for the motor.” AI displays the content before and after the edit and asks whether to write it back. After she confirms, AI updates FAQ.md directly. She then asks AI to rename three interview notes to “2026Q3\_original filename” and move them to the “Interview Materials” folder. AI first lists the proposed changes in a table and completes them together after confirmation. Version history records that she confirmed each step in the conversation.

***

## Edit File Contents <a href="#edit-file-content" id="edit-file-content"></a>

### 1. Describe What to Change <a href="#describe-change" id="describe-change"></a>

In a conversation with a workspace attached, describe the file and the content you want to change. For example:

> “Change the warranty in the third question of FAQ.md to: two years for the main unit and three years for the motor.”

### 2. Confirm the Change <a href="#confirm-change" id="confirm-change"></a>

AI reads the file first, shows the content before and after the edit, and asks whether to write the change. Check the content, then reply to confirm or select the confirmation option AI provides. Only then will AI write the change to the file.

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-41b16d41fa190807f7441a4e5ff34d83ec221fc3%2Ffile-library-ai-edit-confirm.png?alt=media" alt="AI shows the third question of FAQ.md before and after the edit and asks whether to write the change"><figcaption><p>AI shows the content before and after the edit, then writes it only after confirmation</p></figcaption></figure>

### 3. View the New Version <a href="#check-new-version" id="check-new-version"></a>

After the write completes, the file has a new version, with its name and location unchanged. The version list shows <mark style="color:blue;">Agent</mark>, the person who confirmed the change, and the source conversation. See [Version History and Restore](https://docs.maiagent.ai/maiagent-user-guide/en/work/file-library/versions.md).

### Editable Formats <a href="#editable-formats" id="editable-formats"></a>

| Type             | Formats                 | Description                                                                                                                                             |
| ---------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Text and data    | MD, TXT, SQL, JSON, CSV | Edit contents directly                                                                                                                                  |
| Office documents | XLSX, DOCX, PPTX        | Requires Code Interpreter to be enabled in the conversation; complex charts or formatting may not be fully preserved, so check the result after editing |

{% hint style="warning" %}

* You need **editing permission** for the workspace. If you only have viewing permission, AI explains that it cannot edit the file and generates a new file instead.
* If a colleague saves a new version before you confirm, AI will not overwrite it. It tells you the file has been updated and asks you to confirm again to avoid overwriting someone else's content.
  {% endhint %}

***

## Rename and Move Files <a href="#rename-and-move" id="rename-and-move"></a>

You can ask AI to handle several files at once. For example, “Rename the three interview notes to ‘2026Q3\_original filename’ and move them to the ‘Interview Materials’ folder.” AI first lists the <mark style="color:blue;">Current Location</mark>, <mark style="color:blue;">Current Filename</mark>, <mark style="color:blue;">Filename After Operation</mark>, and <mark style="color:blue;">Destination</mark> in a comparison table, then proceeds after confirmation.

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-3bc6e066c166e05ee0a25dcfe3428dfba1dcb15c%2Ffile-library-ai-move-plan.png?alt=media" alt="AI lists the proposed renames and moves for three interview notes and asks the user to confirm"><figcaption><p>Comparison table before renaming and moving files</p></figcaption></figure>

* Up to **20** files can be processed per operation.
* Renaming cannot change the file extension.
* If the destination folder does not exist, AI includes “Create Folder” in the comparison table and completes everything together after confirmation.
* Renaming and moving the same file are performed together. If either step cannot be completed, neither step runs, and AI explains why.

***

## Delete Files <a href="#delete-files" id="delete-files"></a>

Say “Delete the old Q2 quotation,” and AI lists the files to delete and their locations. **Deletion always requires your confirmation.**

* Deleted files are retained for **30 days**. During that period, you can restore them to their original locations from the workspace's <mark style="color:blue;">Version History</mark>.
* **If you are not a workspace owner (organization owner, space owner, or workspace creator)**, AI submits a deletion request instead. An owner can select <mark style="color:blue;">Approve Deletion</mark> or <mark style="color:blue;">Reject</mark> under <mark style="color:blue;">Pending Deletions</mark> in the workspace. Requests expire after 7 days.

***

## Related Pages <a href="#related" id="related"></a>

* [Use Workspaces in MaiGPT](https://docs.maiagent.ai/maiagent-user-guide/en/work/file-library/use-in-maigpt.md)
* [Version History and Restore](https://docs.maiagent.ai/maiagent-user-guide/en/work/file-library/versions.md)
* [Code Interpreter (Code Execution)](https://docs.maiagent.ai/maiagent-user-guide/en/build/agent/code-interpreter.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/maiagent-user-guide/en/work/file-library/ai-edit.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
