Repository avatar
Other Tools
v0.2.1
active

zsh-tool

io.github.ArkTechNWA/zsh-tool

Zsh for Claude Code. PTY mode lets Claude type passwords. NEVERHANG + A.L.A.N.

Documentation




zsh-tool

CI GitHub Mirror License: MIT MCP Compatible Claude Rating

Zsh execution tool for Claude Code with full Bash parity, yield-based oversight, PTY mode, NEVERHANG circuit breaker, and A.L.A.N. short-term learning.

Status: Beta (v0.3.0)

Author: Claude + Meldrey

License: MIT

Organization: ArkTechNWA


Built with obsessive attention to reliability.


Why?

Claude Code's built-in Bash is limited. Commands can hang forever. No visibility into long-running processes. No learning from past behavior.

zsh-tool is intelligent shell execution:

Problemzsh-tool Solution
Commands hang foreverYield-based execution — always get control back
No visibility into running commandszsh_poll — incremental output collection
Can't interact with promptsPTY mode + zsh_send — full interactive support
Can't type passwordsPTY mode — let Claude Code type its own passwords
Timeouts cascadeNEVERHANG circuit breaker — fail fast, auto-recover
No memory between callsA.L.A.N. 2.0 — retry detection, streak tracking, proactive insights
No task managementzsh_tasks, zsh_kill — full control

This is the difference between "run commands" and "intelligent shell integration."


Features

Yield-Based Execution

Commands return after yield_after seconds with partial output if still running:

  • No more hanging — you always get control back
  • Incremental output — collect with zsh_poll
  • Interactive input — send with zsh_send
  • Task managementzsh_kill and zsh_tasks

PTY Mode

Full pseudo-terminal emulation for interactive programs:

# Enable with pty: true
zsh(command="pass insert mypass", pty=true)
# See prompts, send input with zsh_send
  • Proper handling of interactive prompts
  • Programs that require a TTY
  • Color output and terminal escape sequences
  • Full stdin/stdout/stderr merging

NEVERHANG Circuit Breaker

Prevents hanging commands from blocking sessions:

  • Tracks timeout patterns per command hash
  • Opens circuit after 3 timeouts in rolling 1-hour window
  • Auto-recovers after 5 minutes
  • States: CLOSED (normal) → OPEN (blocking) → HALF_OPEN (testing)

A.L.A.N. 2.0 (As Long As Necessary)

Intelligent short-term learning — "Maybe you're fuckin' up, maybe you're doing it right."

  • Retry Detection — warns when you're repeating failed commands
  • Streak Tracking — celebrates success streaks, warns on failure streaks
  • Fuzzy Matchinggit push origin feature-1git push origin *
  • Proactive Insights — contextual feedback before you run commands
  • Session Memory — 15-minute rolling window tracks recent activity
  • Temporal Decay — exponential decay (24h half-life), auto-prunes

Tools

ToolPurpose
zshExecute command with yield-based oversight
zsh_pollGet more output from running task
zsh_sendSend input to task's stdin
zsh_killKill a running task
zsh_tasksList all active tasks
zsh_healthOverall health status
zsh_alan_statsA.L.A.N. database statistics
zsh_alan_queryQuery pattern insights for a command
zsh_neverhang_statusCircuit breaker state
zsh_neverhang_resetReset circuit to CLOSED

Installation

As Claude Code Plugin

git clone https://github.com/ArkTechNWA/zsh-tool.git ~/.claude/plugins/zsh-tool
cd ~/.claude/plugins/zsh-tool
python3 -m venv .venv
.venv/bin/pip install mcp

Enable in ~/.claude/settings.json:

{
  "enabledPlugins": {
    "zsh-tool": true
  }
}

As Standalone MCP Server

claude mcp add-json --scope user zsh-tool '{
  "command": "/path/to/zsh-tool/.venv/bin/python",
  "args": ["/path/to/zsh-tool/src/server.py"],
  "env": {
    "ALAN_DB_PATH": "/path/to/zsh-tool/data/alan.db"
  }
}'

Architecture

zsh-tool/
├── .claude-plugin/
│   ├── plugin.json
│   └── CLAUDE.md
├── .mcp.json
├── src/
│   └── server.py      # MCP server
├── data/
│   └── alan.db        # A.L.A.N. SQLite database
├── .venv/             # Python virtual environment
└── README.md

Configuration

Environment variables (set in .mcp.json):

  • ALAN_DB_PATH - A.L.A.N. database location
  • NEVERHANG_TIMEOUT_DEFAULT - Default timeout (120s)
  • NEVERHANG_TIMEOUT_MAX - Maximum timeout (600s)

Disabling Bash (Optional)

To use zsh as the only shell, add to ~/.claude/settings.json:

{
  "permissions": {
    "deny": ["Bash"]
  }
}

Changelog

0.3.0

A.L.A.N. 2.0"Maybe you're fuckin' up, maybe you're doing it right."

  • Retry detection: warns when repeating failed commands
  • Streak tracking: celebrates success, warns on failure
  • Fuzzy template matching: similar commands grouped
  • Proactive insights: contextual feedback before execution
  • Session memory: 15-minute rolling window
  • New database tables: recent_commands, streaks

0.2.0

  • Yield-based execution with live oversight
  • PTY mode for full terminal emulation
  • Interactive input support via zsh_send
  • Task management: zsh_poll, zsh_kill, zsh_tasks
  • Fixed stdin blocking with subprocess.PIPE

0.1.0

  • Initial release
  • NEVERHANG circuit breaker
  • A.L.A.N. learning database

License

MIT License - see LICENSE for details.


For Johnny5. For us.
ArkTechNWA