⚡ xdh (xdharness)
Autonomous Terminal Agent Harness & TUI
Cross-platform intelligence for Android Termux, Linux, macOS, and Windows
Features • Installation • Quick Start • Slash Commands • Documentation & Wiki • Architecture • Contributing
🌟 Highlights
xdh is a lightweight, high-performance terminal agent harness and Text User Interface (TUI) built for autonomous code generation, system exploration, and agentic workflows. Designed with first-class support for Android Termux as well as standard desktop operating systems.
██╗ ██╗██████╗ ██╗ ██╗
╚██╗██╔╝██╔══██╗██║ ██║
╚███╔╝ ██║ ██║███████║
██╔██╗ ██║ ██║██╔══██║
██╔╝ ██╗██████╔╝██║ ██║ xdharness v1.0.9
🚀 Features
- 🖥️ 3-Segment Layout & Responsive Drawer: Real-time context header (tokens, RAM, latency, provider/model), scrollable history viewport with collapsible blocks, sidecar drawer panel (
F2/Ctrl+B), and dynamic multi-line composer. - 🔒 Fortified Security & AST Plugin Scanner: Pre-execution AST security validation for plugins blocking dangerous system calls, strict path traversal guards on session IDs, and zero-trust SSRF protection in
fetch_urlblocking private, link-local, and loopback IPs. - 🐚 Persistent Shell State: Working directory persists across autonomous
bashcommand executions (cdtransitions tracked inharness.current_cwd) and all file tool paths resolve against it. - 🛡️ Universal Mutation Safety Guards: Comprehensive protection against unauthorized destructive modifications to critical system paths (
/etc,/boot,/system,.git,.ssh,.env). - 🔍 Semantic BM25 / TF-IDF Search: Score-ranked semantic and keyword relevance search for
/index buildand/index query. - 🧠 True Context Compaction & Summarization: LLM-driven structured bullet summarization of pruned turns preserving goal progress, file states, and user intent.
- ⚡ Headless & Pipe Mode: Full CLI non-interactive operation (
xdh -p "prompt",--pipe,cat file | xdh -p "..." > out) without launching the full TUI. - 🛡️ Configurable Permission Modes:
--safe(strict confirmation on state changes),--auto(default guard against destructive commands), and--yolo(unconstrained speed). - 🔌 Model Context Protocol (MCP): Native stdio JSON-RPC 2.0 MCP client integration. Configure servers in
~/.xdharness/mcp.jsonor/mcp add, with automatic dynamic tool discovery. - 📑 AST Code Structure Outline: Fast structural inspections via AST / multi-language pattern parser (
code_outlineand/outline <file>). - 💾 Rollback Checkpoints: Instant snapshots of entire workspaces before refactors (
manage_checkpointand/checkpoint create|restore|list). - 🚫
.xdhignore&.gitignoreFilters: Full workspace scanning exclusion support across search, tree, and index tools. - ⏰ Autonomous Task Scheduling: Schedule recurring autonomous agent triggers via
/schedule <interval_sec> <task>. - 🎯 Reusable Skills System: Built-in
create_skill&call_skillengine. Define, discover, and run skills via/skill list,/skill run <name>, or autonomous agent calls. - 🤖 Multi-Agent Orchestration: Built-in
create_agent&spawn_agents. Launch multiple specialized subagents concurrently in parallel threads to solve tasks cooperatively. - 🔌 Dynamic Plugin Management: Add, install from git repositories, delete, and manage community or personal plugins via
/pluginwith automated AST safety verification. - ❓ Interactive User Question Prompting: Agents can invoke
ask_questionwith selectable options to clarify ambiguity during execution. - ⚡ Mid-Run User Guidance Interruption: Send a message or press
ESC/Ctrl+Cwhile an agent is executing to immediately pause, incorporate guidance, and pivot smoothly. - 🛡️ Fault-Tolerant Resilience: 5-stage connection retry backoff with automatic provider failover.
- ♾️ Unconstrained Autonomous Execution: Continuous multi-step reasoning without artificial iteration bounds.
- 🎨 Curated Color Palettes:
tokyo_night,dracula,catppuccin,monokai,nord,cyberpunk,gruvbox, andsolarized. - 📱 Mobile & Termux First: Smooth step-scroll animation for touch gestures, compact mini-banners for narrow viewports (<70 cols), and zero heavy C-extension dependencies.
📦 Installation
From Source (Git)
git clone https://github.com/PwnedBytes0x1/xdh.git
cd xdh
pip install -r requirements.txt
pip install -e .
Direct Execution
python3 -m xdh --version
Termux Quick Setup
pkg update && pkg install python git -y
git clone https://github.com/PwnedBytes0x1/xdh.git
cd xdh
pip install -r requirements.txt
ln -s $(pwd)/xdh.py $PREFIX/bin/xdh
chmod +x $PREFIX/bin/xdh
xdh
⚡ Quick Start
-
Launch
xdh:xdh
-
Configure Your Provider & Key: Type
/settingsinside the interface or edit~/.xdharness/config.json. You can switch providers dynamically:xdh ❯ /provider openrouter xdh ❯ /model anthropic/claude-3.5-sonnet
-
Interact: Type plain language prompts to instruct the agent to inspect files, execute tests, refactor code, or run background builds.
⌨️ Slash Commands
| Command | Description | Example |
|---|---|---|
/settings |
Open interactive settings & quick toggles | /settings theme dracula |
/provider |
Switch active provider | /provider openai |
/model |
Switch model for active provider | /model gpt-4o |
/theme |
Switch color theme palette | /theme catppuccin |
/tools |
Enable or disable agent function tools | /tools on or /tools off |
/thinking |
Toggle live thought/reasoning token streaming | /thinking on |
/diff |
Inspect staged file diffs proposed by agent | /diff |
/apply |
Apply pending unified diffs to files | /apply |
/checkpoint |
Manage rollback snapshots | /checkpoint create pre_refactor |
/mcp |
Manage Model Context Protocol servers | /mcp list or /mcp add <name> <cmd> |
/permission |
Configure safety/permission mode | /permission safe or /permission yolo |
/outline |
Show AST/regex code structure outline | /outline xdh.py |
/schedule |
Autonomous interval task execution | /schedule 60 "check git status" |
/drawer |
Toggle sidecar status drawer pane | /drawer |
/tasks |
List, inspect, or kill background tasks | /tasks list / /tasks logs <id> |
/git |
Execute git status, diff, or commit directly | /git status |
/scratch |
Access or update persistent scratchpad memo | /scratch set <notes> |
/tree |
Print directory tree of current workspace | /tree |
/index |
Build or query workspace keyword index | /index build |
/copy |
Copy last response or code block to clipboard | /copy |
/undo |
Roll back latest file edit from backups | /undo |
/clear |
Clear viewport history (or Ctrl+L) |
/clear |
/help |
Show command reference table | /help |
/exit |
Save session state and exit (or Ctrl+Q) |
/exit |
⌨️ Keybindings
Tab: Auto-complete slash command / accept ghost suggestion.Right Arrow: Accept ghost suggestion at line end.Up / Down: Navigate history or smooth-scroll conversation viewport.F2/Ctrl+B: Toggle sidecar drawer pane (swarm stats, MCPs, checkpoints, tasks).ESC/Ctrl+C: Interrupt running generation / halt active task.Ctrl+T: Cycle color themes dynamically.Ctrl+P: Cycle configured AI providers.Ctrl+O: Toggle block collapse (compact vs expanded summary).Ctrl+L: Clear current viewport.Ctrl+J: Insert newline in composer without submitting.Ctrl+Q: Save session and quit.
📚 Documentation & Wiki
Detailed guides and specifications are organized in docs/wiki/:
- 🏠 Home & Overview: Product overview and architecture.
- 🚀 Getting Started & Installation: Step-by-step setup across Termux, Linux, macOS, and Windows.
- ⚙️ Configuration & Providers: API keys, model parameters, custom endpoints, and auto-failover.
- 🛠️ Tools & Workflows: Deep dive into diff generation, sandbox execution, web search, and tasks.
- 🎨 Theming & UI Customization: Theme reference and customizing styles.
- 🔌 Extensibility & Architecture: Harness internals, compaction, streaming protocols, and lifecycle.
🏗️ Architecture
flowchart TD
User([User Terminal / Touch]) --> UI[XDHApp TUI Container]
UI --> Layout[3-Segment Layout: Header, Viewport, Composer]
UI --> Engine[XDHarness Core Engine]
Engine --> ProviderRouter[Provider Router & Failover]
ProviderRouter --> LLM[Streaming API / Ollama / OpenAI / OpenRouter]
Engine --> ToolManager[Autonomous Tool Execution Engine]
ToolManager --> Filesystem[(Filesystem & Atomic Backups)]
ToolManager --> Shell[Subprocess Shell & BG Tasks]
ToolManager --> Web[DuckDuckGo / Web Fetcher]
🤝 Contributing & Community
Contributions are welcome! Please review our community guidelines before getting started:
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xdharness-1.0.9.tar.gz.
File metadata
- Download URL: xdharness-1.0.9.tar.gz
- Upload date:
- Size: 66.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea13857494426feb4e38949485e95bef14b07f74df74b54c5a05cb13b5789e20
|
|
| MD5 |
671a11529d63a66eeeb8891cb9577ebd
|
|
| BLAKE2b-256 |
cb74462367a224ca40ac910d88a340fcb2e9214c020194c713b63740d02ff21b
|
Provenance
The following attestation bundles were made for xdharness-1.0.9.tar.gz:
Publisher:
publish.yml on PwnedBytes0x1/xdh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xdharness-1.0.9.tar.gz -
Subject digest:
ea13857494426feb4e38949485e95bef14b07f74df74b54c5a05cb13b5789e20 - Sigstore transparency entry: 2758632614
- Sigstore integration time:
-
Permalink:
PwnedBytes0x1/xdh@e223c1f7704cc9be49c0b1d15a25c541d7b9fa1a -
Branch / Tag:
refs/tags/v1.0.9 - Owner: https://github.com/PwnedBytes0x1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e223c1f7704cc9be49c0b1d15a25c541d7b9fa1a -
Trigger Event:
release
-
Statement type:
File details
Details for the file xdharness-1.0.9-py3-none-any.whl.
File metadata
- Download URL: xdharness-1.0.9-py3-none-any.whl
- Upload date:
- Size: 62.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f92ea57cf620922305d3b642818ab346aef07f0650a51fa08bb24c380f2812b7
|
|
| MD5 |
c75e697a2d6bdd1b9da401062ea25c9f
|
|
| BLAKE2b-256 |
29bd8463080f8673c5870a27bcec4f0784cdff94365a76f99ee6c6cfd825e43a
|
Provenance
The following attestation bundles were made for xdharness-1.0.9-py3-none-any.whl:
Publisher:
publish.yml on PwnedBytes0x1/xdh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xdharness-1.0.9-py3-none-any.whl -
Subject digest:
f92ea57cf620922305d3b642818ab346aef07f0650a51fa08bb24c380f2812b7 - Sigstore transparency entry: 2758632656
- Sigstore integration time:
-
Permalink:
PwnedBytes0x1/xdh@e223c1f7704cc9be49c0b1d15a25c541d7b9fa1a -
Branch / Tag:
refs/tags/v1.0.9 - Owner: https://github.com/PwnedBytes0x1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e223c1f7704cc9be49c0b1d15a25c541d7b9fa1a -
Trigger Event:
release
-
Statement type: