|
| 1 | +# PARITY GAP ANALYSIS |
| 2 | + |
| 3 | +Scope: read-only comparison between the original TypeScript source at `/home/bellman/Workspace/claude-code/src/` and the Rust port under `rust/crates/`. |
| 4 | + |
| 5 | +Method: compared feature surfaces, registries, entrypoints, and runtime plumbing only. No TypeScript source was copied. |
| 6 | + |
| 7 | +## Executive summary |
| 8 | + |
| 9 | +The Rust port has a good foundation for: |
| 10 | +- Anthropic API/OAuth basics |
| 11 | +- local conversation/session state |
| 12 | +- a core tool loop |
| 13 | +- MCP stdio/bootstrap support |
| 14 | +- CLAUDE.md discovery |
| 15 | +- a small but usable built-in tool set |
| 16 | + |
| 17 | +It is **not feature-parity** with the TypeScript CLI. |
| 18 | + |
| 19 | +Largest gaps: |
| 20 | +- **plugins** are effectively absent in Rust |
| 21 | +- **hooks** are parsed but not executed in Rust |
| 22 | +- **CLI breadth** is much narrower in Rust |
| 23 | +- **skills** are local-file only in Rust, without the TS registry/bundled pipeline |
| 24 | +- **assistant orchestration** lacks TS hook-aware orchestration and remote/structured transports |
| 25 | +- **services** beyond core API/OAuth/MCP are mostly missing in Rust |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## tools/ |
| 30 | + |
| 31 | +### TS exists |
| 32 | +Evidence: |
| 33 | +- `src/tools/` contains broad tool families including `AgentTool`, `AskUserQuestionTool`, `BashTool`, `ConfigTool`, `FileReadTool`, `FileWriteTool`, `GlobTool`, `GrepTool`, `LSPTool`, `ListMcpResourcesTool`, `MCPTool`, `McpAuthTool`, `ReadMcpResourceTool`, `RemoteTriggerTool`, `ScheduleCronTool`, `SkillTool`, `Task*`, `Team*`, `TodoWriteTool`, `ToolSearchTool`, `WebFetchTool`, `WebSearchTool`. |
| 34 | +- Tool execution/orchestration is split across `src/services/tools/StreamingToolExecutor.ts`, `src/services/tools/toolExecution.ts`, `src/services/tools/toolHooks.ts`, and `src/services/tools/toolOrchestration.ts`. |
| 35 | + |
| 36 | +### Rust exists |
| 37 | +Evidence: |
| 38 | +- Tool registry is centralized in `rust/crates/tools/src/lib.rs` via `mvp_tool_specs()`. |
| 39 | +- Current built-ins include shell/file/search/web/todo/skill/agent/config/notebook/repl/powershell primitives. |
| 40 | +- Runtime execution is wired through `rust/crates/tools/src/lib.rs` and `rust/crates/runtime/src/conversation.rs`. |
| 41 | + |
| 42 | +### Missing or broken in Rust |
| 43 | +- No Rust equivalents for major TS tools such as `AskUserQuestionTool`, `LSPTool`, `ListMcpResourcesTool`, `MCPTool`, `McpAuthTool`, `ReadMcpResourceTool`, `RemoteTriggerTool`, `ScheduleCronTool`, `Task*`, `Team*`, and several workflow/system tools. |
| 44 | +- Rust tool surface is still explicitly an MVP registry, not a parity registry. |
| 45 | +- Rust lacks TS’s layered tool orchestration split. |
| 46 | + |
| 47 | +**Status:** partial core only. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## hooks/ |
| 52 | + |
| 53 | +### TS exists |
| 54 | +Evidence: |
| 55 | +- Hook command surface under `src/commands/hooks/`. |
| 56 | +- Runtime hook machinery in `src/services/tools/toolHooks.ts` and `src/services/tools/toolExecution.ts`. |
| 57 | +- TS supports `PreToolUse`, `PostToolUse`, and broader hook-driven behaviors configured through settings and documented in `src/skills/bundled/updateConfig.ts`. |
| 58 | + |
| 59 | +### Rust exists |
| 60 | +Evidence: |
| 61 | +- Hook config is parsed and merged in `rust/crates/runtime/src/config.rs`. |
| 62 | +- Hook config can be inspected via Rust config reporting in `rust/crates/commands/src/lib.rs` and `rust/crates/rusty-claude-cli/src/main.rs`. |
| 63 | +- Prompt guidance mentions hooks in `rust/crates/runtime/src/prompt.rs`. |
| 64 | + |
| 65 | +### Missing or broken in Rust |
| 66 | +- No actual hook execution pipeline in `rust/crates/runtime/src/conversation.rs`. |
| 67 | +- No PreToolUse/PostToolUse mutation/deny/rewrite/result-hook behavior. |
| 68 | +- No Rust `/hooks` parity command. |
| 69 | + |
| 70 | +**Status:** config-only; runtime behavior missing. |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## plugins/ |
| 75 | + |
| 76 | +### TS exists |
| 77 | +Evidence: |
| 78 | +- Built-in plugin scaffolding in `src/plugins/builtinPlugins.ts` and `src/plugins/bundled/index.ts`. |
| 79 | +- Plugin lifecycle/services in `src/services/plugins/PluginInstallationManager.ts` and `src/services/plugins/pluginOperations.ts`. |
| 80 | +- CLI/plugin command surface under `src/commands/plugin/` and `src/commands/reload-plugins/`. |
| 81 | + |
| 82 | +### Rust exists |
| 83 | +Evidence: |
| 84 | +- No dedicated plugin subsystem appears under `rust/crates/`. |
| 85 | +- Repo-wide Rust references to plugins are effectively absent beyond text/help mentions. |
| 86 | + |
| 87 | +### Missing or broken in Rust |
| 88 | +- No plugin loader. |
| 89 | +- No marketplace install/update/enable/disable flow. |
| 90 | +- No `/plugin` or `/reload-plugins` parity. |
| 91 | +- No plugin-provided hook/tool/command/MCP extension path. |
| 92 | + |
| 93 | +**Status:** missing. |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## skills/ and CLAUDE.md discovery |
| 98 | + |
| 99 | +### TS exists |
| 100 | +Evidence: |
| 101 | +- Skill loading/registry pipeline in `src/skills/loadSkillsDir.ts`, `src/skills/bundledSkills.ts`, and `src/skills/mcpSkillBuilders.ts`. |
| 102 | +- Bundled skills under `src/skills/bundled/`. |
| 103 | +- Skills command surface under `src/commands/skills/`. |
| 104 | + |
| 105 | +### Rust exists |
| 106 | +Evidence: |
| 107 | +- `Skill` tool in `rust/crates/tools/src/lib.rs` resolves and reads local `SKILL.md` files. |
| 108 | +- CLAUDE.md discovery is implemented in `rust/crates/runtime/src/prompt.rs`. |
| 109 | +- Rust supports `/memory` and `/init` via `rust/crates/commands/src/lib.rs` and `rust/crates/rusty-claude-cli/src/main.rs`. |
| 110 | + |
| 111 | +### Missing or broken in Rust |
| 112 | +- No bundled skill registry equivalent. |
| 113 | +- No `/skills` command. |
| 114 | +- No MCP skill-builder pipeline. |
| 115 | +- No TS-style live skill discovery/reload/change handling. |
| 116 | +- No comparable session-memory / team-memory integration around skills. |
| 117 | + |
| 118 | +**Status:** basic local skill loading only. |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## cli/ |
| 123 | + |
| 124 | +### TS exists |
| 125 | +Evidence: |
| 126 | +- Large command surface under `src/commands/` including `agents`, `hooks`, `mcp`, `memory`, `model`, `permissions`, `plan`, `plugin`, `resume`, `review`, `skills`, `tasks`, and many more. |
| 127 | +- Structured/remote transport stack in `src/cli/structuredIO.ts`, `src/cli/remoteIO.ts`, and `src/cli/transports/*`. |
| 128 | +- CLI handler split in `src/cli/handlers/*`. |
| 129 | + |
| 130 | +### Rust exists |
| 131 | +Evidence: |
| 132 | +- Shared slash command registry in `rust/crates/commands/src/lib.rs`. |
| 133 | +- Rust slash commands currently cover `help`, `status`, `compact`, `model`, `permissions`, `clear`, `cost`, `resume`, `config`, `memory`, `init`, `diff`, `version`, `export`, `session`. |
| 134 | +- Main CLI/repl/prompt handling lives in `rust/crates/rusty-claude-cli/src/main.rs`. |
| 135 | + |
| 136 | +### Missing or broken in Rust |
| 137 | +- Missing major TS command families: `/agents`, `/hooks`, `/mcp`, `/plugin`, `/skills`, `/plan`, `/review`, `/tasks`, and many others. |
| 138 | +- No Rust equivalent to TS structured IO / remote transport layers. |
| 139 | +- No TS-style handler decomposition for auth/plugins/MCP/agents. |
| 140 | +- JSON prompt mode is improved on this branch, but still not clean transport parity: empirical verification shows tool-capable JSON output can emit human-readable tool-result lines before the final JSON object. |
| 141 | + |
| 142 | +**Status:** functional local CLI core, much narrower than TS. |
| 143 | + |
| 144 | +--- |
| 145 | + |
| 146 | +## assistant/ (agentic loop, streaming, tool calling) |
| 147 | + |
| 148 | +### TS exists |
| 149 | +Evidence: |
| 150 | +- Assistant/session surface at `src/assistant/sessionHistory.ts`. |
| 151 | +- Tool orchestration in `src/services/tools/StreamingToolExecutor.ts`, `src/services/tools/toolExecution.ts`, `src/services/tools/toolOrchestration.ts`. |
| 152 | +- Remote/structured streaming layers in `src/cli/structuredIO.ts` and `src/cli/remoteIO.ts`. |
| 153 | + |
| 154 | +### Rust exists |
| 155 | +Evidence: |
| 156 | +- Core loop in `rust/crates/runtime/src/conversation.rs`. |
| 157 | +- Stream/tool event translation in `rust/crates/rusty-claude-cli/src/main.rs`. |
| 158 | +- Session persistence in `rust/crates/runtime/src/session.rs`. |
| 159 | + |
| 160 | +### Missing or broken in Rust |
| 161 | +- No TS-style hook-aware orchestration layer. |
| 162 | +- No TS structured/remote assistant transport stack. |
| 163 | +- No richer TS assistant/session-history/background-task integration. |
| 164 | +- JSON output path is no longer single-turn only on this branch, but output cleanliness still lags TS transport expectations. |
| 165 | + |
| 166 | +**Status:** strong core loop, missing orchestration layers. |
| 167 | + |
| 168 | +--- |
| 169 | + |
| 170 | +## services/ (API client, auth, models, MCP) |
| 171 | + |
| 172 | +### TS exists |
| 173 | +Evidence: |
| 174 | +- API services under `src/services/api/*`. |
| 175 | +- OAuth services under `src/services/oauth/*`. |
| 176 | +- MCP services under `src/services/mcp/*`. |
| 177 | +- Additional service layers for analytics, prompt suggestion, session memory, plugin operations, settings sync, policy limits, team memory sync, notifier, voice, and more under `src/services/*`. |
| 178 | + |
| 179 | +### Rust exists |
| 180 | +Evidence: |
| 181 | +- Core Anthropic API client in `rust/crates/api/src/{client,error,sse,types}.rs`. |
| 182 | +- OAuth support in `rust/crates/runtime/src/oauth.rs`. |
| 183 | +- MCP config/bootstrap/client support in `rust/crates/runtime/src/{config,mcp,mcp_client,mcp_stdio}.rs`. |
| 184 | +- Usage accounting in `rust/crates/runtime/src/usage.rs`. |
| 185 | +- Remote upstream-proxy support in `rust/crates/runtime/src/remote.rs`. |
| 186 | + |
| 187 | +### Missing or broken in Rust |
| 188 | +- Most TS service ecosystem beyond core messaging/auth/MCP is absent. |
| 189 | +- No TS-equivalent plugin service layer. |
| 190 | +- No TS-equivalent analytics/settings-sync/policy-limit/team-memory subsystems. |
| 191 | +- No TS-style MCP connection-manager/UI layer. |
| 192 | +- Model/provider ergonomics remain thinner than TS. |
| 193 | + |
| 194 | +**Status:** core foundation exists; broader service ecosystem missing. |
| 195 | + |
| 196 | +--- |
| 197 | + |
| 198 | +## Critical bug status in this worktree |
| 199 | + |
| 200 | +### Fixed |
| 201 | +- **Prompt mode tools enabled** |
| 202 | + - `rust/crates/rusty-claude-cli/src/main.rs` now constructs prompt mode with `LiveCli::new(model, true, ...)`. |
| 203 | +- **Default permission mode = DangerFullAccess** |
| 204 | + - Runtime default now resolves to `DangerFullAccess` in `rust/crates/rusty-claude-cli/src/main.rs`. |
| 205 | + - Clap default also uses `DangerFullAccess` in `rust/crates/rusty-claude-cli/src/args.rs`. |
| 206 | + - Init template writes `dontAsk` in `rust/crates/rusty-claude-cli/src/init.rs`. |
| 207 | +- **Streaming `{}` tool-input prefix bug** |
| 208 | + - `rust/crates/rusty-claude-cli/src/main.rs` now strips the initial empty object only for streaming tool input, while preserving legitimate `{}` in non-stream responses. |
| 209 | +- **Unlimited max_iterations** |
| 210 | + - Verified at `rust/crates/runtime/src/conversation.rs` with `usize::MAX`. |
| 211 | + |
| 212 | +### Remaining notable parity issue |
| 213 | +- **JSON prompt output cleanliness** |
| 214 | + - Tool-capable JSON mode now loops, but empirical verification still shows pre-JSON human-readable tool-result output when tools fire. |
0 commit comments