Skip to content

feat(commands): add /editor command to compose messages in $EDITOR - #7620

Closed
Linux2010 wants to merge 1 commit into
NousResearch:mainfrom
Linux2010:feat/issue-7263-editor-command
Closed

feat(commands): add /editor command to compose messages in $EDITOR#7620
Linux2010 wants to merge 1 commit into
NousResearch:mainfrom
Linux2010:feat/issue-7263-editor-command

Conversation

@Linux2010

@Linux2010 Linux2010 commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

What added

New /editor (alias /edit) slash command that opens the user's preferred text editor (EDITOR, VISUAL, or auto-detected nano/vim/vi) to compose long messages. Save and close to queue the message; leave empty to cancel.

> /editor
Opening vim... Save and close to send, leave empty to cancel.
(847 chars from editor) Queued for the next turn.

Target Users

Gateway platform users (Telegram, Discord, Slack, WhatsApp, Signal):

  • No keyboard shortcuts available in messaging platforms
  • /editor is the only way to use external editor on these platforms

CLI users: See #7941 for a better solution (Ctrl+G shortcut + paste collapse)

Related Work

Both PRs are complementary, not competing:

Implementation

File Change
hermes_cli/commands.py Added CommandDef for "editor" with "edit" alias
gateway/run.py Added _handle_editor_command() method (88 lines)

Editor detection: $EDITOR$VISUAL → auto-detect (nanovimvi)

Message handling: Uses same pattern as /queue — queues in adapter._pending_messages

Comment stripping: Lines starting with # are ignored (hint comments)

Why this is minimal

  • Only 91 lines in gateway/run.py + 2 lines in commands.py
  • Uses existing pattern (same as /queue)
  • Uses existing imports (subprocess, tempfile, shlex)
  • No changes to core agent loop

What I tested

Added test suite tests/gateway/test_editor_command.py with 8 test cases.

Python syntax validated for all files.

What I intentionally did not change

Fixes #7263

Note: For CLI users, recommend using #7941 (Ctrl+G) instead — it's more ergonomic and includes paste collapse.

@lumenradley

Copy link
Copy Markdown
Contributor

FYI, done with Shortcut instead of command, to be able to go into edit latter not only from empty message #7941

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Apr 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #7977 and #9401 — same /editor compose command. Also related to #4774 (Ctrl+G external editor). Original issue: #7262/#7263.

…ports

The _handle_editor_command() method used subprocess.call() but did not
import subprocess, causing AttributeError at runtime.

subprocess is not globally imported in gateway/run.py. Other uses of
subprocess in this file use local imports (line 1289), so the editor
command should follow the same pattern.

- Added: import subprocess (local import, matching file pattern)
- Removed: redundant local imports for asyncio, shlex, tempfile
  (already imported globally at lines 16, 21, 24)

Python syntax validation (py_compile)
@Linux2010
Linux2010 force-pushed the feat/issue-7263-editor-command branch from 7e084da to 9e5e75c Compare April 30, 2026 09:37
@Linux2010 Linux2010 closed this May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants