Skip to main content

Trusted directories

At startup you are asked whether you trust the working directory.

  • Trust it (y) and a rule covering the whole tree is written, so ordinary work proceeds without a prompt for every edit. The answer is written down as well, so later sessions started in that directory are not asked. See Remembering the answer.
  • Decline (n) and nothing is written, so nothing is trusted and every write is shown to you first. You can still work in the directory. A decline is not kept, so the next session asks again.
  • Leaving at the question starts no session. It takes Ctrl-C twice, because a program writing into your terminal, such as an editor activating a virtualenv, can send one Ctrl-C by itself.

A question like this is answered only by a key that arrived on its own. Several keys arriving together are a paste or another program typing, so they answer nothing and are carried to the input box instead, where you can read what they were.

That record is the trust map, and it is the thing every read and every write consults.

A session started with --dangerously-skip-permissions is the one exception: the question is not put at all, and the map is the one a yes would have written. That mode already approves vouching for every unvouched file the planner reads, so the tree becomes trusted a file at a time either way. A resume still takes the map from its own record even there. See modes.

Nothing is trusted until it is granted​

An empty map trusts no path. Trust is granted by a person, and never inferred from silence, from a path's shape, or from anything a model or a file said. That is what makes declining at startup mean something.

How a path is matched​

Rules are keyed by path prefix and matched by whole segments, and the longest matching prefix decides. Both polarities are expressible, so a trusted tree may hold an untrusted subtree, which may hold a trusted path again. Equivalent spellings of a path are one rule, and a later decision replaces an earlier one.

That is what lets @vendor/lib.js be trusted inside a vendor you marked untrusted, without the answer leaking to its siblings.

Every rule is keyed on a full path, and there is one set of them. You may name a file relatively, which is how a file in the project is named, and the map reads that under the working directory: src/main.rs in a session working in /work is a rule about /work/src/main.rs, and the project's own rule is /work. So the project is a path like any other rather than a prefix covering everything, and a directory you opened by name sits in the same map without reaching into the project: ~/notes does not prefix ~/proj, and whole-segment matching is what stops a rule about ~/proj covering ~/proj-secret.

A rule about a directory that does hold the project covers the project's files, because you vouched for a tree the project is in. The project's own rules are the more specific ones and still decide wherever they exist, so a no given inside the project is not undone by a yes given above it.

A rule is about a path, not about the files that were in it when the rule was made, and it is consulted when a file is read rather than when the rule is written. A file that appears in a trusted directory afterwards is therefore read as trusted, whoever put it there.

Which name a path is asked about under​

A path is reduced to the open directory it lands in, and takes that directory's recorded name with the rest of the path as it was spelled. The open directories are the working directory and the ones you opened by name, each under the path its name resolved to. So a file in the project reaches one rule whichever way it is spelled: naming it in full finds the rule its relative name wrote, and vouching for it under either spelling records the same rule.

This is what makes two spellings of a directory one rule, including the spellings only the filesystem can tell apart. A directory named through a link is the same directory, which matters on macOS where /tmp and $TMPDIR are both links: without this, a file you vouched for would be quarantined under half its names.

Two paths are asked about exactly as written, because neither has a spelling under a recorded name: one landing in no open directory, and one reaching an open directory through a link straight into the middle of it rather than through that directory's own name. Nothing covers either.

A directory whose resolved name cannot be keyed is refused rather than opened. A key is spelled from /, so /add-dir and /cd both refuse a path that is not, rather than recording a rule under a name that would be read as a path inside the project, where your answer at startup covers it. On Windows that is every path there is, so opening a directory by name is unavailable there for now.

