Skip to content

Add a Rex module for browsing and resuming sessions - #266

Merged
nicosuave merged 1 commit into
mainfrom
rex-plugin
Oct 28, 2026
Merged

nicosuave merged 1 commit into
mainfrom
rex-plugin

Conversation

@nicosuave

Copy link
Copy Markdown
Owner

Adds Rex support alongside the herdr plugin.

Rex has no plugin manager. A plugin is a Lua module that init.lua loads with require (the rex-worktrunk pattern). memex ships one at rex/memex.lua, embedded in the binary, and memex rex install writes it beside Rex's init.lua. It never edits init.lua; it prints the lines to add.

require("memex").setup{}
rex.bind("cmd+shift+m", "memex_palette")

Actions (they mirror the herdr plugin; all appear in Rex's command palette under "memex"):

  • memex_palette: the TUI zoomed over the focused pane. Quitting it restores the layout.
  • memex_here: the palette filtered to the focused terminal's repo.
  • memex_desk: a memex tab, reused when one is already open.
  • memex_sidebar: a split beside the focused pane, or closes it if one is open.
  • memex_resume_last, memex_index, memex_web.

Resume inside Rex. When memex runs in a Rex terminal (REX_SESSION is set), resuming from the TUI, or with the hidden memex rex resume[-last], works like this:

  • It opens a new Rex tab at the session's directory and types the resume command into the tab's shell, via initial_input. The shell stays open after the agent exits, as with herdr's pane run.
  • If a terminal in the same Rex session is already running that session, memex focuses it instead. It matches the session id against the command lines of the processes under each terminal.
  • rex_resume = "tab" | "split" | "off" in memex's config.toml changes where sessions open.
  • Session selection is now shared with memex herdr resume[-last] (resume_target).

Rex-specific choices:

  • Palette placement. The palette is a zoomed split rather than a floating layer. Rex draws floating layers without a backdrop, and the TUI keeps the terminal's default background, so the pane underneath would show through.
  • Pane labels. Resumed panes carry no pane label; only their tab is labeled. The module finds its own panes by the label memex, which would otherwise match an agent resumed from the memex repo.
  • No startup hook. Rex doesn't send events to config files. The memex daemon already covers background indexing.

Checked:

  • clippy with warnings as errors is clean.
  • New unit tests in src/rex.rs and a memex rex install integration test (tests/rex_cli.rs) pass, along with cli_surface.
  • The Lua module passes rex config check (7 actions).
  • Live against Rex 0.0.1792787366 with a sandbox root: memex rex resume-last opened a tab running the resume command, and a second run focused that tab. memex_palette, loaded through init.lua, opened the TUI zoomed over the pane.
  • Not yet exercised live: desk, sidebar, here, index, web.

Rex has no plugin manager: a plugin is a Lua module beside init.lua. memex now
ships one (rex/memex.lua, embedded in the binary) and `memex rex install`
writes it to Rex's config directory. Its actions mirror the herdr plugin: a
session palette zoomed over the focused pane, a "recent here" palette, a desk
tab, a sidebar toggle, resume-last, index, and web.

Inside a Rex terminal, resuming a session from the TUI or `memex rex
resume[-last]` opens a new Rex tab (or split, via `rex_resume`) with the resume
command typed into its shell, or focuses the terminal already running that
session. Session selection is shared with the herdr path.
@nicosuave
nicosuave merged commit f0c1ada into main Oct 28, 2026
11 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