Raise output token cap; add one-time note about the rota-methodology fix

MAX_OUTPUT_TOKENS was 600 and briefings were hitting it mid-sentence
(confirmed on a live generation — cut off mid-bullet). Raised to 900.

Also adds a time-boxed methodology note (expires 29/07/2026) so the
model doesn't flag the 25/07 base-cost-only rota fix as an unexplained
swing when it sees a prior insight's rota variance figures differ —
it was told to compare against recent insights explicitly, and without
this note it correctly but unhelpfully treated a deliberate correction
as an open question needing clarification.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-25 09:30:15 +00:00
parent 661e219aac
commit 216dacb0f2

View file

@ -6,9 +6,14 @@ import { forecastDayCost } from '../lib/forecast.js'
export const DEFAULT_MODEL = 'claude-haiku-4-5-20251001' export const DEFAULT_MODEL = 'claude-haiku-4-5-20251001'
export const DEFAULT_DAILY_TOKEN_BUDGET = 5000 export const DEFAULT_DAILY_TOKEN_BUDGET = 5000
const MAX_OUTPUT_TOKENS = 600 const MAX_OUTPUT_TOKENS = 900
export const MANUAL_RATE_LIMIT_MINUTES = 5 export const MANUAL_RATE_LIMIT_MINUTES = 5
// One-time context so the model doesn't flag the 25/07 rota-methodology fix (oncost-inclusive
// -> base-pay-only comparison) as an unexplained swing when it sees a prior insight's figures
// change. Safe to delete this constant and its usage below once it's a few days stale.
const METHOD_CHANGE_NOTE_UNTIL = '2026-07-29'
function toISODate(d) { function toISODate(d) {
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}` return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`
} }
@ -358,6 +363,19 @@ export function buildPrompt(monthProgress, priorPeriod, rotaVsActual, forecast,
const lines = [] const lines = []
if (recentInsights.length && toISODate(new Date()) <= METHOD_CHANGE_NOTE_UNTIL) {
lines.push('## Methodology Note (25/07/2026)')
lines.push(
"The Rota vs Actual Variance comparison was corrected on 25/07/2026 to use base pay only on both " +
"sides (previously actual cost included employer NI oncosts while rota did not, since Workforce's " +
"schedules API never supplies oncosts — this inflated every rota variance figure by roughly 14-20%). " +
"If a recent previous insight below shows a notably different rota variance figure for the same " +
"department than today's, that is this correction taking effect, not a real change in performance — " +
"do not describe it as unexplained or needing clarification."
)
lines.push('')
}
if (recentInsights.length) { if (recentInsights.length) {
lines.push('## Recent Previous Insights (most recent first — reference these, do not just repeat them)') lines.push('## Recent Previous Insights (most recent first — reference these, do not just repeat them)')
for (const r of recentInsights) { for (const r of recentInsights) {