BY baoyu.io — Bilingual Study Editionbaoyu.io 最新 50 篇精读
All ↩目录 ↩
#31baoyu.ioSebastian Raschka · 2026-04-05 · magazine.sebastianraschka.com

The Coding Agent Is Not the Model — It's the Harness编程智能体真正的核心:不是模型,是 Harness

Six components that turn a chat model into Claude Code让聊天模型变身 Claude Code 的六个核心组件

01

Concise Summary简洁概述

Frontier base models have converged in raw capability; the gap between a great coding tool and a mediocre one now lives almost entirely in the harness — the software layer that manages context, tools, caching and memory around the model.

Raschka decomposes a coding harness into six components: live repo context, cacheable prompt structure, validated tool calls, context-bloat control, two-tier session memory, and bounded subagent delegation.

顶尖基础模型的原始能力已经趋同,真正拉开 Claude Code 与普通聊天界面差距的,是包裹在模型外的那层软件——负责上下文、工具、缓存和记忆的 Harness。

作者把编程 Harness 拆成六个模块:实时代码仓库上下文、可缓存的提示词结构、受校验的工具调用、上下文瘦身、两层会话记忆,以及受限的子智能体委派。

02

Infographic信息图

6 大组件
6 core components
六大核心组件
2 层记忆
2-tier memory: transcript vs. working memory
完整记录 vs 工作记忆,双层存储
≈0 差距
base model capability gap ≈ 0, harness gap large
基础模型能力差距≈0,Harness 差距才是关键
🗂️

Live Repo Context

实时代码仓库上下文

Before acting, the harness gathers stable facts — git branch, status, AGENTS.md/README, file tree — into a workspace summary, so the model isn't guessing which test command to run or where files live.

动手前先收集稳定事实:git 分支、状态、AGENTS.md/README、文件树,打包成工作区摘要,让模型不必瞎猜测试命令或文件位置。

🧊

Cacheable Prompt Shape

稳定前缀 + 提示词缓存

System instructions, tool specs and the workspace summary form a stable prefix that gets cached via provider prompt-caching APIs; only the fast-changing turn (latest request, recent history, short-term memory) is rebuilt each call.

系统指令、工具说明和工作区摘要构成一个几乎不变的稳定前缀,通过厂商的提示词缓存机制复用;每轮只重建变化快的部分(最新请求、近期记录、短期记忆)。

🛡️

Gated Tool Calls

受校验、受权限约束的工具调用

The model can only pick from a whitelisted toolset with strict argument schemas; the harness validates each call, checks path boundaries, and can require human approval before executing anything risky.

模型只能从白名单工具中选择,参数格式受严格校验;Harness 会检查路径边界,对高危操作要求人工审批后才放行执行。

✂️

Context Slimming

上下文瘦身

Long tool outputs get clipped, repeatedly-read files get deduped, and older transcript gets summarized more aggressively than recent turns — the unglamorous work behind what looks like model 'intelligence'.

长篇工具输出被裁剪,重复读取的文件被去重,越久远的历史压缩得越狠——这项枯燥的活计,才是模型显得“聪明”的幕后功臣。

The argument, step by step
论证推进链条
1
Distinguish LLM, reasoning model, and agent: the model predicts tokens; the harness runs an observe-analyze-choose-act loop around it.
先厘清概念:大语言模型只负责预测词元;智能体/Harness 是围绕它运转的“观察-分析-选择-执行”控制循环。
2
Claim: frontier base models have converged, so the harness — not the model — is now the main differentiator in product experience (Claude Code vs. Codex vs. raw chat).
论点:顶尖基础模型已趋同,产品体验的分水岭如今主要在 Harness,而非模型本身(Claude Code、Codex 与普通聊天界面的差距即是明证)。
3
Component 1-2: the harness builds a live repo-context summary and structures the prompt into a stable, cacheable prefix plus a fast-changing tail, saving cost and latency.
组件一二:Harness 生成实时代码仓库摘要,并把提示词拆成稳定可缓存的前缀与快速变化的尾部,从而省钱省时。
4
Component 3: tool calls are structured, schema-validated, permission-gated, and path-restricted, turning free-text suggestions into safe, executable actions.
组件三:工具调用被结构化、按 schema 校验、按权限把关、按路径限权,把自由文本建议变成可安全执行的动作。
5
Component 4-5: context bloat is fought via clipping/dedup/summarization, while state is split into a full persistent transcript and a small, hand-curated working memory.
组件四五:通过裁剪、去重、摘要对抗上下文膨胀;状态被拆成完整持久记录与精炼的工作记忆两层。
6
Component 6: bounded subagents handle side-quests (e.g., 'where is this defined?') in parallel, but must be tightly constrained (often read-only, limited recursion) to avoid runaway agent sprawl.
组件六:受限子智能体并行处理支线任务(如“这个变量在哪定义”),但必须严格约束(常为只读、限制递归深度)以防失控繁殖。
03

Detailed Summary详细解读

Raschka opens by separating three overloaded terms people conflate when discussing 'LLM coding ability': the LLM itself (next-token predictor), the reasoning model (an LLM post-trained or prompted to spend extra test-time compute on intermediate steps and self-verification), and the agent (a control loop wrapped around either). His car analogy — LLM as engine, reasoning model as a tuned but pricier engine, harness as the vehicle that lets you actually drive it — sets up the article's real thesis: the harness, not engine tuning, is where most of the perceived capability gain now lives.

He argues frontier base models (GPT-5.4, Opus 4.6, GLM-5-base) have essentially converged in raw capability, so the same model dropped into a strong harness would likely perform close to Claude Code or Codex — though harness-specific post-training (OpenAI's separate GPT-5.3 vs. GPT-5.3-Codex) still adds marginal gains. This reframes 'which model is smarter' debates as largely secondary to 'whose harness is better engineered.'

The six components map onto a coherent pipeline rather than isolated features. Repo context (1) and prompt caching (2) are both about giving the model grounded, cheap-to-reuse situational awareness before it acts — separating 'what facts to gather' from 'how to package and cache them.' Tool access (3) is the layer that converts model output into real, gated actions, with schema validation, path restriction, and human-approval gates acting as a security perimeter around an inherently unpredictable text generator.

Context management (4) and session memory (5) are subtly different despite both dealing with 'history': slimming is about what to feed back into the next prompt (clip long outputs, dedup repeated file reads, summarize aggressively with recency bias), while structured memory is about what to persist to disk long-term — a full transcript for lossless recovery plus a small, actively curated working-memory layer for task continuity. Conflating these two would either bloat every prompt or lose recoverability.

Subagent delegation (6) is presented as the natural next step once tools and memory exist, but Raschka is careful to flag its main failure mode: unconstrained subagents duplicate work, race on the same files, or spawn further subagents recursively. The fix — inheriting just enough context while imposing strict boundaries (read-only access, capped recursion depth) — is where he contrasts Claude Code's stricter read-only default against Codex's looser approach of inheriting the parent's sandbox and approval permissions, scoping subagents instead by task, context size, and depth.

Compared to OpenClaw, a general-purpose local agent platform, coding harnesses are narrowly optimized for one job — inspecting and editing a codebase and running local tools — whereas OpenClaw runs many long-lived agents across chats and workspaces, treating coding as just one of many chores. This closing contrast sharpens the article's definition: a coding harness is a special case of agent harness, purpose-built around software engineering's specific information needs.

文章开篇先厘清三个常被混用的术语:大语言模型本身(纯粹的下一词预测器)、推理模型(经过后训练或提示词引导、愿意花更多推理时算力做中间步骤和自我验证的 LLM),以及智能体(围绕两者之一运转的控制循环)。作者用“发动机—爆改发动机—整车系统”的比喻点出全文论点:如今体验上的巨大差异,主要来自整车系统(Harness)而非发动机本身的调校。

他判断顶尖基础模型(GPT-5.4、Opus 4.6、GLM-5 基座版)的原始能力已基本趋同,所以把同一个模型塞进同样强的 Harness,表现大概率会接近 Claude Code 或 Codex——尽管针对 Harness 做专门后训练(如 OpenAI 分别维护 GPT-5.3 与 GPT-5.3-Codex)仍有边际收益。这把“哪个模型更聪明”的争论,降格为“谁的 Harness 工程更好”这个更本质的问题。

六个组件并非孤立功能点,而是一条连贯流水线。仓库上下文(1)与提示词缓存(2)本质都是让模型在行动前获得可靠、廉价复用的现场感知——前者关心“收集哪些事实”,后者关心“如何打包与缓存”。工具接入(3)则是把模型输出转化为受限真实动作的关口,schema 校验、路径限权、人工审批共同构成围住这个本质上不可预测的文本生成器的安全边界。

上下文管理(4)与会话记忆(5)虽然都处理“历史”,但分工微妙不同:前者关心塞回下一次提示词的内容(裁剪长输出、去重重复读取的文件、按“越近越详细”原则压缩),后者关心长期落盘保存什么——一份用于无损恢复的完整记录,加上一个持续被主动提炼的小型工作记忆层。把二者混为一谈,要么让每次提示词都臃肿不堪,要么丧失可恢复性。

子智能体委派(6)被定位为工具和记忆都具备之后的自然延伸,但作者特别提醒其主要失败模式:不受约束的子智能体会重复劳动、争抢同一文件,甚至递归生出“孙子智能体”。解法是让子智能体只继承刚好够用的上下文,同时套上严格边界(只读权限、限制递归深度)——他也借此对比 Claude Code 更严格的默认只读策略,与 Codex 直接继承主智能体沙箱和审批权限、转而用任务范围/上下文大小/深度来限权的做法。

与通用型本地智能体平台 OpenClaw 相比,编程 Harness 的优化目标窄得多——只为检查、修改代码库和跑本地工具服务;而 OpenClaw 在多个聊天/频道/工作区里同时养着一群长期存活的智能体,写代码只是其众多日常任务之一。这个收尾对比进一步锐化了全文定义:编程 Harness 是 Agent Harness 的一个特化子集,专为软件工程的特定信息需求而生。

04

FAQ常见问答

Is the harness more important than the underlying model?Harness 真的比底层模型更重要吗?

Raschka argues the gap between top base models has narrowed enough that the harness is now the main differentiator in day-to-day experience, though harness-specific post-training (e.g. Codex variants) still adds real gains.

作者认为顶尖基础模型间的差距已经收窄,日常体验的主要差异来自 Harness;但针对 Harness 做专门后训练(如 Codex 专用版)仍有实打实的额外提升。

What's the difference between context slimming and session memory?“上下文瘦身”和“会话记忆”有什么区别?

Slimming decides what re-enters the next prompt (clip, dedup, summarize recent-first); memory decides what's saved to disk long-term — a full transcript plus a small curated working-memory layer.

上下文瘦身决定塞回下一次提示词的内容(裁剪、去重、近期优先压缩);会话记忆决定长期落盘保存什么——完整记录加一份精炼的工作记忆。

Why restrict subagents instead of letting them work freely?为什么要限制子智能体,而不是放任它们自由工作?

Unbounded subagents duplicate effort, race on shared files, and can spawn recursive sub-subagents; harnesses cap them with read-only access, scoped context, and limited delegation depth.

不受限的子智能体会重复劳动、抢改同一文件,甚至递归繁殖出子子智能体;Harness 通过只读权限、限定上下文和限制委派深度加以约束。

How does Claude Code's subagent approach differ from Codex's?Claude Code 和 Codex 处理子智能体的方式有何不同?

Claude Code typically forces subagents into read-only mode; Codex instead lets them inherit the parent's sandbox and approval permissions, constraining them via task scope, context size, and depth instead.

Claude Code 通常强制子智能体进入只读模式;Codex 则让子智能体继承主智能体的沙箱和审批权限,转而用任务范围、上下文大小和深度来限权。

How is a coding harness different from a general agent harness like OpenClaw?编程 Harness 和 OpenClaw 这类通用 Agent Harness 有何不同?

A coding harness is narrowly built for inspecting/editing repos and running local dev tools; OpenClaw runs many long-lived general-purpose agents across chats and workspaces, with coding as just one task among many.

编程 Harness 专为检查/修改代码库、运行本地开发工具而生;OpenClaw 则在多个聊天与工作区里长期运行通用智能体群,写代码只是其中一项日常任务。

05

In-depth Analysis · Pros & Cons深入解读 · 优缺点

Sebastian Raschka steps back from model benchmarks to explain why the software wrapped around an LLM — the 'coding harness' — is what actually separates a mediocre assistant from Claude Code or Codex. He decomposes that wrapper into six concrete engineering components, illustrated with his own minimal open-source agent.

Sebastian Raschka 跳出模型跑分之争,指出真正把 Claude Code、Codex 这类产品和普通聊天界面拉开差距的,是包裹在大模型外面的“Coding harness”软件层。他用自己手写的极简开源智能体为例,把这层外壳拆解成六个具体的工程组件。

Strengths亮点 / 优点
  • Clear conceptual taxonomy
    概念分层清晰
    The LLM/reasoning-model/agent/harness distinction cuts through a common source of confusion in agent discourse and gives readers vocabulary to reason precisely about where capability actually comes from.
    大语言模型/推理模型/智能体/Harness 的四层区分,厘清了智能体讨论中常见的混淆,为读者提供了精确讨论能力来源的词汇。
  • Grounded in working code
    有可运行代码支撑
    Every component maps to an actual function in Raschka's open-source Mini Coding Agent, letting readers verify claims against real implementation rather than take diagrams on faith.
    每个组件都对应作者开源 Mini Coding Agent 中的具体函数,读者可以对照真实实现验证论点,而非仅凭图示信服。
  • Names concrete failure modes
    点出具体失败模式
    Rather than abstractly praising subagents or memory, the piece names real risks — uncontrolled subagent sprawl, file-read duplication, prompt-cache waste — that practitioners actually hit.
    文章没有空泛地夸赞子智能体或记忆机制,而是点名了从业者真会遇到的风险:子智能体失控繁殖、文件重复读取、提示词缓存浪费。
  • Useful cross-product comparison
    跨产品对比有价值
    The Claude Code vs. Codex subagent permission contrast, and the coding-harness vs. OpenClaw framing, ground abstract concepts in named, checkable products rather than generic description.
    Claude Code 与 Codex 在子智能体权限上的对比,以及编程 Harness 与 OpenClaw 的框架区分,把抽象概念落在可核实的具体产品上,而非泛泛而谈。
Limits & Critiques局限 / 批评
  • Speculative capability-convergence claim
    能力趋同论证偏推测
    The claim that GLM-5 in a Claude-Code-quality harness would rival GPT-5.4/Opus 4.6 is explicitly framed as the author's guess, not benchmarked — readers should treat it as a hypothesis, not evidence.
    “GLM-5 装进 Claude Code 级 Harness 就能媲美 GPT-5.4/Opus 4.6”这一判断是作者明确标注的猜测,并无跑分支持,读者应视为假设而非实证结论。
  • No quantitative cost/latency data
    缺少量化的成本/延迟数据
    Prompt caching and context slimming are motivated by cost and latency, but the article gives no concrete numbers on token savings, cache hit rates, or how much clipping actually reduces spend.
    提示词缓存与上下文瘦身的动机是省钱省时,但文章没有给出任何具体数字——缓存命中率、裁剪节省的 Token 量、延迟改善幅度均未量化。
  • Mini Coding Agent is a simplified stand-in
    Mini Coding Agent 是简化替代品
    The reference implementation runs subagents synchronously, not in parallel, and is explicitly toy-grade; readers extrapolating its design to production harnesses like Claude Code may overestimate the similarity.
    作为参照的实现中子智能体是同步串行而非并行运行的,且被明确称为“简陋版”;读者若将其设计直接类推到 Claude Code 等生产级 Harness,可能高估两者的相似度。
  • Thin treatment of failure/error recovery
    对错误恢复的讨论较薄
    The piece covers the happy-path tool-call pipeline (validate, approve, execute) but says little about how harnesses handle tool failures, flaky test retries, or recovering from a bad subagent edit.
    文章详细描述了工具调用的顺利路径(校验、审批、执行),但对工具调用失败、测试抖动重试、子智能体误改代码后如何回滚等场景着墨很少。
Bottom line
总评

A clear, code-grounded primer for anyone who uses Claude Code or Codex daily and wants a precise mental model of why they feel so much stronger than a chat window — read it for the six-component taxonomy, but treat the capability-convergence claims as informed speculation rather than measured fact.

这是一篇概念清晰、有代码支撑的入门解读,适合每天用 Claude Code 或 Codex 却说不清“为什么它比聊天框强这么多”的读者——六大组件的拆解值得细读,但关于模型能力趋同的判断,应视为作者的合理推测而非实测结论。

06

Excerpt原文节选

This is a short excerpt, not the full piece — the complete essay belongs to its original author; please read it in full at the link above.

以下仅为节选,并非全文——完整文章版权归原作者所有,请点击上方链接阅读全文。

Components of A Coding Agent

How coding agents use tools, memory, and repo context to make LLMs work better in practice

In this article, I want to cover the overall design of coding agents and agent harnesses: what they are, how they work, and how the different pieces fit together in practice. Readers of my Build a Large Language Model (From Scratch) and Build a Large Reasoning Model (From Scratch) books often ask about agents, so I thought it would be useful to write a reference I can point to.

More generally, agents have become an important topic because much of the recent progress in practical LLM systems is not just about better models, but about how we use them. In many real-world applications, the surrounding system, such as tool use, context management, and memory, plays as much of a role as the model itself.

[…the source continues — read the rest at the link above]

[……原文更长,完整内容请点击上方链接阅读]

Manning (complete book in early access , pre-final layout, 528 pages)

编程智能体的核心组件【译】

原文:Components of A Coding Agent https://magazine.sebastianraschka.com/p/components-of-a-coding-agent 作者:Sebastian Raschka, 博士

编程智能体如何在实践中利用工具、记忆和代码仓库上下文,让大语言模型发挥更大威力

在这篇文章里,我想和大家聊聊编程智能体(Coding Agent)和 Agent harness(智能体 Harness)的整体设计。它们到底是什么?怎么工作的?在实际应用中,各个部件又是如何协同配合的?因为经常有读者问我关于智能体的问题(他们大多读过我写的《从零构建大语言模型》和《从零构建推理模型》),所以我决定写这篇参考指南,方便以后直接分享给大家。

往大了说,智能体现在之所以这么火,是因为最近实用化大语言模型(LLM)的进步,不仅仅靠模型本身变强,更在于我们 怎么用 它们。在很多真实的落地场景里,模型外围的配套系统——比如工具调用、上下文管理和记忆功能——发挥的作用一点都不比模型本身小。这就解释了,为什么像 Claude Code 或 Codex 这样的系统,用起来感觉比你在普通聊天界面里直接跟它们背后的模型对话要强得多。

接下来,我将为大家梳理编程智能体的六大核心模块。

Claude Code、Codex CLI 与其他编程智能体

大家可能对 Claude Code 或 Codex CLI( CLI 即命令行界面,一种让用户在终端中通过敲代码输入指令来操作计算机的工具 )已经很熟悉了。简单定个基调:它们本质上都是智能体化的编程工具。它们把大语言模型包裹在一个应用层(也就是我们说的 Agent harness)里,从而在处理编程任务时更加顺手,表现也更好。

图 1:Claude Code CLI、Codex CLI,以及我自己写的极简版编程智能体。

编程智能体是专门为软件开发打造的。在这里,重头戏可不仅仅是你选了哪个模型,更在于外围的配套系统——包括代码仓库的上下文(Repo Context)、工具的设计、提示词缓存的稳定性、记…

[…the source continues — read the rest at the link above]

[……原文更长,完整内容请点击上方链接阅读]

来源: https://magazine.sebastianraschka.com/p/components-of-a-coding-agent