Duet’s shared terminal is the heart of pair programming sessions. Every user in a room shares the same terminal - all input and output is synchronized in real-time.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jaypopat/cf_ai_duet/llms.txt
Use this file to discover all available pages before exploring further.
Terminal Features
Real-time Synchronization
When any user types in the terminal:- Their input is broadcast to all users in the room
- Everyone sees the same terminal state
- Terminal updates are pushed to all clients via subscription channels (internal/ui/model.go:637-671)
Typing Indicators
You can see when others are actively typing:- Appears when a user sends input to the terminal
- Displays “[username] is typing…”
- Automatically clears after 2 seconds of inactivity
- Debounced to avoid spam (500ms between broadcasts)
Pre-installed Tools
Each room’s workspace includes:- nvim - Text editor for collaborative coding
- Node.js - JavaScript runtime for running scripts
- Standard Unix utilities (git, grep, find, etc.)
Working in the Terminal
Basic Terminal Input
The terminal accepts all standard keyboard input (internal/ui/model.go:418-464):- Regular keys - Type normally
- Enter - Send command
- Backspace - Delete character (sends ASCII 127)
- Tab - Auto-completion
- Arrow keys - Navigate command history and cursor
- Up:
\x1b[A - Down:
\x1b[B - Right:
\x1b[C - Left:
\x1b[D
- Up:
- Home/End - Jump to line start/end
- Delete - Forward delete
- Esc - Escape key
Running Commands
Simply type commands as you would in any terminal:- The commands being executed
- Real-time output
- Any errors or results
Working with Files
Using nvim
The workspace includes nvim for collaborative editing:- Only one person should edit at a time to avoid conflicts
- Use the AI assistant or sandbox for file operations when working simultaneously
File Operations
Standard Unix file commands work as expected:Terminal Modes
Duet has different input modes (internal/ui/screen.go:16-23):Normal Mode (Default)
- Standard terminal interaction
- All keyboard input goes to the terminal
- Use keyboard shortcuts to access other features
AI Mode
See AI Interaction for details on the AI prompt mode.Sandbox Mode
See AI Interaction for details on direct sandbox command execution.Special Keyboard Shortcuts
These shortcuts are reserved for Duet features and won’t be sent to the terminal:ctrl+g- Enter AI prompt modectrl+r- Enter sandbox command modectrl+a- Toggle AI sidebar visibilityctrl+j- Scroll AI sidebar downctrl+k- Scroll AI sidebar upctrl+l- Leave room and return to launch screen
Workspace Directory
Your terminal starts in the room’s workspace directory:- Path:
/app/workspaces/<workspace-name>/ - Isolated per room
- Persists for the lifetime of the room
- Automatically deleted when the last user leaves
Best Practices
Coordination
- Communicate before running destructive commands - Everyone shares the same filesystem
- Take turns editing files - Multiple simultaneous edits can cause conflicts
- Use descriptive commit messages - Others can see your git activity
Performance
- The terminal auto-resizes based on window dimensions (internal/ui/model.go:156-159)
- Minimum recommended size: 120x24 for optimal layout with sidebars
- Terminal content is efficiently streamed via update channels
Troubleshooting
- If the terminal seems frozen, it may be waiting for input in a program (like nvim or less)
- Press
ctrl+cin the terminal to cancel a running command - Use
ctrl+l(Duet shortcut) to leave the room if something goes wrong
Terminal Limitations
- The terminal runs in a chroot environment for security
- Some system-level commands may not be available
- Network access depends on server configuration
- Terminal size is shared - one user’s window resize affects everyone