<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Graph on 老张开工了</title>
    <link>/graph/</link>
    <description>Recent content in Graph on 老张开工了</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Sat, 25 Jul 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="/graph/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>
    <item>
      <title>Graph 工作流：多节点编排</title>
      <link>/posts/2026/06/agent-graph/</link>
      <pubDate>Sun, 21 Jun 2026 00:00:00 +0000</pubDate>
      <guid>/posts/2026/06/agent-graph/</guid>
      <description>单一 ReAct 循环是 Agent 的&amp;quot;单核&amp;quot;——但很多真实任务天然就是图（DAG），而不是直线。本章把 Agent 从&amp;quot;循环&amp;quot;扩展到&amp;quot;有向图&amp;quot;，让你能把分支、并行、汇合、回退写到系统里，而不是让模型现编。&#xA;11.1 为什么单 Loop 不够 让 AI 做一个&amp;quot;自检 + 修复一束文件&amp;quot;的任务，在单 loop 里跑大概是这样：&#xA;thinking: 看 5 个文件 (生成 list) ↓ tool: read 文件 1 ↓ thinking: 文件 1 没问题 ↓ tool: read 文件 2 ↓ thinking: 文件 2 有 lint 错 ↓ tool: edit 文件 2 ↓ ...重复 5 轮，每次都让&amp;#34;thinking&amp;#34;来做路由决策 问题：你反复让模型决定&amp;quot;下一步该看哪一支&amp;quot;，但其实流程是确定的：每个文件都看一遍、有问题就修。这把&amp;quot;决策权&amp;quot;浪费在了不必要的地方，还让模型容易漏一两个文件。&#xA;这是 Graph 工作流要解决的事：把&amp;quot;必然要做的形状&amp;quot;画成 DAG，模型只做每个节点的&amp;quot;实质推理&amp;quot;，流程通过图去接管。&#xA;11.2 Graph Agent 的三件套 ┌─────────────────────────────────────────────────────┐ │ Node : 一个 f(input) -&amp;gt; output 的小 Agent │ │ Edge : 节点之间的连接，可以是固定的 │ │ 也可以是 condition 提供的分支选择 ──┘ │ │ State : 在所有节点之间流动的共享字典 │ └─────────────────────────────────────────────────────┘ 11.</description>
    </item>
  </channel>
</rss>
