Fix system prompt rules across all 10 horse racing agents#95
Draft
Fix system prompt rules across all 10 horse racing agents#95
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 askrule. Agents now fall back to expert knowledge immediately, without surfacing the absence of live data to the user.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.tshorse-racing-uk-all-weather-agent.tshorse-racing-ireland-all-weather-agent.tsRule 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.tsAdded 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.tsOriginal 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: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.tsis 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.tssays "the other 7 horse racing agents" — must be updated to "9".Fix Required
Update
getSystemPrompt()in ALL 10 horse racing agent files:AI-Sports-Almanac/backend/src/agents/horse-racing-agent.tsAI-Sports-Almanac/backend/src/agents/horse-racing-uk-grass-agent.tsAI-Sports-Almanac/backend/src/agents/horse-racing-uk-all-weather-agent.tsAI-Sports-Almanac/backend/src/agents/horse-racing-uk-jumps-agent.tsAI-Sports-Almanac/backend/src/agents/horse-racing-ireland-grass-agent.tsAI-Sports-Almanac/backend/src/agents/horse-racing-ireland-all-weather-agent.tsAI-Sports-Almanac/backend/src/agents/horse-racing-ireland-jumps-agent.tsAI-Sports-Almanac/backend/src/agents/horse-racing-international-agent.tsAI-Sports-Almanac/backend/src/agents/horse-racing-handicap-agent.tsAI-Sports-Almanac/backend/src/agents/cheltenham-festival-agent.tsChange 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:
Change 2 — Add Rule 8 to agents that are missing it
Check each file. If Rule 8 is missing, add it:
The following agents are known to be missing Rule 8:
horse-racing-uk-grass-agent.tshorse-racing-uk-all-weather-agent.tshorse-racing-ireland-all-weather-agent.tsChange 3 — Add Rule 9 to ALL agents (tailored per agent)
Add after Rule 8 in every agent:
For
horse-racing-agent.ts:For
horse-racing-uk-grass-agent.ts:For
horse-racing-uk-all-weather-agent.ts:For
horse-racing-uk-jumps-agent.ts:For
horse-racing-ireland-grass-agent.ts: