hermes - 💡(How to fix) Fix Feature Request: CLI Auto-Queue Mode with Smart Interrupt and Crash Recovery

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

| Steer # that doesn't exist | Error: "No queued item #5" | | Saved queue older than 7 days | Auto-delete, warn user |

Code Example

[Processing...] User types "status"Cancels current → "status" executes

---

[Processing...] User types "status"Queued as #2
[Processing...] User types "stop"Immediate interrupt, cancels #1
[Processing complete]Auto-starts #2

---

[Processing file 23/50 of refactor...]
User: "Actually use zod instead of yup"
[Message queued as #2]

User: /queue steer 2
[Hermes receives steer signal mid-stream]
[Hermes adapts: "Switching validation library to zod for remaining files..."]

---

cli:
  auto_queue:
    enabled: false
    interrupt_keywords:
      - stop
      - cancel
      - abort
      - revert
      - undo
      - quit
      - exit
      - no wait
      - nevermind
      - scratch that
      - halt

---

[Processing...] User: "stop"Immediate interrupt
[Agent] Stopping current task. Progress saved at checkpoint 23/50.

[Processing...] User: "revert the last file"Immediate interrupt  
[Agent] Reverting file 23 changes...

[Processing...] User: "check this other thing"Queued

---

[User] refactor all validation to use zod
[Hermes] Processing... file 12/50

[User] what's the zod syntax for optional again?
[CLI] 📥 Queued #2: "what's the zod syntax..."

[User] /queue list
[CLI] 
  #1 [RUNNING]: refactor all validation to use zod (file 12/50)
  #2 [PENDING]: what's the zod syntax for optional again?

[Hermes] Processing... file 45/50
[User] actually stop and revert
[CLI] ⚠️ Interrupt detected: "stop"
[Hermes] Stopping. Reverted 45 files. Original state restored.

---

[User] write a blog post about rust memory safety
[Hermes] Processing... generating outline...

[User] make it focus on ownership specifically
[CLI] 📥 Queued #2: "make it focus on ownership..."

[User] /queue steer 2
[Hermes] [receives steer] Adjusting outline to focus on ownership vs borrowing vs lifetimes...
[Continues with modified direction]

---

[User] analyze this codebase for security issues
[Hermes] Processing... scanning dependencies...

[User] also check for any hardcoded secrets
[CLI] 📥 Queued #2

[User] and look for SQL injection patterns
[CLI] 📥 Queued #3

[User] /queue list
[CLI]
  #1 [RUNNING]: analyze codebase for security issues
  #2 [PENDING]: check for hardcoded secrets  
  #3 [PENDING]: look for SQL injection patterns

[User] /queue pop 2  [removes #2, keeps #3]

---

[User] refactor all validation to use zod
[Hermes] Processing... file 23/50

[User] also update the tests
[CLI] 📥 Queued #2

[User] check if any imports need updating too
[CLI] 📥 Queued #3

[Sudden crash: connection lost, power outage, OOM kill]

[later...]

$ hermes chat

[CLI] 📥 Found saved queue from crashed session (3 items, not auto-resuming)
[CLI] Last active: 23 minutes ago

[CLI] Saved items:
  #1 [INTERRUPTED]: refactor all validation to use zod (file 23/50)
  #2 [PENDING]: also update the tests
  #3 [PENDING]: check if any imports need updating too

[CLI] Use `/queue restore` to list, `/queue resume` to continue, or `/queue discard` to delete

[User] /queue resume
[CLI] Restored 3 items. Processing #1 from checkpoint (file 23/50)...
[Hermes] Resuming refactor at file 23...

---

┌─────────────────────────────────────────────────────────────┐
│                      hermes chat                            │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐  │
│  │   Input      │───▶│   Queue      │───▶│   Agent      │  │
│  │   Handler    │    │   Manager    │    │   Loop       │  │
│  └──────────────┘    └──────────────┘    └──────────────┘  │
│         │                   │                    ▲         │
│         │                   ▼                    │         │
│         │            ┌──────────────┐            │         │
│         │            │ Interrupt    │────────────┘         │
│         │            │ Detector        (steer or cancel)│         │            └──────────────┘                      │
│         ▼                                                  │
│  ┌──────────────┐                                          │
│  │ /queue cmd   │                                          │
│  │   parser     │                                          │
│  └──────────────┘                                          │
└─────────────────────────────────────────────────────────────┘

---

class UserMessage:
    type: "normal" | "steer" | "interrupt"
    content: str
    queue_position: Optional[int]

---

async def process_turn(messages, steer_signal=None):
    if steer_signal:
        # Incorporate into current reasoning
        context.add("User update: " + steer_signal.content)
        # Continue rather than restart
    # ... normal processing

---

# ~/.hermes/queue/{session_id}.yaml
session_id: "abc123"
saved_at: "2026-04-20T17:30:00Z"
items:
  - id: 1
    content: "refactor all validation to use zod"
    status: "running"
    created_at: "2026-04-20T17:25:00Z"
  - id: 2
    content: "what's the zod syntax for optional again?"
    status: "pending"
    created_at: "2026-04-20T17:27:00Z"
  - id: 3
    content: "also check for hardcoded secrets"
    status: "pending"
    created_at: "2026-04-20T17:28:00Z"

---

[CLI] 📥 Found 3 queued items from previous session (not auto-resuming)
[CLI] Use `/queue restore` to see them, `/queue resume` to continue, or `/queue clear` to discard

---

# ~/.hermes/config.yaml
cli:
  auto_queue:
    enabled: false           # Default off (opt-in)
    max_queue_size: 10       # Prevent abuse
    show_queue_on_input: true  # Show "📥 Queued #2" on every queue
    
    # Persistence settings
    persistence:
      enabled: true                    # Auto-save queue to disk
      path: "~/.hermes/queue"          # Save location
      auto_resume: false               # NEVER auto-resume (user must /queue resume)
      retention_hours: 168             # Delete saved queues after 7 days
    
    interrupt_keywords:
      - stop
      - cancel
      - abort
      - revert
      - undo
      - quit
      - exit
      - halt
      - scratch that
      - nevermind
      - no wait
      
    steer_keywords:          # Optional: auto-steer instead of queue
      - actually
      - instead
      - wait
      - correction:

---

[User] refactor this codebase
[Hermes] Processing...

[User] /smalltalk "research zod vs yup performance"
[CLI] 📥 Queued: steer for /smalltalk
[CLI] 🤖 Side talk spawned (will notify when ready)

[User] /queue steer 1  [incorporate smalltalk research]
[Hermes] [adapts refactor based on side talk findings]
RAW_BUFFERClick to expand / collapse

Feature Proposal: CLI Auto-Queue Mode with Smart Interrupt

Author: Apostol Apostolov
Status: Draft
Target: Hermes Agent CLI (hermes chat)


1. Problem Statement

In Hermes CLI (hermes chat), sending a new message while the agent is processing cancels the ongoing turn and starts fresh. This destroys context and wastes progress on long-running tasks.

Current pain:

  • Deep in a 50-file refactor, need to ask a quick question? Cancel everything.
  • Multi-step research running? Can't check status or add constraints.
  • Only option is to wait or lose work.

2. Proposed Solution: Auto-Queue Mode

A CLI mode where user inputs are queued during processing, then consumed sequentially. With smart interrupt for urgent commands.

2.1 Core Behavior

Normal Mode (current):

[Processing...] User types "status" → Cancels current → "status" executes

Auto-Queue Mode (proposed):

[Processing...] User types "status" → Queued as #2
[Processing...] User types "stop" → Immediate interrupt, cancels #1
[Processing complete] → Auto-starts #2

2.2 Command Interface

CommandDescription
/queue onEnable auto-queue mode
/queue offDisable auto-queue (default behavior)
/queue listShow pending items
/queue pop [n]Remove item #n from queue
/queue clearEmpty the queue
/queue steer {n}Steer the ongoing session with queued item #n
/queue restoreList saved queue items from crashed/exited session
/queue resumeRestore saved queue and start processing
/queue discardDelete saved queue without restoring

2.3 Steer Command — Dynamic Context Injection

The /queue steer command allows retroactive context insertion into an ongoing session.

[Processing file 23/50 of refactor...]
User: "Actually use zod instead of yup"
[Message queued as #2]

User: /queue steer 2
[Hermes receives steer signal mid-stream]
[Hermes adapts: "Switching validation library to zod for remaining files..."]

Implementation: Send a special "steer" message type that the agent interprets as:

"User wants to add this context without cancelling. Incorporate if possible, or acknowledge and queue for next turn."


3. Smart Auto-Interrupt

Auto-queue mode waits for most messages, but immediately interrupts if the message contains urgent keywords.

3.1 Interrupt Keywords

Default set (configurable in ~/.hermes/config.yaml):

cli:
  auto_queue:
    enabled: false
    interrupt_keywords:
      - stop
      - cancel
      - abort
      - revert
      - undo
      - quit
      - exit
      - no wait
      - nevermind
      - scratch that
      - halt

3.2 Interrupt Behavior

[Processing...] User: "stop" → Immediate interrupt
[Agent] Stopping current task. Progress saved at checkpoint 23/50.

[Processing...] User: "revert the last file" → Immediate interrupt  
[Agent] Reverting file 23 changes...

[Processing...] User: "check this other thing" → Queued

3.3 Case-Insensitive Matching

Keywords match regardless of case, punctuation, or position:

  • "Stop!" → Interrupt
  • "just stop" → Interrupt
  • "please cancel this" → Interrupt
  • "stopwatch timer" → No interrupt (keyword detection needs word boundaries)

4. UX Flow Examples

Scenario 1: Long refactor with questions

[User] refactor all validation to use zod
[Hermes] Processing... file 12/50

[User] what's the zod syntax for optional again?
[CLI] 📥 Queued #2: "what's the zod syntax..."

[User] /queue list
[CLI] 
  #1 [RUNNING]: refactor all validation to use zod (file 12/50)
  #2 [PENDING]: what's the zod syntax for optional again?

[Hermes] Processing... file 45/50
[User] actually stop and revert
[CLI] ⚠️ Interrupt detected: "stop"
[Hermes] Stopping. Reverted 45 files. Original state restored.

Scenario 2: Steer mid-task

[User] write a blog post about rust memory safety
[Hermes] Processing... generating outline...

[User] make it focus on ownership specifically
[CLI] 📥 Queued #2: "make it focus on ownership..."

[User] /queue steer 2
[Hermes] [receives steer] Adjusting outline to focus on ownership vs borrowing vs lifetimes...
[Continues with modified direction]

Scenario 3: Multiple queued items

[User] analyze this codebase for security issues
[Hermes] Processing... scanning dependencies...

[User] also check for any hardcoded secrets
[CLI] 📥 Queued #2

[User] and look for SQL injection patterns
[CLI] 📥 Queued #3

[User] /queue list
[CLI]
  #1 [RUNNING]: analyze codebase for security issues
  #2 [PENDING]: check for hardcoded secrets  
  #3 [PENDING]: look for SQL injection patterns

[User] /queue pop 2  [removes #2, keeps #3]

Scenario 4: Crash recovery (the key feature)

[User] refactor all validation to use zod
[Hermes] Processing... file 23/50

[User] also update the tests
[CLI] 📥 Queued #2

[User] check if any imports need updating too
[CLI] 📥 Queued #3

[Sudden crash: connection lost, power outage, OOM kill]

[later...]

$ hermes chat

[CLI] 📥 Found saved queue from crashed session (3 items, not auto-resuming)
[CLI] Last active: 23 minutes ago

[CLI] Saved items:
  #1 [INTERRUPTED]: refactor all validation to use zod (file 23/50)
  #2 [PENDING]: also update the tests
  #3 [PENDING]: check if any imports need updating too

[CLI] Use `/queue restore` to list, `/queue resume` to continue, or `/queue discard` to delete

[User] /queue resume
[CLI] Restored 3 items. Processing #1 from checkpoint (file 23/50)...
[Hermes] Resuming refactor at file 23...

Key behavior:

  • Queue is saved automatically on every change
  • On crash or exit, items persist to ~/.hermes/queue/{session}.yaml
  • On restart, user sees notice but nothing auto-executes
  • User chooses: restore (list only), resume (restore + start), or discard (delete)
  • Even the interrupted task #1 is recoverable with context ("file 23/50")

5. Technical Implementation

5.1 CLI Architecture Changes

┌─────────────────────────────────────────────────────────────┐
│                      hermes chat                            │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐  │
│  │   Input      │───▶│   Queue      │───▶│   Agent      │  │
│  │   Handler    │    │   Manager    │    │   Loop       │  │
│  └──────────────┘    └──────────────┘    └──────────────┘  │
│         │                   │                    ▲         │
│         │                   ▼                    │         │
│         │            ┌──────────────┐            │         │
│         │            │ Interrupt    │────────────┘         │
│         │            │ Detector     │   (steer or cancel)  │
│         │            └──────────────┘                      │
│         ▼                                                  │
│  ┌──────────────┐                                          │
│  │ /queue cmd   │                                          │
│  │   parser     │                                          │
│  └──────────────┘                                          │
└─────────────────────────────────────────────────────────────┘

5.2 Message Types

Extend the CLI→Agent protocol with:

class UserMessage:
    type: "normal" | "steer" | "interrupt"
    content: str
    queue_position: Optional[int]
  • normal: Standard message, starts new turn
  • steer: Injected into ongoing turn (agent decides how to handle)
  • interrupt: Cancels current turn, starts fresh

5.3 Agent-Side Handling

Agent needs to support "steer" signals:

async def process_turn(messages, steer_signal=None):
    if steer_signal:
        # Incorporate into current reasoning
        context.add("User update: " + steer_signal.content)
        # Continue rather than restart
    # ... normal processing

This may require:

  • Streaming response interruption (already supported in some backends)
  • Context injection mid-generation
  • Or: queue steer for immediate next turn (simpler)

5.4 Queue Persistence (Crash Protection)

Queue state is automatically saved to disk on every change:

# ~/.hermes/queue/{session_id}.yaml
session_id: "abc123"
saved_at: "2026-04-20T17:30:00Z"
items:
  - id: 1
    content: "refactor all validation to use zod"
    status: "running"
    created_at: "2026-04-20T17:25:00Z"
  - id: 2
    content: "what's the zod syntax for optional again?"
    status: "pending"
    created_at: "2026-04-20T17:27:00Z"
  - id: 3
    content: "also check for hardcoded secrets"
    status: "pending"
    created_at: "2026-04-20T17:28:00Z"

Save triggers:

  • New item queued
  • Item popped/steered/completed
  • Session crash (SIGTERM handler)
  • Graceful exit

Resume behavior: On hermes chat restart, check for saved queue:

[CLI] 📥 Found 3 queued items from previous session (not auto-resuming)
[CLI] Use `/queue restore` to see them, `/queue resume` to continue, or `/queue clear` to discard

Important: Items are NOT auto-executed on resume. User must explicitly choose:

  • /queue restore — List saved items without starting
  • /queue resume — Restore and start processing next pending item
  • /queue clear — Discard all saved items

6. Configuration

# ~/.hermes/config.yaml
cli:
  auto_queue:
    enabled: false           # Default off (opt-in)
    max_queue_size: 10       # Prevent abuse
    show_queue_on_input: true  # Show "📥 Queued #2" on every queue
    
    # Persistence settings
    persistence:
      enabled: true                    # Auto-save queue to disk
      path: "~/.hermes/queue"          # Save location
      auto_resume: false               # NEVER auto-resume (user must /queue resume)
      retention_hours: 168             # Delete saved queues after 7 days
    
    interrupt_keywords:
      - stop
      - cancel
      - abort
      - revert
      - undo
      - quit
      - exit
      - halt
      - scratch that
      - nevermind
      - no wait
      
    steer_keywords:          # Optional: auto-steer instead of queue
      - actually
      - instead
      - wait
      - correction:

7. Edge Cases

ScenarioBehavior
Queue full (max 10)Reject new input with warning
Steer while not processingTreat as normal message
Interrupt with no active taskTreat as normal message
Steer # that doesn't existError: "No queued item #5"
Agent doesn't support steerFallback: queue for next turn
User types /queue mid-generationAlways immediate (meta-command)
Session crash/SIGTERMQueue saved to disk, user prompted on restart
Graceful exit (Ctrl+C once)Save queue, prompt on next start
Force exit (Ctrl+C twice)Save queue, exit immediately (still recoverable)
Resume with saved queueShow restore notice, do not auto-execute
Saved queue older than 7 daysAuto-delete, warn user
Multiple saved sessionsList them: /queue restore --list to pick
Restore with current queue non-emptyMerge or prompt for conflict resolution

8. Prior Art

  • Shell job control (bg, fg, jobs) — process queueing
  • Vim :make — async with quickfix list
  • Emacs async-shell-command — background with interrupt
  • ChatGPT/Claude web UI — no queuing, each message interrupts
  • Pi AI — maintains single thread, no parallel inputs

Hermes differentiation: Explicit queue management with steer — user controls flow, not just fire-and-forget.


9. MVP Phases

Phase 1 (Core Queue):

  • /queue on/off toggle
  • Input buffering during processing
  • /queue list command
  • Sequential processing of queued items

Phase 2 (Smart Interrupt):

  • Keyword detection for auto-interrupt
  • Configurable keyword list
  • Interrupt with progress save/report

Phase 3 (Steer):

  • /queue steer {n} command
  • Agent protocol extension for steer signals
  • Visual feedback: "[Steered]" in output

Phase 4 (Persistence & Crash Recovery):

  • Auto-save queue to disk on every change
  • SIGTERM/SIGINT handlers for graceful saves
  • /queue restore command (list saved items)
  • /queue resume command (restore + start)
  • /queue discard command (delete saved)
  • Never auto-execute on resume (explicit user action required)
  • 7-day retention for saved queues

Phase 5 (Polish):

  • Queue export/import
  • Integration with /smalltalk side conversations
  • Multiple session queue management |

10. Integration with /smalltalk

Auto-queue and /smalltalk are complementary:

  • Auto-queue: User message sequencing (this proposal)
  • /smalltalk: Agent-side async subagents (previous proposal)

Together they enable:

[User] refactor this codebase
[Hermes] Processing...

[User] /smalltalk "research zod vs yup performance"
[CLI] 📥 Queued: steer for /smalltalk
[CLI] 🤖 Side talk spawned (will notify when ready)

[User] /queue steer 1  [incorporate smalltalk research]
[Hermes] [adapts refactor based on side talk findings]

Request for Comments:

  • Should auto-queue be opt-in or default?
  • Is "steer" feasible with current agent architecture, or should it queue-for-next-turn instead?
  • Missing interrupt keywords?
  • Is the no-auto-resume behavior correct? Alternative: auto-restore but mark items as [REVIEW] requiring explicit /queue resume to start |

extent analysis

TL;DR

To implement the proposed CLI auto-queue mode with smart interrupt, extend the existing CLI-Agent protocol to support queued messages, add interrupt detection, and implement queue persistence for crash recovery.

Guidance

  1. Extend the CLI-Agent protocol: Introduce a new message type for queued messages and implement support for "steer" signals that allow users to inject context into ongoing sessions.
  2. Implement interrupt detection: Develop a keyword-based system to detect urgent commands and interrupt ongoing tasks accordingly.
  3. Develop queue management commands: Create commands like /queue list, /queue pop, and /queue clear to manage the queue.
  4. Implement queue persistence: Save the queue state to disk on every change and restore it on restart, with options to resume or discard saved queues.
  5. Test and refine: Thoroughly test the auto-queue mode, smart interrupt, and queue persistence features to ensure they work as expected and refine the implementation based on feedback.

Example

class UserMessage:
    type: "normal" | "steer" | "interrupt"
    content: str
    queue_position: Optional[int]

async def process_turn(messages, steer_signal=None):
    if steer_signal:
        # Incorporate into current reasoning
        context.add("User update: " + steer_signal.content)
        # Continue rather than restart
    # ... normal processing

Notes

  • The implementation should consider the trade-offs between complexity and usability.
  • The steer feature may require significant changes to the agent's architecture.
  • The no-auto-resume behavior on restart should be carefully evaluated to ensure it meets user expectations.

Recommendation

Apply the proposed auto-queue mode with smart interrupt as an opt-in feature, allowing users to choose between the default behavior and the new queue-based approach, to provide more flexibility and control over the interaction with the Hermes Agent CLI.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING