A Scratch extension that brings local AI education to schools, enabling students to learn coding with AI through visual blocks. Schools maintain complete privacy and safety control.
The GPT-OSS Scratch Extension integrates local AI capabilities into Scratchβs visual programming environment. This open-source platform makes AI tangible and accessible to learners while ensuring complete data privacy through local deployment.
π Privacy-First Architecture
π‘οΈ Multi-Layer Safety System
π Educational AI Blocks
π Comprehensive Admin Dashboard
# Clone the repository
git clone https://github.com/cindyhuen/scratch-gpt-oss.git
cd scratch-gpt-oss
# Run the setup script
./start-scratch.sh
# Open in browser
open http://localhost:8602
Important: After setting up the system, administrators must create student accounts through the admin interface to enable proper AI usage tracking.
http://127.0.0.1:8602/static/admin/ (or use your IP address and port)Example Student Login URL: http://127.0.0.1:8602?student=12345&class=grade8a (or use your IP address and port)
π Setup Reminder: Always create student accounts through the admin interface before classroom use to ensure proper tracking and analytics functionality.
Detailed setup guide for administrators to get the complete system running.
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Download model (choose one)
# For faster performance and basic educational use:
ollama pull gpt-oss:20b
# For advanced reasoning and research-level performance:
ollama pull gpt-oss:120b
# Start server
ollama serve
# Runs on http://localhost:11434
# Install NeMo
brew install pipx && pipx install nemoguardrails
pipx inject nemoguardrails langchain-openai
# Start NeMo server
cd nemo-guardrails
./start-nemo.sh
# Runs on http://localhost:8001
Edit config.js:
module.exports = {
gptoss: {
host: 'localhost', // GPT-OSS server
port: 11434,
model: 'gpt-oss:20b'
},
nemoGuardrails: {
enabled: true, // Line 39 - Set false to disable NeMo
host: 'localhost', // NeMo server
port: 8001
// If enabled=true but NeMo fails β shows "NeMo unavailable" error
// If enabled=false β direct GPT-OSS (no filtering)
}
}
π Configuration Update Notes:
Remember to modify the values in config.js to match your local server setup
config.js, if you want to use Nemo Guardrails, you must also manually update the corresponding values in nemo-guardrails/nemo-education-config/main/config.yml:
model: to match your model (e.g., gpt-oss:20b or gpt-oss:120b)openai_api_base: to match your server URL (e.g., "http://192.168.8.21:11434/v1")# Install dependencies
cd scratch-vm && npm install
cd ../scratch-gui && npm install
# Start Scratch
npm start
# Runs on http://localhost:8602
# Test GPT-OSS server
./test-openai.sh
# Test NeMo server (if enabled)
./test-nemo-connection.sh
# Set up students after testing
# Navigate to http://127.0.0.1:8602/static/admin/ to create student accounts with personalized QR codes
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Student β β NeMo Guardrails β β GPT-OSS β
β Scratch UI βββββΆβ Content Filter βββββΆβ AI Server β
β (Port 8602) β β (Port 8001) β β (Port 11434) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
Components:
Request Flow:
gpt-oss-scratch-extension/
βββ README.md
βββ config.js
βββ start-scratch.sh
βββ test-nemo-connection.sh
βββ test-nemo-safety.sh
βββ test-openai.sh
βββ .gitignore
βββ nemo-guardrails/ # NeMo configuration
β βββ start-nemo.sh
β βββ generate-flows.js
β βββ nemo-education-config/
βββ scratch-gui/ # Modified Scratch GUI
β βββ src/lib/libraries/extensions/gptoss/ # Extension assets
β βββ static/ # Static assets and admin interface
β β βββ admin/ # Complete admin dashboard
β β βββ index.html # Main documentation
β β βββ *.css, *.js # Styling and functionality
β βββ package.json
βββ scratch-vm/ # Modified Scratch VM
βββ src/extensions/scratch3_gptoss/ # AI extension code
βββ package.json
Key Directories:
config.js - Main configuration filenemo-guardrails/nemo-education-config/main/config.yml - NeMo server configuration (update to match config.js)nemo-guardrails/ - Safety filtering system configurationscratch-gui/static/admin/ - Teacher admin dashboardscratch-gui/static/examples/ - 9 sample Scratch projects demonstrating AI blocksscratch-vm/src/extensions/scratch3_gptoss/ - Core AI extension implementation*.sh - Setup and testing scriptsThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Copyright 2025 Cindy Huen. Licensed under the Apache License, version 2.0.