Case is folded only on a volume that folds it. Where Docs and docs open the same file, a rule about one decides the other, in both directions, and where rules disagree about the spellings the least trusting one decides: untrusted over undecided over trusted, whichever sorts first. Trusting docs does not undo a distrust recorded for Docs. A decision about one spelling replaces only that spelling's rule, since some volumes can hold claß.md and class.md apart. A trust under claß.md therefore leaves class.md undecided, while a refusal of either name is read for the other. Where the working directory's volume keeps the spellings apart, a rule about Docs decides nothing about docs. Where the volume cannot be asked, it is read as one that might fold, for what withholds trust: a distrust, an undecided boundary and the reservation that refuses a second writer all reach both spellings, so a file untrusted as .env is untrusted as .ENV and a second write under .ENV is refused. A trust still compares bytes there, so trusting Docs decides nothing about docs.

A refusal reaches every spelling Unicode makes one name. An accented name can be written as a letter followed by a combining accent mark or as one precomposed letter. Unicode treats the two as one name, and a volume such as APFS opens one file under either. A file you refused, or one a fetched page was written to, stays untrusted whichever of the two the model types. The map cannot ask the volume whether it keeps the two apart, so the refusal reaches both. A trust does not: vouching for one spelling decides that spelling, and where a refusal is recorded for the other the less trusting rule decides.

What a write does​

Every row here is exact. A write matching a row does what that row says and nothing else.

datadestinationprompt?effect on the map
trustedtrustednounchanged
untrustedtrustedyesthat path becomes untrusted
trusteduntrustednothat path becomes trusted
untrusteduntrustednounchanged
eithernever mentionedyesthat path takes the data's trust

A prompt here asks one question and only this one: may this path stop being trusted? That is the only consequence a later step cannot undo, since a path recorded as untrusted can no longer be examined or edited.

  • Writing trusted data never asks. Trusted data means the turn observed nothing untrusted, so it holds no byte an attacker influenced, and the destination only ever gains trust.
  • Untrusted data into a trusted path must mark it untrusted. This closes the round trip: written into a trusted tree and read back as trusted, untrusted bytes would launder injected text into trusted input, and the map would become a bypass for the gate it exists to support.
  • A path nobody has mentioned asks either way, because there is no decision behind it yet, and the first write there is the moment to ask.

Reconciliation marks the exact path written, never the parent. One untrusted file does not taint its siblings, and marking the parent would turn a single fetched page into a project nobody may edit.

Every way a rule gets written​

Each grants exactly one thing, and grants it because a person made a gesture, never because anything inspected content.

GestureWhat it grants
yes at the startup questionthe whole working directory, for this session and every later one started in that directory (or below it, where it is a git root), until /forget-trust or Forget in the desktop app's permissions. For this session only where the answer cannot be kept
@path or --filethat one file, for the rest of the session
dropping a filethat one file, wherever on disk it is, plus reach to it
/add-dir <path>that directory: reachable and trusted, for this session
/cd <path>that directory, as the new working directory, for this session
yes at a quarantined readthat one path, for the rest of the session
yes to a directory your settings file namedthat directory: reachable and trusted, for this session

Each name in permissions.additionalDirectories in your settings file is put to you as its own question when the session opens. Accept one and it is opened by the route /add-dir takes and trusted on the same terms, which is what keeps a directory you named in a file and one you typed from being reachable on different terms. Decline and it is neither reachable nor trusted. Leaving at any of the questions starts no session.

The question shows the path the name resolved to rather than the name as it was written, because opening a directory follows a link wherever it leads: a box showing the spelling would collect an answer about a different tree. A name that cannot be opened is reported rather than asked about, and a directory two layers both named is one question.

A settings file names a destination and grants nothing, which is why each name is a question. The layers a checkout carries arrive with the checkout, so a name that opened a directory by itself would be reach and trust granted by whoever last edited the file. The cost is that a file naming thirty directories is thirty boxes before you can type anything, and Ctrl-C is the way out of a list you do not want to answer.

A session resumed with its own map is asked none of these and opens none of them, since the directories it has open are the ones its own record reopened. /clear closes the ones that were open and opens none.

The quarantined-read prompt​

When a turn reads a file nobody has vouched for, you are shown the path and the first lines of it and asked whether to trust it:

