AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Nov 8, 2026, 19:01 JST

osFoundry: screen rules beat byte-tail for Claude Code prompts

Send on LINE
osFoundry: screen rules beat byte-tail for Claude Code prompts

3 Key Points

  1. What happened

    osFoundry (an app that runs coding agents in terminal panes) tested three ways to tell when Claude Code 2.1.303 is waiting for a reply; its screen-emulation rules matched all 11 real captures, while reading the last 8 KB of output matched only 5.

  2. Why it matters

    Claude Code draws prompts with cursor moves and no newline bytes, so prompt text never appears as a clean line — and a missed permission prompt can stall an agent session.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

Context & Analysis

Claude Code 2.1.303 builds its permission prompt by jumping the cursor to fixed columns with CSI sequences like \x1b[5G rather than writing spaces, and it sends no newline bytes at all — all 11 saved captures (2,099 to 7,672 bytes) contain zero. That design defeats the obvious shortcut of grepping the end of the output. A Python port of osFoundry's rules scored the last 8 KB of each capture after stripping escape sequences and keeping text after the final carriage return, and produced idle for every case, including the four that were truly blocked; the apparent prompt text also ran together into 'Doyouwanttoproceed?'. Feeding the same bytes into a minimal screen emulator that handles only characters, \r \n \b, cursor movement and erase recovered all 11 states correctly.

The osFoundry desktop app follows that conclusion. In terminal_pty.rs each session holds a vt100::Parser, and detection uses only screen_text() from the emulated screen. The 200-line scrollback above it is deliberately excluded, because a prompt that has already been answered and scrolled up would otherwise keep the pane marked blocked forever.

On a live setup with a stand-in agent that copies Claude Code's wording and redraw habits, a 700 ms sweep of all panes cost a median 0.26 s and up to 0.70 s of extra delay, with up to one cycle of lingering state — fine for a badge a person reads. The project's guidance for anyone building their own: classify the emulated screen, match prompt-specific text and footers, put blocked rules above working rules, keep the program that launches agents from editing those rules, and treat the process table as a way to see who is running, not who is waiting.

FAQ
Why doesn't waiting for silence work as a signal?
Some tool calls run silently for 0.5 to 6 seconds, and a finished turn is as quiet as a pending prompt. On a 30-task test, a 5-second silence rule fired 18 false positives while idle.
How does osFoundry avoid stale 'blocked' states?
It classifies an emulated 32x120 screen instead of the raw byte tail. Its code keeps a per-session vt100 parser and only feeds the emulated screen into detection, deliberately excluding the 200-line scrollback.
Can the machine tell whether a process is waiting?
On macOS, no. A process blocked on terminal read and a process sleeping between spinner frames both show state S, and CPU time does not separate them, so process state cannot confirm a pending prompt.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articlePangram AI Detection test: ChatGPT and Qwen Image 2.1 images caught