claude-code - 💡(How to fix) Fix [FEATURE] Allow additionalContext to specify a /context category [1 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#54718Fetched 2026-04-30 06:37:57
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

Code Example

{
  "additionalContext": ["...policy text..."],
  "additionalContextCategory": "Hook: coding-policy"
}
RAW_BUFFERClick to expand / collapse

Hook-injected additionalContext disappears into the "Messages" bucket in /context. There's no way to see how much context your hooks are consuming vs. actual conversation.

Proposal: Add an optional category field to additionalContext entries. When present, /context displays those tokens as a named category instead of folding them into Messages.

{
  "additionalContext": ["...policy text..."],
  "additionalContextCategory": "Hook: coding-policy"
}

Message normalization presumably flattens hook attachments into plain user messages today, so the category would need to survive that step.

Related to #19891 but much narrower in scope — just a category label, not a richer context management system.

extent analysis

TL;DR

Adding an optional category field to additionalContext entries may help distinguish hook-injected context from actual conversation in the /context display.

Guidance

  • Introduce a new field, additionalContextCategory, to categorize additionalContext entries, allowing for separate display in /context.
  • Ensure message normalization preserves the category field when flattening hook attachments into plain user messages.
  • Update the /context display logic to show categorized additionalContext entries separately from the "Messages" bucket.
  • Consider the potential impact on existing conversation handling and context management systems.

Example

{
  "additionalContext": ["...policy text..."],
  "additionalContextCategory": "Hook: coding-policy"
}

Notes

This solution assumes that the proposed category field can be successfully integrated into the existing message normalization and /context display logic.

Recommendation

Apply workaround: Introduce the additionalContextCategory field to provide a clear distinction between hook-injected context and actual conversation, as this is a narrower and more targeted solution compared to a full context management system.

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

claude-code - 💡(How to fix) Fix [FEATURE] Allow additionalContext to specify a /context category [1 participants]