╭ let the model read this file? ────────────────────────────╮
│Trust game.js │
│ │
│ the check found no attempt to give instructions in this │
│ │
│ the model cannot read this file, so it is working blind │
│ on it. Vouching lets it read this file for the rest of │
│ this session, here and in every later read. │
│ │
│┃ const SPEED = 100; │
│ │
│ y trust it n leave it quarantined ctrl-c stop │
╰───────────────────────────────────────────────────────────╯

Yes writes exactly the rule @ would have written, so it stays consistent for every later read. The prompt shows the full path the rule will be held under, below the file's name, so a rule wider than the name reads as wider. A name that is empty, is only whitespace, has a space at either end of it or of a directory in it, holds a character that draws as nothing (a zero-width character, a bidirectional control, a no-break space) or as a blank cell (the blank braille pattern), or holds a literal " or a literal Control Pictures character (U+2400 to U+243F), is drawn in quotes with each such character spelled out, so it cannot read as another name. A literal backslash is written \\ once a name is quoted for one of these reasons, and a name that is otherwise plain, such as a Windows path, is drawn as it is. The terminal and the desktop window also spell a byte of a path that is not part of a UTF-8 character as \xNN, so two paths that differ only in such bytes are not drawn alike. The prompts for a write, an overwrite and an edit, for reading a credential, for a path programs may reach and about a directory, the names a checkout's removal would delete, and the files a run would write and the directories it is confined to, draw names the same way, and so do the line a call about a file draws in the transcript, the lists of files a turn wrote, read or changed, and the startup notes about an allow rule a checkout proposed. A search for a pattern is drawn as written. The question is asked once per path per turn, and only where the read is quarantined, except that a yes given after the file may have changed while you were answering is thrown away and the next read of it asks again. Declining leaves the file as it was and the turn carries on with a reference.

The startup trust question an editor, the desktop window or the mobile app shows draws the directory and the file a yes is kept in the same way. So do the desktop window's notice that a yes was kept, its list of what is kept and its list of the allow rules a checkout proposed, and the mobile app's write, run and trust cards. The terminal's trust questions also draw the file a yes is kept in and the file each proposed rule came from this way.

The line above the preview is a check reading the whole file, not the few lines you can see, because a yes grants the whole file. It decides nothing: a yes writes the rule whatever the check said, and a no writes nothing whatever it said. It is there because the preview alone left you answering the question that grants the most with the least in front of you.

A character in the preview that draws as nothing is written out. A zero-width character, a bidirectional control, a variation selector or a tag character is drawn as ‹U+XXXX›, and a sentence above the preview says how many there are. Only the lines shown are written out and counted. The planner receives the file as it is.

A preview that is the beginning of a longer file says so. When the file has more lines than the preview, every front end adds a line after the preview saying it is the beginning of the file and not all of it. A file that fits in the preview has no such line. A blank preview of a longer file says the file continues, and does not say the file is empty. The line decides nothing: a yes writes the rule whatever it said.

What the file holds decides nothing about whether you are asked. A file with nothing to show, because it is empty or does not read as text, is asked about like any other, and the prompt says so where the preview would be.

What does decide it is the path, and only a path naming a file is offered. Never a picture, because a yes grants that a file's text may be read and a picture's text is never read whatever the map says. Never a directory, and never a path naming nothing: a yes writes a rule covering everything beneath the name it was given, so a box titled with one file would hand over every file beneath the name at once, over a string the planner chose rather than one you typed.

A yes is not spent if the file may have changed while you were asked. If the file changed, or a run line started while the question was open, the yes is thrown away, the file stays quarantined and the read says so. A program can rewrite files its line does not name, so the text you read in the preview may no longer be what the file holds. Where the permission mode vouches in your place, nobody read a preview, so only a change to the file throws the vouch away, and a run line that started meanwhile does not. Where a change does throw it away, the read says that the mode answered and nobody was asked.

/add-dir​

/add-dir ~/notes

records a rule under that directory's own path that does two things together: the directory becomes reachable, since a path outside the project is otherwise refused whatever the map says, and it is recorded as trusted. Either half alone is no use. One leaves a rule about files nothing can open, the other a directory that prompts on every edit.

