agentafk
Reference

Look up keyboard shortcuts

Find verified REPL key bindings for editing prompts, steering turns, navigating pickers, and reading output.

REPL keys depend on what currently owns the terminal: your prompt, a running turn, a picker, or a viewer. Start with the tables below rather than assuming a key does the same thing everywhere. These bindings describe the normal TUI unless a different input reader is named explicitly.

Run /keys for the built-in quick reference and /help for commands. Plain output (AFK_PLAIN_OUTPUT=1) uses a simple line reader instead of the normal TUI, so most application-level bindings below do not apply there.

Submit, stop, and switch modes

KeyContextAction
EnterIdle prompt with text or an imageSubmit the prompt. Empty input does nothing.
EnterRunning turn with a draftCommit the draft to the type-ahead queue and clear the input for another draft.
EnterSlash completion menuApply the selected command and submit.
EnterFile or flag completion menuApply the selection without submitting.
Shift+EnterPrompt, terminal reports the modifierInsert a newline.
Alt+EnterPromptInsert a newline.
Backslash then EnterPrompt ending with a continuation backslashReplace the trailing backslash with a newline.
EscRunning turn, outside a picker or task viewSoft-stop, preserve completed work and the draft, and wait for teardown. Does not roll back effects.
EscIdle promptDismiss completion UI; at an empty prompt, dismiss the proposed next action.
Esc twiceEmpty idle prompt, within 600 msOpen the conversation rewind selector.
Ctrl+CRunning model turn with an armed TUIOpen the Stop / Cancel picker.
Ctrl+C againInterrupt picker openHard-cancel and close the REPL immediately.
Ctrl+CRunning model turn without an armed TUIRequest a soft-stop.
Ctrl+C twiceIdle prompt, within 1.5 secondsExit. The first press prints the exit reminder.
Ctrl+CForeground ! shell commandAbort the shell before applying model-turn or idle-exit actions.
Ctrl+DEmpty TUI inputSignal EOF through the cancel path. At idle, the exit confirmation behavior still applies. Use /exit for a direct exit.
Ctrl+DNon-empty TUI inputDelete the character after the cursor.
Ctrl+LPrompt or streaming inputClear the screen and repaint, without clearing conversation context.
Shift+TabPrompt or streaming inputCycle default → plan → bypassPermissions → default. From AFK mode, exit AFK and land on default.
Ctrl+BRunning turnFirst promote eligible foreground subagents; otherwise detach eligible bash/compose calls; otherwise do nothing. Never detaches the whole turn.
Ctrl+BIdle normal TUINo action.
Ctrl+ONormal TUIOpen the current draft in $VISUAL, or $EDITOR if VISUAL is unset. Successful edits return to the buffer without sending.
Ctrl+GNormal TUIOpen captured output from the most recent bash command that has a capture. This is not a viewer for the currently running command's live tail.

Shift+Tab is a permission-mode cycle, not just a plan toggle. The bypass step disables path-approval prompts and containment. Cancel and exit do not undo changes already made. See Permissions and Undo changes.

Edit and navigate the prompt

On macOS, Alt usually means Option configured to send Meta. Terminal-specific Command mappings only work if your terminal forwards the corresponding control sequence to AFK.

KeyContextAction
Left / RightText inputMove one character. Right has ghost-accept behavior at the end of the buffer, described below.
Ctrl+A / HomeNormal TUI inputMove to the start of the current logical line, not the whole multiline buffer.
Ctrl+E / EndNormal TUI inputMove to the end of the current logical line.
Ctrl+Left / Alt+LeftNormal TUI inputMove one word backward.
Ctrl+Right / Alt+RightNormal TUI inputMove one word forward.
Alt+B / Alt+FPromptMove one word backward / forward.
BackspacePromptDelete the previous character. A collapsed paste placeholder is deleted as one unit at its boundary.
BackspaceEmpty text buffer with image attachmentsRemove the most recently attached image. Does not dequeue type-ahead messages.
DeletePromptDelete the next character; a collapsed paste placeholder is deleted as one unit at its boundary.
Alt+BackspacePromptDelete the previous word (Option+Delete on macOS).
Alt+DeletePromptDelete the next word (Option+Fn+Delete on macOS).
Ctrl+WPromptDelete the previous word.
Ctrl+UPromptDelete from the cursor to the start of the current line.
Ctrl+KPromptDelete from the cursor to the end of the current line.
Up / Ctrl+PCompletion menu openMove the selection upward.
Down / Ctrl+NCompletion menu openMove the selection downward.
Up / Ctrl+PEmpty buffer, menu closed, pending type-aheadRecall the newest queued message and its attachments for editing.
Up / Ctrl+PNormal TUI, menu closedRecall older input history.
Down / Ctrl+NNormal TUI, menu closedMove forward through input history.
TabCompletion menu openInsert the highlighted completion without sending.
TabStreaming, no completion menu, running child availableOpen the newest running subagent's live view.
TabNo higher-priority completion or task viewAccept the full ghost suggestion. Otherwise no action.
RightCursor at buffer end, ghost visible, menu closedAccept the next word of the ghost suggestion.
Ctrl+VTUI, supported clipboard image backendAttach a clipboard image. macOS uses the pasteboard; Linux uses wl-paste or xclip.
Cmd+VmacOS terminal pastePaste text, or probe the clipboard for an image when terminal paste handling makes it available.

Typing @ followed by a path opens file completion. Slash completion can start at the beginning of input or after whitespace within a draft. Type -- after a slash command to complete advertised flags. These are input triggers, not separate key chords.

Alternate raw input reader

