dietclaw
v0.2.0
Published
Codebase health monitor. Find out why your project is getting fat.
Maintainers
Readme
Dietclaw
Codebase health monitor. See where the bloat is, how deep your dependencies go, and what's actually your code vs what you're carrying. Works standalone or as an OpenClaw skill.
What It Does
- separates your code from everything else (dependencies, assets, generated files, configuration)
- shows the source-to-bloat ratio
- counts transitive dependencies and shows how many packages get installed
- detects large files, long files, and duplicate files
- analyzes outdated packages, unused dependencies, and heaviest packages
- compares multiple projects side by side with
--each --jsonflag on all commands for agents and scripts
Requirements
- Node 22+
- pnpm
Install
git clone https://github.com/psandis/dietclaw.git
cd dietclaw
pnpm install
pnpm buildQuick Start
pnpm cli scan # scan current directory
pnpm cli scan ../myproject # scan another project
pnpm cli scan ~/Projects --each # compare all projects
pnpm cli deps # dependency analysis
pnpm cli scan --save # save a snapshot
pnpm cli trend # view historyCLI
All commands are run with pnpm cli <command>.
Scan a project
dietclaw scan
Project Health Report
/home/dev/myapp
Weight
Total 2.1 MB
Source code 42.8 KB (2.0%)
Breakdown
┌─────────────────┬────────┬───────┬───────┐
│ Category │ Size │ Files │ Share │
├─────────────────┼────────┼───────┼───────┤
│ Assets │ 1.9 MB │ 3 │ 92.4% │
│ Source code │ 42.8 KB│ 18 │ 2.0% │
│ Generated files │ 64.2 KB│ 2 │ 3.0% │
│ Configuration │ 5.6 KB │ 7 │ 0.3% │
└─────────────────┴────────┴───────┴───────┘
Dependencies
Direct 8 production + 9 development
Installed 214 packages (148.3 MB)
Languages
┌────────────┬───────┬───────┬───────┐
│ Language │ Lines │ Files │ Share │
├────────────┼───────┼───────┼───────┤
│ TypeScript │ 1,840 │ 16 │ 68.2% │
│ JSON │ 482 │ 5 │ 17.9% │
│ Markdown │ 312 │ 3 │ 11.6% │
│ CSS │ 64 │ 2 │ 2.4% │
└────────────┴───────┴───────┴───────┘
Large Files (2)
Files exceeding the size threshold
┌──────────────────┬────────┐
│ File │ Size │
├──────────────────┼────────┤
│ public/hero.png │ 1.4 MB │
│ public/logo.png │ 512 KB │
└──────────────────┴────────┘Notes:
--limit <n>controls how many large/long files to show (default:10)--jsonoutputs structured JSON for scripts and agents
Compare multiple projects
dietclaw scan ~/Projects --each
Project Comparison
┌─────────────┬─────────────┬──────────┬──────────────┐
│ Project │ Source code │ Assets │ Dependencies │
├─────────────┼─────────────┼──────────┼──────────────┤
│ api-server │ 12.4 KB │ — │ 187.2 MB │
│ dashboard │ 28.1 KB │ 4.2 MB │ 294.7 MB │
│ mobile-app │ 45.3 KB │ 892.0 KB │ 203.5 MB │
│ shared-lib │ 8.7 KB │ — │ 31.4 MB │
└─────────────┴─────────────┴──────────┴──────────────┘Notes:
- detects subprojects by looking for project markers (
package.json,Cargo.toml,go.mod, etc.) - project markers are configurable in
data/defaults.jsonc
Dependency analysis
dietclaw deps
Dependency Analysis
Outdated Packages (3)
┌─────────────┬─────────┬────────┬────────┐
│ Package │ Current │ Latest │ Update │
├─────────────┼─────────┼────────┼────────┤
│ next │ 14.1.0 │ 16.2.1 │ major │
│ react │ 18.3.1 │ 19.2.4 │ major │
│ autoprefixer│ 10.4.21 │ 10.4.27│ patch │
└─────────────┴─────────┴────────┴────────┘
Heaviest Packages (top 20)
┌──────────────────────────┬──────────┐
│ Package │ Size │
├──────────────────────────┼──────────┤
│ @next/swc-darwin-arm64 │ 129.4 MB │
│ typescript │ 21.8 MB │
│ prisma │ 70.6 MB │
└──────────────────────────┴──────────┘
Version Conflicts (5)
These packages exist multiple times in your project at different versions.
┌───────────┬───────────────────┬───────────┐
│ Package │ Installed version │ Needed by │
├───────────┼───────────────────┼───────────┤
│ commander │ 14.0.3 │ direct │
│ commander │ 4.1.1 │ sucrase │
└───────────┴───────────────────┴───────────┘Notes:
--limit <n>controls how many items per section (default:20)--jsonoutputs structured JSON for scripts and agents
Configuration
All classification rules live in data/defaults.jsonc — a JSONC file with inline comments explaining every option. No code changes needed to:
- add new languages or file extensions
- change what counts as source code, assets, data, or binaries
- adjust thresholds for large files (default: 500 KB) and long files (default: 300 lines)
- add directories to the ignore list
- add project markers for
--eachdetection
Agent Integration
All commands support --json for structured output:
dietclaw --json scan
dietclaw --json deps
dietclaw --json scan ~/Projects --eachOpenClaw Skill
Once installed globally (npm install -g dietclaw), add a SKILL.md to your workspace:
---
name: dietclaw
description: Codebase health monitor — find bloat, complexity, and dependency weight
version: 1.0.0
requires_binaries:
- dietclaw
---
When the user asks about project health, size, bloat, or dependencies, use the `dietclaw` CLI:
- To scan a project: `dietclaw --json scan`
- To analyze dependencies: `dietclaw --json deps`
- To compare projects: `dietclaw --json scan ~/Projects --each`
- To view trend: `dietclaw --json trend`Track changes over time
Save snapshots with --save and view the trend:
dietclaw scan --save # save a snapshot
dietclaw trend # view historydietclaw trend
Project Trend
/home/dev/myapp
History (3 snapshots)
┌─────────────────────┬───────┬────────┬─────────────┬────────┬──────────┬──────────────┐
│ Timestamp │ Files │ Lines │ Source code │ Total │ Packages │ Dependencies │
├─────────────────────┼───────┼────────┼─────────────┼────────┼──────────┼──────────────┤
│ 2026-04-01 14:32:01 │ 22 │ 3,200 │ 48.1 KB │ 2.6 MB │ 92 │ 102.4 MB │
│ 2026-03-28 10:15:43 │ 20 │ 2,800 │ 42.8 KB │ 2.1 MB │ 88 │ 96.0 MB │
│ 2026-03-20 09:30:12 │ 15 │ 1,950 │ 32.1 KB │ 1.8 MB │ 85 │ 92.0 MB │
└─────────────────────┴───────┴────────┴─────────────┴────────┴──────────┴──────────────┘
Change
Total +819.2 KB
Source code +16.0 KB
Files +7
Lines +1,250Notes:
- snapshots are stored locally in
~/.dietclaw/history.db - override storage location with
DIETCLAW_HOMEenvironment variable --limit <n>controls how many snapshots to show (default:20)
Roadmap
dietclaw monitor— runtime performance monitoring (memory, CPU)- CI-friendly exit codes and thresholds
Development
git clone https://github.com/psandis/dietclaw.git
cd dietclaw
pnpm install
pnpm build
pnpm test
pnpm lint
pnpm cli --helpRelated
- 🦀 Dustclaw — Find out what is eating your disk space
- 🦀 Driftclaw — Deployment drift detection across environments
- 🦀 Feedclaw — RSS/Atom feed reader and AI digest builder
- 🦀 OpenClaw — The open claw ecosystem
License
See MIT
