/plugin command silently drops 'prompt' field from agent-type SessionEnd hooks
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
- Add a
SessionEndhook with an agent-type entry that includes apromptfield:
{
"hooks": {
"SessionEnd": [
{
"matcher": "prompt_input_exit",
"hooks": [
{
"type": "agent",
"prompt": "You are a memory management agent. Do useful things on session end...",
"timeout": 60
}
]
}
]
}
}
- Run
/pluginand install any plugin (e.g.,code-review@claude-plugins-official)
- Observe that
settings.jsonnow has the hook entry without thepromptfield:
{
"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):promptfields present on both SessionEnd agent hooks - v2 (after first
/pluginadding a UserPromptSubmit hook):promptfields still present - Current (after second
/pluginaddingcode-reviewto enabledPlugins):promptfields gone
So the lossy round-trip specifically occurs when /plugin modifies the enabledPlugins object.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