Open-source research collective

Structure that composes.

We build tooling for mathematics, scientific computing and AI/ML: libraries, editors and stores in which models, code and knowledge are made of parts that compose, with the mathematics that says why they compose written down next to the code.

A factor graph: variables joined by factors, with messages passing along the wires x y z θ h w
Projects

One idea, three layers.

Most tools treat a model as a function, a program as text in files, and knowledge as documents in folders. We treat all three as graphs of parts with typed interfaces, and build one project per layer, on a shared mathematical foundation.

  1. 01 models

    Lenticulum.jl

    Learn relations, not functions.

    Probabilistic models you can condition on any variable, composed as factor graphs, with uncertainty carried through as distributions.

    • Diffusion models and other implicit models, conditioned on any variable
    • Every message is exact or explicitly marked as an approximation
    • Message passing and variational free energies, tested against closed-form results
  2. 02 code

    Sophia

    Code, keyed by its structure.

    A content-addressed store for code in any language: definitions keyed by the hash of their structure, with proofs, tests and cross-language equivalences attached as evidence.

    • Code stored by the hash of its structure, so identical definitions are stored once
    • A Datalog query language for asking what uses, proves or depends on what
    • Shows which axioms each theorem in a large library of checked proofs rests on
  3. 03 interface

    Moonkale

    One graph, every editor a view.

    A graph-native editor: files, symbols, notes, databases and relations are one graph, and every editor is a view on it, for people and AI agents alike.

    • Code with language servers; Markdown with wiki-links, KaTeX and Typst
    • GPU graph views of 100k nodes; databases as tables and graphs
    • LLM agents that act only with your approval, and an MCP server for other AI tools
    Working prototype Rust · Linux, web, Android
    Overview
  4. 04 foundation

    Category Theory & ML Wiki

    Knowledge you can run.

    MathStruct's shared knowledge graph: category theory where it shows up in learning, inference, databases and compilers, one note per concept, with code in Julia, Lean 4 and Haskell.

    • One note per concept, bringing together textbooks and papers
    • Exercises, each with a worked solution
    • The theory that Lenticulum.jl and Sophia build on
    Living wiki · first draft Obsidian vault
    Overview

We are early, and we say so plainly. Each project lists what works, what does not, and what is planned.

Approach

Research, written down.

Every project is also a published vault of linked notes: the theory, the design decisions and the dead ends sit beside the code they explain, and every page can be commented on.

01

Open by default

Code, notes, design decisions and negative results are public. The software is MIT-licensed.

02

Every project is a vault

Concepts, derivations and design notes link to each other and to the code, including what it does not do and what went wrong on the way.

03

Tested against what is known

Where a closed form exists, the code is tested against it. Approximations say that they are approximations.

04

Asynchronous, on GitHub

Issues, pull requests and discussions. A comment on any page of any vault goes straight into GitHub Discussions.

How the layers meet

Lenticulum to Moonkale

A Lenticulum model is a factor graph; Moonkale is to edit it as a diagram that stays a diagram instead of becoming code.

Sophia to Moonkale

Sophia is designed as the store that Moonkale edits: a definition, its proof and its tests are one node rather than three files.

Wiki to everything

Factors are Bayesian lenses and wiring is composition. The wiki is where that is worked out.

Writing

From the blog.

All posts →

Diagrams that compile: TikZ on a Quartz site

How TikZ diagrams get rendered to SVG at build time, and what that means for writing.

Writing formulas in Typst

A page where every formula is Typst rather than LaTeX, courtesy of one frontmatter line.

Welcome to the MathStruct blog

What this blog is for and what to expect here.

Work with us

Build it with us.

Researchers & contributors

Every page of every vault has a comment thread: sign in with GitHub and comment. Questions, corrections and "this is wrong" are all welcome. Contributions are credited, including authorship on releases.

Funders

The projects are open research infrastructure for mathematics, scientific computing and machine learning. Read what we are trying to do, and why.

Companies & investors

The open-source core stays open source. Applications built downstream of it can be commercial. If that interests you, get in touch.