When configuring generative AI for code-review workflows, keep prompts and model behaviors tightly bounded to control latency/cost while preserving quality.
Apply these rules: 1) Constrain prompt instructions and outputs
Example (prompt constraint):
# Prefer a short, bounded requirement for summaries
todo_summary: str = Field(
description="Up to 6 words summarizing the functional areas of TODO comments found in the code. Return 'No' if none."
)
2) Cap extended thinking / generation budgets
Example (token caps):
enable_claude_extended_thinking = false
extended_thinking_budget_tokens = 2048
extended_thinking_max_output_tokens = 2048
3) Make weaker/cost-saving model usage opt-in
model_weak (or similar) if the user explicitly defines it; otherwise prioritize quality.4) Choose fallbacks that can actually handle expected context
This standard reduces runaway costs/latency, improves consistency of LLM outputs, and prevents poor review quality caused by unsuitable model/fallback choices.