Why Manual Spot-Checking Breaks When Prompts Scale
Fixing one edge case in a system prompt frequently degrades three unrelated workflows. Without a golden dataset of representative user queries and expected tool calls, teams ship blind.
- Track retrieval recall@k separately from final answer faithfulness
- Assert strict JSON schema validity for every tool-calling step
- Enforce p95 latency and token-cost budgets inside CI pull requests
Structuring a Lightweight Evaluation Runner
Even a 40-case regression suite catches citation drift and broken tool parameters immediately after chunking or model updates.
tsevals/run-rag-eval.ts
interface EvalCase {
query: string;
expectedDocIds: string[];
}
export function scoreRecall(retrieved: string[], expected: string[]): number {
const hits = expected.filter((id) => retrieved.includes(id));
return hits.length / Math.max(expected.length, 1);
}