Agent awareness of long-running background Bash processes (RAM pressure)
What happened
I use web new experience beta Claude Code (agent mode) to drive a domain-specific CLI tool — a ~14,000-line Java/ASM fat-jar called ClaudePatcher that statically analyzes 355-jar Minecraft Forge modpacks (~65k classes). Each invocation is a separate JVM process consuming 1.5–2 GB RAM.
During a session, the agent sometimes launches the same heavy command multiple times for timing tests / verification, without realizing previous background processes are still running. Seen today: 3 concurrent java processes × 1.5 GB each on a box without that headroom → memory thrashing → a command that finishes in ~15 s alone took 14 minutes before being killed.
The root problem: the agent has BashOutput and KillShell for shells it explicitly tracks, but no mechanism to see "what heavy processes are live right now" or to be warned before launching a new one.
Requests
- Surface pre-launch signals to the agent: running-process summary and available RAM, especially before
Bashcalls expected to be long / memory-heavy (or taggedrun_in_background: true). - Auto soft-kill or explicit warning for duplicate invocations: "a previous
java -jar X ...is still running, continue? / will this thrash?" - Expose a tool like "list my active background shell IDs" to the agent (currently it must self-track).
Workaround I'm building locally
A PreToolUse hook matching Bash that shells out to ps/free and returns {"decision":"block","reason":...} when the command matches a heavy-pattern AND a previous instance is already alive. Happy to share the script if useful as a community example.
Env
Claude Code web/IDE session (no terminal), ~April 2026 session date. Observed on a modpack with 355 mods
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