github.com/rilder-almeida/dsmn

Resilient CLI/daemon wrapper for Claude Code — survives terminal disconnection, auto-resumes on rate limits


License
MIT
Install
go get github.com/rilder-almeida/dsmn

Documentation

dsmn

dsmn = "Don't Stop Me Now"

Wrapper for the Claude Code CLI that survives terminal disconnection and resumes on its own when it hits a subscription rate limit — without tmux.

Install

go install github.com/rilder-almeida/dsmn/cmd/dsmn@latest
# or: npm install -g dsmn
dsmn install   # prints the alias + completion snippet for your shell

dsmn install never edits any shell config file — it detects your shell (bash, zsh, or fish) and prints the exact alias and completion lines to paste into its config yourself. Run dsmn uninstall to check whether an old-style auto-injected block (from a previous dsmn version) is still present in ~/.bashrc/~/.zshrc; it prints exactly what to delete rather than deleting it itself.

Reentrancy (not double-wrapping claude when already inside a dsmn session) is handled in dsmn start itself, so it works whether you invoke claude through the installed alias or dsmn start -- claude directly.

Optional: capture Claude Code's own session id

dsmn list/dsmn status can show the underlying Claude Code session_id (so you can claude --resume <id> after a session ends), learned via Claude Code's own SessionStart hook. This is opt-in and installed the same way any Claude Code plugin is — dsmn never edits ~/.claude/settings.json itself:

claude plugin marketplace add rilder-almeida/dsmn
claude plugin install dsmn@dsmn

The hook is a no-op for any claude session that isn't wrapped by dsmn, so it's safe to install once, globally.

Optional: show dsmn's attach state in Claude Code's statusLine

dsmn statusline prints dsmn when the current Claude Code session is attached to a dsmn session, or 4 blank spaces otherwise (not dsmn-wrapped, or wrapped but currently detached) — fixed width either way, so the rest of your statusLine never shifts. It relies on the same SessionStart hook above already being installed (it identifies "is this session dsmn-wrapped" via the session_id the hook captured), and dsmn never edits your ~/.claude/settings.json itself — add this yourself:

"statusLine": { "type": "command", "command": "dsmn statusline" }

You can also check a specific dsmn session directly by ID, independent of Claude Code or the hook (e.g. for scripting or manual verification): dsmn statusline <id> prints dsmn if that session currently has an attached client, or 4 blank spaces otherwise.

Usage

dsmn start [-- command...]   # starts a new session and attaches (default: claude)
dsmn attach <session-id>     # reattaches to an existing session
dsmn list                    # lists active sessions
dsmn status [session-id]     # session state
dsmn logs [session-id]       # tail of the current day's log
dsmn kill <session-id>       # ends it (SIGTERM, then SIGKILL if needed)
dsmn run [-- command...]     # synchronous/piped mode (--print), no daemon
dsmn version

Configuration

~/.dsmn.json (or .yaml/.toml), environment variables (DSMN_<FIELD>), and CLI flags (e.g. --margin-seconds) override defaults in that order of precedence. See docs/design.md §8 for the full field list.

Design

The full technical spec lives at docs/design.md.

Supported platforms

Unix-like (Linux, macOS) only — no Windows/ConPTY support.