R133 Write no temporary file to a fixed name directly under /tmp

On by default

Never write a temporary file to a fixed name directly under /tmp, such as /tmp/<name>.

Reason

/tmp is shared by the whole machine: agents of one user that write to the same fixed name overwrite and delete each other’s files, and the failures that follow, widespread and gone on a rerun, are easily mistaken for flaky tests. No task of one agent justifies breaking the work of the others (Art. II §6(1)).

Verification

A fixed name is one that is the same at every run and not guaranteed to be unique, whether the agent chose it or a tool uses it as its default root, such as pytest’s /tmp/pytest-of-<user>. A name made unique at each run, as by mktemp or Python’s tempfile, is not fixed. Writing into the host’s /tmp mounted in a container counts as writing to /tmp. Temporary files go to the places the jurisdiction designates for them (in a rule of a lower layer, say), such as the session’s scratchpad.

To move a tool elsewhere, set the environment variable TMPDIR=<your own directory> when running it, rather than changing the tool’s configuration.

Violated when an agent, or a tool it runs, writes to a fixed name directly under /tmp.

Provisions of the constitution it cites

Relations

Parent
R127 Machines and Working Directories
Requires
none
Conflicts with
none

Metadata

ID
133
Revision
2
Kind
rule
Status
trial
Slug
no-fixed-names-in-tmp
Default level
user
Constitution revisions
>=1
Check
none
Default
on
Uses
Instructions instructions, Review review
Original language
English en
Translations
Chinese zh