Academy → Developer guideOfficial documentation · clear explanation

TUI & Desktop from Worktrees

TUI & Desktop from Worktrees

Developer10 minutes3 questions2026-08-09
The idea in one minute

Start with meaning, then move to detail.

This lesson explains TUI & Desktop from Worktrees as part of Hermes internals and extension points. You will learn what it does, when it matters, and the smallest safe test that proves it works.

If you are new

If you are new, do not memorize names. Focus on three questions: what problem does this solve, what access does it need, and how can you verify the result?

For hands-on use

For practice, inspect the first example, identify its effects, run it on test data, and compare the result with the source claim.

For specialists

For advanced readers, inspect The deps-sharing model, htui — TUI from the worktree, hgui — desktop app from the worktree, then verify failure modes and version compatibility.

What do you need first?

Know Python, Git, and basic project structure before changing code.

What will you know?

A clear outcome before you read.

  • Understand TUI & Desktop from Worktrees without assumed prior knowledge.
  • Separate the source description from what still needs testing in your environment.
  • Read the first command and identify its inputs and outputs before copying it.
Lesson terms

Short definitions before the details.

Provider
The service that runs or provides access and authentication to a model.
Official page description

Run the Ink TUI and Electron desktop app from a git worktree without a full npm install per checkout

Topic map

What does the source say, and in what order?

  1. 01
    The deps-sharing model

    Start here to understand the core idea or structure.

  2. 02
    htui — TUI from the worktree

    Read this after the foundation, then connect it to the previous step.

  3. 03
    hgui — desktop app from the worktree

    Read this after the foundation, then connect it to the previous step.

  4. 04
    Shared helpers

    Read this after the foundation, then connect it to the previous step.

  5. 05
    See also

    Finish here to verify the result and special cases.

Examples from the official page

Copy only after you understand the effect.

Two env vars name the canonical checkout: | Variable | Meaning | |----------|---------| | `HERMES_MAIN_CHECKOUT` | The deps checkout — where `node_modules` really lives, and whose `.venv/bin/python` runs the backend. | | `HERMES_GUI_DEPS_CHECKOUT` | Where the desktop deps (`apps/desktop/node_modules`) live. Defaults to `HERMES_MAIN_CHECKOUT`; override only if you keep desktop deps elsewhere. | Neither is read by Hermes itself — they're private to these helpers. The variables Hermes *does* read are covered in [Environment Variables](../reference/environment-variables.md). ## `htui` — TUI fro
`--dev` compiles from source, so it links `ui-tui/node_modules` from `HERMES_MAIN_CHECKOUT` when the root lockfile matches and installs locally otherwise (see [`_hermes_root` / linking helpers](#shared-helpers)). :::warning `--dev` and `HERMES_TUI_DIR` are mutually exclusive `HERMES_TUI_DIR` points Hermes at a *prebuilt* bundle (Nix, system packages), which has no source to hot-reload. If it's set in your shell, `hermes --tui --dev` exits with an error. Run `unset HERMES_TUI_DIR` before `htui`. ::: ## `hgui` — desktop app from the worktree The desktop app is heavier: it needs `node_modules`
The desktop env vars it sets are all real backend-resolution knobs: | Variable | Role in `hgui` | |----------|----------------| | `HERMES_DESKTOP_HERMES_ROOT` | Runs the backend from **this worktree**, not the packaged/PATH `hermes`. | | `HERMES_DESKTOP_PYTHON` | Reuses the deps checkout's venv instead of re-resolving a Python. | | `HERMES_DESKTOP_IGNORE_EXISTING` | Ignores any `hermes` on `PATH` so it can't shadow the worktree. | | `HERMES_DESKTOP_CWD` | Opens the desktop chat rooted at the worktree. | Two footguns `hgui` handles that a bare `npm run dev` does not: - **Port `5174` is fixed
Try it now

Read the first command and identify its inputs and outputs before copying it.

Match every command to your installed Hermes version, review the files and accounts it can reach, and use non-sensitive data for the first test. If this explanation differs from the source, the official source wins.

Knowledge check

Three decisions before completion.

1. What is the source of truth when “TUI & Desktop from Worktrees” changes?
2. What is the best way to apply this lesson?
3. What should happen before a step can modify files or an external account?