[OneDev #21] ghst skill: add wait_for_text helper (semantic blocking on PTY output) #20

Closed
opened 2026-05-24 04:46:38 +00:00 by joseph · 1 comment
Owner

Imported from OneDev issue #21 (id 35426)
Original project: internal-joseph
Original state: Closed
Original submitterId: 5
Original submitDate: 2026-04-18T13:37:16.967+00:00
Original lastActivity: {'date': '2026-04-22T18:45:48.836+00:00', 'description': "changed state to 'Closed'", 'userId': 5}

Original fields:

  • Type: New Feature
  • Priority: Normal
  • Assignees: None

Background

From the ghst vs tui-use eval (internal-joseph#13): tui-use's wait --text "pattern" is the one genuine advantage — it blocks until a text pattern appears in the terminal, with no polling guesswork. ghst currently relies on a 400ms settle heuristic after send, which is fragile for slow-starting programs.

Task

Add a wait_for_text polling pattern to the ghst skill (SKILL.md) so agents have a reliable way to block until a prompt or output appears.

Implementation

In the ghst skill, document a reusable loop:

repeat:
  mcp__ghst__read { session: "<name>", lines: 20 }
  if output contains pattern → proceed
  else if timeout exceeded → fail/flag
  else → repeat (short interval, e.g. 500ms via Bash sleep)

Keep it in the skill as a documented pattern (not a new MCP tool). The agent loops using Bash + ghst__read until the pattern matches or a deadline is exceeded.

Acceptance criteria

  • Pattern documented in SKILL.md under a "Semantic waiting" or "Waiting for output" section
  • Includes timeout handling (deadline + error path)
  • Example shows waiting for a shell prompt ($) and waiting for program-specific text
  • Skill edit goes to git source (~/git/internal-joseph/skills/ghst-subagent-dispatch/SKILL.md), not ~/.claude/skills/
Imported from OneDev issue #21 (id 35426) Original project: internal-joseph Original state: Closed Original submitterId: 5 Original submitDate: 2026-04-18T13:37:16.967+00:00 Original lastActivity: {'date': '2026-04-22T18:45:48.836+00:00', 'description': "changed state to 'Closed'", 'userId': 5} Original fields: - Type: New Feature - Priority: Normal - Assignees: None ## Background From the ghst vs tui-use eval (internal-joseph#13): tui-use's `wait --text "pattern"` is the one genuine advantage — it blocks until a text pattern appears in the terminal, with no polling guesswork. ghst currently relies on a 400ms settle heuristic after `send`, which is fragile for slow-starting programs. ## Task Add a `wait_for_text` polling pattern to the ghst skill (`SKILL.md`) so agents have a reliable way to block until a prompt or output appears. ## Implementation In the ghst skill, document a reusable loop: ``` repeat: mcp__ghst__read { session: "<name>", lines: 20 } if output contains pattern → proceed else if timeout exceeded → fail/flag else → repeat (short interval, e.g. 500ms via Bash sleep) ``` Keep it in the skill as a documented pattern (not a new MCP tool). The agent loops using Bash + ghst__read until the pattern matches or a deadline is exceeded. ## Acceptance criteria - Pattern documented in `SKILL.md` under a "Semantic waiting" or "Waiting for output" section - Includes timeout handling (deadline + error path) - Example shows waiting for a shell prompt (`$`) and waiting for program-specific text - Skill edit goes to git source (`~/git/internal-joseph/skills/ghst-subagent-dispatch/SKILL.md`), not `~/.claude/skills/`
Author
Owner

Imported from OneDev comment id 400 on issue #21
Original userId: 5
Original date: 2026-04-22T18:45:47.836+00:00

Already implemented: ghst-subagent-dispatch/SKILL.md has a "## Waiting for output (semantic)" section (lines 32–54) with the full Bash deadline loop, timeout error path, and examples for shell prompt ($/PS >) and program-specific text. All acceptance criteria met.

Imported from OneDev comment id 400 on issue #21 Original userId: 5 Original date: 2026-04-22T18:45:47.836+00:00 Already implemented: `ghst-subagent-dispatch/SKILL.md` has a "## Waiting for output (semantic)" section (lines 32–54) with the full Bash deadline loop, timeout error path, and examples for shell prompt (`$`/`PS >`) and program-specific text. All acceptance criteria met.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
joseph/internal-joseph#20
No description provided.