<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>重构 on 老张开工了</title>
    <link>/%E9%87%8D%E6%9E%84/</link>
    <description>Recent content in 重构 on 老张开工了</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Sat, 25 Jul 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="/%E9%87%8D%E6%9E%84/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>实战四：用 Graph 重构大型项目</title>
      <link>/posts/2026/07/practice-graph-refactor/</link>
      <pubDate>Sat, 25 Jul 2026 00:00:00 +0000</pubDate>
      <guid>/posts/2026/07/practice-graph-refactor/</guid>
      <description>第四个实战最 hairy：用 Graph 工作流引导 Agent 重构一个多模块（≥30 文件、≥5000 行）的中型项目。这种任务单 ReAct loop 撑不下来——决定要做什么、做哪部分、什么时候跳、什么时候熔断，全靠 Graph。&#xA;28.1 任务定义 一个老 Python 项目：&#xA;30+ 文件，5000+ LOC 没有类型注解，没有 unit test 覆盖（5%） pyproject.toml 里没 ruff 三个 orchestrator 文件 (main, cli.py, web_server.py) 错综耦合 重构目标（一季）：&#xA;引入类型注解 + basedpyright 严格 单测覆盖率 70%+ 三 orchestrator 拆出公共 lib 28.2 为什么单 Agent Loop 不行 一次 Claude Code session 用 ReAct loop 跑：&#xA;Step 1: 想想 - &amp;#34;拆 main 和 cli&amp;#34; 大致步骤 Step 2-30: 边读边改文件 30 个 → context soon 80k+ → 压缩 Step 31-50: 压缩了早期 notes, 起初约束忘 Step 51: refactor 30 文件已混乱,report &amp;#34;DONE but lots of TODO&amp;#34; Step 80-200: 又迭代一次,实际上模型忘了第 3 步的架构 budget 到,模型默认 &amp;#34;DONE&amp;#34;, 实际未完成 80% Graph + Looper 优势：把项目拆成 30 个 node, 每个 node 限 scope, progressive cap, 不烧枚举上下文。</description>
    </item>
  </channel>
</rss>
