SystemHarness.Windows 0.29.1

dotnet add package SystemHarness.Windows --version 0.29.1
                    
NuGet\Install-Package SystemHarness.Windows -Version 0.29.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SystemHarness.Windows" Version="0.29.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SystemHarness.Windows" Version="0.29.1" />
                    
Directory.Packages.props
<PackageReference Include="SystemHarness.Windows" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SystemHarness.Windows --version 0.29.1
                    
#r "nuget: SystemHarness.Windows, 0.29.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SystemHarness.Windows@0.29.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SystemHarness.Windows&version=0.29.1
                    
Install as a Cake Addin
#tool nuget:?package=SystemHarness.Windows&version=0.29.1
                    
Install as a Cake Tool

system-harness

NuGet CI License: MIT

A computer-use primitives library for .NET — eyes, hands, and shell in one harness.

system-harness provides a unified interface for programmatic and interactive computer control. It wraps shell execution, process management, filesystem operations, screen capture, OCR, input simulation, UI automation, and document processing into a single coherent API.

No AI inside. No opinions about your agent framework. Just the primitives you need to use a computer — whether you're a bot or a human writing automation scripts.

Why

AI agents need to operate computers. The "brain" (LLM) decides what to do. But it still needs:

  • Shell — run cmd, powershell, bash commands and get results
  • Process — launch, kill, and list running programs
  • FileSystem — read, write, move, delete files and directories
  • Screen — capture what's on screen (for vision-capable models or logging)
  • Mouse / Keyboard — click, type, drag when there's no API and GUI is the only way
  • OCR — read text from screen regions without requiring vision models
  • UI Automation — interact with UI elements by accessibility tree, not pixel coordinates
  • Office Documents — read and write Word, Excel, PowerPoint, HWP without Office installed

Today, you stitch together 5+ libraries to get all of this. system-harness is one library, one interface, three layers:

Layer 1: Programmatic Control (fast, precise, preferred)
  Shell, Process, FileSystem, Window, Clipboard, Display, SystemInfo

Layer 2: Vision + Action (when GUI is the only way)
  Screen, Mouse, Keyboard, OCR, UIAutomation, TemplateMatcher, DialogHandler

Layer 3: App Automation (document processing)
  Office (Word, Excel, PowerPoint, HWP) — no installation required

Use Layer 1 whenever possible. Fall back to Layer 2 when you must.

Quick Start

dotnet add package SystemHarness.Core
dotnet add package SystemHarness.Windows  # Windows implementation
using SystemHarness;
using SystemHarness.Windows;

using var harness = new WindowsHarness();

// Layer 1 — Programmatic
var result = await harness.Shell.RunAsync("cmd", "/C echo Hello!");
Console.WriteLine(result.StdOut);   // "Hello!\r\n"

await harness.FileSystem.WriteAsync("hello.txt", "world");
var content = await harness.FileSystem.ReadAsync("hello.txt");

await harness.Process.StartAsync("notepad.exe");
await harness.Window.FocusAsync("Notepad");

// Layer 2 — Vision + Action
var screenshot = await harness.Screen.CaptureAsync();
// screenshot.Base64, screenshot.Width, screenshot.Height, screenshot.MimeType

await harness.Mouse.ClickAsync(350, 200);
await harness.Keyboard.TypeAsync("Hello World");
await harness.Keyboard.HotkeyAsync(default, Key.Ctrl, Key.S);

// OCR — read text from screen
var ocrResult = await harness.Ocr.RecognizeScreenAsync();
Console.WriteLine(ocrResult.Text);

// UI Automation — interact with elements by name
var tree = await harness.UIAutomation.GetTreeAsync("Notepad");
await harness.UIAutomation.TypeIntoAsync("Notepad", "Edit", "Hello from automation");

NuGet Packages

Package Description
SystemHarness.Core Interfaces + models (zero platform dependencies)
SystemHarness.Windows Windows implementation (Win32, DXGI, SendInput, FlaUI)
SystemHarness.Apps.Office Office/HWP document processing (OpenXML, OWPML)
SystemHarness.Apps.Email Email automation (IMAP/SMTP via MailKit)
SystemHarness.Apps.Browser Browser automation (Playwright)

