Skip to content

feat: record existing terminal session #49

@dwmkerr

Description

@dwmkerr

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:

  1. Attach by PID - attach to an existing process's PTY
  2. Attach by TTY - attach to a specific TTY device (e.g., /dev/ttys001)
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions