AI coding assistants like Claude can silently accumulate stale Gradle and Kotlin daemons, consuming large amounts of RAM during Android/KMP development sessions. A practical solution using a Claude PreToolUse hook is presented: a bash script that automatically detects and kills idle Gradle/Kotlin daemon processes (idle for more than 3 seconds CPU usage) before any new Gradle command is executed. The hook is configured via Claude's settings.json and placed in the .claude/hooks directory at either project or user level, requiring no manual intervention once set up.
Sort: