Skip to content

research(tools): Claude Code Monitor tool — stream background process events into agent context #3328

@bug-ops

Description

@bug-ops

Description

Claude Code v2.1.100+ added a Monitor tool that allows the agent to subscribe to streaming stdout events from background processes and receive notifications as events arrive. This enables the agent to watch long-running scripts without polling.

Pattern

The Monitor tool works in conjunction with background script execution:

  1. Start a background process (e.g., a test runner, build, or server)
  2. Call Monitor with the process reference to receive a stream of stdout lines as tool events
  3. Agent reacts to events (e.g., test failure, build complete) without sleeping or polling

Relevance to Zeph

Zeph's zeph-tools provides ShellExecutor which currently blocks until completion. Adding a Monitor-style streaming mode would enable:

  • Long-running tool outputs streamed into context as they arrive
  • TUI status updates from background builds / test runs
  • Hook-based reactions to specific stdout patterns (e.g., fire a PostToolUse hook when output contains "error")

Implementation Sketch

Add ShellExecutorMode::Streaming variant to ToolExecutor:

  • Spawn process, return AsyncStream<ToolEvent>
  • Each stdout line = one ToolEvent::Partial
  • On process exit: ToolEvent::Complete with exit code

Expose in TUI as a spinner with live output tail.

Source

Metadata

Metadata

Assignees

Labels

P3Research — medium-high complexityllmzeph-llm crate (Ollama, Claude)researchResearch-driven improvement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions