Skip to main content

What is MonoTerm?

MonoTerm is Monolex’s terminal-in-terminal. It wraps the same headless PTY engine that powers the Monolex desktop app, but renders directly to your existing terminal via crossterm — no Electron, no WebView, no GUI.
┌───────────────────────────────────────────────────────────────────┐
│ Your Terminal (iTerm, Wezterm, Terminal.app, etc.)                │
│                                                                   │
│  ┌───────────────┬─┬─────────────────────────────────────────┐    │
│  │  Sidebar      │││  PTY Main Area                          │    │
│  │               │││                                         │    │
│  │  PROJECT      │││  macbook@NIIA ~ % claude                │    │
│  │  claude       │││  ╭────────────────────────────────────╮ │    │
│  │  ───────────  │││  │ Claude Code                        │ │    │
│  │  TABS         │││  │                                    │ │    │
│  │  ● Agent-1    │││  │  > how can I help?█                │ │    │
│  │    Agent-2    │││  │                                    │ │    │
│  │               │││  ╰────────────────────────────────────╯ │    │
│  │  FILES        │││                                         │    │
│  │  ▶ src/       │││                                         │    │
│  │    .env       │││                                         │    │
│  │               │││                                         │    │
│  │  ACTIVITY     │││                                         │    │
│  │  read main    │││                                         │    │
│  │  bash cargo   │││                                         │    │
│  ├───────────────┴─┴─────────────────────────────────────────┤    │
│  │  claude │ ● Agent-1  ^T:new ^N/P:tab ^B:sidebar ^Q:quit   │    │
│  └───────────────────────────────────────────────────────────┘    │
│                                                                   │
└───────────────────────────────────────────────────────────────────┘

Install

# Via OpenCLIs (signed + notarized macOS binary)
openclis install monoterm

# Or download directly
curl -L https://openclis-releases.monolex.ai/monoterm/latest -o monoterm
chmod +x monoterm

Quick Start

# Launch with project selector (Where & With)
monoterm

# Launch plain shell (skip selector)
monoterm --plain

# Show all commands and keybindings
monoterm --help

# Run self-tests (no terminal needed)
monoterm test

Keybindings

Default keybindings, configurable via JSON:
KeyAction
Ctrl+TNew tab (project selector)
Ctrl+WClose tab
Ctrl+N / Ctrl+PNext / Previous tab
Ctrl+BToggle sidebar
Ctrl+RRename tab
Ctrl+QQuit
Alt+1~9Go to tab by number
Alt+BackspaceDelete word backward
Alt+Left/RightMove word backward/forward
Override via ~/Library/Application Support/Monolex/keybindings.json:
{
  "actions": {
    "ctrl+shift+t": "new_tab",
    "ctrl+shift+w": "close_tab"
  },
  "pty": {
    "alt+backspace": "\\e\\x7f"
  }
}

Architecture

MonoTerm does not implement a terminal emulator. It wraps the Monolex headless engine — the same Alacritty VTE parser, AtomicState diff engine, and PTY daemon that power the desktop app.
monoterm (binary)
  ├── lib-keybinding        → Key event → Action or PTY bytes
  ├── monolex-headless      → Session management, GridUpdate engine
  │   ├── lib-atomic-renderer  → AtomicState, XtermCell, DiffHint
  │   └── lib-pty-client       → PTY daemon communication
  └── crossterm             → Terminal rendering (no GUI)

What MonoTerm adds over raw headless:

FeatureHeadlessMonoTerm
PTY sessionYesYes + multi-tab
Grid renderingGridUpdate JSON/binarycrossterm to host terminal
SidebarNoFile tree, tabs, activity
IME supportinverse_cursor fieldVirtual cursor tracking + hold
ResizeGrid worker onlyGrid + PTY daemon (SIGWINCH)
KeybindingsN/AConfigurable JSON
Self-testN/Amonoterm test (PTY harness)

Virtual Cursor & IME

When apps like Claude Code hide the real cursor and draw their own using INVERSE video (\x1b[7m), MonoTerm detects the virtual cursor position from the AtomicState layer and places the host terminal’s cursor there. This ensures the parent terminal’s IME (Korean, Japanese, Chinese input) composition window appears at the correct position — where the user is actually editing, not where the hidden real cursor is. The detection uses the same algorithm as the Monolex desktop app:
  • Scan for INVERSE cells on the cursor row first (avoid false positives)
  • Fall back to bottom-up scan
  • Hold position during Ink erase-redraw cycles (6 frames)
  • Distance check to discard false positives (zsh % marker, status bars)

PTY Harness

MonoTerm includes a built-in test system that exercises the headless engine without needing a terminal:
$ monoterm test

MonoTerm PTY Harness Tests v0.1.0

  1. Session create + echo ... PASS
  2. Resize 80x24 120x40 ... PASS
  3. Cursor visible (shell) ... PASS
  4. Fast output (50 lines) ... PASS

  4/4 passed
The harness (lib-pty-harness) creates real PTY sessions and inspects GridUpdate structs directly — no ANSI parsing, no screen scraping. Available as a library for custom tests:
use lib_pty_harness::PtyHarness;

let mut h = PtyHarness::start(80, 24).await?;
h.send("echo hello\r").await?;
h.wait_for_text("hello", 3).await?;

let snap = h.snapshot().await?;
assert!(snap.cursor_visible);
assert_eq!(snap.viewport_rows, 24);

h.resize(120, 40).await?;
let snap2 = h.snapshot().await?;
assert_eq!(snap2.viewport_rows, 40);

Source

MonoTerm is distributed as a signed, notarized macOS binary via OpenCLIs. Source code is not published.