How smlfg/the-farmer-was-replaced works
This is a local spoken learning companion for The Farmer Was Replaced. Its main workflow is to detect the game session, observe saved code and (when available) the game window, combine that context with spoken questions or runtime errors, generate a teaching response, and speak it while maintaining learning progress. The core watcher and RPC orchestration in tutor.py is only partially excerpted, so undocumented internal call links are omitted; README-described capabilities are retained.
Main entry points: tutor.py Session watcher · offline_tutor.py Offline tutor fallback · ptt.swift Push-to-talk listener · konzepte.py Concept map
Components 21
Tutor runtime
- Session watcher
tutor.py - Code and save reader
tutor.py - Game screenshot capture
tutor.py - Observation builder
tutor.py - Response and lesson parser
tutor.py - Tutor commands
tutor.py
Learning support
- Concept map
konzepte.py - Practice streak
konzepte.py - Daily lesson plan
konzepte.py - Tutor notebook
tutor.py
Voice interaction
- Speech playback
tutor.py - Push-to-talk listener
ptt.swift - Local transcription
tutor.py
Tutor providers
- Pi RPC tutor
tutor.py - Offline tutor fallback
offline_tutor.py - Rule-based hint
offline_tutor.py
Other components
- Learner
- Game session
- Loopback Ollama
- MiniMax API
- Piper Thorsten
Connections 22
- Learner → Push-to-talk listener: holds key
README.md - Push-to-talk listener → Local transcription: signals key
README.md - Local transcription → Session watcher: supplies question
README.md - Learner → Tutor commands: sends commands
README.md - Game session → Session watcher: session detected
README.md - Session watcher → Code and save reader: reads saved files
README.md - Session watcher → Game screenshot capture: captures window
README.md - Session watcher → Observation builder: assembles context
tutor.py - Game session → Observation builder: provides runtime errors
README.md - Observation builder → Pi RPC tutor: requests analysis
README.md - Pi RPC tutor → MiniMax API: sends tutor request
README.md - Pi RPC tutor → Offline tutor fallback: falls back
README.md - Offline tutor fallback → Loopback Ollama: requests local model
README.md - Offline tutor fallback → Rule-based hint: falls back
offline_tutor.py - Pi RPC tutor → Response and lesson parser: returns tutor text
tutor.py - Response and lesson parser → Speech playback: queues lesson
tutor.py - Speech playback → Piper Thorsten: speaks text
README.md - Session watcher → Concept map: updates progress
tutor.py - Session watcher → Practice streak: records activity
tutor.py - Session watcher → Daily lesson plan: loads lesson
tutor.py - Session watcher → Tutor notebook: persists teaching context
README.md - Response and lesson parser → Tutor notebook: updates notes
tutor.py