Surface LLM reasoning in hook output for YELLOW/RED decisions #5

Open
opened 2026-04-09 13:38:16 +00:00 by jbr870 · 0 comments
Owner

Summary

When the LLM scores a tool call as YELLOW or RED, the reasoning is logged to audit.jsonl but not shown to the user. The user sees only a generic permission dialog (YELLOW) or silent denial (RED) with no explanation.

User Stories Served

  • US-5: See LLM reasoning at decision time, not buried in a log file

Proposed Change

The Claude Code hook protocol supports a message field in the JSON response. Currently claude-permit only returns decision and optionally reason. Add the LLM reasoning to the response:

For RED (deny):

{
  "decision": "deny",
  "reason": "LLM safety evaluation: RED — This command attempts to delete system files. Risk: data loss, system instability."
}

For YELLOW (ask user):
The PermissionRequest hook could include the LLM reasoning in its passthrough, so Claude Code's permission dialog shows context.

Considerations

  • Keep messages concise — the LLM reasoning can be verbose
  • RED messages should be actionable: explain what triggered it and hint at how to override (e.g., "add an allow rule for this pattern")
  • YELLOW is trickier — the user sees Claude Code's standard permission dialog, and we can't inject text into it. May need to print to stderr as a notification.
## Summary When the LLM scores a tool call as YELLOW or RED, the reasoning is logged to audit.jsonl but not shown to the user. The user sees only a generic permission dialog (YELLOW) or silent denial (RED) with no explanation. ## User Stories Served - **US-5:** See LLM reasoning at decision time, not buried in a log file ## Proposed Change The Claude Code hook protocol supports a `message` field in the JSON response. Currently claude-permit only returns `decision` and optionally `reason`. Add the LLM reasoning to the response: **For RED (deny):** ```json { "decision": "deny", "reason": "LLM safety evaluation: RED — This command attempts to delete system files. Risk: data loss, system instability." } ``` **For YELLOW (ask user):** The PermissionRequest hook could include the LLM reasoning in its passthrough, so Claude Code's permission dialog shows context. ## Considerations - Keep messages concise — the LLM reasoning can be verbose - RED messages should be actionable: explain what triggered it and hint at how to override (e.g., "add an allow rule for this pattern") - YELLOW is trickier — the user sees Claude Code's standard permission dialog, and we can't inject text into it. May need to print to stderr as a notification.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jbr870/claude-permit#5
No description provided.