你能控制的,只有 context window
一位 MLOps community Amsterdam 的现场分享。讲者把 "context engineering" 拆成一个 很哲学的命题:每周一个新模型,你能控制的只有那个 context window —— 怎么往里塞东西, 比模型本身更重要。从 25% 的经验法则、context 的三分法(deterministic / probabilisti…
不是 syntax 教学,而是 "怎么在每周一个新模型的世界里保持工作姿势" 的心智模型。
讲者讲的是一个很具体的故事:开餐厅时被会计搞出一摊事,最后被法院逼着反向做了三年的账目整理 —— 就是从那一刻开始研究 "怎么从文档里抽出结构化数据"。
作者概括:他特别强调自己不是来教 syntax —— "I'm here to provide you my humble lens on this changing world." 一个看世界的镜头,不是一本手册。
讲者把这事拆得很哲学:
"focus on the things that you can change and that is essentially this little window which could be a million tokens."
即便它能涨到 1M、10M token,也还是一个有限的空间。
context engineering 就是怎么填好这个空间。
"the context window is a solution to a problem. Your problem is that you want your AI to be focused on whatever it is that you do and you want it to remember all that you did."
1M token 的窗口很方便,但不是唯一解。
讲者反复强调:还有别的办法,今晚就讲那些办法。
不管是 1M 模型还是 200K 模型 —— 一样。
"context is not just neutral data" —— 你的 context 里如果同时漂着 3 个互相冲突的概念,模型很难只盯着你想要的那个。
"context optimization is getting the highest form of efficiency: getting the best result with the minimum input injected at exactly the right time."
这就是为什么不是把所有规则塞进一个超大 CLAUDE.md,
而是切成不同 scope、不同触发条件的小块。
讲者自承这是个 "highly debatable" 的分类 —— 但很好用:
关键区别:"the way that they are injected"。同一段 markdown,被硬塞、被按需 fetch、被你打字打出来 —— 是三种完全不同的 context。
他认为很多人把"Python 写法约定"塞进 CLAUDE.md 是错的。
那些约定应该是 rules —— 它们可以是:
作者概括:把 "什么时候用" 写进文件本身,比把它写进一个 always-on 的大 markdown 更省 context。
Claude Code 暴露了一堆生命周期事件,你可以挂任何脚本。
讲者用 hook 在 user input 之后接一个 TTS 转写后的重写步骤 —— 因为他打字慢,靠语音输入,要让另一个模型把口语洗成 prompt。
"If you are flush in credits and flushing tokens, loops are a great thing."
设个 cron job,每 30 分钟自己往前推一步。是烧 token 但省人力的方案。
Claude 自带的 markdown memory。
讲者承认 "I don't really like it" ——
它不太知道何时该存,retrieval 时机也不准。"probably going to be awesome" 但还没到。
讲者的关键观察:sub-agent 不继承 default agent 的:
默认会继承的只有:model 和 MCPs,而且这两个也都能改。
所以 sub-agent 的本质是 "clean slate per job" —— 给一个非编程任务(比如生成发票)派一个干净的 agent,比让默认编程 agent 兼职做要好得多。
讲者举例:让 skill 去调一个 Gemini agent 做 native video 分析 —— Claude 自己不擅长视频,那就把 skill 当 "外援接口"。
他工作流的关键:聊到一个有意思的发现,立刻让 Claude 把它存成 skill。
以前他存 markdown 散落在各处。"和数据库说再见" 之后,技能就是可复用、可发现的。
Anthropic 自己也提供 "make-skill skill"。
skill 多了之后会撞到一个真实问题:每个 skill 的 description 都要让 LLM 看到才能选,200 个 skill 就是 200 段 description 都塞进 context。
Claude Code 的一个 flag。打开之后,skill 与 MCP 的描述按需加载,不再开局全注入 —— context 直接省下一大块。
你可以压缩 description 来省 token,代价是 LLM 选错的概率上升。
讲者说:让 LLM 替你选 —— 比让它替你做 —— 反而是 AI 未来更重要的用法。
"You are not going to think about 200 different skills when you are in a process —— there's just no way that a human will be able to choose from so many options. So you need the LLM to help you choose."
讲者反复回到这个点:在 agent 普及的时代,读文档比以前更重要,不是不重要。
他原话用了一个不太印刷的版本 —— "read the [bleep] manuals" —— 但意思是认真的:
"What you need to have is ideas, and you need to sort of have a feeling what is possible."
模型每周升级一次(讲者讲这个 talk 时 Opus 4.7 刚出,"highly opinionated, really does as you say"),文档跟着变。不读文档,等于自愿放弃可控性。
讲者特意先打预防针:"I am not standing here anthropomorphizing anything"。
这不是 "LLM = 脑子" 的浪漫话术。
是借大脑结构来抽象掉一个太复杂的系统。
一个被忽视的事实:memory 在被取出来的时候会被改写。所以 "查一下笔记" 这个动作本身就不中性。
"knowledge does not get embedded in a vacuum. So you can only see things when you know things."
带两岁的女儿走进同一个房间,她看到的不是同一个世界 —— 物理实景一样,但她的 priors 不同,被注意到的东西完全不同。
你必须先给 agent "a mental model of the world it's operating in"。
否则它就算扫到了关键信息,也不会知道那是关键 —— 它不知道自己在找什么。
讲者点名引用了 Andrej Karpathy 几周前的一个建议(YouTube 自动字幕把名字打成了 "Kapati"):
做 agent 的工程师,把 memory storage 当作一堆 markdown 文件就够了 —— 不用上 RAG。
为什么这个建议有意思:
讲者说他用 Obsidian 可视化,看到所有 note 之间的连线 —— "super easy".
Karpathy 的建议到 "markdown 文件 + index" 就停了。讲者继续往下做:
顶层一个文件,每次有新信息处理都被更新。是当前 "热点" 的快照。
每条 note 都有一个数值 —— 表示 "这条多大可能性还属于这套 corpus"。
14 天 / 30 天没被用到的 note 会被降分。同主题的新 note 进来则会把这个主题的所有 note 提分。
讲者承认这token 很重,但他坚持:每一篇论文都整篇地让 agent 读 —— 切片会丢上下文。
讲者最近在玩的另一个 pattern:另开一个终端 session 当观察者。
Claude Code 的 session 是本地的 JSONL 文件。另一个进程要读它易如反掌。
通过 tmux(讲者口误说成 "Tumix" / "Timox",是同一回事)让两个终端互发消息。
他用的还是 "the most important use of AI is offloading the things we have to make choices about" —— 让 LLM 替我决定 "这条信息要不要回头查",是节省人脑的最关键场景。
讲者现场放了一个对比 demo。
任务:从零做一个 cellular automata visualization。
两边都是:Opus 4.7、同样的 CLAUDE.md、同样的 skills、同样的 sub-agents。
唯一区别:configured 版本带一个事先填好的 wiki(他花了一小时研究 + 读论文 + 喂进数据库)。
Hard 约束:5 分钟硬性 timer,每 30 秒 hook 一次提醒 "hurry up"。
带 wiki 的那个直接 fetch 概念建图。
默认版本只能靠 parametric memory 或临时研究 —— 时间用完了还在搜资料。
"the most beautiful things are the unexpected things —— the sort of serendipity, the findings that actually update the priors not only confirm the priors."
你派它去 arxiv 抓某个主题的论文 —— 它会聚焦在那个主题,这是它该做的。
但你还可以让另一批指令不同的 agent 处理那些"顺手挖到的"论文 —— 95% 不直接进 context,先沉到 wiki 里。
未来某次任务它们就成了你 priors 之外的意外。
讲者花了几分钟讲他认为不该给 LLM 的活 —— 这部分他口气最坚决:
"if you are not able to say that if a model produces an output, if that output is good or bad, then you probably shouldn't give the task to an LLM."
你说不清什么样的 essay 是 "好" 的。
拼写检查可以,主体写作不行。
理由很经济学 —— 任何免费、人人可得的东西就失去价值了。
客服的一半意义是品牌感知,不只是解决问题。
判别标准简单粗暴:你能不能事先说出 "好 / 坏" 的定义? 说不出 → 别上 LLM。
讲者整场分享的实战环节就围绕这件事 —— 这也是他个人入行的起点:
工业里到处都是技术图纸:一个机械零件的 3D 实物 → 2D 视图。你看到的是有损版本,但里面其实塞满了可被还原的信息。
讲者把自己怎么进 AI 圈的故事接在这儿:开餐厅时被会计搞砸,被法院判要倒着补三年的账 —— "that is the point where I started learning about structured extraction." 财务表也好、机械图也好,规则是一样的:抽得出,验得了。
观众问到 Anthropic 的 emotion vectors 论文 —— 讲者答得很小心:
你给 LLM 一个高情绪冲击的故事,研究者能在内部测到 "emotion vectors" 被激活。
这些 vector 是从人类语料中学来的模式,不是真情绪。
"you can use sort of reverse psychology to work with it, but it doesn't mean it's actually true."
可以借这个机制写更有效的 prompt,但不要在街上公开讲—— 大多数人会把"模型会有反应"听成"模型有感受"。
"I am not standing here anthropomorphizing anything" —— 但允许借大脑、借情绪当类比,因为模型本来就是被人类语料训出来的。
讲者强调:"a raw API call is stateless"。
你打过去就只有这一发,没有任何隐含 context。
"cloud code does not come stateless." (原字幕,意指 Claude Code)
打开一个 terminal 就已经预装了系统指令、CLAUDE.md 层级、可能还有 skill 描述、memory、tools。
所有 "怎么管 context" 的讨论,只有在有状态的封装里才存在。
如果你直接用 API,你就是 statelessness 的全部责任人。
如果你用 Claude Code,你是在调一个已经装满东西的环境 —— 别假装它是空的。
"the whole thing with Claude and AI agents is that they can solve problems at runtime. It's not always your production solution, but it's definitely something you can learn a lot from."
你写 Pydantic model + rich description
→ 你已经知道要抽什么
→ 才能写出 schema
→ 这是 script 的活
未知 schema 也能干 ——
你给一张你从没见过领域的图,agent 在 runtime 自己定义 schema。
对生产未必稳,但学到的东西巨多。
讲者反复纠正一种主流叙事 —— 主流报刊把 AI 想成 "一个全能模型"。他认为这是误判:
"people look at it with a sort of like magic thinking" —— 总在等那个万能模型。
但你不需要每个模型都是全能。
→ 加在一起一样有大影响力。
这也是为什么他不停在 Claude 之外接 Codex / Gemini —— 把不同模型当作不同 sub-agent,谁擅长什么用谁。
讲者讲了一段挺个人的话:这件事已经不是 "写代码" 了:
从客户通话录音里自动起报价单。
生成发票草稿、回邮件草稿。
研究新主题、写 talk、做对比实验(比如这场分享)。
他强调:千万别让默认的 coding agent 做非 coding 的事。
"sending a coding agent on a non-coding job —— probably works, but probably not optimal."
正确做法是:对每一类业务任务设计一个 sub-agent,给它自己的 system message、skill 子集、模型选择。
"focus on the things that you can change, and that is essentially this little window."
"don't even think about going over 25% of context usage" / "less is always more when it comes to context."
"knowledge does not get embedded in a vacuum. You can only see things when you know things."
"if you are not able to say that if a model produces an output, if that output is good or bad, then you probably shouldn't give the task to an LLM."
"the most beautiful things are the unexpected things —— the serendipity, the findings that actually update the priors not only confirm the priors."
"the whole thing with Claude and AI agents is that they can solve problems at runtime."
"As we all learned —— that comes at a price."
—— 讲者在演讲结尾对全场说的最后一句