rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
lemonmmice/dsh-agent-toolchain
Evidence tools for coding agents on Windows desktop (WPF) apps: 64 DSH/MCP tools (25 read-only) to build, drive the UI, capture API traffic and diagnose perf/hangs in a live client, plus an optional Harness² improvement loop.
PROJECT TOPICS
PROJECT README
The engineering runtime that makes coding agents verifiably accountable for their own changes.
A suite of plugins and an MCP server that let a coding agent do more than write code — it can see the running desktop application, drive it, measure it, and capture what it sends over the network, to check the change it just made. Each plugin is a small, composable building block; together they close the loop between "the agent wrote a change" and "the change actually works" — and produce the evidence to prove it.

One command runs the whole loop against a throwaway WPF window that ships in this repo — build it, launch it, drive it, and read the result back out:
npm run demo # build → launch → drive → read
npm run demo:perf # + catch a deliberately blocked UI thread
Real output (npm run demo, paths shortened):
1. environment self-check
ok toolchain_status reports what is configured (toolchain_status, 542 ms)
2. build the sample app (and bind the result to a runId)
ok build_run → 0 errors (build_run, 3353 ms)
3. launch and look at the real window
ok ui_launch brings the window up (ui_launch, 11929 ms)
ok ui_observe(state) sees the controls (ui_observe, 62 ms)
4. drive it — this is the part a code-reading agent cannot do
ok type into the Input box (ui_drive, 458 ms)
ok click Greet (ui_drive, 314 ms)
ok read the result back out of the UI (ui_observe, 79 ms)
ok capture a screenshot as evidence (ui_observe, 35 ms)
steps: 8/8 ok
npm run demo:perf additionally reports stutterCount=1, maxMs=1474 — the sample app blocks its UI thread for exactly 1500 ms on purpose, and the perf probe has to catch it.
The demo is not demo-only code.
mcp/demo/run-demo.mjsis an ordinary MCP client: it spawnsmcp/server.mjsover stdio and calls the same tools Claude Code, Cursor, Cline or Codex would call. If it passes, the MCP face works.
Recording a GIF:
npm run demo:perfwhile a screen recorder is running is the intended capture — the window does something visible at every step.docs/media/is where the recording goes.
Coding agents are excellent at producing patches, but they are blind to what happens after the patch: Did the build break? Did the UI actually render the new page? Which API calls did the application fire, and did one of them hang for 20 seconds? Did the change introduce a memory leak or a UI stall?
Traditional agents verify by reading code. This toolchain lets them verify by observing the running application — the same way a human QA engineer would — and then makes them show the evidence.
change code → build (dsh-build) → drive client (dsh-ui-drive)
→ capture APIs (dsh-api-visualizer, dsh-postman)
→ inspect perf (dsh-perf) / hang (dsh-hang-inspector)
→ remember lessons (dsh-memory)
failures record themselves → failure corpus (the data flywheel, internal)
a lesson worth keeping → harness_trial (Harness²) → validated project skill (optional)
Exactly the tools npm run demo exercises — build_run, the ui_* family, perf_probe, http_request — need neither Rust nor MSVC. Verified on a checkout whose plugins/*/bin/ directories are empty.
net10.0-windows).npm install --prefix mcp — the MCP server is the only thing with a dependency.npm run demo.Nothing is written into the repo tree: a demo run keeps its screenshots, build log and any failure records under .dsh-agent-toolchain/demo/ (gitignored).
An optional standalone Rust MCP runtime is available through npm run build:runtime.
It runs HTTP, background tasks and evidence publication without Node, and can
retain the complete tool catalog through a lazy Node compatibility bridge.
See Rust runtime scope, deployment and validation.
The API-capture store, the memory index, flame folding and the terminal inspector load Rust Node-API modules. Build the ones you need (Rust + Visual C++ build tools), or take a deployment that already ships them:
npm run build:capture-store # dsh-api-visualizer (+ shared by dsh-verify)
npm run build:memory-store # dsh-memory
npm run build:trace-fold # dsh-perf flame folding
npm run build:terminal-inspector # dsh-win-terminal-inspector
Then pwsh -File install.ps1 (dry run) or pwsh -File install.ps1 -Apply to copy the plugins into your DSH profile, register them in cordis.patch.yml, and restart the host.
.csproj projects do not include new .cs files automatically, so a build can report success while your file was never compiled. build_compile_check answers that question specifically, with three states — in the compilation set, provably not, or cannot be read (never silently "not").ui_observe / ui_drive / ui_flow find controls by name or AutomationId, click, type, wait for conditions, read values back, and capture window-scoped screenshots. Read-only actions never need permission; anything that clicks or types must pass allowSideEffects=true, and an optional snapshot-freshness gate rejects actions aimed at a stale UI.ui_jev sends a sanitized UIA control list to Jev, lets it choose one bounded candidate action, then reuses the same deterministic UI executor and safety gates. Jev never receives pixels, generates arbitrary input, or bypasses authorization; see docs/jev-ui.md.The single source of truth is lib/tool-registry.mjs; both faces (DSH plugins and MCP) are generated from it, so they cannot drift apart. Every tool, one line each, sorted by what you are trying to do → docs/tools.md.
| Plugin | What it does for the agent |
|---|---|
| dsh-build | Run MSBuild / dotnet build as a tool: incremental build, structured error list (file/line/col/code), error re-parse, compile-membership check. Build defaults auto-resolve by repo layout (legacy client layouts keep their defaults byte-for-byte; stock repos get .sln/.slnx + platform auto-detection). Also hosts the optional dev_* tools: C# language-server queries, local log search, .NET skills, encoding-preserving file read/edit, public docs lookup and PNG diff. |
| dsh-ui-drive | Drive a running Windows desktop client via UIA: find/click/type/read/screenshot, visual-tree dumps, multi-step flows with assertions and replay. Screenshots come back as files for the calling model to read; a vision model is used only by the opt-in click fallback. |
| dsh-verify | Toolchain-status and Harness² surface: toolchain_status / toolchain_job environment self-check and job control, plus harness_trial / harness_experience. (Name kept for id stability; it no longer does verification.) |
| dsh-api-visualizer | Capture the client's HTTP traffic: live panel, JSONL store, caller attribution, auto-responder rules, baseline/contract regression, optional Fiddler-style local proxy. |
| dsh-postman | Postman-style HTTP client inside the harness: compose/send requests from the host (no browser CORS), history store, collections with folders, environments, assertions and variable extraction, a collection runner, WebSocket client, http_request / http_collection agent tools. |
| dsh-perf | UI stutter measurement (window-message latency, P50/P95/P99, stutter events), full-dump capture + ClrMD analysis, managed-heap stats, GC-root retention paths, ETW trace / hotstacks / flame and allocation folding, UI-freeze (wall-clock) analysis, offline CPU-sample breakdown by thread, time window and method group. |
| dsh-hang-inspector | Hang diagnosis: monitor main-window responsiveness, auto-collect evidence packs (frozen screenshot, timeline, process info, net-trace tail, dump), analyze the managed thread stack and map the hang to project source. |
| dsh-memory | Long-term memory for the harness: semantic search over indexed workspace docs, cross-session key-value conventions, mtime-incremental indexing, stale-chunk eviction, token/secret filter on save. |
| dsh-win-terminal-inspector | Windows terminal (ConPTY) inspection for persistent shells. |
| dsh-jev | Optional TypeSafe Jev decision layer: batched typed routing/evidence judgments with explicit remote-data opt-in; advisory only, never executes a selected action. |
Highlights
lib/ code.click/setvalue/key require an explicit allowSideEffects=true; read-only operations are always safe. An operational kill switch and an optional deny-first policy sit above every action, and recovery is deliberately not an agent tool.ui_flow assertion failures, and ui_drive/http failures all append automatically under a fixed 7-class taxonomy. The corpus is an internal store (no agent-callable tool); the runtime writes it and the Harness² feature reads it. See docs/failure-corpus.md.claude mcp add --scope user dsh-agent-toolchain -- cmd /c node <repo>\mcp\server.mjs
Cursor, Cline and other stdio clients take the same command. Configuration details, progress notifications, output budgets and the honest platform matrix live in mcp/README.md.
The repository root is also a plugin (.claude-plugin/plugin.json, listed by .claude-plugin/marketplace.json). One install brings three things together:
mcp/launch.mjs, which installs the MCP SDK on first start if node_modules is missing and reads this machine's settings from ~/.dsh-agent-toolchain/env.json (DSH_ENV_FILE to move it, none to disable; only DSH_* string values, never DSH_CRED_*). Like the env block of a claude mcp add -e … registration, the file overrides inherited environment variables of the same name;skills/ — UI self-check, API capture, perf triage, hang triage, build/compile-set check — loaded on demand instead of 64 tool descriptions doing all the teaching;hooks/hooks.json):PostToolUse — writing a .cs/.vb/.fs file that a legacy project provably does not compile gets an immediate warning (same judgement as build_compile_check; undecidable cases stay silent).SessionStart — in a .NET repo, a few lines on what is connected and which process the UI/perf tools will act on, with a warning when that target's source root is not the repo you are in.claude plugin marketplace add lemonmmice/dsh-agent-toolchain
claude plugin install dsh-agent-toolchain@dsh-agent-toolchain
For local development, load the checkout in place instead of a cached copy (Claude Code auto-loads plugins under ~/.claude/skills/<name>/), so edits take effect in the next session — Windows: mklink /J %USERPROFILE%\.claude\skills\dsh-agent-toolchain <repo>. Plugin-provided tools are namespaced, e.g. mcp__plugin_dsh-agent-toolchain_dsh__build_run; remove a separate claude mcp add registration of the same server to avoid two copies of every tool.
Codex reads .claude-plugin/plugin.json and .claude-plugin/marketplace.json as alternate manifest locations (upstream codex-rs/core-plugins), so the same layout is meant to load there too — not yet verified end to end.
Each plugin is a drop-in host plugin. Copy the plugin directory into your DSH profile's plugins/ (or node_modules/@dsh-agent-toolchain/ for the panels) and register it in cordis.patch.yml:
- insert:
- id: ui-drive
name: './plugins/dsh-ui-drive/index.js'
scripts/deploy-plugins.mjs (wrapped by install.ps1) is the supported way to do that copy; --check reports drift without writing.
Shared lib/: every plugin imports modules from the repo-root lib/ (all of them tool-registry.mjs; dsh-verify also loads the Harness² core from lib/harness/). Their relative imports resolve against the profile root, so the profile needs a copy of the monorepo lib/ tree. scripts/deploy-plugins.mjs copies the whole tree and reports its drift separately from the plugins:
<profile>/
plugins/dsh-build/... # each plugin dir copied as-is
lib/ # the repo's lib/ tree, copied as a whole
tool-registry.mjs
harness/...
verify/...
Missing shared modules make the plugin crash at load (static imports); the failure-corpus/verify dynamic imports degrade to no-ops instead.
Then restart the host, and ask the agent for toolchain_status — it reports what is configured, from which source (process env / user registry / unset), and what cannot be checked.
The evidence spine (verify / failure corpus / capture / memory / http), the dotnet build engine and build-target resolution are cross-platform. UI-driving, the VS-MSBuild engine and the perf/hang probes are Windows-only, and on macOS/Linux they report unconfigured rather than pretending. The per-tool matrix is in mcp/README.md; the compatibility matrix (harness × plugin × MCP versions) is in docs/compatibility.md.
This repository is meant to be a working example of its own argument, so the process is part of the artifact rather than a footnote:
Codex r30, Codex r37, @codex r54, Codex 第十二轮): a review conclusion that is not executable decays immediately.agent-misjudge, the one class a machine can catch unaided (docs/failure-corpus.md).What this project learned from, package by package and file by file — including what was deliberately not taken, and an honest inventory of the review reports that are not in this repository — is collected in docs/prior-art.md.
At a glance:
codex-rs, Apache-2.0, Copyright 2025 OpenAI) — the largest single influence. A 76-file subset of its workspace was studied locally; what was taken is interface shape, policy structure and naming discipline (the Guardian approval layer, the tool-spec registry, the call-trace discipline, the computer-use access control model, the truncation policy). No Codex source is vendored here and no file was copied — every implementation is an independent re-implementation, and native/**/*.rs contains no Codex references. Codex is also a subject: bench/harness/bench.mjs runs it as an agent under test.cdb) — wrapped and parsed, with the traps recorded in docs/native-stacks.md.| Doc | What is in it |
|---|---|
| ROADMAP.md | The public three-year plan and its design principles |
| docs/architecture.md | How the pieces compose |
| docs/tools.md | All 64 tools, one line each, grouped by what you are trying to do |
| docs/prior-art.md | What this project learned from (per package), and what it deliberately did not copy |
| docs/verify-package.md | Proposal: extracting the verification core as a standalone package — status: not implemented |
| docs/harness2-integration-design.md | Harness² source assessment and DSH integration design |
| docs/harness2-executor.md | Harness² execution adapter, evidence boundaries and evaluation limits |
| bench/README.md | The evaluation bench: SWE-bench-style tasks with hidden verification. Results, including the ones later retracted, are in bench/pilot/report.md |
| docs/perfview-parity.md | The perf plugin measured against PerfView, gaps included |
| docs/native-runtime.md | The optional Rust MCP runtime: scope, deployment and validation |
| docs/failure-corpus.md | Failure taxonomy and record schema |
| docs/agent-toolchain-evaluation.md | Measurements of this toolchain, plus what is still weak |
| docs/ui-drive-safety-boundary.md | What UI automation is allowed to do |
| CHANGELOG.md | SemVer history (Keep a Changelog) |
See CONTRIBUTING.md. npm run check is the repo gate (syntax, forbidden references, schema DSL, PowerShell encoding).
Apache-2.0 (per-plugin LICENSE files mirror this).
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: mcp、llm、mcp-server、deepseek-harness。