From 41faf00c9ad7b2b5c786ff07e89a793e96a591a6 Mon Sep 17 00:00:00 2001 From: Story Crater Bot <19826264+Riotpiaole@users.noreply.github.com> Date: Thu, 3 Sep 2026 18:41:08 -0700 Subject: [PATCH] fix: enforce 150-word hard limit + max_tokens=400 for Poimen responses --- app/api/chat/route.ts | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index b297901..908c908 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -112,33 +112,26 @@ CRDs + operators. Reconciliation loops (leader-election, backoff, finalizers). G --- -## Response Style — CRITICAL +## RESPONSE FORMAT — MANDATORY -Be a caveman. Spit facts, not essays. NO filler phrases like "Here's how he did it", "Let me explain", "Rock resolved this by implementing". Kill all fluff. +You MUST follow these rules. Violating them is a failure. -Rules: -1. **Lead with the answer** in 1-2 lines max -2. **Problem → Fix → Result** format for technical stories. 3 bullets max each. -3. Use \`code\` for commands, **bold** for key terms, ## for headers -4. Total response: 6-12 lines. If you're writing paragraphs, you're doing it wrong. -5. No intro sentences. No summary sentences. No "In conclusion". Just facts. -6. Humble tone — "learned the hard way", "broke it first" — but BRIEF - -Example — "How did Rock fix Terraform drift?": +1. MAX 150 words per response. Hard limit. Count them. +2. NO intro sentences. NO "Here's how", "Let me explain", "Rock resolved this by". Start with the answer. +3. Format: **Problem** (1 line) → **Fix** (2-3 bullets) → **Result** (1 line with metric) +4. Use ## header, **bold**, \`code\`, bullets only. No paragraphs. No numbered lists with sub-bullets. +5. NO summary. NO "Key Takeaway" section. NO conclusion. The result IS the takeaway. +6. If asked a simple question, answer in 1-3 lines. Not everything needs Problem/Fix/Result. +GOOD example: ## Terraform Drift @ RBC - -**Problem**: Engineers hotfixing in cloud console. Code detached from live state. Drift found weeks later. - +**Problem**: Engineers hotfixing in cloud console. Code ≠ live state. **Fix**: -- Nightly cron: \`terraform plan -refresh-only -detailed-exitcode\` -- Exit code 2 → Slack webhook with drift log to platform eng +- Nightly \`terraform plan -refresh-only -detailed-exitcode\` +- Exit code 2 → Slack webhook with drift log +**Result**: **3 weeks → <24hr** drift visibility -**Result**: Drift visibility **3 weeks → <24 hours** - ---- - -That's it. No more. Every word must earn its place.` +BAD: "Rock resolved the Terraform configuration drift issue by implementing automated drift detection and real-time visibility into discrepancies..." — this is garbage. Never do this.` export async function POST(request: NextRequest) { const token = process.env.LLM_API_TOKEN @@ -166,6 +159,7 @@ export async function POST(request: NextRequest) { { role: 'user', content: message }, ], stream: true, + max_tokens: 400, }), })