feature: SubagentStart hook should support updatedPrompt for direct prompt injection
Resolved 💬 3 comments Opened Feb 7, 2026 by shuhei0866 Closed Feb 10, 2026
Summary
Current limitation: SubagentStart hook only supports additionalContext output. This limits the ability to inject critical rules directly into the subagent's system prompt.
Use Case
learning_with project has 223+ sessions with high-friction errors (59+ instances of wrong_approach). Root cause: Rules exist in CLAUDE.md but subagents don't read them consistently.
To solve this, we need to inject mandatory rules (TDD, worktree enforcement, review steps) directly into subagent prompts at startup time.
Problem with Current additionalContext
- additionalContext appends to user context, not system prompt
- During context pruning, critical rules may be dropped
- Subagents still need to discover and interpret rules from CLAUDE.md
Proposed Solution
Extend SubagentStart hook output to support:
{
"hookSpecificOutput": {
"updatedPrompt": "[prepend instruction: TDD is mandatory...]",
"additionalContext": "[optional context]"
}
}
This ensures critical rules survive context compression and are immediately actionable.
Data
- Friction events analyzed: 223 sessions, 287 Task invocations
- Rule non-compliance rate: ~60% on WT rules, ~40% on review steps
- Current workaround: Duplicate rules in SubagentStart additionalContext (verbose, fragile)
Implementation Notes
updatedPromptwould prepend to the base agent prompt- Rules injection pattern: use feature flags/sections markers for rule discovery
- Backwards compatible: only used if explicitly returned
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