The alternate raw reader has additional bindings not wired into the standard compositor-backed prompt. It is not enabled by plain output, which chooses the simple line reader instead. This distinction also explains why some entries printed by /keys do not work in the normal prompt.

KeyContextAction
Ctrl+B / Ctrl+FAlternate raw readerMove one character backward / forward.
Home / EndAlternate raw readerMove to the whole buffer's start / end.
Up / Ctrl+PAlternate raw reader, menu closedMove up a visual row in a multiline draft; recall history when movement is unavailable.
Down / Ctrl+NAlternate raw reader, menu closedMove down a visual row; otherwise move forward in history.
Ctrl+XAlternate raw readerRemove the most recently attached image.
Ctrl+DAlternate raw readerEOF only on an empty buffer; no action on a non-empty buffer.
Ctrl+RAlternate raw readerStart incremental reverse input-history search. Type a query to search; repeated Ctrl+R moves to older matches.
EnterReverse input-history searchAccept the displayed match and submit through the normal Enter handler.
Esc / Ctrl+GReverse input-history searchCancel the search and restore the draft saved before searching.
BackspaceReverse input-history searchRemove the last query character and search again.
Ctrl+CReverse input-history searchPass the interrupt to the surrounding reader.
Other navigation keyReverse input-history searchKeep the current match, leave search, and process that key normally.

For conversation search in the standard REPL, use /search <term> or /search --error.

Pickers and settings

These shared picker bindings apply to /model, /resume, the settings categories, usage-pause choices, and the Stop / Cancel menu. The rewind selector supports Up/Down, Enter, and Esc/Ctrl+C, but not all shared-picker shortcuts.

KeyContextAction
Up / Ctrl+PShared pickerSelect the previous option.
Down / Ctrl+NShared pickerSelect the next option.
Home / EndShared pickerSelect the first / last option.
EnterSingle-choice pickerConfirm the highlighted option.
SpaceMultiple-choice pickerToggle the highlighted option.
EnterMultiple-choice pickerConfirm the selected set.
EscOrdinary pickerCancel or go back one settings level. In the interrupt menu, the running turn continues.
Ctrl+CShared pickerCancel, except the interrupt menu where it hard-cancels the session.
Printable charactersSearchable /resume pickerAppend to the fuzzy filter.
Backspace / DeleteSearchable pickerRemove the last filter character.
EscSearchable picker with non-empty filterClear the filter first; press again to dismiss.
EnterResume conversation previewResume the selected session.
Esc / Ctrl+CResume preview or bug-report previewCancel the preview action.
EnterBug-report previewConfirm submission.
Up / DownConversation rewind selectorChoose an earlier prompt.
EnterConversation rewind selectorRewind and load the chosen prompt for editing.
Esc / Ctrl+CConversation rewind selectorCancel without rewinding.

Settings text fields

These bindings apply to the in-TUI text editor used for settings and other short field values, not the external $EDITOR.

KeyContextAction
Left / Ctrl+BSettings text fieldMove one character backward.
Right / Ctrl+FSettings text fieldMove one character forward.
Home / Ctrl+ASettings text fieldMove to the start of the field.
End / Ctrl+ESettings text fieldMove to the end of the field.
Backspace / DeleteSettings text fieldDelete the previous / next character.
Ctrl+WSettings text fieldDelete the previous word.
Ctrl+U / Ctrl+KSettings text fieldDelete to line start / end.
EnterSettings text fieldValidate and confirm. Validation errors keep the field open.
Esc / Ctrl+CSettings text fieldCancel the edit.

Subagent task views

KeyContextAction
Up / Down/tasks listSelect a subagent.
Enter/tasks listOpen the highlighted subagent's history and live output.
Esc / Ctrl+C/tasks listReturn to the main conversation.
Esc/tasks:view <id>Leave the task view.
TabParent turn streaming, no completion menuOpen the most recently dispatched running child, if one exists.
Printable text then EnterMid-turn child viewSend a message to the child.
BackspaceMid-turn child viewRemove the last character from the child-message draft.
EscMid-turn child view or its completion screenReturn to the parent view without cancelling the child.

The mid-turn child view is a separate input context. Parent turn activity continues while you read it. Other control keys are not prompt-editing shortcuts there.

Bash output viewer

Open the viewer with Ctrl+G. It reads saved output and starts at the tail, rather than attaching to the running shell. If there is no capture or it has expired, the error screen closes on any key.

KeyContextAction
Up / Ctrl+PViewerScroll up one line.
Down / Ctrl+NViewerScroll down one line.
Page Up / Page DownViewerScroll approximately one screen.
g / HomeViewerJump to the top.
G / EndViewerJump to the bottom.
/ViewerStart entering a search query.
EnterViewer search inputApply a case-insensitive substring search.
Backspace / DeleteViewer search inputRemove the last query character.
EscViewer search inputCancel the new query and keep the previous search.
n / NViewer with search resultsMove to the next / previous match, wrapping at the ends.
EscViewer with an active searchClear the search first.
EscViewer without an active searchClose the viewer.
qViewer outside search-input modeClose the viewer immediately.

Terminal compatibility

Modified Enter and Alt/Option keys depend on your terminal forwarding distinct sequences. If Shift+Enter submits instead of inserting a newline, use Alt+Enter, a trailing backslash, or Ctrl+O.

In tmux with its default prefix, Ctrl+B twice sends a literal Ctrl+B to AFK. Enable extended keys for reliable modified Enter handling, and reduce tmux's Escape delay if soft-stop feels slow. See the REPL terminal settings.

On this page