Feature request: enforced output styles (mechanical validation of outputStyle, not just prompt injection)

Status Open
Maintainer reply None cached
Activity 0 comments · opened Sep 4, 2026

Problem

outputStyle injects style rules into the system prompt, but adherence is probabilistic. With a custom style (Simplified Technical English + strict brevity), the model drifts reliably in long, tool-heavy turns: headers creep back in, sentences run long, replies sprawl. The rules are in the system prompt, re-injected every turn via a UserPromptSubmit hook, and it still drifts. Reminding the model more does not converge.

What we built as a workaround

Three layers, all in user settings:

  1. outputStyle with the custom style (system prompt injection).
  2. A UserPromptSubmit hook re-injecting the rules each turn, now with a good/bad exemplar pair, plus a PostToolUse nudge for long tool-heavy turns where the turn-start reminder is thousands of tokens back.
  3. A Stop hook running a Python validator against the last assistant message: it blocks the stop with {"decision": "block"} when it finds markdown headings, tables, bold-only pseudo-headings, more than N prose lines, or 3+ sentences over 25 words, forcing one rewrite (guarded by stop_hook_active).

This works, but it costs an extra generation per violation, and every user who wants a reliable style has to reinvent the validator.

Request

First-class support for validated output styles. Ideas, in increasing ambition:

  1. Let an output style declare mechanical constraints (max prose lines, max sentence length, forbidden markdown constructs) that Claude Code validates post-generation, with automatic single-retry - essentially productizing the Stop-hook pattern.
  2. Ship a "brief" / "STE" style with such constraints built in, since terse, low-ceremony output is a common ask.
  3. Longer term: an API-level response-shape parameter, so style survives outside Claude Code. I understand system prompts are the intended mechanism; the gap is enforcement, not expression.

Environment

Claude Code with a global custom output style; behavior consistent across models and sessions over multiple weeks.

View original on GitHub ↗