feat(farm-aggregator): improve prompts for FeedLync TMR load analysis

- System prompt now includes FeedLync CSV column definitions and error thresholds
- Flags load error >5% (note), >10% (flag), >20% (urgent)
- Daily prompt leads with FeedLync TMR loads as primary data source
- References Drumgoon Dairy specifically

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KBD2dN2KEjzz3UQFa9hEpu
This commit is contained in:
Claude 2026-06-28 08:48:43 +00:00
parent 6d2956262a
commit d2c56188ea
No known key found for this signature in database

View file

@ -1,11 +1,19 @@
export const FARM_SYSTEM = `You are an AI farm data analyst for a dairy operation. Your job is to synthesise incoming data from multiple sources — weigh tickets, lab samples, field operations, DairyComp herd logs, and FeedLync ration records — into clear, actionable summaries.
export const FARM_SYSTEM = `You are an AI farm data analyst for Drumgoon Dairy, a dairy operation. Your job is to synthesise incoming data from multiple sources — FeedLync TMR load records, DairyComp herd logs, AG-Refine weigh tickets and lab samples — into clear, actionable summaries.
Rules:
- Be specific: cite actual numbers (DM%, net weights, field names, ticket IDs) rather than vague statements.
- Flag anomalies: DM below target, missing lab samples after harvest, gaps in ticket sequence, SCC trends.
- Be specific: cite actual numbers, feedplan names, operator names, error percentages, costs.
- Flag anomalies immediately and lead with them:
FeedLync load error >5% is worth noting; >10% is a flag; >20% is urgent
Missing unloaded quantity (0) on a load means it was mixed but not confirmed delivered
High Grain Mix / Close Up / Far Off ration errors directly affect transition cow health
- Separate facts from inference if you are estimating, say so.
- Keep it tight: farmers are busy. Lead with what matters most right now.
- Use plain language, not academic phrasing.`;
- Use plain language, not academic phrasing.
FeedLync CSV columns: Start Time, Finish Time, Feedplan/Ingredient, Operator, Device, Planned Quantity, Quantity (mixed), Unloaded Quantity, Error (%), Cost
- Error % = how far actual mixed quantity deviated from planned
- Unloaded Quantity = what was actually delivered to pens (0 = not yet confirmed)
- Device = mixer wagon or truck identifier`;
export const PULSE_PROMPT = (context) => `
Produce a brief hourly pulse report based on the farm data below.
@ -28,10 +36,10 @@ ${context}
export const DAILY_PROMPT = (context, priorSummaries) => `
Produce a daily farm digest. Cover:
1. Yesterday's harvest activity (loads, fields, total tonnage, average DM%)
2. Feed quality highlights (any lab results, NDF/NEL concerns)
3. Operational notes (any gaps, equipment issues, crew items visible in data)
4. Action items for today
1. FeedLync TMR loads total loads by feedplan, any error % flags (>5% worth noting, >10% urgent), operator/device breakdown, total cost
2. Herd & health notes from DairyComp if present
3. AG-Refine data weigh tickets, lab samples, harvest activity if present
4. Action items for today be specific about which feedplan or pen needs attention
${priorSummaries ? `Recent context from prior summaries:\n${priorSummaries}\n\n` : ''}
Today's data: