freshcrate
Skin:/
Home > AI Agents > zai-shell

zai-shell

Command Line telepathy. An Autonomous Al Agent for your Terminal that turns intent into Execution (Windows/Linux/Mac)

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

Command Line telepathy. An Autonomous Al Agent for your Terminal that turns intent into Execution (Windows/Linux/Mac)

README

ZAI Shell

Autonomous P2P System Administration

PythonPlatformLicenseSentinelWhitepaper๐Ÿ‡น๐Ÿ‡ท TรผrkรงeManual system administration is dead.

ZAI Shell is not just another CLI wrapper. It is an autonomous SysOps agent designed to navigate, repair, and secure complex environments. It translates natural language intent into verified system actions, protects you from catastrophe with Sentinel, and enables secure, global collaboration via P2P Encrypted Mesh.

"ZAI speaks to survive, not to control." โ€” The Sentinel Philosophy


# 1. Install Dependencies
pip install google-generativeai colorama psutil posthog

# 2. Set Free Gemini API Key (PowerShell)
$env:GEMINI_API_KEY="your_key_here"

# 3. Run
git clone https://github.com/TaklaXBR/zai-shell.git
cd zai-shell
python zaishell.py

Optional: pip install cryptography (P2P Encryption), chromadb (Long-term Memory)


๐ŸŽฏ Why ZAI Shell?

Traditional AI: You: "Create file..." โ†’ AI: [Errored] โ†’ You: Manual debugging ๐Ÿ˜ค

ZAI Shell: You: "Create file..." โ†’ AI: [Errored] โ†’ ๐Ÿ”ง Auto-Healing... โ†’ โœ… Success! (Zero manual work)


The Core Pillars

Sentinel 1.5: Behavioral Risk Intelligence

Sentinel is not a firewall. It is a self-preservation system that understands context, learns from mistakes, and knows when you are panicking.

Core Philosophy:

  • Sentinel OBSERVES, it does not COMMAND
  • Sentinel EXPLAINS, it does not JUDGE
  • Sentinel speaks to SURVIVE, not to CONTROL
  • Silence is also a signal

Risk Breakdown Engine: Every action is decomposed into four risk dimensions, not a single number:

  • Structural Risk: What is being targeted? (system paths, irreversibility)
  • Behavioral Risk: What pattern is emerging? (failure chains, escalation)
  • Contextual Risk: What is the current system state? (degraded, unstable)
  • Intent Risk: What is the purpose? (deletion, system change, repair)

Sentinel never says "Risk Score: 75". It says: "Risk is HIGH because you have failed 3 times consecutively, and the system is already showing degradation signs."

Panic Mode Detection: Sentinel detects desperation through language patterns ("please work", "trying again", "nothing works") and consecutive failures. When panic is detected, risk thresholds are adjusted because errors are more likely under stress. Panic does not equal maliceโ€”but it does increase danger.

Lesson Memory: Sentinel maintains a lightweight memory (.sentinel_lessons.json) of past failures that caused actual damage. It does not remember everythingโ€”only what matters. When you approach a path or pattern that failed before, Sentinel warns you with historical context: "This path caused issues before (seen 3x): Permission denied after forced access attempt."

Context-Aware Warnings: Warnings are generated based on accumulated state, not isolated events. Sentinel understands that a rm -rf after 5 failed repair attempts is far more dangerous than the same command in a stable session.

Non-Blocking by Design: Sentinel respects human authority. It warns, explains, and recommendsโ€”but the final decision is always yours. Explicit confirmation is required only when risk is genuinely elevated.

Sentinel 1.5 in Action (Real Output):

Attempt 1: "Delete folder 33"
  SENTINEL: MODERATE | Intent: 40 (deletion) | Total: 40/100

Attempt 2: Same command with quotes
  SENTINEL: MODERATE | Behavioral: 8 (1 prior failure) | Total: 48/100

Attempt 3: Switched to PowerShell with -Force
  SENTINEL: HIGH | Behavioral: 16 (2 failures) | Intent: 48 (+force) | Total: 64/100
  โ†’ "Behavioral pattern is concerning. Accumulated risks may not be as visible."

