Skip to content

Model prompt and agent hook handler types #228

@bguidolim

Description

@bguidolim

Phase 2: Prompt & Agent Hook Handler Types

Context

Claude Code now supports two LLM-based hook handler types:

  • type: "prompt" — single-turn LLM evaluation returning a yes/no decision
  • type: "agent" — spawns a subagent with tool access (Read, Grep, Glob) to verify conditions

New Fields (shared by both types)

Field Type Description
type "prompt" or "agent" Handler type
prompt String Prompt text. $ARGUMENTS placeholder for hook input JSON
model String? Model to use (defaults to a fast model)

Timeout Defaults

  • prompt: 30 seconds
  • agent: 60 seconds

Example (prompt)

hooks:
  PreToolUse:
    - matcher: "Bash"
      hooks:
        - type: prompt
          prompt: "Review this bash command for safety: $ARGUMENTS"
          model: haiku

Files to Modify

  • Sources/mcs/Core/Settings.swift — extend HookEntry to support prompt and model fields
  • Sources/mcs/ExternalPack/ExternalPackManifest.swift — allow packs to define prompt/agent hooks
  • Validation: if type == "prompt" or type == "agent", prompt is required
  • Tests

Acceptance Criteria

  • HookEntry can represent prompt and agent hooks with all fields
  • Pack authors can define prompt/agent hooks in techpack.yaml
  • Validation ensures prompt is present for these types
  • Backward compatible

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priorityenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions