Skip to content

JulienEllie/morris

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧬 Morris

AI-Powered Mutation Testing for Rust

Find the bugs hiding in your test suite

Rust Claude Code

    ╔═══════════════════════════════════════╗
    β•‘  Your Code  β†’  Morris  β†’  Better Tests β•‘
    β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Changes from the original

This is a fork of Marc Brooker's morris. Key differences:

  • Claude Code skill instead of Bedrock β€” the original used AWS Bedrock for AI reasoning; this fork uses a Claude Code /morris skill, so no API keys or AWS setup needed
  • Markdown + YAML output β€” cargo morris discover outputs markdown with YAML frontmatter and fenced code blocks instead of a single-line JSON blob with escaped newlines
  • Diff-style mutation input β€” mutation plans use a ## file:line / - original / + mutated format instead of JSON, which is less error-prone for LLMs to generate
  • File/directory targeting β€” you can run morris on specific files or directories (/morris src/lib.rs)
  • Dropped serde/serde_json dependencies β€” the simpler text formats eliminated the need for JSON serialization

🎯 What is Morris?

Morris is a Claude Code skill that performs 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 splits work between deterministic code (file discovery, test execution, mutation application) and AI reasoning (selecting mutations, analyzing results). The deterministic parts run as a cargo subcommand. The AI parts are handled by Claude Code β€” no API key required if you have a Claude subscription.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Your Code  β”‚ ───> β”‚    Morris    β”‚ ───> β”‚  Test Gaps  β”‚
β”‚   + Tests   β”‚      β”‚ (Fixed Flow) β”‚      β”‚  + Fixes    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β”œβ”€ Discovers files (deterministic)
                            β”œβ”€ Runs baseline tests (deterministic)
                            β”œβ”€ AI selects mutations (Claude Code)
                            β”œβ”€ Tests mutations (deterministic)
                            └─ AI analyzes results (Claude Code)

πŸš€ Quick Start

Prerequisites

Installation

# Install the cargo subcommand
cargo install --git https://github.com/JulienEllie/morris

# Install the Claude Code skill (global β€” works in any project)
mkdir -p ~/.claude/skills
cp -r .claude/skills/morris ~/.claude/skills/morris

Usage

In any Rust project, open Claude Code and type:

/morris

That's it! Claude will discover your source files, propose mutations, test them, and analyze the results.

You can also target specific files or directories:

/morris src/lib.rs
/morris src/parser/

πŸ“‹ How It Works

Morris uses a fixed, deterministic workflow. Claude Code provides the AI reasoning, while the cargo-morris binary handles all file I/O, test execution, and mutation application.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     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 β€” Claude Code)                     β”‚
β”‚     └─ Claude proposes 5-8 strategic mutations             β”‚
β”‚        β€’ 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 β€” Claude Code)                          β”‚
β”‚     └─ Claude explains surviving mutations and             β”‚
β”‚        suggests specific tests to catch them               β”‚
β”‚                                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸŽ›οΈ CLI Subcommands

Morris exposes three subcommands used by the /morris skill. You don't normally call these directly, but they're available if you want to integrate Morris into other workflows.

Command Description
cargo morris discover [paths...] Find source files, read them, run baseline tests. Outputs markdown.
cargo morris test --timeout <secs> Read mutation plan from stdin, test each mutation, output results.
cargo morris apply --timeout <secs> Read analysis text from stdin, auto-apply suggested tests.

All subcommands accept -v / --verbose for debug logging.


πŸ“Š Example Session

> /morris

🧬 Morris v0.3.0 - Mutation Testing

πŸ“ Discovering source files...
   src/lib.rs

πŸ“– Reading source files...
⏱️  Running baseline tests...
   βœ… Baseline passed in 1.2s (mutation timeout: 30.0s)

[Claude proposes 6 mutations...]

πŸ§ͺ Testing 6 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

[Claude analyzes surviving mutations and suggests specific tests...]

πŸ†š Morris vs cargo-mutants

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
  • 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.


πŸ”§ Configuration

Verbose Output

# Pass -v to any subcommand for debug logging
cargo morris discover -v
cargo morris test -v --timeout 30

πŸ—οΈ Architecture

Morris separates deterministic operations from AI reasoning. The cargo-morris binary handles all file I/O, test execution, and mutation application. Claude Code provides the intelligence β€” no API keys or separate billing required.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Morris Architecture                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                         β”‚
β”‚  β”‚ Claude Codeβ”‚  /morris                                β”‚
β”‚  β”‚   Skill    β”‚  (AI reasoning)                         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                                         β”‚
β”‚        β”‚                                                 β”‚
β”‚        v                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚
β”‚  β”‚      cargo-morris (deterministic)      β”‚             β”‚
β”‚  β”‚                                        β”‚             β”‚
β”‚  β”‚  discover: find files, run baseline   β”‚             β”‚
β”‚  β”‚  test: apply mutations, run tests     β”‚             β”‚
β”‚  β”‚  apply: inject new tests, verify      β”‚             β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚                                                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

About

Morris is an experimental AI-powered mutation tester and test critic for Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 100.0%