Skip to content

feat(cli): TUI extension hooks — build custom CLIs on top of Hermes#2333

Merged
teknium1 merged 2 commits intomainfrom
hermes/hermes-5d6932ba
Mar 21, 2026
Merged

feat(cli): TUI extension hooks — build custom CLIs on top of Hermes#2333
teknium1 merged 2 commits intomainfrom
hermes/hermes-5d6932ba

Conversation

@teknium1
Copy link
Contributor

@teknium1 teknium1 commented Mar 21, 2026

Based on PR #1749 by @erosika (reimplemented on current main — original was 200+ commits behind).

What this does

Extracts three protected methods from HermesCLI.run() so wrapper CLIs can extend the TUI without overriding the entire 1000+ line method:

  • _get_extra_tui_widgets() — inject widgets (between spacer and status bar)
  • _register_extra_tui_keybindings(kb, *, input_area) — add keybindings
  • _build_tui_layout_children(**widgets) — full control over widget ordering

Default implementations reproduce existing layout exactly. Zero behavior change for existing users.

What this enables

The TUI extension hooks let anyone build a custom CLI on top of Hermes without forking or monkey-patching. Subclass HermesCLI, override a few methods, and you have a branded product with its own UI elements and shortcuts — while inheriting all of Hermes's agent loop, tool system, memory, sessions, and provider infrastructure.

  • Themed/branded CLIs — a company builds "AcmeCLI" that's Hermes underneath with their logo panel, custom status widgets, and domain-specific keybindings
  • Domain-specific overlays — a data science wrapper that shows a live metrics panel, a DevOps wrapper with deployment status, a trading wrapper with position summaries
  • Toggleable inspection panels — tool call timelines, token usage breakdowns, debug views that appear/disappear with a hotkey
  • Workflow integrations — music controls for a coding-with-music setup, pomodoro timers, notification feeds, anything that benefits from persistent UI presence alongside the agent
  • Research tools — experiment dashboards, prompt/response inspectors, evaluation score displays during RL training

The key value: none of these need to touch run() or track upstream changes to the layout code. The hooks are stable API surface — upstream can rearrange internals and the wrapper keeps working.

Changes

  • cli.py: 3 new protected methods + refactored run() layout to use _build_tui_layout_children()
  • tests/test_cli_extension_hooks.py: 5 tests covering defaults, widget insertion, and keybinding registration
  • website/docs/developer-guide/extending-the-cli.md: full documentation with working example, hook reference, layout diagram, and tips
  • website/sidebars.ts: added to Developer Guide navigation

5697 tests passing.

Based on PR #1749 by @erosika (reimplemented on current main).

Extracts three protected methods from run() so wrapper CLIs can extend
the TUI without overriding the entire method:

- _get_extra_tui_widgets(): inject widgets between spacer and status bar
- _register_extra_tui_keybindings(kb, input_area): add keybindings
- _build_tui_layout_children(**widgets): full control over ordering

Default implementations reproduce existing layout exactly. The inline
HSplit in run() now delegates to _build_tui_layout_children().

5 tests covering defaults, widget insertion position, and keybinding
registration.
@teknium1 teknium1 force-pushed the hermes/hermes-5d6932ba branch from 0fdda03 to d70e07f Compare March 21, 2026 16:42
@teknium1 teknium1 changed the title refactor(cli): add protected TUI extension hooks for wrapper CLIs feat(cli): TUI extension hooks — build custom CLIs on top of Hermes Mar 21, 2026
Streaming provides a better UX — tokens appear as they arrive instead
of waiting for the full response. show_reasoning remains false so
thinking blocks are not streamed to the user.
@teknium1 teknium1 merged commit cc51ffd into main Mar 21, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant