nsh  by fluffypony

AI-powered terminal assistant for natural language command execution

Created 2 months ago
685 stars

Top 49.4% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

nsh is an AI-powered shell assistant designed to enhance terminal productivity by transforming natural language requests into executable commands or direct answers. It targets developers and power users who rely heavily on the command line, offering intelligent assistance without leaving their current shell environment. The core benefit is a significant reduction in cognitive load and execution time for common and complex terminal tasks.

How It Works

nsh wraps the user's shell in a pseudo-terminal (PTY) to capture scrollback and command history, storing it locally in an SQLite database. It dynamically assembles rich context from the OS, project structure, Git state, and terminal output, then leverages configured LLM providers to generate responses. A key architectural choice is its multi-step agent loop, enabling chained tool calls for complex problem-solving, investigation, and verification before executing actions.

Quick Start & Requirements

  • Installation: Via curl -fsSL https://nsh.tools/install.sh | bash (Unix/WSL/MSYS) or native Windows PowerShell installer. Source builds require Rust 1.85+.
  • Prerequisites: A shell (zsh, bash, fish, PowerShell), an LLM provider API key (OpenRouter default), and optionally Rust for building.
  • Setup: Run nsh autoconfigure --interactive or manually configure ~/.nsh/config.toml. Integrate with your shell via eval "$(nsh init <shell>)".
  • Docs: Installer script URL: https://nsh.tools/install.sh.

Highlighted Details

  • Natural Language Interface: Single-character aliases (?, ??, ?!) for standard queries, reasoning, and private modes, with optional auto-execution (!!).
  • Contextual Awareness: Gathers extensive context including scrollback, project structure (Node.js, Python, Rust, etc.), Git state, and cross-TTY activity.
  • Command Prefill & Safety: Suggests commands at the prompt for review/editing, with configurable confirmation modes and risk assessment (safe/elevated/dangerous).
  • Multi-step Agent & Coding Agent: Capable of chaining up to 50 tool calls for complex tasks, featuring a dedicated sub-agent for code-related operations within project directories.
  • Security Features: Built-in secret redaction, sensitive directory blocking, command risk classification, and audit logging.
  • Persistent Memory: A 6-tier memory system (Core, Episodic, Semantic, Procedural, Resource, Knowledge Vault) enables long-term learning and context retention.
  • Remote Access: Supports P2P remote access via iroh, including a mobile companion app and LAN discovery.

Maintenance & Community

The project provides a self-update mechanism via DNS TXT records. No specific community channels or contributor details were found in the README.

Licensing & Compatibility

Licensed under the permissive BSD 3-Clause license, allowing for broad compatibility with commercial and closed-source applications.

Limitations & Caveats

Requires configuration of an LLM provider and API key. The "coding agent" operates with working-directory constraints. While extensive, the README does not detail specific performance benchmarks or known bugs.

Health Check
Last Commit

4 days ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
9
Star History
1,402 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.