lazymartha#6 package 3: Claude Code members in a real CLI pane (pty + emulator, no kitty or tmux) #11

Closed
opened 2026-12-02 10:19:32 +00:00 by titan · 1 comment
Member

Raf, 2026-12-02, in martha-ai/lazymartha#6: "the UX is not great at all. How difficult would it be to port martha-engine into lazymartha, get rid of the dependency on kitty/tmux and make lazymartha into a one-stop TUI?"

DECIDED 2026-12-02 "Yes, build it (Recommended)"; DECIDED 2026-12-02 "Real CLI in a pane (Recommended)"; DECIDED 2026-12-02 "Whole room (Recommended)".

Purpose (feature): package 3 of the design on #6 (comment 8053), option (b) of its §3: a Claude Code member of the crew runs as the real claude CLI, started by martha start <member> exactly as today, in a pty that lazymartha emulates and draws in that member's pane; keys and resize reach it, and "needs you" is read from the member's dashboard row.

Refs #6

Package 1 (martha serves ACP upward) is not needed here and nothing it changes is touched: a Claude Code member never speaks ACP. The crew strip, the room pane and the martha.json editor tab are package 4; martha up execing this screen is package 5; removing tmux and kitty from martha is package 6.

Done when

  1. lazymartha crew --root <root> starts every Claude Code member its declaration names and does not park — martha start <member>, unchanged, as a child in a pty — beside the engine members it already starts over ACP. No kitty, no tmux.
  2. The selected member's pane draws the real CLI's screen through a VT emulator (github.com/charmbracelet/x/vt): what the CLI drew, styled, at the pane's size.
  3. Keys typed while a Claude Code pane is on screen reach the CLI: printable text, Enter, Tab and Shift+Tab, Escape, Backspace and Delete, arrows, Home/End, PgUp/PgDn, Space, and alt and ctrl chords. f12 hands the keyboard back to the crew and takes it again, so ctrl+c interrupts the CLI and quits the screen only from the crew.
  4. Resize reaches the CLI: when the terminal is resized the pty is resized with it (the child reads the new rows and columns) and the emulator is resized to match.
  5. "needs you" is read from the member's dashboard row, <CREW>/row/<member>.json under the crew directory martha where names: the member list shows the row's state, the newest open dialog's words (or the row's own needs) are shown with the pane, and a row quiet past the crew's offline time (the declaration's thresholds.offline_after_seconds, 30 s when it names none) reads offline.
  6. go test ./... and go vet ./... pass, and no test reaches outside the box: every pty child in a test is a stand-in program of the test's own — no real Claude Code, no model, no network.
Raf, 2026-12-02, in martha-ai/lazymartha#6: "the UX is not great at all. How difficult would it be to port martha-engine into lazymartha, get rid of the dependency on kitty/tmux and make lazymartha into a one-stop TUI?" DECIDED 2026-12-02 "Yes, build it (Recommended)"; DECIDED 2026-12-02 "Real CLI in a pane (Recommended)"; DECIDED 2026-12-02 "Whole room (Recommended)". Purpose (feature): package 3 of the design on #6 (comment 8053), option (b) of its §3: a Claude Code member of the crew runs as the real `claude` CLI, started by `martha start <member>` exactly as today, in a pty that lazymartha emulates and draws in that member's pane; keys and resize reach it, and "needs you" is read from the member's dashboard row. Refs #6 Package 1 (martha serves ACP upward) is not needed here and nothing it changes is touched: a Claude Code member never speaks ACP. The crew strip, the room pane and the martha.json editor tab are package 4; `martha up` execing this screen is package 5; removing tmux and kitty from martha is package 6. ## Done when 1. `lazymartha crew --root <root>` starts every Claude Code member its declaration names and does not park — `martha start <member>`, unchanged, as a child in a pty — beside the engine members it already starts over ACP. No kitty, no tmux. 2. The selected member's pane draws the real CLI's screen through a VT emulator (`github.com/charmbracelet/x/vt`): what the CLI drew, styled, at the pane's size. 3. Keys typed while a Claude Code pane is on screen reach the CLI: printable text, Enter, Tab and Shift+Tab, Escape, Backspace and Delete, arrows, Home/End, PgUp/PgDn, Space, and alt and ctrl chords. `f12` hands the keyboard back to the crew and takes it again, so `ctrl+c` interrupts the CLI and quits the screen only from the crew. 4. Resize reaches the CLI: when the terminal is resized the pty is resized with it (the child reads the new rows and columns) and the emulator is resized to match. 5. "needs you" is read from the member's dashboard row, `<CREW>/row/<member>.json` under the crew directory `martha where` names: the member list shows the row's state, the newest open dialog's words (or the row's own `needs`) are shown with the pane, and a row quiet past the crew's offline time (the declaration's `thresholds.offline_after_seconds`, 30 s when it names none) reads `offline`. 6. `go test ./...` and `go vet ./...` pass, and no test reaches outside the box: every pty child in a test is a stand-in program of the test's own — no real Claude Code, no model, no network.
Author
Member

Landed: main is caa38f1 (fast-forward; PR 12 closed by Terra). CI: run 6853 success at caa38f1 (the PR run), run 6858 success at caa38f1 (the push on main).

r=2 closed Mercurius's r=1 FAIL: BodySize() shrinks a row per ask drawn while the CLI's pty kept its height, so screenLines cut the CLI's bottom rows. The screen now reads its body size before and after each event and makes every CLI the height its pane is drawn at.
Telling the CLIs is a tea.Cmd, never a call: prog.Send from inside Update deadlocks bubbletea v1.3.11 (measured), and r=1's own ctrl+a, Enter-for-a-turn and terminal-resize paths all froze the real screen the same way — folded in. The same run drove both before and after in a real pty.
Tests: TestTwoAsksLeaveTheClisTerminalItsPanesHeight (fails on 9cff0e9) and TestATurnDoesNotStopTheScreensLoop (fails on 9cff0e9). Gate: go vet, gofmt, go test ./... twice and once -race, all green.

Filed while landing: #13, the one remaining synchronous write in Update (Keys → pty write), so a CLI that stops reading its keys cannot freeze the screen later.

Landed: main is caa38f1 (fast-forward; PR 12 closed by Terra). CI: run 6853 success at caa38f1 (the PR run), run 6858 success at caa38f1 (the push on main). r=2 closed Mercurius's r=1 FAIL: BodySize() shrinks a row per ask drawn while the CLI's pty kept its height, so screenLines cut the CLI's bottom rows. The screen now reads its body size before and after each event and makes every CLI the height its pane is drawn at. Telling the CLIs is a tea.Cmd, never a call: prog.Send from inside Update deadlocks bubbletea v1.3.11 (measured), and r=1's own ctrl+a, Enter-for-a-turn and terminal-resize paths all froze the real screen the same way — folded in. The same run drove both before and after in a real pty. Tests: TestTwoAsksLeaveTheClisTerminalItsPanesHeight (fails on 9cff0e9) and TestATurnDoesNotStopTheScreensLoop (fails on 9cff0e9). Gate: go vet, gofmt, go test ./... twice and once -race, all green. Filed while landing: #13, the one remaining synchronous write in Update (Keys → pty write), so a CLI that stops reading its keys cannot freeze the screen later.
titan closed this issue 2026-12-02 12:07:27 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
martha-ai/lazymartha#11
No description provided.