Skip to content

Latest commit

 

History

History
60 lines (47 loc) · 3.72 KB

File metadata and controls

60 lines (47 loc) · 3.72 KB

AgentDisk

English | 中文

The more you use AI coding assistants, the fuller your disk gets — session logs, transcripts, and caches scattered across ~/.claude, ~/.codex, and half a dozen other corners, with no tool to see or manage them all in one place. AgentDisk was built to solve exactly that: one scan attributes every byte used by AI agents into a single, unified view.

AgentDisk UI

Tech Stack

  • Single Go binary: concurrent read-only scan engine + chi for the local HTTP server; the only dependencies are yaml.v3 and chi
  • Embedded frontend: bundled into the binary via go:embed (Vite + React + TS + Tailwind; no router, no chart library, ~65 KB gzipped)
  • Declarative YAML rule base: describes each agent's directories and cleanup levels; drop a same-named file into ~/.agentdisk/rules/ to override the built-in rules

Features

  • One scan, unified attribution: covers 8 agents (Claude Code, Codex CLI / desktop app, Kimi CLI, Gemini CLI, GitHub Copilot CLI, OpenCode, Aider), presented as app → directory → category
  • Single-page dashboard: segmented storage bar + per-agent accordion details
  • Cautious cleaning, never hard-deletes:
    • Three safety tiers (safe to clean / clean with caution / high risk)
    • Directories in active use are auto-locked (modified within 24h or a process is running)
    • Leftover sessions whose original project was deleted are auto-flagged as safe to clean
    • Whitelist (login credentials, settings files, etc.) is never cleaned
    • Mandatory two-step flow: preview list → confirm → items are only moved to the Trash, recoverable anytime from Finder; high-risk items require an extra explicit checkbox
  • CLI: scan [--snapshot] / snapshots / diff / serve

Project Structure

agentdisk
├── main.go              # CLI entry: scan / snapshots / diff / serve
├── web_dist.go          # go:embed bundle of the frontend build
├── rules/*.yaml         # Built-in rules: directories, categories, safety levels for 8 agents
├── internal/
│   ├── rules/           # Rule loading, user-override merging, path resolution (glob/TOML config reading)
│   ├── scanner/         # Concurrent directory walk, size attributed by block to agent → directory → category
│   ├── safety/          # Safety model: default selection, whitelist, in-use locking, orphan detection
│   ├── store/           # Snapshot persistence and diffing (~/.agentdisk/snapshots/)
│   ├── cleaner/         # Cleanup execution: preview token + move to Trash (rename only, never delete)
│   └── server/          # Local HTTP API (127.0.0.1 only) + frontend hosting
├── web/                 # Frontend source (built with bun, output embedded into the binary)
└── docs/                # UI screenshots used by this README

Quick Start

make build            # Frontend build → single Go binary (requires bun)
./agentdisk serve     # Open the dashboard (default http://127.0.0.1:17777, auto-increments if the port is taken)

Limitations

  • Platform: fully tested on macOS only; the rule schema reserves Linux/Windows path fields, but they are untested
  • Accuracy: sizes are computed by disk allocation blocks (consistent with du), which differs slightly from Finder's "show size" figure
  • Maintenance: rules depend on each agent's directory conventions — upstream changes may break them. You can override rules in ~/.agentdisk/rules/, and PRs updating the built-in rules are welcome
  • Scope: no scheduled auto-cleaning; historical snapshot comparison is CLI-only (snapshots / diff) and not shown in the UI