# Files: Notes and folders (/en/docs/files/notes)

This page helps you bring your notes into files and keep your own notes there. You can add a folder of
Markdown files or an Obsidian vault, search its documents, and write notes about people, messages and
projects. files imports your folders without changing them. `notes edit` can change a source note; `notes export` writes files.

There are two kinds of notes:

- **Notes from your files.** files reads them from a folder you choose. To change one, edit the file
  and import again. Their references look like `document:3`.
- **Notes you write in files.** They live in the local store and can be about a person, a message, a
  project or another note. Their references look like `note:12`.

## Add a folder [#add-a-folder]

A folder can be any folder of notes on your computer: project notes, a folder of documents or an
Obsidian vault. files reads the folder and all the folders inside it.

**The easiest way: ask your agent.**

```text prompt
Use the WireCat files CLI to add my notes folder at /path/to/notes and import it.
Tell me how many notes it found and which files it could not read.
```

**Or run the commands yourself.** Replace `/path/to/notes` with the full path of your folder.

```sh
files folders add /path/to/notes
files sync --no-embed
```

files picks the format for you. A folder is an Obsidian vault when it, or a folder above it, has Obsidian's own
`.obsidian` folder: files reads it as `obsidian`. Any other folder is `markdown`. With `--json`, the answer has the
`format` and `format_from`: `detected`, `option` when you gave `--format`, or `saved` for a folder files already knew.
To choose yourself, add `--format`:

```sh
files folders add /path/to/notes --format markdown
```

`files folders add` prints the folder's ID, for example `1`. `files sync` reads the notes and
reports how many it found:

```text
/path/to/notes: 24 notes, 24 changed, 0 moved, 0 gone
```

`--no-embed` skips the preparation for search by meaning, so you do not need the search model to
start. Run `files sync` again after you add or edit files; only the changes are read.

With `--json`, `files sync` also writes one progress line at a time to stderr while it reads each folder, at most two a
second. It holds counts only, never a file name:

```json
{"event":"progress","step":"notes","done":120,"total":480,"unit":"files","label":"1"}
```

`label` is the folder's ID.

You can add more than one folder. `files folders list` shows them all. A folder inside or around one files already
reads is refused (reason `folder.overlap`), because each shared file would be two notes. `files doctor` names such
a pair in an older config.

### Remove a folder [#remove-a-folder]

```sh
files folders remove /path/to/notes               # files stops reading it; its notes stay searchable
files folders remove 1 --allow-delete --yes       # also deletes its notes from the store
```

Without `--allow-delete`, the notes stay in the store and `files folders list` shows the folder as not on this
computer. With it, files deletes the folder's notes and their text from the store. Your files are never touched, so
`files folders add` reads them again. Without `--yes`, files says how many notes it would delete and changes nothing.
The store keeps the folder's ID, so `files folders update` can connect it again.

### Markdown or Obsidian [#markdown-or-obsidian]

The format tells files how links and tags are written in your notes. You do not need Obsidian to use
files, and Obsidian does not need to be open.

| | `markdown` | `obsidian` |
|---|---|---|
| Links to other notes | Markdown links to the file (below) | `[[Other note]]`, `[[Other note\|label]]`, also with `#heading` |
| Tags | the `tags:` field at the top of the file | the `tags:` field and `#tags` in the text |
| Other names for a note | | the `aliases:` field |

A link in a `markdown` folder looks like this:

```md
[label](other-note.md)
```

In a `markdown` folder, a `#word` in the text is not a tag. Both formats understand links written as
references, such as `[Kai](person:7)` or a bare `msg:telegram/1/77/42`.

An **Obsidian vault** is a folder of Markdown notes that Obsidian opens as one workspace. files skips
hidden folders such as `.obsidian`.

To change a folder's format, add it again with `--format`, or use `files folders update` with `--format`. The next
`files sync` reads every note of that folder again, so a `#word` read as a tag before is dropped.

### Files it can read [#files-it-can-read]

