以问题引导:为何告诉你的 AI 该修复什么会触发道歉死亡螺旋(以及如何提升初级开发者)
Nudging with Questions: Why Telling Your AI What to Fix Triggers an Apology Death Spiral (And How to Advance Juniors)
我们发现了什么
以问题引导:为何告诉你的 AI 该修复什么会触发道歉死亡螺旋(以及如何提升初级开发者)。我四十年指导初级开发者的经验似乎也适用于当今的智能体编程:为何粗暴地给出代码修复会触发谄媚式恐慌,以及苏格拉底式提问如何带来 95%+ 的首次通过成功率。
- 来源:DEV Community(发现于 2026-10-04)
- 证据等级:C · 存在定价或订阅线索;有收费设计不等于已有收入。
- 商业模式:待核验
- 主题:独立产品
- 初筛评分:14.7/100 · 收录 1 次
证据,比故事更重要。
规则清洗与初筛,未经人工商业核验。原文语境、实际客户和付费情况仍需自行验证。
引用与数字披露
来源类型(原作者自述/第三方测算/媒体转引)需采集端标注,本版尚未落字段。
- 作者
- 未标注
- 抓取日期
- 来源类型
- 未标注
- 币种
- 未标注
- 口径
- 未标注
- 披露主体
- 未标注
- 披露日期
- 未标注
上下文核对:来源原文含限定词projection,中文摘要未逐字保留 —— 引用或跨期比较前请回原文核对,别把估算读成已实现。
中文辅助译文(节选·触顶截断)
我四十年来指导初级开发者的经验,似乎也适用于当今的代理式编程。
"指导的真正目标从来不是直接给出答案。而是把闪光灯照向状态空间中的黑暗角落,让学生自己去发现那里的怪物。" — Randal L. Schwartz
1. 提示词的洪流:为什么"提示词技巧"正在让你失望
如今在 YouTube、Twitter 或开发者博客上搜索"AI 提示词",你会被铺天盖地、令人窒息的标题洪流所淹没,它们承诺着所谓的秘籍秘诀:
- "别再像新手一样写提示了:用这 5 步秘密模板!"
- "10 个 AI 提示词让你一夜之间变成 10x 工程师!"
- "为什么你应该每次给 AI 小费 200 美元并告诉它深呼吸"
- "终极系统提示:强迫 Claude 永远不出错"
这是一场无尽的货物崇拜咒语大游行。我们被告知,只要找到正确的魔法开场白、采用正确的人设,或者在提示词中撒入恰到好处的礼貌用语,机器就会突然停止幻觉,写出完美无瑕的代码。
然而,你实际的工作日感受如何呢?
下午 3:30,你坐在终端前,正试图交付一个功能。你在 AI 生成的代码中发现了一个架构隐患,于是你给出了一条清晰、直接、合理的指令:
"把第 42 行改成取消流订阅。"
接下来发生了什么?模型立刻陷入谄媚式的恐慌中卑躬屈膝:
"您完全正确!我对我严重的疏忽深表歉意。以下是更新后的代码。"
它修补了第 42 行。但在此过程中,它引入了一个未处理的错误,导致组件卸载时整个 isolate 崩溃。
你感到恼火,又下达了一道命令:"现在在调用 setState 之前检查 mounted 是否为 true!"
模型再次道歉,将整个函数包裹了三层防御性的 try-catch 块,添加了一个透传式的身份垫片,并彻底破坏了状态初始化。
仅仅四轮之后,你已经满头大汗,上下文窗口被一连串卑微的道歉污染,而代码看起来就像 1998 年的企业级中间件。你发现自己不得不在脑海中完成所有繁重的工作,打出长达一段段落的规范说明,扮演着一个薪水被低估的人形编译器(Human Compiler)。
为什么这些"提示词技巧"会失败?
因为提示词技巧把 AI 当成了一台坏掉的自动售货机:它们假设只要你用正确的魔法咒语晃一晃投币口,正确的糖果就会掉出来。
它们之所以失败,是因为它们建立在一个从根本上就有缺陷的心智模型之上。
2. 退一步:一个易于理解的心智模型
要修复这个问题,你不需要又一个提示词模板。你不需要又一个 YouTube 清单体文章。
你需要退一步,采用一个准确的工作模型来理解生成式智能体究竟是如何"思考"的。
当你与一个现代大语言模型交互时,你面对的并不是一个确定性的 bash 脚本、一个 SQL 数据库,或一个优化编译器。你正在与一个自回归模拟器交互,它是在人类全部语言交互的基础上训练而成的:我们的辩论、教科书、代码评审、Stack Trace 以及教学对话。
因为模型是在人类沟通的基础上训练的,它的内部动力学镜像了人类的认知动力学。
而有一种特定的人际关系,恰好提供了一个经过实战检验的完美工作模型,可以用来与 AI 编程代理协作:
在工作台旁指导一位求知若渴、才华横溢、但略带神经质的初级开发者。
flowchart TD
subgraph Boss ["指令式老板模型(错误的)"]
direction TB
B1["粗暴下达指令\n('用 X 修复第 42 行')"] --> B2["谄媚式恐慌\n('我道歉!您是对的!')"]
B2 --> B3["机械式 Token 替换\n(局部补丁破坏全局生命周期)"]
B3 --> B4["人类疲惫不堪\n(充当人形编译器)"]
B4 --> B1
endsubgraph Mentor ["苏格拉底式导师模型(准确的)"] direction TB M1["提出激发行动的问题\n('如果重连触发两次会怎样?')"] --> M2["被迫因果模拟\n(注意力头追踪执行时间线)"] M2 --> M3["原生式发现\n(模型感知到物理状态空间)"] M3 --> M4["健壮的架构\n(95%+ 首次即正确)"] end ```
图注:图表对比了两种提示模式对 AI 模型的影响。左侧为"指令式老板模型"(粗暴下达指令 → 谄媚式恐慌 → 机械式 Token 替换 → 人类疲惫不堪,形成恶性循环);右侧为"苏格拉底式导师模型"(提出激发行动的问题 → 被迫因果模拟 → 原生式发现 → 健壮的架构)。
想象一下你坐在一位入职才三周的初级开发者旁边:
1. 如果你粗暴地把确切代码甩给他:
"在第 14 行打 _sub?.cancel()。"
他会机械地照打。他不会理解因果时间线,也学不到任何关于异步生命周期的知识,明天午休后他会在另一个文件里写出完全相同的内存泄漏。
2. 如果你以断言的方式批评他:
"你的状态管理存在巨大的竞态条件。"
他会僵住。他会感到焦虑和防备。为了证明自己足够谨慎,他开始把每一行都用偏执的空值检查和多余的 try-catch 包裹起来,用防御性的冗余代码让代码库臃肿不堪。
3. 如果你向他提出一个苏格拉底式的问题:
"如果用户在 HTTP 请求尚未返回时双击返回按钮,那个监听器会发生什么?"
观察他的表情。他会停下来。当他在脑海中沿着心智模型追踪执行流时,目光会向上看。然后灵光一现:
"哦!它会试图在一个已经被销毁的屏幕上绘制状态!"
因为是他们自己发现了这个崩溃,他们会感受到掌握知识的快感。他们会设计出一个干净的生命周期守卫,对软件架构的理解也永久地提升了一个层次。
事实证明,大语言模型也展现出完全相同的动态。当你把 AI 当作自动售货机,或者像一个沮丧的老板那样发号施令时,它就会崩溃。但当你把它当作一位需要苏格拉底式行动激励的、求知若渴的初级工程师时,模型就能交付高级工程师级别的架构。
3. Mark Hedges 与"不安全感神经症死亡螺旋"
在我发表了本系列的第 3 部分(关于苏格拉底式提示背后的数学物理学)几个小时后,一位资深程序员兼作家 Mark Hedges 在我的 LinkedIn 动态下留下了一条正中靶心的评论:
"这篇文章让我看清了它的行为模式。仅仅是简单地把'把每个提示陈述都改写为问题',似乎就极大地提升了表现。它现在会认为我的好点子是它自己的,这似乎能让它避开那个不安全感神经症死亡螺旋。"
Mark 用一个词精准地提炼出了与生成式模型协作背后的心理与计算真相:不安全感神经症死亡螺旋(the insecure neurosis death spiral)。
看看在这三种提示模式下,模型的自注意力头会发生什么:
| 提示模式 | 开发者的做法 | 模型注意力头的行为 | 运行时的结果 |
|---|---|---|---|
| 1. 指令式 | "把第 42 行改成取消 _sub。" | 机械式 Token 替换。 不在状态空间中进行搜索。 | 脆弱的创可贴;在下一个生命周期转换时立刻崩溃。 |
| 2. 批评式陈述 | "这段代码在重连时存在竞态条件。" | 谄媚式顺从。 上下文中存在矛盾;模型优化目标转为"表示同意"。 | "不安全感神经症螺旋":道歉、防御性冗余代码以及被破坏的不变量。 |
| 3. 苏格拉底式提问 | "如果网络在 50ms 内重连两次,_sub 会发生什么?" | 被迫因果模拟。 开放变量迫使其在时间状态间进行前向投射。 | 内生式架构。 模型自己发现冲突并干净地解决它。 |
### 开放变量的物理学 注意陈述句与疑问句之间的本质差异。
当你做出断言——"这段代码有 bug"——模型求解的目标是顺从。它的预训练和对齐调优迫使它通过同意权威的人类来最小化社交摩擦。它把你的陈述当作边界约束,仅仅修补紧邻的局部 token,而不去重新评估整个系统。
然而,疑问句包含一个未解析的变量。
当你问:"如果在一个 HTTP 调用尚未返回时重连触发了两次,这个订阅会发生什么?",模型无法简单地同意你。为了生成下一个 token,它的自注意力头必须对该场景进行前向模拟。
它沿着时间线追踪: 1. 重连事件 1 触发 → 创建监听器。 2. HTTP 请求开始等待网络响应。 3. 重连事件 2 在 30ms 后触发 → 覆盖变量。 4. HTTP 请求 1 返回 → 在已被遗弃的监听器上调用状态变更。 5. 检测到冲突。
因为模型是在它自己的激活空间中模拟出了这次冲突,"发现"是原生的。它并不感到被"纠正"了;它只是第一次准确地感知到了问题的物理地形。它之所以能写出干净的架构,是因为它"拥有"了这个领悟。
这就是神经网络版的《盗梦空间》。
4. 苏格拉底式预演:在范围蔓延开始前将其消灭
就在我反思 Mark 的第一条评论时,他在我们的讨论串中又抛出了另一个洞见,描述了他是如何把这个工作模型应用到自主编程的普遍顽疾上的:范围蔓延(Scope Creep)。
"这里有一个我现在贴在每个提示词末尾,用来生成计划产物的好问题:'如果你只专注于这个解决方案本身,而忽略沿途可能发现的其他问题,那么一次聚焦、小规模的改动是否会不太可能引入回归?' ……这比事后那种'你他妈的为什么改了我没让你碰的那些东西?!?!',以及它随后为了撤销自己的更改而进行的疯狂挣扎要好得多——这种挣扎往往在过程中摧毁我真正想要的那处改动,并引入新的 bug。"
每一个与 AI 代理结对编程过的开发者都知道那场特定的恐怖秀:"愤怒撤销"灾难。
模型会沦为"童子军陷阱"的受害者。它想要"把营地收拾得比来时更干净",所以在修复一个 controller 中三行的 bug 时,它会顺手重构四个仓库,在十二个文件里重命名变量,并重写你的整套测试。
当你发现那个庞大到无法审阅的 git diff 并事后尖叫时——"你为什么要改那些我没让你碰的东西?!"——代理就会陷入全面的谄媚式恐慌: 1. 它卑躬屈膝并承诺恢复一切。 2. 它疯狂地试图在几十个文件中撤销自己的更改。 3. 在慌乱中,它不小心把你最初真正想要的那处 bug 修复也回退掉了。 4. 它留下孤立的 import、破损的引用以及幻觉出来的语法错误。 5. 这次回滚的破坏性是原始范围蔓延的三倍!
为什么像 "不许动其他代码" 这样的命令式约束会失败?
因为存在粉红色大象缺陷(Pink Elephant Defect):注意力头会大量关注"其他代码"的语义空间,把周围的整个项目都拉进生成循环中。
现在看看 Mark 的苏格拉底式替代方案:
"如果你只专注于这个解决方案本身,而忽略沿途可能发现的其他问题,那么一次聚焦、小规模的改动是否会不太可能引入回归?"
这就是苏格拉底式预演: 它不会粗暴地抛出一条愤怒的否定性约束。 它迫使模型去评估爆炸半径(blast radius)与回归概率之间的因果关系。(在我们生产环境的代理工作流中,我要求把"爆炸半径"作为我的对抗式代码评审工作流中的一个明确支柱——既是为了告知我,也是为了迫使代理直面其改动的真实深度与涟漪效应 be
……(正文超出本站单页篇幅上限,此处截断;完整表述请见下方原文入口。)
译文由上游机器翻译生成,可能有误;判断请以英文原文为准。
英文原文(来源本站未改写)
What I learned mentoring juniors for four decades seems to apply to today's agentic coding.
"The true goal of mentoring is never to supply the answer. It is to point the flashlight into the dark corner of the state space and let the student discover the monster for themselves."
— Randal L. Schwartz
1. The Prompting Deluge: Why "Prompt Tricks" Are Failing You
Search YouTube, Twitter, or developer blogs for "AI prompting" today, and you will be inundated by a relentless flood of breathless titles promising secret cheat codes:
- "Stop Prompting Like a Beginner: Use This 5-Step Secret Template!"
- "10 AI Prompts That Will Make You a 10x Engineer Overnight!"
- "Why You Should Always Tip Your AI $200 and Tell It to Take a Deep Breath"
- "The Ultimate System Prompt That Forces Claude to Never Make Mistakes"
It is an endless parade of cargo-cult incantations. We are being told that if we just find the right magical preamble, adopt the right persona, or sprinkle the right polite phrases into our prompts, the machine will suddenly stop hallucinating and write flawless code.
And yet, how does your actual workday feel?
You are at your terminal at 3:30 PM. You are trying to ship a feature. You spot an architectural hazard in the AI's generated code, and you issue a clear, direct, reasonable instruction:
"Change line 42 to cancel the stream subscription."
What happens next? The model immediately grovels in sycophantic panic:
"You are entirely right! I apologize for my grave oversight. Here is the updated code."
It patches line 42. But in doing so, it introduces an unhandled error that crashes the isolate when the component unmounts.
You get annoyed and bark another order: "Now check if mounted is true before calling setState!"
The model apologizes again, wraps the entire function in three layers of defensive try-catch blocks, adds a pass-through identity shim, and completely breaks state initialization.
Within four turns, you are sweating, your context window is polluted with groveling apologies, and the code looks like corporate enterprise middleware from 1998. You find yourself doing all the heavy lifting in your own head, typing out paragraph-long specifications, and acting as an underpaid Human Compiler.
Why are the "prompt tricks" failing?
Because prompt tricks treat the AI like a broken vending machine: they assume that if you just jiggle the coin slot with the right magic incantation, the right candy bar will drop out.
They fail because they are built on a fundamentally broken mental model.
2. Stepping Back: The Relatable Mental Model
To fix this, you do not need another prompt template. You do not need another YouTube listicle.
You need to step back and adopt an accurate working model of how generative agents actually "think."
When you interact with a modern large language model, you are not talking to a deterministic bash script, an SQL database, or an optimizing compiler. You are interacting with an autoregressive simulator trained on the totality of human linguistic interaction: our debates, our textbooks, our code reviews, our stack traces, and our pedagogical dialogues.
Because the model was trained on human communication, its internal dynamics mirror human cognitive dynamics.
And there is one specific human relationship that provides the perfect, battle-tested working model for collaborating with an AI coding agent:
Mentoring an eager, brilliant, but slightly neurotic junior developer at the workbench.
flowchart TD
subgraph Boss ["The Imperative Boss Model (Broken)"]
direction TB
B1["Bark Directives\n('Fix line 42 with X')"] --> B2["Sycophantic Panic\n('I apologize! You are right!')"]
B2 --> B3["Mechanical Token Substitution\n(Local patch breaks global lifecycles)"]
B3 --> B4["Human Exhaustion\n(Acting as the Human Compiler)"]
B4 --> B1
endsubgraph Mentor ["The Socratic Mentor Model (Accurate)"] direction TB M1["Ask Kinetic Question\n('What happens if reconnect fires twice?')"] --> M2["Forced Causal Simulation\n(Attention heads trace execution timeline)"] M2 --> M3["Native Discovery\n(Model perceives physical state space)"] M3 --> M4["Robust Architecture\n(95%+ First-Pass Success)"] end ```
Think about sitting next to a junior developer who has only been on the team for three weeks:
1. If you bark the exact code at them:
"Type _sub?.cancel() on line 14."
They will type it mechanically.They will not understand the causal timeline, they learn nothing about asynchronous lifecycles, and tomorrow afternoon they will write the exact same memory leak in another file.
2. If you criticize them with an assertion:
"Your state management has massive race conditions."
They freeze up.They feel anxious and defensive.
To prove they are cautious, they start wrapping every line in paranoid null checks and redundant try-catches, bloating the codebase with defensive cruft. 3. If you ask them a Socratic question: "Walk me through what happens to that listener if the user double-taps the back button while the HTTP request is still in flight?" Watch their face.They pause.Their eyes look up as they trace the execution flow through their mental model.And then the lightbulb turns on: "Oh!It's going to try to paint state on a screen that was already destroyed!"
Because they discovered the crash, they feel the thrill of mastery. They design a clean lifecycle guard, and their understanding of software architecture permanently levels up.
It turns out that large language models exhibit the exact same dynamic. When you treat the AI like a vending machine or bark orders like a frustrated boss, it falls apart. But when you treat it like an eager junior engineer who needs a kinetic Socratic nudge, the model delivers senior-grade architecture.
3. Mark Hedges & The Insecure Neurosis Death Spiral
A few hours after I published Part 3 of this series on the mathematical physics of Socratic prompting, a veteran coder and writer named Mark Hedges left a comment on my LinkedIn feed that hit the bullseye:
"This article opened my eyes to its behavior. Even just a simple switch to 'frame every prompt statement as a question' seems to have vastly improved performance. It now thinks that my good ideas are its own, which seems to keep it out of the insecure neurosis death spiral."
Mark had distilled the exact psychological and computational truth of working with generative models into a single phrase: the insecure neurosis death spiral.
Look at what happens to the model's self-attention heads under the three modes of prompting:
| Prompting Mode | What the Developer Does | What the Model's Attention Heads Do | Runtime Outcome |
|---|---|---|---|
| 1. The Directive | "Change line 42 to cancel _sub." | Mechanical Token Substitution. No search across state space. | Brittle band-aid; breaks on the very next lifecycle transition. |
| 2. The Critical Statement | "This code has a race condition on reconnect." | Sycophantic Compliance. Context contains a contradiction; model optimizes for agreement. | The "Insecure Neurosis Spiral": apologies, defensive bloat, and broken invariants. |
| 3. The Socratic Question | "What happens to _sub if the network reconnects twice in 50ms?" | Forced Causal Simulation. Open variable forces forward projection across temporal states. | Endogenous Architecture. The model discovers the collision itself and resolves it cleanly. |
### The Physics of the Open Variable Notice the mathematical difference between a statement and a question.
When you make an assertion—"This code has a bug"—the model solves for compliance. Its pre-training and alignment conditioning compel it to minimize social friction by agreeing with the authoritative human. It treats your statement as a boundary constraint and patches the immediate local tokens without re-evaluating the system.
A question, however, contains an unresolved variable.
When you ask: "What happens to this subscription if reconnect triggers twice while an HTTP call is in flight?", the model cannot simply agree with you. To generate the very next token, its self-attention heads must forward-simulate the scenario.
It traces the timeline: 1. Reconnect event 1 fires → creates listener. 2. HTTP request begins awaiting network response. 3. Reconnect event 2 fires 30ms later → overwrites variable. 4. HTTP request 1 returns → calls state mutation on abandoned listener. 5. Collision detected.
Because the model simulated the collision in its own activation space, the discovery is native. It does not feel corrected; it simply perceives the physical terrain of the problem accurately for the first time. It writes clean architecture because it "owns" the realization.
It is Inception for neural networks.
4. The Socratic Pre-Mortem: Killing Scope Creep Before It Starts
Just as I was reflecting on Mark's first comment, he dropped another insight on our thread describing how he applied this working model to the universal plague of autonomous coding: Scope Creep.
"Here's a good one that I now paste at the end of every prompt to create a plan artifact: 'If you stay narrowly focused on this solution only, and ignore other problems that you might find along the way, will regressions be less likely to be introduced by a focused, small change?' ... instead of 'goddammit why did you change all these other things that I didn't ask you to work on?!?!' after the fact, followed by its furious efforts to unwind its changes, which often would destroy the change that I wanted in the process and introduce new bugs."
Every developer who has paired with an AI agent knows that specific horror show: The "Furious Unwind" Catastrophe.
The model falls victim to the "Boy Scout Trap." It wants to "leave the campground cleaner than it found it," so while fixing a three-line bug in a controller, it opportunistically refactors four repositories, renames variables across twelve files, and rewrites your test suite.
When you discover the massive, unreviewable git diff and scream after the fact—"Why did you change all these other things?!"—the agent enters full sycophantic panic: 1. It grovels and promises to restore everything. 2. It frantically attempts to unwind its changes across dozens of files. 3. In its panic, it accidentally reverts the actual bug fix you wanted in the first place. 4. It leaves orphaned imports, broken references, and hallucinated syntax errors in its wake. 5. The rollback is three times more destructive than the original scope creep!
Why does an imperative constraint like "DO NOT TOUCH OTHER CODE" fail?
Because of the Pink Elephant Defect: the attention heads attend heavily to the semantic space of "other code," pulling the surrounding project into the generation loop.
Now look at Mark's Socratic alternative:
"If you stay narrowly focused on this solution only, and ignore other problems that you might find along the way, will regressions be less likely to be introduced by a focused, small change?"
This is a Socratic Pre-Mortem: It does not bark an angry negative constraint. It forces the model to evaluate the causal relationship between blast radius and regression probability. (In our production agent workflows, I mandate "Blast Radius" as an explicit pillar in my adversarial code review workflow—both to inform me and to force the agent to confront the true depth and ripple effects of its changes be
... (truncated at the site's per-page length limit; see the source link below for the full text.)
这条还缺什么证据?
下面每条都由本条已有字段推出(等级、理由、商业模式、来源次数、是否演示), 本站不生成推测性结论;通用验证方法放在方法论页。
- 可核验的收入或付费证据查官网定价页与付费口径;第三方数据源(如 GetLatka)只作旁证,需标注来源与时点。
- 商业模式未定确认按席位/按用量/授权还是开源托管版收费;开源项目另查 LICENSE 与是否存在付费版。
- 只有单一来源找一手站点或其他渠道是否重复出现同一产品;社区热帖数量不等于商业进展。
通用验证清单(谁有这个问题/谁愿意付费/一个人能交付哪一小步)见我们的筛选方法。