mbagley/local-shell-accessLM Studio plugin that lets the model run commands in the user's local shell.
Companion to mbagley/agent-browser: where that plugin gives a model a browser
it can drive, this one gives it a terminal.
This is a power tool. Any command the model emits runs as your user, on your machine, with your permissions — including destructive ones (
rm -rf, network egress, package installs, git pushes, …). Only enable it for models you trust, and prefer running with a model and prompt that asks before doing anything irreversible.
/bin/zsh, /bin/bash, /bin/sh)
on macOS / Linux, or cmd.exe / powershell.exe on Windows.LM Studio's plugin runtime starts with a stripped PATH and does not inherit
the user's interactive shell environment. To make commands behave the same as
they would in your terminal, this plugin auto-detects your shell (from
$SHELL, falling back to your login shell in /etc/passwd, then to
/bin/zsh / /bin/bash) and invokes it with -l -c by default so your login
profile is sourced. That is what restores your real PATH, version-manager
hooks, etc. Aliases defined only in interactive rc files (.zshrc, .bashrc)
are typically not available — put PATH and env in .zprofile /
.bash_profile if you need them.
| Tool | Purpose |
|---|---|
shell_exec | Run a command. Supports pipes, redirects, &&, globs, command substitution, optional cwd / env / timeout_ms overrides. Returns exit code, stdout, stderr. |
shell_info | Report the resolved shell binary, args template, default cwd, user, hostname, and platform. Useful as a first orienting call. |
Each shell_exec call spawns a fresh shell process — there is no persistent
session, so cd and exported vars do not carry over between calls. Chain
steps in one command (cd /tmp && ls) or pass cwd per-call.
| Field | Default | Notes |
|---|---|---|
shell | (auto-detect) | Absolute path to a shell binary. Blank = auto. |
loginShell | true | Pass -l so the login profile is sourced. Disable for faster startup if your environment doesn't depend on profile-sourced PATH. |
defaultCwd | (home) | Working directory when the model doesn't specify one. |
timeoutMs | 60000 | Default per-command timeout. SIGTERM, then SIGKILL after a 2s grace. |
maxOutputBytes | 262144 | Per-stream cap on captured stdout/stderr. Output past this is truncated with a marker. |
npm install
npm run dev # lms dev — auto-rebuilds and reloads the plugin in LM Studio
npm run test:verify # build + integration test against the local shell
npm run push # lms push