Clarify#
The clarify tool lets a subagent pause and ask its parent orchestrator a
question when it cannot proceed without more information. The session stops
cleanly and the parent can answer with subagent_reply(agent_id, reply),
which re-spawns the subagent with the original task and the Q&A in context.
The tool is opt-in and enabled automatically for subagents; enable it explicitly
with -t +clarify.
Clarify tool — subagents use this to pause and ask the parent for more information.
Registers the clarify block type so the executor recognizes it as a valid
tool call and stops the session cleanly (instead of letting auto_reply_hook fire
and append follow-up messages that push the clarify block away from log[-1]).
Only enabled in autonomous/subagent sessions (disabled_by_default=True).
The parent receives a ❓ hook notification via subagent hooks and can answer
with subagent_reply(agent_id, reply) to re-spawn with full Q&A context.
- gptme.tools.clarify.clarify_hook(messages: list[Message], **kwargs) Generator[Message, None, None]
Detect a clarify block and stop the session immediately.
Runs at GENERATION_PRE (before generating the next response) to halt the subagent session the moment it writes a clarify block, preventing auto_reply_hook from injecting a follow-up user message that would push the clarify block away from log[-1] and cause _read_log() to miss it.