Inspiration

I built RallyRef from a practical frustration: in squash training and casual matches, there often is no official referee. Players have to remember the score, track service changes, settle Lets, and keep the match moving—all while trying to play well.

I wanted a tool that would not ask players to keep reaching for a phone or rely on a third person beside the court. The interaction needed to be quick enough for live play, but the match state also needed to be reliable enough to review later.

That led to RallyRef: a personal project to turn the devices players already wear and carry into a practical referee workflow. Apple Watch becomes the lightweight in-match control surface, while iPhone maintains the authoritative score, provides announcements, optionally records the match, and preserves a reviewable timeline.

The project also became an exploration of how I could work with Codex and GPT-5.6 to turn a real sports workflow into a tested cross-device product. Rather than using AI only to generate isolated code, I used it to help define rules, challenge assumptions, implement the system, and build tests around the failure cases that matter during a match.

What it does

RallyRef supports a complete squash match workflow:

  • Create a match with two local players, a designated Watch Scorer, and a best-of-three or best-of-five format.
  • Prepare and verify referee announcements before play.
  • Start the match from Apple Watch; iPhone intentionally does not provide an in-match manual scoring control.
  • Record points, Lets, undo actions, corrections, pauses, and recovery actions from the Watch.
  • Apply official scoring logic, including 11-point games, win-by-two deuce rules, service handovers, left and right service boxes, Game Ball, Match Ball, and game intervals.
  • Keep iPhone as the single source of truth for score, service, match phase, timeline, and persistence.
  • Optionally record the match, then review video with the authoritative score, service state, and event timeline.
  • Save completed or incomplete matches locally for later review.

For this demo, the court footage is a previous squash recording played on a display. We use it as a controlled and repeatable simulation of real match rhythm. RallyRef does not use computer vision to judge the video; all referee decisions are explicitly submitted from Apple Watch.

How we built it

RallyRef is built with Swift and SwiftUI for iPhone and Apple Watch.

The system is organized around a pure Swift squash rules engine. This engine owns match semantics and produces structured referee events. The user interface, Watch connectivity, voice playback, recording, and persistence consume those events rather than independently recalculating scores or service state.

The architecture has one central rule:

Apple Watch submits referee intent; iPhone validates, persists, and projects the authoritative state.

This gives us a consistent answer to difficult cases such as duplicate Watch actions, corrections after a winning point, an interrupted connection, or an app relaunch during a live match.

We used:

  • SwiftUI for the iPhone and Watch interfaces.
  • WatchConnectivity to transmit typed referee actions and authoritative state snapshots.
  • Local persistence for active matches, timelines, archives, player profiles, and recoverable pre-match drafts.
  • AVFoundation and Photos integration for optional recording and playback.
  • Local audio playback for match announcements.
  • XCTest for focused rule, persistence, synchronization, integrity, and recovery tests.

The referee voice workflow is also designed around match reliability. Voice resources are prepared and validated before play. Once a match starts, RallyRef plays local audio rather than requiring an online speech request during a rally.

Codex and GPT-5.6

Codex and GPT-5.6 were used as engineering collaborators throughout the project.

GPT-5.6 helped us translate squash rules and product constraints into an explicit state model. In particular, it helped us reason about the distinction between a user action, such as “Cathy scored,” and an accepted state transition, which only becomes valid after the iPhone validates and persists it.

Within Codex, GPT-5.6 accelerated several parts of the development loop:

  • Structuring the cross-device responsibilities between Apple Watch and iPhone.
  • Implementing Swift and SwiftUI views without mixing UI state with match-rule logic.
  • Building typed Watch actions, state projections, synchronization, and recovery behavior.
  • Implementing local persistence, match archives, voice-pack handling, and recording flows.
  • Reviewing edge cases such as deuce, service changes, duplicate actions, corrections, interrupted matches, and reopening a match-winning point.
  • Creating and iterating on focused XCTest coverage for scoring, synchronization, persistence, audio integrity, and recovery.

The result was faster iteration, but the important outcome was consistency: product decisions, rule semantics, UI behavior, and automated tests could be checked against the same model.

Challenges we ran into

Keeping two devices consistent

A Watch and an iPhone can both display match information, but they must not independently decide the result. We solved this by making the iPhone the only authority. The Watch sends an intention; the iPhone validates it, saves it, and returns the updated state.

Handling corrections correctly

A correction is more complex than simply changing a displayed number. It may change the server, service box, Game Ball status, Match Ball status, or even reopen a game or match that appeared finished. Modeling these transitions explicitly in the rules engine was essential.

Making the system usable during play

A referee tool must avoid distracting players. This led to the decision that Apple Watch is the single manual input surface during a live match. The iPhone can remain outside the court, providing announcements, authoritative state, and optional video capture.

Testing without a full live court session every time

Real match testing is necessary, but not every engineering iteration requires a live match. For the demo, we play a previous match recording on a screen and operate RallyRef in real time. This gives us a repeatable way to test the interaction between video, Watch input, score changes, announcements, and timeline playback.

What we learned

We learned that the difficult part of a sports referee tool is not displaying a score. It is defining which device is authoritative, making every state change recoverable, and preserving the meaning of a match when something goes wrong.

We also learned that AI-assisted development is most effective when the system boundaries are explicit. Codex and GPT-5.6 were particularly useful for turning a complex set of rules and interaction constraints into small, testable engineering tasks. But the final product still depends on deliberate choices about rules, player workflow, reliability, privacy, and what must happen on-device.

What's next

RallyRef is currently focused on a controlled squash MVP. The next step is continued real-court validation across supported iPhone and Apple Watch pairs, including full matches, connectivity interruptions, offline announcement playback, and sustained recording sessions.

Our goal is straightforward: make referee-less squash matches easier to run, easier to verify, and easier to review.

Built With

  • apple-watch
  • gpt-5.6
  • ios
  • openai-codex
  • swift
  • swiftui
  • text-to-speech
  • video
  • watchconnectivity
  • watchos
Share this project:

Updates