如何为 AI 驱动的代码现代化项目做好准备

How to organize AI-driven modernization projects for critical systems and regulated enterprises. 如何为关键系统和受监管企业组织 AI 驱动的现代化项目。

  • Category分类
    分类企业 AIClaude Code
  • Product产品
    产品Claude Code
  • Date日期
    September 23, 20262026年9月23日
    日期2026年9月23日
  • Reading time阅读时间
    13
    min分钟
    阅读时间13分钟
  • Share分享
    Copy link
    https://claude.com/blog/how-to-prepare-for-ai-driven-code-modernization-projects
    分享复制链接https://claude.com/blog/how-to-prepare-for-ai-driven-code-modernization-projects
  • Author(s)作者
    Jonah Ezekiel
    Lexie Tonelli
    作者 Jonah EzekielLexie Tonelli

In our Notes from the Field series, Anthropic forward deployed engineers share best practices inspired by real customer deployments. In this article, we share our experience managing large code modernization projects.在我们的“实地笔记”(Notes from the Field)系列文章中,Anthropic 的前线部署工程师们分享了从真实客户部署中总结的最佳实践。本文将分享我们在管理大型代码现代化项目方面的经验。

Code modernizations once scoped as multi-year, all-hands efforts can now finish in months (or weeks), but the organizational work on either side often remains the same. 过去需要多年、全员参与的代码现代化项目,现在可以在几个月(甚至几周)内完成,但项目前后的组织工作往往保持不变。

For example, every change to a critical banking system must go through change management, review, and approval. It is a robust process because regulators, auditors, and the business require it. 例如,对关键银行系统的每一次变更都必须经过变更管理、审查和批准。这是一个稳健的流程,因为监管机构、审计人员和业务部门都有此要求。

Those processes are what make critical systems trustworthy, and they were built on the assumption that a human wrote each change and a human would review each diff. Once agents accelerate writing the changes, the bottleneck shifts from producing changes to mobilizing the organization around them.正是这些流程使关键系统值得信赖,而它们建立的前提是:每一项变更都由人工编写,每一处差异(diff)都由人工审查。一旦 AI 智能体加速了变更的编写,瓶颈就会从生产变更转移到围绕变更进行组织动员上。

This article covers the work enterprises must do before the modernization takes place: defining what done means, what evidence a change must carry, how certified changes will reach production, and what has to be staged so the run can start. 本文涵盖了企业在现代化实施前必须完成的工作:定义“完成”的标准、变更必须携带的证据、经过认证的变更如何进入生产环境,以及为了启动运行必须准备就绪的事项。

We break this process into six steps:我们将此过程分为六个步骤:

  1. Define the target: the tech stack and behavior the modernized code must have. 定义目标:现代化后的代码必须具备的技术栈和行为。
  2. Create the certificate: the conditions that the changes must meet to be considered correct in the target state. 创建证书:变更在目标状态下被视为正确必须满足的条件。
  3. Set the promotion policy: the path by which certified changes get into production at the rate they’re produced. 设定推广策略:已认证的变更以其产出速度进入生产环境的路径。
  4. Put the prerequisites in place: environment, CI/CD, review capacity, and approvals.准备先决条件:环境、CI/CD、审查能力和审批。
  5. Build and refine the agentic workflow: the custom Claude Code dynamic workflow that distributes the modernization across many smaller parallel subagent workstreams that produce the changes. This is built around the target, certificate, and promotion policy.构建并优化智能体工作流:定制的 Claude Code 动态工作流,将现代化任务分配到许多更小的并行子智能体工作流中以产出变更。这是围绕目标、证书和推广策略构建的。
  6. Run the modernization: prove the workflow end to end on a small partition of the codebase, then scale. 运行现代化:在代码库的一小部分上端到端地验证工作流,然后进行扩展。

Step 1: Define the target第 1 步:定义目标

The target is the end state of the modernization. The desired end state determines which of the three kinds of modernization you are doing, detailed in the table below. 目标是现代化的最终状态。预期的最终状态决定了您正在进行哪种类型的现代化,详见下表。

Determine the modernization type确定现代化类型

Type What it is Choose when The target is
Uplift Same-stack version bump (e.g., C++11 → C++20). The stack is fine but the version has fallen behind: end-of-life runtimes, unpatched security issues, dependencies you can no longer upgrade. A runtime version and package set.
Transform Cross-stack rewrite that keeps behavior fixed (e.g., COBOL → Java). The stack is the problem to resolve and the behavior is trusted. Everything needed for an uplift, plus the language, frameworks, and architectural conventions the new code must follow.
Reimagine Greenfield rebuild on a new architecture with modified behavior. The behavior needs to be changed alongside the code. Everything needed for a transform, plus a written behavioral spec for the new system.

Determining which type of modernization to do is often debated inside an organization. In our experience, the people closest to production want the stack swapped with behavior held constant to contain risk (transform modernization). On the other side are often the engineers who have lived with the codebase and want the modernization to pay down tech debt, plus other business stakeholders who want to take the opportunity to name new requirements (reimagine modernization). 在组织内部,确定采用哪种现代化类型通常会引发争论。根据我们的经验,最接近生产环境的人员希望在保持行为不变的情况下替换技术栈,以控制风险(转换式现代化)。另一方通常是长期维护代码库的工程师,他们希望通过现代化来偿还技术债务,此外还有其他业务利益相关者,他们希望借此机会提出新的需求(重构式现代化)。

Both positions are reasonable, but if the question is left unresolved it resurfaces later as an argument over whether a given change is “correct.” Building consensus on which path to take adds initial friction, but streamlines the project as a whole.这两种立场都有其合理性,但如果问题悬而未决,稍后就会演变成关于特定变更是否“正确”的争论。就采取哪种路径达成共识会增加初始阻力,但能使整个项目更加顺畅。

Map the codebase and create the behavioral spec映射代码库并创建行为规范

Understanding the current system is often a good first step for defining the target. Extracting what the old code actually does and creating an inventory of current behavior makes it easy to decide if parts should be changed or dropped, and so whether the modernization is a transform or a reimagine. This also often reveals unknown business logic and edge cases. 了解当前系统通常是定义目标的第一步。提取旧代码的实际功能并盘点当前行为,可以轻松决定是否应更改或删除某些部分,从而确定现代化是属于转换式还是重构式。这通常还能揭示未知的业务逻辑和边缘情况。

Claude can do much of that discovery by mapping dependencies and documenting workflows that nobody remembers building. The code modernization plugin’s assess, map, and extract-rules commands mine business rules with source citations that engineers can then review. Claude 可以通过映射依赖关系和记录无人记得如何构建的工作流来完成大部分此类发现工作。代码现代化插件的 assess(评估)、map(映射)和 extract-rules(提取规则)命令可以挖掘带有源引用的业务规则,供工程师审查。

However, Claude’s discovery alone may not capture how a legacy system fully behaves. Interviews with business users and developers, and internal documentation, can fill those gaps. Context gathering may take some time upfront, but the quality of that context shapes every decision the workflow makes later.然而,仅靠 Claude 的发现可能无法完全捕获遗留系统的行为。与业务用户和开发人员的访谈以及内部文档可以填补这些空白。收集背景信息可能需要一些前期时间,但这些背景信息的质量决定了工作流后续所做的每一个决定。

For a reimagine, defining the target requires additional work: a detailed behavioral spec should be written down and agreed with user groups.对于重构式现代化,定义目标需要额外的工作:应编写详细的行为规范并与用户组达成一致。

An interactive dependency map example from the code modernization plugin. 来自代码现代化插件的交互式依赖关系图示例。

Establish the project’s justification and goals确立项目的正当性与目标

Alongside defining the target, the organization should consider why the modernization is worth undertaking at all. Modernizing legacy systems can reduce ongoing maintenance and operational costs, however, in our experience, cost reduction has not been the driving goal of most modernization projects.在定义目标的同时,组织应考虑为什么这项现代化工作值得进行。现代化遗留系统可以减少持续的维护和运营成本,但根据我们的经验,成本削减并不是大多数现代化项目的主要驱动目标。

Risk reduction is often the most important modernization benefit. Consider the risk of not doing the modernization when debating whether or not to undergo the project. 降低风险往往是现代化最重要的益处。在讨论是否进行项目时,请考虑不进行现代化的风险。

For example, a system carrying unpatched vulnerabilities can mean a cyber breach or an outage severe enough to put the business itself at risk. An unsupported runtime or a shrinking pool of engineers who understand the system exacerbates the risk. 例如,携带未修补漏洞的系统可能意味着网络入侵或足以危及企业自身的严重中断。不受支持的运行时或了解该系统的工程师群体不断缩减,加剧了这种风险。

Agentic coding tools like Claude Code have shortened modernization timelines, but budgets are still hard to estimate, which leads to inertia. We have released the costs of some of our large-scale modernizations as have others. These can serve as a rough baseline, and we have additional guidance on budget projections at the bottom of this guide. 像 Claude Code 这样的智能体编码工具缩短了现代化时间表,但预算仍然难以估算,这导致了惰性。我们已经发布了一些大型现代化项目的成本,其他人也一样。这些可以作为粗略的基准,我们在本指南底部提供了有关预算预测的额外指导。

The main challenge in initiating these projects is usually building the internal consensus and commitment from the teams that own the system, and the teams that depend on it. Building the business case and setting the goals of the project, often at the leadership level, make this part of the process easier. This also helps anchor the tradeoffs in the certificate and promotion policy that follow. When stakeholders disagree over how much risk a change can carry, the risk of not modernizing is the counterweight. 启动这些项目的主要挑战通常是建立内部共识,并获得系统所属团队以及依赖该系统的团队的承诺。建立商业案例并设定项目目标(通常在领导层层面)可以简化此过程。这也有助于巩固后续证书和推广策略中的权衡。当利益相关者对变更所能承受的风险存在分歧时,不进行现代化的风险就是平衡点。

Step 2: Define the certificate第 2 步:定义证书

The certificate is the set of conditions or tests that every modernization change must meet. Pick the conditions that give the strongest cumulative evidence that the change is correct against the target. 证书是每一项现代化变更都必须满足的条件或测试集。选择那些能提供最强有力累积证据的条件,以证明变更相对于目标是正确的。

Each condition should be checkable without a human in the loop, so the agentic workflow can iterate on a change until it meets the certificate or flag it for human review if it can’t. 每个条件都应在无需人工干预的情况下可检查,以便智能体工作流可以对变更进行迭代,直到满足证书要求,或者在无法满足时将其标记为人工审查。

What goes into the certificate depends on the target, but will usually draw from this list:证书中包含的内容取决于目标,但通常会从以下列表中选取:

  • The original test suite passes原始测试套件通过
  • Claude-authored tests written during the modernization all pass现代化期间编写的所有 Claude 编写的测试均通过
  • Test coverage meets an agreed threshold测试覆盖率达到商定的阈值
  • Performance benchmarks stay within an agreed bound性能基准保持在商定范围内
  • Independent adversarial reviews by Claude, each in a fresh context window, find no blocking issues由 Claude 在全新上下文窗口中进行的独立对抗性审查未发现阻塞性问题
  • For user interfaces, Claude-driven computer use finds no regressions对于用户界面,Claude 驱动的计算机使用未发现回归
  • Current and target versions produce the same output from the same input, which can be live, recorded, or Claude-generated当前版本和目标版本在相同输入下产生相同输出,输入可以是实时的、录制的或 Claude 生成的
  • Persisted state and wire formats round-trip between current and target versions持久化状态和线路格式在当前版本和目标版本之间往返一致
  • Changes run in staging for an agreed period with no regressions in error rates, latency, or alerts变更在暂存环境中运行一段商定时间,且错误率、延迟或警报没有回归
  • Static analysis and security scans show no new findings静态分析和安全扫描未显示新发现
  • For compiled targets, the build is clean and type checks pass对于编译目标,构建是干净的且类型检查通过
Write the certificate with the people who will review and promote changes into production. Bring in the developers, user groups, and business leads who depend on the codebase now, while the certificate and agentic workflow are still being designed. 与将审查并推广变更到生产环境的人员一起编写证书。在设计证书和智能体工作流时,尽早引入目前依赖该代码库的开发人员、用户组和业务主管。

Their expertise shapes what the certificate measures, and their early involvement is what earns their buy-in when changes reach review. A good check on the finished certificate is whether they would be comfortable merging on the certificate's evidence alone. If they see their own bar in it, the promotion policy in Step 3 can be lighter. 他们的专业知识决定了证书的衡量标准,他们的早期参与是变更到达审查阶段时获得支持的关键。对已完成证书的一个很好的检验标准是:他们是否愿意仅凭证书的证据进行合并。如果他们看到了自己设定的标准,第 3 步中的推广策略可以更轻松。

What the certificate checks against, and how, depends on the modernization type. 证书对照检查的内容和方式取决于现代化类型。

  • For an uplift modernization, parity is against the original codebase, and the original test suite can be the core of the certificate. 对于升级式现代化,一致性对照的是原始代码库,原始测试套件可以作为证书的核心。
  • For a transform modernization, parity is also against the original codebase, but the original test suite rarely runs on the new stack. Replay of production traffic, differential testing between old and new, and a prod-parallel deployment do most of the work instead. 对于转换式现代化,一致性也对照原始代码库,但原始测试套件很少在新技术栈上运行。生产流量重放、旧版本与新版本之间的差异测试以及生产并行部署反而承担了大部分工作。
  • For a reimagine modernization, the certificate is anchored in the behavioral spec. This is the hardest case. A spec is less objective than an existing system to diff against, so a larger degree of model judgement is involved, which can lead to more variable outcomes. Here, the certificate leans on tests written from the spec, independent adversarial reviews by Claude that check each change against the sec, and differential checks where the new system keeps the old one’s behavior. Expect to revise the certificate as the spec is clarified: gaps in the spec show up here first.对于重构式现代化,证书锚定在行为规范中。这是最困难的情况。规范不如现有系统那样客观,无法直接进行差异对比,因此涉及更高程度的模型判断,这可能导致结果更加多变。在这里,证书依赖于根据规范编写的测试、Claude 进行的检查每个变更是否符合规范的独立对抗性审查,以及新系统保持旧系统行为的差异检查。预期随着规范的澄清而修订证书:规范中的空白会首先在这里显现。

Older systems often have thin test coverage, flaky tests, and little telemetry. Part of defining the certificate is identifying these gaps. If it will be difficult to support a strong certificate, one of the most useful things to do at this step is to use Claude to build the missing evidence, whether that’s standing up a prod-parallel setup, building a replay harness, or writing more tests. 旧系统通常测试覆盖率低、测试不稳定且遥测数据很少。定义证书的一部分就是识别这些差距。如果难以支持强有力的证书,此步骤中最有用的做法之一是使用 Claude 来构建缺失的证据,无论是建立生产并行设置、构建重放工具还是编写更多测试。

Step 3: Set the promotion policy第 3 步:设定推广策略

Agents will produce changes far faster than any human team can review them diff-by-diff. The promotion policy is a tiered review path–written down and agreed in advance–that sets the depth of human review for a change, so the modernization can finish on an acceptable timeline. 智能体产出变更的速度将远超任何人工团队逐个差异(diff-by-diff)审查的速度。推广策略是一种分层审查路径——事先书面记录并达成一致——它设定了人工审查变更的深度,以便现代化能在可接受的时间表内完成。

Like the certificate, work this step with the reviewers, and fit it into your organization's existing change-management process wherever you can. The details will differ by organization and the risk tradeoffs it faces, but a few rules hold everywhere:像证书一样,与审查人员共同制定此步骤,并尽可能将其纳入组织现有的变更管理流程中。细节会因组织及其面临的风险权衡而异,但有几条规则在任何地方都适用:

  • Tier changes by blast radius and agent confidence. Use your organization's own change or risk classification if it has one. Keep full human review for critical paths.按影响范围和智能体置信度对变更进行分级。如果组织有自己的变更或风险分类,请使用它。对关键路径保留全面的人工审查。
  • Fix recurring flags at the source. Group and analyze the flagged changes over time. When the same kind of flag keeps recurring, fix the cause in the agentic workflow or the certificate rather than reviewing each one.从源头修复重复出现的标记。对一段时间内标记的变更进行分组和分析。当同类标记不断出现时,修复智能体工作流或证书中的原因,而不是审查每一个标记。
  • Design the output format with the reviewers. Agree on what information and format make review the fastest, and what signals give more confidence than others. Have them review early sample outputs in Step 5.与审查人员共同设计输出格式。就哪些信息和格式能使审查最快、哪些信号比其他信号提供更多置信度达成一致。让他们在第 5 步中审查早期的样本输出。
  • Allocate SME time effectively. SMEs won't read every final diff, but their judgment is still the scarce input. Make it easy for them to go straight to the changes in the highest-risk tiers, and to the flagged agent decisions within each one, without wading through large diffs. A small number of expert hours then covers the changes that carry the most risk.有效分配 SME(主题专家)的时间。SME 不会阅读每一个最终差异,但他们的判断仍然是稀缺的投入。让他们能够轻松直接地查看最高风险层级的变更,以及其中被标记的智能体决策,而无需翻阅大量的差异。少量的专家工时即可覆盖风险最高的变更。

Many of these rules front-load SME hours by engaging them early in the project. Their feedback tunes the certificate and the agentic workflow before the full modernization begins.这些规则中有许多通过让 SME 尽早参与项目,将他们的工时前置。他们的反馈会在全面现代化开始前调整证书和智能体工作流。

Their sign-off on the samples also becomes further justification for a lighter review path where there is high confidence. This is the reverse of the traditional, non-agentic pattern, where review happens at the end.他们对样本的签字确认也成为在置信度高的情况下采用更轻量审查路径的进一步理由。这与传统的非智能体模式相反,传统模式中审查发生在最后。

The path of a change from generation to production.变更从生成到生产的路径。

The promotion policy should also reflect where the modernization sits on the spectrum between speed and review depth. A modernization racing to a hard deadline, such as a runtime losing support, needs a faster policy with lighter human review and an explicit agreement to accept more risk per change. 推广策略还应反映现代化在速度与审查深度之间的位置。争分夺秒完成的现代化(例如运行时失去支持)需要更快的策略、更轻量的人工审查,并明确同意接受每个变更更多的风险。

A modernization on a longer timeline can afford deeper human review and a slower cutover. Stakeholders will land on different points of this spectrum depending on their risk appetite and constraints so it is worth locking in before the work starts.时间表较长的现代化可以负担更深入的人工审查和更缓慢的切换。利益相关者会根据其风险偏好和约束条件落在该谱系的不同点上,因此在工作开始前锁定这一点是值得的。

In a regulated environment, taking a lighter human review path for any change can cause real discomfort. Individual approvers hesitate to sign off because they carry the risk of a bad change, while leadership carries the larger risk of an aging system. 在受监管的环境中,对任何变更采取更轻量的人工审查路径都可能引起真正的不适。个人审批者犹豫是否签字,因为他们承担着错误变更的风险,而领导层则承担着老化系统的更大风险。

In our experience, it is best to have the directive for the promotion policy come from the top of the organization. It is also better to agree on it beforehand so responsibility for a bug that reaches production is shared, not pinned on whoever approved the change.根据我们的经验,最好让推广策略的指令来自组织高层。最好事先达成一致,以便对进入生产环境的错误承担责任时是共享的,而不是归咎于批准变更的人。

All of this still depends on a certificate detailed enough to serve as real evidence, and on reviewers who understand how Claude arrived at a change well enough to trust it. 这一切仍然取决于足够详细以作为真实证据的证书,以及足够了解 Claude 如何得出变更并足以信任它的审查人员。

Step 4: Put the prerequisites in place第 4 步:准备先决条件

Much of this step runs through teams outside the modernization: platform or infrastructure for the host, QA or release engineering for test capacity, security and compliance for approvals. Each of those teams often has its own backlog or approval process, so open the conversations early, as soon as you have identified the requirements, often while Steps 1 through 3 are still underway.此步骤的大部分工作由现代化团队之外的团队完成:平台或基础设施团队负责主机,QA 或发布工程团队负责测试能力,安全和合规团队负责审批。这些团队通常都有自己的积压工作或审批流程,因此一旦确定了需求,请尽早开启对话,通常在第 1 至第 3 步进行时就开始。

Environment环境

  • A dedicated remote host for running the workflow with the codebase and other relevant sources reachable by Claude一个专用的远程主机,用于运行工作流,且 Claude 可以访问代码库和其他相关资源
  • Test capacity as required by the certificate证书要求的测试能力
  • Anything that strengthens the certificate: production telemetry, a prod-parallel setup, or production data for replay任何能加强证书的事项:生产遥测、生产并行设置或用于重放的生产数据

Codebase and CI/CD代码库和 CI/CD

  • A dependency map of the codebase, grounded in build and compile logs; import analysis; or runtime traces. Note: The plugin’s map command is a good starting point, but depending on the size and age of the codebase, more extensive upfront work may need to be done基于构建和编译日志、导入分析或运行时跟踪的代码库依赖关系图。注:插件的 map 命令是一个很好的起点,但根据代码库的大小和年限,可能需要进行更广泛的前期工作
  • Planned treatment of any dependencies or packages, as part of the target definition作为目标定义的一部分,对任何依赖项或包的计划处理
  • A compatibility check ready to add to CI/CD, if needed如有必要,准备添加到 CI/CD 的兼容性检查
  • An agreed code-freeze policy, if you are modernizing in place如果您在原地进行现代化,则需商定代码冻结策略
  • A communication plan for active developers covering any code freezes and new compatibility requirements针对活跃开发人员的沟通计划,涵盖任何代码冻结和新的兼容性要求

Teams and review团队与审查

  • Agreement from other teams that depend on the codebase on how they take part, like signing off on the certificate or reviewing under the promotion policy, with reviewer time set aside依赖代码库的其他团队同意如何参与,例如签署证书或在推广策略下进行审查,并预留审查人员时间

Security and compliance安全与合规

  • A model access path for Claude Code approved for source code已批准用于源代码的 Claude Code 模型访问路径
  • Least-privilege access for the agentic workflow: write only to modernization branches and no production credentials智能体工作流的最小权限访问:仅写入现代化分支,且无生产凭据
  • Secrets and PII scrubbed or masked from the modernization branch从现代化分支中清除或屏蔽机密和 PII
  • Every change traceable and PR linked to an agent transcript and certificate evidence每一项变更均可追溯,且 PR 链接到智能体记录和证书证据
  • License and vulnerability checks on new dependencies新依赖项的许可证和漏洞检查

Step 5: Build and refine the agentic workflow第 5 步:构建并优化智能体工作流

Use Claude Code to develop a customized dynamic workflow for modernizing the codebase. 使用 Claude Code 开发一个用于现代化代码库的定制化动态工作流。

We recommend starting with the code modernization plugin, and putting everything the workflow may need on the file system or over MCP, where Claude can reach it. This includes the target, certificate, promotion policy, codebase, documentation, and whatever data sources or tooling the certificate requires. You can give this article to Claude as context too. This forms the central knowledge base for the project.我们建议从代码现代化插件开始,并将工作流可能需要的一切放在文件系统上或通过 MCP 提供,以便 Claude 可以访问。这包括目标、证书、推广策略、代码库、文档以及证书所需的任何数据源或工具。您也可以将本文作为上下文提供给 Claude。这构成了项目的核心知识库。

With that in place, building the modernization workflow is the easy part. Have SMEs review Claude’s work as needed, including any codebase-specific skills or extracted rules before anything downstream relies on it. 准备好这些后,构建现代化工作流就是简单部分了。让 SME 根据需要审查 Claude 的工作,包括任何特定于代码库的技能或提取的规则,然后再让下游任何环节依赖它。

Refine what you've built by applying it to small parts of the codebase, with SMEs reviewing the changes it produces, the agents’ process, and the evidence the certificate was met. 通过将其应用于代码库的一小部分来优化您构建的内容,并由 SME 审查其产出的变更、智能体的流程以及证书满足的证据。

You should modify the workflow, not each change, when issues surface. The goal is confidence that, once scaled, changes will meet the certificate almost everywhere and reviewers will be comfortable merging under the promotion policy. 当问题出现时,您应该修改工作流,而不是修改每一个变更。目标是确保一旦扩展,变更几乎在所有地方都能满足证书要求,并且审查人员能够放心地在推广策略下进行合并。

Step 6: Run the modernization第 6 步:运行现代化

First, complete the modernization end to end on a small part of the codebase, including reviewing and landing the changes through the promotion policy. Fix anything that doesn’t work while it’s still cheap, repeat the process until you are confident, then scale to the full codebase. 首先,在代码库的一小部分上端到端地完成现代化,包括通过推广策略审查和落地变更。在成本尚低时修复任何无效的部分,重复此过程直到您充满信心,然后扩展到整个代码库。

While transform and reimagine modernizations involve building the target alongside the existing system and cutting over once complete, an uplift has a second option: modernizing in place on the live codebase while development continues. 虽然转换式和重构式现代化涉及在现有系统旁边构建目标并在完成后进行切换,但升级式现代化有第二个选择:在实时代码库上原地现代化,同时开发工作继续进行。

This is the usual choice when the system cannot be down, or when the codebase changes so quickly that it’s difficult to keep a separate modernized copy up to date. What we have seen work in this case is splitting the codebase into logical partitions from the leaves inward; freezing and modernizing one partition at a time; and gating CI/CD so new commits cannot undo a partition once it has been modernized. 当系统不能停机,或者代码库变化太快以至于难以保持一个单独的现代化副本更新时,这通常是首选。在这种情况下,我们看到有效的方法是:从叶子节点向内将代码库划分为逻辑分区;一次冻结并现代化一个分区;并设置 CI/CD 门禁,以便新提交无法撤销已现代化分区的成果。

