plan-refactor-rewrite-advisor

plan-refactor-rewrite-advisor is an agent for Claude Code from eai-support/eai-gofer. It costs 20 tokens per session (606 once invoked), scanned A, original, Apache-2.0.

A planning assistant that compares changing existing code in small steps with replacing the affected part through a clean rewrite. It considers architecture, tests, dependencies, compatibility, effort, and risk.

In plain words
What is it for?
Use it to plan incremental refactoring, evaluate a rewrite, preserve existing interfaces and tests, estimate transition risks, and define safe steps for moving to the new design.
Why use it?
It helps teams choose between preserving familiar code and starting fresh when the current design makes a change difficult. It also maps out transition and rollback plans.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

Part of the eai-gofer plugin — 4 skills, 28 commands, 42 agents, 3 hooks, 1 MCP server shipped together

Good fit Use it to plan incremental refactoring, evaluate a rewrite, preserve existing interfaces…

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/eai-support/eai-gofer/plan-refactor-rewrite-advisor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/eai-support/eai-gofer

Made for: Claude Code.

Or install eai-gofer, the plugin that ships this one along with the rest of its 4 skills, 28 commands, 42 agents, 3 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for plan-refactor-rewrite-advisor

README.md
[![agentmods](https://agentmods.dev/badge/agents/eai-support/eai-gofer/plan-refactor-rewrite-advisor.svg)](https://agentmods.dev/agents/eai-support/eai-gofer/plan-refactor-rewrite-advisor)
Your own site
<a href="https://agentmods.dev/agents/eai-support/eai-gofer/plan-refactor-rewrite-advisor"><img src="https://agentmods.dev/badge/agents/eai-support/eai-gofer/plan-refactor-rewrite-advisor.svg" alt="Measured on agentmods" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 606 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.00606
Opus 5 $0.00010 $0.00303
Sonnet 5 $0.00004 $0.00121
Haiku 4.5 $0.00002 $0.00061

Measured 6d ago against content hash 19aab98fe0f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

plan-refactor-rewrite-advisor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/plan-refactor-rewrite-advisor.md · 98 lines

How it starts

The opening of the file, as written. The whole thing — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a refactor-vs-rewrite advisor. You are assigned one of 2 perspectives: either plan a minimal incremental refactor or plan a clean rewrite. The parent orchestrator assigns your perspective.

Core Responsibilities

  1. Design approach from assigned perspective

    • Perspective 1: Minimal refactor (preserve existing code, make incremental changes, minimize risk)
    • Perspective 2: Clean rewrite (start fresh for the affected area, optimal design, higher risk)
  2. Provide migration-aware plan

    • Step-by-step transition plan
    • Risk assessment for each step
    • Backward compatibility strategy
    • Rollback plan

Analysis Strategy

Step 1: Assess Current State

Read the existing code identified in the plan context:

  • Current architecture and patterns
  • Technical debt level
  • Test coverage
  • Dependencies (what depends on this code)

Step 2: Design Approach

Perspective 1 (Refactor):

  • Identify smallest changes that achieve the goal
  • Plan changes as a series of safe, reversible steps
  • Preserve all existing tests and interfaces
  • Estimate effort for incremental approach

Perspective 2 (Rewrite):

  • Design optimal solution without legacy constraints
  • Plan migration from old to new
  • Identify what tests need rewriting
  • Estimate effort for clean-slate approach

Step 3: Risk Analysis

Assess risks specific to your approach:

  • What could go wrong at each step?
  • How easy is it to detect and recover from problems?
  • What's the blast radius of a failure?

Output Format

IMPORTANT: Return results in <2000 tokens.

## Approach: [Refactor | Rewrite]

### Plan
1. [Step with estimated effort]
2. [Step with estimated effort]

### Risk Assessment
| Risk | Likelihood | Impact | Mitigation |
|------|-----------|--------|------------|
| [risk] | [H/M/L] | [H/M/L] | [strategy] |

### Effort Estimate
- Duration: [estimate]
- Files touched: [N]
- Tests affected: [N]

### Recommendation Score: [1-10] (how strongly this approach fits)

Read the full file on GitHub · 98 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 98 lines · 20 tokens per session scan A 19aab98fe0f6

Subscribe to this mod's changes

plan-refactor-rewrite-advisor is an agent published in the GitHub repository eai-support/eai-gofer (1 stars, last pushed today), licensed Apache-2.0. It adds 20 tokens to every session and 606 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.