# References

```
openprogram references add docs ~/work/product-docs --description "product behaviour and terms"
openprogram references add sdk https://github.com/example/sdk --branch main
openprogram references list
```

Then, in any conversation: `Compare @docs/api/auth.md with how we log in.`

| Written | Means |
| --- | --- |
| `@docs` | The whole folder. The agent searches and reads it as needed |
| `@docs/api/auth.md` | That file. In the Web composer it becomes an attachment chip, like any `@` file |
| `@./docs/api/auth.md` | The working directory's own `docs` folder, when it has one with the same name |

Typing `@` in the Web composer lists the matching names first, as folders; `@docs/` then searches inside `docs`. Every conversation's system context names each reference with its path, so the TUI, channels and `--print` work the same.

## What the agent may do there

| Reference | Read and search | Write, edit, patch |
| --- | --- | --- |
| A folder (default) | Yes | Refused in every permission mode, Bypass included |
| A folder added with `--writable` | Yes | As in the working directory: Accept edits applies, and a sandboxed command may write there |
| A repository | Yes | Refused; it is always read-only |

The closest folder decides: a project kept inside a read-only reference still writes its own files. Files the sandbox blocks from reading stay blocked. Without the sandbox, the refusal covers the file tools; shell commands are not checked.

## Manage them

| Command | Does |
| --- | --- |
| `openprogram references add NAME FOLDER` (`--writable`, `--description TEXT`) | Registers the folder (absolute, `~`, or relative to where you run it). The same name again replaces it |
| `openprogram references add NAME URL` (`--branch BRANCH`) | Clones an `https://`, `ssh://` or `git@host:path` repository into `~/.openprogram/references/` |
| `openprogram references refresh NAME` | Updates a cloned repository to its remote branch. Nothing refreshes on its own |
| `openprogram references remove NAME` | Forgets the name. A clone is deleted; a folder is left as it is |
| `openprogram references list` (`--json`) | Every name, path and access |

In the Web composer and the TUI, `/references` takes the same verbs, for example `/references add docs ~/work/product-docs`; a relative folder there is read from the conversation's working directory. Names use letters, digits, `.`, `_` and `-`. References belong to the profile and are saved in its `config.json` under `references`.

[Permissions](https://openprogram.io/docs/capabilities/permissions.html)