MCP Server (AI Tool Integration)

system-harness includes a built-in Model Context Protocol server with 172 commands across 25 categories, accessed through 3 MCP tools using a command dispatch pattern.

Installation

Download the latest release from GitHub Releases and extract it to a directory of your choice.

Configuration

Claude Desktop / Claude Code (claude_desktop_config.json or .mcp.json):

{
  "mcpServers": {
    "system-harness": {
      "command": "C:/path/to/SystemHarness.Mcp.exe"
    }
  }
}

Operator settings — pass as arguments ("args": ["--rate-limit=5"]). The agent can tighten them but not loosen them:

Argument Default Effect
--command-policy=default\|none default default blocks destructive programs (format, shutdown, diskpart, rm -rf, del /s, ...) in shell commands and process starts
--rate-limit=N off At most N actions per second; the agent can lower it but not raise or disable it
--safe-zone=<window> off Input actions only reach this window (title substring or handle); the agent cannot change it
--stop-hotkey=false on Ctrl+Shift+Escape stops the session (running commands are cancelled, every later action is refused) until the server restarts
--auto-update=true off Check GitHub Releases daily, stage updates, and allow update.check/update.apply

From source (development):

{
  "mcpServers": {
    "system-harness": {
      "command": "dotnet",
      "args": ["run", "--project", "src/SystemHarness.Mcp"]
    }
  }
}

3 MCP Tools

Instead of 172 individual tool definitions (which consume ~12,000 tokens per API call), commands are accessed through 3 dispatch tools:

Tool Purpose Example
help(topic?) Discover commands help(), help("mouse"), help("mouse.click")
do(command, params?) Execute mutations do("mouse.click", '{"x":100,"y":200}')
get(command, params?) Execute queries get("window.list")

Command Categories

Category Commands Examples
shell 1 shell.execute
process 14 process.start, process.list, process.find_by_port
file 13 file.read, file.write, file.read_bytes, file.hash
window 19 window.list, window.focus, window.wait, window.set_opacity
app / dialog 7 app.open, app.close, dialog.check, dialog.click
screen 5 screen.capture, screen.capture_region, screen.capture_monitor
mouse 11 mouse.click, mouse.drag, mouse.smooth_move
keyboard 8 keyboard.type, keyboard.press, keyboard.hotkey
ocr 4 ocr.read, ocr.read_region, ocr.read_detailed
vision 10 vision.click_text, vision.wait_text, vision.find_image
ui 15 ui.get_tree, ui.find, ui.click, ui.select, ui.annotate
clipboard 9 clipboard.get_text, clipboard.set_text, clipboard.set_html
display 5 display.list, display.get_primary, display.get_at_point
coord 4 coord.to_absolute, coord.to_relative, coord.scale_info
desktop 4 desktop.count, desktop.current, desktop.switch
system 4 system.get_info, system.get_env, system.set_env
office 10 office.read_word, office.write_excel, office.read_hwpx
safety 10 safety.emergency_stop, safety.set_zone, safety.confirm_before
monitor 4 monitor.start, monitor.stop, monitor.read, monitor.list
report 3 report.get_desktop, report.get_screen, report.get_window
session 5 session.save, session.compare, session.bookmark
observe 1 observe.window (hybrid screenshot + accessibility + OCR)
record 4 record.start, record.stop, record.get_actions, record.replay
update 2 update.check, update.apply (GitHub Releases; only with --auto-update=true)

Compound Facades (reduce multiple tool calls to one)

Command What it does Calls saved
vision.click_text OCR + find text + click center 3 → 1
vision.click_and_verify Screenshot + click + screenshot + compare 4 → 1
app.open Start process + wait for window 2 → 1
app.close Close window + handle dialog + wait for exit 3 → 1
report.get_screen Screenshot + OCR + UI elements 3 → 1
observe.window Screenshot + accessibility tree + OCR 3 → 1
ui.select_menu Navigate menu path like "File > Save As" N → 1

Office Documents

Read and write Microsoft Office and Korean HWP documents without Office installed — uses OpenXML and OWPML directly.

