Skip to content

Contributing

  • Rust 1.85.0+ (rustup update stable)
  • cargo (ships with Rust)
  • Optional: Chrome/Chromium for browser tool tests
  • Optional: nextest for parallel test execution: cargo install cargo-nextest

Terminal window
# Clone
git clone https://github.com/NousResearch/edgecrab
cd edgecrab
# Debug build (fast compile)
cargo build
# Release build (optimized)
cargo build --release
# The binary is at:
./target/release/edgecrab

Terminal window
# All tests (unit + integration)
cargo test --workspace
# Parallel (faster)
cargo nextest run --workspace
# Single crate
cargo test -p edgecrab-tools
# With output
cargo test --workspace -- --nocapture
# E2E tests (requires --release)
cargo test --workspace --release --test '*'

Before working on a feature, read the crate that owns it:

FeatureCrate
New tooledgecrab-tools/src/tools/
Config optionedgecrab-core/src/config.rs
Slash commandedgecrab-cli/src/commands.rs
CLI flagedgecrab-cli/src/cli_args.rs
Platform adapteredgecrab-gateway/src/
Security ruleedgecrab-security/src/
Database schemaedgecrab-state/src/ + edgecrab-migrate/

  1. Create crates/edgecrab-tools/src/tools/your_tool.rs
  2. Implement the Tool trait:
    pub struct YourTool;
    impl Tool for YourTool {
    fn name(&self) -> &'static str { "your_tool" }
    fn description(&self) -> &'static str { "..." }
    fn parameters(&self) -> serde_json::Value { /* JSON schema */ }
    async fn call(&self, args: serde_json::Value, ctx: &ToolContext) -> ToolResult { ... }
    }
  3. Register in crates/edgecrab-tools/src/registry.rs:
    registry.register(Arc::new(YourTool));
  4. Add to the appropriate toolset in toolsets.rs
  5. Add tests in crates/edgecrab-tools/tests/

  1. Add the field to the appropriate struct in edgecrab-core/src/config.rs
  2. Set a sensible Default value
  3. Add env var override in apply_env_overrides() if needed
  4. Document in Configuration Reference

  • cargo fmt --all before committing
  • cargo clippy --workspace -- -D warnings must pass
  • No unwrap() in tool implementations — use ? and ToolError
  • All public APIs must have doc comments (///)
  • Integration tests in tests/ subdirectory, unit tests in #[cfg(test)] modules

  1. Fork the repository
  2. Create a feature branch: git checkout -b feat/my-feature
  3. Make changes with tests
  4. Run the full test suite: cargo test --workspace
  5. Run clippy: cargo clippy --workspace -- -D warnings
  6. Format: cargo fmt --all
  7. Open a PR against main with a clear description

All crates in the workspace share the same version number (set in the workspace Cargo.toml). Version bumps are done via a single PR that updates the workspace version.


Apache-2.0. By contributing, you agree to license your contribution under the Apache 2.0 license.


  • Run cargo nextest run --workspace before opening a PR — it runs tests in parallel and is 3-4x faster than cargo test.
  • Start small: one tool, one crate, one test. Keeping PRs focused makes review faster.
  • Read the crate README before editing — each crate in crates/ has a short README explaining its role in the graph.
  • Use RUST_LOG=debug edgecrab ... to trace exactly which code paths your change touches before writing tests.
  • Check clippy early: cargo clippy --workspace -- -D warnings will save you a round-trip after opening the PR.

Can I add a dependency without approval? Open an issue first. EdgeCrab’s binary size and startup time are tracked metrics. New dependencies are evaluated against both.

My test requires a real API key — how do I mark it? Gate it with #[ignore] and document the env var in the test function’s doc comment. CI will skip it; contributors with keys can run it manually.

Where do I add a new config option? In crates/edgecrab-core/src/config.rs, in the relevant struct. Then add an EDGECRAB_* override in apply_env_overrides() and document it in the Environment Variables and Configuration pages.

How do I run only one test file?

Terminal window
cargo test -p edgecrab-tools --test checkpoint_test