Skip to content

About

Single-EXE Blackwell NVFP4/MXFP8 local AI inference studio in pure Go + Python (WebView2, GWC WASM, KnowLine routing, local voice, live applets, MCP).

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inkling Studio

Inkling Studio

One binary. Custom Blackwell NVFP4/MXFP8 inference. Local voice, KnowLine System-1 routing, live controllable applets, and a GoWebComponents v8 UI.

CI GitHub Pages Live Docs Release Stack Hardware License

Quick Start · Single-EXE Runtime · Benchmarks · Capabilities · Extending / Plugins · Architecture · API & MCP · GitHub Pages Docs


Inkling Studio is a high-performance local AI inference engine, native Windows desktop + system tray app, headless LAN server, and mobile PWA built for thinkingmachines/Inkling-2-Mini.

Instead of juggling separate Node.js frontends, Electron wrappers, and external Python scripts, InklingStudio.exe compiles the entire GoWebComponents v8 WebAssembly UI, WebView2 desktop + system tray host, LAN web server, and all 47 inkling_server Python modules into one pure-Go (CGO_ENABLED=0) executable that hosts CPython (python312.dll) in-process.

Pure Go + Python only — zero Node.js, zero npm, zero Vite, zero Electron, and zero external python.exe server processes.


✨ Highlights

Pillar What It Does
Single-EXE Architecture Run InklingStudio.exe for native WebView2 + System Tray or InklingStudio.exe --headless for a headless LAN server. All 47 Python backend modules are embedded via //go:embed and executed in-process through internal/pyhost (CGO_ENABLED=0).
Blackwell NVFP4 / MXFP8 Engine Streams safetensors directly to GPU via an 8 MiB host buffer (~18.2 GiB footprint vs ~49.3 GiB expanded). Custom Triton tl.dot_scaled kernels reach 164.3 TFLOPS (NVFP4), 3,753 tok/s real-checkpoint prefill (6.03× speedup), and 39.0 tok/s CUDA-Graph decode (97.4% of raw graph speed).
KnowLine-4B System-1 ("JEV") Dual-head schema-driven tool router (prompt_scope + tool_route) with zero-overhead complexity fast-pass, async thinking voice-line selector (12 JEV thought types × 5 tonal variations = 60 spoken cues), and idle-time SQLite prompt-stats analytics.
Full Local Voice & Dialog Mode Streaming Nemotron 0.6B ASR, CPU Silero VAD hands-free wake word ("Computer, ..." with barge-in ducking), and 3 local TTS engines (MagpieTTS ~15× RT CUDA, Kokoro-82M 54 voices 0 VRAM, Qwen3-TTS 1.7B). Spoken Dialog Mode & TTS automatically spell out numbers ($214,205 → "two hundred and fourteen thousand two hundred and five dollars").
Blended Live Applets & Automation 20 prebuilt interactive widgets (calculator, pomodoro, budget_tracker, slider, toggle, color_picker, thermostat, control_panel, …) + programmable backend actions (applet_action_register for Windows volume/media, WLED, Hue, Home Assistant) rendered borderless in chat at exact content height.
Exact Math, Search, Browser & Memory Code-verified math (math_calc, 25 math_equation formulas, isolated math_python sandbox), zero-key DuckDuckGo / Tavily / Brave / SearXNG web search + SSRF-safe web_fetch, Playwright Edge browser panel, read-only local FS, durable memory / journal / notepad, and contextual thread reminders.
Inkling Remote Mobile PWA Dedicated mobile.wasm phone app + authenticated inkling-remote.exe gateway (8-digit pairing, HttpOnly cookies, LAN HTTPS + VPS SSH tunnel, live SQLite thread sync, dictation & wake word).
OpenAI /v1, OpenCode & MCP Drop-in /v1/chat/completions streaming (delta.reasoning_content, vision up to 10 images, structured JSON, tools, skills), preconfigured opencode.json, bidirectional MCP (stdio + /mcp), and SQLite diagnostics/recovery tools.

🚀 Quick Start

1. Set Up the Local Python CUDA Environment

Install Python 3.12 (Windows ARM64/x64) with NVIDIA CUDA drivers:

python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt

Download thinkingmachines/Inkling-2-Mini to a local folder (default ~/models/Inkling-2-Mini), then either set INKLING_MODEL_PATH, copy settings.example.json → settings.json, or configure the path in Settings.

2. Build the Single Executable (Requires Go 1.27+)

# Compiles app.wasm, mobile.wasm, unified bin/InklingStudio.exe, and bin/inkling-remote.exe
go run ./tools/build -target all

3. Launch Inkling Studio

# Native Windows WebView2 Desktop + System Tray + Embedded Python Backend
.\bin\InklingStudio.exe

# Headless LAN/Local Server (no window, no tray, same single exe)
.\bin\InklingStudio.exe --headless

# Headless on a custom port
.\bin\InklingStudio.exe --headless --addr :8298

# Start minimized directly into the Windows Notification Area tray
.\bin\InklingStudio.exe --tray-only

# Verify embedded WASM, icons, and 47 Python modules
.\bin\InklingStudio.exe --smoke-test

Pin to Start Menu / Desktop with custom icon:

.\install_shortcut.ps1

🧩 Single-EXE Runtime

On Windows, bin/InklingStudio.exe hosts the Python backend in-process by default using pure Go (CGO_ENABLED=0) and Win32 LoadLibraryEx:

  • 47 embedded Python modules: Compiled directly into the binary via inkling_server/embed.go (//go:embed *.py) and loaded in-memory via a sys.meta_path loader—no loose .py files required on disk.
  • Zero GIL / signal conflicts: Runs uvicorn.Server on one persistent OS-locked goroutine (Py_InitializeEx(0)), releases the GIL while idle (PyEval_SaveThread), shuts down cleanly via a Win32 manual-reset event (CreateEvent / SetEvent), and calls Py_FinalizeEx on quit so CUDA/PyTorch/OpenMP tear down cleanly.
  • Self-hosted Python subcommands: InklingStudio.exe acts as sys.executable and handles -I -c (isolated math sandbox), -c (applet Python actions), and -u -m (tts_worker) directly.
  • Developer escape hatches:
    • --external-backend (or INKLING_EXTERNAL_BACKEND=1) launches the legacy external python.exe -m inkling_server.managed worker.
    • INKLING_USE_DISK_PYTHON=1 loads inkling_server/*.py from disk for rapid Python iteration without rebuilding the .exe.

Note on binary runtime assets: Large native wheels and weights (python312.dll, .venv/Lib/site-packages for PyTorch/CUDA/Triton, model checkpoints, and engines/nemo-speech) remain external on disk alongside the workspace.


⚡ Benchmarks

Measured on real Inkling-2-Mini checkpoints on RTX Spark N1X / GB10 (Blackwell SM 12.1, 48 SMs, 96 GiB dedicated) — see devlog.md for full profiling traces.

Blackwell Inference Kernels & Decode Pipeline

Stage Baseline Optimized Gain
NVFP4 tl.dot_scaled GEMM (e2m1 + e4m3) 52.5 TFLOPS (BF16) 164.3 TFLOPS 3.13×
MXFP8 tl.dot_scaled GEMM (e4m3 + ue8m0) 52.5 TFLOPS (BF16) 87.7 TFLOPS 1.67×
Real 7.7K-token prefill (Inkling-2-Mini) 617 tok/s 3,723–3,753 tok/s 6.03×
Real 16.5K Needle-in-a-Haystack prefill — 3,221 tok/s (21.2 GiB VRAM) Exact retrieval
Sampling temp=0 (200K vocab) 1.24 ms/tok 0.079 ms/tok (Triton argmax) 15.7×
Sampling temp=0.8, top_p=0.9 (200K vocab) 5.06 ms/tok (torch.sort) 0.236 ms/tok (4-stage Triton nucleus) 21.4×
Streaming BPE decode (1,500 tok) 257 ms O(N²) 3.19 ms O(1) (0.0021 ms/tok) 80.6×
End-to-end generate() decode (temp=0 / top_p=0.9) ~27–38 tok/s 39.02 / 38.97 tok/s (97.4% of raw graph) Zero top-p loss

Serving, ASGI & Host Proxy Latency

Operation Before After Speedup
POST /v1/chat/completions SSE (200-tok burst) 58.21 ms (0.291 ms/tok) 1.625 ms (0.0081 ms/tok) 35.8×
POST /v1/chat/completions non-streaming (200 tok) 21.51 ms 0.638 ms 33.7×
ModelService.stream() bridge (200-tok burst) 50.98 ms 0.387 ms 131.7×
GET /api/status 2.423 ms 0.511 ms 4.7×
voice_manager.status() probe 2.586 ms 0.006 ms 431×
Go reverse-proxy SSE flush delay up to 40.0 ms/chunk 0 ms (FlushInterval = -1) Instant

🏗 Architecture

flowchart TB
    subgraph EXE["InklingStudio.exe — Single Pure-Go Binary (CGO_ENABLED=0)"]
        UI["WebView2 Desktop + System Tray<br/>(or --headless CLI Server)"]
        WASM["GoWebComponents v8 WASM<br/>app.wasm · 5-Locale i18n · Virtualized Transcript"]
        DOM["Pure-Go Domain Layer (internal/domain)<br/>Chat · Markdown · Charts · Applet Host · Voice DSP"]
        WEB["Go Web Host & Low-Latency SSE Proxy (:8298)"]
        PYHOST["In-Process CPython Host (internal/pyhost)<br/>LoadLibraryEx(python312.dll) · 47 Embedded Modules"]
    end

    subgraph PY["Embedded inkling_server (:8297 In-Process)"]
        API["FastAPI + Zero-Overhead ASGI Middleware<br/>/v1/* · /api/* · /mcp · WebSockets"]
        ENG["InklingEngine<br/>Blackwell NVFP4/MXFP8 · Triton · CUDA Graphs"]
        JEV["KnowLine-4B System-1 (JEV)<br/>Tool Router · Async Thinking Cues · Prompt Stats"]
        VOICE["Voice Manager<br/>Nemotron ASR · Silero VAD · Magpie / Kokoro / Qwen3"]
        TOOLS["Local Tools & Stores<br/>Math · Search · Browser · FS · Applets · Memory/Journal/Notepad · SQLite Sync"]
    end

    REMOTE["Inkling Remote (bin/inkling-remote.exe)<br/>mobile.wasm PWA · 8-Digit Pairing · LAN HTTPS / VPS Tunnel"]

    UI --> WASM --> DOM
    WASM <--> WEB <--> API
    PYHOST --> API
    API --> ENG
    API --> JEV
    API --> VOICE
    API --> TOOLS
    REMOTE <--> API
Loading

Repository Layout

  • cmd/desktop/ — Unified InklingStudio.exe entry point (native WebView2 + System Tray + --headless + --smoke-test + Windows console attach).
  • internal/pyhost/ — Pure-Go in-process CPython DLL loader, zlib/base64 MetaPathFinder bootstrap, Win32 event shutdown, and -I/-u/-c/-m subcommand dispatch.
  • internal/domain/ — Pure Go domain models, chat/tool/skill rules, Markdown/GFM-table/SVG-chart parser, applet host kit, thread sync, connection state machine, voice barge-in, and zero-alloc WakeGate DSP (zero DOM/JS imports).
  • frontend/ — GoWebComponents v8 WASM desktop (app.wasm) and mobile (mobile.wasm) views and thin browser transport adapters.
  • internal/remote/ & remote/ — Standalone mobile PWA gateway (bin/inkling-remote.exe), 8-digit pairing auth, rate limiting, and VPS SSH tunnel tooling.
  • inkling_server/ — Embedded Python FastAPI server, Blackwell NVFP4/MXFP8 inference kernels, KnowLine System-1 router (tool_router.py), async JEV thinking cues (thinking_cues.py), voice/number-spelling (voice.py, wake.py), math engine, prompt stats, programmable applet actions, and SQLite thread/diagnostics stores.
  • internal/e2e/ — Pure-Go Playwright Chromium E2E test harness against the real compiled WASM bundles.
  • docs/ — Zero-JS GitHub Pages documentation & showcase site (docs/index.html) and KnowLine guide (docs/decision-model.md).

🧠 Capabilities

KnowLine-4B System-1 ("JEV") Layer

  • Two-head dynamic tool router (tool_router.py): Scores both prompt_scope (simple_direct, single_tool, complex_multi, unclear_vague) and tool_route directly from declared OpenAI tool schemas—fast-passing complex multi-step requests straight to the full toolset with zero steering bias.
  • Async thinking voice-line selector (thinking_cues.py): Classifies thoughts across 12 JEV categories × 5 tones (60 unique TTS lines) asynchronously alongside streaming with anti-repeat probability sampling and instant heuristic fallback.
  • Idle-time prompt analytics (prompt_stats.py): Tracks mood, valence, urgency, curiosity, energy, cognitive load, and 24-hour rhythms in SQLite WAL only while the GPU is idle (stats_trends).
  • See docs/decision-model.md for KnowLine installation (python -m tools.install_decision) and /v1/systemone API usage.

Local Voice, Wake Word & Spoken Dialog Mode

  • Streaming STT: Local NVIDIA Nemotron 0.6B ASR (nemo-speech.exe CUDA) over WS /api/voice/stt/realtime.
  • Hands-free wake word: Zero-alloc WASM RMS gate + CPU Silero VAD ONNX (~0.12 ms/frame) supporting single-breath commands ("Computer, set a 5-minute timer") and barge-in audio ducking.
  • Multi-engine TTS: Switch live via UI, REST, or voice_set tool between MagpieTTS (CUDA ~15× RT), Kokoro-82M (CPU, 54 voices, 0 GiB VRAM), and Qwen3-TTS 1.7B.
  • Spoken Dialog Mode & TTS Number Spelling: Instructs the agent to speak in natural prose and deterministically spells out currencies ($214,205 → "two hundred and fourteen thousand two hundred and five dollars"), percentages, decimals, clock times, ordinals, and ranges inside prepare_text_for_speech().

Blended Live Applets & Hardware/LAN Automation

  • 20 built-in presets (calculator, timer, stopwatch, pomodoro, todo, unit_converter, world_clock, habit_tracker, expense_splitter, budget_tracker, scratchpad, decision_wheel, slider, toggle, button_pad, color_picker, thermostat, media_remote, status_monitor, control_panel) rendered borderless inside chat at exact content height.
  • Programmable backend actions (applet_action_register): Wire chat widgets to Windows master volume/media keys, psutil telemetry, Wake-on-LAN, WLED, Philips Hue, Home Assistant, or any LAN REST endpoint through the sandboxed window.inklingAction(name, payload) bridge.

Inkling Remote (Standalone Phone PWA)

  • Dedicated GoWebComponents mobile.wasm app with local threads, offline reconnection backoff, 8-digit pairing code (POST /gateway/pair, HttpOnly SameSite=Strict cookie), live SQLite thread sync, dictation, and wake word.
  • Works on home Wi-Fi via Start Inkling Mobile LAN.cmd (tools/lan_https.py --mobile, port 8444) or from anywhere via an outbound SSH tunnel to your Linux VPS (remote/prepare.py + Start Inkling Remote.cmd --connect).

🔌 API, OpenCode & MCP

OpenAI-Compatible API (/v1)

Base URL: http://127.0.0.1:8297/v1 · Model ID: inkling-2-mini

$body = @{
  model = 'inkling-2-mini'
  messages = @(@{ role = 'user'; content = 'Explain Blackwell NVFP4 in two sentences.' })
  max_tokens = 256
  reasoning_effort = 'low'
} | ConvertTo-Json -Depth 8
Invoke-RestMethod http://127.0.0.1:8297/v1/chat/completions -Method Post -ContentType 'application/json' -Body $body

Supports streaming (delta.reasoning_content), stream_options.include_usage, reasoning_effort, response_format (text / json_object / json_schema), tools / tool_choice, skills, context compaction, and multi-image image_url (up to 10 images).

OpenCode & Bidirectional MCP

  • OpenCode: Ready out of the box via opencode.json (includes inkling/inkling-2-mini reasoning variants + local inkling-maintenance stdio MCP server).
  • MCP Server: Streamable HTTP JSON-RPC 2.0 at POST http://127.0.0.1:8297/mcp (inkling_status, inkling_chat, inkling_decide, voice_list, voice_set, web_search, web_fetch).
  • MCP Client: Connect arbitrary external stdio or http MCP servers in Settings → MCP servers (mcp_<server>__<tool>).

Key REST & WebSocket Endpoints

Domain Endpoints
Inference & Model POST /v1/chat/completions, GET /v1/models, GET /api/status, POST /api/model/load, POST /api/model/unload, PUT /api/settings
KnowLine System-1 POST /v1/systemone, GET /api/decision/status, POST /api/decision/load, POST /api/decision/route, POST /api/decision/unload
Voice & Wake POST /api/voice/tts, POST /api/voice/stt, POST /api/voice/thinking-cue, PUT /api/voice/config, WS /api/voice/stt/realtime, WS /api/voice/wake
Tools & Applets /api/{search,fs,browser,memory,journal,notepad,math,stats,notify,applets,mcp}/{tools,call}, POST /api/applets/actions/{name}/run
Threads & Sync GET/POST /api/threads, PUT/DELETE /api/threads/{id}, POST /api/threads/sync

⚙️ Configuration & LAN Security

Runtime settings live in gitignored settings.json (template: settings.example.json).

Variable Purpose Default
INKLING_MODEL_PATH Inkling-2-Mini safetensors directory ~/models/Inkling-2-Mini
INKLING_DECISION_MODEL_PATH KnowLine-4B-Gen5.5 directory ~/models/KnowLine-4B-Gen5.5
INKLING_HOST Backend bind address (127.0.0.1 for local-only) 0.0.0.0
INKLING_EXTERNAL_BACKEND Set 1 to force external python.exe worker 0 (embedded in-process)
INKLING_USE_DISK_PYTHON Set 1 to load on-disk .py files instead of embedded 0
INKLING_LOG_LEVEL Minimum severity persisted to logs/diagnostics.db DEBUG
  • LAN access: Listens on :8298 (GWC Web UI) and :8297 (API/MCP) with private-LAN/loopback CSRF origin checks (403 on foreign origins). Run .\allow_lan_firewall.ps1 once as Administrator if Windows Defender Firewall blocks LAN devices. See SECURITY.md.
  • Diagnostics & Recovery: Query structured operational logs with python -m inkling_server.maintenance logs --level ERROR --limit 20 or trigger verified recovery via python -m inkling_server.maintenance recover --wait.
  • Run python -m benchmarks.gwc to profile Studio and mobile rendering. The command records native render timings and allocations, sampled view hotspots, shared chat algorithm timings, and browser composer latency under one request ID. Use python -m inkling_server.maintenance logs --component frontend --event render.algorithm to compare algorithm runs. The transcript lookup benchmark reuses its index between measurements, as the client does between layout changes.

🧪 Testing & CI

Automated GitHub Actions workflows run on every push/PR (.github/workflows/ci.yml) and publish multi-arch releases on v*.*.* tags (.github/workflows/release.yml):

# 1. Build unified InklingStudio.exe, WASM bundles, and remote gateway
go run ./tools/build -target all

# 2. Go static analysis, unit tests, and embedded desktop smoke test
go vet ./internal/... ./cmd/... ./tools/...
go test -v ./internal/domain/... ./internal/backend/... ./internal/webhost/... ./internal/l10n/... ./internal/remote/... ./internal/pyhost/... ./frontend/view/...
.\bin\InklingStudio.exe --smoke-test

# 3. Go Playwright Chromium E2E UI suite
go test -v -timeout 240s ./internal/e2e/...

# 4. Python backend unit test suites (17 suites, 85 tests)
.\.venv\Scripts\python.exe -m unittest tests.test_api tests.test_voice tests.test_thinking_cues tests.test_tool_router tests.test_mcp tests.test_search tests.test_fs tests.test_memory tests.test_notes tests.test_math tests.test_prompt_stats tests.test_threads tests.test_applet_presets tests.test_applet_actions tests.test_diagnostics tests.test_tool_protocol tests.test_service_concurrency

# 5. CUDA Blackwell NVFP4 / MXFP8 hardware kernel verification (GPU required)
.\.venv\Scripts\python.exe -m unittest tests.test_quantized_matmul

📄 License

Licensed under the MIT License.

About

Single-EXE Blackwell NVFP4/MXFP8 local AI inference studio in pure Go + Python (WebView2, GWC WASM, KnowLine routing, local voice, live applets, MCP).

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages