Files
claw-code/rust
Yeachan-Heo 8b6bf4cee7 Establish stdio JSON-RPC framing for MCP initialization
The runtime already knew how to spawn stdio MCP processes, but it still
needed transport primitives for framed JSON-RPC exchange. This change adds
minimal request/response types, line and frame helpers on the stdio wrapper,
and an initialize roundtrip helper so later MCP client slices can build on a
real transport foundation instead of raw byte plumbing.

Constraint: Keep the slice small and limited to stdio transport foundations
Constraint: Must verify framed request write and typed response parsing with a fake MCP process
Rejected: Introduce a broader MCP session layer now | would expand the slice beyond transport framing
Rejected: Leave JSON-RPC as untyped serde_json::Value only | weakens initialize roundtrip guarantees
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Preserve the camelCase MCP initialize field mapping when layering richer protocol support on top
Tested: cargo fmt --all --manifest-path rust/Cargo.toml
Tested: cargo clippy -p runtime --all-targets --manifest-path rust/Cargo.toml -- -D warnings
Tested: cargo test -p runtime --manifest-path rust/Cargo.toml
Not-tested: Integration against a real external MCP server process
2026-03-31 22:19:30 +00:00
..
2026-03-31 17:43:09 +00:00
2026-03-31 17:43:09 +00:00

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-harness crate 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:

  1. Extract observable upstream command/tool/bootstrap facts first.
  2. Keep Rust module boundaries recognizable.
  3. Grow runtime compatibility behind proof artifacts.
  4. 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/.