Add manual context field for AI insights

Free-text setting fed directly into every briefing's prompt as ground
truth (e.g. "Joseph Trice-Rolph is on a flexi rota, has no fixed rota
shifts — account for that in overspend"), so known context the data
itself can't show doesn't get flagged as an anomaly. New
ai_insights_manual_context config key, a textarea in Settings, and a
top-of-prompt section in the job with an explicit instruction to treat
it as ground truth.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-25 10:07:37 +00:00
parent c09b31c41e
commit d36655c02c
4 changed files with 38 additions and 6 deletions

View file

@ -62,6 +62,7 @@ export default function SettingsPage() {
{ key: 'ai_insights_model', value: settings.ai_insights_model ?? 'claude-haiku-4-5-20251001' },
{ key: 'ai_insights_schedule_time', value: settings.ai_insights_schedule_time ?? '07:15' },
{ key: 'ai_insights_daily_token_budget', value: settings.ai_insights_daily_token_budget ?? '5000' },
{ key: 'ai_insights_manual_context', value: settings.ai_insights_manual_context ?? '' },
])
setSaved(true)
setTimeout(() => setSaved(false), 2000)
@ -344,6 +345,23 @@ export default function SettingsPage() {
</div>
</div>
<div style={{ marginBottom: 12 }}>
<label style={{ display: 'block', fontSize: 12, fontWeight: 500, marginBottom: 4, color: 'var(--text-muted)' }}>
Additional Context
</label>
<textarea
rows={3}
style={{ width: '100%', resize: 'vertical', fontFamily: 'inherit' }}
value={settings.ai_insights_manual_context ?? ''}
onChange={e => handleChange('ai_insights_manual_context', e.target.value)}
placeholder="e.g. Joseph Trice-Rolph is on a flexi rota and has no fixed rota shifts — account for that when flagging overspend."
/>
<p style={{ margin: '4px 0 0', fontSize: 12, color: 'var(--text-muted)' }}>
Free text fed directly into every briefing as known context use it for things the data can't show
(contract quirks, known one-off causes, planned changes) so they don't get flagged as anomalies.
</p>
</div>
<div style={{ display: 'flex', gap: 16, flexWrap: 'wrap', alignItems: 'flex-start' }}>
<div>
<button className="btn btn-secondary" onClick={handleTestConnection} disabled={testStatus === 'testing'}>