Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By RyanKim17920v0.3.0MITIn 1 marketplace
Watches free memory and swap (macOS and Linux), shows them in the status line and alerts once (naming the top memory users) when either crosses its limit. While over, only light commands run. Always caps this session's top-level agents (subagents, and teammates while they work) at 4 and its background jobs at 3.
Code that runs inside Claude Code on every session, as you, unsandboxed.
Claude Code asks for these when you enable the plugin. Sensitive values are stored in your system keychain.
Gate modegateMode
allowlist (default): while gated, a Bash command runs only if every part of it is light (reading, inspecting, small file chores like cp and mv, everyday git such as add, commit and push, stopping, cleanup, --help); everything else is refused, and so is a light name reached by a path or with PATH, a pager or an editor changed. patterns: the old gate, which refuses only commands matching its heavy-work rules.
One of allowlist, patterns
stringdefault allowlist
1 critical to review before installing
JavaScript or TypeScript that runs inside Claude Code as you, unsandboxed. Read from its source, it sees, changes or blocks tool calls; runs programs; sends prompts on its own.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Maximum swap (GB)maxSwapGb
Alert when swap in use rises above this many gigabytes. 0 (the default) sizes it to the machine: the amount of physical memory (24 on a 24 GB machine).
numberdefault 0
Show the status-line figureshowStatus
Show the current figure in the status line.
booleandefault true
Show toastsshowToasts
Show a toast when an alert fires and each time the gate refuses a command.
booleandefault true
Cap teammates toocapTeammates
Count teammates (every named Agent spawn when teammateMode is on) against the agent cap while they work a task, and refuse a new one past it. An idle teammate never holds a slot. Off exempts teammates from the cap entirely.
booleandefault true
Gate new heavy workgateHeavyWork
While memory is over a limit, refuse new work: the Agent tool and every Bash command that is not light (by gateMode). Reading, inspecting, stopping and cleanup always run. Lifts by itself on recovery.
booleandefault true
Minimum free memory (%)minFreePercent
Alert when the system-wide free memory percentage falls below this.
numberdefault 28
Alert cooldown (minutes)cooldownMinutes
At most one alert in this many minutes.
numberdefault 30
Check interval (seconds)intervalSeconds
How often memory and swap are read.
numberdefault 60
Wake the main thread on alertwakeMainOnAlert
Submit one prompt to the main thread when an alert fires, with the figures and the top processes.
booleandefault true
Gate allow patternsgateAllowPatterns
Regular expressions (separated by ' ;; ') for Bash commands that always run while gated, matched against each part of a command with wrappers like sudo or env stripped. In allowlist mode, this is how to add a command to the light list.
stringdefault
Extra gate block patternsgateBlockPatterns
Regular expressions (separated by ' ;; ') for more Bash commands to refuse while gated, even light ones, matched against each part of a command with wrappers like sudo or env stripped.
stringdefault
Most background jobs at oncemaxBackgroundJobs
Refuse a new run_in_background Bash command while this many background jobs this session started are still running, whatever memory says. 0 turns the cap off.
numberdefault 3
Most top-level agents at oncemaxConcurrentAgents
Refuse a new subagent or teammate from the main thread while this many of this session's top-level agents are running, whatever memory says. A teammate counts only while it works a task, not while it waits idle for a message. Agents that a subagent or teammate starts are never refused by the cap and do not count (the memory gate still applies to them). Counted from the session's own agent list, so a finish is never missed and each session has its own quota. 0 turns the cap off.
numberdefault 4
System notificationssystemNotifications
Send a system notification when an alert fires.
booleandefault true
Gate light subcommandsgateLightSubcommands
Tool subcommands (one or two words after the tool, separated by ' ;; ') that count as light in allowlist mode, like git status: for example 'mytool status ;; mytool list ;; mytool jobs show'. The tool's global flags before the subcommand are skipped and any arguments after it are allowed. Other subcommands of the tool stay refused while gated.
stringdefault
Background job expiry (minutes)backgroundJobExpiryMinutes
A background job whose finish was never seen stops counting against maxBackgroundJobs after this long, so a lost notification holds a slot for at most this long.
numberdefault 30
Watches free memory and swap on a timer: on macOS from memory_pressure and sysctl vm.swapusage, on Linux from /proc/meminfo (MemAvailable over MemTotal, and SwapTotal - SwapFree). It shows them in the status line and alerts once when either crosses its limit, naming the processes and Docker containers using the most memory. It does two things to keep a session from running the machine out of memory:
Nothing is ever stopped or killed by the mod.
Where it works. macOS and Linux. On any other OS there is no reading: after 3 ticks in a row with none the mod says so once in the transcript (a single failed read, such as a memory_pressure timeout on a busy Mac, does not count), the status line stays empty and the memory gate stays open, but the cap still applies. A reading that comes later is shown and gates as usual.
After adding the marketplace (see Install in the main README):
claude plugin install mem-watch@ryk-claude-mods
Or add the marketplace and install in one step:
claude plugin install mem-watch --marketplace RyanKim17920/ryk-claude-mods
minFreePercent 28 was tuned on a 24 GB Mac: see Why 28% below. maxSwapGb defaults to 0, which sizes the swap limit to the machine's physical memory (hw.memsize on macOS, MemTotal on Linux), so a 16 GB machine alerts past 16 GB of swap. Set it above 0 for a fixed limit. If hw.memsize fails on macOS there is no swap limit yet (refusals say no swap limit yet, and free memory alone can put a reading over); it is retried each tick until it answers, then read no more.
| Option | Default | What it does |
|---|---|---|
minFreePercent | 28 | Over the limit when free memory is below this % |
maxSwapGb | 0 | Over the limit when swap in use is above this many GB. 0: the size of physical memory |
intervalSeconds | 60 | How often memory is read (minimum 5) |
cooldownMinutes | 30 | At most one alert per this many minutes |
wakeMainOnAlert | true | Send one prompt to the main thread on alert (interactive sessions only) |
showStatus | true | Show the status-line figure |
showToasts | true | Show a toast on alert and on each gate refusal |
systemNotifications | true | Send a system notification on alert |
gateHeavyWork | true | Refuse new work while over a limit |
gateMode | "allowlist" | allowlist: only light commands run while gated. patterns: the older gate, which refuses only commands matching its built-in heavy-work rules (Docker, builds, installs, downloads, train/eval scripts) |
gateBlockPatterns | "" | More regexes to refuse while gated, even light commands, separated by ;; |
gateAllowPatterns | "" | Regexes that always run while gated, separated by ;;. In allowlist mode, this adds commands to the light list |
gateLightSubcommands | "" | Tool subcommands that count as light in allowlist mode, separated by ;;, for example mytool status ;; mytool list ;; mytool jobs show. Each entry is a tool and one or two subcommand words; the tool's global flags before them are skipped and any arguments after are allowed. The tool's other subcommands stay refused |
maxConcurrentAgents | 4 | Most top-level agents (subagents and working teammates started by the main thread) this session runs at once; a subagent's or teammate's own children are never capped. 0 turns the cap off |
capTeammates | true | Count teammates against maxConcurrentAgents while they work a task, and cap new teammate spawns. False exempts teammates entirely, as the cap used to |
maxBackgroundJobs | 3 | Most run_in_background Bash jobs this session runs at once; 0 turns the cap off |
backgroundJobExpiryMinutes | 30 | A background job whose finish is never seen stops counting after this long |
The gate and the cap keep working when all UI options are off.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub ryankim17920/ryk-claude-mods --plugin mem-watch