It lasts the session, --resume carries both halves, and /clear closes it. A directory already inside the project is refused. A directory a resume cannot open again, because it has moved or gone, says so rather than being passed over.

The path may also be relative to the working directory: /add-dir ../notes opens the directory beside the project and /add-dir ../ the directory that holds it. A leading ~ is read first. What is opened, trusted and named in the note is the directory the path resolves to. A relative path is refused where the working directory's name is not text. /add-dir close takes the same spellings.

/add-dir close ~/notes

closes that one directory and takes both halves back, without ending the conversation. A file only it reached is refused again, and its trusted rule goes. Where a directory above it is trusted, the closed one is left undecided rather than trusted through that one. A rule there that distrusts a file stays, so closing never makes anything more trusted. A later resume does not reopen it.

A directory that holds the project is not refused, and its rule covers the project's files as it covers everything else in that tree. Vouching for a directory is a standing statement about the place, and the project is in it, so there is nothing to except.

The command-line --add-dir grants the trusted half only where the run trusts its working directory. The gesture behind that half is a person naming the path where they have already answered for the directory they are working in. A one-shot run given --trust-workspace, or one a kept answer trusts, has that answer, so the directories its command line opens are trusted with the working directory. A run that trusts nothing can reach the directory and vouches for nothing in it.

A refusal for a path outside the project says what to open. When a file tool is given an absolute path outside the project and every directory you opened, the refusal tells the model to ask you to open the directory the file is in with /add-dir or --add-dir. If the path names a directory, that directory is the one to open. A name nothing is at yet is offered through the directory it is in, as a file is. Only a read is also told the file can be dropped on the window, and a read of a directory is not, since a directory cannot be dropped. In a run nobody can be asked in, the refusal names no /add-dir, --add-dir or drop and asks the planner to say which path the work needs. The refusal names /add-dir alone: with permissions bypassed the file tools reach such a path with no request and the refusal is not given, outside the paths a granted request refuses (request_path). An absolute path that lands inside the project is refused with "is inside the workspace, and a path there is named relative to the workspace root", and no directory is offered, since opening one would change nothing. A path with .. that lands inside the project is refused with "contains '..' and lands inside the workspace" and the instruction to name it relative to the workspace root without the .., and no directory is offered for it either. A refused write is not pointed at an unconfined run line in either case.

Moving the working directory​

/cd ~/projects/other

makes that directory the working directory and vouches for it, on the same terms /add-dir uses: you typed the path, and a later decision replaces an earlier one. See /cd for everything else it moves.

The map says what it always said, and carries nothing with it. Every rule names the file it always named, because every key is a full path. What changes is only which rules a relative name reaches and how each is spelled back to you. So a yes given for one project does not become a yes for another, and a no given inside the old one is not forgotten. That grants nothing and withdraws nothing, which is what makes it something bravebot can do without asking you.

With readsStayInWorkspace set, /cd may move further into the tree and not back out: a parent or a sibling is refused, as is a name inside the tree that reaches outside it. See Configuration.

Anything overlapping the new working directory closes: the directory you left, and any /add-dir directory holding it or sitting inside it, each said out loud as it happens. A directory reachable through the new root as well as under its own name would leave two names for a path to be asked about under, with nothing to choose between them.

Reach stays confined​

No rule extends reach. Reading, writing, editing, listing and searching are confined to the working directory and to whatever has been opened beside it, the directory the session was given among them. .. and absolute paths outside those are refused rather than resolved, in an added directory exactly as in the project, and a symlink leaving one is refused. A path with .. in it is allowed only where it lands in a directory that is already open (../worktree/file.rs beside the project, for example), and it is then treated as the absolute path it lands on, so rules, trust and the audit trail see that one spelling. A .. that goes through a symlink, lands back inside the project or lands on a name that is not valid UTF-8 is refused. One that lands back inside the project is told to be named relative to the project root without the ..; the others are refused as leaving the workspace. A relative path always means the project, never a directory opened beside it.

Confinement is about where an operation lands rather than how its path is spelled, so it holds for a file that does not exist yet: a write creates what it names, and a symlink out of the tree is refused whether or not there is anything at the other end of it.

A directory of the session's own​

Every session is given a directory of its own in the system temporary directory, created as the session opens, and it is somewhere to put an intermediate file. A one-shot run has one for as long as it runs. A session that cannot be given one runs without one and says so. On macOS and Linux, one left behind by a session that was killed rather than closed is removed as the next session opens.

On Unix it is made inside a directory of your account's own in the temporary directory, named bravebot- and your numeric user id, so opening a session does not wait on how many entries other programs have left in the temporary directory. That directory is used only where it is a directory your account owns, and is not removed with the session's directory. Where it cannot be used, the session's directory is made in the temporary directory itself. The first start that makes it also removes, once, the directories of killed sessions that stand directly in the temporary directory.

The session records which directory it made. Every program may write the temporary directory, so the name could be made to lead elsewhere. A program is refused when it starts once the name leads to a link or a file, and for the rest of the session. A name that leads to nothing, or on Unix to a different directory because the directory was removed or made again, is not granted to programs, and the programs after it still start.

/status reports it as the session's own, on a line of its own rather than among the rules, because it is reachable without any rule covering it.

A program a run starts is told where it is, through BRAVEBOT_SCRATCH_DIR in the environment of every stage of the line, in the background as in the foreground. An assignment of that name on the line itself wins, as it would in a shell. A session with no directory of its own sets nothing, so a program finds the name absent rather than pointing somewhere that is not there. The planner is told the same path at the same point, since a variable nothing knows to read is a variable nothing reads. $TMPDIR for such a program stays whatever it was.

A delegate is given a directory of its own inside the session's, named from its number, made as it starts and removed when it ends, and BRAVEBOT_SCRATCH_DIR for the programs it runs holds that one, so delegates started together do not overwrite each other's files. Where one cannot be made the delegate keeps the session's, and says so to the model. Reach is unchanged: a delegate can still name the directory of another delegate by its path, and a stage of a delegate writes the session's directory as any stage does.

The reason this exists is that the alternatives are worse. A file in the project is one a build, a test run, a git add -A and a reviewer each have to deal with, and one somebody has to remember to delete. Reaching /tmp instead would mean /add-dir /tmp, which vouches for whatever every other process on the machine has left in a world-writable directory in the same action.

What it is trusted for, which is nothing extra​

A path under it resolves, so a file there is read, written, listed and searched by its absolute path. The temporary directory it sits in is not reachable, and a path leaving the session's own directory is refused exactly as one leaving the project is. Neither /add-dir nor /cd will take it.

Nothing is trusted for being there. The directory carries no rule of its own, so a path under it that no rule covers is answered by whatever you said about the workspace, which trusts nothing where you declined. Per file the answer is the one a write records, marking the exact path written. A line whose output is untrusted distrusts the file it redirected into here as anywhere else, which is what stops a turn reading its own untrusted output back as trusted.

It is a place to write, not a place where writes stop being asked about. A path under it appears in a plan's write set, is shown in the prompt, and takes every write gate a path in the project takes. What it buys is a fixed place that needs no name invented for it, that your repository does not report, that no search has to skip, and that goes when the session does.

Nothing in it outlives the session​

The directory goes as the session ends, with everything in it, whether the session ended by being left or by an error on the way out. A session that carries on from another is given its own: a resume, a fork, and the session /clear begins each open a new one, and the directory belonging to the session they followed is removed rather than handed on. A resume can come days later, and bytes surviving that gap would be a cache nothing evicts.

An undo does not reach in here. A file a turn wrote in this directory is neither restored nor removed, and it is not named among the paths the rewind could not put back. What a turn keeps so that it can be undone is a bounded amount shared by every file that turn wrote, and an intermediate file is exactly the size of thing that bound is set to stay clear of: keeping one would spend what a source file's own copy needed, so the file you want undone would lose to the file nobody does.

How long an answer lasts​

The map belongs to the session, not the directory. A session start asks unless an earlier yes was kept for that directory (below). A decline is never kept. /clear begins a session and therefore asks, on the same terms.

