Skip to main content

⚡ xdh (xdharness)

Autonomous Terminal Agent Harness & TUI
Cross-platform intelligence for Android Termux, Linux, macOS, and Windows

Release License: MIT Python: >=3.10 Platform

FeaturesInstallationQuick StartSlash CommandsDocumentation & WikiArchitectureContributing


🌟 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.1

🚀 Features

  • 🖥️ 3-Segment Layout: Real-time context header (tokens, RAM, latency, provider/model), scrollable history viewport with collapsible blocks, and dynamic multi-line composer.
  • 🔄 Multi-Provider Failover: Native streaming integration with OpenAI, OpenRouter, Anthropic, DeepSeek, Groq, Ollama, LM Studio, and more. Automatically fails over to backup providers on rate limits (429) or server errors (5xx).
  • 🛠️ Autonomous Agent Tools:
    • bash_run: Sandboxed execution with timeout and output capture.
    • read_file & write_file: Atomic file read/write with automatic backup generation.
    • edit_file: Smart fuzzy matching and targeted block replacement.
    • diff_files & /apply: Unified diff generator and staged hunk applicator.
    • web_search & web_fetch: DuckDuckGo query integration and readable text extraction.
    • bg_task: Background task runner with detached output streams.
    • tree_view: Directory visualizer with gitignore-awareness.
  • 🎨 7 Curated Color Palettes: tokyo_night, dracula, catppuccin, monokai, nord, cyberpunk, and gruvbox.
  • 📱 Mobile & Termux First: Smooth step-scroll animation for touch gestures, compact mini-banners for narrow viewports (<70 cols), and zero heavy C-extension dependencies.
  • 🧠 Context Optimization: Automatic message history compaction when nearing token capacity thresholds.

📦 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

  1. Launch xdh:

    xdh
    
  2. Configure Your Provider & Key: Type /settings inside the interface or edit ~/.xdharness/config.json. You can switch providers dynamically:

    xdh ❯ /provider openrouter
    xdh ❯ /model anthropic/claude-3.5-sonnet
    
  3. 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
/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.
  • 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+C: Interrupt running generation / exit.
  • Ctrl+Q: Save session and quit.

📚 Documentation & Wiki

Detailed guides and specifications are organized in docs/wiki/:


🏗️ 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

xdharness-1.0.1.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xdharness-1.0.1-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file xdharness-1.0.1.tar.gz.

File metadata

  • Download URL: xdharness-1.0.1.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xdharness-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ef81de51173f6e520346cb1c3a08e078a43d9cd103e18627b331f4b567aa798f
MD5 bf8e69d182c217ad68d087602454a59c
BLAKE2b-256 6edeb7ae6ce317b856bdc9579f8f3e766225be3cff1541a688e691d2ea9dcc16

See more details on using hashes here.

Provenance

The following attestation bundles were made for xdharness-1.0.1.tar.gz:

Publisher: publish.yml on PwnedBytes0x1/xdh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xdharness-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: xdharness-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xdharness-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b78601502a8690ab766858a5d1774a80be3366dd98d2263a92c2c66cf3d49982
MD5 55539a6828088966b813963e80682540
BLAKE2b-256 561ff933da729f55400de9873d7d2f139c1da0c3fecbeed0b9e7a5da2a7f7e70

See more details on using hashes here.

Provenance

The following attestation bundles were made for xdharness-1.0.1-py3-none-any.whl:

Publisher: publish.yml on PwnedBytes0x1/xdh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

This release

1.0.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page