| 5376 | } |
| 5377 | |
| 5378 | int cbm_remove_claude_subagent_hooks(const char *settings_path) { |
| 5379 | char command[CLI_BUF_8K]; |
| 5380 | char previous_command[CLI_BUF_8K]; |
| 5381 | char released_command[CLI_BUF_8K]; |
| 5382 | char previous_legacy_command[CLI_BUF_8K]; |
| 5383 | char released_legacy_command[CLI_BUF_8K]; |
| 5384 | if (cbm_resolve_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, command, sizeof(command)) != |
| 5385 | CLI_OK || |
| 5386 | cbm_resolve_previous_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, previous_command, |
| 5387 | sizeof(previous_command)) != CLI_OK || |
| 5388 | cbm_resolve_released_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, released_command, |
| 5389 | sizeof(released_command)) != CLI_OK || |
| 5390 | cbm_resolve_previous_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT_LEGACY, |
| 5391 | previous_legacy_command, |
| 5392 | sizeof(previous_legacy_command)) != CLI_OK || |
| 5393 | cbm_resolve_released_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT_LEGACY, |
| 5394 | released_legacy_command, |
| 5395 | sizeof(released_legacy_command)) != CLI_OK) { |
| 5396 | return CLI_ERR; |
| 5397 | } |
| 5398 | const char *const old_commands[] = {released_command, previous_command, released_legacy_command, |
| 5399 | previous_legacy_command, NULL}; |
| 5400 | return remove_hooks_json((hooks_remove_args_t){.settings_path = settings_path, |
| 5401 | .hook_event = "SubagentStart", |
| 5402 | .matcher_str = "*", |
| 5403 | .old_commands = old_commands, |
| 5404 | .match_command_exact = command}); |
| 5405 | } |
| 5406 | |
| 5407 | /* Matcher excludes read_file for consistency with the Claude fix: the hook |
| 5408 | * is an advisory reminder, not a gate over the agent's file reads. */ |
no test coverage detected