Skip to content

Nexus background sessions: detach, live status, agents driving agents - #18

Merged
Darknode-Official merged 1 commit into
mainfrom
feat/background-sessions
Nov 7, 2026
Merged

Darknode-Official merged 1 commit into
mainfrom
feat/background-sessions

Conversation

@Darknode-Official

Copy link
Copy Markdown
Owner

Background sessions for Nexus. Agents keep running after you close the terminal or lose SSH. Every session is marked working / blocked / idle / done, and agents can start, prompt and wait on each other.

Commands: nexus bg, nexus attach (Ctrl+] detaches), nexus ls, nexus sessions (a live list), and nexus hub send|wait|peek|kill|restore|stop.

The agent sessions tool works in the native loop and over the nexus MCP bridge (Claude Code, Codex and others). It goes through the run_command gates, is blocked in plan mode, and only spawns inside the project.

Tested: 54 new tests (screen model, status detection, command guard, tool safety, a live hub driving a real shell under a pty). The full suite is 3,491 passed, 0 failed. Also checked by hand in tmux: attach and detach on a real Nexus TUI, the live list, restore after a hub restart, and the MCP tool spawning and waiting on a worker.

Limits: Linux and macOS only (macOS untested here). Processes do not survive a reboot; hub restore relaunches them.

A per-user session hub keeps agent sessions running after the terminal closes
or an SSH connection drops.

- nexus bg [-- claude ...] starts Nexus or any agent under a real terminal.
  The terminal comes from the system `script` program (no native modules).
  Resizing uses stty on the session's tty.
- nexus attach takes a session over. Ctrl+] detaches and leaves it running.
  A small screen model repaints the client on attach.
- nexus ls and nexus sessions (a live list) mark each session working,
  blocked, idle or done. Nexus reports its own state. Other agents are read
  from their screen and, on Linux, from the tty's foreground job.
- Desktop notifications fire when an unattended session gets blocked or
  finishes.
- nexus hub send / wait / peek / kill / restore / stop / forget / status.
- The sessions tool (spawn, send, wait, peek, list, kill) is available in the
  native loop and to external engines through the nexus MCP bridge. It goes
  through the run_command danger gate and policy, is blocked in plan mode,
  and only spawns inside the project.
- Words that can start a prompt stay prompts unless they name a running
  session.
@Darknode-Official
Darknode-Official merged commit f6bb833 into main Nov 7, 2026
6 checks passed
@Darknode-Official
Darknode-Official deleted the feat/background-sessions branch November 7, 2026 19:11
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