Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
MuaraAIPublic

About

Mora (.mr) - AI-first programming language with compile-time tensor shape checking, reverse-mode autograd, native C99 auto-SIMD AOT, GGUF, and structured agent primitives by MuaraAI

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

55 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mora Programming Language

Mora (.mr)

Language: English | Bahasa Indonesia

Mora is a programming language by MuaraAI (v0.4.0, Apache-2.0) built for writing AI agents, daemon orchestrators, MCP servers, and CPU/GPU tensor programs in plain .mr files. It catches matrix shape mismatches before your code runs, builds structured LLM outputs & multi-turn tool calls (schema, llm.ask, llm.chat, llm.stream), impl blocks & methods on schema / enum (Type::fn, self, var self, Self), exhaustive enum / Option[T] / Result[T, E] sum types with match and ? propagation, structured concurrency (spawn/join, chan[T], select), subprocess stdio pipes (proc.spawn), Unix domain sockets (unix.*), custom-header HTTP/SSE (http.request/http.sse), TOML config parsing (toml.parse), embedded SQLite + vector store (db.*), MCP servers (mcp.*), mora init --template starters, and mora.toml/mora.lock (path, git, and mora publish registry) dependencies directly into the language, alongside the 13-module self-hosting morac compiler (compiler/), compiling either to a standalone mora-rt binary AST bundle (1.60-4.14 MiB) or a ~49 KiB native C99 executable (--native, POSIX pthread & Win32 _beginthreadex).

Why Mora Exists: Problem and Solution

Building AI agents and tensor code today usually forces you into one of three compromises.

First, Python scripts are concise to write, yet shape bugs sit silent until runtime, often right after weights finish loading or an API request runs. Shipping a small Python CLI agent also drags in the Python interpreter, virtual environments, and ~60+ MiB of peak memory.

Second, compiled languages like Go, Rust, or compiled TypeScript give you real binaries, yet they offer no static tensor shape checking. Writing typed LLM calls with JSON schema validation, retry loops, concurrency, and matrix math takes roughly 200 to 300+ lines of glue code.

Third, heavy compute stacks like PyTorch CPU, Julia, or Mojo carry multi-hundred-megabyte memory footprints, cold JIT delays, or external shared libraries when you only need a small offline CPU binary.

Mora solves all three from one small .mr codebase. Before running anything, mora check verifies matrix dimensions symbolically (Batch, D, D * 4, (H * Dh) / H) and rejects bad call sites in milliseconds:

fn linear_relu(
    x: f32[Batch, 512],
    w: f32[512, 256],
    b: f32[256]
) -> f32[Batch, 256] {
    let hidden = x @ w + b
    return relu(hidden)
}

fn main() {
    let input = zeros(4, 512)
    let weights = rand(256, 128) // wrong shape for w
    let bias = zeros(256)

    let features = linear_relu(input, weights, bias)
    print(features.shape)
}

Running mora check examples/shape_error_demo.mr rejects that mismatch immediately before execution (~2.2 ms):

error[E0301]: dimensi tensor tidak cocok pada parameter 'w' di 'linear_relu': mengharapkan f32[512, 256], ditemukan f32[256, 128]
  --> examples/shape_error_demo.mr:15:39
   |
15 |     let features = linear_relu(input, weights, bias)
   |                                       ^^^^^^^
  help: pastikan dimensi bernilai 512 (saat ini '256')

For agent and RAG workflows, you declare a schema, load vectors across explicit ?N runtime shape boundaries, retrieve with @, and get validated JSON structs without external packages (see examples/mini_rag.mr):

schema Answer {
    text: str
    confidence: f32
}

fn top_doc(docs: list[str], vecs: f32[N, D], q: f32[D]) -> str {
    let scores = vecs @ q
    return docs[argmax(scores)]
}

fn main() {
    let docs = ["Store opens 8-17", "Returns within 7 days", "Free local shipping"]
    let vecs: f32[?N, 1536] = llm.embed(docs)
    let q: f32[1536] = llm.embed_one("can I return an item?")
    let ctx = top_doc(docs, vecs, q)

    let ans: Answer = llm.ask("Answer using context: " + ctx, Answer)
    print(ans.text)
}

Who Should Use Mora (and Honest v0.2 Limits)

