Add a standalone api crate for Anthropic's Messages API with typed requests, responses, and SSE event parsing. The crate can send standard message requests or consume streaming responses incrementally, and the workspace now passes the stricter clippy invocation required by this lane. Constraint: Must fit the existing Rust workspace and pass cargo fmt/clippy/test Constraint: Live Anthropic verification depends on a valid ANTHROPIC_API_KEY at runtime Rejected: Add a Stream-trait wrapper with extra dependencies | custom next_event() keeps the crate smaller Rejected: Skip workspace lint cleanup | user explicitly required cargo clippy to pass Confidence: medium Scope-risk: moderate Directive: Extend StreamEvent deliberately if future lanes need tool-use or thinking deltas Tested: cargo fmt Tested: cargo clippy --workspace --all-targets -- -D warnings Tested: cargo test --workspace Not-tested: Live Anthropic stream smoke test with a valid API key (current ANTHROPIC_API_KEY returned 401 authentication_error)
Rust port foundation
This directory contains the first compatibility-first Rust foundation for a drop-in Claude Code CLI replacement.
Current milestone
This initial milestone focuses on harness-first scaffolding, not full feature parity:
- a Cargo workspace aligned to major upstream seams
- a placeholder CLI crate (
rusty-claude-cli) - runtime, command, and tool registry skeleton crates
- a
compat-harnesscrate that reads the upstream TypeScript sources in../src/ - tests that prove upstream manifests/bootstrap hints can be extracted from the leaked TypeScript codebase
Workspace layout
rust/
├── Cargo.toml
├── README.md
├── crates/
│ ├── rusty-claude-cli/
│ ├── runtime/
│ ├── commands/
│ ├── tools/
│ └── compat-harness/
└── tests/
How to use
From this directory:
cargo fmt --all
cargo check --workspace
cargo test --workspace
cargo run -p rusty-claude-cli -- --help
cargo run -p rusty-claude-cli -- dump-manifests
cargo run -p rusty-claude-cli -- bootstrap-plan
Design notes
The shape follows the PRD's harness-first recommendation:
- Extract observable upstream command/tool/bootstrap facts first.
- Keep Rust module boundaries recognizable.
- Grow runtime compatibility behind proof artifacts.
- Document explicit gaps instead of implying drop-in parity too early.
Relationship to the root README
The repository root README explains the leaked TypeScript codebase. This document tracks the Rust replacement effort that lives in rust/.