Skip to content

ollama_refactor_plan

Refactor plan. REFACTOR. Phased SEQUENCING plan for a multi-file refactor — complement to multi_file_refactor_propose. Same inputs (files, change_description, optional per_file_max_chars) plus priority: 'safety' | 'speed' | 'parallelism' (default ‘safety’). Server reads the files and asks the Workhorse tier for a phased plan: {phases:[{phase, files_involved, reason, tests_to_write, parallelizable}], sequencing_notes, rollback_strategy, estimated_phases, weak}. Phases are renumbered 1..N in arrival order. files_involved is strictly intersected with the input set. Missing rollback_strategy or empty tests with no sequencing notes → weak=true. Use this when you know WHAT to change (multi_file_refactor_propose covers that) but need HOW to land it safely.

Parameter Type Required Default Description
files any yes Source file paths the refactor touches. Min 1, max 20 — same envelope as multi_file_refactor_propose.
change_description string yes What the refactor accomplishes. 20-2000 chars.
per_file_max_chars integer no Chars to read per file (default 60_000).
priority "safety" \ "speed" \ "parallelism" no

The JSON Schema below is generated from the same zod schema the server validates against at the wire — it cannot drift from runtime behavior.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"files": {
"description": "Source file paths the refactor touches. Min 1, max 20 — same envelope as multi_file_refactor_propose."
},
"change_description": {
"type": "string",
"minLength": 20,
"maxLength": 2000,
"description": "What the refactor accomplishes. 20-2000 chars."
},
"per_file_max_chars": {
"description": "Chars to read per file (default 60_000).",
"type": "integer",
"minimum": 1000,
"maximum": 200000
},
"priority": {
"description": "Planning bias. 'safety' (default) sequences conservative phases with heavy tests-first. 'speed' compresses phases. 'parallelism' prefers splitting work across agents/files when possible.",
"type": "string",
"enum": [
"safety",
"speed",
"parallelism"
]
}
},
"required": [
"files",
"change_description"
]
}

Every tool returns the standard envelope — tier_used, model, tokens_in/tokens_out, elapsed_ms, backend provenance, warnings. See Envelope & tiers.

Schema + handler: src/tools/refactorPlan.ts · registration: src/index.ts


Back to the Tool Reference.