Repository navigation
Nexus background sessions: detach, live status, agents driving agents - #18
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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), andnexus hub send|wait|peek|kill|restore|stop.The agent
sessionstool 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 restorerelaunches them.