repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

skills(terminal-harness): document bounded marker polling

f34cc5a8939a3e54aea0182b5cb522f8f2489a22

Oliver Jan Krylow <oliver@bugabinga.net> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (3)

pi/agent/skills/terminal-harness/SKILL.md

Modified
39 39 1. Observe an app-specific ready state before sending input.
40 40 2. Send literal text and control keys as separate actions.
41 41 3. After each action, capture the current viewport and wait for a visible state change.
42 -4. Poll observable state with a short bound; never use a blind sleep as control flow.
42 +4. Poll observable state with a short bound; never use a blind sleep as control flow. Use the wait-until-marker loop from the provider reference.
43 43 5. Treat process names as hints, not proof that the app is ready or idle.
44 44 6. Use the agent shell for setup, file inspection, and independent verification.

pi/agent/skills/terminal-harness/references/tmux.md

Modified
39 39 Alternate-screen TUIs may expose only the current viewport.
41 +## Wait for a State
43 +Poll until a literal marker appears.
44 +The loop returns as soon as the marker shows, a capture failure breaks it, and the `seq` times `sleep` product bounds the wait.
46 +```bash
47 +out=""
48 +for i in $(seq 60); do
49 + out=$(tmux capture-pane -p -t "$APP_PANE") || break
50 + printf '%s' "$out" | grep -qF -- "$MARKER" && break
51 + sleep 5
52 +done
53 +printf '%s' "$out"
54 +```
56 +Match markers with `grep -F` so text like `[ok]` or `done.` is literal, not a regex.
57 +Never park a wait in `sleep N; tmux capture-pane`;
58 +the bash tool timeout is only a kill ceiling, and pi has no key that ends one tool call without aborting the whole turn.
41 60 ## Input
43 62 Literal text and Enter:

pi/agent/skills/terminal-harness/references/wezterm.md

Modified
34 34 The first command captures the current screen.
35 35 The second includes recent scrollback.
37 +## Wait for a State
39 +Poll until a literal marker appears.
40 +The loop returns as soon as the marker shows, a capture failure breaks it, and the `seq` times `sleep` product bounds the wait.
42 +```bash
43 +out=""
44 +for i in $(seq 60); do
45 + out=$(wezterm cli get-text --pane-id "$APP_PANE") || break
46 + printf '%s' "$out" | grep -qF -- "$MARKER" && break
47 + sleep 5
48 +done
49 +printf '%s' "$out"
50 +```
52 +Match markers with `grep -F` so text like `[ok]` or `done.` is literal, not a regex.
53 +Never park a wait in `sleep N; wezterm cli get-text`;
54 +the bash tool timeout is only a kill ceiling, and pi has no key that ends one tool call without aborting the whole turn.
37 56 ## Input
39 58 `send-text --pane-id` writes to the target pane without activating or focusing its GUI.