promptgarten ๐ŸŒฑ
๐ŸŒ ES

Command reference ยท Aider

/read-only

Adds files to the chat for reference only, without letting Aider edit them.

/read-only <file> adds a file to the chat as read-only, so Aider can read it for context but never edit it directly. Files already added with /add can be switched to read-only afterwards with /read-only. On the command line, this corresponds to the --read FILE flag (usable multiple times).

โœ… WHEN TO USE IT?

Give an interface or config file as context without risking accidental edits

/read-only src/types.ts, so Aider knows the types but never edits them itself

Provide a large reference file (e.g. API docs as markdown) as context

/read-only docs/api-reference.md before a question about correct endpoint usage

โ›” WHEN NOT TO?

The file actually needs to be changed

Aider explicitly never edits read-only files, even if the request sounds like it should.

Better: Use /add <file> to make it editable

Adding many large reference files read-only that are barely needed

Even read-only files consume context space (tokens) on every request.

Better: Only add the files actually needed, and remove them with /drop once no longer needed

SOURCES