Skip to content

Add agent hooks and the subagent_stop, pre_compact, and session_end events #168

Open

Description

@hakula139

Goal

Some checks need to read files or run commands before deciding, such as reviewing a diff before a turn ends. An agent handler runs a read-only child agent for these checks. The other lifecycle events let hooks guide compaction and clean up after a session.

Acceptance criteria

  • An agent handler runs a child engine with the hook's prompt and an optional definition (use = "<agent>"). By default, it has read-class tools, a read-only sandbox, 20 turns, no hooks, denied asks, and a 10 min timeout. Its final message is parsed like a prompt reply.
  • subagent_stop fires when a child agent ends a turn and honors continue.
  • pre_compact fires before summarization with the trigger and instructions, and its context is added to the summary instructions.
  • session_end fires on exit, /clear, and session roll. All its hooks share a 5 s budget.
  • Tests cover each event's payload and honored fields, as well as an agent hook's verdict.

Notes

Depends on #159. This issue establishes the agent execution core that #134 describes and #136's subagents reuse, so #136 depends on this issue, not the other way round. The core runs a child as an in-process engine with its own cwd and messages, the parent's policy and mode, and the parent frontend's approval channel.

Activity

  1. self-assigned this
    on Oct 15, 2026
  2. added
    enhancement
    area: agent
    area: extensions
    on Oct 15, 2026
  3. added this to the milestone on Oct 15, 2026
  4. modified the milestones: , v0.1.0 on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: agentarea: extensionsenhancement

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions