fastC

fastc-lang · language project · v1.0 feature-complete

C, but safe and
agent-friendly.

fastC is a small systems language with capability-typed I/O, mandatory contracts, and zero executable build scripts. It compiles to portable C11. A function with no capability arguments structurally cannot do I/O — not because a sandbox blocked it, because the compiler rejected the call.

status v1.0 feature-complete · 340+ tests · 11-package fastc-core · Sigstore + SLSA L3
hello.fc
// hello.fc — a fastC program is plain C-shaped, but with
// explicit types everywhere and no implicit conversions.
fn add(a: i32, b: i32) -> i32 {
    return (a + b);
}

fn main() -> i32 {
    let x: i32 = 10;
    let y: i32 = 20;
    let result: i32 = add(x, y);
    return result;
}
fastC v1.0 terminal demo: scaffolding a project, compiling, running, and inspecting the cap-typed surface.
fastC v1.0 in 60 seconds — cap-typed I/O, the v1.3 agent surface, the fastc-core ecosystem.

What is fastC

A small systems language for the age of agent-generated code.

fastC is a systems programming language that looks like C — fn, let, i32, braces, semicolons — and compiles to readable, portable C11 you can audit. What changes is everything around the function body: the signature now carries capabilities (what I/O it may do), contracts (what must hold on entry and exit), and a fixed set of annotations the compiler treats as obligations.

The bet: when the modal author of code is a stochastic process and the reviewer is also stochastic, the compiler is the only deterministic step in the loop — so the language should push as much of "is this correct and safe?" into the type system as it can. Read the full thesis →

Why a new language

The producer is stochastic. So is the reviewer.

Existing systems languages were designed when a careful human wrote every line. That is no longer the common case — and the properties that would help most are exactly the ones a large, established ecosystem cannot retrofit.

Problem Ambient authority & opaque builds

  • Any function can call fs::read — authority is invisible in the signature.
  • Build scripts (build.rs, build.zig, cgo, postinstall) run untrusted code at build time.
  • Correctness lives in prose and tests, not in obligations the compiler checks.
  • Diagnostics differ per tool, so agents text-parse compiler stderr.

fastC Authority in the type system

  • I/O is a typed argument; a function with no capability param is structurally inert.
  • No executable build scripts — deps are git URLs pinned by commit + sha256, cosign-signed, vendored.
  • @requires / @ensures are compile-time obligations, discharged in three tiers.
  • One JSON diagnostic envelope across every error kind, read by fastc explain.

The wedge

Four things a large ecosystem cannot retrofit.

fastC is not "Rust minus features." It is a smaller language designed from the start around properties that a 150K-package ecosystem cannot adopt without breaking itself.

Capability-typed I/O

No ambient fs::read. Capabilities are typed values, minted only in main and passed down as arguments. The type system records what a function cannot do.

Mandatory contracts

@requires and @ensures on public APIs are compile-time obligations — syntactic pass, then Z3, then a runtime fc_trap fallback.

No executable build scripts

Dependencies are git URLs with commit + sha256 + cosign keyless signing, vendored. No build.rs, no cgo, no central registry to phish.

Enforced compile budget

A compile-time budget published and regressed against on every push. fastc build --dev swaps in tcc for sub-10ms C steps.

Signature = operating manual

A signature tells an agent which memory it touches, what I/O it can do, what must hold on entry and exit, whether it can panic, and its complexity bound.

Typed protocol for agents

fastc mcp exposes build artifacts to Claude Code, Cursor, and Codex over Model Context Protocol — no text-parsing of cargo check.

One canonical idiom

The 11-package fastc-core ecosystem ships one curated answer per domain. No choosing between twelve logging libraries.

Compiles to readable C11

fastC emits portable C11 you can audit and cross-compile with zig cc across eight pre-wired targets. Same binary-size class as C and Zig.

The shape of a fastC program

Looks like C. Behaves like a proof obligation.

Three real fastC snippets: capabilities as typed arguments, contracts the compiler holds you to, and the v1.3 annotations an agent reads before generating a call site.

I/O as a typed argument, not ambient authority

capabilities_demo.fc
// I/O capabilities are typed function arguments. A function
// without a CapFsRead in its signature structurally cannot
// read a file. The compiler refuses the call.
use caps::init;

fn count_files_read(c: ref(CapFsRead)) -> i32 {
    discard(c);
    return 42;
}

fn main() -> i32 {
    let caps: Caps = init();             // root caps minted in main
    let n: i32 = count_files_read(addr(caps.fs_read));
    return n;
}

CapFsRead, CapNetConnect, CapProcSpawn — the capability set is finite, named, and only mintable in main via caps::init(). Capabilities reference →

Contracts the compiler holds you to

contracts_demo.fc
// Pre- and postconditions are compile-time obligations.
// v1 lowers to runtime asserts; v2.1 discharges via Z3 where
// it can — proven obligations cost zero at runtime.
@requires(divisor != 0)
@requires(divisor > 0)
fn safe_div(value: i32, divisor: i32) -> i32 {
    return (value / divisor);
}

@ensures(result >= 0)
fn abs(x: i32) -> i32 {
    if (x < 0) {
        return (0 - x);
    }
    return x;
}

Three-tier discharge: a syntactic pass catches free wins, Z3 handles linear-integer tautologies under a 500 ms budget, and anything unproven falls back to a runtime fc_trap. Contracts reference →

Structured annotations the v1.3 surface enforces

annotations.fc
// v1.3 added structured annotations the compiler enforces and
// `fastc explain` surfaces as JSON for agent tooling.
@purity(pure)
@complexity(O(n))
fn sum_n(n: i32) -> i32 {
    let mut acc: i32 = 0;
    let mut i: i32 = 0;
    while (i < n) {
        acc = (acc + i);
        i = (i + 1);
    }
    return acc;
}

The v1.3 annotation set — @purity, @panics, @complexity, @mem, plus module-level mandatory headers — is the signature contract an agent reads before generating a call site. fastc explain --json emits the full surface per function. Annotations reference →

Measured

Binary size, where the wedge is sharpest.

Snapshot from the cross-language benchmark suite on M3 (2026-05-22). fastC sits in the C / Zig class, not the Rust / Go class.

53 KB
stripped hello binary
6.4×
smaller than Rust
40×
smaller than Go
340+
compiler tests
Language hello sum fib(40) mandelbrot vs fastC
C33 KB17 KB17 KB33 KB0.3–0.6×
Zig50 KB50 KB50 KB50 KB0.95×
fastC53 KB53 KB53 KB53 KB1.0×
Rust342 KB341 KB341 KB342 KB6.4× larger
Go2.4 MB2.1 MB2.1 MB2.1 MB40× larger

Compile time runs ~30–40 % faster than Rust to a release binary. Runtime matches C on floating-point work; ~26 % slower on recursive integer (overflow-check cost). Full methodology and re-run scripts live at benchmarks/cross-lang/.

Ecosystem

One curated answer per domain.

The fastc-core ecosystem ships eleven capability-typed packages, each with a public preview repo under github.com/fastc-lang and a v0.1.0 release alongside fastC v1.0.

Explore fastc-core →

Compare

Pick your fight, fairly.

fastC is not "better than X on every axis." Each comparison shows the trade-offs honestly — where fastC wins, where the other language wins, and which threat model each was built for.

vs Rust

The obvious comparison. Rust has more safety machinery and a vastly larger ecosystem; fastC has structural answers to build.rs, capabilities, and compile-time budgets that Rust cannot retrofit.

vs Zig

Zig is the closest in spirit on binary size, cross-compilation, and "no hidden control flow." fastC chooses capability typing and mandatory contracts over comptime as the wedge for agent-generated code.

Full set: Rust · Zig · C · C++ · Go · Python · TypeScript — or the all-in-one matrix →

Questions

Straight answers.

What is fastC?

fastC is a small systems programming language with capability-typed I/O, mandatory contracts, and zero executable build scripts. It compiles to portable, readable C11, ships 53 KB stripped binaries, and is designed for a world where most code is written by an AI agent and reviewed by a human. It is v1.0 feature-complete and MIT-licensed.

What does "agent-first" mean for a programming language?

A fastC function signature declares what it may do — its required capabilities, its @requires/@ensures contracts, its purity and complexity — so an agent or a human reviewer can read a function's authority without reading its body. Diagnostics are a single structured JSON envelope, and fastc mcp exposes the build artifacts to Claude Code, Cursor, and Codex over Model Context Protocol.

How is fastC different from Rust or Zig?

fastC is not "Rust minus features." It is a smaller language built around four properties a large existing ecosystem cannot retrofit: capability-typed I/O as function arguments, mandatory contracts on public APIs, no executable build scripts with vendored content-hashed dependencies, and a CI-enforced compile-time budget. Rust has more safety machinery and a larger ecosystem; Zig is closest in spirit on binary size and cross-compilation.

More questions →

Recent writing

Notes on the design.

How the language interacts with code-writing agents.

All posts →

Get started

Try C, but safe and agent-friendly.

fastC is v1.0 feature-complete, MIT-licensed, and ships with an 11-package curated stdlib and a v1.3 agent-tooling surface. Read the getting-started guide or clone the compiler.