Summary
Allow shellwright to attach to and record an existing terminal session, rather than spawning a new one.
Use Case
Currently shellwright spawns processes via shell_start. But often you're already running something (claude code, vim, htop) and want to start recording mid-session. This feature would let you attach shellwright to an existing PTY and capture what's happening.
Proposed Approach
New tool: shell_attach or shell_record_external
Options:
- Attach by PID - attach to an existing process's PTY
- Attach by TTY - attach to a specific TTY device (e.g.,
/dev/ttys001)
- Pipe mode - shellwright reads from stdin, useful with
script or tmux
Example Usage
{
"tty": "/dev/ttys001",
"cols": 80,
"rows": 24
}
Or integration with tmux capture-pane / script command.
Technical Considerations
- Reading from existing PTY requires appropriate permissions
- May need to poll/capture the terminal buffer periodically
- Could leverage
tmux or screen for easier capture
- Alternative: provide a CLI mode where shellwright wraps an existing command
Alternative: Wrapper Mode
shellwright wrap -- claude
This would be simpler - shellwright spawns the process but the user interacts with it directly in their terminal, while shellwright records in the background.
Summary
Allow shellwright to attach to and record an existing terminal session, rather than spawning a new one.
Use Case
Currently shellwright spawns processes via
shell_start. But often you're already running something (claude code, vim, htop) and want to start recording mid-session. This feature would let you attach shellwright to an existing PTY and capture what's happening.Proposed Approach
New tool:
shell_attachorshell_record_externalOptions:
/dev/ttys001)scriptortmuxExample Usage
{ "tty": "/dev/ttys001", "cols": 80, "rows": 24 }Or integration with
tmux capture-pane/scriptcommand.Technical Considerations
tmuxorscreenfor easier captureAlternative: Wrapper Mode
This would be simpler - shellwright spawns the process but the user interacts with it directly in their terminal, while shellwright records in the background.