# Your data

> Where the Trajectonomics CLI keeps the ledger, what is safe to delete, and how to back it up.

`traj` is a local tool. It keeps one SQLite database on your machine, uploads nothing, and has no
account to cancel. This page says where that database is, what else lives beside it, and which of
the two is safe to delete.

## The data directory

All state is one directory, `~/.traj` on every platform, or the value of `TRAJ_HOME` when
that is set. `traj init` creates it:

```bash
traj init
```

`traj init` creates the directory readable only by you (mode `0700`) and the ledger the same way
(mode `0600`), and every later command keeps the ledger at `0600`. A directory that already exists
keeps the mode you gave it.

Two children matter:

| Path | What it is | Safe to delete? |
| --- | --- | --- |
| `traj.db` | The ledger: every account, transaction, correction, Scenario and tax Levy, in one SQLite file. | No. It is the only copy. |
| `bin/` | The npm launcher's cache of downloaded release binaries, about 100 MB per version. | Yes. The next `npx` run downloads again. |

The install scripts do not use `bin/`: they put the binary where the platform expects it, and the
directory then holds the ledger alone.

## Back it up

Before you delete anything, take the copy you would keep:

```bash
traj backup --out ~/traj-backup
```

The backup writes `traj.jsonl` into a directory that must not already exist, and
[`traj restore`](https://docs.trajectonomics.com/cli/commands/restore/) reads it back into an empty database.
`traj export` writes the same JSONL plus CSV and Markdown, which do not restore.

## Remove traj, keep the ledger

Delete the program and the caches. [Installation](https://docs.trajectonomics.com/cli/installation/) lists each path. The
ledger stays where it is, and a later install opens the same books.

## Remove the ledger too

Delete the whole data directory yourself:

```bash
rm -rf ~/.traj
```

Use `"$TRAJ_HOME"` instead when you set it:

```bash
rm -rf "$TRAJ_HOME"
```

That deletes the database, and there is no copy anywhere else unless you made one above.

To remove only the ledger and keep the data directory, use [`traj data remove`](https://docs.trajectonomics.com/cli/commands/data/).
It deletes the database files and nothing else, and it refuses unless a backup holds exactly the data
as it is now. `traj scenario rm` tombstones one Scenario, and no other command deletes accounts or
transactions.

## Keep several ledgers apart

Point `TRAJ_HOME` at another directory to keep two sets of books on one machine:

```bash
TRAJ_HOME=~/money/work traj init
TRAJ_HOME=~/money/work traj balance --as-of 2026-03-31
```

Each directory is complete on its own: its own `traj.db`, its own `bin/` cache, and nothing shared
with the default `~/.traj`.

Previous: [Installation](https://docs.trajectonomics.com/cli/installation/) · Next: [Agent](https://docs.trajectonomics.com/cli/agent/).

Part of the [Docs index](https://docs.trajectonomics.com/llms.txt).
