Skip to content

Before Day 1 — Make Your Working Copy

You are not supposed to guess where code belongs. Before Day 1, create one private working copy with a known path. Every Brandforge page will name files relative to that directory.

From the repository root, the relevant directories are:

rust/rust-ai-engineering/
├── crates/brandforge/ # finished reference answer — do not edit during the lesson
├── starters/brandforge/ # clean starter template — do not edit
└── learning/brandforge/ # your working copy — edit this one

The learning/ directory is ignored by Git. You can make mistakes there without damaging the finished reference crate or mixing your learning changes into a commit.

Open a terminal at the repository root, then run exactly:

Terminal window
cd rust/rust-ai-engineering
sh scripts/new-brandforge-lab.sh
cd learning/brandforge
cargo run

Expected output:

Brandforge learning project is ready.

On the first run, Cargo may download the Rust libraries listed in Cargo.toml. “Offline first” in this book means the required AI exercises make no paid model or scraping calls after dependencies are installed.

Keep the terminal in rust/rust-ai-engineering/learning/brandforge for Days 1–5. When a page says src/main.rs, the complete path is therefore:

rust/rust-ai-engineering/learning/brandforge/src/main.rs

Every code step uses one of three labels:

  • CREATE means the file does not exist yet. Create it and paste the complete block.
  • REPLACE means select everything in that file and replace it with the complete block.
  • ADD means keep the existing code and insert the small block at the stated marker.

If a block is only an explanation and should not be pasted, the page labels it READ ONLY.

Never paste Rust code into an .md book page, Cargo.toml, or a different .rs file unless the step explicitly names that file.

Before Day 1, your working copy contains:

learning/brandforge/
├── Cargo.toml
├── fixtures/
│ ├── site.md
│ ├── business-profile.json
│ └── business-profile-unsupported.json
└── src/
└── main.rs

Cargo.toml already contains the dependencies used across the five days. You do not need to understand all of them now. Each page explains a dependency when the next feature needs it.

After each edit:

Terminal window
cargo fmt
cargo check

Only continue when cargo check finishes successfully. If it fails, read the first error, compare the filename and line number with the page, and fix that error before the rest.

At the end of a day, run the page’s exact cargo run or cargo test command. The page will show the important part of the expected output.

Do not overwrite it. Create a second clean copy so you can compare:

Terminal window
cd rust/rust-ai-engineering
sh scripts/new-brandforge-lab.sh learning/brandforge-2

You now know where to work, which copy is the answer, and how each edit is described.

Next: Day 1 — CLI and Owned Input →.