using SystemHarness.Apps.Office;

// Register in DI
services.AddOfficeReaders();

// Read documents to markdown
var wordContent = await documentReader.ReadWordAsync("report.docx");
var excelContent = await documentReader.ReadExcelAsync("data.xlsx");
var pptxContent = await documentReader.ReadPowerPointAsync("slides.pptx");
var hwpContent = await hwpReader.ReadHwpxAsync("document.hwpx");

// Write documents from structured content
await documentReader.WriteWordAsync("output.docx", documentContent);
await documentReader.WriteExcelAsync("output.xlsx", spreadsheetContent);

// Find and replace
await documentReader.FindReplaceWordAsync("template.docx", new() { { "{{name}}", "John" } });

Safety Features

using var harness = new WindowsHarness(new HarnessOptions
{
    // Block dangerous commands (format, shutdown, rm -rf, etc.)
    CommandPolicy = CommandPolicy.CreateDefault(),

    // Record all actions for auditing
    AuditLog = new InMemoryAuditLog(),
});

// This throws CommandPolicyException:
await harness.Shell.RunAsync("format", "C: /FS:NTFS");

Emergency Stop

var stop = new EmergencyStop();
// Pass stop.Token to any CancellationToken parameter
// Call stop.Trigger() to cancel all operations at once

MCP Server Safety

Every MCP command passes one gate before it runs. A refused command is not run, and the refusal is recorded in the action history:

  • Emergency stop — safety.emergency_stop or the operator hotkey (Ctrl+Shift+Escape) cancels running commands and refuses every later action (emergency_stopped). The agent can resume its own stop with safety.resume; a hotkey stop holds until the server restarts.
  • Command policy — blocked programs in shell commands and process starts are refused (policy_blocked), including programs chained inside the command part of a shell host (cmd /c, pwsh -Command / -EncodedCommand, bash -c). The arguments a host passes to a script (pwsh -File run.ps1 format, bash run.sh shutdown) are the script's data and are not read as commands; blocked patterns still apply to the whole line.
  • Rate limiting — actions over the limit are refused (rate_limited).
  • Safe zones — with a zone set, input actions (mouse, keyboard, UI automation, vision clicks, dialogs, window changes) must target the zone window: coordinates inside it (or inside its region), window arguments naming it, keyboard input only while it is in the foreground (outside_safe_zone). A zone window that cannot be found refuses the action; commands whose target is only known after they run (vision.click_text, record.replay) are refused while a zone is set.
  • Confirmation — safety.confirm_before writes a JSON request the user approves or denies by editing its status; the agent polls with safety.check_confirmation and has no command to answer its own request.
  • Action history — full audit trail of tool invocations, including refusals
  • Server files — screenshots, clipboard images and confirmation requests are written to a private per-process directory (%TEMP%\system-harness\<pid>) that is deleted when the server stops; file commands cannot write, move or delete anything inside it (protected_path)

Monitoring

Background monitors track system changes in real-time, writing events to JSONL files:

Monitor Type Watches
file File/directory create, modify, delete, rename
process Process start and exit events
window Window create, close, focus change, title change
clipboard Clipboard content changes
screen Visual changes with periodic snapshots
dialog Dialog/popup window appearances

Dependency Injection

services.AddSystemHarness(); // default options
// or
services.AddSystemHarness(new HarnessOptions
{
    CommandPolicy = CommandPolicy.CreateDefault(),
});

// Inject IHarness or individual services:
public class MyService(IShell shell, IScreen screen, IOcr ocr) { }

Platform Factory

// Auto-detect platform at runtime
using var harness = HarnessFactory.Create();

Windows only. SystemHarness.Windows is the one platform implementation; there is no Linux or macOS implementation and none is planned. On another OS HarnessFactory.Create() throws PlatformNotSupportedException saying so. The platform-independent packages (SystemHarness.Core models, SystemHarness.Apps.*) still work there.

Architecture

