Move Under a New Rule
A rule states one thing the system must do, and its scenarios show it. Over time a rule can collect scenarios that show something else. A rule about the cart total picks up a scenario about discount codes, and its title grows a "less any discount" to cover it. The rule no longer tells a reader one thing to expect, and a failing test under it doesn't say which criterion broke.
Use move-under-new-rule to give those scenarios a rule of their own in the same spec. The agent titles the new rule with the acceptance criterion the scenarios show, narrows the rule they leave, and trims each rule's background to the steps its own scenarios rely on.
Ask the agent to move the scenarios
Give the agent the spec path and name the scenarios to move by title, or give their lines with --only-lines. A line anywhere in a scenario, from the tags above it to its last step, picks that scenario. A line on a rule's title, description or background picks nothing, so a selection that starts on a rule's title picks just the scenarios below it.
For example, ask the agent to move the apply a valid discount code scenario of ShoppingCart.specb under a new rule.
Feature: Shopping cart
Rule: the cart total is the sum of its products' prices, less any discount
Background:
Given the discount code "SAVE10" takes 10% off
Scenario: add a product to an empty cart
Given the cart is empty
When I add a "Coffee mug" at "€12.00"
Then the cart total is "€12.00"
Scenario: add a second product
Given the cart holds a "Coffee mug" at "€12.00"
When I add a "Tea towel" at "€8.00"
Then the cart total is "€20.00"
Scenario: apply a valid discount code
Given the cart total is "€40.00"
When I apply the discount code "SAVE10"
Then the cart total is "€36.00"
The agent puts the new rule after the rule whose criterion is closest to it, here the one the scenario came from, and narrows that rule's title to what is left. Only the moved scenario uses the discount code, so the background that sets it up goes with it.
Feature: Shopping cart
Rule: the cart total is the sum of its products' prices
Scenario: add a product to an empty cart
Given the cart is empty
When I add a "Coffee mug" at "€12.00"
Then the cart total is "€12.00"
Scenario: add a second product
Given the cart holds a "Coffee mug" at "€12.00"
When I add a "Tea towel" at "€8.00"
Then the cart total is "€20.00"
Rule: a valid discount code takes its percentage off the cart total
Background:
Given the discount code "SAVE10" takes 10% off
Scenario: apply a valid discount code
Given the cart total is "€40.00"
When I apply the discount code "SAVE10"
Then the cart total is "€36.00"
The scenarios move unchanged, with their tags and the comments above them, in the order they had. A scenario from the Feature's own level, outside any rule, moves one level deeper. The agent keeps any background step it is unsure about, such as a setting a scenario may rely on without naming it. The report says where the new rule went and why, and lists every background step removed.
When you pick every scenario of a rule
If the scenarios you pick are all of a rule's scenarios and they show its criterion, they already have a rule of their own. The agent says so and changes nothing.
If they show a different criterion, they move, and the rule they leave keeps its title and description with no scenarios. SpecBinder turns a rule with no scenarios into a failing test, so it shows as work to do until you give it a scenario. emptyRuleBehavior
The scenarios must come from one Feature, since a rule belongs to one. To move rules and scenarios under a new Feature instead, use Move Under a New Spec.
Check the move, or review it first
The steps don't change, so their implementations stay where they are. The generated test methods are named by position, such as rule_2_scenario_1, so the new rule renumbers the rules after it and the tests in them.
A removed background step is how the move can break a test. Add --verify in a Java project with JUnit 5, and the agent runs the spec's tests before and after the move and puts back any step a scenario turns out to need. Without it, check the report's list of removed steps.
Add --as-review-finding to see the change before it is made. The agent publishes it as one split finding in the spec's AI Review tab in IntelliJ IDEA, where you inspect it and select Apply or Dismiss. The agent needs the same connection to the IDE as a spec review.
From the spec editor
In IntelliJ IDEA, right-click in the spec editor and choose SpecBinder → Move Under a New Rule. The entry saves the spec and sends the lines selected, or the caret's line with nothing selected, to the agent in the spec's own session, starting one if none is open. Agent sessions
The entry is greyed out where it has nothing to move, such as on a Feature's user story, and on scenarios of more than one Feature. The status bar says why. It works with Claude Code for now.