# Notes

> A Markdown notebook for each session, kept in your repo under .flow/notes, with pages, notes on code and PR diffs, task lists and diagrams.

The Notes tab is a notebook for one session: a folder of Markdown pages that lives in your repository, next to the code it's about. Write free text and task lists, pin notes to lines, files and folders of the repo or to a pull request's diff, and draw Mermaid diagrams. The pages are plain `.md` files, so you can @mention one in a [Claude Code](https://flow.worldbreakstudios.com/docs/cli/claude-code.md) session and the agent reads it, or have the agent write pages for you.

## Open the Notes tab

Any of these shows the session's Notes tab, opening it in the focused pane if it isn't open yet:

- The **Notes** tile on the New tab page (`⌘T`, when New tab opens the launcher, the default), subtitled "Session scratchpad". In the launcher it's `⌘5` (`⌘4` while web tabs are off).
- Right-click the **+** at the end of the tab strip and pick **Notes**.
- The **Notes** action in the command palette (`⇧⌘P`). It's unbound by default; bind `keyboard.new_notes_tab` in Settings › Keyboard.
- `flow-cli new-notes-tab` (see [From the command line](#from-the-command-line)).

Each session has one notebook and one Notes tab. If the tab is already open, Flow switches to it. A Notes tab stays with its session: you can't drag it into another one.

## Where notes live

A notebook is the folder `.flow/notes/SLUG/` at the top of the session's repository:

- The repo top is the git work-tree top of the session's directory. A linked worktree has its own notebooks, separate from the main checkout's. Outside a git repository, the folder sits in the session's directory itself.
- `SLUG` comes from the session's name the first time you open Notes, made unique among the open sessions in that repo (`-2`, `-3`…). Two sessions in one repo never share a notebook. Renaming the session keeps its notebook.
- When Flow creates a notebook, it adds `/.flow/notes/` to the repository's `.git/info/exclude`, so the pages stay untracked and ignored in every worktree.
- A new notebook starts with one empty page, `notes.md`.

The pages are the visible `*.md` files directly in that folder. Subfolders and other files aren't pages; the hidden `.outputs/` folder holds [notebook](https://flow.worldbreakstudios.com/docs/features/notebooks.md) outputs.

## Pages

The bar along the top lists the notebook's pages.

- Click a page to show it.
- **+** adds a page named `untitled-1.md`, `untitled-2.md`… and shows it.
- Right-click a page and pick **Rename…**. Type a name (Flow adds `.md` if you leave it off) and press ↩, or ⎋ to cancel. Flow refuses a name another file in the folder already has, ignoring case, and never overwrites anything.
- **Copy folder path**, at the right of the bar, copies the notebook folder's path.

The header under the bar shows the page's path, a **Preview | Markdown** toggle, and **Copy path**. Copy path copies the page's path relative to the repo, such as `.flow/notes/my-session/notes.md` (with `../` steps when the session's directory is below the repo top), ready to @mention in an agent session.

Flow has no Delete for pages, and closing the tab never deletes a file. To remove a page, delete its file; it drops out of the bar on the next refresh.

## Preview and Markdown

**Preview** shows the page rendered:

- Headings, paragraphs, bulleted, numbered and task lists, quotes and GitHub alerts, tables, links, bold, italic and inline code.
- Fenced code, syntax-highlighted when the fence names a language.
- Mermaid diagrams (`mermaid` fences), rendered on your Mac. Nothing is sent anywhere. Click a diagram to enlarge it; **Show source** / **Hide source** toggles its code.
- Task boxes you can click: a click checks or unchecks the box and saves the page at once.
- Issue and pull request references (`#123`, `owner/repo#123`, or a bare GitHub issue or PR URL) become chips with their state and title, and hovering shows a card. A bare `#123` refers to the repo's GitHub `origin`.
- `@path`, `@path:12` or `@path:12-20` naming a file or folder in the repo becomes a chip. Clicking it opens the file in a Files tab at that line, or reveals the folder.
- Each block has a ✕ that removes it from the page.

You can drag to select text in Preview and copy it with `⌘C`. Links open in your browser, or as `links.open_in` says; ⇧-click opens them the other way (see [Link router](https://flow.worldbreakstudios.com/docs/features/link-router.md#links-you-open-inside-flow)).

**Markdown** mode shows the page's raw text in an editor:

- Flow saves 700 ms after you stop typing. The header shows **Saving…**, **Saved** or **Not saved**. `⌘↩` saves now.
- Tab inserts two spaces. ⎋ leaves the editor.

## Notes on code and pull requests

Besides free text, a page can hold notes attached to something:

| Note | Add it from | Shows in Preview as |
| --- | --- | --- |
| Line note | A Files tab: drag down the note column (the **+** beside a line) or the line numbers. Or click **Add note** in a diff peek. | A card with the file name and range, the lines with one line of context, and **Open ↗** |
| File or folder note | A Files tab's explorer: right-click a row, then **Add note to file…** or **Add note to folder…** | A card with the path, its line or file count, and **Open ↗** or **Reveal ↗** |
| PR diff note | A pull request review tab: a diff row's menu, **Add note on line…** or **Add note on hunk** | A card with `owner/repo#N`, the file and range, the diff lines, and **Open ↗** back to the review tab |

The composer lets you pick the target page (**→ page ▾**, by default the page your Notes tab shows) and @mention files as you type. **Add note** (`⌘↩`) appends the note to that page. PR diff notes are personal: Flow keeps them in your notebook and never posts them to GitHub.

Files tabs show notes inline under the lines they're about, with **Open in Notes ↗**. See [Files](https://flow.worldbreakstudios.com/docs/features/files.md) and [Pull requests](https://flow.worldbreakstudios.com/docs/features/pull-requests.md).

- **Lines move, notes follow.** When the code a line note points at moves, the note follows it to the closest place those exact lines appear.
- **Nothing is dropped.** If a note's file or folder is gone, its card says "missing" and the note is kept as it was.

## The page format

A page is plain Markdown, and an attached note is an HTML comment marker followed by the note's text. A line note also carries a copy of its lines in a fence, which Flow refreshes on every save. The copy is there for anyone reading the file, an agent say; the marker decides what the note points at.

````markdown
A paragraph of free text.

- [ ] A task

<!-- note: src/main.rs#L10-L16 -->
```rust
fn main() {
    // lines 10 to 16 of src/main.rs
}
```
Why this loop retries.

<!-- note: docs/ -->
A note on a folder (a trailing slash), or on a file without a range.

<!-- note: pr https://github.com/acme/app/pull/42 src/main.rs#R10-R16 · hunk -->
```diff
+let retries = 3;
```
A PR diff note: R is the new side of the diff, L the old.
````

- Blocks are separated by a blank line. A note's text runs to the next blank line or marker.
- Paths are relative to the repo top, with `%`, `#` and spaces percent-encoded (`docs/My%20Notes.md`).
- `-L16` appears only for a range longer than one line. A tag such as ` · modified hunk` after the range is optional.

## Edits from outside Flow

Flow lists the notebook folder and re-reads changed pages about every 2 seconds, so pages an agent or another editor writes show up on their own. No edit is ever silently lost:

- Checking a task, removing a block or adding a note re-reads the file first and applies the change to what it holds now.
- If you were editing in Markdown mode and the file changed behind you, Flow saves your version beside it as `NAME-conflict-1.md` (then `-2`…) and reloads the page. The footer says so.
- A save that fails stays pending, shows **Not saved**, and is retried every 2 seconds. Pending edits are written before you switch page or mode, close the tab, or quit Flow.

## Notes on another Mac

In a mirror group, a session that runs on another Mac paired through [Puddles](https://flow.worldbreakstudios.com/docs/features/puddle.md), the Notes tile is "Session scratchpad on DEVICE" and opens the notebook that session keeps on its own Mac. You edit it here; Flow syncs it when the tab opens, about a second after each save, every 10 seconds while it's open, and once more as it closes.

- A page changed on both Macs keeps both: your edit is saved as `NAME-conflict-N.md`, and the footer names both pages.
- A page is removed on the other Mac only when you rename it away here.
- While the other Mac can't be reached, the tab stays open and its footer counts the changes kept here. They go out when it answers again.
- Only top-level `*.md` pages sync: at most 500, each at most 2 MiB.
- Copy path copies the path on the other Mac. Notes attached to code read "on DEVICE", and Open or Reveal says the file is on that Mac instead of opening anything. [Notebook](https://flow.worldbreakstudios.com/docs/features/notebooks.md) cells don't run.
- The tile is disabled with "Update Flow on DEVICE to use its notes here" when that Mac runs an older Flow, or "This session has no notes folder on DEVICE".

## From the command line

```sh
# Show the active session's Notes tab (or a named session's)
flow-cli new-notes-tab
flow-cli new-notes-tab --group work

# Rename a page of that Notes tab (.md added when missing)
flow-cli notes-rename-page notes.md design ideas

# Check or uncheck task 0 of block 2 on the shown page (both count from 0)
flow-cli notes-toggle-task 2 0
```

`new-notes-tab` replies with the repo top (`root`), the notebook folder (`folder`), the shown `page` and the list of `pages`. An agent can write pages straight into that folder; the tab picks them up within a couple of seconds. See [flow-cli](https://flow.worldbreakstudios.com/docs/cli/flow-cli.md).

## Limits

- Sessions on a remote host have no Notes ("Not for remote sessions"), and neither does a session without a directory of its own. PR diff notes are off in a remote group ("Notes are local only"). See [Remote hosts](https://flow.worldbreakstudios.com/docs/sync/remote-hosts.md).
- Only the visible `*.md` files directly in the notebook folder are pages.
- A page that isn't UTF-8 text shows "Could not read …" and is never written.
- A Mermaid diagram's source can be at most 50 KB.
