Skip to content

[WIP] Fix bugs in horse racing agents' rules#94

Merged
Bitpass-dev merged 1 commit intomainfrom
copilot/fix-agent-bugs-rules
Mar 14, 2026
Merged

[WIP] Fix bugs in horse racing agents' rules#94
Bitpass-dev merged 1 commit intomainfrom
copilot/fix-agent-bugs-rules

Conversation

Copy link

Copilot AI commented Mar 14, 2026

  • Fix Rule 3 in all 10 agents (never ask to paste data)
  • Add Rule 8 to agents missing it (uk-grass, uk-all-weather, ireland-all-weather)
  • Add Rule 9 to all 10 agents (venue scope rule)
  • Fix "other 7 horse racing agents" → "other 9" in handicap agent
  • Add CRITICAL SCOPE section to uk-all-weather agent
  • Verify VENUE_FILTER_MAP in chat-data-injector.ts is correct
Original prompt

Problem

There are two bugs affecting all 10 horse racing agents in AI-Sports-Almanac/backend/src/agents/:


Bug 1 — Rule 3 allows asking users to paste data (all 10 agents)

Current Rule 3 in every horse racing agent's getSystemPrompt() reads:

"Only ask the user to paste race card data if NO live data is present in the LIVE DATA section below, or if they are asking about a specific race not in the live data."

This causes the agent to ask the user to paste race cards when a venue exists but isn't in the live data feed. This is terrible UX. The agent should never ask users to paste anything.

Bug 2 — UK All-Weather agent shows non-AW races (e.g. Saint-Cloud, Chepstow) when no AW venues match

The horse-racing-uk-all-weather-agent.ts system prompt is missing a rule that tells it to ignore any races in the LIVE DATA that are NOT at the 6 UK AW venues (Lingfield, Wolverhampton, Kempton, Chelmsford, Southwell, Newcastle). When the live data contains turf or jump races (Saint-Cloud, Chepstow, etc.) and no AW races, the agent currently lists those irrelevant races and suggests the user wait or switch to jump racing.

Bug 3 — Missing Rule 8 in some agents (inconsistency)

Several agents (e.g. horse-racing-uk-all-weather-agent.ts, horse-racing-ireland-all-weather-agent.ts, horse-racing-uk-grass-agent.ts) are missing Rule 8 which tells the agent what to do when live data says "No live fixture data is available". This rule exists in some agents but not others.

Also, the horse-racing-handicap-agent.ts still references "the other 7 horse racing agents" in its system prompt — this should be updated to "9" since there are 10 total.


Fix Required

Update the getSystemPrompt() method in all 10 horse racing agent files:

  1. AI-Sports-Almanac/backend/src/agents/horse-racing-agent.ts
  2. AI-Sports-Almanac/backend/src/agents/horse-racing-uk-grass-agent.ts
  3. AI-Sports-Almanac/backend/src/agents/horse-racing-uk-all-weather-agent.ts
  4. AI-Sports-Almanac/backend/src/agents/horse-racing-uk-jumps-agent.ts
  5. AI-Sports-Almanac/backend/src/agents/horse-racing-ireland-grass-agent.ts
  6. AI-Sports-Almanac/backend/src/agents/horse-racing-ireland-all-weather-agent.ts
  7. AI-Sports-Almanac/backend/src/agents/horse-racing-ireland-jumps-agent.ts
  8. AI-Sports-Almanac/backend/src/agents/horse-racing-international-agent.ts
  9. AI-Sports-Almanac/backend/src/agents/horse-racing-handicap-agent.ts
  10. AI-Sports-Almanac/backend/src/agents/cheltenham-festival-agent.ts

Changes to make in EVERY agent's BEHAVIOUR & INTERACTION RULES:

Replace Rule 3 (currently: "Only ask the user to paste race card data if...") with:

3. NEVER ask the user to paste race card data or provide information under any circumstances.
   If the venue or race they ask about is not in the live data, use your expert knowledge
   immediately — draw on trainer patterns, course characteristics, historical form, and
   market intelligence. Do NOT mention that the venue is absent from the live data feed.
   Do NOT suggest waiting for data to appear. Just give your expert analysis.

Add Rule 8 (to any agent that is missing it — check each file):

8. If the LIVE DATA section says "No live fixture data is available", do NOT ask the user
   to paste data. Instead, immediately give your best expert analysis using your knowledge
   of current form, standings, recent results, and key matchups. Be direct and confident.
   Open with "Based on current form and market intelligence..." and go straight into picks.

Add Rule 9 to ALL agents:

9. You ONLY cover [agent-specific venues]. If the LIVE DATA contains races at venues
   outside your specialisation (e.g. turf races, jump races, overseas races not in your
   remit), IGNORE them completely. Never mention or analyse races outside your venue scope.
   If no relevant live data is available for your venues, go straight to expert knowledge.

The [agent-specific venues] text should be tailored per agent:

  • horse-racing-agent.ts: "UK and Irish horse racing venues"
  • horse-racing-uk-grass-agent.ts: "UK grass flat turf racecourses"
  • horse-racing-uk-all-weather-agent.ts: "the 6 UK all-weather venues: Lingfield (Polytrack), Wolverhampton (Tapeta), Kempton (Polytrack), Chelmsford (Polytrack), Southwell (Fibresand/Polytrack), and Newcastle (Tapeta)"
  • horse-racing-uk-jumps-agent.ts: "UK National Hunt jump racecourses"
  • horse-racing-ireland-grass-agent.ts: "Irish grass flat turf racecourses"
  • horse-racing-ireland-all-weather-agent.ts: "Dundalk Polytrack — Ireland's only all-weather venue"
  • horse-racing-ireland-jumps-agent.ts: "Irish National Hunt jump racecourses"
  • horse-racing-international-agent.ts: "international racing venues: Meydan, ParisLongchamp, Flemington, Sha Tin, Tokyo, Randwick, Churchill Downs, Belmont"
  • horse-racing-handicap-agent.ts: "UK and Irish horse racing venues (all surfaces)"
  • `cheltenham-fe...

This pull request was created from Copilot chat.


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

@Bitpass-dev Bitpass-dev marked this pull request as ready for review March 14, 2026 00:16
@Bitpass-dev Bitpass-dev merged commit 894fb20 into main Mar 14, 2026
1 check failed
Copilot AI requested a review from Bitpass-dev March 14, 2026 00:17
Copilot stopped work on behalf of Bitpass-dev due to an error March 14, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants