tui-smoke-test-with-tmux
Skill44 starsChanged 3 months agoApache-2.0View on GitHub
Verify and debug this project's ratatui/crossterm TUI by running the ACN agent CLI inside tmux, capturing terminal screens as text, sending scripted keys, checking stderr, and writing focused tmux regressions for requested TUI flows. Use after changes to src/session_tui, src/bin/acn.rs interactive mode, terminal rendering, key handling, layout, composer behavior, queued input behavior, cancellation, scrolling, or when asked to smoke-test a concrete TUI flow.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- code-reviewSkill
- verifySkill
- code-reviewSkill
- tui-smoke-test-with-tmuxSkill
- verifySkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill to validate the real terminal behavior of the Agent Claim Network TUI.
- Very specific: line 24
Ensure tmux is installed. If an environment or dependency is missing, fix that environment issue first.
- Very specific: line 37
When the user asks whether a concrete TUI behavior is fixed, do not rely only on the default /help smoke test.
- Very specific: line 43
Always assert stderr.log is empty and the tmux session is cleaned up.
- Distinctive: line 85
If a flow depends on long LLM turns, prefer a controlled test hook or a focused unit test for the exact state transition, then use tmux to …
- Distinctive: line 96
Treat the smoke test as passing only when:
- Distinctive: line 107
Run the default smoke test:
- Distinctive: line 113
Run focused resize regressions:
- Distinctive: line 120
Use a different agent or config:
- Distinctive: line 140
Keep ANSI escape codes for color/style review:
- Distinctive: line 155
Always clean up stale sessions before or after a failed run:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TUI Smoke Test With tmux
Use this skill to validate the real terminal behavior of the Agent Claim Network TUI. It supports both the default smoke test and task-specific tmux scripts for user-described interaction flows.
The project TUI entrypoint is:
cargo run --quiet --bin acn -- --config config.tomlThe TUI uses ratatui + crossterm, so verify it in a real tty. Prefer tmux capture files over screenshots because they can be inspected with rg, sed, and diffs.
The bundled runners that inspect TOML config use Python's standard library and require Python
3.11+ (tomllib). Their shared preflight reports this requirement before starting a TUI.
Workflow
- Review the TUI change and decide the expected screen states or key flow.
- Ensure
tmuxis installed. If an environment or dependency is missing, fix that environment issue first. - Source
export_env.shbefore verification when it exists or the run needs API/model variables. - For broad startup verification, run the bundled smoke script from the repo root:
.agents/skills/tui-smoke-test-with-tmux/scripts/tui_tmux_smoke.sh- For a specific user story, write a focused script using
scripts/tui_tmux_lib.sh; use an existing regression script as the structural example. - Inspect the generated
*.txtcaptures andstderr.log; use exact text assertions where stable.
Focused Verification
When the user asks whether a concrete TUI behavior is fixed, do not rely only on the default /help smoke test. Convert the behavior into a tmux flow:
- Name the flow after the behavior, for example
queue-cancel-resend. - Define checkpoints:
initial,queued,after_cancel,after_resend, etc. - At each checkpoint, capture the pane to a task-specific directory under
target/. - Assert stable visible markers with
rg; avoid brittle assertions on session ids, timing-dependent model output, or full-screen whitespace. - Always assert
stderr.logis empty and the tmux session is cleaned up.
For one-off verification, create the script in a task-specific directory under target/. For a reusable regression, add it under this skill's scripts/ directory. Source scripts/tui_tmux_lib.sh, which provides:
tui_start: build if needed, create the runner, and start the fixed-size tmux session.tui_capture <name>: save the current pane as<name>.txt.tui_send_keys ...: send keys such as"/help" Enter,Escape,PageUp.tui_assert_contains <capture> <regex> <message>: fail if a capture lacks an expected marker.tui_assert_not_contains <capture> <regex> <message>: fail if a capture shows a forbidden marker.tui_assert_stderr_empty: fail on stderr output.
Example custom flow:
#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT"
source "$REPO_ROOT/.agents/skills/tui-smoke-test-with-tmux/scripts/tui_tmux_lib.sh"
TUI_CASE="queue-cancel-resend"
TUI_OUT_DIR="target/tui-flows/$TUI_CASE"
tui_start
sleep 3
tui_capture "initial"
tui_assert_contains "initial" "ACN|open|initializing" "TUI did not start"
# Replace these keys with the flow required by the user story.
tui_send_keys "第一条" Enter
sleep 1
tui_send_keys "第二条" Enter
sleep 1
tui_send_keys Escape
sleep 1
tui_capture "after_cancel"
tui_assert_contains "after_cancel" "第二条|turn cancelled" "cancel did not restore expected state"
tui_assert_stderr_emptyIf a flow depends on long LLM turns, prefer a controlled test hook or a focused unit test for the exact state transition, then use tmux to verify the terminal shell of the behavior. Do not fake successful external behavior in production code.
Default Checks
The bundled script builds --bin acn first, then starts a fixed-size tmux session and captures:
initial.txt: startup screen.after_help.txt: screen after typing/helpand pressing Enter.final.txt: final visible screen before cleanup, if the session still exists.stderr.log: stderr from the TUI process.
Treat the smoke test as passing only when:
- the captured screen shows the ACN status line or initialization state;
/helpshows theACN commandsheader and the/skillscommand;stderr.logis empty;- the tmux session is cleaned up.
Expected stable strings in the current TUI include Agent Claim Network, Whisper your wish here..., type / for commands · Enter sends, ACN commands, /skills, initializing, and open. Agent ids, session ids, elapsed time, model output, and terminal whitespace are dynamic and must not be treated as stable assertions.
Useful Commands
Run the default smoke test:
.agents/skills/tui-smoke-test-with-tmux/scripts/tui_tmux_smoke.shRun focused resize regressions:
.agents/skills/tui-smoke-test-with-tmux/scripts/tui_tmux_welcome_resize_regression.sh
.agents/skills/tui-smoke-test-with-tmux/scripts/tui_tmux_live_region_regression.shUse a different agent or config:
.agents/skills/tui-smoke-test-with-tmux/scripts/tui_tmux_smoke.sh \
--command "cargo run --quiet --bin acn -- --config config.toml --upstream agent_hub"自定义命令默认不管理 supervisor,避免终止共享 config 下原本存在或后来复用该
supervisor 的其他 TUI。只有 config 与 acn_home 都是本次测试独占的临时资源时,
才传 --supervisor-config 启用回收;其值必须与自定义命令传给 --config 的参数
文本一致。直接使用已构建二进制时还可传 --supervisor-binary
/absolute/path/to/acn,加强进程候选过滤。
Skip the pre-build only when an explicit binary is already known to be current:
TUI_ACN_BINARY=/absolute/path/to/acn \
.agents/skills/tui-smoke-test-with-tmux/scripts/tui_tmux_smoke.sh --skip-buildKeep ANSI escape codes for color/style review:
tmux capture-pane -t acn_tui_smoke -e -p > target/tui-smoke/screen.ansi.txtSend keys manually to an active session:
tmux send-keys -t acn_tui_smoke "/help" Enter
tmux send-keys -t acn_tui_smoke PageUp PageDown
tmux send-keys -t acn_tui_smoke Escape
tmux send-keys -t acn_tui_smoke "/exit" EnterAlways clean up stale sessions before or after a failed run:
tmux kill-session -t acn_tui_smoke 2>/dev/null || trueWhen Debugging Failures
- Empty or garbled capture: confirm the command is running in tmux, the fixed size is large enough, and the TUI entered alternate screen.
- Missing prompt/footer: inspect
src/session_tui/chat_widget.rs,src/session_tui/bottom_pane/mod.rs, and the current rendering tests. - Keys not taking effect: inspect
handle_key_event,classify_input, and whether the state accepts text. - Non-empty stderr: fix the underlying panic, terminal error, config issue, or dependency problem instead of bypassing the smoke test.
- Startup hangs: capture the initial screen and stderr, then decide whether the app is waiting on external services, LLM env vars, or session initialization.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

