Find the bugs hiding in your test suite
βββββββββββββββββββββββββββββββββββββββββ
β Your Code β Morris β Better Tests β
βββββββββββββββββββββββββββββββββββββββββ
Morris is a cargo subcommand that uses AWS Bedrock (Claude Sonnet 4.6) to perform intelligent mutation testing on Rust projects. Instead of exhaustively testing thousands of mutations, Morris uses AI to strategically select 5-8 high-value mutations that are most likely to reveal gaps in your test coverage.
Morris follows a fixed workflow β file discovery, test execution, and mutation application are all handled by deterministic code. The AI is used only for two targeted tasks: selecting which mutations to try, and analyzing the results.
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β Your Code β βββ> β Morris β βββ> β Test Gaps β
β + Tests β β (Fixed Flow) β β + Fixes β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β
ββ Discovers files (deterministic)
ββ Runs baseline tests (deterministic)
ββ AI selects mutations (Bedrock)
ββ Tests mutations (deterministic)
ββ AI analyzes results (Bedrock)
cargo install --path .- AWS Bedrock access with Claude Sonnet 4.6 enabled
- AWS credentials configured (via
~/.aws/credentialsor environment variables) - A Rust project with tests
cd your-rust-project
cargo morrisThat's it! Morris will analyze your code and report surviving mutations.
Morris uses a fixed, deterministic workflow. The AI (via AWS Bedrock Converse API) is called exactly twice: once to propose mutations, and once to analyze results.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Morris Workflow β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β 1. π Discovery (deterministic) β
β ββ Recursively finds .rs files under src/ β
β β
β 2. π Read Sources (deterministic) β
β ββ Reads all source files into memory β
β β
β 3. β±οΈ Baseline (deterministic) β
β ββ Runs `cargo test` to verify and measure timing β
β β
β 4. 𧬠Mutation Plan (AI β Bedrock call #1) β
β ββ Claude proposes 5-8 strategic mutations as JSON β
β β’ Operators: > β <, + β -, == β != β
β β’ Boundaries: 0 β 1, len() β len()-1 β
β β’ Logic: && β ||, true β false β
β β
β 5. π§ͺ Testing Loop (deterministic) β
β For each mutation: β
β ββ Backup original file β
β ββ Apply mutation to single line β
β ββ Run tests (with 3x baseline timeout) β
β ββ Restore original file β
β β
β 6. π Results Summary (deterministic) β
β ββ Counts killed / survived / build errors β
β β
β 7. π‘ Analysis (AI β Bedrock call #2) β
β ββ Claude explains surviving mutations and β
β suggests specific tests to catch them β
β β
β 8. β¨ Auto Mode (optional, deterministic) β
β ββ Parses AI suggestions and writes improved tests β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Flag | Description | Use Case |
|---|---|---|
| (none) | Default mode with Claude Sonnet 4.6 | Best quality analysis |
--quick |
Use Claude Haiku 4.5 | Faster, less thorough |
--auto |
Automatically apply test improvements | Hands-free mode |
-v / --verbose |
Enable debug logging | Troubleshooting |
# Standard analysis (recommended)
cargo morris
# Quick analysis for rapid feedback
cargo morris --quick
# Auto-apply test improvements
cargo morris --auto
# Quick + auto for maximum speed
cargo morris --quick --auto$ cargo morris
𧬠Morris v0.2.0 - AI-Powered Mutation Testing
π Discovering source files...
src/lib.rs
π Reading source files...
β±οΈ Running baseline tests...
β
Baseline passed in 1.2s (mutation timeout: 30.0s)
𧬠Asking AI for mutation plan...
Got 6 mutations
π§ͺ Testing mutations...
[1/1] src/lib.rs:42 - Change > to <... β SURVIVED
[2/2] src/lib.rs:67 - Change + to -... β SURVIVED
[3/3] src/lib.rs:89 - Change == to !=... β
KILLED
[4/4] src/lib.rs:23 - Change >= to >... β
KILLED
[5/5] src/lib.rs:51 - Change true to false... β SURVIVED
[6/6] src/lib.rs:15 - Remove bounds check... π§ BUILD ERROR
π Results: 2 killed, 3 survived out of 5 testable mutations
π‘ Analyzing surviving mutations...
[AI analysis with specific test suggestions]cargo-mutants is an excellent exhaustive mutation testing tool. Morris takes a different approach:
cargo-mutants β Exhaustive Approach
- Systematically generates all possible mutations
- Tests hundreds/thousands of mutations
- AST-based pattern matching
- Comprehensive coverage analysis
- Best for: CI/CD pipelines, audits
Morris β AI-Guided Approach
- Fixed workflow, AI used only for selection & analysis
- Selects 5-8 strategic mutations
- Contextual explanations of why mutations survive
- Auto-applies improvements
- Best for: Interactive development, learning
The biggest difference is that mutants is a lot more mature, and probably more useful in production code bases for now.
Morris requires AWS credentials with Bedrock access:
# Option 1: AWS CLI
aws configure
# Option 2: Environment variables
export AWS_ACCESS_KEY_ID=your_key
export AWS_SECRET_ACCESS_KEY=your_secret
export AWS_REGION=us-east-1# Enable debug logging
cargo morris -v
# Or via environment variable
RUST_LOG=debug cargo morrisMorris uses a fixed workflow with two targeted Bedrock Converse API calls. All file I/O, test execution, and mutation application is deterministic code β no agent loop or tool-use protocol.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Morris Architecture β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββ β
β β CLI β cargo morris [--quick] [--auto] [-v] β
β βββββββ¬βββββββ β
β β β
β v β
β ββββββββββββββββββββββββββββββββββββββββββ β
β β Fixed Workflow Engine β β
β β β β
β β 1. Discover .rs files (fs) β β
β β 2. Read source files (fs) β β
β β 3. Run baseline tests (cargo test) β β
β β 4. Get mutation plan βββββββββββββββ β β
β β 5. Test each mutation (cargo test) β β β
β β 6. Summarize results β β β
β β 7. Get analysis ββββββββββββββββββββ€ β β
β β 8. Auto-apply (optional, fs) β β β
β βββββββββββββββββββββββββββββββββββββββ β β
β β β
β v β
β βββββββββββββββββββββββ β
β β AWS Bedrock β β
β β Converse API β β
β β β’ Sonnet 4.6 β β
β β β’ Haiku 4.5 β β
β β (2 calls total) β β
β βββββββββββββββββββββββ β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