Mora v0.2 fits well if you are building:

  1. CLI AI agents, MCP servers, and AI Second Brain tools: mora build compiles .mr apps and mora.toml packages against mora-rt into a standalone executable (~1.20 MiB with --slim / --no-default-features or ~3.74 MiB with bundled TLS + SQLite) featuring llm.ask schema retries, llm.stream SSE streaming, cooperative spawn/join, persistent HTTP/1.1 keep-alive pooling, multi-worker http.serve, embedded SQLite + vector store (db.*), and first-class mcp.* stdio/HTTP MCP servers (6.03 ms IDE cold start in Suite 3 benchmarks).
  2. Offline CPU/GPU inference, training & quantized GGUF tools: mora build --native turns .mr tensor code, reverse-mode autograd loops, and GGUF loaders (F32, F16, BF16, Q8_0, Q4_0, Q4_K/Q4_K_M, Q6_K) into a ~49.4–74 KiB dependency-free executable using multi-core pthread and AVX2/FMA or ARM NEON (6.30 ms min for 400-step XOR training in native C99), while --gpu=vulkan adds zero-header live Vulkan 1.0 SPIR-V GPU offloading (63.2 KiB ELF) and --gpu=cuda/--gpu=metal emit CUDA/Metal runtimes & kernels.
  3. Math kernels called from C or Python: check tensor shapes in .mr, then export .so + .h headers via mora build --shared --emit-header for C, Rust, or Python ctypes.
  4. Projects written with AI coding agents: short SKILL.md rules, machine-readable mora check --json diagnostics, mora fmt, and mora lsp (diagnostics, hover, package-aware go-to-definition, cross-file rename, codeAction quick-fixes, semanticTokens) help coding agents catch and fix tensor errors before execution.

Keep these v0.2 limits in mind before picking Mora for a workload:

  • --gpu=vulkan runs live Vulkan 1.0 SPIR-V compute kernels (with automatic MORA_GPU=0 CPU fallback), and --gpu=cuda/--gpu=metal emit standalone .cu/.mm host+kernel code (compiling CUDA or Metal binaries requires nvcc or macOS Xcode SDK). Distributed multi-GPU training and high-throughput LLM GPU serving still belong in PyTorch, JAX, or dedicated inference engines.
  • list[T], map[K, V], for-in, full schema, enum (including recursive ASTs via list[Self] / map[K, Self]), Option[T], Result[T, E], exhaustive match, postfix ?, str.*, fs.*, os.{args, exit, pid, chmod}, proc.run/ProcResult, and io.{eprint, read_line} compile directly under --native (E0501 under --vm), while network/agent/DB/streaming modules (llm.*, http.*, mcp.*, db.*, time.*, non-literal json.*, toml.*, py.*, gguf.save, proc.spawn/ChildProc, chan[T]/select, os.signal_chan, unix.*, spawn/join, try/catch) run in the Interpreter and mora build bundler (mora build appends a pre-checked, checksummed, stream-masked binary AST MORA_BUNDLE_V02! onto mora-rt and executes directly without re-parsing source or leaking raw .mr text via strings, though encoding/masking is not cryptographic DRM; calling those modules directly under --vm, --native, or --shared stops cleanly with E0501). For mixed agent + compute apps, mora build --hybrid / mora run --hybrid automatically extracts pure tensor functions into a native C99 worker process over zero-unsafe binary IPC (MORA_HYBRID=0 to disable, MORA_HYBRID_TRACE=1 to trace).
  • mora.toml / mora.lock supports local path dependencies, git dependencies (git, rev, branch, tag, subdir, entry), and remote registry dependencies (version, registry) via mora publish / mora pkg add --version (MORA_REGISTRY_URL, MORA_REGISTRY_TOKEN) with bundle/commit SHA-256 pinning in mora.lock and offline local cache (MORA_PKG_CACHE / ~/.mora/pkg, ~/.mora/git).
  • On Windows x86_64, the mora.exe CLI and runtime work natively, while C99 native compilation (--native / --shared) currently needs MinGW-w64, MSYS2, or WSL because emitted C code uses <pthread.h> and POSIX APIs for os/proc.

What Mora Is Built With

The mora toolchain and mora-rt runtime are written in Rust (edition 2021) (src/, 31 source files) compiled with opt-level = "z", fat LTO, single codegen unit, panic = "abort", and stripped symbols, yielding a 4,751,424 B (~4.53 MiB) full mora compiler/CLI binary alongside dedicated 3,917,312 B (mora-rt with TLS + SQLite) and 1,258,424 B (~1.20 MiB mora-rt --no-default-features slim) bundle runners (Cargo.toml).

