MokuML is a local-first macOS app for small businesses that want to turn a database and a plain-language prediction request into a safe tabular machine-learning workflow.
The privacy boundary is the core product rule:
- The LLM receives the user prediction prompt and schema metadata only.
- The LLM never receives table rows, cell values, previews, API keys, or connection passwords.
- SQL is validated before local execution.
- Query execution and model inference happen on the user machine.
This repository contains:
- A SwiftUI macOS app shell in
app/MokuPredictor. - A local Python worker in
worker/src/worker. - Postgres connection, schema introspection, SQL validation, local preview execution, and ML runner endpoints.
- LLM adapters for Ollama-compatible local models and OpenAI-compatible APIs.
- Metadata-only run audit records in
~/Library/Application Support/MokuML/runs/. - Dependency-light fallback behavior so safety/privacy tests can run before the full Python environment is installed.
swift run MokuPredictorThe app starts a local worker at 127.0.0.1:8765 using:
PYTHONPATH=worker/src python3 -m worker.main --host 127.0.0.1 --port 8765For a production-style worker environment, use Python 3.11+:
cd worker
uv venv --python 3.11
source .venv/bin/activate
uv pip install -e ".[dev]"
python -m worker.mainThe macOS app automatically prefers worker/.venv/bin/python when that environment exists. Without this environment, it falls back to system Python, which may not have the Postgres dependencies needed for /connect/test.
GET /healthPOST /connect/testPOST /schema/introspectPOST /llm/generate-sqlPOST /sql/validatePOST /sql/execute-previewPOST /ml/run-tabpfn
The default UI points at Ollama on http://127.0.0.1:11434 with a SQLCoder-style model name. You can switch to the offline template provider for a no-network dry run, or configure an OpenAI-compatible endpoint. API mode still sends schema metadata only.
Core dependency-light tests:
PYTHONPATH=worker/src python3 -m unittest discover worker/testsFull SQL AST validation, Postgres access, and TabPFN inference require the worker dependencies from worker/pyproject.toml.
Create a self-contained macOS DMG with bundled Python and worker dependencies:
scripts/package_app.shOutput:
dist/MokuPredictor.app
dist/MokuPredictor-0.1.0.dmg
See docs/PACKAGING.md for local signing, Developer ID signing, and notarization.
The app cannot invent future outcomes. Supervised predictions require a historical target column or a safe target derivation already present in the database. If the target cannot be inferred from schema alone, the app asks the user to choose or clarify it.
Before commercial use, verify the current TabPFN-3 license and deployment terms.