Quick start
You need Bayesian SSH 2.13 or later, a few hosts saved in bssh, and an agent that speaks MCP.
Connect your agent
Section titled “Connect your agent”-
Add bssh to your agent’s MCP configuration:
bssh ai install claude-codeThe same command works with
codex,cursor,vscodeandclaude-desktop. It adds one entry namedbsshand leaves everything else in the file alone, after a backup.--dry-runprints the change without writing it:{"mcpServers": {"bssh": {"type": "stdio","command": "/usr/bin/bssh","args": ["ai", "mcp", "--policy", "default"]}}}Any other MCP client works too: point it at
bssh ai mcpover stdio. -
Restart the agent. It now has 15 bssh tools, starting with
list_hosts. -
Ask it something about a host:
Why is nginx returning 502 on web-1?
A typical session:
list_hosts,observefor the failed units,search_logson the nginx journal,read_fileon the site configuration. None of it asks you anything, because none of it can change the host.
What the agent may do at first
Section titled “What the agent may do at first”Until you write a policy, bssh uses the built-in observe profile on every host you have saved: the agent can read, and every write is refused. It acts for you, so it sees the hosts you already have, never more.
Check how a command would be treated, here or at any time:
$ bssh ai explain --host web-1 "journalctl -u nginx --since '10 min ago' | grep -i error"command: journalctl -u nginx --since '10 min ago' | grep -i errortags: readcommands: 1. journalctl -u nginx --since 10 min ago tags: read rule: journalctl read 2. grep -i error tags: read rule: greppolicy: default host: web-1decision: allow - analyzer: every command is read-onlyLet it fix things
Section titled “Let it fix things”Give the default policy the operate profile and a scope. Policies live under ai.policies in your configuration file, ~/.config/bayesian-ssh/environments/default/config.json:
"ai": { "policies": { "default": { "profile": "operate", "scope": { "tags": ["staging", "prod"] }, "approval": { "in_client": ["staging"], "two_person": ["prod"] }, "write_paths": ["/etc/nginx/**"] } }}Now the agent can propose changes on hosts tagged staging or prod, and edit files under /etc/nginx. Every change asks first. On staging, a low-risk change can be confirmed in the agent’s own client; anything else goes to the desktop app or the terminal. See Policies for every field.
Approve the first change
Section titled “Approve the first change”Ask the agent to fix what it found. It sends a change plan: the steps, the diff, how to check the fix and how to undo it. The desktop app shows it in its AI section; in a terminal:
bssh ai approvebssh ai approve lists what is waiting, shows the request in full and asks for a decision. --deny --reason "…" refuses with a reason the agent receives. Once approved, bssh runs exactly the approved steps, then the plan’s verify steps, and the agent reports back.
See what happened
Section titled “See what happened”bssh ai log # recent runsbssh ai log <run> --report # hosts touched, changes with diffs, approvals, undo pointsbssh ai status # running agents, pending approvals, active grantsbssh ai stop # end a run nowEverything above also sits in a signed, hash-chained log on your machine.
Keep agents on the bssh path
Section titled “Keep agents on the bssh path”An agent that also has a shell tool can still try plain ssh. For Claude Code, bssh can install a hook that blocks ssh, scp, sftp and rsync to the hosts bssh knows and points the agent to the bssh tools instead:
bssh ai install claude-code --guardNext steps
Section titled “Next steps”- Policies: profiles, paths, deny rules, budgets, and testing a policy in CI.
- Host setup: the low-privilege agent user, the read-only jail and approval-bound certificates.
- Approvals: plans, grants and the desktop app.