Only 6 direct crate dependencies sit in Cargo.toml:

  • clap (CLI argument parsing; mora run and bundled executables bypass clap on the hot startup path)
  • serde and serde_json (JSON serialization, structured --json diagnostics, schema checking, MCP JSON-RPC, and LSP 3.17 framing)
  • tokio (single-threaded LocalSet async I/O runtime driving spawn/join and optional multi-worker http.serve / mcp.serve_http)
  • reqwest with rustls-tls (pure-Rust TLS + connection pooling for https://, zero OpenSSL system dependency; plain http:// uses a direct keep-alive TcpStream pool)
  • rusqlite with bundled SQLite (db.* embedded WAL persistence and raw f32 vector BLOB storage with zero external DB server)

Optional external tools used only when requested:

  • A C99 compiler (cc, gcc, or clang) when running mora build --native or --shared
  • python3 only if your script invokes py.eval or py.call

Architecture

One frontend parser, transitive module resolver (import "./path.mr" with file:line source mapping), and static type/shape checker feed three execution backends plus developer tooling:

.mr source files (import "./mod.mr")
  |
  v
[Frontend]         lexer.rs -> parser.rs -> module_loader.rs (source map: file:line)
  |
  v
[Static Checker]   checker/ + types.rs (symbolic shapes, dim arithmetic, ?N bounds, E0101..E0311)
  |
  +--> [1. Interpreter & Bundler]  `mora run` / `mora build`
  |      interpreter/ + runtime.rs + autograd.rs + py_bridge.rs + gguf.rs + bundler/
  |      Full language + Tokio LocalSet I/O + fast HTTP/1.1 path (~3.15 MB app binary)
  |
  +--> [2. Register Bytecode VM]   `mora run --vm`
  |      ir.rs -> arena_planner.rs (O(1) ARENA_MARK / RESET) -> vm.rs
  |      Runs tensor, Transformer, env.*, and GGUF load without Tokio or a C compiler
  |
  +--> [3. Native C99, GPU & FFI] `mora build --native` / `--gpu` / `--shared` / `--emit-c`
  |      ir.rs -> gpu.rs -> arena_planner.rs -> codegen_native/ -> cc / Vulkan / CUDA / Metal
  |      ~49 KiB native ELF (AVX2/NEON), ~63 KiB Vulkan GPU ELF, or C ABI .so + .h header
  |
  +--> [Tooling]                   `mora fmt` (fmt.rs) | `mora test` (cli.rs) | `mora lsp` (lsp/)
Execution Path Command Best Used For Unsupported Features
Interpreter & Bundler mora run, mora build AI agents, llm.*, http.serve, autograd.*, py.*, gguf.save None (full language)
Bytecode VM mora run --vm Fast startup for tensors, Transformer ops, autograd, and GGUF without cc Rejected at compile (E0501)
Native C99 & GPU AOT mora build --native, --gpu, --shared Peak CPU (~49–74 KiB ELF), Vulkan live GPU (--gpu=vulkan), .so/.h Rejected at compile (E0501)

Project Structure

Mora/
|-- src/                          Rust compiler, runtime, VM, C99 AOT backend, and LSP
|   |-- lexer.rs, token.rs        Tokenizer and token definitions
|   |-- ast.rs, parser.rs         Brace syntax AST and recursive-descent parser
|   |-- span.rs, module_loader.rs Multi-file `import` resolver (`./` + `mora.toml` packages) with DFS deduplication
|   |-- manifest.rs               Pure-Rust `mora.toml` manifest & FIPS 180-4 SHA-256 `mora.lock` resolver
|   |-- types.rs, checker/        Tensor shape unifier, symbolic dim arithmetic, ?N boundary rules, diagnostic checks
|   |-- diagnostic.rs             Human and `--json` error formatter (E0101..E0501)
|   |-- interpreter/              Tree-walking evaluator and Tokio LocalSet / HTTP worker coordinator
|   |-- runtime.rs                `llm.*` (incl. SSE `llm.stream`), `http.*` keep-alive pool, `json`, `env`
|   |-- db.rs, mcp.rs             Embedded WAL SQLite + `f32` vector BLOBs (`db.*`) and stdio/HTTP MCP server (`mcp.*`)
|   |-- tensor.rs, autograd.rs    CPU f32 kernels, cosine/Top-K, 7 Transformer ops, reverse-mode autograd
|   |-- gguf.rs, py_bridge.rs     GGUF v2/v3 loader/saver (`F32/F16/BF16/Q8_0/Q4_0/Q4_K/Q6_K`) and Python bridge
|   |-- ir.rs, arena_planner.rs   Register Mora IR lowering (`lower_hybrid_subset`) and O(1) loop-safe arena lifetimes
|   |-- gpu.rs, hybrid.rs         GPU subgraph fusion (`GPU_MATMUL_FUSED`), SPIR-V Vulkan, and zero-`unsafe` hybrid C99 IPC offload
|   |-- vm.rs, codegen_native/    Register Bytecode VM and multi-core SIMD/GPU C99 code generator + `.c` runtimes
|   |-- bundler/, bin/mora_rt.rs  V2/V3 binary AST packer (`MORA_BUNDLE_V02!`, `--hybrid`, `--slim`) and stripped `mora-rt` runner
|   `-- cli.rs, fmt.rs, lsp/      Zero-clap hot CLI dispatch (`init`, `pkg`), canonical formatter, LSP 3.17 server
|-- compiler/                     Stage 2b self-hosting `morac` compiler written purely in Mora (13 `.mr` modules -> C99 with tensors, autograd, GGUF, `fmt`/`test`/`run` & `mora.toml`; 3-stage fixed-point bootstrap)
|-- tests/integration.rs          51 end-to-end compiler, VM, C99 AOT, self-hosting `morac` (Stage 1-2b), `proc.spawn`, `chan[T]`/`select`, `os.chmod`/signals/`unix.*`, `http.request`/`http.sse`, `llm.chat`/`toml.parse`, `mora publish`/registry, sum types + `?`, hybrid offload, Vulkan GPU, K-quant, autograd, SQLite, MCP, `mora-rt`, pkg, and LSP 3.17 tests
|-- docs/                         Bilingual guides (`*.md` EN and `*_ID.md` ID, 9 pairs)
|-- examples/                     Verified `.mr` programs, `tiny_llm/`, `second_brain_mcp.mr`, `streaming_agent.mr`, and `compare/` suites
|-- editors/                      Extensions and setups for VS Code, Antigravity, Zed, FluxCode, Neovim, Helix, Sublime, Emacs
|-- packaging/                    `.deb`, Arch `pacman`, AUR `PKGBUILD`, Inno Setup `.iss`, Homebrew tap template
|-- skills/ & SKILL.md            Agent Skills modules (`mora`, `mora-lang`, `mora-agents`, `mora-native`, `mora-compiler`)
|-- assets/brand/                 7 Graphite & Vermilion SVG brand marks and README banner
|-- evals/                        Blind AI coding agent benchmark tasks (`tasks.md`, `tasks_ID.md`)
|-- .github/                      CI checks, core-team PR policy, multi-platform Release workflow
`-- install.sh, install.ps1       1-command binary installers for Linux, macOS, and Windows

Install and Common Commands

Prebuilt Installers (Linux, macOS, Windows)

On Linux and macOS (x86_64 and ARM64), run:

curl -fsSL https://raw.githubusercontent.com/MuaraAI/Mora/main/install.sh | sh

On Windows (x86_64 PowerShell, adds binary directory to User PATH):

irm https://raw.githubusercontent.com/MuaraAI/Mora/main/install.ps1 | iex

You can also download the Windows 1-click GUI setup (mora-0.4.0-setup-x86_64.exe), Debian/Ubuntu .deb (amd64 or arm64), Arch pacman package (.pkg.tar.zst), or .tar.gz archives directly from GitHub Releases (details in packaging/README.md). Note: release archives now include mora, mora-rt, and mora-rt-slim.

Build from Source

Requires Rust (optional cc/gcc/clang for --native/--shared and python3 for py.*):

cargo build --release --bin mora --bin mora-rt
# Optional 1.60 MiB slim runtime without reqwest TLS or bundled rusqlite:
# cargo build --release --no-default-features --bin mora-rt

Common workflows after installing or building:

# Project manifest & package manager (mora.toml / mora.lock)
./target/release/mora init --dir ./my_app --name my_app
./target/release/mora pkg check
./target/release/mora pkg lock

# Type and shape checking without execution
./target/release/mora check examples/linear_relu.mr
./target/release/mora check examples/shape_error_demo.mr
./target/release/mora check examples/shape_error_demo.mr --json

# Run with Interpreter or Bytecode VM (--vm)
./target/release/mora run examples/linear_relu.mr
./target/release/mora run examples/mlp_bench.mr --vm

# Offline autograd training & Python bridge
./target/release/mora run examples/train_xor.mr
./target/release/mora run examples/interop_python.mr

# LLM, Mini-RAG & parallel agents (auto-loads examples/.env; copy examples/.env.example)
export MORA_LLM_API_KEY="your-api-key"
export MORA_LLM_BASE_URL="https://api.openai.com/v1"
export MORA_LLM_MODEL="gpt-4o-mini"
export MORA_EMBED_MODEL="text-embedding-3-small"
./target/release/mora run examples/mini_rag.mr --trace
./target/release/mora run examples/parallel_agents.mr

# Bundle modules + runtime into one standalone executable (auto-uses sibling mora-rt / --slim)
./target/release/mora build examples/linear_relu.mr -o ./linear_relu_app
./target/release/mora build examples/linear_relu.mr -o ./linear_relu_slim --slim
./linear_relu_app

Native C99 Auto-SIMD AOT (--native), live Vulkan GPU (--gpu=vulkan), portable binary, and C shared library (--shared)

./target/release/mora ir examples/mlp_bench.mr --gpu=vulkan ./target/release/mora build examples/mlp_bench.mr -o ./mlp_native --native ./target/release/mora build examples/mlp_bench.mr -o ./mlp_gpu --native --gpu=vulkan ./target/release/mora build examples/mlp_bench.mr -o ./mlp_portable --native --portable ./target/release/mora build examples/native_kernel.mr -o ./libkernel.so --shared --emit-header ./kernel.h ./target/release/mora build examples/linear_relu.mr -o ./linear_relu.c --emit-c MORA_GPU_TRACE=1 ./mlp_gpu

Offline GGUF inference & multi-file Tiny Transformer

MORA_GGUF_PATH="./model.gguf" ./target/release/mora run examples/local_gguf_inference.mr ./target/release/mora run examples/tiny_llm/main.mr --vm ./target/release/mora build examples/tiny_llm/main.mr -o ./tiny_llm_native --native MORA_NUM_THREADS=4 ./tiny_llm_native ./target/release/mora run examples/checkpoint_gguf.mr

Formatting, built-in unit tests, HTTP server, and LSP 3.17

./target/release/mora fmt examples/.mr examples/tiny_llm/.mr ./target/release/mora fmt --check examples/.mr examples/tiny_llm/.mr ./target/release/mora test examples/tests_demo.mr ./target/release/mora test examples/tests_demo.mr --json MORA_ADDR="127.0.0.1:8080" ./target/release/mora run examples/agent_api.mr ./target/release/mora lsp


## Measured Benchmarks

All numbers below were measured on `x86_64` Linux (`Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz`, 2 cores / 4 threads, AVX2/FMA, GCC `16.2.1`) using a C `posix_spawnp` + `wait4` harness (`CLOCK_MONOTONIC` wall clock and child-only `ru_maxrss`). The Phase 3 complete toolchain & runtime split measures **`4,751,424 B`** (`~4.53 MiB`) for `mora`, **`3,917,312 B`** (`~3.74 MiB`) for full `mora-rt`, and **`1,258,424 B`** (`~1.20 MiB`, `73.5%` smaller) for `mora-rt --no-default-features` (`mora-rt-slim`), `cargo test --offline` passes **80 unit + 33 integration tests**, and blind AI agent evaluation passed **5/5** tasks using only `SKILL.md` ([`evals/tasks.md`](evals/tasks.md)). *(Suites 1 & 2 below retain the exact recorded `v0.1.0` baseline measurements; Suite 3 and live Vulkan GPU scaling in `docs/benchmarks.md` reflect subsequent releases.)*

### 1. AI Agent and Hybrid Tensor-RAG (5 Languages / 8 Targets)

Workload: batch embedding of 4 documents (`?N x ?D`), `vecs @ q` / `argmax` retrieval, and 3 concurrent `llm.ask` requests with strict `TriageAnswer` JSON schema checks and retries. Full report: [examples/compare/README.md](examples/compare/README.md) and [docs/benchmarks.md](docs/benchmarks.md).

<p align="center">
  <img src="examples/compare/benchmark.svg" alt="Mora vs Bun vs Go vs Rust vs Node vs Python AI Agent Benchmark" width="100%" />
</p>

| Target | LOC (code / total) | Binary / Package | Shape Bug (`[4,512]@[256,128]`) | Offline `delay=0` (5 runs avg) | Peak RSS Max (`delay=0`) | Offline `delay=40` (3 runs avg) |
| --- | --- | --- | --- | --- | --- | --- |
| **`mora_bundle`** (`mora build`) | **44 / 50** | **3,150,929 B** (~3.00 MiB) | **Compile-time (`E0301`, `2.2 ms`)** | **6.94 ms** | 5,128 KiB | **57.24 ms** |
| **`mora_run`** (`mora run`) | **44 / 50** | Shared `mora` CLI | **Compile-time (`E0301`, `2.2 ms`)** | **7.87 ms** | 5,068 KiB | **50.03 ms** |
| `rust_release` (`tokio`+`reqwest`) | 267 / 285 | 5,097,848 B (131 crates) | Runtime (`Vec<Vec<f32>>`) | 179.71 ms | **4,808 KiB** | 219.14 ms |
| `go_release` (`net/http`) | 316 / 345 | 6,766,855 B | Runtime panic (exit `2`) | 182.23 ms | 14,416 KiB | 228.10 ms |
| `bun_compile` (`bun 1.4.5 --compile`) | 228 / 246 | 109,213,872 B (~104.2 MiB) | Runtime (exit `1`) | 207.98 ms | 31,332 KiB | 254.39 ms |
| `bun_ts` (`bun run`) | 228 / 246 | Bun 1.4.5 runtime | Runtime (exit `1`) | 273.36 ms | 39,148 KiB | 231.92 ms |
| `node_ts` (`node v26.13.1`) | 228 / 246 | Node v26 runtime | Runtime (exit `1`) | 311.80 ms | 104,184 KiB | 378.19 ms |
| `python` (`3.14`+`httpx`+`numpy`) | 160 / 183 | Python venv + 3 PyPI | Runtime (exit `1`) | 791.68 ms | 60,576 KiB | 858.43 ms |

> [!NOTE]
> **Suite 1 Methodology Disclosure:** The offline `delay=0` speedup (`6.94 ms` vs `179.71 ms` for `rust_release`) measures plain `http://127.0.0.1` mock requests where Mora bypasses `clap` and lazily defers `reqwest` TLS setup, whereas the Rust baseline eagerly initializes `reqwest::Client` TLS pools up front. Against a real upstream server ([`docs/benchmarks.md`](docs/benchmarks.md#live-upstream-llm-test-deepseek-v41-flash--text-embedding-3-large)), end-to-end latency is I/O-bound (`11,159 ms` Mora vs `6,859 ms` Python / `6,977 ms` Node / `7,907 ms` Go / `15,631 ms` Rust).

### 2. Local Tensor Compute (`--native` vs Mojo 1.2, Julia 1.13, C99, NumPy, PyTorch CPU, `--vm`)

Workload: deterministic 80-step 2-layer MLP (`64x512 -> 512x512 SiLU -> 512x256 ReLU`, `~4.03 GFLOPs` `f32`) with strict numerical checksum parity (`~22.657`, tolerance `< 1e-2`). Full report: [examples/compare/compute/README.md](examples/compare/compute/README.md) and [docs/benchmarks.md](docs/benchmarks.md).

<p align="center">
  <img src="examples/compare/compute/compute_benchmark.svg" alt="Mora Native vs Mojo, Julia, C99, NumPy and PyTorch Compute Benchmark" width="100%" />
</p>

| Target | LOC | Binary / Runtime | Shape Bug (`[64,512]@[256,256]`) | Avg Time (`5` runs) | Peak RSS Max | Checksum |
| --- | --- | --- | --- | --- | --- | --- |
| **`mora_native`** (`--native`) | **26 / 28** | **50,408 B** (~49.2 KiB ELF) | **Compile-time (`E0301`, `2.56 ms`)** | **356.56 ms** | 8,668 KiB | `22.656700` |
| `mojo_native` (`mojo 1.2.0` 1T SIMD) | 99 / 119 | 63,152 B + 3 Modular `.so` | Manual pointer index | 416.81 ms | 18,772 KiB | `22.656755` |
| `mora_native_1t` (`MORA_NUM_THREADS=1`) | **26 / 28** | **50,408 B** (~49.2 KiB ELF) | **Compile-time (`E0301`)** | 422.65 ms | 8,564 KiB | `22.656700` |
| `numpy` (`2.5.4` OpenBLAS) | 26 / 37 | Python + OpenBLAS | Runtime error | 785.05 ms | 40,084 KiB | `22.657161` |
| `c99_o3` (`gcc 16.2.1 -O3 -march=native`) | 99 / 112 | **16,288 B** ELF | Manual loop index | 1,089.77 ms | **4,160 KiB** | `22.657182` |
| `julia` (`1.13.4` cold JIT, 3 runs) | 31 / 39 | Julia JIT + depot | Runtime error | 3,218.25 ms | 321,308 KiB | `22.657144` |
| `pytorch_cpu` (`2.15.0+cpu`) | 27 / 38 | Python + Torch CPU | Runtime error | 3,731.35 ms | 254,612 KiB | `22.657185` |
| `mora_vm` (`mora run --vm`, 1 run) | **26 / 28** | Shared `mora` CLI | **Compile-time (`E0301`)** | 11,571.36 ms | 8,596 KiB | `22.656294` |

> [!NOTE]
> **Suite 2 Methodology Disclosure:** `mora_native` (`356.56 ms`) uses multi-core `pthread` workers plus cache-tiled AVX2/FMA microkernels, while both `c99_o3` (`1,089.77 ms` un-tiled 3-loop C) and `mojo_native` (`416.81 ms` standalone `mojo 1.2`) run single-threaded. With equalized 1-thread execution (`MORA_NUM_THREADS=1`), `mora_native_1t` (`422.65 ms`) trails `mojo_native` (`416.81 ms`) slightly while requiring no external Modular `.so` libraries.

### 3. AI Second Brain + MCP Server (5 Languages / 8 Targets)

Workload: stdio MCP JSON-RPC 2.0 server backed by real SQLite WAL persistence + 8-dim `f32` vector BLOB storage + cosine similarity Top-K search (`save_note` and `search_notes`). Scenario A measures IDE MCP cold-start (`initialize` + `tools/list`), and Scenario B executes 33 JSON-RPC messages (`20x save_note` + `10x search_notes` with strict Top-K parity verified on every run). Full report: [examples/compare/mcp/README.md](examples/compare/mcp/README.md) and [docs/benchmarks.md](docs/benchmarks.md).

<p align="center">
  <img src="examples/compare/mcp/mcp_benchmark.svg" alt="Mora vs Rust vs Go vs Bun vs Node vs Python AI Second Brain MCP Benchmark" width="100%" />
</p>

| Target | LOC (code / total) | Binary / External Deps | Cold Start (`5` runs) | Cold RSS Max | Full 33-msg Session | Session RSS Max |
| --- | --- | --- | --- | --- | --- | --- |
| **`mora_bundle`** (`mora build`) | **92 / 103** | `4,447,447 B` (0 pkgs) | **6.03 ms** | 6,508 KiB | **24.93 ms** | 7,536 KiB |
| **`mora_run`** (`mora run`) | **92 / 103** | Shared `mora` CLI | **6.89 ms** | 6,556 KiB | **32.94 ms** | 7,400 KiB |
| `rust_release` (`rusqlite`) | 343 / 366 | **`1,448,888 B`** (3 crates) | **3.50 ms** | **3,548 KiB** | **6.62 ms** | **3,476 KiB** |
| `go_release` (CGo `libsqlite3`) | 327 / 363 | `2,668,856 B` (links `.so`) | 8.80 ms | 10,728 KiB | 14.20 ms | 10,984 KiB |
| `bun_compile` (`bun:sqlite`) | 211 / 224 | `109,213,872 B` (0 pkgs) | 50.89 ms | 35,144 KiB | 54.51 ms | 40,776 KiB |
| `bun_ts` (`bun run`) | 211 / 224 | Bun 1.4.5 runtime | 94.53 ms | 38,096 KiB | 69.08 ms | 43,428 KiB |
| `python` (stdlib `sqlite3`) | 166 / 190 | Python 3.14 runtime | 113.40 ms | 14,552 KiB | 132.17 ms | 14,860 KiB |
| `node_ts` (`node:sqlite`) | 211 / 224 | Node v26 runtime | 312.81 ms | 80,616 KiB | 327.96 ms | 82,672 KiB |

## Documentation Hub

Every guide ships in English and Bahasa Indonesia (`*_ID.md`). Agent Skills (`SKILL.md`, `skills/*/SKILL.md`) stay in English for cross-model compatibility.

| Guide | English | Bahasa Indonesia | Focus |
| --- | --- | --- | --- |
| Documentation Hub | [docs/README.md](docs/README.md) | [docs/README_ID.md](docs/README_ID.md) | Reading paths & complete index |
| Getting Started | [docs/getting-started.md](docs/getting-started.md) | [docs/getting-started_ID.md](docs/getting-started_ID.md) | Source build, 5-minute tour, `.env` setup |
| Language Guide | [docs/language-guide.md](docs/language-guide.md) | [docs/language-guide_ID.md](docs/language-guide_ID.md) | `{ }` syntax, CoW semantics, `import`, `test`, `fmt` |
| Tensors, Transformer & Autograd | [docs/tensors-and-autograd.md](docs/tensors-and-autograd.md) | [docs/tensors-and-autograd_ID.md](docs/tensors-and-autograd_ID.md) | Shape rules, `?N`, `@`, 7 Transformer ops, autograd, GGUF |
| AI Agents & Stdlib | [docs/agents-and-stdlib.md](docs/agents-and-stdlib.md) | [docs/agents-and-stdlib_ID.md](docs/agents-and-stdlib_ID.md) | `llm.*` (`llm.stream`), `mcp.*`, `db.*`, keep-alive `http.*`, `str.*`, `fs.*`, `py.*` |
| Native AOT, GPU, VM & C FFI | [docs/native-aot-and-vm.md](docs/native-aot-and-vm.md) | [docs/native-aot-and-vm_ID.md](docs/native-aot-and-vm_ID.md) | Mora IR, GPU fusion (`--gpu`), O(1) Arena Planner, `--vm`, `--native`, `--shared`, `extern fn` |
| CLI, Diagnostics & LSP | [docs/cli-and-diagnostics.md](docs/cli-and-diagnostics.md) | [docs/cli-and-diagnostics_ID.md](docs/cli-and-diagnostics_ID.md) | Flags (`--gpu`, `--emit-gpu`), `--json`, `--trace`, `E0101`–`E0501`, LSP 3.17 |
| Benchmarks & Methodology | [docs/benchmarks.md](docs/benchmarks.md) | [docs/benchmarks_ID.md](docs/benchmarks_ID.md) | Suite 1 Agent, Suite 2 Compute (+ Vulkan GPU), and Suite 3 MCP Server reports |
| Scope & Roadmap | [docs/roadmap.md](docs/roadmap.md) | [docs/roadmap_ID.md](docs/roadmap_ID.md) | Phases 1-2 complete, honest limits, and Phase 3 `< 1 MB` `mora-rt` slim runtime plan |
| Editor Integrations | [editors/README.md](editors/README.md) | [editors/README_ID.md](editors/README_ID.md) | VS Code, Antigravity, Zed, FluxCode, Neovim, Helix, Sublime, Emacs |
| Brand & Design System | [DESIGN.md](DESIGN.md) | [DESIGN_ID.md](DESIGN_ID.md) | Graphite & Vermilion palette, WCAG 2.1 tokens, G1 logo specs |

## Example Programs

| Example | What It Demonstrates |
| --- | --- |
| [`examples/linear_relu.mr`](examples/linear_relu.mr) | Neural network layer with compile-time shape verification (`f32[Batch, 512] @ f32[512, 256]`) |
| [`examples/shape_error_demo.mr`](examples/shape_error_demo.mr) | Intentional `[4, 512] @ [256, 128]` bug caught at `mora check` (`E0301`) |
| [`examples/mlp_bench.mr`](examples/mlp_bench.mr) | 50-step 2-layer MLP exercising Mora IR, O(1) arena loop resets, `--vm`, and `--native` |
| [`examples/train_xor.mr`](examples/train_xor.mr) | 2-layer MLP trained on XOR via `autograd.reset/track/backward/grad/detach` and `mse_loss` |
| [`examples/interop_python.mr`](examples/interop_python.mr) | Mora/Python bridge (`py.call` / `py.eval`) with schema and `?R` tensor validation |
| [`examples/native_kernel.mr`](examples/native_kernel.mr) | Native compute kernel exported to `.so` + `.h` (`--shared --emit-header`) for C or `ctypes` |
| [`examples/local_gguf_inference.mr`](examples/local_gguf_inference.mr) | Offline inference reading quantized GGUF weights (`F32`, `F16`, `BF16`, `Q8_0`, `Q4_0`) |
| [`examples/checkpoint_gguf.mr`](examples/checkpoint_gguf.mr) | GGUF checkpoint save/upsert, `gguf.set_meta`, `fs.*` logging, and reload validation |
| [`examples/tiny_llm/layers.mr`](examples/tiny_llm/layers.mr) & [`main.mr`](examples/tiny_llm/main.mr) | Multi-file Tiny Transformer (`causal_attention` prefill, KV-cache decode) across `--vm` and `--native` |
| [`examples/tests_demo.mr`](examples/tests_demo.mr) | Isolated `test "name" { ... }` blocks with `assert`, `assert_eq`, and `assert_near` |
| [`examples/mini_rag.mr`](examples/mini_rag.mr) | Batch embedding, vector retrieval (`vecs @ q`), and structured `llm.ask(..., Answer)` |
| [`examples/parallel_agents.mr`](examples/parallel_agents.mr) | 50 concurrent `llm.ask` tasks coordinated with `spawn` and `join` |
| [`examples/agent_api.mr`](examples/agent_api.mr) | Concurrent HTTP API server (`/health`, `/ask`, `/batch`) built on `http.serve` |
| [`examples/second_brain_mcp.mr`](examples/second_brain_mcp.mr) | AI Second Brain + first-class `stdio`/HTTP MCP server backed by `db.*` SQLite + cosine `topk` |
| [`examples/streaming_agent.mr`](examples/streaming_agent.mr) | SSE token streaming (`llm.stream` stdout & callback) and multi-worker `http.serve` |
| [`examples/compare/`](examples/compare/README.md), [`compute/`](examples/compare/compute/README.md) & [`mcp/`](examples/compare/mcp/README.md) | Reproducible harnesses for all three 8-target benchmark suites |

## Brand Marks, Agent Files, and Governance

| Primary Mark | `.mr` File Icon | Adaptive Wordmark (Dark / Light) |
| --- | --- | --- |
| <img src="assets/brand/mora-mark.svg" alt="Mora Mark" height="36" /> | <img src="assets/brand/mora-file-icon.svg" alt="Mora File Icon" height="36" /> | <picture><source media="(prefers-color-scheme: dark)" srcset="assets/brand/mora-wordmark-dark.svg" /><source media="(prefers-color-scheme: light)" srcset="assets/brand/mora-wordmark-light.svg" /><img src="assets/brand/mora-wordmark-light.svg" alt="Mora Wordmark" height="32" /></picture> |
| [`mora-mark.svg`](assets/brand/mora-mark.svg) | [`mora-file-icon.svg`](assets/brand/mora-file-icon.svg) | [All 7 official SVGs (`DESIGN.md`)](DESIGN.md#3-logo-blueprint-flowing-geometric-ribbon-m) |

- Agent specifications: [`SKILL.md`](SKILL.md) (single-file English language spec, 234 lines), [`skills/mora/SKILL.md`](skills/mora/SKILL.md) (5-module skill pack installable via `npx skills add MuaraAI/Mora`), and [`llms.txt`](llms.txt) (documentation & diagnostic code index).
- Governance and releases: [`LICENSE`](LICENSE) (Apache License 2.0), [`NOTICE`](NOTICE), [`TRADEMARK.md`](TRADEMARK.md), [`CONTRIBUTING.md`](CONTRIBUTING.md), [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md), [`SECURITY.md`](SECURITY.md), [`CHANGELOG.md`](CHANGELOG.md), and [`docs/roadmap.md`](docs/roadmap.md).
- Contact: [admin@muaraai.com](mailto:admin@muaraai.com).

About

Mora (.mr) - AI-first programming language with compile-time tensor shape checking, reverse-mode autograd, native C99 auto-SIMD AOT, GGUF, and structured agent primitives by MuaraAI

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages