AgentStack
MCP verified MIT Self-run

PatchWarden

mcp-jiezeng2004-design-patchwarden · by jiezeng2004-design

Secure local MCP bridge for ChatGPT and local agents with workspace-scoped tasks, safe summaries, audits, and Direct editing.

No reviews yet
0 installs
4 views
0.0% view→install

Install

$ agentstack add mcp-jiezeng2004-design-patchwarden

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets Used
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of PatchWarden? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

PatchWarden

简体中文 · English

[](https://www.npmjs.com/package/patchwarden) [](https://nodejs.org/) [](LICENSE)

当前源码版本:v1.5.0。查看 [CHANGELOG](CHANGELOG.md)、[迁移指南](docs/migration-from-safe-bifrost.md)和 [发布检查清单](docs/release-checklist.md)。GitHub Release / npm 发布状态需要在发布前单独核对。

PatchWarden 是一个面向本地编程 Agent 的安全 MCP 桥接器。上游的 ChatGPT、Codex、OpenCode 或其他 MCP 客户端负责规划与验收, PatchWarden 负责把计划保存成工作区内任务,再由预先配置的本地 Agent 执行,并返回结果、代码差异和独立测试记录。

统一英文定位:

> PatchWarden is a local-first MCP safety and verification layer for AI coding agents, with workspace confinement, command allowlists, scope-violation detection, and auditable task evidence.

> [!IMPORTANT] > PatchWarden 不是通用远程 Shell。MCP 客户端不能随意执行命令: > 文件必须位于配置的工作区内,Agent 必须预先登记,验证命令必须与白名单 > 完全一致,敏感文件名会被阻止。

目录

  • [它解决什么问题](#它解决什么问题)
  • [运行结构](#运行结构)
  • [环境要求](#环境要求)
  • [五分钟快速开始](#五分钟快速开始)
  • [完整配置说明](#完整配置说明)
  • [接入 OpenCode](#接入-opencode)
  • [接入 Codex](#接入-codex)
  • [接入 ChatGPT Connector](#接入-chatgpt-connector)
  • [代理配置:必须先看](#代理配置必须先看)
  • [标准任务工作流](#标准任务工作流)
  • [HTTP MCP 模式](#http-mcp-模式)
  • [诊断与健康检查](#诊断与健康检查)
  • [踩坑记录与故障排查](#踩坑记录与故障排查)
  • [Direct 模式:ChatGPT 直接开发](#direct-模式chatgpt-直接开发)
  • [安全边界与本地数据](#安全边界与本地数据)
  • [升级与旧版本迁移](#升级与旧版本迁移)
  • [开发与发布验证](#开发与发布验证)

它解决什么问题

很多本地编程桥会把完整 Shell 暴露给上游模型。PatchWarden 采用更窄、 更容易审计的任务通道:

  • 上游模型只能调用明确的 MCP 工具,不能直接拼接任意 Shell 命令。
  • 每个任务必须指定位于 workspaceRoot 内的 repo_path
  • Agent 启动命令来自本地配置,而不是来自模型输入。
  • 测试命令必须精确匹配 allowedTestCommands
  • 任务完成后保存结构化结果、完整差异、文件统计和独立验证记录。
  • 工作区外出现变化时,任务会标记为作用域违规,而不是悄悄接受。
  • .env、Token、SSH 密钥、Cookie、凭据文件等敏感路径默认不可读。

适合的场景:

  • 让 ChatGPT 规划任务,让 OpenCode 或 Codex 在本地执行。
  • 给本地 MCP 客户端增加可审计的 plan → task → verify 流程。
  • 在执行后读取 result.jsondiff.patchverify.json 并独立验收。
  • 需要工作区限制、命令白名单和敏感信息防护的自动化任务。

不适合的场景:

  • 希望 MCP 客户端获得无限制 Shell。
  • 直接管理整个磁盘、用户主目录或包含大量私人文件的目录。
  • 无人监督地自动提交、推送、发版或修改线上环境。

运行结构

ChatGPT / Codex / OpenCode / 其他 MCP 客户端
                    |
                    v
          PatchWarden MCP Server
                    |
          save_plan / create_task
                    |
                    v
       .patchwarden/tasks//
                    |
              Watcher 发现任务
                    |
                    v
        本地 Agent(OpenCode / Codex)
                    |
                    v
 result.json / diff.patch / verify.json / status.json
                    |
                    v
       MCP 客户端读取、审计、人工验收

一次完整运行通常包含三个角色:

  1. MCP Server:由 Codex、OpenCode 或 Tunnel 启动。
  2. Watcher:监听待处理任务并启动本地 Agent。
  3. 本地 Agent:真正修改代码,必须在配置中预先登记。

> [!WARNING] > “MCP 已连接”不等于“任务一定会执行”。如果 Watcher 没有运行, > create_task 仍能保存任务,但任务会保持 queued,并返回 > execution_blocked: true

环境要求

  • Node.js 18 或更高版本
  • npm
  • Git(可选,但没有 Git 就无法生成可靠的 git.diff
  • 至少一个可用的本地编程 Agent,例如 OpenCode 或 Codex CLI
  • Windows Tunnel 模式还需要 tunnel-client.exe、Tunnel ID 和运行时 API Key

Windows PowerShell 检查:

node -v
npm.cmd -v
git --version
where.exe opencode
where.exe codex

如果 where.exe codex 只返回 WindowsApps 下的 Codex Desktop 应用程序,它不一定是可供 PatchWarden 调用的 Codex CLI。请安装或指定真正的 CLI,或者先把 OpenCode 配置为执行 Agent。

五分钟快速开始

方案 A:从源码运行(推荐)

源码方式最适合完整使用 Watcher、Windows 一键启动器和诊断脚本。

Windows PowerShell:

git clone https://github.com/jiezeng2004-design/PatchWarden.git
cd .\PatchWarden
npm.cmd ci
npm.cmd run build
Copy-Item .\examples\config.example.json .\patchwarden.config.json

然后编辑 patchwarden.config.json,至少修改:

  • workspaceRoot
  • agents
  • allowedTestCommands

运行只读诊断:

npm.cmd run doctor

启动 Watcher:

$env:PATCHWARDEN_CONFIG = (Resolve-Path .\patchwarden.config.json)
npm.cmd run watch

保持该窗口运行,再按照后文配置 OpenCode、Codex 或 ChatGPT Connector。

方案 B:使用 npm 包

npm 包适合让 MCP 客户端通过固定版本启动 PatchWarden。为了执行任务, 仍然必须另外启动 Watcher。

New-Item -ItemType Directory .\patchwarden-runtime
Set-Location .\patchwarden-runtime
npm.cmd init -y
npm.cmd install patchwarden@
Copy-Item .\node_modules\patchwarden\examples\config.example.json .\patchwarden.config.json
$env:PATCHWARDEN_CONFIG = (Resolve-Path .\patchwarden.config.json)
node .\node_modules\patchwarden\dist\runner\watch.js

MCP 客户端可以使用:

npx.cmd -y patchwarden@

将 ` 替换为已经在 npm/GitHub 上确认存在的版本;不要在重要环境中无条件使用 latest`。

完整配置说明

从示例创建本地配置:

Copy-Item .\examples\config.example.json .\patchwarden.config.json

推荐的 Windows 示例:

{
  "workspaceRoot": "D:/ai_agent/codex_program",
  "plansDir": ".patchwarden/plans",
  "tasksDir": ".patchwarden/tasks",
  "toolProfile": "full",
  "agents": {
    "opencode": {
      "command": "opencode",
      "args": ["run", "{prompt}"]
    },
    "codex": {
      "command": "codex",
      "args": ["exec", "--cd", "{repo}", "{prompt}"]
    }
  },
  "allowedTestCommands": [
    "npm test",
    "npm run build",
    "npm run lint",
    "pytest"
  ],
  "repoAllowedTestCommands": {
    "desktop-app": ["npm run release:check"]
  },
  "maxReadFileBytes": 200000,
  "defaultTaskTimeoutSeconds": 900,
  "maxTaskTimeoutSeconds": 3600,
  "watcherStaleSeconds": 30,
  "httpPort": 7331
}

字段说明:

| 字段 | 是否必需 | 说明 | | --- | --- | --- | | workspaceRoot | 是 | PatchWarden 唯一允许访问的工作区根目录。 | | plansDir | 是 | 计划目录,通常使用 .patchwarden/plans。 | | tasksDir | 是 | 任务和结果目录,通常使用 .patchwarden/tasks。 | | toolProfile | 否 | fullchatgpt_corechatgpt_directchatgpt_search;本地客户端推荐 full,动态工具发现场景使用 chatgpt_search。 | | agents | 是 | 可执行 Agent 白名单;支持 {repo}{prompt} 占位符。 | | allowedTestCommands | 是 | 独立验证命令白名单,调用时必须精确匹配。 | | repoAllowedTestCommands | 否 | 按工作区相对仓库路径增加精确验证命令;不支持通配符。 | | maxReadFileBytes | 是 | MCP 单次文件读取上限。 | | defaultTaskTimeoutSeconds | 是 | 默认任务超时。 | | maxTaskTimeoutSeconds | 是 | 客户端可请求的最大任务超时。 | | watcherStaleSeconds | 是 | Watcher 心跳超过该时间后视为失联,范围为 5–3600 秒。 | | repoAliases | 否 | 给工作区内仓库设置简短别名。 | | httpPort | 否 | 本地 HTTP MCP 端口,默认 7331。 | | http.ownerTokenEnv | 否 | HTTP 鉴权 Token 所在的环境变量名。 |

配置注意事项:

  • Windows JSON 路径推荐写成 D:/path/to/project
  • 如果使用反斜杠,必须写成 D:\\path\\to\\project
  • 不要把 workspaceRoot 设置成磁盘根目录、用户主目录、桌面、下载或文档目录。
  • plansDirtasksDir 相对于 workspaceRoot 解析。
  • repo_path 必须位于 workspaceRoot 内,不能通过 .. 跳出。
  • allowedTestCommands 是精确匹配,不会把相似命令自动视为已授权。
  • 仓库专属命令只从本机可信配置读取;目标仓库不能通过 package.json 自行扩权。
  • 配置文件可能包含私人路径,默认不要提交到 Git。

设置配置路径:

$env:PATCHWARDEN_CONFIG = "D:\path\to\patchwarden.config.json"

该环境变量只影响当前 PowerShell 及其子进程。如果从另一个窗口启动 Watcher 或 MCP Server,需要在那个窗口重新设置。

接入 OpenCode

推荐从本地源码启动,以便版本、Watcher 和配置文件保持一致。

编辑 OpenCode 配置:

%USERPROFILE%\.config\opencode\opencode.jsonc

示例:

{
  "mcp": {
    "patchwarden": {
      "type": "local",
      "command": [
        "node",
        "D:/path/to/PatchWarden/dist/index.js"
      ],
      "environment": {
        "PATCHWARDEN_CONFIG": "D:/path/to/PatchWarden/patchwarden.config.json",
        "PATCHWARDEN_TOOL_PROFILE": "full"
      },
      "enabled": true
    }
  }
}

验证:

opencode mcp list

预期看到:

patchwarden connected

然后在 PatchWarden 项目目录的另一个 PowerShell 窗口启动:

$env:PATCHWARDEN_CONFIG = (Resolve-Path .\patchwarden.config.json)
npm.cmd run watch

如果 OpenCode 能看到 MCP 工具,但创建的任务一直 queued,先检查 Watcher, 不要反复删除并重建 MCP 配置。

接入 Codex

编辑:

%USERPROFILE%\.codex\config.toml

使用 npm 固定版本:

[mcp_servers.patchwarden]
command = "npx.cmd"
args = ["-y", "patchwarden@"]

[mcp_servers.patchwarden.env]
PATCHWARDEN_CONFIG = "D:\\path\\to\\patchwarden.config.json"
PATCHWARDEN_TOOL_PROFILE = "full"

或使用本地源码:

[mcp_servers.patchwarden]
command = "node"
args = ["D:\\path\\to\\PatchWarden\\dist\\index.js"]

[mcp_servers.patchwarden.env]
PATCHWARDEN_CONFIG = "D:\\path\\to\\PatchWarden\\patchwarden.config.json"
PATCHWARDEN_TOOL_PROFILE = "full"

修改后完全退出并重新打开 Codex Desktop,再新建会话。已经打开的会话可能仍 保留旧 MCP 工具目录。

同样需要单独运行 Watcher。Codex 作为 MCP 客户端 和 Codex CLI 作为 任务执行 Agent 是两个不同角色;前者连接成功不能证明后者命令可用。

接入 ChatGPT Connector

推荐的 Windows 链路:

ChatGPT Web
→ ChatGPT Connector
→ OpenAI Secure MCP Tunnel
→ PatchWarden stdio MCP
→ Watcher
→ 本地 Agent

一键启动

准备好以下内容:

  • 已构建的 PatchWarden 源码目录
  • 有效的 patchwarden.config.json
  • tunnel-client.exe
  • Tunnel ID
  • Tunnel runtime API Key
  • 可用的 HTTP 代理及受支持的出口区域

先按下一节配置代理,然后运行:

PatchWarden.cmd start core

启动器会:

  • 检查 dist/index.js,缺失时自动构建。
  • 校验 chatgpt_core 的版本、26 个核心工具和 Schema Manifest。
  • 读取或提示输入 Tunnel ID。
  • 读取或提示输入运行时 API Key。
  • 使用 Windows DPAPI 保存凭据到 %APPDATA%\patchwarden
  • 启动并监督由当前启动器拥有的 Watcher。
  • 运行 tunnel-client doctor 和 readiness 检查。
  • 对可恢复断线做限速重试,不会无限快速重启。

运行时状态位于:

%LOCALAPPDATA%\patchwarden\runtime

这里包含 PID、健康状态和脱敏诊断信息,不应包含 API Key 或 Tunnel ID。

ChatGPT Connector 创建时:

  • 选择 Tunnel 的 Channel
  • 除非自行实现了 OAuth,否则认证选择 None
  • 不要把本地 127.0.0.1 URL 当成公网 Server URL。
  • 创建或更新 Connector 后,重新连接并新开一个 ChatGPT 对话。
  • Platform 页面异常时,先关闭网页翻译扩展再重试。

更完整的 Tunnel 示例见 [examples/openai-tunnel/README.md](examples/openai-tunnel/README.md)。

代理配置:必须先看

一键脚本的默认值

scripts/control/start-patchwarden-tunnel.ps1 优先读取当前进程的 HTTPS_PROXY。如果没有设置,它会默认使用:

http://127.0.0.1:7892

7892 不是通用端口。 Clash、Mihomo、V2Ray、sing-box 或其他代理工具 可能使用 7890、7897、10809 或自定义端口。请在代理软件中确认 HTTP/Mixed 监听端口,不要照抄示例。

先测试端口:

Test-NetConnection 127.0.0.1 -Port 7892

如果 TcpTestSucceededFalse,说明该端口没有代理服务。

推荐设置

以下命令只影响当前 PowerShell 和从它启动的子进程,不修改系统级环境变量:

$env:HTTPS_PROXY = "http://127.0.0.1:你的HTTP或Mixed端口"
$env:HTTP_PROXY  = $env:HTTPS_PROXY
$env:ALL_PROXY   = $env:HTTPS_PROXY
$env:NO_PROXY    = "localhost,127.0.0.1,::1"
.\PatchWarden.cmd start core

例如代理软件的 Mixed 端口是 7890:

$env:HTTPS_PROXY = "http://127.0.0.1:7890"
$env:HTTP_PROXY  = $env:HTTPS_PROXY
$env:ALL_PROXY   = $env:HTTPS_PROXY
$env:NO_PROXY    = "localhost,127.0.0.1,::1"
.\PatchWarden.cmd start core

这里的 HTTPS_PROXY=http://... 并不矛盾:变量名表示 HTTPS 请求通过代理, URL 的 http:// 表示连接到本地 HTTP 代理端口。不要把只支持 SOCKS 的端口 误填到当前 --http-proxy 参数中。

三条不同的网络路径

| 网络路径 | 是否需要代理 | 说明 | | --- | --- | --- | | Tunnel → OpenAI control plane | 通常需要 | 一键启动器通过 HTTPS_PROXY 传给 tunnel-client。 | | PatchWarden → 127.0.0.1 | 不需要 | 必须保留 NO_PROXY=localhost,127.0.0.1,::1。 | | 本地 Agent → 模型提供方 API | 视 Agent 而定 | Watcher/Agent 可能继承当前终端的代理变量。 | | npm / GitHub | 视网络而定 | 与 Tunnel 是否健康是两回事,要分别诊断。 |

如果手动启动 Watcher,希望它和子 Agent 使用同一代理,要在启动 Watcher 的那个 PowerShell 窗口设置代理变量。

地域错误不是代码错误

如果日志出现:

unsupported_country_region_territory
403 Forbidden

说明代理出口区域不被当前 OpenAI control plane 接受。继续重装依赖、 重建 dist 或反复登录通常无效;应先切换到受支持的出口区域,再重新启动 Tunnel。支持范围可能变化,因此不要在项目里写死国家列表。

代理配置检查顺序

  1. 代理软件是否正在运行。
  2. 填写的是 HTTP/Mixed 端口,而不是随手复制的示例端口。
  3. Test-NetConnection 是否成功。
  4. HTTPS_PROXY 是否在启动 Tunnel 的同一个 PowerShell 中设置。
  5. NO_PROXY 是否包含本地地址。
  6. 出口区域是否受支持。
  7. 再运行 PatchWarden.cmd health 和 tunnel-client doctor。

标准任务工作流

推荐顺序:

  1. health_check:确认版本、工作区、Watcher 和工具目录。
  2. list_agents:确认本地 Agent 命令可用。
  3. list_workspace:确定 repo_path
  4. save_plan,或在创建任务时提供 inline_plan
  5. create_task:明确 Agent、仓库和验证命令。
  6. 短任务使用 wait_for_task(timeout_seconds: 25);长任务使用 list_tasksget_task_status 轮询。
  7. get_task_summary(view: "compact"):先看有界结构化总结。
  8. get_result_jsonget_diffget_test_log:按需查看细节。
  9. audit_task:独立核对执行结果。
  10. 人工决定是否接受、提交或发布。

create_task 示例:

{
  "agent": "opencode",
  "repo_path": "my-project",
  "inline_plan": "修复登录页的表单校验,不改动无关文件,并补充回归测试。",
  "verify_commands": [
    "npm run build",
    "npm test"
  ],
  "timeout_seconds": 900
}

要求:

  • repo_path 必须在 workspaceRoot 内。
  • verify_commands 必须逐字匹配全局或当前仓库的可信命令白名单。
  • plan_idinline_plantemplate 三种计划来源必须且只能选择一种。
  • wait_for_task 返回 continuation_required: true 时,应继续调用。
  • terminal: true 只表示任务进入终态,不代表结果一定正确。

内置模板:

  • inspect_only
  • feature_small
  • fix_tests
  • release_check
  • rollback_scope_violation

ChatGPT 任务应优先选择前三个守护模板:只读诊断使用 inspect_only,小范围功能修改使用 feature_small,已知测试失败修复使用 fix_tests。只有模板无法准确表达目标时,才使用 inline_plan 或已保存的长计划。建议先以 execution_mode: "assess_only" 评估,再直接调用返回的 next_tool_call;执行阶段不要重复发送 goal、plan、仓库或验证参数。

inspect_only 和回滚审查模板如果修改文件,会以 failed_policy_violation 失败。回滚审查只生成方案,不会自动回滚用户修改。

audit_taskfail 检查会列入 confirmed_failures;启发式警告会单独列入 possible_false_positivesmanual_verification_items。因此 warn 不等于已确认错误,仍需按人工核实项检查证据。

任务产物

| 文件 | 用途 | | --- | --- | | status.json | 当前状态、阶段、心跳和错误信息。 | | progress.md | Agent 写入的进度记录。 | | result.md | 人类可读的执行报告。 | | result.json | 结构化结果、路径、变更、警告和后续建议。 | | diff.patch | 完整任务差异证据。 | | artifact_manifest.json | 构建或发布产物的路径、类型、大小与 SHA-256。 | | file-stats.json | 文件级增删统计。 | | verify.json | 每条独立验证命令的结构化记录。 | | verify.log | 独立验证的可读日志。 | | test.log | Agent 执行过程中产生的测试输出。 |

本地 Agent 声称“已推送”“已发布”不属于可靠的远程证据。GitHub、npm、 Tag 和 Release 必须再用对应平台的实时状态核验。

HTTP MCP 模式

HTTP Server 只绑定 127.0.0.1,默认端口 7331,不会直接监听局域网。

终端 1,启动 Watcher:

$env:PATCHWARDEN_CONFIG = (Resolve-Path .\patchwarden.config.json)
npm.cmd run watch

终端 2,启动 HTTP MCP:

$env:PATCHWARDEN_CONFIG = (Resolve-Path .\patchwarden.config.json)
npm.cmd run start:http

健康检查:

Invoke-RestMethod http://127.0.0.1:7331/healthz

MCP 地址:

http://127.0.0.1:7331/mcp

可选 Token 配置:

{
  "httpPort": 7331,
  "http": {
    "ownerTokenEnv": "PATCHWARDEN_OWNER_TOKEN"
  }
}

在启动 Server 的当前 PowerShell 中设置:

$env:PATCHWARDEN_OWNER_TOKEN = "请使用随机且仅保存在本机的值"

客户端可使用 Authorization: Bearer ...x-patchwarden-token。 不要把 Token 直接写进配置、README、日志或 Git。

> [!CAUTION] > 不要通过路由器端口映射、0.0.0.0 转发或普通反向代理直接公开 > 本地 7331 端口。远程接入应使用经过认证的安全 Tunnel。

诊断与健康检查

项目诊断:

npm.cmd run doctor

它会检查 Node、npm、Git、配置、工作区、路径保护、敏感文件保护、Agent 命令、工具 Manifest、HTTP 端口、Watcher 目录和构建产物。

统一 Windows 控制入口

双击 PatchWarden.cmd 会打开统一菜单,可分别或同时管理 Core Agent 和 Direct 两种模式的启动、停止、重启与状态。也可以在 PowerShell 中直接调用:

.\PatchWarden.cmd start core
.\PatchWarden.cmd start direct
.\PatchWarden.cmd stop all
.\PatchWarden.cmd restart all
.\PatchWarden.cmd status all
.\PatchWarden.cmd kill all
.\Stop-PatchWarden.cmd

日常桌面入口:PatchWarden-Desktop.cmd 启动托盘并确保 Control Center 可用,不自动打开额外浏览器窗口。只有调试托盘时才使用 PatchWarden-Control-Tray.cmd --foreground;需要完整 Web 控制台时打开 PatchWarden-Control.cmd;需要一键收尾时使用 Stop-PatchWarden.cmd 关闭 Core/Direct、Control Center 和托盘。

旧的单用途入口保留在 scripts/launchers/ 作为兼容层;个人入口位于 .local/launchers/,并继续被 Git 和发布包排除。stop / restart 会同时检查 运行状态、精确的 Tunnel Profile、项目启动器和进程树,因此可以清理同一 Profile 遗留的 tunnel-client.exe,但不会结束无关进程。kill 是显式强制清理入口, 仍受相同的 Profile 和项目路径约束;发现 8080/8081 被无关进程占用时会停止操作并报告 PID。

status 会交叉检查 runtime JSON、health URL 文件、固定的 /readyz / /healthz 端点和真实进程。即使状态文件陈旧,只要 health endpoint 已 ready,也会报告实际运行状态。 supervisor 的最新输出位于:

%LOCALAPPDATA%\patchwarden\runtime\tunnel-client.stdout.log
%LOCALAPPDATA%\patchwarden\runtime\tunnel-client.stderr.log
%LOCALAPPDATA%\patchwarden\runtime-direct\tunnel-client.stdout.log
%LOCALAPPDATA%\patchwarden\runtime-direct\tunnel-client.stderr.log

非零退出时,窗口会显示 stderr 最后 30 行;tunnel-status.json 同时记录退出码、 脱敏后的 stdout/stderr tail 和日志路径,不会输出 API Key 值。

Windows Tunnel 深度健康检查:

PatchWarden.cmd health

它会报告:

  • 源码版本和 dist 版本
  • 实际 MCP 进程来源
  • 工具 Profile、数量、名称和 Schema Hash
  • 工作区和任务目录访问状态
  • Watcher 心跳
  • Tunnel readiness
  • 是否存在混合版本进程

它只读诊断,不会结束进程。

MCP 内部的扩展诊断:

{
  "detail": "self_diagnostic"
}

可配合 health_check 查看 Agent、白名单、最近失败任务和工具目录一致性。

配置或版本更新后需要完整重启时,可运行:

PatchWarden.cmd restart all

该命令只停止当前项目拥有的启动器/Watcher,以及 Profile 精确匹配的 tunnel-client.exe,不会全局结束其他 PatchWarden、OpenCode 或 Codex 实例。

Core 与 Direct 并发运行

Core Agent 和 Direct 可以同时运行,使用不同的 tunnel-client profile:

| 模式 | Profile | Tool Profile | 默认 Health 端口 | | --- | --- | --- | --- | | Core | patchwarden | chatgpt_core | 127.0.0.1:8080 | | Direct | patchwarden-direct | chatgpt_direct | 127.0.0.1:8081 |

为避免两个 tunnel-client 实例的 health 端口冲突,启动时需要显式指定端口:

Core 启动示例:

powershell

…

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [jiezeng2004-design](https://github.com/jiezeng2004-design)
- **Source:** [jiezeng2004-design/PatchWarden](https://github.com/jiezeng2004-design/PatchWarden)
- **License:** MIT
- **Homepage:** https://github.com/jiezeng2004-design/PatchWarden#readme

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.