--resume does not ask: it restores the map from the record of the session you chose, because the answer honoured is the one that session's own user gave. It also carries the rules that session's writes recorded, which is what stops a resumed turn reading back a file an earlier turn of the same session poisoned. A record from before maps were kept has none, and is asked about.

What the record keeps is the name rather than the key. A rule inside the project is written down relative to it and a rule outside is written down in full, and a resume puts the resuming directory back on the relative ones. That is what keeps a record about the same files after you move or rename the checkout: full paths on disk would each name somewhere that is no longer there, nothing would match, and the session would resume as though nobody had vouched for anything.

The question grants standing permission, and it says that a yes is kept: what it covers, how to take it back and the file it writes are on the screen before you answer. In the desktop app the yes stays closed, with a line saying how many are left to read, until the directory and each of those lines have been on screen; a long directory scrolls inside its own box, and the no is always open. A yes is honoured on narrower terms than it is given on.

Remembering the answer​

A yes at the startup question trusts the directory and writes the answer down, one file per directory under ~/.bravebot/trusted. Both the terminal and the desktop app read and write the same file, so a yes kept in one is honoured by the other. Nothing is written inside the project, so a checkout cannot supply or change it.

Where a yes cannot be kept, the question says so and the yes trusts that session only. That is the case at your home directory, a directory holding it or a filesystem root, where the filesystem cannot say when the directory was made, and in an incognito session.

A later session started in that directory is not asked, and says so as it opens. In the terminal:

trusting /home/me/projects/app (you trusted it 3 days ago; /forget-trust to be asked again)

The desktop app says the same at the top of the conversation, and points to its permissions.

It covers less than a yes does:

  • That directory, and below it only for a git root. A session started in the directory itself trusts everything below it, as a yes there does. A session started below it is not asked where the directory is the root of a git worktree, which is the nearest directory above the session's that holds a .git entry. A nested repository or a submodule is below its own root and is asked unless it was answered about itself. A directory above the one answered about is asked: a rule about a directory covers everything below it, so a yes kept about ~/projects would otherwise answer for a session started in any repository cloned there afterwards.
  • That directory, not its name. The answer records which directory was at the path, by when it was made and, except on Windows, its number on the disk. One deleted and made again at the same path, such as a fresh clone, is asked about. On Windows the time is all there is to go on, and a clone deleted and replaced within seconds can be given the old one's time, so it is taken for it.
  • The rule a yes writes, and nothing else. What the earlier session went on to record, a file it marked untrusted included, is not carried. That is the first cost below, and a kept answer does not close it.
  • Whether confined lines run without asking. The question says that a command the sandbox confines then runs in the directory without asking (the run tool). An answer kept before the question said so, and a session resumed from a record that predates it, keep asking about every line until you answer again. The newest kept answer for a directory decides.
  • Not everywhere. It is not kept at a directory your settings file named, with --dangerously-skip-permissions (which asks nothing and writes nothing), or in the cases above. An incognito session still honours a yes an ordinary one kept.

Whenever it is in doubt it asks: a missing or unreadable record, one about an earlier directory at the path, or a line about this directory that this build cannot read all mean the question is put.

bravebot --plain puts the same lines before its question, keeps a yes the same way, and honours a kept yes, saying so as it opens and naming the file that holds it: delete the lines about the directory from that file to be asked again. A line that is not yes declines and keeps nothing.

/status says when a kept answer is in force and names its file. /forget-trust removes it: the session you type it in keeps the map it has, and the next one started there asks. In the desktop app the session's permissions show the kept answer, and Forget there does the same.

Reading the map back​

/status

lists every rule in force, however many there are, so what a line vouched for does not have to be remembered. A rule is listed under its name spelled as the prompts spell one, so a rule about a name made of whitespace, or ending in it, is not a row that reads as nothing. The project root is listed as . in the terminal and as the project root in the desktop window. The session's own directory gets a line of its own there, since it holds no rule to list. Where a kept answer will trust the working directory in later sessions, the line under it says so, when you gave it, and which file holds it.

