Ecosystem detection and adapters
The ecosystem layer identifies the AI plugin format at a path and turns each supported format into one shared package view. This lets the scanner apply common security checks while preserving each ecosystem's plugin, skill, command, hook, MCP, and configuration surfaces. See the security scanner and plugin analysis page for the full scan lifecycle, scanner security checks and rules for policy coverage, and the AI BOM and agent inventory page for downstream inventory use.
System role
The scanner treats an ecosystem as a package format with its own discovery markers and asset layout. An ecosystem adapter finds packages in that format and normalizes them before the scan engine selects the checks that match the package.
Detection and scan flow
The flow moves from a path and an optional ecosystem choice to candidates, normalized packages, ecosystem-specific checks, and one combined result. Auto mode can return several packages from one repository, so the result keeps both package identity and ecosystem identity.
flowchart LR
A[Path and scan options] --> B[Resolve ecosystem choice]
B --> C[Run supported ecosystem adapters]
C --> D[Package candidates]
D --> E[Normalized packages]
E --> F[Common and ecosystem checks]
F --> G[Findings and package-aware report]
References: src/…/scanner.py• L615-652 src/…/detect.py• L38-46 src/…/base.py• L103-114
Package representation
The layer uses two stages so detection stays separate from parsing. The first stage answers “what package might this be?” The second stage answers “what assets and policy data does this package expose?”
Package candidates
A PackageCandidate is a lightweight identity for a detected package. It records the ecosystem, package kind, root path, optional manifest path, and the reason for detection. The scanner can therefore choose the correct parser without making each detector understand the full scan result.
Candidates are de-duplicated by ecosystem and resolved root. When more than one marker describes the same root, the detector keeps the more specific package kind instead of scanning the same package twice.
References: src/…/types.py• L21-30 src/…/detect.py• L11-35
Normalized packages
A NormalizedPackage is the common input to the scan checks. It carries the package identity and manifest together with named component surfaces, simple metadata, policy values, and any manifest parse state.
The component map is the key shared view. An adapter can expose different source layouts under stable concepts such as skills, commands, agents, hooks, mcp_servers, context_files, or plugin modules. Common checks can then use the package root and component paths without knowing the source format.
References: src/…/types.py• L32-47 src/…/base.py• L103-114
Supported package ecosystems
The built-in package adapters cover six scanning ecosystems. Each one uses a format-specific marker for discovery and maps its own extension surfaces into the normalized package view.
Ecosystem surface map
| Ecosystem | Package identity | Main surfaces represented |
|---|---|---|
| Codex | .codex-plugin/plugin.json or a Codex marketplace manifest | Plugin metadata and declared skills |
| Claude | .claude-plugin/plugin.json or marketplace.json | Commands, agents, skills, hooks, and MCP servers |
| DeepSeek Harness | package.json with a dsh.bundle declaration | Bundle patch and client entries |
| Gemini | gemini-extension.json | Commands, MCP servers, and context files |
| Kimi | kimi.plugin.json or .kimi-plugin/plugin.json | Skills, agents, commands, system prompts, MCP servers, and local MCP files |
| OpenCode | opencode.json, opencode.jsonc, or .opencode | Commands, plugin modules, and MCP servers |
The adapters do not force these formats into one manifest schema. They preserve the raw manifest for format-specific checks while exposing the shared fields needed for scan selection, reporting, and path-safe inspection.
References: src/…/registry.py• L15-25 src/…/codex.py• L27-85 src/…/claude.py• L15-46 src/…/deepseek_harness.py• L27-76 src/…/gemini.py• L27-71 src/…/kimi.py• L72-158 src/…/opencode.py• L51-131
Claude policy representation
Claude single-plugin packages expose a boolean root-level strict setting as a normalized policy. Claude marketplaces do not expose one package-wide strict value because the setting belongs to each marketplace plugin entry. The raw marketplace manifest remains available so marketplace checks can validate those per-plugin settings and reject an invalid root-level field.
References: src/…/claude.py• L48-105 src/…/claude.py• L115-185
Detection boundaries
Detection is deliberately based on package markers and safe local paths. It does not need to execute a plugin to identify its package format.
Automatic and explicit selection
The registry is the source of truth for built-in package adapters and supported ecosystem IDs. An explicit ecosystem value limits detection to that adapter. auto and an empty value mean that all built-in adapters may inspect the path; the dsh and deepseek_harness spellings resolve to DeepSeek Harness.
If detection finds no candidate, the scan keeps a compatibility path. An explicitly requested ecosystem becomes a workspace-bundle candidate at the scan root. With no request, the scanner falls back to a legacy Codex single-plugin candidate.
References: src/…/registry.py• L15-47 src/…/scanner.py• L140-159 src/…/scanner.py• L615-633
Safe path discovery
Recursive discovery stays inside the scan root and ignores common dependency, version-control, build, and cache directories. Symlinked files and directories are not followed by the ecosystem walkers. An unreadable directory is skipped so one inaccessible part of a repository does not stop discovery of other packages.
This boundary also protects component enumeration. Adapters only expose files that remain inside the package root, which prevents an external file reached through a link or a path escape from becoming scan input.
References: src/…/base.py• L12-66 src/…/base.py• L69-100 tests/test_ecosystems.py• L176-230 tests/test_ecosystems.py• L232-274
Scan integration
After parsing, the scan engine dispatches checks by ecosystem and combines their outputs with common checks. The normalized package lets a mixed repository report each package without losing its relative location.
Package-aware check dispatch
Codex packages use the established plugin and marketplace scan paths. Claude, DeepSeek Harness, Gemini, Kimi, and OpenCode packages receive their own ecosystem check families in addition to shared security, operational-security, and code-quality checks where applicable. The result records the detected ecosystem and package summaries so downstream consumers can distinguish findings from different package roots.
For a mixed scan, category names receive an ecosystem and path prefix when needed. Findings are rebased to the scan root, which keeps evidence useful when one repository contains several packages.
References: src/…/scanner.py• L350-376 src/…/scanner.py• L443-582 src/…/scanner.py• L585-612
Runtime adapter boundary
Ecosystem adapters describe package content for scanning. Guard runtime adapters serve a different role: they connect an AI tool to the review hook that enforces policy while the tool runs. Keeping this boundary clear prevents runtime launch behavior from changing the package candidate or normalized package model.
Runtime adapters translate each harness's hook events and decision format into the Guard review contract. The adapter registry resolves canonical harness names and install aliases, while each protection contract describes the harness's config surfaces, event surfaces, approval behavior, resume behavior, and known blind spots. Copilot is represented across its CLI configuration, workspace hook files, and MCP configuration. Hermes is represented through its skills, MCP registrations, and pre-tool runtime seam. Devin, ZCode, and Pi remain first-class harnesses with their own config, hook, skill, MCP, and shared hook surfaces. OpenCode keeps one managed plugin contract while registering both its older server entry point and its newer execute.before hook surface.
Internal harness modules are kept as ordinary Python packages with stable source paths. Public adapter classes stay in the parent adapter directory when their physical path is part of an authentication or packaging contract, so moving an internal helper does not create a second compatibility path.
The runtime layer also reports declared capability per event. A capability row states the transport, mode, actions, error behavior, compatibility need, and known blind spots. Its proof state is separate from the declaration: an unverified or not-run row does not claim live enforcement, and a synthetic canary does not become live-block proof. A requested unknown host receives an explicit unsupported row rather than extending the adapter registry.
Runtime diagnostics now separate passive registration checks from optional command probes. Global doctor checks can confirm adapter registration and managed artifacts without starting harness commands. A skipped probe is reported as unverified rather than as a failed or successful runtime check.
Some adapters also establish trusted launch boundaries for the harness itself. Grok accepts an executable only after path, file, ownership, permissions, and content checks, then stores the verified identity for later launches. MCP adapters represent local standard-input/output servers and remote declarations as managed records with stable identities and source labels. Discovery observes configured servers without connecting to them. It recognizes packaged native proxy commands and the Python CLI form, and it can describe an upstream server behind a verified Guard proxy without wrapping that proxy again. Recovered upstream data remains descriptive and does not grant new launch authority.
Codex detection reads both global and project configuration sources and inventories hooks before install changes them. Its native PreToolUse and PermissionRequest routes define the authoritative shell boundary, while migration moves eligible legacy hook entries into the active configuration only after conflict and read-back checks preserve their meaning. Live state is valid only when the managed hook manifest matches the active configuration and hooks are enabled. Cursor detection separates blocking native hook events from observer events and records the managed global hook path with its MCP configuration state. Its project MCP entries can be copied into the global editor configuration, so saved origin state links those entries back to their project source. Copilot uses the same separation for CLI and workspace hooks, and keeps MCP backup and lifecycle state tied to each target configuration. These distinctions let status and install reports describe an installed integration without treating every discovered file as active enforcement.
References: src/…/__init__.py• L10-54 src/…/contracts.py• L23-35 src/…/contracts.py• L346-377 src/…/contracts.py• L853-881 src/…/contract_models.py• L39-72 src/…/capability_report.py• L185-260 src/…/capability_report.py• L271-360 src/…/base.py• L68-116 src/…/base.py• L236-339 src/…/diagnostic_probes.py• L9-34 src/…/mcp_servers.py• L85-109 src/…/mcp_servers.py• L167-220 src/…/mcp_servers.py• L223-301 src/…/harness_mcp_discovery.py• L49-83 src/…/harness_mcp_discovery.py• L94-159 src/…/harness_mcp_discovery.py• L163-244 src/…/grok_executable.py• L69-168 src/…/grok_executable.py• L214-245 src/…/codex.py• L1158-1217 src/…/codex.py• L1322-1464 src/…/cursor.py• L95-152 src/…/cursor.py• L192-251 src/…/cursor_hooks.py• L107-195 src/…/copilot.py• L477-523 src/…/copilot.py• L603-775 src/…/hermes.py• L147-231 src/…/hermes.py• L341-366
Bounded hook transport
Bounded CLI adapters support harnesses without a native daemon hook. The bridge first uses an authenticated local Guard daemon when available, then converts the shared policy result into the harness's native response shape. It limits input, output, process time, and approval wait so a slow or unavailable review cannot run without a defined failure response.
The daemon path accepts only authenticated loopback state and rejects unsafe redirects or oversized responses. If the daemon worker fails or a daemon retry cannot complete, the bridge authenticates the managed fallback launcher before it starts another process. It records a bounded list of stage and reason codes for diagnosis without placing hook data or exception text in the failure report.
Generated hook clients normalize host event names and payloads before review. They reserve time for fallback and use fail-safe native responses when the review cannot complete. Blocking events stop or deny work where the host supports that behavior, while observer and lifecycle events remain non-blocking when a completed action cannot be undone.
References: src/…/bounded_cli_hook_script_template.py• L30-126 src/…/bounded_cli_hook_script_template.py• L308-377 src/…/bounded_cli_hook_script_template.py• L465-527 src/…/claude_hook_argv.py• L80-151 src/…/claude_hook_argv.py• L154-219 src/…/claude_daemon_state.py• L11-44
Probe process boundaries
Runtime and evaluation probes run as bounded child processes. The probe contract limits duration and combined output, closes input, stops the owned process group or Windows job on timeout or overflow, and records incomplete capture when cleanup does not finish. This keeps diagnostics from hanging the adapter layer or consuming unbounded memory.
References: src/…/hook_python_subprocess.py• L20-62 src/…/hook_python_subprocess.py• L64-149 src/…/hook_python_subprocess.py• L196-315 src/…/hook_python.py• L385-445
Harness-specific runtime surfaces
Some harnesses expose a native hook but do not support the same level of mediation. Cline's managed plugin transport can block before a tool call and replace or withhold a tool result; its native post-tool hook remains observation-only. Its MCP adapter scans current and legacy settings locations, manages only local stdio entries, and restores a file only when its managed-content hash still matches.
Copilot separates CLI hooks from VS Code workspace hooks and separates global MCP configuration from workspace MCP configuration. It preserves user hook entries, records per-target backup and state, and restores only the configuration that its lifecycle state authorizes. Hermes reads skills and MCP sources from its resolved home, then uses a managed MCP overlay and a fail-closed hooks.pre_tool_call seam so skill and tool review share one runtime boundary.
Devin reads global and project JSON or JSONC config, MCP registrations, hook groups, and skill roots. It installs managed hooks without replacing user entries. Devin also loads Claude Code hook files by default, so the adapter warns when both paths could report the same event under different harness names.
ZCode represents hooks under its current nested event surface and migrates older flat groups during setup. Its adapter normalizes ZCode and Claude-shaped event and tool fields into the shared hook shape. Review-tier actions use ZCode's native ask prompt, while hard denials use deny and prompt blocks use ZCode's blocking response. Shared hook merge logic refreshes only Guard-owned handlers and preserves user hook groups, which keeps install, repair, and uninstall aligned with the ownership boundary.
Pi uses a generated managed extension to connect prompt, tool-call, and tool-result events to Guard. The active source variant keeps daemon and recovery paths below Pi's hook deadline and bounds the data sent through the hook. It can route approved or required contained test work to a native execution sink when the host and profile support it. For tool output, it preserves the original only when the review hash proves it, or returns a reviewed excerpt; otherwise it keeps the output from reaching the model.
References: src/…/README.md• L1-9 src/…/cline_plugin.py• L332-425 src/…/cline_plugin.py• L502-579 src/…/cline_mcp.py• L22-204 src/…/cline_mcp.py• L249-351 src/…/copilot.py• L477-523 src/…/copilot.py• L603-775 src/…/devin.py• L193-316 src/…/devin.py• L364-421 src/…/devin_config.py• L185-226 src/…/zcode.py• L140-219 src/…/zcode.py• L387-464 src/…/zcode_hooks.py• L40-103 src/…/hook_group_merge.py• L22-91 src/…/hermes.py• L147-231 src/…/hermes.py• L341-366 src/…/hermes.py• L706-798 src/…/pi.py• L91-119 src/…/pi.py• L121-203 src/…/pi_extension_contained_tests_source.py• L114-223 src/…/pi_extension_contained_tests_source.py• L257-281 src/…/pi.py• L206-244
Hook payload normalization
Each native hook has a small translation boundary before it reaches the shared Guard evaluator. Cursor maps shell, MCP, and file events to common tool names and keeps observer events separate from blocking events. Claude builds shell-free argv for its daemon and session-start lanes, while Codex and ZCode use the native updatedInput contract only when the host can apply the rewritten command.
Containment support is host-bound. Codex checks the launching binary and version before it relies on updatedInput; ZCode and Claude route only approved native profiles; Pi and Oh My Pi update the host tool input only after they create a bounded, hash-bound request for the native sink. This keeps a review result from being treated as execution proof on a host that cannot enforce the required route.
References: src/…/cursor_hook_payload.py• L11-41 src/…/cursor_hook_script_template_head.py• L497-586 src/…/cursor_hook_script_template_tail.py• L17-54 src/…/cursor_hook_script_template_tail.py• L321-472 src/…/claude_hook_argv.py• L127-219 src/…/codex_contained_tests.py• L49-91 src/…/codex_contained_tests.py• L102-197 src/…/codex_contained_tests_windows.py• L91-118 src/…/zcode_contained_tests.py• L105-144 src/…/zcode_contained_tests.py• L185-294 src/…/pi_extension_contained_tests_source.py• L114-223
Manifest and surface errors
Adapters preserve parse failures instead of silently treating a broken manifest as a valid package. Ecosystem checks turn those failures into findings or an inapplicable result when a surface is absent. This keeps “not present” distinct from “present but unreadable or invalid.”
For example, OpenCode accepts JSONC-style comments and records a parse reason when its config cannot be read. Kimi and DeepSeek Harness also retain manifest error state so their checks can explain why package data is incomplete.
References: src/…/opencode.py• L13-48 src/…/opencode.py• L91-131 src/…/kimi.py• L14-30 src/…/deepseek_harness.py• L12-19 src/…/opencode.py• L32-73
Change checklist
When these files or sections are changed, remember to consider these:
- Add or update the ecosystem enum, default adapter registry, and CLI alias resolution together. A missing registry entry can make a valid adapter unreachable.
- Keep each adapter's component names aligned with the ecosystem check family. A renamed surface can make checks silently inapplicable.
- Keep manifest parse-error states aligned with the related check messages. A reader or parser change must not turn an invalid configuration into an apparently empty package.
- Preserve the ownership of ecosystem policy fields. Claude marketplace
strictvalues belong to plugin entries and must not be collapsed into one marketplace package policy. - Preserve root-bound path handling when adding a new manifest reference or recursive surface. External files must not enter normalized package components.
- When changing a mixed-scan package shape, preserve package-root rebasing and ecosystem labels in
ScanResultandPackageSummaryoutput. - Keep the harness registry, install aliases, protection contracts, and capability-event rows aligned. A contract without a registered adapter or event row can produce inconsistent setup and capability reports.
- Keep capability evidence separate from declared support. Do not turn file presence, a synthetic canary, or stale evidence into a live-block or healthy deployment claim.
- Keep passive registration checks separate from command probes. Global doctor must not start harnesses, and a skipped probe must remain unverified rather than successful.
- Keep trusted executable registration bound to the same path and content identity used at launch. A changed executable or unsafe environment must not become an accepted runtime.
- Keep managed MCP companion detection aligned with both packaged native and Python proxy command forms. Keep observable proxy recovery aligned with server identity and source labels. A matcher or identity change can cause duplicate wrapping, hide a real server, or attach inventory to the wrong source.
- Keep the managed MCP proxy grammar, argument limits, harness binding, source exception, and environment filtering aligned. Discovery may describe a recovered upstream, but it must not turn an unverified proxy claim into an installable server.
- Keep managed hook markers and ownership checks aligned with merge, repair, and uninstall behavior. A changed marker can leave an old Guard hook active or remove a user hook.
- Keep Devin JSONC inventory separate from strict-JSON writes. A parser change must not make install or uninstall rewrite a file whose comments or trailing commas cannot be preserved.
- Keep ZCode legacy-event migration and current nested event storage aligned with the host schema. A misplaced hook can make the whole config unavailable to ZCode.
- Keep ZCode event normalization and policy mapping aligned with its native response rules. Review actions must continue to reach the native prompt rather than becoming terminal denials.
- Keep OpenCode's V1 and V2 registration paths aligned with the shared pre-tool reviewer. A change to one entry point must not leave the other with different tool or workspace behavior.
- Keep Guard runtime adapters separate from package detection. When a harness launch contract changes, preserve the runtime owner, repair path, and review boundary without changing normalized ecosystem surfaces.
- Keep each harness event map aligned with its native response shape and with the bounded-hook failure policy. A new event can otherwise receive the wrong allow, deny, or continue behavior when Guard is unavailable.
- Keep generated hook identity, managed configuration, backup state, and uninstall matching aligned. A changed command or script path can leave an old hook active or make cleanup skip the managed entry.
- Keep internal harness module package names and stable source paths aligned with import, static-analysis, and frozen-package collection rules. Do not add duplicate compatibility paths when relocating a helper.
- Keep Copilot CLI hooks, workspace hooks, MCP target files, authenticated lifecycle state, and per-target backups aligned. A target-selection change can install protection in one surface and restore or remove another.
- Keep Cline's settings path search, local-stdio filter, managed-content hash, and conservative restore rule aligned. A changed path or hash can proxy remote servers or overwrite user edits.
- Keep Hermes skill and MCP source resolution aligned with its managed overlay, config hook, and manifest ownership records. A source change can leave a stale overlay active or remove a user-owned server.
- Keep Codex hook inventory, legacy JSON migration, canonical TOML rendering, and live manifest verification aligned. A migration must preserve unmanaged hooks and refuse conflicting or changed source definitions. Live protection must require enabled hooks and a valid managed manifest.
- Keep Codex daemon authentication, start or fallback behavior, browser approval wait, and the hook deadline as one contract. A bridge that spends its full budget before fallback can turn a recoverable review into a blocked or incomplete tool turn.
- Keep Claude daemon state validation bound to the absolute state file and its Guard home. A path or query change can redirect recovery to another installation or use non-loopback daemon state.
- Keep Codex fallback launcher authentication in the worker-failure path. An authenticated daemon error does not authorize unverified fallback argv or files.
- Keep bounded probe cleanup and result flags aligned across POSIX and Windows. A timed-out or incomplete capture must not be reported as a valid runtime proof.
- Keep host version gates for native containment aligned with the response sink. A host that cannot apply
updatedInputmust keep the denial instead of starting the original command. - Keep Pi's generated source variant, host deadline reserve, daemon compatibility version, and approval or output response contract aligned. A source change can cause Pi to time out or expose output that Guard did not prove.
- Keep Cursor's global hook path, blocking event set, observer event set, managed script identity, and saved MCP origin state aligned. A runtime can appear installed while shell, MCP, or file actions bypass review, or a copied project server can be attributed to the wrong source. Editor installation must continue to target the global configuration while preserving project origin state.
- Keep Hermes
hooks.pre_tool_callregistration paired with its command allowlist. A runtime can appear installed while its enforcement path is not active.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A new ecosystem is added to the enum but not the default adapter registry | Auto detection and the supported-ecosystem list omit it | Keep the enum and registry change together |
| A manifest marker is missing or has the wrong parent directory | No package candidate is produced, or the scan uses a compatibility fallback | Use the ecosystem's exact discovery marker and package root |
| A manifest cannot be parsed or read | The package has incomplete normalized data and the related check reports a failure | Preserve the parse-error reason and surface it through the ecosystem checks |
| A component path escapes the package root or reaches an external symlink | External content could be scanned as package content | Use the safe recursive walkers and root-bound path validation |
| Two markers identify the same package root | Duplicate checks and duplicate findings can appear without candidate de-duplication | De-duplicate by ecosystem and resolved root |
A Claude marketplace strict value is read as a root package policy | Per-plugin policy differences can be lost, or a valid marketplace can be reported as invalid | Keep marketplace strict values in the raw plugins[] entries and validate them there |
| A capability row claims healthy or live-block support without current scoped evidence | A report can claim enforcement for the wrong build, host version, or platform | Validate evidence freshness, scope, witnesses, and compatibility before accepting the claim |
| An unknown requested harness is treated as supported because a name was supplied | Setup or downstream policy can rely on a transport that has no adapter | Return an explicit unsupported capability row and do not mutate the registry |
| Global doctor runs a command probe and treats its result as registration state | A passive health check can start a harness or report runtime readiness that was not verified | Use passive checks for registration and mark skipped probes as unverified |
| A trusted Grok executable is changed, unsafe, or inside a blocked root | Launch is refused or uses no trusted executable | Re-resolve the path and compare its secure file identity and content hash |
| A local MCP server is mistaken for a Guard companion, or a native proxy form is not recognized | Guard can wrap itself twice or fail to manage the intended server | Match the verified companion name and all supported proxy command shapes |
| A proxied MCP server is recovered with the wrong identity or source label | Inventory and listing results can point to the wrong harness or fail to match a stored observation | Keep server identity, connection identity, source labels, and proxy recovery rules aligned |
| A proxy contains an unknown option, duplicate identity field, oversized argument list, or mismatched source | The upstream remains unavailable for inventory, or an untrusted launch description could be treated as a managed server | Accept only the bounded generated grammar and verify the harness, origin, transport, environment, and stable server ID |
| A bounded hook cannot reach the authenticated loopback daemon or exceeds its limits | The harness receives a fail-safe native response, which may deny protected work or leave observation-only events unreviewed | Keep loopback, token, size, timeout, and native-response checks bounded |
| Claude daemon state names another Guard home or a non-loopback host | The bridge cannot use the state for recovery and must deny without a trusted runtime | Require one absolute daemon-state.json path, matching Guard home, authenticated state, and loopback host |
| A daemon worker fails and the bridge runs fallback without launcher validation | An authenticated daemon failure can lead to execution of changed or untrusted fallback files | Authenticate the managed launcher again before start or fallback, then deny on validation failure |
| A generated probe times out, exceeds its output budget, or cannot be reaped | Diagnostics or evaluation can hang, leak child work, or return incomplete evidence | Stop the owned process group or job and report timeout, overflow, or incomplete capture |
| A generated OpenCode or Pi-family adapter selects a missing, transient, or stale Guard runtime | Tool review can fail, or more than one Guard daemon can own the same hook | Resolve a usable runtime and prefer the durable owner for generated extensions |
| An internal harness helper moves without preserving its package identity or a physical-path contract | Imports, frozen builds, or authenticated managed artifacts can fail to find the helper | Keep ordinary package markers and required public paths stable; do not add duplicate search paths |
| A Pi daemon response lacks a valid output proof or reviewed excerpt | Unreviewed tool output can reach the model, or safe output can be blocked | Require a matching output hash or a non-empty reviewed excerpt before preserving content |
| A Cline plugin is present but its managed state or live pre-tool and post-tool proofs are missing | Cline can appear installed without proving blocking or model-visible result mediation | Check managed integrity and fresh proof outcomes before reporting readiness |
| A Cline MCP file changed after Guard installed its proxies | Uninstall can leave the file unchanged, or a stale proxy can remain in use | Restore only when the current content matches the recorded managed hash |
| Copilot CLI and workspace surfaces point to different MCP targets or stale lifecycle state | One Copilot surface can bypass review, or uninstall can restore the wrong file | Bind each target to authenticated state and keep CLI, workspace, hook, backup, and restore paths paired |
| Hermes config is incomplete or its managed overlay, pre-tool file, or hook registration is missing | Skill or MCP review can run without the configured Guard seam, or setup can leave stale entries | Require complete bounded config inspection and verify the overlay, pre-tool file, manifest, and native hook together |
| Devin also loads Guard-managed Claude Code hooks | One event can be attributed twice or receive the wrong harness policy | Detect the overlap and preserve the configured ownership choice |
| A ZCode hook is left in the rejected legacy layout or managed entries are matched incorrectly | ZCode can reject its config, or repair and uninstall can leave stale hooks | Migrate to the current event map and use the shared managed-entry merge rules |
| ZCode receives a review action with a blocking exit code | The native permission prompt is skipped and a review becomes a hard denial | Emit ask in the native envelope and use a successful hook exit for review-tier tool events |
| An OpenCode V2 hook is not registered or does not forward the event to the shared reviewer | OpenCode V2 tool calls can bypass the managed pre-tool review | Keep the explicit execute.before registration paired with the existing plugin entry point |
| Codex migration finds conflicting hook groups or the rendered config fails semantic read-back | Guard leaves the legacy source in place rather than risking a changed hook contract | Require canonical identity checks, preserve a migration backup, and retry only after the sources are reconciled |
| A Codex daemon is unavailable or fails authentication during a hook | A blocking event must not approve work through an untrusted or stale local listener | Verify the daemon, use the trusted start or fallback path, and keep fail-closed responses for protected events |
| A Cursor hook is present but its managed script is missing, disabled, or not attached to a blocking event | Cursor can report an installed integration while shell, MCP, or file actions bypass runtime review | Check live managed hook identity and require all blocking event routes |
| Cursor's global MCP proxy claims a project origin without matching saved Guard state | Inventory can attach a server to the wrong workspace, or install can wrap a proxy instead of its upstream | Accept copied origins only when the managed state and Guard home match the installed global configuration |
| Pi's generated extension exceeds the host hook deadline or uses an incompatible daemon response | Pi can time out a review or continue without a valid approval or output proof | Keep the source variant budgets below the host limit and require compatible daemon, hash, or excerpt evidence |
| A native containment route targets a host or profile that cannot apply the rewritten input | The host may run the original command outside the required sink | Check host support and keep the denial when the required native route is unavailable |
| Hermes configuration or its command allowlist is malformed or incomplete | The pre-tool hook is not active, so protection is limited to launch review | Parse the full bounded file and require the exact event and command pair |
Key files
| File | Why to read it |
|---|---|
| src/…/registry.py | Shows the supported package ecosystems and name resolution rules. |
| src/…/detect.py | Shows how auto detection combines and de-duplicates adapter results. |
| src/…/base.py | Defines the adapter boundary and safe repository traversal behavior. |
| src/…/types.py | Defines candidate and normalized package identities. |
| src/…/claude.py | Illustrates an adapter that maps plugin, marketplace, skill, hook, and MCP surfaces while keeping marketplace policy per plugin. |
| src/…/kimi.py | Illustrates manifest-declared component paths and local MCP file discovery. |
| src/…/opencode.py | Illustrates workspace detection and tolerant JSON/JSONC config handling. |
| src/…/__init__.py | Shows the runtime harness registry and alias resolution boundary. |
| src/…/base.py | Shows shared harness context, owned install mutations, detection diagnostics, and the distinction between passive checks and command probes. |
| src/…/diagnostic_probes.py | Shows how global doctor suppresses optional subprocess probes without suppressing registration checks. |
| src/…/contracts.py | Defines harness protection contracts and per-event capability declarations. |
| src/…/contract_models.py | Defines the stable capability row and report data shape. |
| src/…/capability_report.py | Validates capability evidence and renders machine and human reports without turning declarations into live claims. |
| src/…/README.md | Defines the package layout and stable path rules for internal harness modules. |
| src/…/bounded_cli_hook_daemon.py | Shows the authenticated loopback daemon path and native response conversion. |
| src/…/bounded_cli_hook_script_template.py | Shows the bounded fallback hook, event normalization, and harness-specific failure behavior. |
| src/…/claude_hook_argv.py | Shows shell-free Claude hook, daemon bridge, and session-start command contracts. |
| src/…/claude_daemon_hook_bridge.py | Shows the Claude compatibility bridge and native runtime handoff. |
| src/…/claude_daemon_state.py | Shows Claude daemon state path, Guard-home binding, authentication, and loopback validation. |
| src/…/claude_daemon_hook_bridge_flow.py | Shows daemon retry, launcher authentication, and bounded fallback selection. |
| src/…/hook_python_subprocess.py | Shows bounded cross-platform process probes and cleanup results. |
| src/…/hook_python.py | Shows how persisted hooks bind to the active Guard interpreter and package identity. |
| src/…/grok_executable.py | Shows trusted Grok executable discovery, registration, and launch environment filtering. |
| src/…/mcp_servers.py | Shows MCP server identity, managed stdio extraction, proxy recognition, environment filtering, and observation-only upstream recovery. |
| src/…/managed_mcp_upstream.py | Defines the bounded proxy grammar used to recover an upstream MCP launch without granting execution authority. |
| src/…/harness_mcp_discovery.py | Shows how configured stdio and remote MCP servers are observed, de-duplicated, labeled by harness, and persisted for inventory without probing them during discovery. |
| src/…/codex.py | Shows Codex global and project detection, hook inventory, legacy migration, authoritative native hook state, and MCP proxy observation. |
| src/…/cline_plugin.py | Shows the Cline plugin transport for pre-tool blocking and post-tool result mediation. |
| src/…/cline_mcp.py | Shows Cline MCP path discovery, local-server proxying, redacted observations, and conservative restoration. |
| src/…/copilot.py | Shows Copilot CLI and workspace hook discovery, MCP target selection, lifecycle state, and managed restoration. |
| src/…/cursor.py | Shows Cursor MCP detection, project-origin state, editor and CLI surface separation, and global editor installation. |
| src/…/cursor_hooks.py | Shows global Cursor hook installation, generated script identity, backups, managed state, and live protection verification. |
| src/…/cursor_hook_payload.py | Shows the small native payload and policy translation boundary used by Cursor hooks. |
| src/…/cursor_hook_script_template_head.py | Shows Cursor event inference and normalization before daemon or fallback review. |
| src/…/cursor_hook_script_template_tail.py | Shows Cursor permission mapping, observer proof, and fail-safe response behavior. |
| src/…/hermes.py | Shows Hermes skill and MCP discovery, managed overlay generation, config hook registration, and lifecycle ownership. |
| src/…/devin.py | Shows Devin detection, managed hook setup, and user-config preservation. |
| src/…/devin_config.py | Shows Devin JSONC reading and extraction of hooks, MCP servers, and skills. |
| src/…/hook_group_merge.py | Shows the shared ownership rules for adding, refreshing, and removing managed hook entries. |
| src/…/zcode.py | Shows ZCode surface detection and current hook-layout migration. |
| src/…/zcode_hooks.py | Shows ZCode hook payload normalization and the mapping from Guard decisions to native permission responses. |
| src/…/zcode_contained_tests.py | Shows the native contained-test request and updated-input route for ZCode-family hooks. |
| src/…/opencode_pretool.py | Shows the separate runtime adapter that keeps OpenCode tool review connected to Guard. |
| src/…/opencode_v2_entrypoint.py | Shows the OpenCode V2 hook registration that shares the managed pre-tool review path. |
| src/…/pi_extension_runtime_ownership.py | Shows how generated Pi-family extensions select a durable Guard runtime owner. |
| src/…/pi_extension_source.py | Shows the active generated Pi extension source variant and its deadline, daemon, recovery, approval, and reviewed-output contract. |
| src/…/pi_extension_contained_tests_source.py | Shows how Pi and Oh My Pi route supported contained work through a bounded native sink. |
| src/…/pi.py | Shows how Pi and Oh My Pi install, enable, verify, and remove managed extensions. |
| src/…/codex_contained_tests.py | Shows Codex process and version checks before the native updatedInput route. |
| src/…/codex_contained_tests_windows.py | Shows the Windows parent-process check used by Codex containment. |
| src/…/scanner.py | Shows fallback selection, ecosystem check dispatch, and mixed-package reporting. |