/aqe-optimize
Optimize test suites using sublinear algorithms to maximize coverage while minimizing test count and execution time
> /plugin marketplace add proffesor-for-testing/agentic-qe> /plugin install agentic-qe-fleet@agentic-qe
Command definition
aqe-optimize.mdname: 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
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
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.
Other commands on agentic-qe.
agent-coordination
CommandCoordination patterns for multi-agent collaboration.
agent-spawning
CommandGuide to spawning agents with Claude Code's Task tool.
agent-types
CommandComplete guide to all 87 available agent types in Claude Flow V3
More commands from other plugins.
bkit
Commandbkit plugin help - Show all available bkit functions. Workaround for skills autocomplete issue. Use "/bkit" or just type "bkit…
check-code-quality
CommandYou are performing static code quality analysis on the Scopy package: `$ARGUMENTS`
bind-docs-sync
CommandCreate a docs-sync binding between local docs and a YApi category.