SystemHarness.Core              Interfaces + models (zero platform dependencies)
  |
  +-- SystemHarness.Windows     Win32/DXGI/SendInput/FlaUI (Windows implementation)
  |
  +-- SystemHarness.Apps.Office OpenXML/OWPML document processing
  +-- SystemHarness.Apps.Email  IMAP/SMTP via MailKit
  +-- SystemHarness.Apps.Browser Playwright-based web automation
  |
  +-- SystemHarness.Mcp         MCP server (3 tools, 172 commands)

IHarness Services (15 interfaces)

Service Layer Purpose
IShell 1 Execute shell commands
IProcessManager 1 Start, stop, list processes
IFileSystem 1 Read, write, list, delete files
IWindow 1 Focus, resize, move, close windows
IClipboard 1 Text, HTML, image, file drop clipboard
IDisplay 1 Monitor enumeration, DPI, bounds
ISystemInfo 1 Environment variables, OS info
IVirtualDesktop 1 Virtual desktop management
IScreen 2 Full-screen and region capture
IMouse 2 Click, drag, scroll, move
IKeyboard 2 Type, press, hotkey, key state
IOcr 2 Screen and image text recognition
ITemplateMatcher 2 Find template images on screen
IUIAutomation 2 Accessibility tree navigation
IDialogHandler 2 System dialog interaction

Windows Implementation Details

Capability Technology
Shell cmd.exe / powershell via Process.Start
Process System.Diagnostics.Process + Toolhelp32 for child processes
Screen DXGI Desktop Duplication (GPU) with GDI BitBlt fallback
Mouse/KB Win32 SendInput with Unicode surrogate pair support
Window EnumWindows, SetForegroundWindow, MoveWindow, SetLayeredWindowAttributes
Clipboard Win32 Clipboard API — text, image, HTML (CF_HTML), file drop (CF_HDROP)
Display EnumDisplayMonitors, GetDpiForMonitor, per-monitor capture
OCR Windows.Media.Ocr (built-in Windows OCR engine)
UI Automation FlaUI / UIA3
Template Matching Normalized Cross-Correlation (NCC) via SkiaSharp
DPI Per-Monitor DPI V2 awareness, virtual desktop coordinates
Cursor GDI cursor overlay with hotspot-adjusted DrawIconEx

Design Principles

  • Zero AI dependency — no LLM SDKs, no model opinions, no agent loops
  • AI-ready — Screenshot returns Base64 for vision APIs; ShellResult is structured
  • Layer 1 first — programmatic control is always preferred; vision+action is the fallback
  • One interface, multiple backends — same IHarness across all platforms
  • Async-first — every operation is Task-based
  • No magic — thin wrappers over OS primitives, not a framework
  • Safety built-in — command policy, audit logging, emergency stop, safe zones

Roadmap

  • Core interfaces and models (15 services)
  • Windows Layer 1: Shell, Process, FileSystem, Window, Clipboard, Display, SystemInfo
  • Windows Layer 2: Screen (DXGI+GDI), Mouse, Keyboard, OCR, UIAutomation
  • Template matching (NCC-based image search)
  • Compound facades: vision_click_text, app_open/close, report_get_screen
  • Smart waiting: vision_wait_text, ui_wait_element, window_wait, vision_wait_change
  • Action verification: vision_click_and_verify, vision_type_and_verify
  • Background monitors: file, process, window, clipboard, screen, dialog
  • Safety: EmergencyStop, safe zones, rate limiting, confirmation gates
  • Session management: save, compare, bookmark
  • MCP server with 172 commands (3-tool dispatch architecture)
  • Office document processing (Word, Excel, PowerPoint, HWP)
  • DPI-aware coordinates, Unicode support, cursor overlay
  • NuGet packaging with SourceLink

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.29.1 0 10/7/2026
0.29.0 0 10/7/2026
0.28.10 57 10/5/2026
0.28.9 64 10/4/2026
0.28.8 50 10/4/2026
0.28.7 242 9/20/2026
0.28.6 149 9/10/2026
0.28.5 141 8/28/2026
0.28.4 194 5/25/2026
0.28.3 150 5/15/2026
0.28.2 259 2/25/2026
0.28.1 141 2/19/2026
0.28.0 139 2/13/2026