Skip to content

Fix system prompt rules across all 10 horse racing agents#95

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-bugs-in-horse-racing-agents
Draft

Fix system prompt rules across all 10 horse racing agents#95
Copilot wants to merge 2 commits intomainfrom
copilot/fix-bugs-in-horse-racing-agents

Conversation

Copy link

Copilot AI commented Mar 14, 2026

Three bugs caused agents to ask users for data, show out-of-scope races, and miscount sibling agents. Affects all 10 agents in AI-Sports-Almanac/backend/src/agents/.

Changes

Rule 3 — all 10 agents

Replaced the old conditional "paste race card data if no live data" instruction with a hard NEVER ask rule. Agents now fall back to expert knowledge immediately, without surfacing the absence of live data to the user.

- 3. Only ask the user to paste race card data if NO live data is present...
+ 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...

Rule 8 — added where missing

Added the "no live data → expert fallback" rule to the three agents that lacked it:

  • horse-racing-uk-grass-agent.ts
  • horse-racing-uk-all-weather-agent.ts
  • horse-racing-ireland-all-weather-agent.ts

Rule 9 — all 10 agents

Added a tailored venue-scope rule to every agent instructing it to ignore LIVE DATA entries outside its remit (e.g. the AW agent now ignores Chepstow, Saint-Cloud, jump venues, etc.).

CRITICAL SCOPE block — horse-racing-uk-all-weather-agent.ts

Added a prominent CRITICAL — YOUR SCOPE: block (after the behaviour rules, before the venue detail section) reinforcing the 6 UK AW venues restriction and providing an explicit expert-fallback path when no AW data is present.

Agent count — horse-racing-handicap-agent.ts

- weighted heavily by the other 7 horse racing agents
+ weighted heavily by the other 9 horse racing agents
Original prompt

Problem

There are three 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 must be replaced. The agent should never ask users to paste anything.

Bug 2 — UK All-Weather agent shows non-AW races (Saint-Cloud, Chepstow etc.)

horse-racing-uk-all-weather-agent.ts is missing a rule that tells it to ignore any races in LIVE DATA that are NOT at the 6 UK AW venues. When turf/jump races bleed in, the agent lists them instead of using expert knowledge.

Bug 3 — Missing Rule 8 in some agents + wrong agent count in handicap agent

Several agents are missing Rule 8 (what to do when live data says "No live fixture data is available"). Also horse-racing-handicap-agent.ts says "the other 7 horse racing agents" — must be updated to "9".


Fix Required

Update getSystemPrompt() 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

Change 1 — Replace Rule 3 in EVERY agent

Find the line that says something like:
"Only ask the user to paste race card data if NO live data is present..."

Replace it 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.

Change 2 — Add Rule 8 to agents that are missing it

Check each file. If Rule 8 is missing, add it:

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.

The following agents are known to be missing Rule 8:

  • horse-racing-uk-grass-agent.ts
  • horse-racing-uk-all-weather-agent.ts
  • horse-racing-ireland-all-weather-agent.ts

Change 3 — Add Rule 9 to ALL agents (tailored per agent)

Add after Rule 8 in every agent:

For horse-racing-agent.ts:

9. You ONLY cover UK and Irish horse racing venues. If the LIVE DATA contains races outside
   this scope, IGNORE them. If no relevant live data is available, go straight to expert knowledge.

For horse-racing-uk-grass-agent.ts:

9. You ONLY cover UK grass flat turf racecourses. If the LIVE DATA contains races at AW venues,
   jump courses, or overseas venues, IGNORE them completely. If no relevant live data is available
   for your venues, go straight to expert knowledge.

For horse-racing-uk-all-weather-agent.ts:

9. You ONLY cover the 6 UK all-weather venues: Lingfield (Polytrack), Wolverhampton (Tapeta),
   Kempton (Polytrack), Chelmsford (Polytrack), Southwell (Polytrack), and Newcastle (Tapeta).
   If the LIVE DATA contains races at turf venues (e.g. Chepstow, Ascot, Saint-Cloud), jump
   venues, or Irish/overseas venues, IGNORE those races entirely — they are NOT your remit.
   If no AW live data is available, immediately give expert AW analysis from your knowledge:
   which AW venues typically run that day, likely race types, key AW trainers (Andrew Balding,
   Roger Varian, Charlie Appleby, David Menuisier), and AW specialists. Do NOT defer or suggest waiting.

For horse-racing-uk-jumps-agent.ts:

9. You ONLY cover UK National Hunt jump racecourses. If the LIVE DATA contains flat races,
   AW races, or overseas races, IGNORE them. If no relevant live data is available, go straight
   to expert knowledge.

For horse-racing-ireland-grass-agent.ts:

9. You ONLY cover Irish grass flat turf racecourses. If the LIVE DATA contains races at UK venues,
   AW venues, jump co...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

…ndicap count

Co-authored-by: Bitpass-dev <186615221+Bitpass-dev@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix multiple bugs in horse racing agents Fix system prompt rules across all 10 horse racing agents Mar 14, 2026
Copilot AI requested a review from Bitpass-dev March 14, 2026 00:26
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