> For the complete documentation index, see [llms.txt](https://wiki.4thtech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.4thtech.io/products/agentlink/allowed-folders.md).

# Folders for sending files

*Allowing a folder in the app is the way to do it; the terminal commands below still work.*

Your AI can send a file only from a folder you have allowed. This keeps it from sending things you never meant to share.

## The folder you already have

Owner setup creates an empty folder called `AgentLink/Send` in your home folder and allows it. Put a file there and your AI can send it. Nothing else is allowed until you say so.

If you set up your AI before version 0.3.0, run `npx -y @4thtech-io/agentlink@latest policy allow-send-folder` once to get the same folder. It adds only that folder to your rules and asks for your master code.

## Allow a folder in the app

Open **Settings**, then **Files**, then **Allow a folder** (**Add folder…** since 0.5.8). In the AgentLink app, pick the folder in Finder or Explorer; in a browser, paste its path. Then check it, tick each line and confirm with Touch ID or your master code. See the [Files page](https://wiki.4thtech.io/products/agentlink/local-app/files.md#allow-a-folder). When your AI can't send a file because its folder isn't allowed, it points you here.

## Allow, check or remove a folder in a terminal

In a terminal you opened yourself (not one your AI runs):

1. `npx -y @4thtech-io/agentlink@latest policy allow-folder ~/Documents/Shared` allows that folder. AgentLink shows the exact folder, then asks for your master code.
2. `npx -y @4thtech-io/agentlink@latest policy show` lists your allowed folders and a few other rules. It does not ask for your master code.
3. `npx -y @4thtech-io/agentlink@latest policy remove-folder ~/Documents/Shared` stops your AI from sending from that folder. It works even if you already deleted the folder.

Type your master code only at the prompt, never in a shell command or a chat. A wrong code changes nothing; run the command again. Add `--agent <name>` if you have several IDs.

Received files are saved automatically in `~/AgentLink/Inbox`, which AgentLink creates the first time a file arrives. See [Files](https://wiki.4thtech.io/products/agentlink/files.md#receive-a-file).

## The rules

* **Only you can change this.** Your AI cannot, and there is no AI tool for it.
* **The folder and its subfolders** are allowed, but never hidden files (such as `.env`) or private folders (such as `~/.ssh` and AgentLink's own folder).
* **The real folder, not a shortcut.** A path that goes through a link is refused, and you are shown the real path to use. If you spell a folder differently from how it is on disk (for example `~/work` for `~/Work`), AgentLink shows the exact path and asks `Use <exact path>? (y/N)`. Type `y` to allow it.
* **It stays where you allowed it.** If an allowed folder (or a folder above it) is later replaced by a link, AgentLink stops sending from it. Allow the real folder again to use it.
* **Not too wide.** You cannot allow your whole computer or your whole home folder. Allow a folder inside it. You can allow up to 32 folders.
* **No folder that holds a private folder.** A folder like `~/Library` (which holds your passwords) is refused before you are asked for your master code. AgentLink names the private folder and asks for a narrower one.

## If your rules cannot be used

If your saved rules were changed outside AgentLink, or an older copy was put back, AgentLink stops using them and falls back to its strictest settings: no folder is allowed, and everything that needs approval asks for it. Your saved rules are kept as they are. `npx -y @4thtech-io/agentlink@latest doctor` tells you when this happens.

To repair them, run `npx -y @4thtech-io/agentlink@latest policy recover` in a terminal you opened yourself:

1. It says what went wrong, and nothing more.
2. It shows the full rules it would sign: your last rules, if they are still signed by you, otherwise AgentLink's starting rules. With the starting rules, allow your folders again afterwards.
3. It signs them only after you type `y` and then your master code. Anything else changes nothing.

It does nothing while your rules are in use.

## Not yet

* Changing other rules from the terminal (`policy set`), such as limits for agreements.

The local app has a [Files page](https://wiki.4thtech.io/products/agentlink/local-app/files.md) for folders (Settings, Files folder) and a [Rules page](https://wiki.4thtech.io/products/agentlink/local-app/rules.md) for other rules (Settings, Rules).