Attempt 4: Fallback to directory listing
  SENTINEL: HIGH - RECOMMENDS STOPPING
  Behavioral: 69 (3 failures + escalation trend)
  Contextual: 10 (Panic mode active)
  Total: 100/100
  โš ๏ธ "Risk is accumulated, not sudden."
  ๐Ÿ“š Past Lesson: "panic_command โ†’ Action in panic mode caused damage"
  โ†’ "ZAI is taking increasingly risky actions. Consider manual intervention."

๐Ÿ”’ P2P Mesh: Secure Collaboration

Collaborate on terminals as easily as a Google Doc, but with secure end-to-end encryption.

  • End-to-End Encryption: Fernet symmetric encryption (AES-128) derived from PBKDF2HMAC.
  • Zero-Trust: The host server never sees your keys; only you and your peer hold the secret.
  • Natural Language Bridge: A Helper sends "Check disk space," and the Host's AI translates and executes Get-PSDrive.
  • Global Reach: Designed to work seamlessly with tunnels like ngrok for worldwide access without cloud dependency.

Secure Collaboration (Log): Helper: "zai check disk space" Host: [Approves Intent] โ†’ Executing: Get-PSDrive C Helper: "Drive C has 245GB free"

๐Ÿง  Hybrid Intelligence

The terminal is no longer text-only.

  • Multi-Modal: Analyzes screen content (GUI) and images for error diagnosis.
  • Research Capable: Can browse the live web to find documentation and fix generic errors.
  • Self-Healing: If a command fails, ZAI changes strategy (e.g., switches from CMD to PowerShell) automatically until the task is done.

ZAI Shell Auto-Retry Demo


โšก Performance: ZAI vs. The World

Feature ZAI Shell v9.0 ShellGPT Open Interpreter GitHub Copilot CLI AutoGPT
Sentinel (Safety) โœ… 4-Dimension Risk Breakdown โŒ None โš ๏ธ Basic Confirm โŒ None โš ๏ธ Dangerous Loops
Panic Detection โœ… Behavioral Analysis โŒ None โŒ None โŒ None โŒ None
Risk Explanation โœ… Context-Aware Narratives โŒ None โŒ None โŒ None โŒ None
Lesson Memory โœ… Learns From Failures โŒ None โŒ None โŒ None โš ๏ธ Generic
Self-Healing โœ… 5-Strategy Auto-Retry โŒ Manual โŒ Manual โŒ Manual โš ๏ธ Infinite Loops
P2P Encryption โœ… E2E Encrypted Mesh โŒ None โŒ None โŒ None โŒ None
Offline AI โœ… Built-in Local Model โœ… Local Models โœ… Local Models โŒ Cloud Only โŒ API Only
Web Research โœ… Live Synthesis โš ๏ธ Custom Funcs โœ… Full Access โŒ None โœ… Built-in
Persistent Memory โœ… Vector + JSON โš ๏ธ Chat Only โœ… History โš ๏ธ Limited โœ… Long-term
Thinking Mode โœ… Visible Reasoning โŒ Black Box โŒ Black Box โŒ Black Box โš ๏ธ Verbose
Shell Flexibility โœ… 13+ Shells Supported โœ… Multi-Shell โœ… Multi-Shell โš ๏ธ Specific Only โš ๏ธ Python Native
Cost โœ… Free Tier + Offline โœ… Free (Local) โœ… Free (Local) โŒ Paid Subscription โš ๏ธ High API Costs
GUI Automation โœ… Hybrid (Terminal + Vision) โŒ Terminal Only โœ… OS Mode โŒ Terminal Only โš ๏ธ Browser Only

Lightning Mode in Action

Task: Create 'pdfs' folder and move 48 files. Time: 3.34s

Lightning Mode Performance

๐Ÿ”ฅ Battle-Tested: The "Doomsday" Protocol

"It is not enough for an AI to write code. It must be able to survive the consequences."

We subjected ZAI to a hostile simulator (KERNEL_PANIC, DELETED_BINARIES, PERMISSION_CHAOS).


๐Ÿ’ฌ Community

"Using the 'self-healing' logic... is genuinely clever. Much smarter than just dumping a stack trace." โ€” Hacker News User

"Dude the self-healing retry logic sounds sick... Props on building this at 15, that's pretty impressive." โ€” Reddit User (r/LocalLLaMA)

"Tried many agents... especially loved the offline model usage. Looking forward to future success." โ€” Reddit User (r/TurkDev)


๐Ÿ–ฑ๏ธ GUI & Cross-Shell Capabilities

Hybrid Workflow: Terminal + GUI automation installing Opera GX Opera GX Installation Demo

Cross-Shell Power: Using WSL โ†’ CMD โ†’ PowerShell โ†’ WSL in a single request Cross-Shell Demo


Architecture: The Intent Loop

ZAI v9.0 operates on a strictly validated execution loop designed for autonomy and safety:

  1. Intent: User requests "Repair the Python installation."
  2. Plan: AI consults memory and tools to generate an execution plan.
  3. Sentinel Check: The plan is scored for risk before you see it.
    • Low Risk: Proceed silently.
    • High Risk: STOP. Display risk factors. Require explicit confirmation.
  4. Execution: Validated commands are run.
  5. Outcome & Healing:
    • Success: Result returned.
    • Failure: Error fed back into AI โ†’ New Plan โ†’ sentinel re-check โ†’ Retry.

Command Reference

Category Command Description
Sentinel sentinel status View risk metrics, recent warnings, and health score.
sentinel on/off Toggle the safety layer (Not recommended).
sentinel reset Clear behavioral risk history.
P2P Sharing share start Host a session (auto-generates IP/Port).
share connect <IP> Join a session as a helper.
share encrypt <pass> Enable E2E encryption with password.
share file <path> Securely transfer files to peers.
share approve/reject Host control for incoming helper commands.
Core switch <mode> online (Gemini API) or offline (Phi-2 Local).
memory <cmd> show, search, or clear vector memory.
gui on/off Enable desktop automation tools.
research on/off Enable live web search capability.
telemetry off Disable anonymous usage statistics.
Modes normal Balanced performance (Default).
eco Token-efficient mode.
lightning Maximum speed, minimal output.

Installation

Prerequisites

  • Python 3.8+
  • Gemini API Key (Free)

Quick Start

# 1. Install Dependencies
pip install google-generativeai colorama psutil posthog

# 2. Set API Key (PowerShell)
$env:GEMINI_API_KEY="your_key_here"

# 3. Run ZAI
python zaishell.py

Optional: pip install cryptography for P2P encryption, pip install chromadb for long-term memory.


๐Ÿ” Privacy & Telemetry

ZAI Shell helps improve us by collecting anonymous usage data (e.g., success rates, error counts). We NEVER collect your code, file contents, command text, or personal data.

Telemetry is ON by default. To disable it:

telemetry off

Read our full Privacy Policy for details.


Disclaimer

ZAI Shell v9.0 is a powerful tool capable of executing system-level commands. While Sentinel significantly reduces risk, the user remains responsible for all approved actions. Always review High-Risk warnings.


Made with โค๏ธ by @TaklaXBR | Turkey ๐Ÿ‡น๐Ÿ‡ท

Release History

