Skip to content

feat: register additional CC hook types (FileChanged, CwdChanged, PreCompact, PostCompact) #571

@OneStepAt4time

Description

@OneStepAt4time

Context

Aegis currently registers 14 CC hook types in hook-settings.ts. Claude Code supports additional hooks that could provide valuable telemetry:

Proposed Additions

Hook Value for Aegis
FileChanged High — Track which files an agent is modifying in real-time without JSONL parsing. Useful for monitoring, conflict detection, and progress reporting.
CwdChanged Medium — Know when agent changes directory. Useful for context tracking.
PreCompact / PostCompact Low-Medium — Know when CC compacts context. Useful for detecting sessions approaching context limits.

Why

Implementation

  1. Add events to HTTP_HOOK_EVENTS in src/hook-settings.ts
  2. Add handlers in src/hook.ts (forward to monitor/Telegram)
  3. Verify these hook types are valid across CC versions (check against CC 2.1.63+ to avoid [Bug][P1] Invalid hook type 'StopFailure' causes Claude Code settings error on session creation #555 regression)
  4. Add tests

Compatibility Note

After #555, we must verify each new hook type is recognized by the minimum supported CC version before adding it. Consider a CC version check (#564) or feature flags.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions