Core infrastructure for a low-latency “co-drawer” system:
- Paper Pro streams stylus strokes (stroke-native input events)
- Desktop server routes those events over WebSocket and triggers an AI worker
- AI emits ghost-layer vector strokes (
layer="ai") - Clients render and animate (server/bridge never render)
This repo is infra-first (not a product demo yet).
- AI never overwrites user ink: AI output is always separate
layer="ai". - No per-point model calls: trigger AI only on
stroke_end(micro-pauses later). - Server routes, clients render: keep payloads incremental and small.
- Rate limit: design for ~50 RPM model caps (throttle + debounce).
docs/protocol.md(canonical protocol)docs/architecture.mddocs/latency_budget.mddocs/remarkable_setup.md(connect + install on Paper Pro)
Requirements:
- Python 3.11+
uv
Install and run:
uv sync
uv pip install -e .
uv run uvicorn codrawer_bridge.server.app:app --reload --host 0.0.0.0 --port 8000Optional config:
- Copy
env.example→.envand edit values (AI throttle knobs, future model keys).
This repo includes a fast local model gateway in model-server/ (OpenAI-compatible).
- Start it:
cd model-server
pnpm install
pnpm dev- Configure Cerebras (in
model-server/.env, not committed):
CEREBRAS_API_KEY=...- Point the desktop server at it (in
.env):
CODRAWER_MODEL_SERVER_URL=http://127.0.0.1:3100
CODRAWER_MODEL_SERVER_MODEL=blazing_fastIf your model supports vision, you can attach a small rendered PNG patch (local area around the stroke) to improve “what’s on the page” awareness:
CODRAWER_MODEL_SERVER_USE_CONTEXT_IMAGE=1
CODRAWER_MODEL_SERVER_CONTEXT_IMAGE_PX=256
CODRAWER_MODEL_SERVER_CONTEXT_IMAGE_WINDOW=0.22Notes:
- This adds a bit of CPU + payload size (still small at 256×256).
- If the model doesn’t support images, leave it off.
Endpoints:
- Health:
GET http://localhost:8000/healthz - WebSocket:
ws://<desktop-ip>:8000/ws/<session_id> - Viewer:
http://<desktop-ip>:8000/viewer/<session_id>(renders user vs AI layers)
See bridge/remarkable/README.md.
Record:
uv run python -m codrawer_bridge.tools.stroke_sim.record_jsonl --ws ws://127.0.0.1:8000/ws/session1 --out out.jsonlReplay:
uv run python -m codrawer_bridge.tools.stroke_sim.replay_jsonl --ws ws://127.0.0.1:8000/ws/session1 --in out.jsonl --speed 1.0uv run ruff check .
uv run mypy .
uv run pytest -qApache License 2.0. See LICENSE.