claude-code - 💡(How to fix) Fix feat: support dynamic statusMessage interpolation for hooks [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45398Fetched 2026-04-09 08:06:20
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Fix Action

Fix / Workaround

Workaround attempted

We consolidated 3 PostToolUse hooks into 1 dispatcher to reduce the number of entries (3→1 per tool call). This helps but doesn't solve the readability problem — each entry still shows a generic static message.

Consolidated 3 PostToolUse hooks into 1 dispatcher script to reduce the number of UI entries from 3 to 1 per tool call. This reduces noise by 50% but each entry still shows a static generic message — the user still can't tell which file triggered which hook.

Code Example

{
  "matcher": "Read|Write|Edit|Agent",
  "hooks": [{
    "type": "command",
    "command": "/path/to/hook.sh",
    "statusMessage": "Processing..."
  }]
}

---

- After tool use: Edit"Processing..."
- After tool use: Edit"Processing..."
- After tool use: Edit"Processing..."

---

{
  "statusMessage": "Processing: {{tool_input.file_path}}"
}

---

- After tool use: Edit"Processing: src/Controller/VehicleController.php"
- After tool use: Edit"Processing: .claude/settings.json"
- After tool use: Edit"Processing: backend/config/routes.yaml"
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

feat: support dynamic statusMessage interpolation for hooks


Problem

Hook statusMessage in .claude/settings.json is a static string. When hooks fire on tool calls, the activity log shows repeated generic labels like "After tool use: Edit" with no indication of which file is being processed or what the hook is doing.

In a typical session with 30+ tool calls, this produces 60-100 identical entries that provide no useful feedback to the user.

Current behavior

{
  "matcher": "Read|Write|Edit|Agent",
  "hooks": [{
    "type": "command",
    "command": "/path/to/hook.sh",
    "statusMessage": "Processing..."
  }]
}

Activity log shows:

- After tool use: Edit    → "Processing..."
- After tool use: Edit    → "Processing..."
- After tool use: Edit    → "Processing..."

No way to tell which file or what action each entry corresponds to.

Desired behavior

Allow statusMessage to interpolate variables from the hook context:

{
  "statusMessage": "Processing: {{tool_input.file_path}}"
}

Activity log would then show:

- After tool use: Edit    → "Processing: src/Controller/VehicleController.php"
- After tool use: Edit    → "Processing: .claude/settings.json"
- After tool use: Edit    → "Processing: backend/config/routes.yaml"

Proposed API

Support {{variable}} interpolation in statusMessage with access to the same context available to the hook script via stdin:

VariableExample value
{{tool_name}}Edit
{{tool_input.file_path}}src/Entity/Vehicle.php
{{tool_input.command}}git push origin main
{{tool_input.pattern}}*.tsx
{{tool_input.description}}Search for patterns

Fallback: if the variable is not present in the context, replace with empty string (so "{{tool_input.file_path}}" on a Bash call just shows blank, not a literal {{...}}).

Workaround attempted

We consolidated 3 PostToolUse hooks into 1 dispatcher to reduce the number of entries (3→1 per tool call). This helps but doesn't solve the readability problem — each entry still shows a generic static message.

Environment

  • Claude Code web (claude.ai/code)
  • Hooks: PreToolUse + PostToolUse with matchers for Edit|Write|Read|Bash
  • Typical session: 30-50 tool calls → 60-100 hook activity entries

Proposed Solution

Allow statusMessage to support {{variable}} interpolation using the same context object that hooks receive via stdin.

Configuration:

{ "statusMessage": "Processing: {{tool_input.file_path}}" }

Available variables:

Variable Example {{tool_name}} Edit {{tool_input.file_path}} src/Entity/Vehicle.php {{tool_input.command}} git push origin main Fallback: If a variable is not present in the context, replace with empty string.

Alternative Solutions

Consolidated 3 PostToolUse hooks into 1 dispatcher script to reduce the number of UI entries from 3 to 1 per tool call. This reduces noise by 50% but each entry still shows a static generic message — the user still can't tell which file triggered which hook.

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

I'm building a Symfony app with 20+ workflow hooks (pre-edit gates, auto-evidence tracking, status line generation) I use Claude Code web (claude.ai/code) and the activity log shows 60-100 entries per session Every entry says "After tool use: Edit" with statusMessage "Processing..." — all identical With dynamic interpolation, I'd see "Processing: src/Controller/VehicleController.php" and instantly know what each hook invocation corresponds to This would save me from expanding each entry individually to understand what happened

Additional Context

No response

extent analysis

TL;DR

Implementing dynamic statusMessage interpolation for hooks using {{variable}} syntax would allow for more informative activity log entries.

Guidance

  • Review the proposed API for {{variable}} interpolation in statusMessage to understand the available variables and their example values.
  • Consider the fallback behavior where if a variable is not present in the context, it is replaced with an empty string.
  • Evaluate the impact of consolidating multiple hooks into a single dispatcher script on reducing the number of activity log entries.
  • Assess the priority and feature category of this request to determine the urgency and scope of the implementation.

Example

{
  "statusMessage": "Processing: {{tool_input.file_path}}"
}

This example demonstrates how the statusMessage could be configured to display the file path being processed.

Notes

The implementation of dynamic statusMessage interpolation would require updates to the hook processing logic to support the {{variable}} syntax and access to the hook context via stdin.

Recommendation

Apply the proposed solution to allow statusMessage to support {{variable}} interpolation using the same context object that hooks receive via stdin, as it would provide more informative activity log entries and improve the overall user experience.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING