nvsh
An agent-first shell for NVIDIA Jetson AGX Orin/Thor and DGX Spark,
usable locally in Ghostty or over ssh. It hooks
into your existing interactive bash: your commands run exactly as they do
today, and when one fails, nvsh hands the error and device context to an
agent (shell → agent), which diagnoses the problem and proposes a fix.
Works like a shell. Helps when things break. Fixes when you let it.
Status: hook implemented. The bash hook (nvsh setup/uninstall/on/off),
the per-user session daemon, the trigger table, redaction, platform
detection, output capture, the pluggable NvshAgent backends (fake, Pi,
OpenAI-compatible, Claude, Codex, Qwen), the failure panel, slash commands
and the approve/execute/verify loop are all on disk and covered by tests —
see docs/architecture.md for the design and
docs/verification.md for what has been checked on
real hardware. Still open: the default-login-shell (chsh) mode stays
parked (see "Parked: login-shell mode" in docs/architecture.md), an
auto-apply mode (running a fix without confirmation) is out of scope for
v1, and machine-level undo beyond the current approve/execute/verify loop
is tracked as a follow-up
(#7). The design is
tracked in #1 (build
brief) and #2 (interactive
self-healing shell).
Goal
nvsh hooks into your existing bash rather than replacing or wrapping it:
- A shell first.
nvsh setupinserts one marked block into your rc file that adds a function to bash'sPROMPT_COMMANDarray. Bash itself keeps parsing, doing job control, completion, aliases and rc files exactly as it always has. A command that succeeds gets no added latency and no model call — seedocs/architecture.mdfor the decision and why a hook was chosen over a PTY wrapper. - An agent second. The agent is called only on a real failure (non-zero
exit, traceback, CUDA OOM, container or service failure, missing binary)
or when you ask for it (
nvsh ask,Ctrl+G, slash commands like/doctor). Exit codes that aren't errors, such as Ctrl-C, SIGPIPE, orgrepfinding nothing, don't trigger it, and automatic calls are rate-limited. - Propose, don't run. You get a diagnosis and a proposed fix, then accept, edit or reject it. Nothing the agent suggests runs without your confirmation. After an approved fix, nvsh can retry the command and check that it worked.
- NVIDIA-aware. Platform detection (JetPack/L4T, DGX OS/GB10, RTX),
CUDA / TensorRT / driver versions, unified memory,
nvpmodeland the container runtime are attached to each diagnosis; seedocs/platforms.mdfor sources. - Offline by default, pluggable. The agent backend sits behind an adapter: a local/LAN model first (Nemotron's "associate", via Pi, is the initial default), with the Culture mesh or a hosted API as options.
- Reversible.
nvsh uninstallremoves the marked block from your rc file (restoring it from a backup), the hook file, and any runtime state it created.NVSH_DISABLE=1andnvsh off/nvsh onare kill switches for the current shell.
nvsh is not a new POSIX shell. It is not an autonomous agent that runs
commands by itself, and it doesn't replace jetson-cli / dgx-spark-cli
(it calls them when they are installed). It is not built as a login shell
or PTY wrapper in this scope — that mode is a parked possible follow-up,
not a current goal (see docs/architecture.md).
What leaves the machine
- Nothing, by default. nvsh's own hook makes no network call on a successful command. On a qualifying failure, only a bounded context slice — the command line, exit status, a capped (<=64 KB) slice of the command's own output, and the detected platform block — is sent to the configured agent backend, which defaults to a LAN-local model, not a public API.
- Redaction runs before anything leaves the process. Tokens shaped like
HF_TOKEN=,--api-key,Authorization:headers, and.env-style assignments are scrubbed from the context before it is handed to the agent.--show-contextprints exactly the bytes that would be sent, so you can check before you trust it.
Quickstart (development)
uv sync
uv run pytest -n auto # run the test suite
uv run nvsh whoami # identity from culture.yaml
uv run nvsh doctor # health checks
uv run nvsh learn # self-teaching prompt (add --json)
uv run teken cli doctor . --strict # the agent-first rubric gate CI runs
CLI
| Verb | What it does |
|---|---|
whoami |
Report this agent's nick, version, backend, and model from culture.yaml. |
learn |
Print a structured self-teaching prompt. |
explain <path> |
Markdown docs for any noun/verb path. |
overview |
Read-only descriptive snapshot of the agent. |
doctor |
Health checks: agent-identity invariants, platform detection, agent backend configured/reachable, and (from a hooked shell) hook sourced, bindings, capture and daemon status. |
cli overview |
Describe the CLI surface itself. |
setup |
Render the bash hook files and insert the rc block. |
uninstall |
Remove the rc block, rendered files, sockets, logs and daemon. |
on / off |
Print the bash that rebinds / unbinds the hook in the current shell. |
agent |
List, choose, or install NvshAgent harness backends. |
approve |
Check or manage the approved-command pattern store. |
capture |
Show the last captured command output. |
context |
Show exactly the context that would be sent to the agent. |
daemon |
Run, inspect or stop the per-user session daemon. |
slash |
Dispatch one /verb ... line. |
complete |
Tab-completion candidates. |
Every command supports --json. Results go to stdout, and errors and
diagnostics go to stderr; the two are never mixed. Exit codes: 0 success,
1 user error, 2 environment error, 3+ reserved.
Verified on: see docs/verification.md for the
devices and scenarios this has actually been exercised against.
Repository layout
nvsh is an AgentCulture mesh agent built from the culture-agent-template:
culture.yamlholds the mesh identity (suffix: nvsh,backend: claude).- One prompt file per agent harness, with no shared base:
CLAUDE.mdfor Claude Code,AGENTS.override.md+.pi/SYSTEM.mdfor Pi/associate,AGENTS.colleague.mdfor colleague, andQWEN.mdfor Qwen Code. There is deliberately noAGENTS.md. Seedocs/harness-selection.mdanddocs/automation-contract.md. .claude/skills/holds the guildmaster skill kit, vendored cite-don't-import. Seedocs/skill-sources.md.docs/architecture.mdrecords the hook-vs-wrap decision, anddocs/platforms.mdrecords where each detected device value comes from.- CI covers pytest, lint, secret scanning, the agent-first rubric gate, a per-harness smoke check, and PyPI Trusted Publishing.
Every PR bumps the version. See CLAUDE.md for the full
contributor conventions.
License
Apache 2.0 — see LICENSE.
Release files for nvsh 0.9.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nvsh-0.9.2.tar.gz | 750.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nvsh-0.9.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 969.3 kB
Release files / nvsh-0.9.2.tar.gz
| Download URL | nvsh-0.9.2.tar.gz |
|---|---|
| Size | 750.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c21ccbac65e57b5053491c0d49eabf3a98f0f9040e77a98bf4360528f212724a
|
|
BLAKE2b-256 checksum How to use checksums |
afa8a605e4834049e90b1cd3402f2e3c127e493b129256baf6eef379aa9d1003
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / nvsh-0.9.2-py3-none-any.whl
| Download URL | nvsh-0.9.2-py3-none-any.whl |
|---|---|
| Size | 218.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6167e96ab90bb1316d93c0d93514205b78cddd4b84f494adeab05a12d01babbe
|
|
BLAKE2b-256 checksum How to use checksums |
93586266e54084531c0135bc4e83823cf19106c75a2649142da474b7d179269c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|