# disk_usage

How much disk the AI agents and developer caches use, per folder, and how much a clean would free. Reads sizes and times only; changes nothing.

**In short:** Risk class [`read`](https://docs.cmdop.ai/reference/tools.md#risk-classes). Over MCP call `disk_usage`; over HTTP send `"tool": "disk_usage"` to [`POST /api/v1/call`](https://docs.cmdop.ai/reference/http/post-call.md).

## Arguments

Over MCP every tool also takes `machine`: the machine's name or id, optional when only one machine is online.

| Name | Type | Required | Meaning |
| --- | --- | --- | --- |
| `older_than_days` | `integer` | no | Count only files unchanged for at least this many days. It can only raise an item's own age. |
| `targets` | `string[]` | no | `agent:<id>` for one agent's own files (`agent:claude-code`), `cache:<id>` for a developer cache no agent owns (`cache:cargo`, `cache:npm`, `cache:pnpm`). Absent: every one known. |

## Result

| Name | Type | Required | Meaning |
| --- | --- | --- | --- |
| `bytes` | `integer` | yes | Bytes on disk of every item measured. |
| `cleanable_bytes` | `integer` | yes | Of those, what a clean would free. |
| `targets` | `object[]` | yes |  |
| `truncated` | `boolean` | yes | The walk stopped at its limit of files or time: the numbers are a lower bound. |

## Examples

**MCP**

```json
{
  "name": "disk_usage",
  "arguments": {
    "machine": "<machine>"
  }
}
```

**HTTP**

```bash
curl -sS -X POST "https://<contour>.cmdop.dev/api/v1/call" \
  -H "Authorization: Bearer $CMDOP_TOKEN" \
  -H "x-cmdop: 1" \
  -H "Content-Type: application/json" \
  -d '{"machine":"<machine>","tool":"disk_usage","args":{}}'
```

## Limits

The call times out after 90 s (`timed_out`). Available since version 0.1.13. A refused or failed call returns one of the [error codes](https://docs.cmdop.ai/reference/errors.md).
