Skip to content

SubagentStop fires every turn — optimize stop gate #606

@AIOSAI

Description

@AIOSAI

Discovery (S172)

SubagentStop hook event fires on EVERY response turn, not just when Agent tool sub-agents complete. Claude Code internally creates an agent per turn with empty agent_type.

Payload differences:

  • Real sub-agent: agent_type=general-purpose (or Explore, etc)
  • Internal turn: agent_type empty

Current impact:

  • subagent_stop_gate.py runs drone @git status every turn (~600ms wasted when no files modified)
  • Piper speaks subagent stop gate every turn
  • Checker itself works correctly — finds violations when files ARE modified

Potential optimization:

  • Read agent_type from stdin — skip full git status + seedgo check when empty (internal turn)
  • Or: only run when modified file count > 0 via a lighter check than drone subprocess
  • Keep Piper speaking regardless so the trust layer stays visible

Not urgent — 600ms overhead is tolerable, checker is functional, no false positives.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions