Skip to content

Guidance for agents (.stamp/AGENTS_GUIDE.md) ​

.stamp/AGENTS_GUIDE.md holds what you want every agent to know when it works in a repository: "open pull requests against develop", "run make check before you push", "never edit generated/". Stamp shows the text to agents at the moments it applies. It is guidance only: nothing waits on it, and no push or pull request is refused because of it.

Where agents see it ​

  • After an accepted branch push. Below the acceptance lines and the next stamp pr create step, as remote: lines in the output of git push. It is shown once per push, and only when the push wrote a branch (not for a tag or a deleted branch).
  • After stamp pr create. Below the created pull request and its next steps. With --json, it is the repositoryGuide field of the answer.
  • On request. stamp repo guide OWNER/REPO prints it. Any agent or person of a server whose GitHub App covers the repository can run it. A repository without the file prints "OWNER/REPO has no guidance for agents on this server."

It looks like this:

text
Guidance for agents from acme/api (.stamp/AGENTS_GUIDE.md on main):
  Open pull requests against develop, not main.
  ...

Stamp reads the file through GitHub, so GitLab repositories do not show it, neither after a push nor on a merge request.

Read from the default branch ​

Stamp reads the file from the repository's default branch, and only from there. Editing it on another branch, or in a pull request, changes nothing until that change is merged into the default branch.

To change the guide, open a pull request that edits .stamp/AGENTS_GUIDE.md and merge it.

When a change shows up ​

Stamp keeps the file in memory, per server and repository:

  • For 5 minutes after reading it, Stamp shows its copy without asking GitHub.
  • After that, the next read still gets the copy at once, and Stamp checks GitHub for a newer file in the background. The read after that shows the new text.
  • A deleted file is remembered the same way, so it can take as long for the guide to disappear.

So after a change is merged, agents can see the old text for up to 5 minutes, and for a few seconds more (up to 10) while Stamp fetches the new file.

If GitHub cannot be read (an error, a rate limit, a timeout), Stamp does not ask again for 1 minute, or until the rate limit resets when GitHub says when, up to 10 minutes. Meanwhile it keeps showing its last copy. It stops showing a copy 1 hour after it last read GitHub successfully, until a read succeeds again.

What is shown ​

  • The text is shown as it is, each line indented by two spaces. Markdown is not rendered, so write plain sentences and lists.
  • Line endings become plain line breaks. Control characters other than tabs (terminal escape codes among them) are removed, and trailing spaces are trimmed.
  • At most 4,000 characters are shown. A longer file is cut at the last line break before that point (a single line longer than that is cut at exactly 4,000), and a line says "(shortened; the whole guide: link)" with a link to the file on GitHub (or just "(shortened)" when Stamp has no link).
  • An empty file, or one that is empty after cleaning, counts as no guide. So does a directory at that path.
  • GitHub's contents API does not inline files over 1 MB. Stamp cannot read such a file: nothing is shown after a push or a pull request, and stamp repo guide reports a failed read.

When it cannot be read ​

After a push and after stamp pr create, Stamp waits at most 2 seconds for the guide. If the file is missing, cannot be read, or is slower than that, nothing is shown, and the push or the pull request goes on as usual. A slow read keeps going in the background (up to 10 seconds), so the next push can show the guide. Only a read with no usable copy in memory (the first one, or after the hour above) waits on GitHub; other reads answer from memory.

stamp repo guide reports a failed read instead: REPOSITORY_GUIDE_UNAVAILABLE. Run it again; it changes nothing. A repository your server's App does not cover is REPOSITORY_NOT_FOUND.

An example ​

text
This repository is the public API. Before you open a pull request:

- Target develop. main is for releases only.
- Run make check; CI runs the same and fails on any warning.
- Do not edit files under generated/: run make generate instead.
- Changes to migrations/ need a reviewer from @db-reviewer (see .stamp/CODEOWNERS).

Ask in #api if anything here is unclear.

Next ​