treg
superdesigndev
OpenRouter for agent tools. Join community here: https://discord.gg/6mQYYfFMAn
Lavaver/Cargo-by-Harness
Rust, Evolved. A DSH session mode that grounds the Agent in your local Cargo cache instead of hallucinating APIs. Features pure-JS macro_rules! expansion, a strict cargo check feedback loop, and beginner-first guidance.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:Lavaver/Cargo-by-Harness
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A DeepSeek Harness session mode, That gives everyone the ability to build reliable, efficient Rust software
Select Cargo by Harness when starting a new session in DSH. The Agent prioritizes retrieving crate sources and API signatures from the local Cargo cache rather than relying on memory. Core features:
macro_rules! expansion (zero external binaries)
Building a full terminal Tetris game from a single prompt.

Use axum to build a “Hello world” example program that returns JSON.

Tracklogs During DSH Operation.
CbH reuses DSH capability seams instead of reinventing them:
| DSH Capability | Plugin Usage |
|---|---|
@deepseek-ai/dsh-agent-preset |
Declares preset-cbh, exposing "Cargo by Harness" in the new-session mode selector |
ctx.tools.register |
Registers 4 model tools: cargo_search, cargo_read, cargo, cargo_expand |
ctx.commands.register |
Registers 6 deterministic slash commands; handlers answer directly without creating model messages |
ctx.skills.register |
Registers 4 bundled skills: rust-beginner-workflow, rust-compile-fix, rust-crate-choice, rust-daily-loop |
| File System | Reads local sources and rustdoc JSON under $CARGO_HOME/registry/ |
Data flow in one sentence: The model uses cargo_search / cargo_read to fetch real APIs from the local cache, cargo to execute toolchain commands with structured diagnostics, and cargo_expand to see through generated code from macro_rules!.
| Tool | Description |
|---|---|
cargo_search |
Searches local crate caches for crates, symbols, trait impls, or code patterns. Returns up to 20 item summaries without full doc bodies. |
cargo_read |
Reads exact signatures, docs, sources, implementations, or cache status by precise ID or full Rust path. |
cargo |
Executes daily toolchain commands (build/check/test/run/fmt/clippy/add/tree, etc.) with exit status and structured diagnostics. Does NOT expose publish, install, or yank. |
cargo_expand |
Pure JavaScript macro_rules! expander. Parses top-level use aliases and resolves definitions from locally cached crates. No external binaries or Rust builds required. |
If you haven't installed Rust yet, click here and follow the instructions to download and install it.
dsh plugin --profile <profile> add https://github.com/Lavaver/Cargo-by-Harness
After installation, select "Cargo by Harness" in the mode selector of a new DSH session. If you modify the bundle's sub-rows (e.g., adding skills), restart the DSH process to remount the preset composition.
Once in CbH mode, describe your Rust needs in natural language. The Agent follows a "local cache → minimal implementation → compile verify → fix" rhythm.
Example prompt:
I'm a Rust beginner. Help me write a hello world using axum that returns JSON, and make sure it runs.
The Agent will first use cargo_search to check the local axum version and API, write the code, run cargo check to verify, and automatically apply the rust-compile-fix skill when errors occur.
Both tools and commands follow the same non-skippable order:
$CARGO_HOME/registry/src/<index>/<crate>-<version>/ — Cargo unpacked source.Cargo.lock first, then manifest version requirements.where clauses, and feature-gated code..crate or docs.rs rustdoc JSON), written under $CARGO_HOME/cbh-cache/ before returning.| Command | Purpose |
|---|---|
/cargo-doctor |
Diagnose Rust toolchain, workspace, lockfile, and target directory. |
/cargo-check [--all-targets] [--clippy] [--offline] [--timeout <s>] |
Compile-verify and deterministically summarize diagnostics (error/warning counts, error codes, file:line:col). |
/cargo-cache [status\|list\|prune\|verify] |
Inspect, list, prune unreferenced cache entries, or verify cached crates. |
/cargo-fetch <crate>[@version] [--from crates.io\|docs.rs\|local] |
Perform one minimal remote completion. |
/cargo-workspace [deps\|features\|target] |
View current workspace dependency resolution. |
/cargo-item <crate::path> [--source] |
Read an exact single item, optionally including the source snippet. |
Commands perform deterministic, cacheable work only. Anything requiring natural-language judgment of "what to look up" is delegated to cargo_search / cargo_read tools.
Local check scripts are provided under the ../tools/ directory:
node tools/cbh-smoke.mjs # registry, version precedence, all commands
node tools/cbh-command-test.mjs # command registration and handlers
node tools/cbh-tool-test.mjs # fallback compiler path
node --import ./tools/register-cbh-stubs.mjs tools/cbh-tool-test.mjs # host compiler path + schema parity + cargo_expand
node tools/cbh-macro-expander-test.mjs # pure-JS macro expansion and graceful degradation
node tools/cbh-skills-test.mjs # bundled skill discovery and registration
node tools/cbh-cargo-run-test.mjs # cargo runner: whitelist, diagnostics, metadata
node tools/cbh-toolchain-test.mjs # real cargo doctor / check (fixtures)
node tools/cbh-remote-smoke.mjs # crates.io completion (throwaway CARGO_HOME)
tools/vendor/dsh-tools is a test-only extraction of @deepseek-ai/dsh-tools from the installed app, used to run the schema compiler outside the Host.
Verified Records: Real run of cargo check --offline on a failure correctly reported error [E0308] src/main.rs:2:22 mismatched types. /cargo-doctor correctly identified cargo 1.99.1 / rustc 1.99.1 / edition 2021.
#[derive], attribute macros, and functional proc-macros are left untouched; cargo_expand returns the original code. Reason: Proc-macros require compilation execution, which pure static analysis cannot cover. Mitigation: The Agent can fall back to cargo_read to inspect the macro crate's source for alternative context.use tokio::*; do not establish macro alias mappings. Reason: Static text cannot determine which macros a glob actually imports. Mitigation: When a bare call cannot be resolved, cargo_expand reports it as unresolved, and the Agent can switch to a fully qualified path./* <- [original call] */ comments to preserve a trace back to the original invocation.MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: developer-tools。