R395 · Agent architecture › Memory and context

Instruction files that load once, and the eight places a CLI looks

Read the original

harness-configmemoryagent-toolspermissionsdeveloper-infrastructureclaim-checking

A short claim about a coding-agent CLI — that its custom instruction files take effect only in a new session — is half right, and the half that is wrong matters more than the half that is right. Checking it against the vendor's own reference turns up a larger surprise: the CLI reads eight distinct instruction sources, two of them belonging to competing products, and the precedence rule most people assume exists is explicitly disclaimed for this surface and defined only for a different one.

What the reference actually says

The staleness is real. The CLI documentation states that changes to custom instruction files "are not immediately available for use in active CLI sessions." Editing a rule file while the agent is running does nothing; the running session keeps the text it started with.

The remedy, though, is not what the headline claim suggests. The same page says to exit the current session and "either resume it (for example, run copilot --continue), or start a new session (for example, use /new from within an interactive session)." Both are offered as ways to apply the change. A resumed session is explicitly good enough. The distinction that matters is exiting, not starting fresh — and that is a much cheaper discipline, because it means you keep your conversation while picking up the edited rule.

That difference is worth getting right. "Start over whenever you edit a rule" is a rule people will refuse to follow, and refusing it quietly leaves them running against stale instructions. "Bounce the session" is a rule they will follow.

Eight sources, and two of them belong to other vendors

The discovery list is longer than most users would guess. At user level there is a single instructions file and a directory of modular *.instructions.md files, both relocatable by an environment variable that overrides the agent's home directory. At repository level there is the repository-wide instructions file and a modular instructions directory — the latter "discovered in the standard locations but not intermediate directories," which is a real asymmetry worth knowing before you place files. Then come three agent files, documented as discovered in the standard locations: the cross-vendor AGENTS.md convention, plus the context files belonging to two competing assistants, one of which is also read from its own dotfile directory. Finally, a comma-separated environment variable can add further directories supplying agent and instruction files.

The interesting fact there is not the count but the interoperability: a vendor's CLI reading its competitors' context files by name. For a team that uses more than one assistant, that is a reason to keep shared conventions in the cross-vendor file and reserve product-specific files for product-specific behaviour — otherwise one product silently inherits another's instructions, including instructions written against a different tool's capabilities.

The precedence rule that is not there

This is the part to internalise. For the CLI, the documentation says it removes duplicate copies of identical user-level, repository-wide and agent instructions, "but does not define a general precedence order between these files," and follows with: "Avoid conflicting instructions." Files are combined, not ranked. Path-scoped instructions are included only when their glob matches a file being worked on, and when a path-scoped file and a repository-wide file both apply, both sets are used — a narrower file does not override a broader one.

A precedence order does exist in the same documentation set, but for a different surface: in the web chat experience, personal instructions rank highest, then repository path-specific, then repository-wide, then agent files, then organisation instructions. Organisation instructions, meanwhile, are documented as not supported in local client sessions at all.

So the same instruction files can be ranked on one surface and merely concatenated on another, and an organisation-wide rule that governs the web experience does not reach anyone's terminal. A team that writes deliberately layered instructions — a broad default plus a narrow override — will get the layering it designed in one place and an undifferentiated merge in another. The documentation's answer to that is a single sentence telling you not to write conflicting instructions, which is advice rather than a mechanism.

Instructions are context, not a control

The concept documentation is candid that this is all advisory: the assistant "may not always follow your custom instructions in exactly the same way every time they are used," and they "do not guarantee that generated content will comply with a policy." Nothing in the instruction mechanism restricts what the agent may edit or run.

That is the right mental model and it is the one teams most often get wrong. An instruction file saying a path is off limits is a strong hint to a model, not a boundary. It belongs in the same category as a code comment, not in the same category as a permission rule or a pre-commit hook. If a file must not be edited, that has to be enforced by something that is not a prompt — the tool-permission mechanism, a hook, or review — and the instruction file exists only to make the common case go smoothly. A verification step that confirms the model mentions the rule confirms that the text was loaded. It does not confirm that the rule will hold.

There is one practical affordance worth knowing for exactly this reason: the CLI exposes a command that lists the instruction files discovered for the current session and lets you enable or disable them individually. That turns "which of my eight sources actually loaded?" from guesswork into a question with an answer, and it is the first thing to run when behaviour does not match the files on disk.

A contradiction in the documentation itself

One inconsistency should be flagged rather than smoothed over. The repository-instructions page — which is written for the web surface, not the CLI — states that instructions are available for use as soon as the files are saved. The CLI page states that changes are not immediately available in active sessions. Both can be true of their respective surfaces, but the pages do not say so, and a reader who lands on the general page and applies it to a terminal session will draw the wrong conclusion. Treat surface-specific pages as authoritative for that surface only.

Review checklist

Connections

See R395 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.