Rust + AI · Project-First
First Principles · Build it, run it, break it, understand it
You will not study Rust for months and hope to use it later. You will not read AI theory and hope a prompt eventually becomes a product. You will build seven real systems, and every language or AI concept will arrive when the next feature forces you to understand it.
Make something useful first. Then let the artifact, compiler, tests, and evals teach you. Every project starts with a visible result, grows in small runnable slices, includes deliberate failures, and ends with evidence that the behavior works.
The project ladder
Section titled “The project ladder”Turn website evidence into a typed business profile, claim audit, image prompt, and visual ad preview.
Ingest local documents, retrieve relevant chunks, stream an answer, and verify exact citations.
Align logs, screenshots, traces, and voice notes into a cited incident hypothesis graph.
Decode and sample video, extract specialist signals, align a timeline, and produce a cited critique.
Build a safe coding/research agent with typed tools, authorization, progress, receipts, replay, and evals.
Inspect transformer mechanics, run local inference, route small models, and make tuning decisions.
Ship the complete platform with an API, durable jobs, streaming, tenancy, observability, and rollback.
Start with a finished artifact
Section titled “Start with a finished artifact”The first project is inspired by the kind of small AI experiment that makes learning stick: provide business information, generate something visible, inspect what the model got wrong, and improve the system in code.
cd rust/rust-ai-engineeringcargo run -p brandforge -- build \ --source fixtures/brandforge/site.md \ --profile fixtures/brandforge/business-profile.json \ --output target/brandforgeOpen target/brandforge/ad-preview.svg, then inspect the prompt, profile, claim audit, and run report.
Next run the unsupported profile and watch Brandforge reject a plausible but invented 98% metric.
The daily loop
Section titled “The daily loop”see the product → predict → type the slice → run → break → inspect → test → explainEach day contains:
- the product behavior you are adding;
- the files and types involved;
- runnable code and exact commands;
- expected evidence;
- a deliberate failure;
- tests or evals;
- what Rust protected and what the AI system still cannot guarantee.
The companion crate is the reference answer. Type the slice yourself first when possible, then compare.
Rust and AI arrive together
Section titled “Rust and AI arrive together”| Product need | Rust concept that becomes necessary | AI concept that becomes necessary |
|---|---|---|
| preserve a website snapshot | ownership, borrowing, paths, errors | frozen evidence and provenance |
| consume model output | structs, enums, Serde, validation | structured output and refusals |
| search documents | slices, lifetimes, iterators, floats | embeddings, ranking, citations |
| process media | bytes, checked math, async workers | OCR, transcription, alignment |
| let a model act | traits, state machines, capabilities | tools, policy, progress, stopping |
| run local models | tensors, native boundaries, resource budgets | tokenization, sampling, quantization |
| operate a service | Axum, SQLx, channels, tracing | evals, routing, rollout, rollback |
The exhaustive topic chapters remain available in the Deep Reference Library, linked from the build day where each topic first matters.
A real Rust AI agent
Section titled “A real Rust AI agent”The maintained OpenAI Codex CLI is implemented in Rust. Project 5 uses its public source as a real-world architecture study before you extend Forge with tools, approvals, sandbox-shaped policy, traces, and replay. Rust + AI is not a hypothetical pairing; it already powers a widely used native coding agent.
Ready? Build Brandforge →