Ownership Prompt Turns Claude Fable 5.2 Into a Proactive Refactorer, at a 70-80% Token Tax
Anthropic's official Claude Fable 5.2 prompt guide includes an interesting test result. On small programming tasks, if the prompt doesn't mention code ownership, or treats the codebase as someone else's project, the model usually forces its way forward on the existing structure, even when the new logic is nearly identical to the old code. In that default state, the probability that the model actively merges duplicate code is under 10%.
But add a single sentence to the AI prompt telling the model that it is the owner and long-term maintainer of this codebase, and everything changes. On the same batch of test tasks, Claude Fable 5.2's rate of proactively merging duplicate code into shared functions jumped to about 75%, and it even fixed small related problems along the way.
I had been wondering how to get AI to merge duplicate code on its own, and only after reading this guide did it click. As long as you assign the codebase to the model itself, even AI doesn't want to face a tangled mountain of spaghetti code.
One Prompt Line That Makes AI Take Over Long-Term Maintenance of the Codebase
Anthropic's guide shares the original English sentence, which is very short, just one line.
You are the owner and long-term maintainer of this codebase, and its design is up to you.
Translated into Chinese, it is the following line.
你是这个代码库的所有者和长期维护者,代码库的设计由你决定。
Short as it is, the sentence packs three key signals into the model. First, it hands over code ownership, making the model treat the project as its own rather than a temporary job from an outsider. Second, it stretches the timeline: the model has to make changes with the expectation of continuing to take over and maintain the code long-term, not just finish the conversation and walk away. Third, it grants the authority to make refactoring calls, so when it encounters awkward old code it no longer has to hold back; it decides how to straighten out the structure.
Why a Different Role Assignment Makes AI Also Disdain Spaghetti Code
When I use AI tools in everyday work, my instructions are blunt: fix this error, or add a new field to this endpoint. Without declared code ownership, the model's safe default, learned from training data, is not to touch other people's old code. The most reliable path is to get through the current request with minimal changes. The conversation is done as soon as the task is handed back; even if identical logic sits right next to it, the model will not bother refactoring and will simply copy-paste the snippet that is least likely to break.
Once you give it the identity of owner and long-term maintainer, the logic inverts completely. Under this role assumption, code is no longer a one-time external assignment. It is an engineering effort the model will have to keep facing every time a feature is added or a defect is fixed. Before touching the code, the model runs an extra layer of accounting across the project.
- Does this new logic collide with something already written, and should it be extracted and merged?
- If I write it the easy way now, will later requirement changes become more painful?
- Do nearby files contain the same identical problem, and should they be cleaned up while I'm here?
- Do the directory layout and naming conventions feel off, and should the overall structure be unified?
With that, the model's reasoning priorities tilt. Long-term metrics like removing redundancy, extracting shared methods, and keeping structure consistent move to the front. Other people's code just needs to run, but once a project is one the model will have to carry itself, even AI is unwilling to add more bricks to a spaghetti pile.
What AI Does on Its Own After Long-Term Maintenance Mode Is Enabled
Combining my own experience of writing code with AI and Anthropic's test records, once this AI code-maintenance prompt is added, these are the kinds of things the model most readily handles on its own.
- Find similar validation logic, data transformations, or business branches across files, merge them into shared functions or utility methods, and replace the call sites.
- Clean up unreachable dead branches, old variables no one references, and stale comments that no longer match the actual logic, which makes the code look much cleaner.
- Align chaotic variable naming, directory levels, and interface parameters with inconsistent styles.
- While handling the current task, fix related small issues along the way. Anthropic's tests on Claude Fable 5.2 also found that a large share of the extra changes the model proactively added were new unit tests and documentation, which helps block many cascading problems during later code changes.
Great as It Is, Output Token Consumption Jumps 70-80%
Making the model more diligent does not come free. With the ownership setting, the model's output token consumption rises by 70% to 80%.
The cost increase is easy to understand. Once it becomes the long-term maintainer, the model has to look through several files before acting and understand dependencies between modules; it can no longer glance at one spot and start writing. A local patch can be done by changing a few lines, but structural refactoring often pulls in multiple files, so the model's analysis process and proposed changes get longer. Add in the unit tests, comments and documentation, and related fixes it volunteers, and the number of characters produced in a single conversation naturally climbs.
So in my own daily development, this prompt is definitely not something to leave on by default. If you set aside time specifically to clean up a core module, sort out architecture, or pay down technical debt, spending more tokens for code quality is worthwhile. But if you just want to change a few variable names, adjust a line or two of config, or fix a clearly bounded small problem, including this prompt is just burning quota. When you are sensitive to the API bill, or running high-frequency automation scripts, you need even tighter control over when it appears.
More Headache Than Token Burn: AI May Get Too Involved
Compared with spending more money, what worries me most in use is changes getting out of control. As soon as you hand ownership and design authority to the model, its reach extends far, and several annoying problems easily follow.
I wanted it to change one method, and it went ahead and tidied a dozen neighboring files instead. Opening the code review screen shows a full page of additions and deletions, making manual verification painful. More frightening, Anthropic's tests explicitly note that Claude Fable 5.2 changed existing feature behavior in some tests. Sometimes, to pursue structural neatness or apply a design style it likes, it refactored away special-case handling that old code intentionally kept. Put that in production and you easily get an incident.
Also, the model's final summary of changes frequently omits the small spots it changed along the way. If I get lazy and only read the textual summary without reviewing the actual code diff line by line, the hazard gets merged straight into the main branch.
My first reaction was the same: just prepend a restriction to the ownership prompt telling it not to make incidental changes anywhere else. Anthropic's tests closed that path off. They tried prepending a restriction like No drive-by refactors, renames or cleanups while keeping the ownership setting, and the model still consolidated duplicate code in more than half of the tests. A single restriction line cannot stop the model's urge to refactor.
Of course, the official advice is also considerate: if you are changing an open-source project maintained by someone else, a collaborative repository, or if you want this commit's changes to be as small as possible, the easiest path is to delete the ownership prompt and not include it at all.
Only when you confirm the code is yours to manage, and you really do want to tidy the structure along the way, should you use hard process constraints to fence it in.
- Make it stop before changing files, list its analysis and modification plan, and only change code after I approve.
- Draw strict boundaries on which files may be changed; if it touches anything outside the requirement scope, it must flag that separately.
- State up front that existing public interfaces and business behavior must not change; any adjustment that could affect existing functionality must be brought to me first.
- Let it modify only one small piece at a time; after each piece, I review the diff and run tests, never allowing it to rewrite an entire module in one go.
How I Use This Claude Code-Refactoring Prompt Now
To get AI to actively clean up duplicate code without letting it rewrite the whole project beyond recognition, I no longer just throw one identity line at it. Instead I write out the requirements in a five-layer structure.
First layer: set the identity, handing it the perspective of codebase owner and long-term maintainer. Second layer: clarify the task objective, telling it exactly which block of duplicate logic to handle this time. Third layer: define boundary conditions, specifying which files can be changed and which interfaces and business behaviors are off limits. Fourth layer: lock down the execution flow, requiring analysis before a plan and waiting for my confirmation before editing code. Fifth layer: add verification requirements; after finishing, it must run tests and list every change against the actual diff.
For example, to clean up duplicate validation logic in a user registration flow, I would give it an instruction roughly like this.
You are the owner and long-term maintainer of this codebase. Resolve the duplicate validation logic in the user registration flow.
Before changing any code, analyze where the duplicated code appears and give a refactoring plan.
Only modify files directly related to registration validation; existing public interfaces and business behavior must remain unchanged.
Any change that could alter existing functionality must explain its impact and wait for confirmation; do not adjust on your own.
After finishing, run the relevant unit tests and summarize all changes and potential risks against the actual diff.
Split up this way, the model is still very active about finding redundant code, but the actual write-to-disk changes are firmly locked behind plan confirmation, directory boundaries, and test verification, which makes it much more comfortable to use.
If You Want AI to Write Cleaner Code, Make It Responsible for Maintenance Cost
Looking back, a single AI prompt of a dozen English words can lift Claude Fable 5.2's probability of consolidating duplicate code from under 10% to about 75%, while also bringing a 70-80% rise in output tokens and the risk of uncontrolled change scope.
For someone like me who deals with AI programming every day, the most practical part of this trick is turning it on and off by scenario. For long-term projects I maintain myself, or when technical debt in some historical module is unbearable, I open a dedicated refactoring task with this prompt attached, pair it with boundary constraints, automated tests, and line-by-line diff review, and let it straighten out the structure. For routine small fixes, emergency production repairs, or pull requests to someone else's repository, I simply remove the line. That saves money and worry.
Most of the time AI does not fail to write clean code. The problem is that when I give instructions, I only push it to get features out and never tell it this code will belong to it later. Once I actually put long-term maintenance responsibility into the prompt, even AI is unwilling to keep adding bricks to the spaghetti pile.
Top 2 from juejin.cn, machine-translated. The original thread is authoritative.
Like
"No drive-by refactors, renames or cleanups" can't stop it; in more than half of the tests, the model still merges. This result is more worth being cautious about than the 75% figure—meaning that once ownership is given, the scope of changes is basically no longer constrained by a single sentence. The 70-80% token increase is actually a minor matter; what's truly expensive is the human time to review diffs. A method change produces diffs across a dozen files; review simply can't keep up. Do you currently attach these five layers of prompts only in dedicated refactoring rounds, or do you also carry them in daily requirement changes, relying solely on the "present a plan first and I approve" gate as the fallback?