OpenProgram Docs

Directory references

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.

PartDesign
Registryreferences in the profile's config.json: {name: {path, writable?, description?}} or {name: {repository, branch?, description?}}, written through update_config
Told to the modelOne line in <environment>: every reference by name, with its path, access and description
MentionThe composer's @ file mention. A first segment that names a reference resolves inside it
ReadOpen, as any folder outside the working directory, under the sandbox's read denials
WriteRefused into a read-only reference in every mode; a writable one counts as a working directory
RepositoryCloned once, shallow, into <state>/references/<host>/<path>[@<branch>]; always read-only; updated by refresh
Managementopenprogram references list|add|remove|refresh and /references on the shared command registry

Decisions

QuestionChoiceWhy
Named or a plain extra directoryNamed, persistent, per profileOpenCode, 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 syntaxThe existing @path: @name, @name/path; @./name reaches a same-named folder of the working directoryThe 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 sendsA file becomes the usual path attachment; a folder stays as typedEvery 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 seesAll of them, sorted by nameOpenCode 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 cacheThe line is built from the registry aloneIt stays byte-identical turn to turn and changes only when a reference is added or removed.
Default accessRead-only; --writable for a local folderOpenCode 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 enforcedpermission_decision, after identity and before the owner's rulesLike 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.
NestingThe closest folder holding the target decidesA project inside a read-only reference stays writable; a read-only vendor inside the project stays protected.
SandboxWritable references join writable_roots; read-only ones are not rootsThe sandbox already refuses writes outside its roots, so read-only needs no extra rule there. Read denials (credentials) are not lifted.
Repositorieshttps://, ssh://, git://, git@host:path; refreshed only on requestOpenCode 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 foldersThe URL is user text handed to Git, and its parts become folder names under the profile.
RemoveForgets the name; deletes a clone no other reference usesA clone lives in OpenProgram's cache and can be cloned again; a user's folder is never touched.

Data path

StageCodeBehaviour
Registerstate/directory_references.py, interfaces/cli/commands/capabilities/references.py, runtime/commands/directory_references.pyValidates the name and folder, or clones; a relative folder is read from the CLI's directory or the conversation's working directory
Suggest/api/file-search in interfaces/server/routes/files/file_search.pyMatching names lead the results as folders; name/partial walks the reference
Attach/api/file-resolvename/path resolves inside the reference; leaving it by .. or a symlink is a 400. Reference folders are attachment roots, so the chip opens
Promptenvironment_block in runtime/context/prompt_assembly/components.pyAdds the line; left out when the file tools act on another machine
Readstate/worktree/path_resolve.pyNo outside-worktree warning for a path inside a reference
Writeruntime/permissions/file_safety.py, policy.py, identity.path_is_safe, host/sandboxREAD_ONLY_REFERENCE refusal; writable references in the Accept edits fence and the sandbox roots

Implementation status

ItemStatus
TUI @ menuWalks the local disk itself and does not list references yet; @name/path typed there works through the system line
Shell commandsChecked only by the sandbox. A read-only reference inside a sandbox writable root is protected from the file tools only
Automatic refreshNone; refresh is explicit

Additional working directories

Last updated · 2026-11-30