Skip to content

Add automatic permission hook installation for all supported clients #1982

Open

Description

@mickdarling

Summary

We need true automatic permission-hook installation for every client we claim to support in the Setup flow, not just Claude Code.

Today, the backend permission evaluator can format decisions for multiple platforms, but only the Claude Code install path is verified and auto-wired. The remaining clients need real host-level integration research, implementation, and regression coverage before we can honestly say permissions are automatically enforced there.

Current state

Verified and implemented

  • claude-code
    • automatic hook install and settings merge implemented
    • hook marker written
    • install path tested
    • enforcement path verified

Backend response support exists, but auto-install is not yet implemented/verified

  • cursor
  • windsurf
  • gemini-cli
  • codex

Why this matters

Users expect that if they install DollhouseMCP from the Setup tab and activate a policy-bearing element, permission enforcement will actually be wired. Right now that expectation is only safe for Claude Code.

For the remaining clients, we need to avoid both failure modes:

  • pretending support exists when no hook is really installed
  • writing guessed or incorrect config into a user's host settings

Required work

1. Per-client hook integration research

For each platform below, verify from real installs and/or official docs:

  • settings/config file location
  • hook/pre-tool interception support
  • exact config schema
  • whether command hooks are global or workspace-local
  • merge/idempotency behavior
  • platform-specific constraints on shell commands and env vars

Platforms:

  • cursor
  • windsurf
  • gemini-cli
  • codex

2. Hook script strategy

Decide per client whether we can:

  • reuse one canonical script under ~/.dollhouse/hooks/
  • or need thin per-platform wrapper scripts that only change payload shape / platform name

At minimum verify:

  • correct platform value sent to /api/evaluate_permission
  • session_id forwarding
  • fail-open behavior when the permission server is unavailable
  • correct output contract for that host

3. Installer implementation

Extend the installer so each supported client gets:

  • hook script deployment into ~/.dollhouse/hooks/
  • executable permissions where needed
  • host settings merge without clobbering existing config
  • backup of modified settings file when appropriate
  • idempotent re-run behavior
  • marker/telemetry so activation and UI can report whether enforcement is actually wired

4. Setup/UI honesty

Until a client is fully verified, Setup and activation flows should say so explicitly.

When support is complete, the Setup flow should surface:

  • supported + configured
  • supported but manual steps required
  • unsupported / not yet implemented

5. Regression coverage

Add tests for:

  • config merge/idempotency per client
  • existing hooks preserved
  • repeated install does not duplicate entries
  • correct hook command/script path written
  • unsupported client paths fail honestly
  • permission hook marker/status reporting

6. Real validation matrix

We should validate against actual client installs where possible:

  • local validation for CLI clients (claude-code, codex, gemini-cli)
  • local validation for desktop/editor clients (cursor, windsurf) if hooks are user-level features there
  • optional containerized file-merge tests for repeatability, but do not rely on Docker alone to prove GUI/editor hook behavior

Acceptance criteria

  • Every client listed in the Setup flow is classified as one of:
    • fully auto-wired and verified
    • supported with explicit manual instructions
    • unsupported / not yet implemented
  • No client is presented as automatically enforced unless the hook path is actually installed and verified
  • Re-running install is safe and idempotent for every supported client
  • Each verified client has regression tests for config merge + install behavior
  • Permissions activation/reporting stays honest about whether enforcement is really active

Related

