# APP-4907 - TUI input focus during agent drafting

APP-4907 is a Claude Code subagent that keeps TUI input active while an agent prepares a tool call, then hands focus to an approval card when blocking begins.

- subagent · `type=agent` · Claude Code, Codex, Cursor · ★ 720 repo stars
- Author: dominikmartn
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Updated: 2026-11-10
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/agents/app-4907-tui-input-focus-during-agent-drafting

## What it does

APP-4907 defines a fix for TUI input losing keyboard focus while an agent prepares a shell command, file change, or question. A selector may be created in the background, but it must not capture keys before a visible approval surface exists.

When the action reaches `AIActionStatus::Blocked`, approval cards remain interactive, including the shell-command editor and the `AskUserQuestion` selector. Once the block is resolved or dismissed, focus returns to the session input with its draft, cursor, and selection preserved. Installation requires placing the subagent file in the platform-specific agent directory.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/agents/APP-4907---TUI-input-focus-during-agent-drafting.md` — For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

### Codex

**Manually: put the files in place**
- File: `.codex/agents/APP-4907---TUI-input-focus-during-agent-drafting.toml` — Codex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/

### Cursor

**Manually: put the files in place**
- File: `.cursor/agents/APP-4907---TUI-input-focus-during-agent-drafting.md` — Cursor also reads .claude/agents/

## When to use it
- keep session input usable during tool-call preparation
- stop a hidden approval selector from consuming keystrokes
- move focus to the shell-command approval editor after blocking
- restore the draft and cursor after a permission prompt closes
- keep `AskUserQuestion` interaction active while answers are awaited

## Example prompts
- Investigate APP-4907 and fix TUI input focus while a shell command is being prepared.
- Test focus handoff from file-edit preparation to the approval card, including cursor preservation.
- Add coverage for `AskUserQuestion` and focus restoration after a blocked action is dismissed.

## Similar
- [codex-tui-proof](https://affpapa.org/en/nevibecode/plugins/codex-tui-proof.md) — plugin · ★ 1596 repo stars
- [Focus Session Manager](https://affpapa.org/en/nevibecode/skills/focus-session-manager.md) — skill · 167 installs
- [textual-tui-skill](https://affpapa.org/en/nevibecode/skills/textual-tui-skill.md) — skill · 268 installs
- [focus-analyst](https://affpapa.org/en/nevibecode/agents/focus-analyst.md) — subagent · ★ 1198 repo stars
- [tui-design](https://affpapa.org/en/nevibecode/skills/tui-design.md) — skill · 1400 installs
- [tui-fundamentals](https://affpapa.org/en/nevibecode/skills/tui-fundamentals.md) — skill · 369 installs

From the same set: [dominikmartn/harp](https://affpapa.org/en/nevibecode/by/dominikmartn/harp.md) — 62 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
