Eve library

phase-107.md

Tracker

Revision 1

On this page

Historical task source. The Eve task board holds current task state.

Phase 107: Kalika UI/UX — Best-in-Industry Research Workbench Interface#

Implements the user interface that makes Kalika not just powerful but pleasurable to use for working mathematicians and physicists. Design principles derived from deep analysis of what makes Mathematica, Desmos, Pluto.jl, Observable, GeoGebra, and Overleaf successful — and what frustrates their users. The north star: type math, see math, immediately. Progressive disclosure from calculator simplicity to research-environment power. Reactive execution. Spatial thinking. Multi-modal input. Verified AI.


107.1 Reactive Notebook Engine (exceeding Pluto.jl + Marimo)#

107.1.1 Dataflow Architecture#

  • 107.1.1.1 Implement DAG-based reactive execution engine: statically analyze each cell's variable reads and writes, build dependency DAG, topologically sort for execution order, and automatically re-execute downstream cells when any upstream cell changes — matching Pluto.jl's reactivity model but for TypeScript/Kalika DSL cells (not just Julia)
  • 107.1.1.2 Implement single-definition rule with escape hatch: each variable defined in exactly one cell (eliminating hidden-state bugs that plague Jupyter), with an explicit %%mutable cell mode for exploratory work where reassignment is needed — balancing Pluto's strictness with practical research flexibility
  • 107.1.1.3 Implement automatic stale-state cleanup: when a cell is deleted, remove all its defined variables from the runtime immediately (unlike Jupyter where deleted cells leave ghost state), re-execute downstream cells that depended on removed variables (they should error cleanly)
  • 107.1.1.4 Implement incremental re-execution: when a cell changes, only re-execute cells whose transitive dependencies include the changed cell — not the entire notebook. Track fine-grained dependencies (if cell A defines x and y, and cell B only uses x, don't re-execute B when only the y-producing line of A changes)
  • 107.1.1.5 Implement execution status indicators: each cell shows real-time status (idle/queued/running/completed/errored) with execution time, and the dependency DAG is visualizable as a minimap showing data flow between cells — making the reactive computation transparent

107.1.2 Plain-Text File Format#

  • 107.1.2.1 Design and implement .kalika plain-text notebook format: cells delimited by lightweight markers (e.g., # %% [type]), human-readable and human-editable in any text editor, produces clean git diffs (no JSON noise), and supports all cell types (code, math, markdown, visualization) — learning from Marimo's pure-Python approach and Observable's HTML approach
  • 107.1.2.2 Implement bidirectional sync between .kalika file and UI: edits in the UI immediately write to the file, edits in a text editor (e.g., VS Code) immediately reflect in the UI (via file watcher) — enabling the "file-over-app" philosophy where the file is the source of truth
  • 107.1.2.3 Implement notebook metadata: embedded environment specification (Kalika version, library versions, random seeds) in the file header, enabling exact reproduction of results when the file is opened on another machine — matching Pluto.jl's built-in package management but for the Kalika ecosystem

107.2 Zero-Latency Math Input (exceeding Desmos + Mathematica)#

107.2.1 Type Math, See Math#

  • 107.2.1.1 Implement live LaTeX rendering in math cells: as the user types LaTeX, render the typeset output character-by-character in real time (no "run" button for display), with <50ms latency from keystroke to rendered update — matching Desmos's zero-latency feedback loop. Use KaTeX for speed (10x faster than MathJax for common expressions)
  • 107.2.1.2 Implement math autocomplete: as the user types \int, offer completion to \int_{a}^{b} f(x) \, dx with tab-stop navigation between placeholders (a, b, f(x)), matching LaTeX editor snippet behavior but in a computation context — every completed expression is both displayed AND evaluable
  • 107.2.1.3 Implement symbolic computation hotkeys: Shift+Enter evaluates the expression (via CAS), Ctrl+S simplifies, Ctrl+D differentiates (with respect to auto-detected variable), Ctrl+I integrates — single-keystroke access to core CAS operations, inspired by Mathematica's Shift+Enter but more granular
  • 107.2.1.4 Implement natural language math input: type "integrate sin x from 0 to pi" in a math cell and have it parsed to \int_0^{\pi} \sin(x) \, dx AND evaluated to 2 — using LLM-backed intent parsing (matching Wolfram|Alpha's NL input but running locally for speed, with Claude API fallback for complex queries)
  • 107.2.1.5 Implement LaTeX palette: clickable grid of common symbols, operators, and structures (fractions, integrals, sums, matrices, Greek letters, set notation, logic symbols) that insert LaTeX snippets at cursor — accessible via toolbar button or Ctrl+P popup, organized by category (calculus, algebra, logic, physics, sets)

107.2.2 Handwriting Recognition#

  • 107.2.2.1 Implement handwriting-to-LaTeX conversion for tablet/stylus input: on-device ML model recognizing mathematical handwriting (symbols, spatial layout, fractions, subscripts/superscripts, matrices) and converting to structured LaTeX — targeting Apple Pencil on iPad and stylus on touchscreen laptops, matching Apple Math Notes quality
  • 107.2.2.2 Implement ink-to-computation pipeline: handwritten expression → recognized LaTeX → Kalika Expr AST → CAS evaluation → typeset result displayed below handwriting — the full loop from pen stroke to computed answer, with ability to "accept" the recognition (replacing ink with typeset) or keep both
  • 107.2.2.3 Integrate MyScript iink SDK (or open-source alternative): leverage MyScript's encoder-decoder attention model for 20% lower error rate and 83% smaller model than traditional approaches, supporting math symbols and scientific notation — with offline capability (model runs on-device)

107.2.3 Voice Input#

  • 107.2.3.1 Implement voice-to-math input using LLM-powered contextual understanding: speak "the integral from zero to infinity of e to the minus x squared dx" and get \int_0^{\infty} e^{-x^2} \, dx — using Phoenix-style approach where an LLM interprets spoken math in context (knowing the current notebook state), eliminating the need for precise symbol dictation
  • 107.2.3.2 Implement voice commands for notebook operations: "simplify this", "differentiate with respect to t", "plot this from -5 to 5", "verify in Lean" — spoken commands that trigger CAS operations on the current cell's expression

107.3 Spatial Canvas Mode (exceeding Observable Canvas)#

107.3.1 Infinite Canvas#

  • 107.3.1.1 Implement infinite 2D canvas workspace: cells are rectangular nodes freely positionable on an infinite canvas (not just vertically stacked), with panning (drag), zooming (pinch/scroll), and minimap navigation — matching tldraw's canvas experience but for mathematical computation. Use R-tree spatial indexing for performance with 1000+ nodes
  • 107.3.1.2 Implement canvas connections: draw arrows/edges between cells to create explicit data dependencies (in addition to automatic variable-based dependencies), with data flowing along connections — creating visual dataflow programs, matching Observable Canvas but with CAS computation
  • 107.3.1.3 Implement canvas regions: group cells into named regions (e.g., "Setup", "Main Proof", "Numerical Verification", "Plots") with collapsible boundaries, shared styling, and independent zoom — supporting the non-linear, spatially organized way mathematicians actually work on scratch paper
  • 107.3.1.4 Implement dual mode: seamless switching between linear notebook mode (traditional vertical cell layout) and canvas mode (spatial layout) — the same underlying document, two views. Users who prefer linearity get it; users who prefer spatial thinking get that
  • 107.3.1.5 Implement freehand annotation: draw directly on the canvas with stylus/mouse (freehand lines, arrows, circles, highlights) overlaid on cells — for annotating proofs, marking important steps, drawing informal diagrams alongside formal computation

107.3.2 Direct Manipulation (GeoGebra-style)#

  • 107.3.2.1 Implement bidirectional visual-symbolic linking: drag a point on a plotted curve and watch the expression update (e.g., dragging the vertex of a parabola updates the a, h, k in a(x-h)^2 + k), or edit the expression and watch the plot update — matching GeoGebra's bidirectional link but generalized beyond geometry
  • 107.3.2.2 Implement parameter sliders with instant feedback: any parameterized expression (detected automatically or user-annotated) gets sliders that update ALL downstream cells and visualizations in real time as the user drags — matching Desmos's slider experience but in a full research environment with reactive propagation
  • 107.3.2.3 Implement drag-to-define: draw a region on a plot to define integration bounds, draw a contour in the complex plane for contour integration, draw a curve to define a parametric path — gesture-based mathematical input that directly creates symbolic expressions

107.4 AI-Integrated UX (Lean Copilot model)#

107.4.1 Verified AI Suggestions#

  • 107.4.1.1 Implement inline AI suggestions (ghost text): as the user types a proof or computation, show faded suggested next steps inline (like GitHub Copilot but for math) — suggestions are generated by Claude API with the current notebook context as prompt, and each suggestion carries a verification badge: "verified" (formally checked or numerically confirmed), "suggested" (unchecked), or "contradicted" (failed verification)
  • 107.4.1.2 Implement proof step suggestions: when the user is writing a proof and pauses, offer 2-3 alternative next steps in a non-intrusive dropdown (not auto-inserted), with each step annotated by its verification status and a brief explanation ("Apply Cauchy-Schwarz to the inner product terms") — matching Lean Copilot's tactic suggestion UX
  • 107.4.1.3 Implement "Explain this result" button: one-click button on any computed result that generates a natural language explanation of how the result was obtained, what it means, and what its implications are — using Claude API with the derivation chain as context, output displayed in a collapsible panel below the result
  • 107.4.1.4 Implement "Verify" button: one-click button on any result that triggers the verification pipeline (numerical spot-check → cross-CAS verification → formal verification attempt in Lean 4), with progress indicator and result displayed as a badge (green checkmark, yellow question mark, red X)
  • 107.4.1.5 Implement AI on-demand, not proactive: AI suggestions ONLY appear when explicitly requested (keystroke, button click, or detected stuckness after 30+ seconds on a cell with errors) — respecting researchers' deep thinking and avoiding the disruption of unsolicited suggestions. Configurable: users can opt into more proactive assistance

107.4.2 Research Assistant Panel#

  • 107.4.2.1 Implement side panel research assistant: a persistent side panel (togglable) where the user can ask natural language questions about the current work ("Is this identity known?", "What's the standard approach to this type of integral?", "Find papers about X"), with responses grounded in literature search (arXiv, INSPIRE) and knowledge graph traversal — NOT a general chatbot but a domain-expert assistant
  • 107.4.2.2 Implement context-aware literature suggestions: as the user works on a problem, the assistant periodically (and non-intrusively, as a badge count) identifies potentially relevant papers based on the mathematical content of the notebook — e.g., "3 papers found related to your computation of Calabi-Yau periods"
  • 107.4.2.3 Implement multi-alternative proof exploration: user writes "I want to prove X" → AI generates 3-5 high-level proof strategies (e.g., "by contradiction", "by induction on dimension", "using the spectral sequence") → user selects one → AI expands it into a detailed proof sketch → user refines/corrects → formally verifiable proof emerges

107.5 Animation & Dynamic Visualization#

  • 107.5.1.1 Implement Manim-style inline mathematical animations: from any parameterized expression or time-dependent system, generate smooth animated transitions directly in the notebook — "animate a(t) from 0 to 2pi" produces an inline animation of the expression's plot morphing, no export/render step needed
  • 107.5.1.2 Implement transition animations between mathematical states: "show the limit as n → infinity" animates the partial sums converging to the series value, "show the deformation from S^2 to T^2" animates the homotopy (where possible) — making abstract mathematical processes visible
  • 107.5.1.3 Implement Penrose-style declarative diagramming: specify mathematical objects and relationships in Kalika's expression language, and get publication-quality diagrams automatically laid out via constraint optimization — separation of content (what to draw) from style (how to draw it), matching CMU Penrose's Substance/Style/Domain separation
  • 107.5.1.4 Implement interactive 3D exploration: for any 3D visualization (manifold, surface, vector field, lattice), provide WebGL-based interactive rotation/zoom/pan with real-time parameter manipulation, cross-section slicing, and measurement tools (click two points to show geodesic distance)

107.6 Collaboration & Publishing#

  • 107.6.1.1 Implement real-time collaborative editing: CRDT-based (Yjs) concurrent editing of notebooks with cursor presence, cell-level locking during execution, and conflict-free merge — matching Google Docs/Overleaf collaboration quality
  • 107.6.1.2 Implement "Compute + Write" unified environment: seamlessly mix executable computation cells with prose/LaTeX writing cells, where figures and equations in the writing are generated by computation cells — closing the gap between Jupyter (computation) and Overleaf (writing) into a single environment where the paper IS the notebook
  • 107.6.1.3 Implement one-click paper export: select cells for publication → generate compilable LaTeX (RevTeX/amsart template) with auto-generated bibliography, properly numbered equations, and figures generated from visualization cells → preview PDF inline → optionally submit to arXiv via API
  • 107.6.1.4 Implement shareable computation links: generate a URL that opens the notebook in a read-only mode with all outputs pre-rendered, or in a "sandbox" mode where the reader can modify parameters and re-execute cells (via WASM CAS in their browser, no server needed) — for supplementary materials to papers

107.7 Accessibility#

  • 107.7.1.1 Implement MathML-based accessible math rendering: all mathematical output uses MathML as internal representation rendered via MathJax 4.0 with built-in screen reader support (speech output, braille output, expression exploration via arrow keys), intent attributes for disambiguation ("(0,5)" annotated as intent="point($1,$2)" vs intent="gcd($1,$2)")
  • 107.7.1.2 Implement keyboard-only navigation: full notebook operation without mouse — navigate cells (up/down), enter/exit cells (Enter/Escape), execute (Shift+Enter), access menus (Ctrl+Shift+P command palette), navigate expression trees (arrow keys within math output)
  • 107.7.1.3 Implement alternative representations: for every mathematical output, provide on-demand spoken description ("the integral from 0 to pi of sine x dx equals 2"), simplified representation (for cognitive accessibility), and braille (Nemeth/UEB Technical codes via MathJax)
  • 107.7.1.4 Implement high-contrast and customizable themes: dark mode, high-contrast mode, configurable font sizes for math and code, dyslexia-friendly font option (OpenDyslexic), and reduced-motion mode (disable animations)

107.8 Tests#

  • 107.8.1.1 Write reactive engine tests: verify DAG construction, topological sort, incremental re-execution, stale-state cleanup, cycle detection — minimum 100 test cases
  • 107.8.1.2 Write UI integration tests (Playwright/Cypress): verify math input → rendering → CAS evaluation loop, slider interaction → downstream update, canvas mode operations, collaboration sync — minimum 50 e2e test cases
  • 107.8.1.3 Write accessibility audit: automated axe-core/pa11y testing of all UI components, manual screen reader testing (VoiceOver, NVDA) of math rendering and navigation — WCAG 2.1 AA compliance for all features