Activity

  1. mickdarling commented on Apr 14, 2026

    @mickdarling
    MemberAuthor

    Investigation notes from upstream docs/source review:

    Verified native hook surfaces

    Claude Code

    Official Anthropic docs clearly support PreToolUse hooks in ~/.claude/settings.json, project settings, and enterprise-managed settings, with command hooks and explicit allow/deny/ask decisions.
    Source: https://docs.anthropic.com/en/docs/claude-code/hooks

    Gemini CLI

    Official Gemini CLI docs clearly support hooks in settings.json, including BeforeTool, AfterTool, and other lifecycle events. User config path is ~/.gemini/settings.json; project config path is .gemini/settings.json.
    Sources:

    Implication: Gemini should move out of the "unverified" bucket. We now have a real documented native hook path.

    Windsurf

    Official Windsurf docs clearly support native shell-command hooks via hooks.json at system, user, and workspace scopes.
    Documented user path for the Windsurf IDE is ~/.codeium/windsurf/hooks.json.
    Documented pre-hook events include:

    Important nuance: Windsurf's hook contract is not the same as Claude/Gemini. It uses event-specific JSON input under tool_info and blocking via exit code 2 / stderr, not the same decision JSON shape we currently use. So Windsurf likely needs a dedicated adapter script + config writer, not just the current generic bridge.

    Cline

    Official Cline docs clearly support hooks, including PreToolUse, with global hooks under ~/Documents/Cline/Hooks/ and project hooks under .clinerules/hooks/.
    Sources:

    Cline was not in the original #1982 scope, but it now looks like a real candidate for native integration.

    No verified native hook path found in this pass

    Cursor

    I found official Cursor docs for MCP install/deeplinks and for Cursor CLI permission configuration (~/.cursor/cli-config.json / project .cursor/cli.json), but I did not find official documentation for a custom pre-tool/pre-command hook system equivalent to Claude/Gemini/Windsurf/Cline.
    Sources:

    • Cursor MCP docs / deeplink install docs
    • Cursor CLI permissions docs

    Implication: do not treat Cursor as having a verified native hook path yet.

    Claude Desktop

    I did not find an official native hook system for Claude Desktop in this pass. Anthropic's documented hook surface is for Claude Code, not Claude Desktop.

    VS Code

    No verified native hook surface found in this pass.

    LM Studio

    I found LM Studio docs for the app and MCP, but no documented native hook/pre-tool extension point in this pass.

    Codex status: internal signals exist, public user path still unclear

    The openai/codex repo clearly contains internal hook/runtime code and config flags such as codex_hooks and request_permissions_tool, and the config schema includes a request_permissions_tool feature flag.
    Sources:

    However, I did not find a clear user-facing documented hook configuration path equivalent to Claude Code / Gemini / Windsurf / Cline. So Codex should still be treated as unverified for automatic native hook installation until we inspect/test it directly.

    Recommended next move for #1982

    Split the native-hook work into buckets:

    Ready for documented-native integration work

    • gemini-cli
    • windsurf
    • cline (if we want to expand supported clients)

    Keep in investigation / not yet verified

    • cursor
    • codex

    Likely fallback-only candidates unless docs emerge

    • claude-desktop
    • vscode
    • lmstudio

    And separately evaluate #1989 for the clients in the latter two buckets.

  2. mickdarling commented on Apr 15, 2026

    @mickdarling
    MemberAuthor

    Present platform matrix after the recent permission-hook work on develop:

    • Claude Code: fully verified native permission path
    • Codex: partial native path (Bash-only)
    • Gemini CLI: partial native path
    • Cursor: partial native path
    • Windsurf: partial native path
    • VS Code: partial native path
    • LM Studio: one-click MCP setup path, but not a verified native hook path
    • Cline: MCP setup path corrected, but native hook automation/runtime verification still incomplete

    What is done now:

    • standard Setup auto-wires verified permission hooks where we know how
    • per-platform hook assets/adapters exist for the currently supported native/partial-native clients
    • Claude Code hook response-shape mismatch is fixed

    Main remaining gaps:

    • end-to-end runtime verification for the partial-native platforms, especially Cursor and Cline
    • deciding whether Gemini/Cursor/Windsurf/VS Code should remain labeled partial or be promoted
    • fallback/plugin/API paths for non-native-hook platforms like Claude Desktop, LM Studio, and Ollama

    So this issue should stay open as the umbrella for the remaining full support matrix / verification work, while #1988 can be closed as completed behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions