Repository navigation
Tracking: Q2 2026 prompt-quality roadmap (research synthesis) #26
Description
Summary
Tracking issue for the Q2 2026 work on prompt-improver. Re-scoped May 2026 after a lens-driven re-evaluation — see the "Closed sub-issues" section at the bottom for what was dropped and why.
The original framing was: "Current detection fires only on clarity (vague vs. clear). The research suggests there is a wider set of failure modes worth catching." After implementing #29 as a prototype and then unshipping it (commit history + #29 close comment), that framing is now contested. The lens we now apply:
The plugin's stated philosophy is "rarely intervene, trust user intent." Surface-form detection of antipatterns (regex/keyword classifiers in the hook) pre-empts the wrapper's context-aware judgment. The eval wrapper + skill, with conversation history and CLAUDE.md, already handle clarity correctly. Pre-emptive intervention based on prompt text alone produces false positives whose cost (broken flow, eroded trust) exceeds the marginal token savings.
This rules out the entire "detect X in prompt → intervene" family. What survives the lens are infrastructure/architectural features that operate on signals the wrapper genuinely can't reach.
Token efficiency principles (binding on all surviving sub-issues)
The hook runs on every prompt submission. Every byte injected counts. All surviving sub-issues must conform to:
- Eval wrapper baseline: ~300 tokens today; no sub-issue may regress this
- Per-feature injection cap: any single nudge / guardrail / hint ≤80 tokens
- Conditional injection only — features add zero tokens when they don't fire
- Skill loads only on non-clear classification — clear prompts must not load the skill or its references
- No new dependencies — Python stdlib only; no imports outside
json,sys,re,pathlib - No network calls in hooks — hooks must complete in <100ms
| Path | Today's cost | Cap |
|---|---|---|
Bypass (*///#) |
prompt only | unchanged |
| Clear prompt | ~300 tok wrapper | ≤300 tok |
| Vague → skill | wrapper + skill load | unchanged |
| PreCompact (#27) | n/a | ≤200 tok injected post-compaction |
| Stop hook (#28) | n/a | ≤60 tok, only on detected scope expansion |
Surviving sub-issues
These passed the lens — they address signals the wrapper cannot see, or are pure cleanup/efficiency improvements:
| # | Title | Why it survived |
|---|---|---|
| #17 | Simplify hook output from JSON to plain text | Pure refactor/cleanup. Reduces failure modes; doesn't add intervention. |
| #18 | Route skill research through Explore subagents | Token-efficiency on the skill path only. Doesn't intervene more, just makes existing intervention cheaper. |
| #27 | PreCompact hook to preserve goal + constraints | Operates on a signal the wrapper genuinely can't reach (post-compaction context loss). Fires only on compaction, not every prompt. |
| #28 | Stop hook to detect unauthorized scope expansion | Post-hoc transparent review, not pre-emptive intervention. Compares prompt-scope vs. files-touched. Needs careful "meaningfully larger" definition — see scope-narrowing comment on #28. |
| #32 | Track upstream updatedPrompt for UserPromptSubmit |
Passive tracking, zero cost. Real upstream signal. |
| #8 | (rescope) Encourage parallel research in skill | Trim to just parallel research; XML/GOLDEN/budget-awareness pieces dropped. See scope-narrowing comment on #8. |
Suggested implementation order
- Simplify hook output from JSON to plain text #17 hook output simplification — lowest risk, removes failure modes, unblocks future work
- Add PreCompact hook to preserve original goal and hard constraints #27 PreCompact hook — addresses the highest-impact failure mode that only the hook layer can address
- Add Stop hook to detect unauthorized scope expansion #28 Stop hook scope audit — once "meaningfully larger" is defined; observational, non-blocking
- Route all skill research through Explore subagents #18 Explore-routed research — token efficiency on skill path
- Track upstream
updatedPromptfor UserPromptSubmit (anthropics/claude-code#27365) #32 upstream tracker — passive watch; revisit whenupdatedPromptships - Enhance eval wrapper with XML structure, parallel research, token budget awareness, and GOLDEN framework #8 (rescoped) parallel research — additive improvement to skill path
Closed sub-issues (lens-driven re-evaluation, May 2026)
The following sub-issues all proposed surface-form detection that pre-empts the wrapper's context-aware judgment. Each was closed as not-planned with issue-specific rationale. Common failure modes:
- Duplicates wrapper logic. The wrapper + skill already handle these cases when given conversation context.
- False positives erode trust. Keyword/regex detection of "vagueness" / "scope creep" / "contradiction" / "destructive intent" produces false fires on legitimate prompts.
- Wrong layer. Several proposed prompt-text safety checks duplicate Claude Code's tool-layer enforcement (which is enforceable, not advisory).
- Anthropic's own guidance says vagueness isn't always bad — exploratory prompts can be valuable.
| # | Closed because |
|---|---|
| #19 task-decomposer | Multi-verb prompts are often legit batched work; surface-form can't distinguish sequential/parallel/compound. |
| #20 scope-definer | Near-identical to the unbounded category we proved unproductive in #29. |
| #21 safety-check | Wrong layer — Claude Code's tool layer already gates destructive operations. |
| #22 constraint-elicitor | Identical to architectural category we rejected in #29. Wrapper handles. |
| #23 conflict-resolver | Wrapper + CLAUDE.md context already let Claude surface conflicts; keyword detection too fragile. |
| #24 fresh-start-advisor | Detection signal too noisy (legit corrections look identical); recommended remedy (/clear) is itself destructive. |
| #29 antipattern phrase pre-filter | Implemented as a prototype, then unshipped. The lens that emerged from this exercise is what triggered the broader re-evaluation. |
| #30 silent scope-creep guardrail | Fires on every clear action-verb prompt = constant overhead; regresses the "zero overhead for clear" property. |
| #31 plan-mode nudge | Keyword-based blast-radius detection too fragile; plan mode is already user-driven. |
| #33 subagent over-spawn | Hook fires before Claude decides to spawn; classification can't substitute for context-aware judgment. |
Relevant new Claude Code features (Jan–May 2026)
Still informative for the surviving roadmap:
| Feature | Version | Why it matters |
|---|---|---|
| PreCompact hooks | v2.1.105 (Apr 13) | Enables #27 — preserve original prompt + constraints across compaction |
| Stop hook reliability fixes | v2.1.126 (May 1) | Makes #28 viable for verification work |
updatedPrompt for UserPromptSubmit |
upstream anthropics/claude-code#27365 | If shipped, would simplify the hook architecture (#32 tracks) |
Design constraints (binding)
- Rarely intervene — most prompts pass through unchanged
- Trust user intent — only ask when genuinely unclear
- Bypass prefixes preserved —
*,/,# - Hook stays minimal — runs on every prompt submission; no heavy imports or network calls
- Token budgets binding — see table above
- The wrapper + skill is sufficient for clarity detection. Don't add parallel detection mechanisms in the hook.
References
- Claude Code changelog: https://code.claude.com/docs/en/changelog.md
- Hook reference: https://code.claude.com/docs/en/hooks
- Best practices: https://code.claude.com/docs/en/best-practices
- Anthropic prompting best practices: https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices
- Prompt defects taxonomy (arxiv): https://arxiv.org/html/2509.14404v1
- Upstream feature request: Feature Request: Add
updatedPromptsupport toUserPromptSubmithook anthropics/claude-code#27365
Activity