This repository is a clean-room Rust rewrite of:
StartripAI/a-fork-of-instructor-claude-codeas the primary repo1 structural and behavioral baselineultraworkers/claw-code-parityas the repo2 compatibility baseline
The working rule is:
- mirror public behavior and internal module boundaries
- preserve root
src/structure parity with repo1 - do not copy upstream source, prose, or line-by-line implementation
As of 2026-04-03, the workspace is in a good handoff state:
- repo1 behavioral coverage:
100.0 - repo1 structural coverage:
100.0 - repo1 structural gate:
true - repo2 command coverage:
100.0 - repo2 tool coverage:
100.0 - repo2 real tool coverage:
100.0 - repo2 moderate tool coverage:
100.0 - repo2 promoted stub count:
17
Authoritative manifest:
parity_manifest.toml
Primary reference repos used during freeze/score:
- repo1:
/Users/star/proj_out/_refs/a-fork-of-instructor-claude-code - repo2:
/Users/star/proj_out/_refs/claw-code-parity
The repository now has two layers:
-
Root package
clawcode- main binary lives at
src/main.rs - root
src/mirrors repo1 layout - root modules increasingly own application behavior
- main binary lives at
-
Helper crates under
crates/- still provide lower-level implementations and compatibility scaffolding
- should continue shrinking in application ownership over time
Important note:
- this directory is not a Git repository right now
git statusfrom the repo root fails because.gitis absent
These are already meaningfully owned by root src/:
- CLI startup chain
src/main.rssrc/entrypoints/cli.rssrc/entrypoints/init.rssrc/entrypoints/server.rssrc/entrypoints/remote.rssrc/entrypoints/repl.rssrc/entrypoints/voice.rs
- command dispatch surface
src/commands.rssrc/commands/mod.rs- root-owned command modules under
src/commands/*/mod.rs
- bridge and services wrappers
src/bridge/*src/services/*
- root query wrapper
src/QueryEngine.rs
- root tool registry and first migrated tool tranche
src/tools.rssrc/tools/mod.rssrc/tools/shared/mod.rs- root-owned tool modules:
ConfigToolEnterPlanModeToolExitPlanModeToolEnterWorktreeToolExitWorktreeToolFileReadToolFileWriteToolFileEditToolGlobToolGrepToolSleepToolSyntheticOutputToolTodoWriteToolToolSearchTooltesting
The root package now owns the main startup path. crates/claw-cli is a thin wrapper over root:
- root startup:
src/main.rs -> src/entrypoints/cli.rs - wrapper only:
crates/claw-cli/src/lib.rs
src/commands.rs intercepts a substantial set of commands before falling back to the helper crate. Root command modules now exist in repo1-style directories.
src/tools.rs now exposes RootToolRegistry, which:
- merges root-owned tool specs with fallback helper-crate specs
- resolves aliases at the root layer
- dispatches selected tools through clean-room root implementations
- falls back to
crates/toolsfor the rest
src/QueryEngine.rs now keeps a root tool registry and routes:
tool_specs()run_tool(...)
through root ownership instead of directly exposing helper-crate tools.
crates/runtime/src/lib.rs was corrected so config.cwd is overwritten with the actual current startup directory. This fixed a real bug where:
doctor- direct tool execution
- workspace path resolution
could accidentally use a stale persisted directory from an older session.
The biggest remaining ownership gap is this:
- direct tool execution through root
QueryEngine::run_tool(...)now uses the root tool registry - but prompt execution inside
crates/runtime::AppRuntime::execute_prompt(...)still uses the helper-crateToolRegistry
That means there are currently two tool paths:
- Root path
- used by root wrappers and direct root tool calls
- Runtime helper path
- used by provider-driven tool loops inside
AppRuntime
- used by provider-driven tool loops inside
This is still behaviorally correct under current tests and harness scores, but it is the most important remaining clean-room migration target if the goal is "full internal rewrite" rather than only parity.
Best next move:
- migrate
AppRuntimeso provider tool loops use root-owned tool dispatch - remove the split between
RootToolRegistryand helper-crate runtime tool execution
Likely touch points:
src/QueryEngine.rssrc/tools.rscrates/runtime/src/lib.rs
Good next subsystems to deepen:
componentshooksinkscreens- additional
tools/*
Many repo1-style paths exist already for structural parity. The best ongoing migration pattern is:
- keep the path
- add a real
mod.rs - move one responsibility at a time into root
- keep helper crates as thin implementations only
Use these commands after any meaningful migration:
cargo fmt
cargo test --workspace
cargo run -p compat-harness -- freeze --repo1 /Users/star/proj_out/_refs/a-fork-of-instructor-claude-code --repo2 /Users/star/proj_out/_refs/claw-code-parity --out /Users/star/proj_out/clawcode/parity_manifest.toml
cargo run -p compat-harness -- score --manifest /Users/star/proj_out/clawcode/parity_manifest.toml
cargo run -- --output-format json doctor
cargo run -- --output-format json prompt /mcpUseful smoke checks:
cargo run -- prompt /skills
cargo run -- prompt '/memory root-owned note'
cargo run -- prompt /clear
cargo run -- prompt /diffAt handoff time, these are expected to pass:
cargo test --workspacecargo run -p compat-harness -- score --manifest /Users/star/proj_out/clawcode/parity_manifest.tomlcargo run -- --output-format json doctorcargo run -- --output-format json prompt /mcp
Expected score highlights:
- repo1 command coverage
100.0 - repo1 tool coverage
100.0 - repo1 structural gate
true - repo2 command coverage
100.0 - repo2 tool coverage
100.0
Expected doctor highlights:
"cwd": "/Users/star/proj_out/clawcode"- root binary starts from current workspace
If someone is resuming this work, start here:
Cargo.tomlsrc/main.rssrc/lib.rssrc/entrypoints/cli.rssrc/commands.rssrc/commands/mod.rssrc/tools.rssrc/tools/mod.rssrc/tools/shared/mod.rssrc/QueryEngine.rscrates/runtime/src/lib.rscrates/compat-harness/src/main.rsparity_manifest.toml
- keep the rewrite clean-room
- do not copy upstream code or wording
- preserve repo1-shaped paths and responsibilities
- prefer moving ownership into root
src/rather than adding new application logic to helper crates - do not accept harness score regression during migration