Skip to content

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.

Terminal window
cd rust/rust-ai-engineering
cargo 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.jsonl
cargo run -p forge-cli -- eval --suite fixtures/forge/eval-suite.json
DayBuildRust conceptAgent concept
18source-guided Codex anatomyworkspaces, async components, native binaryagent = model plus controlled runtime
19narrow tool registrytraits, enums, generics, effectstool schemas and untrusted observations
20progress-aware loopstate machines, budgets, terminationstop on evidence, not narration
21approval and receiptscapabilities, typestate, policypermission before side effects
22causal trace, replay, memorydurable events, conflicts, hashesdebug and remember with evidence
23release gatedatasets, reports, version identityship behavior, not a prompt file
model proposes action
harness validates syntax, policy, budget, and authorization
tool executes narrowly
receipt plus independent state becomes evidence
loop may claim progress

Start with Day 18 — Learn from Codex CLI’s Rust Codebase →.