Skip to content
This repository was archived by the owner on Oct 10, 2026. It is now read-only.
ceedot-rockPublic archive

About

CuNi: one program, same stdout across every language target — or it refuses to build. 53-target catalog, signed receipts.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

234 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

This repo has moved into the verse. Development continues at ceedot-rock/CuNIverse, in repo root. This copy is archived and read-only - history preserved, nothing lost.

CuNi (Code:uNiTY)

Audited checks License: AGPL-3.0-or-later / Commercial

product logo

What CuNi is

CuNi is a programming language with one hard rule: write your code once, and it either behaves exactly the same in every language it builds for — or it refuses to build at all.

It's for anyone who ships code where a small difference is a real loss: money math, escrow contracts, agent policies. One source emits to 53 targets, and cuni check proves they print byte-identical stdout before anything ships — no approximate mode, ever.

Here is why that matters. A program written in Python and the "same" program rewritten in JavaScript are never quite the same program. Tiny differences creep in: how numbers round, how text is handled, what happens at the edges. Most of the time nobody notices. Then money or data is on the line, and a rounding difference becomes a real loss.

CuNi eliminates that whole class of problem. You write one source file. CuNi can turn it into 53 targets — the top 50 languages (Python, JavaScript, Rust, C, Go, Java, SQL, even Solidity smart contracts that run on Ethereum) plus 3 onchain chain profiles. Before it hands you any of them, it proves they all produce identical output. If one target would behave even slightly differently, you don't get a subtly broken program. You get a refusal — and you fix the source.

The refusal is the product. Other tools try to paper over differences. CuNi treats a difference as a failed build.

This is why Agent Rider runs on CuNi. In a world where AI agents write and execute code across systems, "close enough" is how things break. Rider requires CuNi's exactness proof before an agent's policy is allowed to run: same behavior everywhere, or it doesn't run.

Trust Provable, in all things

CuNi's mission. Everywhere the industry trusts two implementations match, CuNi proves it — same stdout, or refuse. ("Replace trust with proof" was the 0.4.0-era line; the mission it named now leads the project.)

The three divisions sit under it, in build order: Code (the compiler — emitters, seats, stdlib, ingest, tooling), Financial (audit proofs, compliance code, verification gates), Onchain (chain emitters, cross-chain proofs). v0.4.0–v0.6.0 shipped the Code Division; v0.7.0 shipped the Financial Division (cuni audit); v0.8.0 ships the Onchain Division — six chain emitters, below.

That turns exactness into working infrastructure:

  • Cross-chain contracts — one escrow/transfer-validation law, proven identical on EVM (Solidity), Rust, and Go targets before anything deploys. See examples/proof-crosschain/.
  • Audit-grade finance — the bank's Java and the auditor's Python, gate-proven to agree. The new Java seat exists for exactly this.
  • Crypto conformance — one reference digest, three independent implementations (Rust, Python, Go) provably in agreement. See examples/proof-crypto/.
  • ML inference parity — the same scoring kernel bit-identical across Python, Rust, and C runtimes, so silent numeric drift gets caught before serving. Integer arithmetic throughout, because cross-language float exactness can't be guaranteed — and CuNi refuses rather than fakes. See examples/proof-mlparity/.
  • Firmware you can ship — control logic proven identical on C and Rust targets, with a refuse-to-promote gate: fail the proof, nothing ships. See examples/proof-firmware/.
  • SQL dialect portability — one query logic, SQLite/PostgreSQL/MySQL dialects, proven against real sqlite3. The new SQL seat.
  • Solana programs — one transfer-validation law compiled to an Anchor-shaped Solana program: the logic core gate-proven byte-identical, the program shell honestly delimited (not compiled here — no Solana toolchain on the check machine). See examples/proof-solana/ and docs/SOLANA.md.
  • Exact money math — the dec type: fixed-point decimals (scale 10⁴, truncation toward zero), same stdout on the 11 dec seats (Python, Rust, Go, JavaScript, TypeScript, C, C++, Ruby, Lua, Java, SQL) plus solc-compiled Solidity. See examples/proof-decimal/ and docs/DECIMAL.md.
  • Exact timestamps — the time type: int64 unix epochs, UTC only, strict ISO-8601 literals, time ± int / time − time arithmetic, parse_time / add_seconds / days_between — settlement, vesting, and expiries with byte-identical stdout on the 11 time seats (Python, Rust, Go, JavaScript, TypeScript, C, C++, Ruby, Lua, Java, SQL). The money-types pair with dec. See examples/proof-time/ and docs/TIME.md.
  • Standard library, wave 1 — JSON parse/emit (canonical form), unix timestamps, string ops, SHA-256: same behavior on every seat, honest refusals where a seat can't be exact. See docs/STDLIB.md.
  • Financial Division — cuni audit — state a money law once as .cuni; prove a foreign implementation (the bank's Java, the auditor's Python, a SQL script) prints byte-identical stdout to the proven gold, and file a signed JSON receipt. Gold gate runs the money seats (py, rs, go, java, sql); impls run by extension (.py/.go/.rs/.java/.sql). PASS or REFUSE is always filed — a failed gate never passes, refusals are signed and fileable too. cuni audit --gen-key mints the auditor's Ed25519 receipt-signing key. Three worked laws: tiered fees, interest accrual (dec × time), marginal withholding — see examples/finance/ and docs/FINANCIAL.md. Hosted verification $0.10/check.
  • Onchain Division — six chain emitters — one law, six chains: --emit-ink (Polkadot/Substrate), --emit-move (Aptos/Sui), --emit-vyper (EVM), --emit-cairo (Starknet), --emit-clarity (Stacks), --emit-cadence (Flow). Each emits the pure logic core the gate proves plus the chain shell in the chain's idiom, in two delimited regions; --emit-X-ref writes the runnable reference (Rust via rustc for ink!, Python for the rest) the gate proves byte-identical to gold. The fee-schedule law runs byte-identical on all six. Logic cores proven with real local toolchains; shells shape-asserted and snapshot-pinned, not compiled here (no chain toolchains on the check machine); nothing deployed. See docs/ONCHAIN.md. Profiles, not seats — the catalog stays 53 (50 + 3 onchain).

CuNi — Code uNiTY

Open CuNi Studio

Playground live Exactness CI v0.10.0 AGPL-3.0-or-later OR Commercial

One source. Emit every coding language. Exactness still runs Python, JavaScript, and Go — or the compiler refuses. Receipts name the program by source_hash, not by path.

CuNi is a small language with a hard exactness contract: a program either produces the same behavior on every supported target, or it does not compile. No approximate mode. --emit-all writes the catalog of coding languages. CuNi compiles one source into all 53 catalog entries. Forty-five of the top 50 — Python, Go, JavaScript, TypeScript, C, C++, C#, Java, Kotlin, Scala, Rust, Ruby, PHP, Lua, Perl, R, Julia, Elixir, Erlang, Haskell, OCaml, F#, Lisp, Clojure, Dart, Zig, Nim, Crystal, D, V, Ada, Pascal, Fortran, COBOL, Prolog, SQL, Assembly, Solidity, Groovy, Objective-C, Bash, PowerShell, Awk, Tcl, and Haxe — build through their real toolchains (Solidity compiles to a deployable EVM contract via solc); the other 5 (MATLAB and Visual Basic, which have no free Linux toolchain, plus Swift, Hack, and Smalltalk, which have no installable Linux toolchain) emit Python under a language-specific file extension and run under python3, so every target's output can actually be compared. cuni check runs the money-seat gate (py, rs, go, java, sql, js): byte-identical stdout everywhere, or the program refuses to compile. cuni check --all runs the full 53-entry catalog. Free hosted CuNi Studio (Playground + Agent mode). Open source under AGPL-3.0-or-later, or a paid commercial grant (LICENSE), v0.10.0.

Exactness contract: a CuNi program with no ext blocks compiles to identical behavior on every supported target — or it refuses to compile.

Current focus: Studio → Rider publish/register loop is live; Agent-mode spend skill (speech → exactness → multi-runtime). Status: docs/STATUS.md.

Try the flagship example (no install)

  1. Open CuNi Studio — it loads spend-control.cuni by default
  2. Hit Run exactness
  3. See identical Python / Go / JavaScript output (or a clear refusal)
  4. Optional: Publish — exactness PASS → metadata + Studio-side Rider registration

That is the entire product promise in under 30 seconds.

Flagship source: examples/spend-control.cuni · Refusal examples: docs/EXACTNESS_REFUSAL_EXAMPLES.md

Agent mind = CuNi

AI speech routes (stub or LLM); law is CuNi and must pass exactness before it runs on py/go/js:

