
Zsh Tool
io.github.ArkTechNWA由 GitHub 帳號 ArkTechNWA 發布v0.2.1更新於 Oct 27, 2026
Zsh for Claude Code. PTY mode lets Claude type passwords. NEVERHANG + A.L.A.N.
概覽
為 Claude Code 提供 zsh 指令執行,支援讓出式控制、PTY 互動、防卡死斷路器與短期指令學習。
- 可以做什麼
- 以讓出式方式執行 zsh 指令,逾時後先回傳部分輸出而不阻塞
- 輪詢執行中的任務取得附行號的增量輸出,傳送標準輸入內容,終止任務並列出進行中的任務
- 檢視健康狀態與斷路器狀態,並重設斷路器
- 查詢 A.L.A.N. 學習資料庫的統計資料與特定指令的模式洞察
- 以 PTY 模式執行互動式程式,處理提示字元與需要終端機的工具
- 適用情境
- 適合在 zsh 環境工作、希望助理執行 shell 指令時避免 Bash 與 zsh 引號不一致,以及需要輪詢、輸入或安全終止長時間執行與互動式指令而不卡住工作階段的場合。
- 執行需求
- 以 stdio 在本機執行;README 要求安裝 Rust 工具鏈(cargo)與 zsh,另有可透過 uvx 執行的 PyPI 套件。選用環境變數可設定 A.L.A.N. 的 SQLite 資料庫路徑(ALAN_DB_PATH)以及逾時與 manopt 設定。未宣告驗證機制。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Zsh Tool,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
zsh-tool
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.7.2)
Author: Claude + Meldrey
License: MIT
Organization: ArkTechNWA
Built with obsessive attention to reliability.
Why?
The #1 reason: If you use zsh, Claude Code's Bash tool causes quotation mismatches and shell confusion. Every debug loop costs tokens. zsh-tool eliminates this instantly and permanently.
The token math: One avoided debug spiral = 30+ seconds saved, hundreds of tokens preserved.
zsh-tool is intelligent shell execution:
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 management —
zsh_killandzsh_tasks
PTY Mode
Full pseudo-terminal emulation for interactive programs:
- 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 Matching —
git push origin feature-1→git 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
- SSH Intelligence — separates host connectivity from remote command success
- Pipeline Segment Tracking — when
cat foo | grep -badopts | sortfails, A.L.A.N. knows which segment failed
Delta Output with Line Numbers (v0.6.3)
zsh_poll returns only new output since the last poll, prefixed with global line numbers. No more dumping 800 lines every poll call.
First poll returns all output from line 1. Subsequent polls continue where the last left off. Completed tasks return the final delta, then empty on re-poll.
Intelligent Polling
zsh_poll performs a 2-second listen window before returning. If output arrives within 2s, it comes back immediately. If not, poll metadata tells the agent what's happening:
Suggestions are advisory only — the agent always decides. A 2-minute pip install no longer generates 40 empty round-trips.
Kill-Aware A.L.A.N.
When the agent kills a command, A.L.A.N. records it as a KILLED outcome and classifies why:
Kill classification compares kill_elapsed / median_duration to distinguish impatience from genuine hangs.
manopt — Man Page Options on Failure
When a command fails repeatedly, A.L.A.N. surfaces its available options:
- 1st failure — normal feedback, no manopt
- 2nd failure — triggers async
manoptlookup in background (2s timeout) - 3rd+ failure — presents cached option table in A.L.A.N. insight
Parsed from local man pages. Cached in SQLite. On by default (ALAN_MANOPT_ENABLED=1).
SSH Tracking
A.L.A.N. treats SSH commands specially, recording two separate observations:
Exit code classification:
0— Success (connected AND command succeeded)255— Connection failed (SSH couldn't connect)1-254— Command failed (connected but remote command failed)
This means when ssh host3 'git pull' fails with exit 255, A.L.A.N. knows the host was unreachable—not that git pull is broken.
Tools
Installation
From Marketplace (Recommended)
Add the ArkTechNWA marketplace to Claude Code:
Then install: /plugin install arktechnwa/zsh-tool
That's it. The plugin auto-installs dependencies on first run.
Manual Installation
Enable in ~/.claude/settings.json:
The bundled scripts/run-mcp.sh builds the Rust binary on first run and launches the MCP server.
Local Development
For local development/testing, the wrapper script automatically detects when CLAUDE_PLUGIN_ROOT isn't expanded and uses the calculated plugin root directory instead. No configuration changes needed.
Alternatively, create a .mcp.local.json with absolute paths:
The ALAN_DB_PATH will be automatically set to {plugin_root}/data/alan.db if not explicitly provided.
Requirements: Rust toolchain (cargo) and zsh must be installed.
Architecture
Configuration
Environment variables (set in .mcp.json):
ALAN_DB_PATH— A.L.A.N. database locationNEVERHANG_TIMEOUT_DEFAULT— Default timeout (120s)NEVERHANG_TIMEOUT_MAX— Maximum timeout (600s)ALAN_MANOPT_ENABLED— Enable man-page option hints on failure (default:1)ALAN_MANOPT_TIMEOUT— Max seconds to wait for manopt parsing (default:2.0)ALAN_MANOPT_FAIL_TRIGGER— Fail count to trigger async lookup (default:2)ALAN_MANOPT_FAIL_PRESENT— Fail count to present cached options (default:3)
Disabling Bash (Optional)
To use zsh as the only shell, add to ~/.claude/settings.json:
Changelog
0.7.2
User-Visible Output — Tell the model to show its work
- Fix: MCP tool results are invisible to users in Claude Code (platform limitation). Tool descriptions now instruct the model to relay command output verbatim in its response text.
- This is a workaround for Claude Code not rendering MCP tool result blocks to users.
0.7.1
Stale Binary Fix — Actually deliver the new format
- Fix:
run-mcp.shnow runscargo clean -pbefore rebuild when source changes, preventing Cargo's incremental build from serving a stale binary - Fix: Rebuild trigger now also watches
Cargo.toml(version bumps were invisible to the oldfind -newercheck)
0.7.0
Rich Output Formatting — No more JSON dumps
- Structured output — command header, separator-divided sections, status footer with icons
- Visual status icons —
✔/✘replace[COMPLETED/[FAILEDbrackets - Progress consolidation — consecutive progress lines (e.g.,
10%,20%,30%) collapsed to show only the latest, preventing screen spam during downloads/builds - Command echo —
$ commandheader shows what ran, truncated at 120 chars - Colored exit codes — green=0, red=nonzero, yellow=signal (129+)
- Richer notifications — background task completions use
┌ notify:with failure coloring - ALAN insight icons —
⚠for warnings,ℹfor info - New
format.rsmodule — all formatting extracted from mod.rs into isolated, testable module - 35 new tests (121 total) covering all formatting functions
0.6.1
Protocol Fix — Bare JSON-RPC support for Claude Code v2.1+
- Fix: MCP server now auto-detects bare newline-delimited JSON (Claude Code v2.1.42+) vs Content-Length framing
- Debug logging: stderr diagnostics for protocol negotiation, request/response lifecycle, shutdown
- Log file:
run-mcp.shredirects stderr to/tmp/zsh-tool-mcp.logfor MCP debugging
0.6.0
Full Rust Rewrite — Goodbye Python, hello speed
- Complete rewrite in Rust — MCP server, executor, A.L.A.N., NEVERHANG, all native
- 79 Rust tests — unit tests + full MCP integration tests (JSON-RPC round-trip)
- CI pipeline rewritten —
cargo test+cargo clippyreplace pytest + ruff - Python removed — 7,600+ lines of Python deleted, zero Python dependencies
- ~2x faster CI — cold build 97s → cached 48s (vs Python's 60-120s)
- All features preserved: yield/poll/send/kill, PTY mode, A.L.A.N. 2.0, NEVERHANG, manopt, SSH tracking, pipeline segments
0.5.0
A.L.A.N. v2 Upgrade — Intelligent polling, kill awareness, manopt
- Intelligent polling: 2s listen window in
zsh_pollreduces empty round-trips; poll metadata with duration estimates and adaptive suggestions - Kill-aware A.L.A.N.:
KILLEDoutcome type with elapsed tracking; classifies early kills (impatience), late kills (genuine hangs), and pattern problems (wrong approach) - manopt integration: Async man-page option parsing on repeated command failures; cached in SQLite; presented on 3rd+ failure for the same command template
- New
outcome_typeandkill_elapsed_mscolumns on observations - New
manopt_cachetable for persistent man-page option storage - ENV vars:
ALAN_MANOPT_ENABLED,ALAN_MANOPT_TIMEOUT,ALAN_MANOPT_FAIL_TRIGGER,ALAN_MANOPT_FAIL_PRESENT
0.4.90
Feedback Improvements — Better signal, less noise
- ALAN insights now classified as info/warning tuples
- Command awareness: grep exit 1 = "no match" (info), exit 127 = "command not found" (warning)
- Post-execution insights: silent detection, pipe masking warnings, SIGPIPE exclusion
- ANSI coloring on metadata lines (green=success, red=failure, cyan=running, yellow=timeout)
- COMPLETED/FAILED status word based on exit code
- Raw pipestatus lists replace formatted
[cmd:code]strings - Grouped insight display:
[info: A.L.A.N.: ...]and[warning: A.L.A.N.: ...]
0.4.83
Python 3.14 Support — Future-proofing
- Added Python 3.14 classifier and badge
- Removed deprecated
asyncio.DefaultEventLoopPolicyfixture (slated for removal in 3.16) - All 331 tests pass on Python 3.14.2
0.4.81
Pipestatus Marker Leak Fix — Data integrity
- Fixed race condition where
___ZSH_PIPESTATUS_MARKER___could leak into output - Marker now stripped in
_build_task_response()before returning to caller - Prevents corrupted file content when output is captured mid-execution
- CI: Runner switched to docker executor, added PEP 668 compliance
0.4.80
Per-Segment Exit Codes — Know exactly which command failed
- Exit codes now show
[cmd1:0,cmd2:1,cmd3:0]format instead of single integer - Each pipeline segment paired with its actual exit status from zsh
$pipestatus - A.L.A.N. learning receives accurate per-command outcomes
- Self-documenting output for human and AI analysis
- Fixes bug where all commands reported
exit=0regardless of actual status
0.4.79
Server Modular Refactoring — Cleaner architecture
- Extracted MCP server into
zsh_tool/server.pymodule - Centralized configuration in
zsh_tool/config.py - Fixed plugin.json version sync with package version
0.4.75
Pipeline Intelligence — Know which segment of your pipeline is failing
- A.L.A.N. now captures zsh's
$pipestatusarray for every pipeline - Each segment recorded as independent observation with its own exit code
- When
cat foo | grep -badopts | sortfails, you know grep was the problem - Quote/escape-aware pipeline parsing handles complex commands correctly
- Backwards compatible: full pipeline still recorded alongside segments
- 248 new test lines covering segment tracking and edge cases
0.4.6
Configuration & Polish — User-configurable defaults, 91% coverage
- User config file (
~/.config/zsh-tool/config.yaml) for custom yield_after - Test coverage improved: 303 tests, 91% coverage
- Fixed null-check bug in task cleanup
- Logo files consolidated and fixed
0.4.5
Bundled Plugin — Zero-friction marketplace install
- Auto-install wrapper (
scripts/run-mcp.sh) creates venv on first run - Portable
.mcp.jsonusing${CLAUDE_PLUGIN_ROOT} - ArkTechNWA marketplace support
- No manual pip install required
0.4.0
Test Suite & CI — 290 tests, 89% coverage
- Comprehensive test suite covering all modules
- CI pipeline with test and lint stages
- Dynamic pipeline and coverage badges
- Gentle test runner (
run_tests.sh) with nice and sleep between files - Fixed deprecation warnings and lint errors
- Added pytest-asyncio for async test support
0.3.1
SSH Intelligence — Separate host connectivity from remote command success
- SSH commands now record dual observations (host + remote command)
- Exit code classification: 0=success, 255=connection_failed, 1-254=command_failed
- New
ssh_observationstable for SSH-specific tracking get_ssh_host_stats()— per-host connection/command success ratesget_ssh_command_stats()— per-command stats across all hosts- SSH-specific insights: flaky hosts, reliable hosts, failing commands
- 31 new tests for SSH tracking
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
來源:README.md,提交 e09ab62
工具
0版本歷史
1- v0.2.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分