# Output formats (/docs/reference/output-formats)

All paths are absolute. Sizes are bytes of allocated disk space. Timestamps are epoch milliseconds unless noted.

## `scan --format json` [#scan---format-json]

One report. It doubles as a [plan](/docs/guides/clean-safely#3-review-then-apply-a-plan) for `clean --plan`.

```json
{
  "version": 1,
  "roots": ["/Users/me/dev"],
  "entries": [
    {
      "path": "/Users/me/dev/app/node_modules",
      "rule": "node_modules",
      "kind": "safe",
      "categories": ["javascript-typescript"],
      "evidence": null,
      "bytes": 979600000,
      "files": 41230,
      "lastActive": 1763500000000,
      "protection": null,
      "project": "app",
      "projectRoot": "/Users/me/dev/app",
      "projectKind": "repo",
      "projectGroup": "/Users/me/dev/app",
      "projectTouchedAt": 1760000000000,
      "gitIgnored": true,
      "synced": null
    }
  ],
  "projects": [
    {
      "name": "app",
      "group": "/Users/me/dev/app",
      "artifacts": 3,
      "bytes": 1200000000,
      "protected": 0,
      "worktrees": 1,
      "ecosystems": ["javascript-typescript"],
      "touchedAt": 1760000000000,
      "lastActive": 1763500000000,
      "dormant": true
    }
  ],
  "summary": {
    "found": 12,
    "entries": 10,
    "protected": 1,
    "dropped": { "empty": 1, "too-small": 0, "too-recent": 0, "unreadable": 0 },
    "unreadable": 0,
    "bytes": 13100000000,
    "durationMs": 2100
  }
}
```

| Field | Meaning |
| --- | --- |
| `kind` | `safe`, `gated` or `marker` |
| `evidence` | what proved a gated or tagged rule (e.g. `package.json`), else `null` |
| `lastActive` | newest modification time of anything inside |
| `protection` | `null` when deletable, otherwise `nested-repository`, `deploy-keypair`, `tracked-files` or `unverified` |
| `project`, `projectRoot`, `projectKind` | what it belongs to: a repository, a worktree (`projectGroup` is its main repository) or a manifest folder |
| `projectTouchedAt` | newest git activity in the project (epoch ms), `null` when git doesn't know |
| `gitIgnored` | `true` is evidence it is not authored content; `null` outside a repository |
| `synced` | the cloud-sync provider whose folder it sits in, else `null` |
| `projects[]` | the same entries rolled up per project, dormant and largest first; `dormant` means untouched for `dormantAfter` (30d) |
| `summary.dropped` | entries hidden by filters, by reason (`empty`, `too-small`, `too-recent`, `active-project`, `unreadable`) |
| `summary.unreadable` | directories that could not be listed |

Entries are sorted largest first, protected last.

## `scan --format ndjson` [#scan---format-ndjson]

One JSON object per line, streamed as results are measured:

```text
{"type":"entry","entry":{ …same shape as above… }}
{"type":"done","summary":{ …same shape as above… }}
```

## `clean --format json` [#clean---format-json]

Requires `--yes` or `--dry-run`.

```json
{
  "dryRun": false,
  "deleted": [{ "path": "…", "bytes": 979600000 }],
  "refused": [{ "path": "…", "code": "recently-active", "message": "modified within the last 7 days" }],
  "failed": [{ "path": "…", "message": "EBUSY: resource busy or locked" }],
  "summary": { "deleted": 1, "refused": 1, "failed": 0, "bytes": 979600000, "dryRun": false },
  "interrupted": false,
  "left": 0
}
```

`refused[].code` is one of `dangerous`, `missing`, `outside-roots`, `no-longer-matches`, `protected`, `recently-active`, `changed-since-scan`, `unverifiable`. When there is nothing to clean the output is `{"deleted":[],"refused":[],"failed":[]}`. `interrupted` is `true` (exit code 130) when a Ctrl+C stopped the run early; `left` counts the targets it never reached.

## `history --format json` [#history---format-json]

An array, newest first:

```json
[{ "time": "2026-11-19T06:20:11.000Z", "action": "deleted", "path": "…", "bytes": 979600000 }]
```

`action` is `deleted` or `failed` (`message` explains a failure). The file itself is JSON Lines; a line cut short by a crash is skipped when read.

## Errors [#errors]

With `--format json` or `ndjson`, a failure is also reported as JSON on stdout (the human text still goes to stderr):

```json
{ "error": { "code": "error", "message": "No such directory: /nope" } }
```

`code` is `usage` for bad arguments and `error` for everything else; the exit code is `2`.

## `explain --format json` [#explain---format-json]

```json
{
  "path": "/Users/me/dev/app/node_modules",
  "matched": true,
  "rule": "node_modules",
  "evidence": null,
  "project": { "name": "app", "root": "…", "kind": "repo", "group": "…", "touchedAt": 1760000000000 },
  "bytes": 979600000, "files": 41230, "lastActive": 1763500000000,
  "protection": null, "gitIgnored": true, "synced": null,
  "wouldDelete": true,
  "refusal": null
}
```

When `clean` would skip the path, `wouldDelete` is `false` and `refusal` is `{ code, message }` (the codes listed above).

## `rules --format json` [#rules---format-json]

The rules in effect: `name`, `kind`, `categories`, `description`, and `when` (gated) or `file`/`signature` (tagged).