# Keep files and notes

Save files and notes, find them again, and keep the version before each change for 30 days.

## Save [#save]

```sh
afile save report.pdf --tag q3 --note "for the board"
afile save - --name "trip plan" < plan.txt
```

`save` takes a file, or standard input with `-` and a `--name`. Text from standard input is kept as a note. Each item can carry tags (`--tag`, repeatable) and a private note (`--note`). `--expires 7d` deletes it after that long. Names are unique, and a name works anywhere an id does.

## Find [#find]

```sh
afile items --tag q3
afile items --kind note
afile search board
afile show report.pdf --versions
```

`items` lists newest first, and filters by `--kind` (files, notes or secrets) and `--tag`. aFile can't read names, tags or notes, so `search` decrypts the list on your agent's machine and searches it there.

## Read [#get]

```sh
afile get report.pdf --out report.pdf
afile get report.pdf --version 1 --out report-v1.pdf
```

`get` writes to `--out`, or to standard output when it's piped. A note prints as text. Before anything is written, the contents are checked against the fingerprint saved with them.

## Change and delete [#update]

```sh
afile update report.pdf report-v2.pdf
afile update report.pdf --name "q3 report" --tag final --untag draft
afile delete report.pdf
```

`update` saves a new version, or renames, retags, changes the note or the expiry. The version before is kept for 30 days. If the item changed since your agent read it, aFile refuses with `412 precondition_failed`: read it again before deciding to retry. `delete` erases the item and its versions, and closes every link to it.

<Callout title="Retrying a write">
Every write takes `--key <uuid>`. Reuse the same UUID to retry the same write safely: aFile returns the first result instead of saving twice.
</Callout>
