# Agent Configuration **IMPORTANT:** Prefer to use the `write_file` tool if the edit is for the majority of a file, or if you are correcting previous problems made edits from other tools. ## Commands **IMPORTANT:** Always export `TERM=dumb`. **IMPORTANT:** The cargo command cannot be ran in parallel. ### Build - Build: `TERM=dumb cargo build` - Build release: `TERM=dumb cargo build --release` ### Test - Run all tests: `TERM=dumb cargo test` - Run specific test: `TERM=dumb cargo test TEST_NAME` - Run tests with output: `TERM=dumb cargo test -- --nocapture` ### Lint/Format Commands - Check formatting: `TERM=dumb cargo fmt --check` - Format code: `TERM=dumb cargo fmt` - Lint: `TERM=dumb cargo clippy` - Lint with errors: `TERM=dumb cargo clippy -- -D warnings` ## Code Style Guidelines ### Imports - Group imports in order: standard library, external crates, local modules - Use explicit imports over glob imports (`use std::fs::File;` not `use std::fs::*;`) ### Formatting - Use rustfmt (configured via rustfmt.toml if exists) - Max line length: 100 characters - Indent with 4 spaces ### Types - Prefer explicit types in public API - Use `&str` for string literals, `String` for owned strings - Use `Option` for optional values, `Result` for error handling ### Naming Conventions - Use snake_case for variables and functions - Use PascalCase for types and traits - Use UPPER_SNAKE_CASE for constants and statics ### Error Handling - Use `anyhow::Result` for most error handling - Use `anyhow::Context` to add context to errors - Avoid `unwrap()` in production code ### Documentation - Document all public APIs with rustdoc - Use examples in documentation when helpful ## Procedures ### Fix build problems 1. Build the project: `TERM=dumb cargo build`. 2. If there are errors or warnings, create a new sub agent (expert rust developer) that uses the `TERM=dumb cargo build` output as input, planned using strategic thinking. a. Read all affected files d. Plan the fixes using strategic thinking: - Read other files if they provide context or examples - Look up relevant API information - Do not downgrade versions - Preserve functionality - Use `TERM=dumb cargo fix` if appropriate. - Prefer the `write_file` tool if there is evidence of double escaping - You must generate the full file contents when using `write_file` or it will be truncated. c. Return the list of files modified 3. If any files were modified, loop back to 1. ### Fix formatting 1. Format the project the project: `TERM=dumb cargo fmt` 2. Continue with the fix build problems procedure.