/plugin command silently drops 'prompt' field from agent-type SessionEnd hooks

Resolved 💬 3 comments Opened Mar 10, 2026 by gbing-bloom Closed Mar 13, 2026

Bug Description

Running /plugin to install a plugin from the marketplace silently strips the prompt field from "type": "agent" hooks in settings.json. This is a lossy read-modify-write round-trip bug — the settings serializer doesn't preserve all fields on agent-type hooks.

Steps to Reproduce

  1. Add a SessionEnd hook with an agent-type entry that includes a prompt field:
{
  "hooks": {
    "SessionEnd": [
      {
        "matcher": "prompt_input_exit",
        "hooks": [
          {
            "type": "agent",
            "prompt": "You are a memory management agent. Do useful things on session end...",
            "timeout": 60
          }
        ]
      }
    ]
  }
}
  1. Run /plugin and install any plugin (e.g., code-review@claude-plugins-official)
  1. Observe that settings.json now has the hook entry without the prompt field:
{
  "type": "agent",
  "timeout": 60
}

The prompt text is silently dropped with no warning.

Expected Behavior

The /plugin command should only modify the enabledPlugins key and preserve all other fields in settings.json exactly as they were, including prompt fields on agent-type hooks.

Actual Behavior

The read → parse → modify → serialize → write cycle strips the prompt field from agent-type hooks. The internal schema/type definition likely doesn't include prompt as a known property on agent hooks, so it gets dropped during serialization.

Impact

This silently breaks user-configured SessionEnd automations (e.g., memory management agents, journal agents) with no indication that data was lost. The user only discovers the problem when their end-of-session hooks stop working as expected.

Environment

  • Claude Code CLI (latest as of March 9, 2026)
  • macOS (Darwin 25.2.0)

File History Evidence

The built-in file-history mechanism (~/.claude/file-history/) confirmed:

  • v1 (before /plugin): prompt fields present on both SessionEnd agent hooks
  • v2 (after first /plugin adding a UserPromptSubmit hook): prompt fields still present
  • Current (after second /plugin adding code-review to enabledPlugins): prompt fields gone

So the lossy round-trip specifically occurs when /plugin modifies the enabledPlugins object.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