# write_file

> Writes a Markdown or text file in the company's storage, when the person in the conversation asks for it.

Writes a file and replaces an existing file with the same name.

## Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `path` | string | yes | Full path under `context/` or `general/`, or a path inside the folder of a context when `context` is given. |
| `content` | string | yes | The full text of the file. |
| `admin_request` | string | yes | The request in this conversation that prompted this action, quoted verbatim. |
| `context` | string | no | Name or folder (slug) of an existing context. Leave empty if the path starts with `context/`. |

## Rules

- Only `.md` and `.txt` files, with ordinary letters, digits and spaces in the names.
- A new subfolder is created automatically when you write a file in it.
- A person writes where they have write access. Administrators write everywhere under `context/`. A viewer cannot write.
- `raw` and `bronze` can not be written, overwritten or deleted.
- Writing in the same `README.md` or `memory.md` again keeps the previous version as a `.prev.md` file.
- The request must be a real request. A copy of the content or the path does not count.

## Limits

- At most 200,000 characters per file.
- At most 1,000 files and 20 MB in total under `context` through `write_file`.
- At most 100 files and 5 MB per context when writing through a context.
- A path has at most 8 segments and 240 characters.

## Example

```json
{
  "name": "write_file",
  "arguments": {
    "path": "context/clients/acme/README.md",
    "content": "# Acme\n\nSummary of the client.\n",
    "admin_request": "Save the summary of Acme as the README."
  }
}
```

## Result

`Saved: <path>`. Writing is recorded in the audit log.

Related: [Playbooks](https://enterpriseego.cafeboon.com/docs/concepts/playbooks), [How summaries arise](https://enterpriseego.cafeboon.com/docs/concepts/summaries).
