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