| 5459 | } |
| 5460 | |
| 5461 | int cbm_remove_claude_subagent_hooks(const char *settings_path) { |
| 5462 | char command[CLI_BUF_8K]; |
| 5463 | char previous_command[CLI_BUF_8K]; |
| 5464 | char released_command[CLI_BUF_8K]; |
| 5465 | char previous_legacy_command[CLI_BUF_8K]; |
| 5466 | char released_legacy_command[CLI_BUF_8K]; |
| 5467 | if (cbm_resolve_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, command, sizeof(command)) != |
| 5468 | CLI_OK || |
| 5469 | cbm_resolve_previous_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, previous_command, |
| 5470 | sizeof(previous_command)) != CLI_OK || |
| 5471 | cbm_resolve_released_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, released_command, |
| 5472 | sizeof(released_command)) != CLI_OK || |
| 5473 | cbm_resolve_previous_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT_LEGACY, |
| 5474 | previous_legacy_command, |
| 5475 | sizeof(previous_legacy_command)) != CLI_OK || |
| 5476 | cbm_resolve_released_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT_LEGACY, |
| 5477 | released_legacy_command, |
| 5478 | sizeof(released_legacy_command)) != CLI_OK) { |
| 5479 | return CLI_ERR; |
| 5480 | } |
| 5481 | const char *const old_commands[] = {released_command, previous_command, released_legacy_command, |
| 5482 | previous_legacy_command, NULL}; |
| 5483 | return remove_hooks_json((hooks_remove_args_t){.settings_path = settings_path, |
| 5484 | .hook_event = "SubagentStart", |
| 5485 | .matcher_str = "*", |
| 5486 | .old_commands = old_commands, |
| 5487 | .match_command_exact = command}); |
| 5488 | } |
| 5489 | |
| 5490 | /* Matcher excludes read_file for consistency with the Claude fix: the hook |
| 5491 | * is an advisory reminder, not a gate over the agent's file reads. */ |
no test coverage detected