Anthropic's prompting guide for Claude Fable 5.2 contains a test result worth reading closely. On small coding tasks, when the prompt says nothing about who owns the code, or frames the codebase as someone else's project, the model tends to keep extending the existing structure. It does this even when the new logic is nearly identical to code sitting a few files away. Default duplicate-code consolidation: under 10%.
One sentence flips that. Tell the model it owns and maintains the codebase for the long haul and, on the same set of tasks, duplicate code gets pulled into shared functions about 75% of the time, with related small issues fixed along the way.
The interesting part is not the prompt itself. It is what the role does to the model's priorities, and what it costs.
The One Line, and the Three Signals Inside It
The line Anthropic shares in the guide is short.
You are the owner and long-term maintainer of this codebase, and its design is up to you.
Ownership, timeline, authority
Three signals arrive at once.
Ownership gets handed over, so the project becomes the model's own rather than a one-off job for somebody else. The timeline stretches, which means changes have to be made as if the model will keep working in this code for a long time instead of finishing this conversation and walking away. Authority to refactor comes with it, so awkward legacy code no longer has to be handled on tiptoe. The model gets to decide how the structure should be straightened out.
Why the default behavior looks like copy-paste
Day-to-day instructions are usually blunt. Fix this error. Add a field to this endpoint. With nothing said about ownership, the model falls back on a habit picked up from training data. Do not mess with other people's legacy code, and make the smallest change that gets the job done. The conversation ends, the task is delivered, and even if identical logic sits right next door, refactoring is not worth the risk. Pasting a block is the least likely route to breaking something.
Under the maintainer role, the same block of code becomes something the model has to face again at the next feature request. So before touching anything, it checks a wider set of questions. Does this new logic overlap with something already written. If the shortcut is taken now, do later changes get harder. Do neighboring files carry the same defect. Are folder structure and naming conventions drifting.
That reordering of priorities is the whole mechanism. Someone else's code only has to run. Code the model will be stuck carrying later has to be maintainable.
What the Model Starts Doing Without Being Asked
Based on hands-on use and checked against Anthropic's test notes, the work the model most often takes on by itself:
- Finding similar validation logic, data transformations or business branches across files, merging them into shared functions or utilities, and updating every call site.
- Removing unreachable branches, unused old variables and stale comments that no longer match the logic.
- Aligning inconsistent variable names, folder hierarchies and API parameters.
- Fixing small related issues while working on the current task. In the Claude Fable 5.2 tests, a large share of the extra changes were new unit tests and documentation, which heads off a good number of knock-on problems in later changes.
The Bill Arrives as Output Tokens
Diligence is not free. With the ownership framing in place, output token usage rises by 70% to 80%.
Where the extra output goes
A long-term maintainer opens more files before writing a line, and has to work out how modules depend on each other instead of glancing at one spot and starting. A local patch is a few lines. A structural refactor touches many files, so analysis and proposed changes both get longer. Add the unit tests, comments, docs and related fixes the model volunteers, and each conversation produces far more output.
When the trade pays off
This prompt does not belong in a default configuration. It earns its tokens when a core module is scheduled for cleanup, when the architecture needs rework, or when technical debt has been ignored long enough. For renaming a few variables, adjusting a line or two of config, or fixing a clearly defined small bug, leaving it on burns quota for nothing. Teams watching an API bill, or running high-frequency automation scripts, need to be even more selective.
Cost visibility matters here. For teams running Claude Code, Codex or opencode across multiple projects, an AI development management tool such as ServBay puts those CLI tools behind one gateway and reports usage and cost per project, which makes a 70% to 80% output increase easy to read against a budget instead of showing up as a surprise on an invoice.
Overreach Is the Bigger Problem
The extra spend is manageable. Changes that escape their scope are not.
A method change that touches a dozen files
Ask for one method to be changed and the model may tidy a dozen files around it. The code review view fills with additions and deletions, and checking them by hand is slow work. Anthropic's tests note that in some cases Claude Fable 5.2 changed the existing behavior of working features. In pursuit of a cleaner structure or a preferred design, it refactored away code written specifically to handle edge cases, which in production can turn into an incident.
There is a quieter version of the same issue. The change summary written at the end often omits the small things modified along the way. Read only the summary and skip the actual diff, and those risks go straight into the main branch.
Why one restriction does not hold
The obvious fix is to put a guard in front of the ownership prompt and forbid touching anything else. Anthropic tested it. With a constraint like no drive-by refactors, renames or cleanups prepended while keeping the ownership framing, the model still consolidated duplicate code in more than half of the tests. A single sentence is not enough to hold back the refactoring drive.
The official guidance is pragmatic. If the code belongs to an open-source project someone else maintains, if the work lands in a shared repository, or if this particular commit needs to stay small, delete the ownership prompt and leave it out.
A Five-Layer Prompt That Keeps Refactors Inside the Lines
For cases where the code is genuinely yours to manage and the structure does need cleaning, a one-line role is not enough. The request gets written in five layers.
Role. The model takes the perspective of the codebase's owner and long-term maintainer.
Goal. Name exactly which duplicate logic is being addressed this round.
Boundaries. Which files may be changed, and which public APIs and business behavior are off limits.
Process. Analysis and a plan first, code edits only after confirmation.
Verification. Tests must pass, and every change must be listed against the real diff.
You are the owner and long-term maintainer of this codebase. Please resolve the duplicate validation logic in the user sign-up flow.
Before modifying any code, first analyze where the duplicate code appears and propose a refactoring plan.
Only modify files directly related to sign-up validation this time, and keep existing public APIs and business behavior unchanged.
For any change that might alter existing functionality, explain the impact first and wait for confirmation. Do not make the adjustment on your own.
When finished, run the relevant unit tests and summarize all changes and potential risks against the actual code diff.
Layered this way, the model still hunts for redundant code, but file edits sit behind plan approval, a file whitelist and test verification. The refactoring appetite is used instead of suppressed, and scope stays bounded.
Four hard rules to add on top of the prompt during review:
- Stop before editing any file, list the analysis and the plan, wait for approval.
- Lock down the files that may be changed, and require anything outside the request scope to be flagged.
- State up front that existing public APIs and business behavior are off limits, and that any change which might affect existing functionality needs sign-off first.
- Change one small piece at a time, review the diff and run the tests before continuing. Never let a whole module be rewritten in one pass.
Choosing Per Task, Not Per Project
A prompt of roughly a dozen English words moves Claude Fable 5.2's consolidation rate from under 10% to about 75%. It also brings a 70% to 80% rise in output tokens and the risk of changes spreading beyond the request.
Treat it as a switch, not a default. For a long-lived project of your own, or a legacy module whose technical debt has become impossible to ignore, set up a dedicated refactoring task with the ownership framing, the boundaries, the tests and a line-by-line diff review. For everyday small fixes, urgent production hotfixes and pull requests to someone else's repository, leave it out. Cheaper, and fewer surprises.
The model is not incapable of writing clean code. Most instructions only ever ask it to ship the feature, and never say this code will be its responsibility later. Write long-term maintenance into the prompt, and the incentive to add one more layer to the spaghetti disappears on its own.



Top comments (0)