The Ghost of Lord's: Spirit of the Laws 🏏👻

An Offline MCC Cricket Law Adjudicator & Arbiter of 1788, Powered by Google Gemma 2.

Built for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine 🎃⚖️

Competing for: Best Use of Gemma ($200) & the Overall Winner ($250).

🏛️ Theme: Ghost in the Machine & Día de los Muertos

Cricket has 42 official Laws governed exclusively by the Marylebone Cricket Club (MCC) at Lord's since 1788. Every year, matches are disrupted by fierce arguments over controversial dismissals:

  • Was Jonny Bairstow's Ashes walkout fair game or against the Spirit of Cricket?
  • Should Angelo Mathews have been given Timed Out when his helmet strap snapped?
  • Is running out the non-striker ("Mankad") a legitimate run out under Law 38 or an affront to sportsmanship?

For Week 4's "Ghost in the Machine" theme, we asked: What if the ancestral 1788 Victorian custodians of Lord's returned to haunt modern cricket?

The Ghost of Lord's is an offline, privacy-first AI oracle possessed by the ancestral arbiters of the Long Room. It watches match video evidence, indexes the complete 42 MCC Laws (2019 code) alongside the original 1788 founding codes, and delivers a dual verdict:

  1. 📜 The Strict Official MCC Ruling: Exact law clauses, penalties, and out/not-out legal determinations.
  2. 👻 The Ghost's "Spirit of Cricket" Verdict: Atmospheric Victorian gentleman commentary evaluating whether the action honors the chivalry and etiquette of the gentleman's game.

🔮 Why Open Innovation & Gemma 2 Matter

  1. Zero Cloud Dependency / 100% Offline Edge Inference: Grassroots cricket grounds, school pavilions, and remote club matches frequently lack reliable Wi-Fi or cellular service. The Ghost of Lord's runs entirely locally on edge hardware via Google's open-weight Gemma 2 (gemma2:2b) using Ollama.
  2. Deterministic Law Retrieval (Local RAG): Instead of relying on closed-source cloud models that hallucinate rule numbers or confuse cricket with baseball, our system locally indexes over 4,300 lines of official MCC 2019 Laws and 1788 founding records.
  3. Data Sovereignty & Open Weights: Umpires, coaches, and clubs can audit and verify the model behavior without vendor lock-in, API throttling, or ongoing subscription costs.

✨ Features & Architecture

  • ⚖️ Full 42 MCC Laws Indexer: High-speed in-memory keyword & token scoring across all 42 official MCC Laws.
  • 📺 Interactive Match Video Evidence: Built-in YouTube video footage for iconic cricket controversies (Angelo Mathews, Jonny Bairstow, R. Ashwin, Ben Stokes).
  • 👻 Dual-Perspective Judgments: Reconciles the black-letter law against the historic Preamble (The Spirit of Cricket).
  • ⚡ Streamlit Web Dashboard & CLI: Fast token streaming, antique Long Room aesthetic, and custom query mode for real-time umpiring disputes.

📺 Live Demo & Video Evidence

The Streamlit dashboard allows umpires to select iconic cricket controversies, watch the actual incident footage, and summon the Ghost Arbiter:

  • Angelo Mathews (2023 CWC): First-ever Timed Out dismissal in international cricket.
  • Jonny Bairstow (2023 Ashes): Alex Carey's controversial under-arm stumping at Lord's.
  • R. Ashwin (2019 IPL): The infamous Mankad dismissal of Jos Buttler.
  • Ben Stokes (2019 CWC Final): The 6-run overthrow ricochet off the bat.

💻 Source Code & Open Repository

🚀 Running Locally

git clone https://github.com/volety17/ghost-of-lords.git cd ghost-of-lords pip install -r requirements.txt ollama pull gemma2:2b python -m streamlit run app.py 

May your decisions be just, and may the Spirit of the Game endure forever. 👻🏏