python3 examples/agent/host/run_agent.py --check-all
python3 examples/agent/host/run_agent.py --message "spend 4 cap 5" --host go
python3 examples/agent/host/run_agent.py --loop --message "echo hi" --message "score 2 8"
python3 examples/agent/host/run_agent.py --repl

In Studio Agent mode, try speech spend 4 cap 5 — it routes to the flagship CheckSpend law.

Design: docs/AI_IS_CUNI.md · pack: examples/agent/

CuNi + Agent-Rider

CuNi provides the exact multi-runtime language and verification.
Agent-Rider provides the coordination layer (identity, messaging, multi-agent workflows).

Related projects

Project Role
Agent-Rider Multi-agent coordination · live
cuni-transparency Append-only Merkle log for signed exactness receipts
quikgater Pay-per-fact fetch for agents (x402 / USDC)
SlidPhi Omni-Dormant integer codecs (npm i slid-phi)
TEACHAiD Interactive beginner school app

Packaging: tap ceedot-rock/homebrew-cuni · draft notes docs/PACKAGING.md.

End-to-end path (live today):

  1. Write a policy in CuNi Studio (default: spend-control).
  2. Run exactness — refuse unless every catalog language matches.
  3. Publish — metadata is stored and auto-registered into the Studio-side Rider stub.
  4. Inspect: GET /api/rider/registered · design for real Rider: docs/RIDER_V0_CONTRACTS.md

They fit together like this:

  1. Write critical agent policies and skills in CuNi (inside the Studio).
  2. Verify them with the exactness checker — the same logic produces the same results on every supported runtime.
  3. Deploy into Agent-Rider. Rider uses CuNi link contracts as the standard interop mechanism and requires exactness before a policy can run.

Result: agents can be implemented in the language that is most convenient, while the parts that matter for consistency and trust remain portable and verified.

Two proofs that matter

Proof How What it shows
Exactness Studio or cuni check examples/full.cuni One program → every catalog language → same stdout
Interop (link) ./examples/link/demo.sh One contract → Go server + Python + JS + Go clients over HTTP
Decimal (dec) cuni check examples/proof-decimal/money.cuni Exact fixed-point money math (scale 10⁴, truncation toward zero) → same stdout on the 11 dec seats (py, go, js, ts, c, cpp, rs, rb, lua, java, sql) + solc-compiled Solidity
Time (time) cuni check examples/proof-time/time.cuni Exact int64 unix epochs, UTC only, strict ISO-8601 → same stdout on the 11 time seats (py, go, js, ts, c, cpp, rs, rb, lua, java, sql) + solc-compiled Solidity
Stdlib wave 1 cuni check examples/stdlib-wave1/ JSON / unix time / strings / SHA-256 → same stdout on every seat that can be exact, tested refusals where a seat can't
Transparency log cuni-transparency Signed exactness receipts published to an append-only Merkle log — proves a receipt existed and wasn't rewritten, not that its claim was true

Flagship: one link, three languages

link Greet(name: str, times: int) -> str do
    ret `hello ${name} x${times}`
end
cargo build --release
./examples/link/demo.sh
# Python / JS / Go clients all print:  hello Cee x3

CuNi link demo: Go server, Python JS Go clients all print hello Cee x3

Tutorial: docs/LINK_TUTORIAL.md · source: examples/link.cuni · Release notes

30s demo (exactness)

CuNi 30-second demo

Full MP4 (30s) · HTML · live: ./examples/demo-30s.sh
One program → Python / Go / JavaScript / Java / C / C++ / Rust — identical 42 / cuni. 53-entry gate.

Install

Requirements: python3, rustc, go, javac/java, sqlite3, and node to run the default cuni check gate (py, rs, go, java, sql, js). The prebuilt binary needs no Rust toolchain.

# Prebuilt binary (recommended) — pick your platform tarball from
# https://github.com/ceedot-rock/cuni/releases
#   cuni-0.10.0-x86_64-unknown-linux-gnu.tar.gz
#   cuni-0.10.0-aarch64-unknown-linux-gnu.tar.gz
#   cuni-0.10.0-x86_64-apple-darwin.tar.gz
#   cuni-0.10.0-aarch64-apple-darwin.tar.gz
tar xzf cuni-0.10.0-<target>.tar.gz
./cuni version   # -> cuni 0.10.0

# or via cargo-binstall (installs the prebuilt binary, no rustup needed)
cargo binstall --git https://github.com/ceedot-rock/cuni --version 0.10.0

# Homebrew (tap not yet created; the formula tracks the prebuilt binary)
# brew install ceedot-rock/tap/cuni

# or clone and build from source (needs Rust stable)
git clone https://github.com/ceedot-rock/cuni.git
cd cuni
cargo build --release
# binary: target/release/cuni

Tap source: https://github.com/ceedot-rock/homebrew-cuni

Quick start

# run in-process (same stdout as check, or check would have refused)
cuni run examples/compute/fib.cuni
# → 55
# optional: emit a native seat instead
cuni run examples/compute/fib.cuni --lang py
# exactness gate — 53 entries, emit+run, identical stdout or refuse
cuni check examples/full.cuni
# → exactness: PASS (53 entries)   exit 0
cuni check examples/full.cuni --only py,go,js,c,cpp,rs,rb,lua   # native seats
cuni check examples/casino/provably-fair-dice.cuni --only py,js,ts,c,cpp,sol  # + Solidity contract
cuni check examples/compute --timeout 180
cuni ingest impl.py -o impl.cuni                         # reverse, or refuse
cuni bank paste impl.py --from py --to js                # paste N, get X, prove or refuse
cuni prove examples/full.cuni --against impl.py          # foreign code must match
# → exactness: FAIL — …         exit 1

cuni check examples/          # all .cuni under a directory
cuni check examples/full.cuni --verbose --timeout 120

# type errors include file:line:col (platform step 2)
# → tests/typeck_invalid/undefined_var.cuni:1:9: type error: undefined variable `y`

# type-check + dump AST
cuni examples/full.cuni

# emit native quality backends (also covered by --emit-all / check)
cuni examples/full.cuni \
  --emit-py /tmp/full.py \
  --emit-go /tmp/full.go \
  --emit-js /tmp/full.js

# emit every language in the catalog (exactness artifacts; check runs the same files)
cuni --list-langs
cuni examples/full.cuni --emit-all /tmp/cuni-all

python3 /tmp/full.py
go run /tmp/full.go
node /tmp/full.js

# from a clone: conformance (runs the full catalog) + typeck suite
cargo test

Exactness CI (platform step 4)

Workflows (run on every push/PR):

Workflow Badge What it runs
Exactness Exactness cuni check on portable examples
CI CI cargo test + exactness

Local:

cargo build --release
./target/release/cuni check --timeout 120 \
  examples/full.cuni examples/structs.cuni examples/enums.cuni

Composite action (this repo): .github/actions/cuni-exactness
Docs for other repos: docs/CI.md

(cuni check needs python3, go, and node on PATH.)

Studio (hosted playground — current focus)

cargo build --release
python3 playground/server.py
# open http://127.0.0.1:8787  (binds 0.0.0.0 by default)

Live: https://cuni-studio.fly.dev/

Emit · Check/Run · Publish (exactness → Rider stub) · Notelog · Critic Book.
Details: playground/README.md · freeze: docs/FREEZE.md.
Redeploy: flyctl deploy --config fly.toml --remote-only (repo root).

Language at a glance

Idea Syntax
Blocks do … end (no braces, no significant whitespace)
Bindings let immutable / mut mutable
Functions def name(x: int) -> int do … ret … end
Fallible -> T ? + fail e + unwrap with ??
Optionals opt<T>, none, same ??
Structs typ Point do x: int y: int end → construct with Point(3, 4)
Interfaces iface Shape do area() -> float end + typ Circle is Shape do … end
Enums payload-free: enum Color do Red Green Blue end
Modules use math → loads math.cuni beside the source file
Escape hatch ext name(...) -> T do py: … go: … js: … end
Cross-program link Greet(name: str) -> str do … end → handler + *_remote client

Full prose: SPEC.md. Formal EBNF: GRAMMAR.md.
link interop tutorial: docs/LINK_TUTORIAL.md.
CI / badges: docs/CI.md.

Layout

src/
  lexer.rs parser.rs token.rs ast.rs   # frontend
  typeck.rs checks.rs modules.rs       # refuse logic + use resolution
  codegen_{py,go,js}.rs                # exactness backends
  langs.rs / emit.rs                   # emit catalog (every coding language)
  main.rs                              # CLI
