A reference is a name for a folder outside the working directory. The user registers it once; every conversation then reaches it as @name or @name/sub/path. User page: References.
Part
Design
Registry
references in the profile's config.json: {name: {path, writable?, description?}} or {name: {repository, branch?, description?}}, written through update_config
Told to the model
One line in <environment>: every reference by name, with its path, access and description
Mention
The composer's @ file mention. A first segment that names a reference resolves inside it
Read
Open, as any folder outside the working directory, under the sandbox's read denials
Write
Refused into a read-only reference in every mode; a writable one counts as a working directory
Repository
Cloned once, shallow, into <state>/references/<host>/<path>[@<branch>]; always read-only; updated by refresh
Management
openprogram references list|add|remove|refresh and /references on the shared command registry
Decisions
Question
Choice
Why
Named or a plain extra directory
Named, persistent, per profile
OpenCode, the only harness with names, keys references by alias in its config. Oh My Pi persists workspace.additionalDirectories but without names; Claude Code, Codex, KimiCode, Copilot CLI and Antigravity take --add-dir per session. A name is what lets a message point at the folder.
Word
“references”
OpenCode's term. /context already shows the token breakdown, so “contexts” would sit one letter from it in the slash menu.
Mention syntax
The existing @path: @name, @name/path; @./name reaches a same-named folder of the working directory
The Web menu and resolver work unchanged, and the TUI already sends @path as typed. A registered name wins the first segment because the user chose it.
What a mention sends
A file becomes the usual path attachment; a folder stays as typed
Every attachment reaches the model as a path it reads on demand. OpenCode attaches a listing of the root; here the system line already maps the name to its path.
Which references the model sees
All of them, sorted by name
OpenCode advertises only described ones, but its clients attach the alias. The TUI, channels and --print send the text as typed, so the model needs every name to read @name.
Prompt cache
The line is built from the registry alone
It stays byte-identical turn to turn and changes only when a reference is added or removed.
Default access
Read-only; --writable for a local folder
OpenCode references grant no permission of their own. Claude Code's additional directories and Codex's --add-dir are writable roots. Reading outside the working directory is already open, so the mark that changes behaviour is the write one.
Where read-only is enforced
permission_decision, after identity and before the owner's rules
Like Plan's read-only promise, it holds in Bypass and outranks allow rules. Write targets come from the call's arguments or the tool profile's written_paths, so write, edit and apply_patch are covered.
Nesting
The closest folder holding the target decides
A project inside a read-only reference stays writable; a read-only vendor inside the project stays protected.
Sandbox
Writable references join writable_roots; read-only ones are not roots
The sandbox already refuses writes outside its roots, so read-only needs no extra rule there. Read denials (credentials) are not lifted.
Repositories
https://, ssh://, git://, git@host:path; refreshed only on request
OpenCode clones into a per-remote cache and refreshes daily in the background. Here nothing reaches the network unasked; the clone is shallow and single-branch.
Clone safety
-- before the URL, file and ext transports off, no terminal prompt, branch names checked, host and path segments checked before they become folders
The URL is user text handed to Git, and its parts become folder names under the profile.
Remove
Forgets the name; deletes a clone no other reference uses
A clone lives in OpenProgram's cache and can be cloned again; a user's folder is never touched.