A note on cost关于成本的说明

We often get asked what a modernization like this will cost in tokens. Each modernization effort is different, but the main cost drivers include:我们经常被问到这样的现代化需要花费多少 Token。每个现代化工作都不同,但主要的成本驱动因素包括:

  • How much of the codebase has to be read versus changed;需要读取多少代码库与需要更改多少代码库;
  • How involved the certificate is (verification, not writing the change, is usually the larger share in a regulated environment);证书的复杂程度(在受监管的环境中,验证通常比编写变更占更大的份额);
  • How much new test writing and test repair the certificate demands; and 证书需要多少新的测试编写和测试修复;以及
  • How much reconciliation work comes from other teams merging around you while the run is in progress.在运行过程中,其他团队在您周围合并代码带来了多少协调工作。
When completing the modernization on a small part of the codebase, measure token-usage and use that to extrapolate for the rest of the run. Treat anything the pilot couldn’t see, such as reconciliation on a live codebase, as an unknown. This way you can get an estimate for the cost floor for the full modernization. 在代码库的一小部分上完成现代化时,测量 Token 使用量并以此推断其余部分的运行情况。将试点阶段无法看到的内容(例如实时代码库上的协调)视为未知数。通过这种方式,您可以获得整个现代化成本底线的估算。

Measurements from the pilot also show where to optimize your agentic workflow for cost. Find the parts of the workflow that consumed the most tokens and consider how to make them more efficient. Move compute-heavy verification signals behind cheaper gates so they only run once easier checks have passed. 试点阶段的测量结果还显示了在何处优化智能体工作流以降低成本。找出工作流中消耗 Token 最多的部分,并考虑如何使其更高效。将计算密集型验证信号放在更便宜的门禁之后,以便它们仅在较简单的检查通过后才运行。

Consider using models like Sonnet that balance cost and capability for the mechanical, high-volume work the certificate fully checks. Keep more intelligent models for hard transformations and the adversarial reviews that verify correctness. 考虑使用像 Sonnet 这样在成本和能力之间取得平衡的模型来处理证书完全检查的机械化、大批量工作。将更智能的模型保留用于困难的转换和验证正确性的对抗性审查。

You can also escalate to a more expensive model when a less expensive one fails to meet the certificate, but analyze retry rates carefully while piloting, since several cheap attempts can cost more than one expensive one. If you give Claude access to both the workflow and the pilot data, it can do much of this analysis with you. 当成本较低的模型无法满足证书要求时,您也可以升级到更昂贵的模型,但在试点时请仔细分析重试率,因为几次廉价的尝试可能比一次昂贵的尝试成本更高。如果您让 Claude 同时访问工作流和试点数据,它可以与您一起完成大部分此类分析。

Beyond the modernization现代化之后

The modernized codebase is one output. The others are the workflow that produced it, a written certificate for what counts as correct, a promotion policy your change-management process has already accepted, and an evidence trail for every change that landed. Codify the playbook as a reusable asset, so the pattern is already in place for the next upgrade or rewrite.现代化的代码库只是一个输出。其他输出包括:产生它的工作流、关于什么算作正确的书面证书、您的变更管理流程已经接受的推广策略,以及每一项已落地变更的证据追踪。将此手册编纂为可重用的资产,以便为下一次升级或重写准备好模式。

Our forward deployed engineers work through these steps with customers on their most critical systems. If you're preparing a modernization, talk to our team.我们的前线部署工程师会与客户一起完成这些步骤,处理他们最关键的系统。如果您正在准备现代化,请联系我们的团队。

Additional resources其他资源

No items found.
Prev
0/5
Next
eBook

No items found.

Transform how your organization operates with Claude使用 Claude 转变您的组织运营方式

See pricing
Contact sales

Get the developer newsletter订阅开发者通讯

Product updates, how-tos, community spotlights, and more. Delivered monthly to your inbox.产品更新、操作指南、社区焦点等。每月发送到您的收件箱。

Subscribe

Please provide your email address if you'd like to receive our monthly developer newsletter. You can unsubscribe at any time.如果您想接收我们的每月开发者通讯,请提供您的电子邮件地址。您可以随时取消订阅。

Thank you! You’re subscribed.
Sorry, there was a problem with your submission, please try again later.
Claude Code
Coding