Introduction
The quality of a prompt scales with how structured it is. A one-line ask gets a one-line answer's worth of effort from the model; a structured multi-section prompt with context, constraints, and examples gets focused work. Hermes makes multiline prompting cheap: Alt+Enter, Ctrl+J, and Shift+Enter all insert a new line without sending. Once entering multiple lines is friction-free, prompts get better.
Key Concepts
- Multiline input: A single prompt spanning multiple lines.
- New-line keystrokes:
Alt+Enter,Ctrl+J,Shift+Enter(terminal-dependent). - Backslash continuation: Ending a line with
\continues on the next line. - Structured prompts: Multi-section prompts with context, request, and constraints.
Real World Context
A developer types a one-liner: "refactor parseInput". The agent guesses what "refactor" means and produces something close to wrong. A different developer types a 12-line prompt with the file path, the target API, the constraints (no breaking changes), and an example of the desired call site. The agent does the right thing on the first try. The second developer paid a 30-second formatting cost and saved a 10-minute rework.
Deep Dive
Hermes accepts multiline input through three keystrokes and one continuation marker:
Alt+Enter is the canonical new-line in most terminals. macOS Terminal, iTerm2, Alacritty, and many Linux terminals all support it cleanly.
Ctrl+J is the universal fallback. It works in every terminal because it is a control character, not a modifier combination. If Alt+Enter does not produce a new line on your setup, switch to Ctrl+J.
Shift+Enter works when the terminal advertises a distinct sequence for it via the Kitty keyboard protocol or xterm's modifyOtherKeys mode. Modern terminals (Kitty, WezTerm, recent xterm) support it; many do not. Test once and standardize on whichever works for your setup.
Windows Terminal note: Windows Terminal captures Alt+Enter for fullscreen toggle. Use Ctrl+J or Ctrl+Enter instead.
Backslash continuation is a fourth option that sometimes feels natural. End a line with \ and the prompt continues on the next line as if you had pressed a new-line key. This mirrors shell scripting and works well when you are pasting in command-like content.
text# Same prompt, three ways to write it # 1) Alt+Enter (or Ctrl+J / Shift+Enter) > Refactor parseInput in src/cli/input.ts. Replace its raw string handling with TokenStream. Do not change the public signature. After: every existing call site must still type-check. # 2) Backslash continuation > Refactor parseInput in src/cli/input.ts. \ Replace its raw string handling with TokenStream. \ Do not change the public signature. # 3) Paste a pre-written block > [pasted: 4 lines, 247 chars - press Enter to send]
When you paste a multi-line block from your clipboard, Hermes shows a compact summary ([pasted: N lines, M chars]) instead of flooding your terminal with the full text. You can review or edit before sending.
When to go multiline
Most prompts can be one line. Reach for multiline when:
- You need to give the agent context that does not fit comfortably on a line (file paths, constraints, examples).
- You are pasting in code, a stack trace, or a log excerpt.
- You are listing more than two requirements.
When the prompt grows past five or six lines, consider switching to the external editor instead (covered in a later lesson). The terminal input is great for short multiline; the editor is great for long ones.
Common Pitfalls
- Accidentally sending with
Enter: New users press Enter intending a new line and accidentally submit a half-written prompt. Train your fingers to useAlt+Enterearly. - Cramming structure onto one line with semicolons: A semicolon-separated wall of text is harder for the model to parse than three clean lines. Use the new-line key.
Best Practices
- Pick one new-line keystroke and standardize: Whether
Alt+Enter,Ctrl+J, orShift+Enter, use the same one everywhere so your fingers stop hesitating. - Switch to multiline the moment a prompt has two clauses: "Do X. Also Y." is two clauses; that means two lines, not one.
Summary
- Multiline input is cheap in Hermes via
Alt+Enter,Ctrl+J, orShift+Enter. - Backslash continuation works the same way and feels natural in shell-like prompts.
- Pasted multi-line text is summarized in the input preview before sending.
- Reach for multiline whenever a prompt has more than one clause; reach for the external editor for long-form drafting.
Code Examples
# A structured multiline prompt typed with Alt+Enter for each line
> Refactor parseInput in src/cli/input.ts.
Goal: replace the raw string handling with the new TokenStream API.
Constraints:
- Keep the public signature identical.
- Update tests in tests/input.spec.ts if behavior changes.
Verify by running: pnpm nx test backend --testPathPattern=input