examples/                              # runnable .cuni samples
examples/link/demo.sh                  # flagship Go server ← py/js/go clients
playground/                            # hosted Studio: emit + check + Notelog + Critic Book
docs/LINK_TUTORIAL.md                  # interop walkthrough
docs/CI.md                             # badges + exactness CI
tests/
  conformance.rs                       # byte-identical stdout + link interop
  check_cmd.rs                         # cuni check CLI
  typeck.rs + typeck_invalid/          # compile-or-refuse fixtures
assets/logo.png                        # brand mark

Status (v0.10.0)

Shipped: lexer/parser, native seats Python/Go/JS/TS/C/C++/Rust/Ruby/Lua/Java/SQL, Solidity seat (--emit-sol: same source → solc-compiled EVM contract; .sol ingests back to CuNi), Java seat (--emit-java: javac-compiled; audit-finance story — the bank's Java and the auditor's Python gate-proven to agree), SQL seat (--emit-sql: SQLite/PostgreSQL/MySQL dialects, verified against real sqlite3), --emit-all language catalog (53: 45 native seats of the top 50 + 5 Python lowerings + 3 onchain profiles), bounded type checker with line:col errors, named typ constructors, call-site generic binding checks, use, link interop, enums, fail/??, stdlib (say, .push, .len, range, abs, min, max, slice), cuni run (in-process seat; cuni check must match catalog gold), cuni check, hosted Studio (cuni-studio.fly.dev) with a language picker, Exactness CI + badge, flagship link demo, gold algorithms in examples/compute/, provably-fair dice contract in examples/casino/.

New in v0.10.0: the CLI is the frozen product surface — cuni emit promoted to a real subcommand, cuni version, cuni check --json (machine-readable receipt only) and --sign <keyfile> (Ed25519-signed receipts a stranger can verify), --all for the full 53-entry catalog. Default cuni check runs the money-seat gate (py, rs, go, java, sql, js — seats a normal install can run); exit codes are a contract: 0 exactness pass, 1 refusal or divergence, 2 usage error or missing toolchain. Receipts are pinned with cuni_version + stdout_hash — a pass from one version is never read as a pass from another.

In since v0.5.0–v0.8.0: dec exact decimal type (scale 10⁴ — money math proven byte-identical on all 12 dec seats, including solc-compiled Solidity), stdlib wave 1 (JSON, unix time, strings, SHA-256 with per-seat support/refusal matrix), Solana program emitter (--emit-solana: Anchor-shaped program, logic core gate-proven, shell honestly delimited — proof profile, not a new seat), Onchain Division (six chain emitters: ink!, Move, Vyper, Cairo, Clarity, Cadence), Financial Division (cuni audit: prove a foreign implementation against a money law, file a signed receipt). Mission line: "Trust Provable, in all things".

Not in v0.1 (by design): tagged unions with payload, streaming link, full inference — see SPEC.md §19.

Design tenets

  1. Mnemonic over cryptic (ret, mut, whl, els)
  2. One concept, one keyword
  3. Small core over broad coverage
  4. Explicit over silently inferred (mutability, fallibility, ext)

License

Dual license. Public tree is AGPL-3.0-or-later — see LICENSE. To ship CuNi inside a closed-source product, buy a written commercial exception: COMMERCIAL.md · corey@slidphilabs.com. Hosted Studio is $0 exactness, not a grant of Rider or PCC. SoT: https://www.slidphilabs.com/licensing.json

Agentic discovery

CuNi Studio: https://cuni-studio.fly.dev/ · Protocol https://cuni-studio.fly.dev/.well-known/cuni-protocol.json · Agent^Rider https://agentrider.fly.dev/.well-known/agent.json · Lab commerce https://www.slidphilabs.com/api/agent · Lab llms.txt https://www.slidphilabs.com/llms.txt
Surface URL
CuNi Protocol https://cuni-studio.fly.dev/.well-known/cuni-protocol.json
Protocol (text) https://cuni-studio.fly.dev/PROTOCOL.md
Studio https://cuni-studio.fly.dev/
agents.txt https://cuni-studio.fly.dev/agents.txt
agents.json https://cuni-studio.fly.dev/agents.json
llms.txt https://cuni-studio.fly.dev/llms.txt
Lab llms.txt https://www.slidphilabs.com/llms.txt
Agent^Rider manifest https://agentrider.fly.dev/.well-known/agent.json
Agent^Rider MCP https://agentrider.fly.dev/api/mcp
Lab x402 commerce https://www.slidphilabs.com/api/agent

About

CuNi: one program, same stdout across every language target — or it refuses to build. 53-target catalog, signed receipts.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages