bots-garden/mini-mepublic Fork
⑂ v2.1.1
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/mini-me.git
git clone ssh://git@rickub.com/bots-garden/mini-me.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
line-mode.md · 38 lines · 2.8 KBmarkdown
Blame HistoryOpen raw

Why keep the line mode — explanation

What is this about?

mm has three front ends on the same loop (see Architecture): the line mode (plain mm), the window (mm -tui) and the ACP façade for editors. The window does more and looks better, so the question comes up: why keep the line mode at all? This page gives the reasons, what it costs, and the scope it is meant to have.

What only the line mode gives

It is the fallback when there is no terminal. When stdin or stdout is not a terminal — a pipe, a script, CI, a container without a TTY — -tui falls back to the line mode by itself (see CLI reference, "Terminal check"). Without the line mode, these cases would have nothing interactive left. It is also how a demo is checked live from a sandbox: the window cannot be driven there, the line mode can.

It is the only scriptable conversation. -p and --ask ask one question and exit, with no session and no interactive ask_user. The line mode is the only one that can be driven by a pipe over several turns, with questions answered, permissions, and sessions saved.

It writes into the terminal's scrollback. The window draws on the terminal's alternate screen and leaves nothing behind when it exits. The line mode leaves a trace you can copy, pipe through tee or grep, and read again later.

It works where a full-screen interface gets in the way: screen readers, limited terminals, a slow ssh connection, Emacs's shell, CI logs.

What it costs

  • Each feature is done three times — line, window, ACP. The Other… row of ask_user (ticket 258) and steering (ticket 265) both had a line-mode version to write and test.
  • Interactions start to collide. Since steering, the line mode reads lines during a turn: answers piped in before a question appears are taken as steering, not as answers (see Steering a running turn). A script that pipes answers must wait for each question.

The scope it is meant to have

The line mode is kept as the fallback and scriptable mode, without aiming for parity with the window:

  • new interactive features (pickers, key bindings, steering, …) can land first, or only, in the window and ACP;
  • the line mode keeps the essentials: the question and the answer, ask_user, permissions, sessions.

One idea not decided yet: turn steering off when stdin is not a terminal, so that pipes are predictable again.

This reasoning comes from the code and the documentation; how much each mode is actually used has not been measured.

See also

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Why keep the line mode — explanation

## What is this about?

`mm` has three front ends on the same loop (see [Architecture](architecture.md)): the line mode (plain `mm`), the window (`mm -tui`) and the ACP façade for editors. The window does more and looks better, so the question comes up: why keep the line mode at all? This page gives the reasons, what it costs, and the scope it is meant to have.

## What only the line mode gives

**It is the fallback when there is no terminal.** When stdin or stdout is not a terminal — a pipe, a script, CI, a container without a TTY — `-tui` falls back to the line mode by itself (see [CLI reference](../reference/cli.md#window-mode-specifics), "Terminal check"). Without the line mode, these cases would have nothing interactive left. It is also how a demo is checked live from a sandbox: the window cannot be driven there, the line mode can.

**It is the only scriptable conversation.** `-p` and `--ask` ask one question and exit, with no session and no interactive `ask_user`. The line mode is the only one that can be driven by a pipe over several turns, with questions answered, permissions, and sessions saved.

**It writes into the terminal's scrollback.** The window draws on the terminal's alternate screen and leaves nothing behind when it exits. The line mode leaves a trace you can copy, pipe through `tee` or `grep`, and read again later.

**It works where a full-screen interface gets in the way**: screen readers, limited terminals, a slow ssh connection, Emacs's shell, CI logs.

## What it costs

- **Each feature is done three times** — line, window, ACP. The `Other…` row of `ask_user` (ticket 258) and steering (ticket 265) both had a line-mode version to write and test.
- **Interactions start to collide.** Since steering, the line mode reads lines during a turn: answers piped in before a question appears are taken as steering, not as answers (see [Steering a running turn](steering.md)). A script that pipes answers must wait for each question.

## The scope it is meant to have

The line mode is kept as the **fallback and scriptable mode**, without aiming for parity with the window:

- new interactive features (pickers, key bindings, steering, …) can land first, or only, in the window and ACP;
- the line mode keeps the essentials: the question and the answer, `ask_user`, permissions, sessions.

One idea not decided yet: turn steering off when stdin is not a terminal, so that pipes are predictable again.

This reasoning comes from the code and the documentation; how much each mode is actually used has not been measured.

## See also

- [Architecture: one loop, three front ends](architecture.md)
- [Use the window mode](../how-to/use-the-window-mode.md)
- [Steering a running turn](steering.md)
- [CLI reference](../reference/cli.md)