Skip to content
Testing
Command

/aqe-optimize

Optimize test suites using sublinear algorithms to maximize coverage while minimizing test count and execution time

From plugin
agentic-qe
534149 skills169 agents149 commands1 MCP
> /plugin marketplace add proffesor-for-testing/agentic-qe
> /plugin install agentic-qe-fleet@agentic-qe

Command definition

aqe-optimize.md
name: aqe-optimize
description: Optimize test suites using sublinear algorithms to maximize coverage while minimizing test count and execution time

AQE Optimize Test Suite

Optimize test suites using sublinear algorithms to maximize coverage while minimizing test count and execution time.

Usage

aqe optimize <target> [options]
# or
/aqe-optimize <target> [options]

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | `target` | string | **required** | Optimization target: suite, coverage, performance, flakiness | | `--path` | path | `./tests` | Test suite path | | `--algorithm` | string | `sublinear` | Algorithm: sublinear, genetic, greedy, heuristic | | `--objective` | string | `coverage-per-test` | Objective: coverage-per-test, execution-time, reliability | | `--budget` | number | - | Time/test budget constraint (seconds) | | `--aggressive` | boolean | `false` | Aggressive optimization (may remove tests) | | `--dry-run` | boolean | `false` | Preview optimization without applying |

Examples

Optimize Test Suite

aqe optimize suite --path tests/unit --algorithm sublinear

Optimizes test suite using sublinear algorithms for maximum efficiency.

Maximize Coverage Efficiency

aqe optimize coverage --objective coverage-per-test --aggressive

Aggressively optimizes for maximum coverage per test ratio.

Reduce Execution Time

aqe optimize performance --budget 300 --algorithm genetic

Optimizes to meet 300-second execution budget using genetic algorithm.

Remove Flaky Tests

aqe optimize flakiness --dry-run

Identifies and previews removal of flaky tests without modifying suite.

Multi-Objective Optimization

aqe optimize suite --objective coverage-per-test --budget 180

Optimizes for both coverage efficiency and time budget.

Integration with Claude Code

Spawning Optimizer Agent

// Use Claude Code's Task tool to spawn the optimizer agent
Task("Optimize test suite for efficiency", `
  Perform comprehensive test suite optimization:
  - Use sublinear algorithms for O(log n) performance
  - Maximize coverage while minimizing test count
  - Target: Reduce execution time by 30%
  - Maintain 95% coverage threshold

  Store optimization results: aqe/optimization/results
  Coordinate with test executor to validate optimized suite.
`, "qe-coverage-analyzer")

Coordinated Optimization Workflow

// Optimize suite and validate results
[Single Message]:
  Task("Optimize test suite", "Use sublinear algorithms to reduce redundancy", "qe-coverage-analyzer")
  Task("Validate optimized suite", "Ensure coverage maintained after optimization", "qe-test-executor")

  TodoWrite({ todos: [
    {content: "Analyze test redundancy", status: "in_progress", activeForm: "Analyzing redundancy"},
    {content: "Apply sublinear optimization", status: "in_progress", activeForm: "Optimizing suite"},
    {content: "Validate optimized suite", status: "pending", activeForm: "Validating optimization"},
    {content: "Measure performance improvement", status: "pending", activeForm: "Measuring improvement"}
  ]})

Agent Coordination

Primary Agent

  • **qe-coverage-analyzer**: Main agent with optimization module

Supporting Agents

  • **qe-test-executor**: Validates optimized suite
  • **qe-performance-tester**: Measures performance impact

Coordination Flow

1. Pre-Task Hook
   ├─> Retrieve test suite metadata
   ├─> Retrieve coverage matrix
   ├─> Retrieve execution history
   └─> Load optimization parameters

2. Optimization Process
   ├─> Build test-coverage matrix
   ├─> Apply sublinear optimization algorithm
   ├─> Calculate minimal test set for target coverage
   ├─> Identify redundant tests
   └─> Generate optimized suite

3. Validation Phase
   ├─> Execute optimized suite
   ├─> Verify coverage maintained
   ├─> Measure performance improvement
   └─> Compare metrics before/after

4. Post-Task Hook
   ├─> Store optimization results
   ├─> Update test suite metadata
   ├─> Train neural patterns
   └─> Notify fleet of improvements

Memory Operations

Input Memory Keys

# Retrieve test suite metadata
npx ruflo@3.76.0 memory retrieve --key "aqe/test-suite/${suite}"

# Retrieve coverage matrix
npx ruflo@3.76.0 memory retrieve --key "aqe/coverage-matrix"

# Retrieve execution history
npx ruflo@3.76.0 memory retrieve --key "aqe/execution-history"

Output Memory Keys

# Store optimization results
npx ruflo@3.76.0 memory store \
  --key "aqe/optimization/results" \
  --value '{"testsBefore": 120, "testsAfter": 85, "coverageDelta": 0.2}'

# Store optimized suite
npx ruflo@3.76.0 memory store \
  --key "aqe/optimized-suite" \
  --value '{"tests": ["test1.ts", "test2.ts"], "metadata": {}}'

# Store optimization metrics
npx ruflo@3.76.0 memory store \
  --key "aqe/optimization-metrics" \
  --value '{"timeSaved": 45, "testsRemoved": 35}'

Hooks and Coordination

Pre-Task Hook

# One id per run; post-task below records the outcome against it
OPT_ID="aqe-optimize-$(date +%s)"
npx ruflo@3.76.0 hooks pre-task \
  --task-id "${OPT_ID}" \
  --description "Optimize ${target} with ${algorithm}"

Post-Task Hook

# Set TASK_SUCCEEDED to true or false from the actual result; results go to `memory store` above
npx ruflo@3.76.0 hooks post-task \
  --task-id "${OPT_ID:?run the pre-task block first, in the same shell}" \
  --success "${TASK_SUCCEEDED:?set to true or false}" \
  --agent "qe-coverage-specialist" \
  --task "Optimize ${target} with ${algorithm}"

Notify Fleet

npx ruflo@3.76.0 hooks notify \
  --message "Optimization: ${TEST_REDUCTION}% fewer tests, ${TIME_SAVED}s saved"

Expected Outputs

Success Output

⚡ Optimizing suite...
🧮 Running sublinear optimization algorithm...

📊 Optimization Results:
   Algorithm: sublinear
   Ob
Read more
@proffesor-for-testing
Ships withagentic-qe

Quality engineering tools for your coding agent. Generate tests, investigate coverage gaps, analyze flaky behavior and coordinate quality checks across the software lifecycle. Keep the findings close to the code and use them to make a better quality decision.

534119 skills169 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
534
Star history of proffesor-for-testing/agentic-qe on GitHub, a chart by star-history.com

Other commands on agentic-qe.

More commands from other plugins.

bkit

bkit

Command

bkit plugin help - Show all available bkit functions. Workaround for skills autocomplete issue. Use "/bkit" or just type "bkit…

bkit6d605
@popup-studio-ai@popup-studio-aiInstall Command
review

review

Command

Open the Canary session viewer and triage a recorded session.

canary4w500
@0xnyn@0xnynInstall Command