Add plugin: `preflight-disk-space` (abort below free-space threshold)
- Dominant language
- Rust
- Stars
- 3
- Forks
- 1
- Avg merge
- 4h 50m
- Merged PRs (30d)
- 1
Description
Agents that write reports, dumps, or logs can fail mid-run with `ENOSPC`, leaving partial state. The `examples/disk-alert/` agent already monitors disk space, but there is no preflight that *prevents* an agent from starting when disk is below a threshold.
## Proposal
A new plugin `preflight-disk-space` that aborts an agent run if free space on a target volume is below a configurable threshold.
Manifest usage:
```toml
[[preflight]]
plugin = "preflight-disk-space"
path = "/Users/me/reports"
min_free_gb = 5 # abort if free space < 5 GiB
# or:
min_free_percent = 10 # abort if less than 10% free
```
## Acceptance criteria
- [ ] New plugin crate under `plugins/preflight-disk-space/` following the convention of `preflight-cmd`.
- [ ] Both absolute (`min_free_gb`) and percentage (`min_free_percent`) thresholds work; either or both.
- [ ] When both are set, abort if *either* is breached.
- [ ] `suggest` field on abort names which volume is full and how much short it is.
- [ ] Works on macOS and Linux (use `statvfs` or equivalent cross-platform crate).
- [ ] Doc page under `docs/plugins/preflight-disk-space.md`.
- [ ] Registered in the workspace `Cargo.toml`.
## Where to start
- `plugins/preflight-cmd/` — convention to copy.
- [`docs/reference/plugin-protocol.md`](docs/reference/plugin-protocol.md) — protocol.
- `examples/disk-alert/` — the existing reactive disk agent for inspiration.
## Non-goals
- Inode exhaustion checks (separate failure mode, future plugin).
- Mount-point health beyond free space.
Contributor guide
Research direction
Start with plugins/preflight-cmd/ and docs/reference/plugin-protocol.md to understand the plugin convention and protocol, then review examples/disk-alert/ for disk-space behavior. Register the new crate in the workspace Cargo.toml and add docs/plugins/preflight-disk-space.md. Done means both threshold forms work on macOS and Linux, either threshold can abort a run, combined thresholds use either breach, and the abort suggestion identifies the volume and shortfall.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100