Metadata-Version: 2.4
Name: workspace-storage-guard
Version: 0.5.3
Summary: Local MCP server for checking workspace storage and reclaiming generated files
License-Expression: MIT
Project-URL: Repository, https://github.com/TonPC64/workspace-storage-guard
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp==2.3.0
Dynamic: license-file

# Workspace Storage Guard

Workspace Storage Guard is a local MCP server and command-line tool for software developers on macOS and Linux. It reports free space, ranks workspace directories by size, and reclaims allowlisted build output such as Cargo debug artifacts, Next.js caches, and `node_modules`. Optional cleanup covers developer caches and unused container resources on Rancher Desktop, Colima, Docker Desktop, Podman, and Kiri.

## How it helps

- **See what's taking space.** Check free space on your workspace volume and find large directories from your agent or terminal.
- **Reclaim space for development.** Clean configured, eligible build outputs when space runs low. You can also opt in to developer cache and container cleanup.
- **Keep an eye on storage.** Configure agent hooks or a macOS LaunchAgent to check in the background and optionally notify you.
- **Choose the cleanup scope.** Workspace cleanup uses your local allowlists and checks whether paths are safe to clean. Generated files may need to be rebuilt afterward.

## How it works

```mermaid
flowchart LR
    A[Agent via MCP<br/>or terminal] --> B[Check or scan storage]
    A --> C[Request cleanup]
    D[Configured hooks<br/>or LaunchAgent] --> C
    C --> E{Free space below<br/>the minimum?}
    E -- Yes --> F[Clean eligible<br/>allowlisted output]
    F --> G[Optionally clean caches<br/>and container resources]
    G --> H[Aim for the<br/>free-space target]
    E -- No --> I[No normal cleanup needed]
```

The minimum triggers normal cleanup, and the target controls when it stops trying new candidates. Cleanup can finish below the target if there is nothing else eligible or it runs out of time. Forced cleanup can process eligible workspace output regardless of free space. [See the cleanup flow](docs/usage.md#how-cleanup-works)

## Install from PyPI

Install uv and create your local config. Then run the published MCP server with `uvx` in Hermes Agent, Claude Code, GitHub Copilot CLI, or Codex. [Setup guide](docs/setup.md)

For example, register it in Codex using the package from PyPI.

```sh
codex mcp add workspace-storage-guard -- "$(command -v uvx)" \
	--default-index https://pypi.org/simple workspace-storage-guard@0.5.3
```

Start a fresh agent session and ask it to call `storage_status`.

For terminal commands, hooks, or the macOS LaunchAgent, install a persistent copy with `uv tool install`. [Install the CLI](docs/setup.md#install-the-cli-with-uv)

## Check and reclaim space

- `storage_status` reports free space and cleanup thresholds, with optional memory and container usage.
- `scan_storage` ranks the largest directories in your workspace.
- `restore_storage` starts configured cleanup when free space drops below your minimum and lists what it cleaned or skipped. Pass `{"dry_run": true}` to preview eligible targets and skip reasons without deleting files, or `{"force": true}` to clean every eligible workspace output regardless of free space.

Your workspace path and allowlists live in a per-user local config. Scan results include local paths and may be shared with your agent’s model provider. [Usage guide](docs/usage.md)

## Automate checks

Run Storage Guard from the terminal, add advisory hooks to your agents, or schedule checks with a macOS LaunchAgent. The example LaunchAgent runs at sign-in and every five minutes. Enable desktop notifications for low disk space or high memory use. [Hook and LaunchAgent setup](docs/setup.md#connect-agent-hooks)

[Publish a release to PyPI](docs/setup.md#publish-a-release-to-pypi)

[Contributing and running checks](CONTRIBUTING.md)
