Skip to content

feat: doctor — detect duplicate and redundant hooks #36

Description

@vishnujayvel

Problem

Hooks get duplicated through copy-paste, multiple installations, or config merging. Redundant guardrail systems stack up without users realizing. Each duplicate wastes resources on every matching event.

From the incident: skill-routing-guard appeared 3 times on PreToolUse, and 3 separate guard systems (hookwise, claude-code-guardian, skill-routing-guard) were all doing overlapping work.

Requirements

F1.5 — Duplicate & Redundancy Detection

Exact duplicates: Same command string on the same event type:

WARN  hook-duplicate: "skill-routing-guard" appears 3 times on PreToolUse
       → Identical hooks waste resources. Remove the duplicates.

Functional overlap: Multiple known guard/guardrail tools on the same event:

INFO  hook-overlap: 3 guard systems detected on PreToolUse:
       • hookwise dispatch (hookwise guards)
       • uvx claude-code-guardian
       • skill-routing-guard
       → Consider consolidating into a single guard framework.

Known Guard/Guardrail Tool Patterns

Maintain a list of known guardrail tool patterns for overlap detection:

  • hookwise dispatch — hookwise's own guards
  • claude-code-guardian — external guardian package
  • skill-routing-guard — skill routing checks
  • Commands containing guard, policy, block, allow in their names

Acceptance Criteria

  • Detects exact duplicate hooks (same command + same event)
  • Detects functional overlap for known guardrail tools
  • Reports the source file for each duplicate/overlapping hook
  • Suggests consolidation for overlapping guardrail tools
  • Unit test with mock settings containing duplicates and overlapping tools

Context

This is P2 — depends on hook inventory scan (#34).

📎 Design doc: docs/plans/2026-03-07-hook-safety-and-onboarding-design.md (Feature 1.5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsafetyHook safety, timeouts, and self-protection

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions