GPT Board
README.md
<img src="ios/GPTBoardPad/Assets.xcassets/AppIcon.appiconset/AppIcon.png" alt="GPT Board app icon" width="128" height="128">
# GPT Board
[](https://github.com/AntonioZannella/gpt-board/actions/workflows/ci.yml)
Handwritten notebooks and whiteboards that an AI assistant can read and annotate. Write on an iPad, follow along on your Mac, and keep your notebook files on your own computer.
Built with a Python backend, plain JavaScript and Canvas 2D. An optional Swift iPad app adds Apple Pencil double-tap and native file sharing. AI access uses Model Context Protocol (MCP); drawing works without an AI account.

*The demo shows the core drawing and annotation workflow; the current toolbar includes additional controls.*
## What it does
- **Write and organize:** paged notebooks, infinite whiteboards, pressure-sensitive ink, highlighter, whole/partial-stroke erasing, selection, undo/redo, typed notes, and reversible Trash.
- **Use both devices:** follow iPad notebook pages or the visible whiteboard region on your Mac, see live handwriting previews, and navigate pages with a trackpad, touch swipes, or keyboard.
- **Work with PDFs:** import pages with internal links, replace backgrounds while preserving handwriting, and export selected pages with annotations.
- **Ask an AI:** capture the current iPad page in one tool call, add editable annotations, inspect proposed edits, and undo AI changes.
- **Keep recoverable work:** revision-checked saves, local recovery journals, conflict preservation, rolling backups, and portable notebook JSON.
The iPad currently requires the Mac server to be running. This is an actively developed personal study tool, not a hosted service or a fully offline iPad app.
## Quick start
Requires Python 3.11 or newer and a browser. From the repository folder:
```sh
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
.venv/bin/python board.py start
```
On Windows, the virtual-environment interpreter is `.venv\Scripts\python.exe`; Windows behavior has not been certified. Core drawing can also run with `python3 board.py start` without extra packages. The optional dependencies enable PDF/image processing and QR pairing. Node is needed for JavaScript tests, not to run the app.
The launcher builds the frontend and opens [localhost:8787](http://localhost:8787). Leave the terminal running and wait for **Saved** before closing. Use **More** for Files, Library, AI, and Recovery. `python3 board.py doctor` provides redacted diagnostics.
**Upgrading an existing installation?** Preserve `data/`, wait for Saved, stop the existing services, update the source, restart, and reload the clients. See [upgrade and recovery](docs/RECOVERY.md).
## Drawing and organization
Choose **Select**, then circle handwriting or choose **Rectangle**. Selected strokes share one blue frame: drag anywhere inside to move, drag a corner to scale proportionally, or use the round handle below to rotate. The floating **Delete / Done** menu acts on the whole selection; tapping outside also deselects. Finger dragging works inside an existing selection, while fingers outside it keep navigating the page. Each completed transform or deletion is one undoable edit. Selection and Select All stay on the current notebook page.
The drawing toolbar includes pen and highlighter, Fine/Medium/Thick widths, whole-stroke or partial erasing, lasso/rectangle selection, and undo/redo. **Ink** opens a Pencil/touch-friendly palette with 12 swatches and a custom hex color; tap outside to dismiss it. **Minimize** hides navigation for more writing space. Use zoom, pan, and Fit page/Fit drawing to move around.
**More → Library** searches, renames, duplicates, reorders, archives, trashes, and restores notebooks or whiteboards. **More → Manage pages** renames, duplicates, reorders, trashes, and restores pages; **+ Page** adds a blank page. Trash is reversible.
**More → AI** also adds and edits your own typed notes and AI annotation text. Unicode math such as x², √, π, and ∫ is supported; LaTeX typesetting is not. **Show AI notes** hides the AI layer without deleting it.
## Connect your iPad
Keep both devices on the same trusted Wi-Fi, or use the optional private Tailscale connection below. On the Mac, choose **More → Connect iPad** and use the displayed URL, QR invitation, or pairing code. Invitations expire and work once. You can revoke devices from the Mac.
Use Safari, or build the [optional native iPad app](ios/README.md) in Xcode for Apple Pencil double-tap and native sharing. It is not distributed through the App Store. Signing requirements depend on your Apple development account.
Use **Follow iPad** on the Mac to follow the tablet's current notebook page, switch notebooks/whiteboards with it, or follow its whiteboard pan and zoom. Whiteboard following centers the tablet's visible region and fits it to the Mac's screen. It pauses while the Mac has an active gesture or unsaved edits. Click again to stop. An ordinary Mac launch also resumes the connected iPad's notebook/page unless you supplied an explicit location.
The native app removes the extra native toolbar, opens external links in Safari, accepts PDF/image/JSON files through **Files → Share → GPT Board**, and uses the iPad share sheet for exports. It can discover the Mac with Bonjour where the network permits it and retries failed initial connections. Pencil double-tap needs a compatible Pencil and the native app; Safari alone does not provide that integration. See the [iPad guide](ios/README.md) for installation and renewal.
Changing between a numeric IP address and a `.local` address changes the browser's storage origin; save before switching addresses.
## PDFs and backups
**More → Files** offers a new-notebook import, append, or explicit background-replacement mapping. Replacement retains page IDs and handwriting and rejects incompatible page proportions. Imported PDF links navigate between pages, with **Back to link** to return; supported external links open in the browser. PNG/JPEG image imports and previewed notebook JSON restores are also available.
Problem pages can also link to bounded YouTube clips. **Watch required clip** opens a player over the board; tap Play to watch the selected intervals, with gaps skipped automatically and playback stopped at the end. A clip can combine segments from different videos. **Back to problem** closes playback without navigating away. Optional review clips stay separately labeled. YouTube must allow embedded playback; if it fails, the player offers a full-video link that starts at the selected time but cannot stop automatically.
PDF import/export supports up to 500 pages, subject to size limits: 16 MiB PDF/image input, 32 MiB rendered import staging, and 48 MiB per notebook. Large documents may need splitting. Browser JSON import accepts up to 64 MiB before validating the decoded notebook; native Files sharing accepts up to 16 MiB.
Export all pages or a range such as `1-5, 8, 12-14`. Choose whether to include AI annotations. PDF output is rasterized; use notebook JSON for an editable backup, or PNG for the current page. Imports/exports show progress and can be cancelled. [Workflow details](docs/WORKFLOW_UPDATE.md)
## Connect an AI assistant
Configure a compatible **local MCP client** with `http://localhost:8787/mcp/<token>`, using the private token in `data/token`. Never publish that complete URL. Cloud-only clients cannot reach localhost directly; the paired iPad bridge does not expose MCP.
A default `read_board` request captures the active iPad page and returns its identity and fresh evidence. Keep GPT Board visible on the iPad; no page number or Mac Follow mode is required. A delayed presence heartbeat does not redirect the read to the Mac: the connected iPad confirms its current page at capture time. Hidden-app and mid-capture page changes ask for a retry. Explicit page requests, page listings, region captures, and overview reads are also available. If you are drawing or the board changes during capture, the read asks the AI to retry rather than interrupting a stroke or returning mixed evidence. Screenshot rendering yields between batches and PNG encoding is asynchronous; physical-device latency still varies. Choose **More → AI** to set an annotation target and review proposals.
AI edits require stable operation IDs. Only AI-owned annotations can be changed automatically; edits to student work require approval of the exact proposal. Imported pages and locked shapes remain protected. AI tools can create editable drawing/highlight strokes as well as text annotations; this is not automatic handwriting imitation. Optional review logging connects to an existing configured Math Learning System; that system and personal study records are not included. When configured, **More → AI → View canonical learning review history** displays its recorded checks.
## Architecture and privacy
The browser handles drawing locally. Python validates and saves notebook edits, while server-sent events carry updates between connected clients. The native app reuses the same web drawing engine. [Architecture and configuration](docs/DETAILS.md)
Private notebooks, page images, tokens, pairing state, backups, and review evidence live in `data/` and are excluded from Git. **More → Recovery / Help** exports unsent edits and preserved conflicts, including a separate notebook with recovered local versions. Browser recovery belongs to its exact origin and does not provide full offline startup. When you ask an AI to read a page, that content goes to the configured AI service under its policies.
The local bridge uses HTTP, so traffic is not encrypted. Use a trusted network; public hosting and untrusted-network access are unsupported. Same-disk backups are not disaster backups. [Security](docs/SECURITY.md) · [Recovery](docs/RECOVERY.md)
## Development and verification
```sh
.venv/bin/python -m pip install -r requirements-dev.txt
.venv/bin/python test.py
```
Tests use disposable notebooks and synthetic course records. The optional external-controller integration is skipped unless explicitly configured. CI runs backend/client tests and Chromium/WebKit workflows. See the badge for hosted status, rather than treating local results as a guarantee.
[Verification record](docs/RELEASE_TESTS.md) · [Performance measurements](docs/PERFORMANCE.md) · [Compatibility](docs/COMPATIBILITY.md) · [Contributing](CONTRIBUTING.md) · [Changelog](CHANGELOG.md)
## Authorship
I design the features and test them, using AI coding tools for implementation. I am learning the Python backend as I maintain it; browser drawing and input stay in JavaScript, and native Apple Pencil integration uses Swift.
## Automatic startup on macOS
Run `python3 board.py autostart install` once to install a per-user LaunchAgent.
After that, bookmark **http://localhost:8787** on the Mac. The service starts at
login, restarts after exit, and leaves normal Mac sleep enabled. The Mac must be
awake and logged in for the iPad to connect. No Terminal window is required.
The installer creates a dedicated Python environment in
`~/Library/Application Support/GPT Board/`, plus **Open GPT Board.webloc** and
**GPT Board Status.command** in that folder. Notebook data stays in the existing
installation. If a manually launched board is already running, automatic startup
monitors it without interruption and takes over after it exits.
- `python3 board.py autostart status` shows launchd state and the log location.
- `python3 board.py autostart disable` stops/disables the managed service.
- `python3 board.py autostart uninstall` also removes the LaunchAgent definition;
notebooks, pairing, runtime and logs are retained.
- Running `install` again re-enables the service. Updates to a running job's
configuration apply on its next start; never stop it while writing is unsaved.
Use the **Connect iPad** hostname URL (`http://<Mac-name>.local:8788`), not a
changing numerical IP. Both devices must share a network that permits local
connections. The bridge rebinds after network changes. Hostname matching is case-insensitive.
When a cable is attached, explicit local cable listeners prevent Bonjour from
resolving to an address that the bridge does not serve; this does not expose the
backend/MCP or listen on arbitrary VPN/public interfaces. The native app retries a
failed connection with bounded backoff, and keeps an already-loaded board open
while its normal save/event connections recover. A changed hostname or expired/
revoked pairing still requires explicit setup. Switching origins does not move
browser recovery journals; save/export pending work before switching.
The native app backs up its own exact-origin pairing cookie in the iPad Keychain
and restores a valid backup before loading that same origin. It does not copy
Safari pairing, share tokens between hosts, or override server revocation and
30-day inactivity expiry. Install the updated native build to get this behavior.
Service logs rotate at 5 MB with three backups under `~/Library/Logs/GPT Board/`.
### Optional stable private connection with Tailscale
If Wi-Fi cannot resolve the Mac's `.local` name, connect both devices to the same
private Tailscale network. Use **HTTPS** for the native iPad app: its App Transport
Security policy can reject plain HTTP to Tailscale addresses, even though the VPN
itself encrypts traffic. Keep the app's security policy enabled.
1. Sign in and enable Tailscale on both devices. In its admin DNS settings, enable
HTTPS certificates. Certificate Transparency records the device's DNS name;
the board itself stays private. See [Tailscale's HTTPS guide](https://tailscale.com/docs/how-to/set-up-https-certificates).
2. Put the Mac's full Tailscale DNS name in the untracked local file
`data/private-connection.json`, for example
`{"https_host":"my-mac.tail123.ts.net"}`. Substitute the actual device name.
3. Run `tailscale serve --bg --tls-terminated-tcp=443 tcp://127.0.0.1:8788`
(substitute the bridge port if customized). On macOS the CLI is also available
at `/Applications/Tailscale.app/Contents/MacOS/Tailscale`.
4. Verify the HTTPS URL, then use the address shown by **Connect iPad** and pair
the native app once. Keep Tailscale connected on both devices.
The bridge rereads configuration every five seconds. In HTTPS mode it adds a
**loopback-only** listener for Tailscale's TLS forwarding. This listener accepts
only the configured HTTPS hostname/origin, issues Secure/HttpOnly pairing cookies,
and enforces the same pairing and route restrictions as Wi-Fi. It never forwards
MCP/admin routes. Use private **Serve**, not public Funnel, and never forward
Tailscale directly to the unrestricted Mac backend on port 8787. Tailscale handles
certificate provisioning/renewal; no custom certificate bypass is required.
The optional `{"host":"100.x.y.z"}` configuration still supports a specific
Tailscale IPv4 HTTP listener for compatible browser clients; it is not the native
iPad setup. No VPN interface is exposed automatically.
Existing cookies and unsaved browser recovery data belong to their original
address; save/export pending work before switching. Keep the same Tailscale device
registration and saved HTTPS URL when changing Wi-Fi. The Mac must still be awake
and the server running. To disable private access, run
`tailscale serve --tls-terminated-tcp=443 off` and remove
`data/private-connection.json`. Notebooks and pairing records are retained.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues