Overview — Project 1: Brandforge
The fastest way to understand Rust and AI together is to make something you can inspect. In this project you will build Brandforge, a command-line product inspired by a small TypeScript experiment: give it business research, ask a model for a brand profile, reject unsupported advertising claims, and create a campaign pack.
The model is allowed to propose. Rust decides what is valid, what is supported by evidence, and what may become an artifact.
What Brandforge does
Section titled “What Brandforge does”Run the finished reference crate:
cd rust/rust-ai-engineeringcargo run -p brandforge -- build \ --source fixtures/brandforge/site.md \ --profile fixtures/brandforge/business-profile.json \ --output target/brandforgeIt writes:
target/brandforge/├── business-profile.json # typed model output├── claim-audit.json # evidence result for every proposed claim├── image-prompt.txt # compiled only from approved information├── ad-preview.svg # visible preview you can open in a browser└── run-report.json # input hashes and artifact inventoryNow run the dangerous case:
cargo run -p brandforge -- build \ --source fixtures/brandforge/site.md \ --profile fixtures/brandforge/business-profile-unsupported.json \ --output target/brandforge-badThe model profile claims 98% client satisfaction, but the website snapshot never says that. The
program exits unsuccessfully, preserves claim-audit.json, and refuses to create an ad preview.
That failure is part of the product.
The five days
Section titled “The five days”| Day | Product slice | Rust that the slice forces | AI lesson |
|---|---|---|---|
| 1 | CLI plus website snapshot | Cargo, modules, PathBuf, String, borrowing | freeze model input |
| 2 | typed business profile | structs, enums, Serde, Option, validation | structured output is still untrusted |
| 3 | replaceable profile producer | traits, errors, configuration | scripted first, live provider second |
| 4 | evidence gate | iterators, normalization, exhaustive state | prompts do not verify facts |
| 5 | campaign pack and preview | bytes, files, hashing, unit and CLI tests | artifact provenance and evals |
The pipeline you will own
Section titled “The pipeline you will own”website snapshot ───────┐ ├─▶ claim audit ─▶ verified prompt ─▶ preview / imagemodel business profile ┘ │ └─▶ reject unsupported campaignThere are two important boundaries:
- The model output is decoded into
BusinessProfile, but decoding only proves its shape. - Every promotional claim must point to a quote present in the frozen source before generation.
The live-provider extension may use an API, but the required build is offline. You can learn the software, rerun the tests, and diagnose failures without a key, network, GPU, or paid request.
Code layout
Section titled “Code layout”crates/brandforge/├── src/│ ├── main.rs # CLI and exit status│ ├── lib.rs # public product boundary│ ├── profile.rs # model-facing data and claim audit│ ├── pipeline.rs # read, validate, compile, write│ ├── render.rs # image prompt and SVG preview│ └── error.rs # named failure modes└── tests/cli.rs # run the real executableThe reference crate is the finished answer. For the strongest learning loop, create a scratch binary and type each day’s slice before comparing it with the reference.
Start with Day 1 — CLI and Owned Input →.