plan_rebase

Read what rebasing an agent's worktree onto its base would do, without moving anything.

AgentwritesidempotentMCP tool

Call this before rebase_worktree, every time: it names the ref and the commit the branch would land on, how many of the agent's own commits would be replayed, how many the base already holds whole and so would be dropped, how many merge commits a rebase would flatten away, and the paths a merge of the base could not settle. Those paths are a warning rather than a verdict, since a rebase replays commit by commit and can conflict where a merge would not. This refuses for the same reasons rebase_worktree does, so it is also how you find out whether a rebase is possible at all without attempting one.

Calling it#

curl -X POST http://127.0.0.1:8787/agent.v1.AgentService/PlanRebase \
  -H 'Content-Type: application/json' \
  -d '{
  "agentId": "<agentId>"
}'

Request#

PlanRebaseRequest#

PlanRebaseRequest asks what a rebase would do without doing it, which is what the confirmation names.

FieldTypeDescription
agentIdstring

Whose branch the rebase would move.

required

Response#

PlanRebaseResponse#

FieldTypeDescription
baseRefstring

The ref the branch would move onto, and the commit that ref named when it was read, so a person is told which commit was used rather than only which branch.

baseShastring

The commit that ref named when it was read.

commitsint32

How many of the agent's own commits would be replayed.

branchstring

Which branch would move.

landedCommitsint32

How many of the agent's own commits the base already holds whole, which is what a merge of its work into the base leaves behind, and how many are left to replay.

replayCommitsint32

How many are left to replay onto the new base.

mergesint32

How many merge commits a rebase would discard, since it flattens history.

conflictPathslist of string

The paths a merge of the base into the branch could not settle, which is a warning rather than a verdict: a rebase replays commit by commit and can conflict where a merge would not.