> 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/ja/work/file-library/ai-edit.md).

# AI によるファイルの編集と整理

ワークスペースをマウントした MaiGPT の会話で、AI にファイル内容の編集、一括名前変更、移動、削除を依頼できます。AI は変更内容を提示し、確認後に実行します。すべての操作は復元できます。

AI はファイルの読み取りだけでなく、ワークスペース内のファイルを直接編集したり、名前変更、移動、削除したりできます。どの変更も、**まず変更内容を提示し、確認を待ってから実行します**。書き込み後は新しいバージョンが作成され、削除したファイルは 30 日以内であれば復元できます。

## 利用シーン <a href="#use-case" id="use-case"></a>

製品発表の前日、保証ポリシーが 1 年から 2 年に変更されました。マーケティング担当者は製品ワークスペースをマウントした会話で、「FAQ.md の 3 問目の保証を、本体は 2 年、モーターは 3 年に変更してください」と依頼します。AI は変更前後の内容を示し、書き戻してよいかを尋ねます。担当者が確認すると、AI は FAQ.md を直接更新します。続いて、3 件のインタビューメモを「2026Q3\_元のファイル名」に変更し、「インタビュー資料」フォルダーに移動するよう依頼します。AI はまず対応表を提示し、確認後にまとめて実行します。バージョン履歴には、各操作を担当者が会話内で確認したことが記録されます。

***

## ファイル内容の編集 <a href="#edit-file-content" id="edit-file-content"></a>

### 1. 変更したい箇所を伝える <a href="#describe-change" id="describe-change"></a>

ワークスペースをマウントした会話で、編集したいファイルと内容を直接伝えます。例えば、次のように依頼します。

> 「FAQ.md の 3 問目の保証を、本体保証は 2 年、モーター保証は 3 年に変更してください」

### 2. 変更を確認する <a href="#confirm-change" id="confirm-change"></a>

AI はまずファイルを読み取り、変更前後の内容を示して、書き込んでよいかを尋ねます。内容に誤りがないことを確認してから、承認の返答をするか、AI が提示する確認用の選択肢をクリックしてください。AI はその後でファイルに書き戻します。

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-41b16d41fa190807f7441a4e5ff34d83ec221fc3%2Ffile-library-ai-edit-confirm.png?alt=media" alt="AI が FAQ.md の 3 問目の変更前後を示し、書き戻してよいかを尋ねています"><figcaption><p>AI は変更前後を提示し、確認後に書き込みます</p></figcaption></figure>

### 3. 新しいバージョンを確認する <a href="#check-new-version" id="check-new-version"></a>

書き込みが完了すると、ファイル名と場所はそのままで、新しいバージョンが作成されます。バージョン一覧には<mark style="color:blue;">Agent</mark>と確認者、元の会話が表示されます。詳しくは[バージョン履歴と復元](https://docs.maiagent.ai/maiagent-user-guide/ja/work/file-library/versions.md)をご覧ください。

### 編集できる形式 <a href="#editable-formats" id="editable-formats"></a>

| 種類        | 形式                  | 説明                                                                               |
| --------- | ------------------- | -------------------------------------------------------------------------------- |
| テキストとデータ  | MD、TXT、SQL、JSON、CSV | 内容を直接編集できます                                                                      |
| Office 文書 | XLSX、DOCX、PPTX      | 会話で Code Interpreter を有効にする必要があります。複雑なグラフや書式は完全に保持されない場合があるため、編集後に確認することをおすすめします |

{% hint style="warning" %}

* 対象ワークスペースの**編集権限**が必要です。閲覧権限しかない場合、AI は編集できないことを伝え、代わりに新しいファイルを生成します。
* 確認前に同僚が新しいバージョンを保存していた場合、AI は上書きしません。ファイルが更新されたことを知らせて再確認を求め、ほかの人の内容が上書きされるのを防ぎます。
  {% endhint %}

***

## 名前変更と移動 <a href="#rename-and-move" id="rename-and-move"></a>

「3 件のインタビューメモを『2026Q3\_元のファイル名』に変更して、『インタビュー資料』フォルダーに移動してください」のように、複数のファイルをまとめて処理するよう依頼できます。AI はまず、<mark style="color:blue;">現在の場所</mark>、<mark style="color:blue;">現在のファイル名</mark>、<mark style="color:blue;">操作後のファイル名</mark>、<mark style="color:blue;">移動先</mark>の対応表を提示し、確認後に実行します。

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-3bc6e066c166e05ee0a25dcfe3428dfba1dcb15c%2Ffile-library-ai-move-plan.png?alt=media" alt="AI が 3 件のインタビューメモの名前変更と移動の対応表を提示し、ユーザーに確認を求めています"><figcaption><p>名前変更と移動前の対応表です</p></figcaption></figure>

* 1 回につき最大 **20** ファイルを処理できます。
* 名前変更時に拡張子を変更することはできません。
* 移動先のフォルダーが存在しない場合、AI は「フォルダー作成」も対応表に含め、確認後にまとめて実行します。
* 同じファイルの名前変更と移動は、一緒に実行されます。どちらか一方でも実行できない場合は、両方とも実行せず、AI が理由を説明します。

***

## ファイルの削除 <a href="#delete-files" id="delete-files"></a>

「Q2 の古い見積書を削除してください」と伝えると、AI は削除対象のファイルと場所を提示します。**必ず確認を得てから削除します**。

* 削除したファイルは **30 日間**保持されます。その間は、ワークスペースの<mark style="color:blue;">バージョン履歴</mark>から元の場所に復元できます。
* **ワークスペースのオーナー（組織オーナー、スペースオーナー、ワークスペース作成者）ではない場合**、AI は代わりに削除申請を送信します。オーナーはワークスペースの<mark style="color:blue;">削除承認待ち</mark>で<mark style="color:blue;">削除を承認</mark>または<mark style="color:blue;">却下</mark>を選択できます。申請は 7 日後に失効します。

***

## 関連ページ <a href="#related" id="related"></a>

* [MaiGPT でワークスペースを利用する](https://docs.maiagent.ai/maiagent-user-guide/ja/work/file-library/use-in-maigpt.md)
* [バージョン履歴と復元](https://docs.maiagent.ai/maiagent-user-guide/ja/work/file-library/versions.md)
* [Code Interpreter（コード実行）](https://docs.maiagent.ai/maiagent-user-guide/ja/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/ja/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.
