Harness RS
Codex CLI-Style Terminal Agent Harness · 30-Day Tutorial
Project Status: D030 / 30 · v0.1.0 · Apache-2.0
Technology Stack: Rust · Cargo Workspace · Rollout JSONL · Ratatui
Study Label: CodexCli-clone; public codename harness-rs.
Harness RS uses Rust to implement a Codex CLI-style terminal Agent Harness from scratch as a clean-room project. Rather than replicating the entire product, the tutorial focuses on understanding the Turn Loop, Rollout, tool patching, approval policies, sandbox boundaries, and multiple terminal execution modes.
← Back to Series Overview · View Source Code · Upstream Codex
MVP Features
Model and Turn Loop
- A single Provider using Chat Wire.
- Turn Loop and structured tool interactions.
- Mock/offline tests remain deterministic, while real models are connected through environment configuration.
- Model decisions and execution approvals are handled separately.
Rollout and Recovery
- Rollout JSONL persistence.
- Resume restores existing threads.
- Run records support replay, inspection, and troubleshooting.
- File and process boundaries are validated through tests and Fixtures.
Tools and Approvals
- Shell and Apply Patch tools.
- Four approval levels covering different automation and human-confirmation needs.
- Plan Mode is separated from execution mode.
- The MVP uses MockSandbox to define the sandbox interface and test boundaries explicitly; real Landlock/Seatbelt support is an extension and is not presented as implemented production-grade isolation.
Terminal and Headless Execution
- Minimal Ratatui TUI.
- Headless Exec JSONL output.
- CLI Help, integration tests, and end-to-end task validation.
- Cargo Workspace separates core, Exec, and TUI concerns.
30-Day Learning Focus
| Stage | Main Topics |
|---|---|
| Foundations | Rust Workspace, messages, Provider, and Turn Loop |
| Persistence | Thread, Rollout JSONL, Resume, and run records |
| Tools | Shell, Apply Patch, errors, and output contracts |
| Security | Approval policies, Plan Mode, Sandbox interfaces, and attack boundaries |
| Interaction | Ratatui TUI, Exec JSONL, and CLI |
| Quality | Format, Clippy, Docs, Build, E2E, and release audits |
Acceptance Record
The D030 release checklist records Workspace tests, Format, Clippy, Docs, Build, CLI Smoke, and E2E. The 52 recorded tests cover Core, Exec, and TUI. No coverage percentage is claimed when coverage tooling is not installed; deterministic tests and critical-path E2E serve as evidence.
Explicit Boundaries
This is a v0.1.0 MVP for learning and local experimentation. It is not equivalent to the official Codex CLI and does not claim a complete production sandbox, comprehensive Provider coverage, or official compatibility.
Clean Room and Licensing
The research pin is the Codex Rust line rust-v0.172.0. The project retains research notes, a Clean-room Log, and third-party attributions; its own implementation is released under Apache-2.0.