| 5438 | } |
| 5439 | |
| 5440 | int cbm_remove_claude_subagent_hooks(const char *settings_path) { |
| 5441 | char command[CLI_BUF_8K]; |
| 5442 | char previous_command[CLI_BUF_8K]; |
| 5443 | char released_command[CLI_BUF_8K]; |
| 5444 | char previous_legacy_command[CLI_BUF_8K]; |
| 5445 | char released_legacy_command[CLI_BUF_8K]; |
| 5446 | if (cbm_resolve_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, command, sizeof(command)) != |
| 5447 | CLI_OK || |
| 5448 | cbm_resolve_previous_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, previous_command, |
| 5449 | sizeof(previous_command)) != CLI_OK || |
| 5450 | cbm_resolve_released_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, released_command, |
| 5451 | sizeof(released_command)) != CLI_OK || |
| 5452 | cbm_resolve_previous_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT_LEGACY, |
| 5453 | previous_legacy_command, |
| 5454 | sizeof(previous_legacy_command)) != CLI_OK || |
| 5455 | cbm_resolve_released_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT_LEGACY, |
| 5456 | released_legacy_command, |
| 5457 | sizeof(released_legacy_command)) != CLI_OK) { |
| 5458 | return CLI_ERR; |
| 5459 | } |
| 5460 | const char *const old_commands[] = {released_command, previous_command, released_legacy_command, |
| 5461 | previous_legacy_command, NULL}; |
| 5462 | return remove_hooks_json((hooks_remove_args_t){.settings_path = settings_path, |
| 5463 | .hook_event = "SubagentStart", |
| 5464 | .matcher_str = "*", |
| 5465 | .old_commands = old_commands, |
| 5466 | .match_command_exact = command}); |
| 5467 | } |
| 5468 | |
| 5469 | /* Matcher excludes read_file for consistency with the Claude fix: the hook |
| 5470 | * is an advisory reminder, not a gate over the agent's file reads. */ |
no test coverage detected