MonitorBaseClaude is a local WinForms and MCP workflow monitor for AI-assisted code edits. It is built around a simple safety idea: the model can propose and stage changes, but the watched source is changed only through an explicit human review path and then verified by hashes.
The current target runtime client is Claude using MCP tools. The current implementation/test client is this repository plus its smoke harnesses.
For a human-readable architecture walkthrough with diagrams, index details, edit flow, and both MCP tool surfaces, open Docs/HumanSystemReadme.html or Docs/HumanSystemReadme.pdf. The Markdown source version is Docs/HumanSystemReadme.md.
- Exposes a local MCP Tool Server for source discovery, source maps, symbol reads, Working candidate composition, staged review snapshots, and decision tools.
- Keeps generated monitor state under
Working, not inside the watched project. - Composes complete candidate files under monitor-owned paths instead of directly overwriting watched source.
- Uses WinMerge or a Host-owned review surface for all-or-none human review.
- Classifies review outcomes with vote-plus-hash agreement:
- Operator reports
acceptedand watched hash equals staged hash ->accepted - Operator reports
acceptedand normalized watched/staged content matches after BOM/EOL normalization ->accepted-normalized - Operator reports
rejectedand watched hash equals original hash ->rejected - anything else ->
dirty-unexpected
- Operator reports
- Blocks further staging on a file after
dirty-unexpecteduntil explicit refresh/recovery.
-
MonitorBaseClaude.csproj- WinForms operator surface and local monitor client code.
-
MonitorBaseClaude.McpServer- MCP Tool Server that exposes the controlled read, source-map, staging, and decision tools.
-
LocalSmokeTestsis a local-only ignored workspace for smoke probes and legacy smoke harnesses.- Console smoke harness for deterministic workflow and fixture testing.
Expected agent edit path:
find_fileif the target file is not known.get_source_mapinnavigationmode for broad project/folder orientation.get_source_mapinselectormode for a chosen file.get_symbolfor the exact body that needs editing.submit_file,submit_symbol,add_symbol,remove_symbol,add_using, orremove_usingto compose the Working candidate.stage_candidate_for_reviewsnapshots the completed Working candidate.launch_staged_diffor a Host-owned review surface opens the staged candidate against watched source.record_diff_decisionverifies the Operator vote against watched file hashes.
The source-map hierarchy is intentional:
navigation: broad outline/orientation, no mutation-grade identity.selector: stable symbol keys, hashes, compact contract signatures, and structured selector metadata.detail: selector identity plus extra contract detail without full audit payloads.full: audit/debug source-map detail.get_symbol: actual source body read after narrowing.
- The Tool Server composes and stages candidates; it does not directly mutate watched source.
- The Operator accepts all or rejects all. Partial hunk merging is outside the v1 workflow.
dirty-unexpectedblocks further staged edits on that file.refresh_fileis the current v1 recovery path after Host/Operator inspection.- Re-voting a blocked dirty record is refused; recovery is explicit.
compare_filemay refresh a missing Working copy, but that implicit refresh does not recover dirty blocks.- C# parse/syntax errors are rejected before a staged record is written.
- Overlay compile diagnostics are reported as validation metadata, not a hard staging blocker, because project/reference/generated-code state can create false positives.
- Razor is handled conservatively: full-file staging plus
razor-validation-pending; no pretend C# symbol surgery for raw.razorfiles.
dotnet build .\MonitorBaseClaude.slnxBuild the solution first, start MonitorBaseClaude.exe, then let Claude bind to the hub bridge executable. The canonical path is:
Claude -> McpHubBridge.exe -> MonitorBaseClaude.exe WinForms hub -> real MCP server
Starting MonitorBaseClaude.exe starts the hub pipe. Claude starts the bridge process from its MCP config, then the bridge connects to that hub.
Do not use dotnet run or PowerShell wrapper scripts as Claude MCP commands. The wrapper layer can break stdio forwarding and MSBuild output can pollute the JSON-RPC stream. Use Docs/ClaudeDesktopAndCodeSetup.md for the workstation-local bridge config.
Decision gate, syntax rejection, dirty blocking, and recovery:
Legacy smoke harnesses were moved to the ignored `LocalSmokeTests` workspace. New smoke work should use class-per-test structure there first.Roslyn source-map and symbol surgery path:
Use `LocalSmokeTests\LegacyToolSmokeTests` only for local debugging while the smoke suite is being broken into test classes.Razor safe-mode path:
Do not add new modes to the old legacy harness.Real watched-project source-map navigation:
New smoke probes should be implemented as one class per test behind a small runner, with separate executables only when process isolation is required.As of the 2026-05-16 safety-gate checkpoint:
- solution build passes
- vote-plus-hash decision scenarios pass
- malformed C# candidate rejection is covered
dirty-unexpectedblocking andrefresh_filerecovery are covered- Roslyn surgery fixture passes
- Razor safe-mode fixture passes
- DBV2 source-map generation has been smoke tested read-only
See:
Docs/SafetyGatePatchREADME.mdDocs/SmokeTestCoverageAddendum.mdDocs/SmokeTestSafetyGateArtifacts/MonitorBaseClaude.McpServer/MONITOR_MCP_TOOL_MANIFEST.mdMCP_CLIENT_TESTING.md
The deterministic monitor workflow is ready for a constrained Claude MCP learning pass:
get_monitor_statusget_tool_manifestget_source_mapnavigationget_source_mapselectorget_symbol- stop before real watched-source staging
Real watched-source mutation should remain deliberate and operator-reviewed.
This repository contains implementation notes for two different roles:
AGENTS.md: build-agent rules for Codex or another assistant changing this repository.CLAUDE.md: runtime MCP-client rules for Claude when it later consumes the tool server.
That split is intentional. Codex builds the monitor; Claude is expected to consume the monitor.