# plan\_rebase

Preview a rebase of a task's branch onto its base branch without moving anything: what would be replayed, dropped and flattened, and which paths may conflict.

writes · idempotent · MCP tool · [Agent](https://komrad.dev/latest/api/agent.md)

## Calling it

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

```bash
komrad rpc plan-rebase \
  --task-id '<uuid>'
```

```json
{
  "name": "plan_rebase",
  "arguments": {
    "task_id": "<task_id>"
  }
}
```

Offered by the komrad MCP server to orchestrator agents.

## Request

### PlanRebaseRequest

PlanRebaseRequest asks what a rebase of a task's branch would do, without doing it.

| Field | Type | Description |
| --- | --- | --- |
| [one of](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseRequest-task)\* |  | The task whose branch to plan a rebase of. |
| [`task_id`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseRequest-task_id) | uuid | The task, by id. |
| [`task_slug`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseRequest-task_slug) | string not empty | The task, by slug. |
| [`onto_base`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseRequest-onto_base) | bool | Plan a re-target of a child onto the workflow's base branch, rebasing only its own commits, in place of a rebase onto its parent. |

## Response

### PlanRebaseResponse

| Field | Type | Description |
| --- | --- | --- |
| [`base_ref`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseResponse-base_ref) | string | The ref the branch would move onto. |
| [`base_sha`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseResponse-base_sha) | string | The commit [`base_ref`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseResponse-base_ref) named when komrad read it. |
| [`commits`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseResponse-commits) | int32 | How many commits the branch has that the base branch does not. |
| [`branch`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseResponse-branch) | string | The branch that would move. |
| [`landed_commits`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseResponse-landed_commits) | int32 | How many of the branch's commits have landed. The rebase would drop them. |
| [`replay_commits`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseResponse-replay_commits) | int32 | How many of the branch's commits the rebase would replay. |
| [`merges`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseResponse-merges) | int32 | How many merge commits the rebase would flatten. |
| [`conflict_paths`](https://komrad.dev/latest/api/agent/plan-rebase.md#komrad-agent-v1-PlanRebaseResponse-conflict_paths) | string\[\] | The paths a merge of the base branch would conflict on. A rebase can conflict where a merge does not, so this is a warning only. |
