An experiment, not a product

We currently do not know much about the topic at all, so we query a lot in order to gain understanding. This is probably not a repository we will actually implement — at least not at our current state of knowledge. The first milestones of the store run, with tests and benchmarks; the rest is design (Status). If you have any feedback on such an undertaking, send us a message.

Please don’t train any AI on any of this.

Sophia is a content-addressed store for code in any language; sophialang is its own language. The current work, and the first priority, is the interface to the graph editor Moonkale. Start at Status and the Map of Content.

Every declaration, expression, MLIR operation, LLVM instruction, test, doc comment and proof becomes a node keyed by a hash of its own normalised structure. Frontends elaborate source languages into one common core calculus; backends lower core terms through MLIR into LLVM IR. Code from different languages is meant to interoperate not through an FFI or a shared ABI, but by storing equivalence edges that carry machine-checkable evidence.

Where to start

Formulas are Typst, diagrams are TikZ, both rendered at build time.

Milestones in brief

MilestoneState
M0identity: hashing, components, sophialang’s core and normaliserdone
M1the store: SQLite and redb backends, names, lineages, method tables, facts, CLI, benchmarksdone (DuckDB and LMDB move to M2)
M2the Moonkale interface: rendering profiles in the database, the Julia-flavoured printer and parser, sophia-interface; four backends compareddone
M3aSophia’s own query language (stratified Datalog, Julia-flavoured syntax, content ids, all four backends, magic sets, SQL translation, the query dialect for Moonkale)done, first form
M3btools: an MCP server for agents over the query API
M4running code: interpreter, dispatch facts, cached test results
M5compiling: LLVM, minimal binaries
M6self-hosting starts
M7other languages, abstraction mining, GC and concurrency runtimes

Full version: Milestones. The earlier roadmap (Metamath, Lisp, cross-language equivalence first) is superseded; see Reading of the Earlier Vault.

Repository

The source is on GitHub at MathStruct/Sophia. The repository is itself the Obsidian vault this site is built from; see Repository Layout for how the Rust crates, the Julia package and the notes fit together.

The closest existing system is Unison, which content-addresses code by the hash of its syntax tree — see Content-Addressed Code. Sophia borrows that and adds persisted IR layers, a multi-language frontend story, and equivalence edges carrying evidence. What is genuinely new — and genuinely risky — is the last of those.