# hanzo-dev LLM.md AI assistant context for the Hanzo Dev workspace. ## Overview This is a Rust workspace containing Hanzo AI development tools, including MCP clients/servers and the ZAP (Zero-copy Agent Protocol) implementation. ## Workspace Structure ``` hanzo-dev/ ├── Cargo.toml # Workspace manifest ├── mcp-client/ # MCP client library ├── mcp-server/ # MCP server library ├── mcp-stdio/ # MCP stdio transport ├── mcp-tui/ # MCP terminal UI ├── mcp-types/ # MCP type definitions ├── rustfmt.toml # Formatting config └── zap/ # ZAP protocol implementation (NEW) ``` ## ZAP Crate (`zap/`) High-performance Zero-copy Agent Protocol for agentic tool calling. ### Key Features - **Zero-copy parsing**: Messages read directly from network buffers - **Zero allocations**: Buffer pooling eliminates GC pressure - **MCP compatibility**: Gateway bridges existing MCP servers - **10-100x performance**: Faster than JSON-RPC for agent workloads ### Module Structure | Module | Purpose | |--------|---------| | `buffer.rs` | Buffer pool for zero-allocation messaging | | `wire.rs` | Binary wire protocol encoding/decoding | | `message.rs` | MCP-compatible message types | | `transport.rs` | TCP/TLS/Unix socket transport | | `client.rs` | ZAP client for tool calling | | `gateway.rs` | MCP gateway bridge | | `config.rs` | Gateway configuration | | `tools.rs` | **167 typed tool definitions** across 14 categories | | `error.rs` | Error types | ### Tool Categories (14 total) 1. **Computer** - Window, input, screen, process, filesystem, packaging 2. **Browser** - Navigation, DOM, network, storage, extraction, render 3. **Vision** - Element detection, OCR, layout analysis 4. **Lsp** - Completion, hover, definition, references, rename, symbols 5. **Vcs** - Status, diff, commit, log, blame, branch, merge, PR ops 6. **Build** - Build, test, lint, typecheck, coverage 7. **Debug** - Attach, breakpoints, step, stack, variables, profile 8. **Container** - Docker, compose, Kubernetes 9. **Cloud** - IaC, secrets, deploy, DNS/CDN 10. **Network** - HTTP, gRPC, SSH, SFTP, port scanning 11. **Data** - DB clients, migrations, queries, backup 12. **Security** - Policy, secret scan, SAST/DAST, signing 13. **Knowledge** - Search, docs, embeddings, citations 14. **Plan** - Intent, route, compose, DAG execution, cache, audit ### Wire Protocol ``` +----------+----------+------------------+ | Length | MsgType | Payload | | (4 bytes)| (1 byte) | (variable) | | LE u32 | | | +----------+----------+------------------+ ``` ### Transport Schemes | Scheme | Port | Use Case | |--------|------|----------| | `zap://` | 9999 | Local development | | `zaps://` | 9999 | Production (TLS 1.3) | | `zap+unix://` | N/A | Same-host, lowest latency | ### Performance | Metric | JSON-RPC | ZAP | Improvement | |--------|----------|-----|-------------| | Parse latency (10KB) | 420 µs | 0.4 µs | 1,050x | | Allocations/msg | 47 | 0 | 100% eliminated | | Typical tool chain (9 calls) | 4.6 ms | 3.1 µs | 1,480x | ### Related Specifications - **HIP-007**: ZAP Protocol Specification (Hanzo AI) - **LP-120**: ZAP Transport Protocol (Lux Network) - **MCP**: Model Context Protocol (Anthropic) ## Development Commands ```bash # Check ZAP crate cargo check -p hanzo-zap # Run tests cargo test -p hanzo-zap # Build all cargo build --workspace ``` ## Session History - **2025-01-25**: Created ZAP crate with comprehensive native tool support (14 categories, 167 typed structs). Integrated with workspace. Added HIP-007 implementations section and LP-120 cross-reference.