Introduction
Ctrl+C is the most important key in Hermes after Enter. It is your steering wheel: the way to stop a wrong direction the instant you see it. But Ctrl+C does subtly different things at different stages of agent activity, and using it well requires knowing which stage you are interrupting at. This lesson walks through the three stages and the right interrupt strategy for each.
Key Concepts
- Single press: Interrupts the current operation, keeps the session alive.
- Double press within 2 seconds: Escalates to a full exit.
- SIGTERM to subprocesses: Running terminal commands receive a graceful kill signal first.
- SIGKILL after 1 second: Stubborn processes get force-killed if they ignore SIGTERM.
Real World Context
The agent is mid-refactor, running a long pnpm install you did not need. You hit Ctrl+C. The install gets SIGTERM, finishes its current step, and exits cleanly. The agent processes your interrupt as a turn-end signal and stops generating its next plan step. You type a corrected request and continue. The total cost: maybe ten seconds. Without the interrupt: a full install plus all the wasted reasoning after.
Deep Dive
Hermes activity happens at three stages, and Ctrl+C behaves differently at each:
Stage 1: The agent is streaming a text response.
A single Ctrl+C cuts the streaming response immediately. The partial output stays in the transcript so you can see what was happening when you interrupted. The session continues, ready for your next input.
textAgent: I'll start by reading parseInput from src/cli/input.ts then refactor it to ▌ ▲ you press Ctrl+C here ┌────────────────────────────────────────────────────────────────────┐ │ [interrupted] │ └────────────────────────────────────────────────────────────────────┘
Stage 2: The agent is running a tool call.
If the tool is a quick read (filesystem, web fetch), Ctrl+C interrupts it like a streaming text. If the tool is a long-running shell command, Hermes sends SIGTERM to the child process. The process gets one second to exit cleanly. If it does not, Hermes follows with SIGKILL.
This is why Ctrl+C in Hermes feels graceful: well-behaved subprocesses get a chance to clean up, but ill-behaved ones still die.
Stage 3: The agent is between turns, waiting for you.
A single Ctrl+C at the input prompt clears the input line. A double Ctrl+C within two seconds exits the CLI entirely.
The double-press exit and how to avoid it
The escalation from single-press interrupt to double-press exit exists for a reason: sometimes a hung session genuinely needs to die. But it can also fire by accident if you Ctrl+C twice in quick succession trying to make sure the interrupt registered. The two-second window is deliberately short enough that intentional double-presses register, and tappy nervous double-presses also register, but you usually want only one.
If you are unsure whether your interrupt worked, watch the screen for a second instead of pressing again. The [interrupted] indicator or the > prompt appearing again is your confirmation.
Combining interrupt with new input
A powerful pattern: type your correction first, then press Enter while the agent is still working. Depending on your /busy mode (interrupt, queue, or steer), Hermes handles the conflict for you. With the default interrupt mode, pressing Enter automatically interrupts and processes the new message. This often beats Ctrl+C followed by retyping, because you keep the correction you were already typing.
Common Pitfalls
- Double-tapping Ctrl+C out of habit: Other CLIs (especially older REPLs) often need two presses for one effect. Hermes uses two presses for escalation. Press once, then watch the screen before pressing again.
- Interrupting too late: The whole point of streaming is to catch drift early. If you wait until the response is complete, you have paid the full cost; interrupting then saves nothing.
Best Practices
- Interrupt at the first line of drift: The moment the response heads somewhere wrong, hit Ctrl+C. Reading ahead does not improve your decision.
- Use Enter-with-correction when you have time to type: Typing your correction while the agent runs, then pressing Enter, is often smoother than Ctrl+C followed by retyping.
Summary
- Single Ctrl+C interrupts the current operation and keeps the session alive.
- Double Ctrl+C within two seconds force-exits the CLI.
- Long shell commands get SIGTERM, then SIGKILL after one second.
- Type-then-Enter during agent activity is often smoother than Ctrl+C plus retype.
Code Examples
# Three interrupt patterns at three stages of agent activity
# Stage 1: streaming text response
Agent: I'll start by reading parseI<Ctrl+C>
[interrupted]
>
# Stage 2: long-running shell command
Agent: Running: pnpm install --frozen-lockfile
<Ctrl+C>
[SIGTERM sent to pnpm; 1s grace period; SIGKILL if still running]
[interrupted]
>
# Stage 3: at the prompt, accidentally pressing twice
> <Ctrl+C><Ctrl+C> (within 2 seconds)
[exit]