Patent Pending: STARGA Inc. US Provisional Patent Application
MIC is a family of compact serialization formats for Mind IR graphs, designed for minimal token usage, fast parsing, and deterministic output.
Canonical IR contract: IRModule (control flow included)
- full IRModule, explicit IDs
- RFC 0001 fixed-point form
- magic
MIC3, emit with--emit-mic3 - the
trace_hashanchor
Back-compat lineage: Graph dataflow shape (demoted, never the compiled-artifact IR)
- implicit IDs, compact opcodes
- mic@2.1 adds the MAP (RFC 0014)
- magic
MICB, ULEB128 varints - Graph shape, binary
mic@1: canonical text
mic@1 is the canonical text serialisation of IRModule. RFC 0001 fixed-point form; the evidence-chain trace_hash is computed over mic@3 binary (RFC 0016 GAP-1, re-anchored 2026-05-31).
mic@3: canonical binary
mic@3 is the canonical binary serialisation of the same IRModule. Shipped behind mindc --emit-mic3; round-trips to/from mic@1.
mic@2 / mic@2.1: demoted
The legacy dataflow lineage, kept for back-compat only and never the current or canonical compiled-artifact IR. mic@2.1 carries the MAP (Metadata-Attachment-Pair) extension (RFC 0014). RFC 0021 step 5 renames the lineage to mind-model@2 (a model-graph artifact, no longer an IR contract) as a byte-preserving migration that is still pending.
Consumers: verify and inspect
mindc verify <artifact> peels the evidence_chain.* MAP, recomputes the canonical mic@3 trace_hash over the parsed IR body, and reports whether it matches; mindc inspect <artifact> decodes a mic@3 binary and pretty-prints the IR body plus a structural summary (instruction count, SSA value count, exports, byte size).
RFC 0021 (canonical-IR unification) progress
- Step 1Shipped
- Step 2Shipped
- Step 3Shipped
- Step 4Shipped
- Step 5Pending
- Step 6Pending
- Step 3: emit
mic@3withmindc --emit-mic3(shipped). - Step 5: rename the
mic@2lineage tomind-model@2(pending).
Both consumers on a real artifact, captured with mindc 0.10.2 on the repository's hello_tensor.mind:
$ mindc hello_tensor.mind --emit-evidence a.mic3
Wrote mic@3 evidence artifact: a.mic3 (316 bytes, self-check ok)
$ mindc inspect a.mic3
artifact: a.mic3
bytes: 316
instrs: 3
ssa_next_id: 1
exports: 0
attested: YES
trace_hash: 7a2e5f47435c8ae55a8c1288ffa47ffdd73f89ad5e19c872f95fd8bd3e5673bc
determinism: deterministic
fp_mode: strict
$ mindc verify a.mic3
artifact: a.mic3
substrate: cpu
determinism: deterministic
toolchain: 0.10.2
parent: (root)
trace_hash: 7a2e5f47435c8ae55a8c1288ffa47ffdd73f89ad5e19c872f95fd8bd3e5673bc
trace_hash_kind: mic3-bytes
trace_hash_valid: yes
ssa_valid: yes
signature: absent
verified: IR body attested (tamper-evident) — trace_hash matches the re-emitted canonical IR
verified: IR body is SSA well-formed
note: artifact carries no signature (unsigned but attested)
note: provenance (substrate/toolchain/parent) is NOT authenticated — these MAP fields sit outside trace_hash; sign the artifact and pin --signer-pubkey to authenticate themFormat Versions
mic@1 (Canonical text)
Canonical text serialisation of IRModule with explicit node IDs and verbose opcodes.
- Explicit IDs:
N0,N1,N2 - Verbose ops:
add,matmul,relu - Bracket syntax:
[f32;3,4]
mic@2 (Back-compat dataflow text)
Compact text format for the lighter Graph dataflow shape with implicit IDs and compact opcodes. Not the compiled-artifact IR; slated for demotion to mind-model@2 (RFC 0021 step 5).
- Implicit IDs by order of appearance
- Compact ops:
+,m,r - Space syntax:
f32 3 4
MIC-B v2 (Back-compat binary)
Compact binary format for the Graph dataflow shape with ULEB128 varints. The canonical binary IR is mic@3 (below); MIC-B v2 is back-compat and slated for demotion to mind-model@2 (RFC 0021 step 5).
- ~4x smaller than mic@2 text
- Direct memory mapping possible
- Deterministic byte output
Format Detection
Automatic format detection by magic bytes or header.
use mind::ir::detect_format;
match detect_format(data) {
MicFormat::Mic3 => parse_mic3(..), // canonical binary
MicFormat::Mic2 => parse_mic2(..), // back-compat
MicFormat::MicB => parse_micb(..), // back-compat
MicFormat::Mic1 => parse_mic(..), // canonical text
_ => Err("unknown format"),
}New since v0.7.0
mic@2.1 (MAP carrier)
Same on-the-wire shape as mic@2, plus a Metadata-Attachment-Pair extension that carries the evidence-chain attestation (determinism / substrate / toolchain / trace_hash).
- Defined by
spec/mic/mic2.1-spec.md(RFC 0014) - MAP attaches via the
0x4Dsentinel epilogue - Consumed by
mindc --emit-evidence
mic@3 (Binary IRModule)
Canonical binary serialisation of the full IRModule. Round-trip equivalent to mic@1 text. Carries an evidence MAP epilogue in the same form as mic@2.1.
- Magic:
MIC3 - RFC 0021 steps 1–4 (shipped); 5–6 pending
- Emit:
mindc --emit-mic3/--emit-evidence
Format Comparison
| Format | Tokens | Bytes | vs JSON | Parse Speed | Use Case |
|---|---|---|---|---|---|
| JSON | 278 | 1,133 | baseline | 5.31 µs | Legacy interchange |
| TOML | 151 | 607 | 1.8x | 137.06 µs | Config files |
| TOON | 67 | 269 | 4.1x | 2.67 µs | Compact text |
| mic@1 | 52 | 209 | 5.3x | 2.26 µs | Mind IR (text) |
| mic@2 | 27 | 111 | 10.3x | ~1.8 µs | LLM prompts, git diffs |
| MIC-B v2 | - | 90 | most compact | ~0.5 µs | Storage, network |
Bytes for the same 6-node layer (linear scale)
- JSON1,133
- TOML607
- TOON269
- mic@1209
- mic@2111
- MIC-B v290
Benchmark: 6-node neural network layer (param, matmul, add, relu). See BENCHMARK_RESULTS.md for methodology, or run mic_map_benchmark_v2.py to reproduce all numbers locally.
Feature Comparison
| Feature | JSON | TOON | mic@1 | mic@2 | MIC-B |
|---|---|---|---|---|---|
| Human readable | Yes | Yes | Yes | Yes | No |
| Git-friendly | No | Partial | Yes | Yes | No |
| Deterministic | No | No | Yes | Yes | Yes |
| LLM-optimized | No | No | Partial | Yes | N/A |
| Binary format | No | No | No | No | Yes |
| Implicit IDs | No | No | No | Yes | Yes |
Side-by-Side Example
mic@1
T0 [f16;128,128]
T1 [f16;128]
N0 param "X" T0
N1 param "W" T0
N2 param "b" T1
N3 matmul N0 N1 T0
N4 add N3 N2 T0
N5 relu N4 T0
N6 add N5 N0 T0
O N6mic@2
T0 f16 128 128
T1 f16 128
a X T0
p W T0
p b T1
m 0 1
+ 3 2
r 4
+ 5 0
O 6Key Design Principles
Token efficiency
Minimize LLM tokens for AI agent workflowsGit-friendly
One operation per line for clean diffsDeterministic
Same graph always produces identical bytesLossless roundtrip
mic@2 ↔ MIC-B ↔ Mind IRSecurity limits
Bounded inputs prevent DoS attacks
Rust API
use mind::ir::compact::v2::{
parse_mic2, emit_mic2, // Text format
parse_micb, emit_micb, // Binary format
detect_format, MicFormat, // Auto-detection
};
// Parse mic@2 text to Graph
let graph = parse_mic2(text)?;
// Emit Graph to mic@2 text
let text = emit_mic2(&graph);
// Parse MIC-B binary to Graph
let graph = parse_micb(&mut cursor)?;
// Emit Graph to MIC-B binary
emit_micb(&graph, &mut writer)?;
// Roundtrip is deterministic
assert_eq!(emit_mic2(&parse_mic2(&text)?), text);Security Limits
All MIC parsers enforce strict limits to prevent denial-of-service attacks:
Learn More
See the full specifications at star-ga/mind-spec.