MichaelP17/claude-mods/tree/main/concurrency-guard
concurrency-guard
並列 subagent と monitor の数を制限し、設定した上限を超えるには理由の提示とユーザーの承認を求める Claude Code mod。
この mod について
concurrency-guard は Claude Code が同時に実行する subagent と monitor の数を制限します。上限未満の起動は通常どおり進みます。上限に達した状態で理由のない起動を行うと拒否され、理由を付けて再試行するよう Claude が案内し、Allow once / No limit this session / Deny の承認ダイアログが開きます。数を明記した入力プロンプトはセッションの上限を引き上げます。ステータス行には現在の使用数が表示され、1 つのメッセージから起動した subagent は空き枠の競合を避けるため順番に判定されます。maxSubagents(デフォルト 4)と maxMonitors(デフォルト 3)は /config または ~/.claude/settings.json の pluginConfigs で設定します。"subagents"/"agents"/"monitors" の前にある英語とドイツ語の数を解析します。入力プロンプトだけが上限を上げ、/clear がリセットします。ゲートされるのは Agent-tool による起動だけですが、workflow やプラグインが起動した subagent も数えられます。CLAUDE_CODE_PLUGIN_DIRS から mod を削除してアンインストールします。
インストール
まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。
claude plugin marketplace add MichaelP17/claude-mods claude plugin install concurrency-guard
原文 / README
concurrency-guard
Caps how many subagents and monitors Claude runs at the same time. Parallel subagents multiply token use, and a runaway loop can start dozens of monitors; this mod makes going beyond a limit a deliberate decision.
| Situation | What happens | | --- | --- | | Below the limit | The subagent or monitor starts as usual | | At the limit, no reason given | The start is refused; Claude is told how to retry with a reason, and to do so only if another one in parallel is really necessary | | At the limit, reason given | A dialog shows the task and Claude's reason: Allow once, No limit this session or Deny | | Your prompt names a count | "Use 8 subagents", "starte fünf Subagents", "5 monitors" raises the limit to that count for the session; a toast confirms it |
While anything runs, the status line shows the count, for example agents 2/4 · monitors 1/3.
Several subagents started in one message are decided one after another, and a subagent that was let through counts until it is visibly running — otherwise all of them would see an empty slot at the same moment.
Configuration
| Option | Default |
| --- | --- |
| maxSubagents | 4 |
| maxMonitors | 3 |
Change them in /config, or in ~/.claude/settings.json:
"pluginConfigs": {
"concurrency-guard": { "options": { "maxSubagents": 6, "maxMonitors": 2 } }
}
How Claude states a reason
Claude learns the format from the refusal, so nothing has to be configured. For reference: a subagent carries the reason as the first line of its prompt, a monitor in front of its description, each introduced with Over-limit reason:. The mod removes the reason again before the subagent or monitor starts.
Details and limits
- Counts in prompts are read in English and German, as digits or as words up to twelve, when they stand directly before "subagents", "agents" or "monitors". Raising only ever goes up;
/clearresets the limits. - Only typed prompts raise limits. Messages from subagents, other sessions or task notifications never do.
- Running subagents come from Claude Code itself. Monitors are counted by the mod from their start until
TaskStop, their timeout or their end notification; a monitor started before the mod was loaded is not counted. - Only starts through Claude's Agent tool are gated. Subagents that workflows or other plugins start are not stopped, but they count toward the running total.
Uninstall
Remove the mod from CLAUDE_CODE_PLUGIN_DIRS. Its options in pluginConfigs can be deleted.