contd makes interactive CLI programs usable in an async way.
It is built for flows where plain run-until-exit CLIs: debuggers, REPLs, setup wizards, prompts, TUIs, and time-consuming commands.
showcase.mp4
Using contd with gdb to solve the CS:APP bomb lab in resumable attach steps.
- Supported: Linux, macOS
- Linux has stronger boundary detection (proc syscall/fd inspection), so stdin-wait recognition is more accurate.
- macOS uses heuristic detection and screen-stability checks, so behavior can be slightly less precise on some workloads.
- Install CLI:
curl -fsSL https://raw.githubusercontent.com/werifu/contd/main/install.sh | bash- Install skill for all supported agents:
npx -y skills@latest add werifu/contd-skill --skill contd --yes --global- Verify:
contd --helpSkill repo: https://github.com/werifu/contd-skill
- Keep one interactive process alive across many calls
- Drive it via
run+ repeatedattach - Get deterministic return points (
ready for input,timed out,exited) - Optional
--jsonmode for agent/tool integration
+---------+ run +-------+ fork +------------------+
| |----------------->| |-------------> | interactive CLI |
| | | | +------------------+
| Agent | | contd | wait for input |
| |<-----------------| |<-----------------------|
+---------+ +-------+ |
|
+---------+ +-------+ |
| | attach+input | | input |
| |----------------->| |----------------------->|
| Agent | | contd | |
| |<-----------------| |<-- output/input wait --|
+---------+ +-------+ |
v
# 1) Start a managed interactive session
$ contd run -- lldb-20 /path/to/contd
# 2) Continue the same live session by ID (or unique prefix)
$ contd attach 5e --input "b main\n"
$ contd attach 5e --input "run\n"
$ contd attach 5e --input "step\n"
# 3) Inspect or clean up sessions
$ contd list
$ contd kill 5e
$ contd cleanDefaults:
runhard timeout:10sattachhard timeout:300s- override with
--yield_timeout <duration>(hard deadline)
$ contd run -- lldb-20 /path/to/contd
ready for input
id: 5e25da868137dd1b499db90ab0446331
pid: 20049
output:
(lldb) target create "/path/to/contd"
Current executable set to '/path/to/contd' (x86_64).
(lldb)
$ contd attach 5e --input "b main\n"
ready for input
id: 5e25da868137dd1b499db90ab0446331
pid: 20049
output:
b main
Breakpoint 1: 2 locations.
(lldb)
$ contd attach 5e --input "run\n"
ready for input
id: 5e25da868137dd1b499db90ab0446331
pid: 20049
output:
run
Process 20378 launched: '/path/to/contd' (x86_64)
Process 20378 stopped
* thread #1, name = 'contd', stop reason = breakpoint 1.2
frame #0: 0x00005555556f6a30 contd`main
(lldb)Use --json when parsing events in agents/tools:
$ contd --json run -- /bin/cat
{"event":"session_waiting_input","session_id":"...","output":"","detector":{...}}Common events:
session_waiting_inputsession_steady_inputsession_yield_timeoutsession_exitederror
contd run -- <cmd> [args...]contd attach <session_id_or_prefix> [--input <text>]contd kill <session_id_or_prefix>contd list [session_id_or_prefix]contd gccontd clean
Global flags:
--json--verbose--raw-pty(run/attach)
Design details (broker model, Linux boundary detection, RPC/compatibility):
cargo test --features test-bins
cargo fmtIntegration tests are OS-scoped:
- Linux runs
tests/integration_linux.rs - macOS runs
tests/integration_macos.rs
Apache-2.0. See LICENSE.
