Overview — Project 5: Forge
The earlier projects used models inside workflows. Forge is the first agent: the model can choose among tools, observe results, repair output, and decide what to do next. That freedom requires stronger boundaries.
You will also study the maintained OpenAI Codex CLI, which is implemented in Rust, as a real-world example of an AI agent that runs locally and coordinates configuration, terminal UI, tools, approvals, sandboxing, and model interaction. The exercise uses OpenAI’s public source as evidence; it does not ask you to imitate undocumented internals.
Run Forge
Section titled “Run Forge”cd rust/rust-ai-engineeringcargo run -p forge-cli -- run \ --task fixtures/forge/task-valid.json \ --responses fixtures/forge/responses-valid.json \ --trace target/forge-valid.jsonl
cargo run -p forge-cli -- replay --trace target/forge-valid.jsonlcargo run -p forge-cli -- eval --suite fixtures/forge/eval-suite.jsonThe six days
Section titled “The six days”| Day | Build | Rust concept | Agent concept |
|---|---|---|---|
| 18 | source-guided Codex anatomy | workspaces, async components, native binary | agent = model plus controlled runtime |
| 19 | narrow tool registry | traits, enums, generics, effects | tool schemas and untrusted observations |
| 20 | progress-aware loop | state machines, budgets, termination | stop on evidence, not narration |
| 21 | approval and receipts | capabilities, typestate, policy | permission before side effects |
| 22 | causal trace, replay, memory | durable events, conflicts, hashes | debug and remember with evidence |
| 23 | release gate | datasets, reports, version identity | ship behavior, not a prompt file |
Product rule
Section titled “Product rule”model proposes action ↓harness validates syntax, policy, budget, and authorization ↓tool executes narrowly ↓receipt plus independent state becomes evidence ↓loop may claim progressStart with Day 18 — Learn from Codex CLI’s Rust Codebase →.