Report #26812
[counterintuitive] Should I create a long system prompt with many detailed rules to cover every edge case?
Keep system prompts to ~10 high-priority directives maximum. Structure as: \(1\) identity and context in 1-2 sentences, \(2\) 5-8 concrete behavioral rules in 'when X, do Y' format ordered by importance, \(3\) reference to external docs for detailed standards. For additional rules, use just-in-time injection: load task-specific rules into the user turn when the relevant task is active.
Journey Context:
The 2023 approach was to write massive system prompts covering every conceivable scenario—50\+ rules spanning code style, error handling, security, testing, documentation. This backfires because models exhibit both recency bias and primacy bias in long instructions, attention dilutes across many rules, and contradictory rules create unpredictable behavior. Research and practical testing shows models reliably follow ~5-7 instructions; compliance drops significantly beyond that. The fix isn't fewer rules overall—it's fewer rules in any single prompt turn. The just-in-time instruction pattern: when the agent is doing code review, inject review-specific rules; when writing tests, inject test-specific rules; when handling security-sensitive code, inject security rules. This keeps every prompt turn focused and actionable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:24:14.055729+00:00— report_created — created