~/.bravebot is not governed by this​

Your own directory is read as trusted by provenance rather than by any rule here: putting a file there is itself the grant. A project's own files are not covered by that and are read through the map, whatever their names. See Instructions.

Known costs​

All of these are deliberate.

  • A fresh session forgets what an earlier one poisoned. The rule that untrusted data marks its destination untrusted holds within a session and across a resume of it. Across a fresh start it cannot, because the map it was recorded in is gone. If a file holds content you do not trust, say no to the directory, or do not leave it there.

  • A file another process drops into a trusted directory is trusted. A rule is about the path, so npm install, git pull, an editor, a background daemon, or a program the agent was allowed to run can all put a file inside a vouched-for tree and it will be read as trusted. This cannot be closed by watching the filesystem: by the time anything noticed, the question would be whether to distrust a file you may have created yourself, and asking that on every change would make the map useless.

    A redirection is the one exception, because bravebot opens that file itself: what a line writes through > or >> is recorded, so a program's output redirected into a vouched-for tree marks the path it landed on untrusted. A file the program opens on its own, which is cmd -o notes.txt or anything a build writes, is not.

    A command the sandbox confines, in a directory whose question said such commands run without asking, is still asked about when its own arguments name a file you have not trusted and it can change files, so cp fetched.md AGENTS.md is shown first. A command that names no such file in its arguments, such as sh -c, python3 -c or make, is not, and neither is one the audited list proves read-only, such as cat fetched.md.

    Said plainly: trusting a directory trusts what lands in it, so a tree that a build or a dependency manager writes into is a tree you are vouching for ahead of time.

    The session's own directory meets this more often without changing what it is. Writing a file and reading it back is incidental in a project and is the whole purpose of that directory, and cmd -o into it is the ordinary case there rather than the odd one, so the redirection exception covers less of the traffic. No rule about that would help, since the same writes are available one directory up.

  • A kept yes trusts what arrived while nobody was asked. A session started from a kept yes trusts its directory as a yes given at its start would, so both costs above apply to it. What it loses beyond a yes is the question itself: the moment after pulling a branch or adding a dependency when you might have answered n. The line the session opens with, /status and /forget-trust are what is left of it.

  • A link or a mount that the lookup cannot see leaves one file with two names, and each name is its own rule. A rule is keyed on the path an operation spelled, while confinement resolves where that path lands. On Linux and macOS a read, a write and a second writer are also checked under the other names the file has: where a symlink lands, its hard links, and its name beneath a second path to the same tree, such as a macOS firmlink or a Linux bind mount. Opening a second path to a tree that is already open is refused, so that last case is a pair that became two paths after both were open. So content written as untrusted through one name is read back as untrusted under the others. That lookup stops at the search cap and at a directory it cannot list, and the file is then read as untrusted. It is not made on Windows, so there a hard link or a second path to a tree is still two rules, and content written as untrusted through one name is read back as trusted under the other. Spellings that differ only in punctuation or letter case are a single rule. If a tree holds a link to somewhere else inside itself, that is a tree to say no to.

  • Confinement is settled before an operation runs, not while it runs. Where a path lands is worked out by resolving it, and the read or the write happens after that. A tree already arranged to escape the project is refused. A tree rearranged in the window between the two, so that a directory resolved on the way in is a symlink by the time the file is opened, is not.

  • An undone turn's intermediate files stay until the session ends. Nothing written in the session's own directory goes back, so a turn that wrote one there and was undone has left a file a later turn in the same session can read. The directory goes when the session does, and what is in it is the workings of a turn rather than anybody's work in progress.

  • Confinement does not keep a confined program out of the session's directory. A program that cannot open a temporary file fails outright, so a confined run is allowed the system temporary directory, and the session's own directory is inside it. Narrowing that to the one directory would leave a compiler or a package manager nowhere to write. So a confined stage can read what a turn left there without its plan naming the path. A program run starts is unconfined, so this arrives with the profile rather than before it.