Typed Rust interfaces for AI code agent CLI protocols.
This workspace provides two independent crates for interacting with Claude Code and OpenAI Codex via their JSON/JSONL streaming protocols.
| Crate | Version | Docs | CI | WASM |
|---|---|---|---|---|
claude-codes |
||||
codex-codes |
Each crate's version tracks the CLI it wraps:
claude-codesversion tracks the Claude CLI it targets and may sit slightly ahead of the CLI it was last integration-tested against. Currentlyclaude-codes 2.1.161, tested against Claude CLI2.1.205.codex-codesversion tracks the Codex CLI it has been tested against, sitting a small offset behind while the bindings stabilize. Currently0.143.2, tested against Codex CLI0.143.0.
Both crates will warn (or fail gracefully) if the installed CLI version diverges from the tested version.
claude-codes is structured into three feature flags to control dependency weight:
| Feature | Description | WASM-compatible |
|---|---|---|
types |
Core message types and protocol structs only | Yes |
sync-client |
Synchronous client with blocking I/O | No |
async-client |
Asynchronous client using tokio | No |
All features are enabled by default. For WASM or type-sharing use cases:
[dependencies]
claude-codes = { version = "2", default-features = false, features = ["types"] }codex-codes mirrors the same feature flag structure:
| Feature | Description | WASM-compatible |
|---|---|---|
types |
Core message types and protocol structs only | Yes |
sync-client |
Synchronous client with blocking I/O | No |
async-client |
Asynchronous client using tokio | No |
All features are enabled by default. For WASM or type-sharing use cases:
[dependencies]
codex-codes = { version = "0.142", default-features = false, features = ["types"] }Both crates share the same testing philosophy:
- Unit tests validate serde round-tripping for every type variant against hand-crafted JSON.
- Integration tests deserialize real JSONL captures from actual CLI sessions. These captures live in each crate's
test_cases/directory and are checked into the repo, so deserialization is validated against real-world protocol output. - CI matrix tests each feature combination independently, including WASM builds via
wasm32-unknown-unknown, clippy, rustfmt, and MSRV (1.85).
To run all tests locally:
cargo test --workspacerust-code-agent-sdks/
claude-codes/ # Claude Code CLI protocol bindings
src/ # Types, sync/async clients, protocol handling
tests/ # Deserialization + integration tests
test_cases/ # Real CLI captures and failure cases
examples/ # async_client, sync_client, basic_repl
codex-codes/ # Codex CLI protocol bindings
src/ # Types, sync/async clients, CLI builder
tests/ # Integration tests
test_cases/ # Real CLI captures
examples/ # async_client, sync_client, basic_repl
See each crate's README for detailed usage:
Apache-2.0. See LICENSE.