# Space file format

## Overview

A Space is a folder of plain local files. The files are the truth: Markdown Items, Collection records, attachments and the `.garnet/` control files. Garnet's search index is a disposable copy it rebuilds from them. Copying the folder, `.garnet/` included, is enough to move a Space to another computer.

## Folder layout

```text
<space>/
  notes/
  journal/
  people/
  life-events/
  places/
  tasks/
  collections/
    <collection>.records.jsonl
  assets/
  index.json
  .garnet/
    settings.json
    space-state.json
    versions/
    restore-points/
    rename-history/
    trash/
    sync-log/
    import-staging/
    styles/
    local-runtime/
    support-packages/
```

- Each Item Type has its own top-level folder, and its files sit flat inside it. These folder names are fixed: do not rename them.
- A Space from an older version may also hold `costs/`, `roles/` or `knowledge/`. Garnet still opens it and reads those files as ordinary files.
- Garnet flags files it does not recognise in Doctor, and never imports them on its own.

## Item files

Every Item is one Markdown file with YAML front matter. The first `#` heading in the body is the Item's title; without one, Garnet uses the file name.

```markdown
---
type: task
internalId: task-send-proposal
createdAt: 2026-08-20T12:00:00.000Z
status: saved
tags: [work]
linkedPeople: [person-alex]
task:
  name: Send proposal
  status: in_progress
  priority: high
  dueDate: 2026-08-22
---

Draft is in the shared folder.
```

### Shared front matter keys

| Key | What it holds |
| --- | --- |
| `type` | The Item Type: `journal`, `note`, `people`, `life_event`, `place`, `task` or `collection`. |
| `internalId` | The Item's identity. Garnet sets it; do not change it. |
| `createdAt` | When the Item was created. Garnet sets it. |
| `updatedAt` | When it was last saved. Garnet writes it on every save. |
| `status` | `draft` or `saved`. |
| `reviewState` | Inbox routing: `inbox` means it still needs review. |
| `tags` | Tags, as a list. These are what the Tags property shows. |
| `aliases` | Other names, used by search and links. |
| `linkedPeople`, `linkedEvents`, `linkedPlaces`, `linkedNotes`, `linkedTasks`, `linkedLists` | Links to other Items, by ID. |
| `attachments` | Attachment paths, such as `assets/photo.jpg`. |
| `photoPeople` | People tagged on each attached photo: attachment path to Person IDs. |
| `archivedAt` | When the Item was archived. Present means archived. |
| `pinned` | Pinned or starred. |
| `importSourceLabel`, `sourceTypeClaim` | Where an imported Item came from. |
| `onThisDayExcluded`, `tripGroupIds` | Optional system metadata. |

### Type sections

Fields that belong to one type live in a YAML object named after it: `journal`, `note`, `person`, `event`, `place`, `task` or `collection`. For example, a Journal entry's mood is `journal.mood`, and a task's due date is `task.dueDate`. Every section can hold `isPrivate: true`, which keeps the Item out of Garnet Connect whatever a grant says.

### Your own keys

Any other top-level key is the file's own. Garnet shows it as a custom property and writes it back unchanged on every save. Garnet never drops a key it does not own.

## Collections

A Collection is a Markdown Item that holds its fields and views. Its records live next to it in `collections/<collection>.records.jsonl`, in JSON Lines: one complete JSON object per line, one line per record. Records link to Items by ID, not by path.

## Attachments

Every attachment is a file in the flat `assets/` folder, at `assets/<filename>`. Garnet makes no subfolders there. Identical files are stored once: a second Item that uses the same file points to the same path. When a name is taken, Garnet adds a number, as in `photo (2).jpg`, and never overwrites the file already there.

An Item uses an attachment in two ways:

- **Inline**, in the text: `![name](assets/<filename>)` or `[name](assets/<filename>)`.
- **Attached**, as a gallery, cover or avatar: the same path in `attachments` or `person.avatar`.

Garnet keeps a catalog of attachments (name, type, size and SHA-256) in `.garnet/space-state.json`. The bytes on disk are the truth.

## The `.garnet/` folder

`.garnet/` marks a folder as a Space and holds its control files. If it is unreadable or damaged, Garnet opens the Space read-only, or refuses to open it, rather than write over it.

| Path | What it holds | Synced by Garnet Sync |
| --- | --- | --- |
| `settings.json` | Space settings that travel with it: name, description, appearance, navigation, sync ignore rules. | Yes |
| `space-state.json` | Structured Space data with no file of its own, such as On This Day pins, Resurface schedules, Keep in touch marks and the attachment catalog. | Yes |
| `versions/` | Version history, one folder per Item: `versions/<item-id>/vNNN_<timestamp>.md`. | Yes |
| `restore-points/` | Restore Points, in a content-addressed store. | Only when Sync Restore Points is on |
| `rename-history/` | One JSON file per rename that rewrote links. | Yes |
| `styles/` | Custom stylesheets and their fonts. See [Custom stylesheets](/help/advanced/stylesheets). | Yes |
| `trash/` | Space Trash: files deleted or replaced on this device. | No |
| `sync-log/` | Sync History for this device. | No |
| `import-staging/` | Work in progress from an Import. | No |
| `local-runtime/` | This device's runtime state, such as locks and the active index pointer. | No |
| `support-packages/` | Doctor support packages waiting for review. | No |
| `space-index-v2.sqlite` and its `-wal` and `-shm` files | The desktop search index. | No |

## What is safe to edit outside the app

Garnet watches the Space folder and picks up files you create, edit, rename or delete in other tools while it runs. Before it saves an Item, it checks the file on disk; if someone else changed it, Garnet reports a conflict instead of overwriting it.

| Safe to edit | Leave to Garnet |
| --- | --- |
| Markdown bodies, in any editor. | `internalId` and `createdAt`. |
| Front matter values, including your own keys. | Anything under `.garnet/local-runtime/`, which holds this device's runtime state. |
| New Markdown files in a type folder, with a `type` key. | `.garnet/space-state.json`, `.garnet/versions/` and `.garnet/restore-points/`. |
| Files in `assets/`, and links to them. | The names of the top-level type folders. |
| Stylesheets in `.garnet/styles/`. | `.garnet/settings.json`, except to fix it by hand when Doctor asks. |

Garnet does not follow symbolic links inside a Space: a file or folder reached through one is refused, so a link can never make Garnet read or write outside the Space.

## What Garnet rebuilds

These files are disposable. Deleting them loses nothing, and Garnet rebuilds them from the files above:

- `index.json` at the Space root, a list of Item paths that helps Garnet recognise the folder as a Space.
- The local search index (`.garnet/space-index-v2.sqlite`, its sidecar files, and later index generations under `.garnet/local-runtime/`). Doctor's Rebuild local index makes a fresh one.

On iPhone, iPad and Android, the search index lives in the app's own storage, outside the Space folder.

## Related

- [Recover your files without Garnet](/help/privacy-and-ownership/recover-without-garnet)
- [Data locality](/help/privacy-and-ownership/data-locality)