| Files | Extensions | What files keeps |
|---|---|---|
| Text and Markdown | `.txt`, `.md`, `.markdown` | The text, links and tags |
| Tables | `.csv`, `.tsv`, `.xlsx`, `.ods` | One line per row, `Row 2: Item: Rent; Amount: 1200`, under a `# <sheet>` heading |
| Documents, slides and e-books | `.odt`, `.odp`, `.pptx`, `.epub`, `.rtf` | The text, without the layout |
| PDF and Word | `.pdf`, `.docx`, `.doc` | The text |
| Web pages saved as files | `.html`, `.htm` | The page's main text and title |
| Scans and pictures | a PDF with no text in it, `.jpg`, `.jpeg`, `.png`, `.webp` | The text OCR finds in it, see [Scans and pictures](#scans-and-pictures) |

A search hit names the file by its path inside the folder. Its excerpt is the line that holds the words, so a hit in a
sheet shows its row and the names of its columns. The PDF page and the sheet's name are not shown yet.

Some files cannot be read: old `.xls` files (save them as `.xlsx`), and files larger than 10 GiB
(`MESSAGING_ATTACHMENT_MAX_MIB` sets another limit). files keeps up to 200,000 characters of each file. The import
report lists every file it could not read, and why, on every run until the file changes:

```text
notes /home/you/Notes: 41 notes, 2 changed, 0 moved, 0 gone, 1 not read
  not read: Archive/2009 budget.xls — this file type cannot be read
```

The text report names the first 10; with `--json`, the whole list is `not_read` in each folder's report, with the reason as `status`:
`too-large`, `unsupported`, `needs-agent` (no text, such as a scan), `unreadable` (damaged or locked) or
`engine-missing`. A scan or a picture OCR did not read also has `reason`, in words. The count of notes leaves out the
files that were not read.

### Scans and pictures [#scans-and-pictures]

A PDF with no text in it (pictures of pages) and a JPEG, PNG or WebP picture are read by OCR, which finds the text in
a picture. The `read_scans` setting chooses who reads them:

| `read_scans` | Who reads scans and pictures |
|---|---|
| `local` (the default) | The `tesseract` program on this computer, in Russian and English. Nothing leaves the computer |
| `anthropic`, `openai` | The AI model you chose with `wcat models ai set`, at that provider's own address, once you allow it pictures (`--images`) |
| `off` | No one: scans stay not read, and new pictures are not looked at. Notes read from pictures before stay |

```sh
files config set --defaults read_scans off
```

A picture becomes a note only when OCR finds text in it. A picture with no text, such as a photo pasted into a vault,
stays in `not_read` with its reason, so `files notes list` does not fill with empty notes. It is not read again until
the file changes or another engine is chosen.

Until tesseract is installed, scans stay not read and new pictures are only counted. The report says so once:

```text
notes /home/you/Notes: 41 notes, 0 changed, 0 moved, 0 gone, 1 not read
  not read: Scans/lease.pdf — waits for OCR, below
  OCR: 0 read, 1 not read, 12 pictures waiting — scans are not read: reading scans on this computer needs the tesseract program …
```

Install it (`apt install tesseract-ocr tesseract-ocr-rus tesseract-ocr-osd`, or `brew install tesseract tesseract-lang`)
and the next `files sync` reads them. Without the `osd` data tesseract cannot turn a page that lies on its side, and
the sync says so. A scanned PDF also needs the optional package `@napi-rs/canvas`, installed where files is
(`npm install -g @napi-rs/canvas` next to a global install); without it, the scan's reason names it.

OCR reads up to 20 pages of a file and 100 pages a sync; the rest wait for the next sync. With `--json`, each folder's
report has `ocr` (`read` this run, `not_read`, `pictures_waiting`, and `unavailable` when no engine can read), and the
sync's `scans` names `read_scans` and the engine, such as `ocr:v2:tesseract@5.3.0:rus+eng`. A change of engine or
version reads the scans it could not read again.

### Skip some files [#skip-some-files]

To keep some files out of files, list them under `notes.ignore` in the
[config file](/llms.mdx/docs/files/configuration/content.md#notes-folders). A rule is a path inside the folder, a folder (everything in
it is skipped) or a pattern:

```json
{ "notes": { "ignore": ["Journal/Private.md", "Archive", "**/Private*"] } }
```

`files sync --ignore Drafts` leaves a folder alone for one run: its notes are not read
again, and the ones already imported stay in files. `notes.ignore` is different: it removes notes
already imported from that place.

## Find your notes [#find-your-notes]

```sh
files search notes 'budget'
files search notes 'budget' --filter 'tag:work'
files notes show document:3
```

Each result shows the file and the first matching line. `files notes show` shows one note with its
tags, the notes it links to and the notes that link to it. See [Search](/llms.mdx/docs/wcat/content.md) for more search
words.

To keep one file, a web page or pasted text that is not in a folder, add it as a source:
[Sources you add by hand](/llms.mdx/docs/files/sources/content.md).

## Write your own notes [#write-your-own-notes]

A note you write in files can be about a person, a message, a project or another note. Writing it
does not send anything to anyone and does not change the message it is about.

```text prompt
Use the WireCat files CLI to save a note that Kai Sample prefers morning meetings, linked to Kai on Telegram.
Show me the saved note.
```

Or yourself:

```sh
files notes add 'Prefers morning meetings' --subject telegram:'Kai Sample'
files notes list 'about:"telegram:Kai Sample"'
```

`notes list about:` lists the notes about a subject and the notes that link it: directly, through a note about it, or
by a name two people share. `via` in `--json` says which: `about`, `link`, `through` or `name`. It stands alone in
the query; `source:internal` and `text:budget` narrow the whole list.

`--subject` on `notes add` says what the note is about. Use it more than once for several subjects:

| About | Write |
|---|---|
| A person in a messenger | `telegram:'Kai Sample'`, `max:'Kai Sample'` or `email:kai@example.com` (a name or an ID) |
| One message | its reference, such as `msg:telegram/1/77/42` |
| A note or a file | `note:12` or `document:3` |
| A person, organization, project or task | `person:…`, `organization:…`, `project:…`, `task:…` |

Copy references from search results; do not type them from memory. The person, message or note must
already be in the local store.

### Read, edit and remove a note [#read-edit-and-remove-a-note]

```sh
files notes show note:12
files notes edit note:12 --revision 1 --text 'Prefers early morning meetings'
files notes remove note:12
```

Each note has a **revision** number that goes up with every edit. `files notes edit` asks for the
current revision, which `files notes show note:12 --json` gives you. If someone or something edited
the note in the meantime, the numbers do not match and files refuses the edit, so no change is lost.
Read the note again and retry.

A note from a file is edited in the file, not with `files notes edit`.

### Save your notes as files [#save-your-notes-as-files]

```sh
files notes export --output-dir /path/to/vault/files --format obsidian
```

Export writes the notes you wrote in files as Markdown files in the folder you choose. Use
`--format markdown` for plain Markdown. Each file gets a `memo-id` and a `memo-hash` at the top, so
importing that folder does not create the same note twice. If you edited an exported file yourself,
files does not overwrite it and tells you. To export one note when you write it, add `--export` to
`files notes add` or `files notes edit`.

## The note about a person [#the-note-about-a-person]

You can tell files which file is the main note about a person, for example `People/Kai.md` in your
vault:

```sh
files notes links add telegram:'Kai Sample' /path/to/vault/People/Kai.md
files notes links show telegram:'Kai Sample'           # shows which note it is
files notes links clear telegram:'Kai Sample'   # forgets it
```

The file must be imported first. After this, the note and the notes that link to it appear in
[the person's context](/llms.mdx/docs/wcat/content.md). If two people share the name, files
refuses and lists their IDs so you can choose.

## Use the same notes on another computer [#use-the-same-notes-on-another-computer]

If your notes are synchronised to another computer, connect the same folder ID there instead of
adding a new folder:

```sh
files folders list                                  # shows the folder IDs the local store has
files folders update 1 /other/path/to/notes
```

With the same ID, the notes keep their links and tags on both computers.

The Google Drive documents drive-cli saved belong to its `google-drive:…` account. `files folders list` marks that
account "kept by drive", and `files folders update` refuses it: wcat search reads it already.

Next: [label your notes with tags](/llms.mdx/docs/wcat/content.md), or [search them](/llms.mdx/docs/wcat/content.md).
