This file provides guidance to Claude Code when working with code in this repository.
ALL work MUST be tracked using cas. No exceptions.
bd ready # See what's unblocked and ready to work on
bd show <issue-id> # Review the issue details before starting
bd update <issue-id> --status in_progress # Claim the issuebd create "Discovered sub-task" --type task # If you discover new work
bd dep add <new-issue> <parent-issue> # Link dependenciesbd close <issue-id> # Mark as done
bd ready # Find next taskTasks are structured as test-first. Implementation tasks are blocked by their test tasks.
- Pick a test task from
bd ready(e.g., "Write Parser tests") - Write the tests, run them (they should fail)
- Close the test task:
bd close <test-issue> - The implementation task becomes unblocked in
bd ready - Implement until tests pass
- Close the implementation task
bd list # All issues
bd list --status open # Open issues only
bd ready # Unblocked work ready to start
bd show <id> # Issue details
bd dep tree <id> # Visualize dependencies
bd create "title" -t task # Create new task
bd update <id> --status in_progress
bd close <id> # Complete an issueDO NOT write code, fix bugs, add features, or make any changes without first having or creating a bd issue for it.
claude_rs is a pure Rust SDK for the Claude Code CLI. It communicates with Claude via the CLI's JSON streaming output format, providing a native Rust experience with async streaming, tools, and hooks.
Ported from ex_claude (Elixir).
claude_rs/
├── src/
│ ├── lib.rs # Main library entry point
│ ├── cli/
│ │ ├── mod.rs # CLI process management (PTY)
│ │ ├── command.rs # CLI argument builder
│ │ ├── parser.rs # JSON stream parser
│ │ └── executable.rs # Executable detection
│ ├── message/
│ │ ├── mod.rs # Message enum and parsing
│ │ ├── system.rs # SystemMessage
│ │ ├── assistant.rs # AssistantMessage
│ │ ├── user.rs # UserMessage
│ │ ├── result.rs # ResultMessage
│ │ └── ... # Other message types
│ ├── tool/
│ │ ├── mod.rs # Tool definition
│ │ ├── schema.rs # JSON Schema helpers
│ │ └── handler.rs # ToolHandler trait
│ ├── hook/
│ │ ├── mod.rs # Hook definition
│ │ ├── input.rs # Hook input types
│ │ ├── output.rs # Hook output types
│ │ └── handler.rs # HookHandler trait
│ ├── mcp/
│ │ ├── bridge.rs # TCP server for tool execution
│ │ ├── config.rs # MCP config generation
│ │ └── protocol.rs # MCP protocol types
│ ├── query.rs # Query struct and control
│ ├── session.rs # Managed session
│ ├── options.rs # QueryOptions builder
│ └── error.rs # Error types
├── src/bin/
│ └── claude_rs_mcp.rs # MCP stdio server binary
├── tests/
│ ├── cli_test.rs
│ ├── parser_test.rs
│ ├── message_test.rs
│ └── ...
├── examples/
│ ├── simple_query.rs
│ ├── multi_turn.rs
│ ├── with_tools.rs
│ └── with_hooks.rs
├── Cargo.toml
├── CLAUDE.md # This file
└── PORTING_PLAN.md # Detailed porting plan
Rust (claude_rs)
│
├── query() / prompt() → streams messages back to caller
├── schemars → JSON Schema (for tool input validation)
│
└── Cli (tokio task)
│
│ PTY (stdin/stdout)
▼
Claude CLI (--print --output-format stream-json)
│
└── Claude API
Key design: Pure Rust implementation using PTY to communicate with the Claude CLI. Messages are streamed as newline-delimited JSON and parsed into typed message structs.
# Build
cargo build
# Run tests
cargo test # Unit tests (mock mode)
cargo test --features live # Include live API tests
# Run example
cargo run --example simple_query
# Check formatting and lints
cargo fmt --check
cargo clippy- Messages stream via async Rust streams from CLI output
- CLI is spawned via PTY with
--print --output-format stream-json - Tool schemas: derive with
schemars, validated before handler execution - Mock mode available for testing without actual CLI
- No external runtime dependencies (no Node.js, no TypeScript)
tokio- async runtimeserde/serde_json- JSON serializationportable-pty- PTY for CLI communicationschemars- JSON Schema generationasync-stream- async stream utilitiesthiserror- error handling