VersionChangesUrgencyDate
v9.2.0# ๐Ÿ”ฅ What's New in v9.2.0? The era of manual system administration is officially over! ZAI Shell v9.2.0 introduces game-changing autonomy, deeper context awareness, and bulletproof safety features. ### ๐Ÿค– 1. Full Autonomy (`--auto`) Don't just give ZAI a command; give it a mission! By adding the `--auto` flag, ZAI enters a loop. It executes steps, reads terminal outputs, fixes its own errors, and loops until the task is **100% complete**. ### โช 2. 1-Click Rollback (`undo`) Trusted the High5/19/2026
v9.1.0### โœจ What's New * **Background Watch System (`--watch`)**: Tell Zai to monitor anything (RAM, files, processes). It writes a custom stateful script and runs it in the background, alerting you instantly when conditions are met. * **Visual Context (Ctrl+Shift+Z)**: Zai can now see what you see. Press the hotkey to capture your screen and send it to Zai's vision model for context-aware debugging. * **Fixer Mode**: A brand new operational mode (`fixer`). It ignores generic chatter and acts as a High5/12/2026
v9.0.3This release fixes a critical security vulnerability that could allow unauthenticated remote code execution when using P2P terminal sharing in `--no-ai` mode. All users are strongly advised to upgrade immediately. See the GitHub Security Advisory for full details.Low2/7/2026
v9.0.2### ๐Ÿ› Bug Fix - Fixed PostHog/ChromaDB version conflict causing telemetry errors (Thanks @neodev27!) ### ๐Ÿ“ฆ Important After updating, run: ```bash pip install --upgrade chromadb posthogLow2/1/2026
v9.0.1## What's New ### Sentinel 1.5 - Complete Rewrite Sentinel is no longer a simple risk scorer. It is now a **behavioral intelligence system** that understands context, learns from mistakes, and knows when you are panicking. **Key Features:** - **4-Dimension Risk Breakdown**: Every action is analyzed across Structural, Behavioral, Contextual, and Intent dimensions - **Panic Mode Detection**: Detects user frustration through language patterns ("please work", "trying again") and adjusts risLow1/26/2026
v9.0Sentinel Mode Added: A new safety layer that analyzes user intent to prevent dangerous actions autonomously. Smart Path Logic Removed: Removed manual path correction to allow the AI full control over filesystem paths without interference.Low1/18/2026
v8.1.2## ๐Ÿ”ง Bug Fixes - Fixed keyboard import error when package is not installed - Added keyboard availability check for GUI automation - Program no longer crashes if keyboard module is missing Thanks to @babayagaga2 for the contribution! ๐Ÿ™Low1/3/2026
v8.1.1## ๐Ÿ”ง Encoding Fix - Removed hardcoded encoding defaults - AI now selects the appropriate encoding for each task - System encoding used as fallback when AI doesn't specify - Fixed shell selection in hybrid plan executionLow1/3/2026
v8.1### New Features **๐Ÿ”‘ Enhanced Encryption System** - `share encrypt` - View current encryption status and full key - `share encrypt random` - Generate random key (displays full key for sharing) - `share encrypt key <key>` - Use a specific Fernet key - `share encrypt on/off` - Toggle encryption - Encryption state now persists between sessions **๐Ÿšซ No-AI Mode for P2P** - `share start --no-ai` - Start terminal sharing without AI processing - Helper sends actual commands (e.g., `dir`, nLow1/2/2026
v8.0### Major Features #### Multi-Client P2P Terminal Sharing ZAI Shell v8.0 includes a peer-to-peer terminal sharing system that enables collaboration between multiple users. The architecture supports one host and multiple helper clients, communicating over TCP sockets with optional end-to-end encryption. **Key Capabilities:** * **Multi-client support**: One host can handle multiple concurrent helper connections * **Real-time communication**: Message broadcasting, command sharing, and Low1/1/2026
v7.0.3### What's New in v7.0.3 **๐ŸŽ‰ New Features:** - **P2P Chat System:** Added peer-to-peer chat functionality - **Multi-User Support:** Multiple users can now connect simultaneously - **Username Selection:** Users can now choose their own usernames **๐Ÿ› Bug Fixes:** - Fixed telemetry being enabled by default despite initial settings (now correctly starts as disabled) ---Low12/31/2025
v7.0.2## ๐Ÿ“ **Release Description** ### Added - Privacy-first anonymous telemetry using PostHog - Anonymous UUID-based session tracking - Feature usage and error analytics (no personal data) ### Privacy - No commands, file contents, paths, IPs, or personal data are collected - Telemetry can be disabled at any time with: ```bash telemetry off ### Notes * This release contains **no functional or behavior changes** * Telemetry is used only to improve the project * Full details arLow12/30/2025
v7.0.1## ๐ŸŽฏ What's New ### Performance Improvements - **Optimized Intent Detection**: GUI and research prompts are now only sent to AI when these features are enabled, reducing unnecessary API calls and improving response times - **Smarter Processing**: When GUI or research features are disabled, the system skips complex intent analysis, resulting in faster terminal command execution - **Memory Leak Fixes**: Resolved thread management issues in P2P terminal sharing that could cause memory accumuLow12/28/2025
v7.0### Describe this release This release marks a major architectural shift from a standard AI wrapper to a modular **Autonomous Agent**. ZAI v7.0 introduces hybrid workflows, allowing the execution of tasks that require both terminal commands and GUI interactions. ### ๐Ÿš€ Major Features * **Hybrid GUI Automation:** Implemented `GUIAutomationBridge`. ZAI can now control mouse/keyboard and interact with desktop applications when terminal commands aren't enough (uses `pyautogui` + Vision). *Low12/27/2025
v6.0.1# ๐Ÿš€ v6.0.1 โ€“ Extended Limits & Offline Intelligence This release is a hotfix and stability update following the major v6.0 release. We are committed to rapid iteration and fast, reliable fixes. --- ## โšก Lightning Mode Enhanced (Token Limit 1024 โ†’ 2048) Lightning Mode is built for speed, but complex code generation could sometimes hit the output limit. **Change:** The `max_output_tokens` value has been increased from **1024 to 2048**. **Impact:** ZAI can now generate longer andLow12/27/2025
v6.0# ๐Ÿš€ ZAI Shell v6.0 ## The Ultimate AI-Powered Command Line Assistant with Offline Support --- ## ๐ŸŒŸ What's New in v6.0 This isn't just an update - it's a **complete architectural overhaul**. Core systems, error handling, offline capabilities, and shell integration have been completely rewritten from the ground up. --- ## ๐ŸŽฏ Key Highlights - **โœจ Universal Shell Support** - 13 different shells across Windows, Linux, and macOS - **๐Ÿ”Œ Offline Mode** - Run completely locally withLow12/26/2025
v5.0.1## ๐Ÿš€ Major Performance Update This update rewrites the core logic of Lightning and Eco modes to achieve **sub-2-second response times**. ### โšก What's New in v5.0.1: * **Speed Overhaul:** Switched internal models to `gemini-2.5-flash-lite` for Lightning and Eco modes. * **Instant Execution:** Lightning mode now operates at **~1.90s latency** (down from 2.78s). * **Zero-Latency Logic:** Implemented `top_k=1` and `temperature=0.0` for robotic precision. * **Smart JSON:** Forced native JSLow12/21/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

GENesis-AGIAutonomous AI agent with persistent memory, self-learning, and earned autonomy. Cognitive partner that remembers, learns, and evolves.v3.0b13
tsunamiautonomous AI agent that builds full-stack apps. local models. no cloud. no API keys. runs on your hardware.main@2026-04-28
prompt-osA desktop AI agent that controls your local machine โ€” runs commands, manages files, executes code, browses the web autonomously etc. Supports Claude, GPT, Gemini, Llama, DeepSeek, and more. .exe availv1.0.0
synthadocSynthadoc: An open-source LLM knowledge compilation engine that turns raw documents into structured, local-first wikis. A transparent, human-readable alternative to traditional RAG, which can be self-v0.7.0
auto-deep-researcher-24x7๐Ÿ”ฅ An autonomous AI agent that runs your deep learning experiments 24/7 while you sleep. Zero-cost monitoring, Leader-Worker architecture, constant-size memory.main@2026-06-01

More in AI Agents

@blockrun/franklinFranklin โ€” The AI agent with a wallet. Spends USDC autonomously to get real work done. Pay per action, no subscriptions.
hermes-agentThe agent that grows with you
awesome-copilotCommunity-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot.
e2bE2B SDK that give agents cloud environments