Stop Letting Agents Fill Your SSD With npm
说明与用途
AI 代理运行 npm install 会复制 node_modules,导致 SSD 空间浪费。always‑pnpm 将 npm 命令自动转换为 pnpm,利用全局存储和硬链接,节省磁盘空间。
问题
AI agents running npm install commands duplicate node_modules, consuming large disk space.
结果
Agents can be guided to use pnpm automatically, preventing redundant package copies and conserving SSD space.
工作流
- 1. Prompt AI agent to prototype web apps. 2. Agent runs npm install for each project. 3. Disk space alert appears. 4. Install always-pnpm to intercept npm commands. 5. Agent’s npm commands are rewritten to pnpm. 6. Projects use shared pnpm store, saving space.
证据
The agent had downloaded three separate copies of React, Vite, TypeScript, and ESLint. Each project had its own 600 MB node_modules directory.
pnpm writes packages once to a global store at ~/.local/share/pnpm/store. Projects link to those files using filesystem hard links.
I built always-pnpm to stop fighting prompt instructions. The tool hooks directly into the agent runtime. When ... runs a shell command starting with npm or npx, always-pnpm parses the string and rewrites it to pnpm in under three milliseconds.
- 记录日期: 2026-10-08T18:56:06.293Z