/ps-bash:ps-bash-sessionsfrom ps-bash
Drive ps-bash from agents and front ends: named sessions keeping state between ps-bash -c calls, the terminal-broker client contract, compact agent output. ps-bash 命名會話與代理。 Use when: shell state must survive between commands, one shell per agent, attaching a front end to a running shell, cutting log tokens, setting ps-bash as Claude Code's or OpenCode's shell.
Ships in ps-bash. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
ps-bash session start build --idle-secs 3600 # create or reuse; ends after 1 h of silence (default 24 h)
PSBASH_SESSION=build ps-bash -c 'x=5; cd /src'
PSBASH_SESSION=build ps-bash -c 'echo $x; pwd' # 5, /src: one pinned runspace for the session's life
ps-bash session list # name, state, mode, pid, start time
ps-bash session status build
ps-bash session stop build
stop or its idle window ends it.$env: are
process-wide), while separate sessions never wait on each other.PSBASH_* variables to a stateful session and does not reimpose its own
cwd or environment. Only exported variables reach a nested sh -c.session start NAME --stateless gives a fresh pooled runspace per command; changing mode needs a stop.A-Z a-z 0-9 _ -. Sessions are per OS user, in a 0700 runtime directory.kill -TERM $$ from inside reaches the session's running script as a message: a trap runs at its
next top-level statement; with no trap the script ends 128+N and the host stays up.A client resolves the endpoint from PSBASH_SESSION=NAME (the launcher's rule), checks liveness in the
<endpoint>.host.json sidecar, and for the live terminal connects to <endpoint minus .sock>-t.sock:
one AF_UNIX stream of frames [type:1][length:4 big-endian][payload ≤ 1 MiB].
| Direction | Frames |
|---|---|
| client → broker | H hello, first (flags byte; bit 0 = read-only), I input bytes, R resize (cols:2, rows:2), Q end the shell |
| broker → client | O output bytes (the first frames after hello replay the scrollback), X shell exited (exit code:4) |
Detach by closing the socket. Reference code: src/PsBash.Shell/Sessions/ (TerminalProtocol.cs,
TerminalBroker.cs); contract: docs/sessions.md.
ps-bash --compact-output -c 'make check' (or PSBASH_COMPACT_OUTPUT=1; --no-compact-output wins
for one call) keeps the command, exit code, timeout, stream labels, file:line diagnostics and the tail,
and collapses repeats and progress noise. Leave it off when exact bytes matter.
Claude Code runs CLAUDE_CODE_GIT_BASH_PATH only when the file is named bash.exe or sh.exe: copy
ps-bash.exe to bash.exe in the same folder (install-local.ps1 does), set that path and
PSBASH_UNIX_PATHS=1 in the settings env, and restart. echo $BASH_VERSION printing
0.x.0(1)-release proves it took. OpenCode reads SHELL. Full guide: docs/agent-setup.md in the
ps-bash repository.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub standardbeagle/standardbeagle-tools --plugin ps-bash7 skills in this plugin
/ps-bash-browseBuild object workbenches on ps-bash's browse: adapters keyed by type name, display columns, actions with a destructive-preview gate, scripted -List/-Select/-Action/-Exec. ps-bash browse 物件工作台。 Use when: an interactive picker or TUI over objects from a .psm1, adding actions for a PSTypeName, scripting browse non-interactively from an agent./ps-bash-embedHost ps-bash in your own .NET app: PsBash.Core NuGet, BashTranspiler.Transpile, importing the embedded version-matched module, keeping objects for object cmdlets, IHostTerminal. ps-bash 嵌入 .NET 應用。 Use when: a GUI, daemon or agent tool runs bash in-process, transpiling bash to PowerShell, vim/less hang or say TERM not set in an embedding./ps-bash-hooksOther plugins' skills for the same job