| 5602 | } |
| 5603 | |
| 5604 | int cbm_remove_claude_subagent_hooks(const char *settings_path) { |
| 5605 | char command[CLI_BUF_8K]; |
| 5606 | char previous_command[CLI_BUF_8K]; |
| 5607 | char released_command[CLI_BUF_8K]; |
| 5608 | char previous_legacy_command[CLI_BUF_8K]; |
| 5609 | char released_legacy_command[CLI_BUF_8K]; |
| 5610 | if (cbm_resolve_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, command, sizeof(command)) != |
| 5611 | CLI_OK || |
| 5612 | cbm_resolve_previous_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, previous_command, |
| 5613 | sizeof(previous_command)) != CLI_OK || |
| 5614 | cbm_resolve_released_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, released_command, |
| 5615 | sizeof(released_command)) != CLI_OK || |
| 5616 | cbm_resolve_previous_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT_LEGACY, |
| 5617 | previous_legacy_command, |
| 5618 | sizeof(previous_legacy_command)) != CLI_OK || |
| 5619 | cbm_resolve_released_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT_LEGACY, |
| 5620 | released_legacy_command, |
| 5621 | sizeof(released_legacy_command)) != CLI_OK) { |
| 5622 | return CLI_ERR; |
| 5623 | } |
| 5624 | const char *const old_commands[] = {released_command, previous_command, released_legacy_command, |
| 5625 | previous_legacy_command, NULL}; |
| 5626 | return remove_hooks_json((hooks_remove_args_t){.settings_path = settings_path, |
| 5627 | .hook_event = "SubagentStart", |
| 5628 | .matcher_str = "*", |
| 5629 | .old_commands = old_commands, |
| 5630 | .match_command_exact = command}); |
| 5631 | } |
| 5632 | |
| 5633 | /* Matcher excludes read_file for consistency with the Claude fix: the hook |
| 5634 | * is an advisory reminder, not a gate over the agent's file reads. */ |
no test coverage detected