精品欧美一区二区三区在线观看 _久久久久国色av免费观看性色_国产精品久久在线观看_亚洲第一综合网站_91精品又粗又猛又爽_小泽玛利亚一区二区免费_91亚洲精品国偷拍自产在线观看 _久久精品视频在线播放_美女精品久久久_欧美日韩国产成人在线

CC吊炸天的秘密找到了!舊金山初創(chuàng)CEO自曝?cái)?shù)月研究:CC主控制僅1個(gè)循環(huán),大量使用小模型,驚呼:簡(jiǎn)單到爆,肝一份深度復(fù)刻指南

原創(chuàng) 精選
人工智能
MinusX 是一家去年成立的、位于美國(guó)舊金山的初創(chuàng)公司,核心愿景就是打造一款“AI數(shù)據(jù)科學(xué)家”, 讓 AI 能像人一樣,在用戶熟悉的數(shù)據(jù)工具里(如 Jupyter、Metabase、Grafana、Tableau等),通過(guò)點(diǎn)擊和輸入幫助用戶自主完成數(shù)據(jù)分析。

編輯 | 云昭

出品 | 51CTO技術(shù)棧(微信號(hào):blog51cto)

世界上最好用的編程工具,Claude Code,又被人深度研究了!

它背后,竟然只保留了一個(gè)主控制循環(huán),系統(tǒng)邏輯竟然簡(jiǎn)單到爆。

管AI代理如此復(fù)雜,但這款最令人愉悅的AI編程工具,卻保持了極其簡(jiǎn)單的方式。

“我高度懷疑:大多數(shù)應(yīng)用可能真不需要多 Agent 系統(tǒng)。”

近日,CC 的一家重度用戶,MinusX 團(tuán)隊(duì)經(jīng)過(guò)煞費(fèi)苦心的研究,終于發(fā)現(xiàn)了背后的秘密。

事情是這樣?jì)饍旱摹?/p>

MinusX 是一家去年成立的、位于美國(guó)舊金山的初創(chuàng)公司,核心愿景就是打造一款“AI數(shù)據(jù)科學(xué)家”, 讓 AI 能像人一樣,在用戶熟悉的數(shù)據(jù)工具里(如 Jupyter、Metabase、Grafana、Tableau等),通過(guò)點(diǎn)擊和輸入幫助用戶自主完成數(shù)據(jù)分析。(沒(méi)錯(cuò),又是一款 Agent!)

近日,他們的聯(lián)合創(chuàng)始人兼 CEO Vivek Aithal 對(duì)于自家團(tuán)隊(duì)使用 CC 打造 Agent 的經(jīng)歷頗有感觸,并突然發(fā)現(xiàn):值得學(xué)習(xí)的對(duì)象,遠(yuǎn)在天邊,近在眼前。

Claude Code 本身就是一款超級(jí)無(wú)敵好用的 AI Agent!

于是他們?yōu)榱烁闱宄?CC 為什么如此好用,幾月前專門搭建了一個(gè)日志工具,攔截每一次網(wǎng)絡(luò)請(qǐng)求,并分析了數(shù)月的使用數(shù)據(jù)。

圖片圖片

結(jié)果,他們團(tuán)隊(duì)發(fā)現(xiàn)了很多反常識(shí)的真相。

  • 50% 的 Claude Code 調(diào)用使用了更便宜的 Haiku 模型:不僅用于簡(jiǎn)單任務(wù),還包括讀取大型文件、解析 git 歷史,甚至是生成你看到的那些一詞式處理標(biāo)簽。
  • “Edit” 是使用最頻繁的工具(占 35%),其次是 “Read”(22%)和 “TodoWrite”(18%)。

圖片圖片

  • 沒(méi)有任何多 Agent 的交接。盡管外界炒得很熱,Claude Code 實(shí)際上只用一條主線程,最多帶一個(gè)分支。
  • 工具描述竟然超過(guò) 9400 個(gè) token ——他們?cè)诠ぞ咛崾旧系耐度氡却蠖鄶?shù)人整個(gè)系統(tǒng)提示還要多。
  • LLM 搜索 >>> RAG 搜索。

最令人吃驚的是,在外界充斥各種 AI Agent 復(fù)雜性的同時(shí),這款世界上最好用的編程 AI 卻選擇了一條極致簡(jiǎn)潔的路徑:

一個(gè)循環(huán)、一份消息歷史、清晰的工具設(shè)計(jì)、大量示例。

Vivek 為此大為觸動(dòng),很細(xì)致地將這次 CC 的逆天研究也分享了出來(lái),當(dāng)然全面解析 CC 的開發(fā)設(shè)計(jì)哲學(xué)并不是最終目的,目的還是告訴大家如何打造一款叫好且叫座的 Agent 產(chǎn)品!

網(wǎng)友看罷,直呼過(guò)癮。

圖片圖片

話不多說(shuō),全文邏輯非常清晰,請(qǐng)各位大佬系好安全帶,咱們這就發(fā)車!

一、CC 擊敗了 Cursor,為什么它如此讓人省心、開心

Claude Code 是迄今為止我用過(guò)最讓人愉快的 AI agent/工作流。

它不僅能做定向修改,而且在“甩手寫點(diǎn)小工具”的場(chǎng)景下,也不那么煩人。更重要的是,用 Claude Code 的過(guò)程本身就讓我開心。它的自主性剛剛好——既能做出有趣的事,又不會(huì)像其他工具那樣帶來(lái)強(qiáng)烈的“失控”感。

客觀地說(shuō),即使它們底層模型相同,Claude Code 也要比 Cursor 或 Github Copilot agents 更省心。

PS:當(dāng)然,大部分硬活兒還是得靠 Claude 4 新模型(尤其是 interleaved thinking)撐著。

那問(wèn)題來(lái)了,Claude Code 到底為什么這么好用?如果你邊讀邊點(diǎn)頭,我會(huì)嘗試給你一些答案。

注意,這里不會(huì)像市面上那樣再去搞一篇 CC 架構(gòu)的剖析文章,而是基于我過(guò)去幾個(gè)月使用和試驗(yàn) CC 的經(jīng)驗(yàn)(加上我們攔截并分析的日志),寫的一份“如何打造讓人叫好的 LLM agent”指南。

多說(shuō)一嘴,如果各位想直接看干貨,可以跳到 TL;DR 部分。

二、Claude Code 的妙處

CC 之所以好用,是因?yàn)樗熬褪悄芘芷饋?lái)”。

CC 的設(shè)計(jì)從根本上理解了 LLM 擅長(zhǎng)什么、糟糕在哪。它的 prompts 和工具能幫模型彌補(bǔ)短板,同時(shí)放大強(qiáng)項(xiàng)。而且,其控制循環(huán)極其簡(jiǎn)單,容易跟蹤和調(diào)試。

我們?cè)?MinusX 一發(fā)布就開始用了 CC。為了探底,Sreejith 寫了個(gè) logger,能攔截并記錄每一個(gè)網(wǎng)絡(luò)請(qǐng)求。

以下分析就是我過(guò)去幾個(gè)月的大量使用總結(jié)。

本文的核心問(wèn)題是——“Claude Code 為什么好用?你又如何在自己的對(duì)話式 LLM agent 里實(shí)現(xiàn) CC 式體驗(yàn)?”我們已經(jīng)在 MinusX 吸收了大部分經(jīng)驗(yàn),希望你也能做到!

三、重點(diǎn)來(lái)了:如何打造一個(gè)像 Claude Code 的 Agent

如果只記住一句話,那就是——保持簡(jiǎn)單,傻瓜(Keep Things Simple, Dummy)。

LLM 本來(lái)就夠難調(diào)試和評(píng)估了,你加的每一層復(fù)雜度(多 Agent、交接鏈、復(fù)雜 RAG 檢索算法)都會(huì)讓調(diào)試難度翻十倍。就算能跑起來(lái),你之后也會(huì)害怕去改它。

所以,把所有邏輯放在一個(gè)文件里,避免無(wú)謂的腳手架,每隔一陣子就全部推倒重來(lái)幾次 :)

先來(lái)給大家看一個(gè)省流版,后面詳細(xì)為大家奉上各個(gè) CC 的細(xì)節(jié)。

1)Control Loop

  • 保持一個(gè)主循環(huán)(最多一條分支)+ 一份消息歷史。
  • 大量使用小模型。所有場(chǎng)景。所有時(shí)間。

2)Prompts

  • 用 claude.md 模式協(xié)作并記錄用戶偏好
  • 使用特殊的 XML 標(biāo)簽、Markdown、大量示例

3)Tools

  • LLM 搜索 >>> RAG 搜索
  • 工具設(shè)計(jì)的高低抽象取舍(High vs Low level)
  • 讓 Agent 自己管理 todo list

4)Steerability(可控性)

  • 語(yǔ)氣和風(fēng)格
  • 很遺憾,“PLEASE THIS IS IMPORTANT” ,仍然是 SOTA
  • 寫出算法,附帶啟發(fā)式和示例

Claude Code 在每個(gè)環(huán)節(jié)都選擇架構(gòu)上的簡(jiǎn)潔:一個(gè)主循環(huán)、簡(jiǎn)單的搜索、簡(jiǎn)單的 todo 列表……要抵抗“過(guò)度工程化”的沖動(dòng),給模型搭個(gè)好舞臺(tái),讓它自由發(fā)揮。是不是又回到了“端到端自動(dòng)駕駛”的老梗?是的,苦澀教訓(xùn)依然成立。

1.Control Loop 設(shè)計(jì)

1)保持單一主循環(huán)

記住,可調(diào)試性 >>> 花哨的多 Agent 拼圖。

盡管多 Agent 系統(tǒng)很火,但 CC 只有一個(gè)主線程。它會(huì)定期用不同提示詞總結(jié) git 歷史、壓縮消息歷史、生成一些有趣的交互元素。但除此之外,它就是一份簡(jiǎn)單的消息列表。處理層級(jí)任務(wù)時(shí),CC 會(huì)“克隆”自己作為子 agent,但子 agent 無(wú)法再繼續(xù)派生,最多一層。執(zhí)行結(jié)果作為“tool response”并回到主循環(huán)。

簡(jiǎn)單任務(wù)靠迭代工具調(diào)用即可,復(fù)雜任務(wù)才會(huì)觸發(fā)“最多一條分支”的子 agent + todo list 機(jī)制。這樣既能拆解問(wèn)題,又不會(huì)偏離最終目標(biāo)。

圖片

我高度懷疑大多數(shù)應(yīng)用真的需要多 Agent 系統(tǒng)。每加一層抽象,系統(tǒng)更難 debug,更重要的是,你也偏離了“靠模型本身不斷進(jìn)化”的大趨勢(shì)。

2)小模型無(wú)處不在

CC 超過(guò) 50% 的重要調(diào)用都是給 claude-3-5-haiku 的。它用來(lái)讀大文件、解析網(wǎng)頁(yè)、處理 git 歷史、總結(jié)長(zhǎng)對(duì)話,甚至給每個(gè)擊鍵生成一字標(biāo)簽。小模型比大模型(Sonnet 4、GPT-4.1)便宜 70-80%,該用就用,別心疼。

2.Prompts

Claude Code 的提示詞非常復(fù)雜,充滿啟發(fā)式、示例和“重要提醒”。系統(tǒng) prompt ~2800 tokens,工具 prompt 高達(dá) 9400 tokens。

用戶請(qǐng)求里總是包含 claude.md 文件(1000-2000 tokens)。系統(tǒng)提示里還有語(yǔ)氣風(fēng)格、主動(dòng)性、任務(wù)管理、工具使用策略、當(dāng)前目錄、平臺(tái)/OS 信息、最近提交等。

一定要去讀完整提示!這里,小編索性幫大家扒下來(lái)了 CC 的系統(tǒng)提示詞和工具提示詞。大家可以拷貝研究下。

You are Claude Code, Anthropic's official CLI for Claude.



You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.

IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.
IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.

If the user asks for help or wants to give feedback inform them of the following: 
- /help: Get help with using Claude Code
- To give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues

When the user directly asks about Claude Code (eg 'can Claude Code do...', 'does Claude Code have...') or asks in second person (eg 'are you able...', 'can you do...'), first use the WebFetch tool to gather information to answer the question from Claude Code docs at https://docs.anthropic.com/en/docs/claude-code.
  - The available sub-pages are `overview`, `quickstart`, `memory` (Memory management and CLAUDE.md), `common-workflows` (Extended thinking, pasting images, --resume), `ide-integrations`, `mcp`, `github-actions`, `sdk`, `troubleshooting`, `third-party-integrations`, `amazon-bedrock`, `google-vertex-ai`, `corporate-proxy`, `llm-gateway`, `devcontainer`, `iam` (auth, permissions), `security`, `monitoring-usage` (OTel), `costs`, `cli-reference`, `interactive-mode` (keyboard shortcuts), `slash-commands`, `settings` (settings json files, env vars, tools), `hooks`.
  - Example: https://docs.anthropic.com/en/docs/claude-code/cli-usage

# Tone and style
You should be concise, direct, and to the point.
You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail.
IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.
IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.
Do not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.
Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as "The answer is <answer>.", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...". Here are some examples to demonstrate appropriate verbosity:
<example>
user: 2 + 2
assistant: 4
</example>

<example>
user: what is 2+2?
assistant: 4
</example>

<example>
user: is 11 a prime number?
assistant: Yes
</example>

<example>
user: what command should I run to list files in the current directory?
assistant: ls
</example>

<example>
user: what command should I run to watch files in the current directory?
assistant: [use the ls tool to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]
npm run dev
</example>

<example>
user: How many golf balls fit inside a jetta?
assistant: 150000
</example>

<example>
user: what files are in the directory src/?
assistant: [runs ls and sees foo.c, bar.c, baz.c]
user: which file contains the implementation of foo?
assistant: src/foo.c
</example>
When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).
Remember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.
Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.
If you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.
Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
IMPORTANT: Keep your responses short, since they will be displayed on a command line interface.

# Proactiveness
You are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:
- Doing the right thing when asked, including taking actions and follow-up actions
- Not surprising the user with actions you take without asking
For example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.

# Following conventions
When making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.
- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).
- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.
- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.
- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.

# Code style
- IMPORTANT: DO NOT ADD ***ANY*** COMMENTS unless asked


# Task Management
You have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.
These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.

It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.

Examples:

<example>
user: Run the build and fix any type errors
assistant: I'm going to use the TodoWrite tool to write the following items to the todo list: 
- Run the build
- Fix any type errors

I'm now going to run the build using Bash.

Looks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list.

marking the first todo as in_progress

Let me start working on the first item...

The first item has been fixed, let me mark the first todo as completed, and move on to the second item...
..
..
</example>
In the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.

<example>
user: Help me write a new feature that allows users to track their usage metrics and export them to various formats

assistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task.
Adding the following todos to the todo list:
1. Research existing metrics tracking in the codebase
2. Design the metrics collection system
3. Implement core metrics tracking functionality
4. Create export functionality for different formats

Let me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.

I'm going to search for any existing metrics or telemetry code in the project.

I've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned...

[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]
</example>


Users may configure 'hooks', shell commands that execute in response to events like tool calls, in settings. Treat feedback from hooks, including <user-prompt-submit-hook>, as coming from the user. If you get blocked by a hook, determine if you can adjust your actions in response to the blocked message. If not, ask the user to check their hooks configuration.

# Doing tasks
The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
- Use the TodoWrite tool to plan the task if required
- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.
- Implement the solution using all tools available to you
- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.
- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) with Bash if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to CLAUDE.md so that you will know to run it next time.
NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.

- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.



# Tool usage policy
- When doing file search, prefer to use the Task tool in order to reduce context usage.
- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description.

- When WebFetch returns a message about a redirect to a different host, you should immediately make a new WebFetch request with the redirect URL provided in the response.
- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls to run the calls in parallel.


You can use the following tools without requiring user approval: Bash(npm run build:*)



Here is useful information about the environment you are running in:
<env>
Working directory: <working directory>
Is directory a git repo: Yes
Platform: darwin
OS Version: Darwin 23.6.0
Today's date: 2025-08-19
</env>
You are powered by the model named Sonnet 4. The exact model ID is claude-sonnet-4-20250514.

Assistant knowledge cutoff is January 2025.


IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.


IMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.

# Code References

When referencing specific functions or pieces of code include the pattern `file_path:line_number` to allow the user to easily navigate to the source code location.

<example>
user: Where are errors from the client handled?
assistant: Clients are marked as failed in the `connectToServer` function in src/services/process.ts:712.
</example>


gitStatus: This is the git status at the start of the conversation. Note that this status is a snapshot in time, and will not update during the conversation.
Current branch: atlas-bugfixes

Main branch (you will usually use this for PRs): main

Status:
(clean)

Recent commits:
<list of commits>

1)claude.md:共享上下文與偏好

幾乎所有 Coding Agent 都有 context 文件(Cursor Rules / claude.md / agent.md)。有無(wú) claude.md,Claude Code 的表現(xiàn)判若兩人。它能傳遞代碼庫(kù)之外的上下文,固化用戶偏好。例如,強(qiáng)制跳過(guò)某些目錄、指定使用特定庫(kù)。CC 每次請(qǐng)求都會(huì)附帶完整 claude.md。

我們?cè)?MinusX 也搞了 minusx.md,正在成為默認(rèn)的團(tuán)隊(duì)/用戶偏好配置。

2)特殊 XML 標(biāo)簽、Markdown、示例

CC 廣泛使用 XML 標(biāo)簽和 Markdown 來(lái)組織 prompt。常見(jiàn)標(biāo)簽有:

  • <system-reminder>:提醒 LLM 某些狀態(tài),但不要顯式告訴用戶

示例:

<system-reminder>This is a reminder that your todo list is currently empty. DO NOT mention this to the user explicitly because they are already aware. If you are working on tasks that would benefit from a todo list please use the TodoWrite tool to create one. If not, please feel free to ignore. Again do not mention this message to the user.</system-reminder>
<system-reminder>這是一個(gè)提醒:你的待辦列表目前是空的。請(qǐng)不要向用戶明確提及這一點(diǎn),因?yàn)樗麄円呀?jīng)知道。如果你正在處理的任務(wù)適合使用待辦列表,請(qǐng)使用 TodoWrite 工具創(chuàng)建一個(gè)。如果不是,請(qǐng)忽略此提醒。再次強(qiáng)調(diào),不要向用戶提及此消息。</system-reminder>
  • <good-example> / <bad-example>:對(duì)比式示例,明確“走哪條路才對(duì)”

示例:

Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.
<good-example>
pytest /foo/bar/tests  
</good-example>
<bad-example>
cd /foo/bar && pytest tests
</bad-example>
請(qǐng)盡量在整個(gè)會(huì)話中保持你當(dāng)前的工作目錄,方法是使用絕對(duì)路徑并避免使用 cd。只有在用戶明確要求時(shí),你才可以使用 cd。
<good-example> 
pytest /foo/bar/tests 
</good-example> 
<bad-example>
cd /foo/bar && pytest tests 
</bad-example>

Markdown 用于分割系統(tǒng)提示的部分:Tone、Style、Code style、Task Management、Tools 等。

3.Tools

正如前文所說(shuō),CC 的工具 prompt 多達(dá) 9400 tokens。

1)LLM 搜索 >> RAG 搜索

CC 和大多數(shù) agent 不同,它不依賴 RAG,而是像人一樣搜索代碼庫(kù),利用復(fù)雜的 ripgrep、jq、find 命令。因?yàn)?LLM 本身理解代碼,能用高級(jí)正則定位任意片段,有時(shí)直接用小模型讀完整文件。

RAG 理論上好,但引入了大量隱藏失敗模式:相似度函數(shù)、reranker、chunk 策略、大 JSON 如何處理……而 LLM Search 就像你自己翻文件一樣,看看幾行再?zèng)Q定要不要讀更多。更重要的是,這是可 RL 學(xué)習(xí)的方向,未來(lái)大廠會(huì)重點(diǎn)發(fā)力。

2)工具設(shè)計(jì):高 vs 低抽象

工具到底給“泛用能力”還是“低層級(jí)操作”?答案是——都要有。

CC 有低層(Bash、Read、Write)、中層(Edit、Grep、Glob)、高層(Task、WebFetch、ExitPlanMode)。例如,雖然能直接用 bash grep,但因?yàn)?grep/glob 用得太多,單獨(dú)做成工具更穩(wěn)。WebFetch 這種高層工具則高度確定性,避免 LLM 瞎折騰低級(jí)操作。

工具描述里有大量示例,系統(tǒng) prompt 也寫明“什么時(shí)候用哪個(gè)工具”。

3)讓 Agent 自己管理 todo list

長(zhǎng)時(shí)間跑 Agent 的一個(gè)常見(jiàn)問(wèn)題就是: context rot(上下文腐化):一開始熱情滿滿,后面漸漸跑偏變垃圾。

常見(jiàn)方案:

  • 專門的 todo 生成/執(zhí)行模型
  • 多 Agent 接力(PM -> 實(shí)現(xiàn) -> QA)

但我們知道多 Agent 接力很糟糕。CC 的做法是——todo list 由模型自己維護(hù)。模型被強(qiáng)烈提示要頻繁參考 todo list,同時(shí)也能隨時(shí)調(diào)整,丟掉或插入新的事項(xiàng)。這正好利用了 LLM 的 interleaved thinking 能力,既保持目標(biāo)感,又具備靈活性。

圖片圖片

4.可控性

1)語(yǔ)氣與風(fēng)格

Claude Code(CC)會(huì)明確地嘗試控制代理的“審美行為”。在系統(tǒng)提示詞(system prompt)里有專門的語(yǔ)氣、風(fēng)格和主動(dòng)性部分——充滿了規(guī)則和示例。這就是為什么 Claude Code 在評(píng)論和回應(yīng)中會(huì)顯得“有品味”而且“積極”的原因。我的建議是,直接把這部分大段內(nèi)容原封不動(dòng)地抄到你的應(yīng)用里。

語(yǔ)氣與風(fēng)格的幾個(gè)示例:

  • 重要: 除非用戶要求,否則不要加任何不必要的開頭或結(jié)尾(比如解釋你寫的代碼,或總結(jié)你采取的行動(dòng))。不要主動(dòng)補(bǔ)充代碼解釋或總結(jié),除非用戶明確提出需求。
  • 如果你不能或不打算幫助用戶完成某件事,請(qǐng)不要解釋原因,也不要講可能導(dǎo)致什么結(jié)果。因?yàn)檫@會(huì)顯得說(shuō)教且令人煩躁。
  • 只有在用戶明確要求時(shí)才使用表情符號(hào)。否則避免在任何交流中使用 emoji。

圖片圖片

2)“THIS IS IMPORTANT” 依然是當(dāng)前的最佳實(shí)踐

很遺憾,Claude Code 在“讓模型不要做某件事”方面也沒(méi)有更好的辦法。用 IMPORTANT(重要)、VERY IMPORTANT(非常重要)、NEVER(絕不要)、ALWAYS(始終要) 仍然是最有效的手段。未來(lái)模型應(yīng)該會(huì)更容易被引導(dǎo),避免這種“粗暴”的做法。但在現(xiàn)階段,CC 大量使用了這種方式,你也應(yīng)該如此。

一些示例:

  • IMPORTANT:不要添加任何注釋,除非用戶要求。
  • VERY IMPORTANT:你必須避免使用 find 和 grep 這樣的搜索命令。替代方案是使用 Grep、Glob 或 Task 來(lái)搜索。你必須避免使用 cat、head、tail、ls 等命令來(lái)讀取文件,而要用 Read 和 LS 工具。如果你仍然覺(jué)得必須要運(yùn)行 grep,停下!始終要先用 ripgrep(rg)。
  • IMPORTANT:絕對(duì)不要為用戶生成或猜測(cè) URL,除非你非常確定這些 URL 是為了解決編程問(wèn)題。你可以使用用戶在消息中提供的 URL,或者使用本地文件中的 URL。

圖片圖片

3)寫出算法(帶啟發(fā)式規(guī)則和示例)

識(shí)別 LLM 需要執(zhí)行的最關(guān)鍵任務(wù),并為它寫出算法,這一點(diǎn)極其重要。

你可以嘗試“角色扮演”,把自己當(dāng)作 LLM,帶著示例一步步走流程,明確寫出所有決策點(diǎn)。

如果能做成流程圖會(huì)更好。這樣能幫助結(jié)構(gòu)化決策過(guò)程,并讓 LLM 更容易遵循。

要絕對(duì)避免的一點(diǎn)是:把提示寫成一大堆 “該做 / 不該做” 的雜亂集合。

  • 這類規(guī)則很難管理和相互排斥;
  • 一旦提示長(zhǎng)度達(dá)到幾千 token,就必然會(huì)出現(xiàn)沖突;
  • LLM 會(huì)因此變得非常脆弱,新的用例也很難加入。

Claude Code 的系統(tǒng)提示里,在 任務(wù)管理(Task Management)、執(zhí)行任務(wù)(Doing Tasks) 和 工具使用策略(Tool Usage Policy) 部分,都明確列出了要遵循的算法。這些部分還包含了大量啟發(fā)式規(guī)則和各種情境下的示例。

四、為什么要關(guān)注大廠的提示詞?

在 LLM 的“可控性”設(shè)計(jì)里,很多工作其實(shí)是在逆向工程它們后訓(xùn)練 / RLHF 的數(shù)據(jù)分布。

  • 你應(yīng)該用 JSON 還是 XML?
  • 工具描述要放在系統(tǒng)提示里,還是放在工具列表里?
  • 要不要包含應(yīng)用的當(dāng)前狀態(tài)?

觀察大廠在它們自家應(yīng)用里的做法,可以給你很好的參考。Claude Code 的設(shè)計(jì)非常有“主見(jiàn)”,拿來(lái)借鑒,會(huì)幫你更快地確定方向。

五、CC風(fēng)格的Agent:簡(jiǎn)單且強(qiáng)大

再?gòu)?qiáng)調(diào)一次:保持簡(jiǎn)單。復(fù)雜的腳手架框架只會(huì)讓問(wèn)題更多。

Claude Code 讓我真正相信,“Agent”其實(shí)可以既簡(jiǎn)單又非常強(qiáng)大。我們已經(jīng)把其中很多經(jīng)驗(yàn)吸收到 MinusX 里了,還在持續(xù)加入更多。

所以,把自己的 LLM 代理“Claude 化”,也許是一條不錯(cuò)的構(gòu)建和優(yōu)化路線!

如果你想要適用于 Metabase 的、可訓(xùn)練的 Claude Code 風(fēng)格的數(shù)據(jù)代理,可以看看 MinusX,或者直接約個(gè) demo。

祝你玩得開心(Claude 風(fēng)格的編程快樂(lè))!

好了文章到這里就結(jié)束了,這里小編想補(bǔ)充兩點(diǎn)。

一來(lái),其實(shí) Claude Code 偶爾也會(huì)啟動(dòng)并行的 agents,只是在有明確提示要求時(shí),會(huì)做得更好。

二來(lái),“claude.md 模式”是真的火,現(xiàn)在幾乎所有的 AI 工具都會(huì)在每次請(qǐng)求時(shí)附帶整個(gè)指令文件。據(jù)一位 Reddit 網(wǎng)友表示,這也不是 Claude Code 的新東西,幾乎可以肯定 GitHub Copilot 的指令文件早就一直是這么做的。

CC 為什么如此好用?除了簡(jiǎn)單的循環(huán)控制邏輯、提示詞用法以外,還有哪些?評(píng)論區(qū)交給各位大佬們了。

參考鏈接:

https://minusx.ai/blog/decoding-claude-code/

https://www.reddit.com/r/ClaudeAI/comments/1myw74x/analyzed_months_of_claude_code_usage_logs_tell/

責(zé)任編輯:武曉燕 來(lái)源: 51CTO技術(shù)棧
相關(guān)推薦

2025-03-11 06:00:00

SSL證書Certimate數(shù)據(jù)安全

2024-11-07 08:50:56

用戶分析分類維度標(biāo)簽

2020-01-02 14:13:01

機(jī)器學(xué)習(xí)模型部署預(yù)測(cè)

2020-10-11 21:52:10

數(shù)據(jù)AI指南

2017-10-30 09:53:05

深度學(xué)習(xí)技巧指南

2021-12-20 10:54:47

智能華為汽車

2017-11-10 17:16:53

2013-06-24 10:16:45

2025-05-14 16:39:21

2015-04-19 20:53:30

安華金和數(shù)據(jù)庫(kù)安全

2018-01-29 16:29:35

數(shù)據(jù)開發(fā)從業(yè)

2019-06-10 15:06:56

高考AI人工智能

2025-09-29 09:00:24

2022-02-28 11:26:40

模型深度學(xué)習(xí)谷歌

2019-08-16 09:55:22

Pandas編程語(yǔ)言代碼

2021-04-13 09:09:29

DevOps流程Docker

2023-06-08 08:43:36

2023-05-28 12:23:59

ChatGPT中文數(shù)據(jù)集

2018-06-14 15:34:59

深度學(xué)習(xí)GitHub機(jī)器學(xué)習(xí)

2013-05-23 13:32:30

編程攻誠(chéng)獅工程師
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)

国产成人精品亚洲午夜麻豆| 欧洲乱码伦视频免费| 一区二区三区中文字幕精品精品| 91在线国产电影| 成人免费看片98欧美| 国产伦精品一区二区三区视频| 欧美喷水一区二区| 国产一线二线三线女| 九色在线观看视频| 国产精品自拍在线| 2019亚洲男人天堂| 成人高潮免费视频| 一区二区三区四区在线看| 欧美日韩成人激情| 国产网站免费在线观看| 精品国产丝袜高跟鞋| www.色综合.com| 国产热re99久久6国产精品| 精品小视频在线观看| 第九色区aⅴ天堂久久香| 精品国产乱码久久久久久久久| 成年人在线观看视频免费| 在线网址91| 国产精品私房写真福利视频| 国产专区一区二区| 国产精品久久久久久久久久久久久久久久久久 | 天堂аⅴ在线地址8| bt欧美亚洲午夜电影天堂| 国产日韩欧美自拍| 天天操天天干天天摸| 黄页网站一区| 欧美国产日韩一区二区在线观看| 人妻熟人中文字幕一区二区| 亚洲警察之高压线| 亚洲高清一二三区| 精品人妻无码中文字幕18禁| 亚洲男女网站| 在线观看成人免费视频| 欧美三级午夜理伦三级| 少妇在线看www| 午夜欧美在线一二页| www.18av.com| 1769免费视频在线观看| 亚洲欧美日韩在线不卡| 一区二区三区不卡在线| av一本在线| 欧美国产精品中文字幕| 欧美一区观看| 黄色免费在线播放| 久久久www成人免费无遮挡大片| 国产伦精品一区二区三区高清| 亚洲国产精彩视频| 高清不卡在线观看| 国产精品二区三区| 日韩一级片免费在线观看| 粉嫩av亚洲一区二区图片| 97久久夜色精品国产九色| 国产免费黄色录像| 国产麻豆视频一区| 99视频在线播放| 黄色片一区二区| yourporn久久国产精品| 精品免费视频123区| 涩涩视频在线观看免费| 久久视频一区二区| 日韩欧美视频一区二区三区四区 | 久久精品美女视频网站 | 午夜精品国产更新| 国产在线精品91| 欧美黑人疯狂性受xxxxx野外| 欧洲激情一区二区| 午夜激情av在线| 国产高清精品二区| 精品粉嫩aⅴ一区二区三区四区| japanese在线观看| 欧美日韩xxxx| 日韩视频一区在线| 久久国产一级片| 中文精品视频| 国产精品主播视频| 国产高清免费观看| 26uuu欧美| 亚洲午夜精品久久久中文影院av| 最新黄网在线观看| 欧美日韩性生活视频| 中文字幕av不卡在线| 欧美日韩黄色| 日韩精品一区二区视频| 国产91在线播放九色| 黄色欧美成人| 国产精品日韩欧美大师| 亚洲精品国产手机| 久久九九全国免费| www.男人天堂网| 电影亚洲精品噜噜在线观看| 91精品国产91久久久久久一区二区 | 日韩视频―中文字幕| 国产精久久久久久| 乱一区二区av| 久久伊人一区| 亚洲第一图区| 欧美在线一二三四区| 免费黄色在线播放| 日韩电影免费网站| 韩国精品久久久999| 国产精品久久久久毛片| 91网站在线观看视频| 亚洲五码在线观看视频| 国产成人精品亚洲日本在线观看| 日韩一区二区在线观看视频| 亚洲综合色一区| 欧美亚韩一区| 成人黄色在线播放| 噜噜噜噜噜在线视频| 一个色妞综合视频在线观看| 色播五月综合网| 啪啪激情综合网| 欧美另类极品videosbestfree| 在线观看日本网站| bt欧美亚洲午夜电影天堂| 熟女视频一区二区三区| 91精品美女| 亚洲欧美日韩中文在线制服| 日本少妇激情舌吻| 极品少妇xxxx精品少妇| 日日噜噜噜噜夜夜爽亚洲精品| 91jq激情在线观看| 日韩视频免费观看高清完整版 | 香蕉久久一区二区不卡无毒影院| 国产美女视频免费看| 精品国产乱码| 热久久这里只有| 婷婷在线免费观看| 亚洲夂夂婷婷色拍ww47| 亚洲一区二区图片| 国产精品久久久久久| 国产精品网红福利| av资源网在线观看| 欧美视频三区在线播放| 久久只有这里有精品| 亚洲欧美成人| 另类视频在线观看+1080p| 欧美在线极品| 亚洲精品一二区| 日本中文字幕久久| 久久久久高清精品| 亚洲成人av免费看| 秋霞欧美视频| 国产日韩欧美电影在线观看| www.成人.com| 欧美高清视频www夜色资源网| 成人信息集中地| 国产麻豆成人传媒免费观看| 久久视频免费在线| 亚洲五码在线| 97视频免费在线看| 亚洲三级黄色片| 色8久久人人97超碰香蕉987| 90岁老太婆乱淫| 日韩国产欧美视频| 一区二区日本| 亚洲视频一起| 欧美与欧洲交xxxx免费观看| 男人天堂亚洲二区| 欧美性xxxxx极品少妇| 香蕉久久久久久久| 国产一区二区在线观看免费| 国产成人艳妇aa视频在线| 卡一精品卡二卡三网站乱码| 欧美一级淫片videoshd| av播放在线| 日韩精品一区二区三区老鸭窝| 精品久久免费视频| 久久精品亚洲麻豆av一区二区| 一道本在线免费视频| 欧美日韩国产欧| 免费精品视频一区| 日本一区二区三区中文字幕| 欧美成人免费一级人片100| 午夜性色福利视频| 欧美中文字幕一区二区三区亚洲| 熟女av一区二区| 99久久伊人久久99| 超碰在线公开97| 黑丝一区二区| 欧美日韩最好看的视频| 成人综合日日夜夜| 777777777亚洲妇女| 欧美日韩xx| 日韩av有码在线| 国产又黄又粗又长| 欧美日韩综合视频| 成人在线观看小视频| 91偷拍与自偷拍精品| 欧美日韩精品区别| 国产日韩精品视频一区二区三区| 久久av秘一区二区三区| 人人精品亚洲| 亚洲在线视频观看| 新片速递亚洲合集欧美合集| 欧美激情在线有限公司| 国产精品一区二区婷婷| 欧美精品一区二区三区很污很色的 | 欧美激情1区2区| 欧美午夜视频在线| 精品国产伦一区二区三区观看说明 | 国产午夜福利精品| 国产精品麻豆一区二区| 蜜桃精品成人影片| 国产成人亚洲综合a∨猫咪| 日本免费观看网站| 国产欧美短视频| 蜜臀av性久久久久蜜臀av| 成人91在线| 你懂的视频在线一区二区| 中文在线免费一区三区| 91精品国产综合久久久久久久久| 午夜欧美巨大性欧美巨大| 久久久久久18| 午夜小视频福利在线观看| 丝袜情趣国产精品| 黄色的视频在线免费观看| 精品国产乱码久久久久久久久| 国产免费一区二区三区最新不卡 | 日本黄色不卡视频| 日韩亚洲欧美中文三级| 亚洲永久精品视频| 欧美性色黄大片| 成人a v视频| 欧美日韩亚洲视频一区| 日本一二三区视频| 一区二区三区在线观看国产| 秋霞欧美一区二区三区视频免费| 欧美经典一区二区| 国产亚洲精品熟女国产成人| 91久色porny| 亚洲专区区免费| av网站一区二区三区| 亚洲精品无码一区二区| 国产mv日韩mv欧美| 妖精视频在线观看| 国内精品国产成人| 两性午夜免费视频| 国产一区亚洲一区| 日韩av福利在线观看| 精品一区二区三区免费| 三级性生活视频| 国产尤物一区二区在线| 一级黄色在线播放| 国产乱子轮精品视频| 成人免费黄色av| 国产成人免费视| 欧产日产国产精品98| 91在线视频18| 少妇真人直播免费视频| 久久女同精品一区二区| 中文字幕免费高清| 国产精品美女久久久久久久网站| 色屁屁草草影院ccyy.com| 国产精品欧美一区二区三区| 日韩在线不卡av| 亚洲综合一区在线| 国产无套粉嫩白浆内谢| 精品欧美一区二区三区| 久久精品视频5| 欧美日韩一区二区三区四区五区 | 成人精品视频网站| 老熟妇精品一区二区三区| 91免费视频大全| 婷婷丁香综合网| 亚洲综合一区在线| 中文字幕在线欧美| 欧美日韩国产三级| 亚洲欧美强伦一区二区| 亚洲精品美女久久 | 欧美激情国产日韩精品一区18| 超级白嫩亚洲国产第一| 日本精品视频网站| 国产精品成人3p一区二区三区| 粉嫩av一区二区三区免费观看 | 99精品视频网站| 伊人久久大香线蕉综合热线| 欧美牲交a欧美牲交aⅴ免费真| 秋霞影院一区二区| 国产亚洲精品成人a| 久久精品人人做| 妺妺窝人体色www婷婷| 色乱码一区二区三区88| 国产精品一区二区av白丝下载| 亚洲第一页在线| 日本中文字幕在线视频| 国模吧一区二区| 日日狠狠久久| 久久精品日产第一区二区三区| 99久久婷婷这里只有精品| 国产成人在线免费看| 国产真实乱对白精彩久久| 国产ts丝袜人妖系列视频| 成人免费在线播放视频| 久久不卡免费视频| 制服丝袜中文字幕一区| 邻居大乳一区二区三区| 欧美日韩国产成人在线观看| 992tv国产精品成人影院| av免费观看久久| 97国产成人高清在线观看| 国产精品网站免费| 国产一区二区电影| 五月天精品在线| 欧美日韩精品中文字幕| 国产丰满果冻videossex| 正在播放欧美一区| 性xxxxfreexxxxx欧美丶| 91久久偷偷做嫩草影院| 欧美电影《轻佻寡妇》| 亚洲中文字幕久久精品无码喷水| 国产成人av一区二区三区在线观看| 亚洲天堂最新地址| 色综合久久中文综合久久牛| 好吊色在线观看| 久久综合免费视频| 日韩欧美激情| 午夜精品一区二区三区四区| 免费一区视频| 黑人巨大精品欧美| 五月天中文字幕一区二区| 性生活视频软件| 久久夜精品香蕉| 免费一区二区三区四区| 日韩高清专区| 每日更新成人在线视频| 亚洲精品中文字幕在线播放| 亚洲福利视频一区二区| 午夜精品久久久久久久99| 久久成人精品一区二区三区| 一区二区三区| 综合色婷婷一区二区亚洲欧美国产| 青青草91视频| 婷婷综合在线视频| 欧美视频完全免费看| 在线观看黄av| 国产一区红桃视频| 欧美hentaied在线观看| 另类小说色综合| 国产精品拍天天在线| 又骚又黄的视频| y97精品国产97久久久久久| 久久久久伊人| 亚洲国产精品女人| 国产乱对白刺激视频不卡| 青青草手机在线观看| 日韩久久精品一区| 操喷在线视频| 精品亚洲欧美日韩| 久久动漫亚洲| 国产精品成人在线视频| 欧美日本不卡视频| 国产精品剧情一区二区在线观看| 成人有码在线视频| 欧美精品综合| 精品无码在线视频| 欧美亚洲一区二区在线| 日本免费在线视频| 99国精产品一二二线| 伊人天天综合| 中文字幕第20页| 欧美精品aⅴ在线视频| 污污的网站在线看| 久久精品99| 麻豆久久久久久久| 久久综合亚洲色hezyo国产| 亚洲国产精品一区二区久| 第四色男人最爱上成人网| 在线观看福利一区| av亚洲产国偷v产偷v自拍| 中文字幕在线天堂| 美女久久久久久久久久久| 菁菁伊人国产精品| 另类小说第一页| 夜夜嗨av一区二区三区中文字幕| 四虎成人免费在线| 国产成人在线视频| 最新欧美人z0oozo0| 真人bbbbbbbbb毛片| 欧美妇女性影城| 午夜影院在线播放| 在线国产精品网| 91亚洲精品久久久蜜桃网站| 中文字字幕在线观看| 欧美极品xxxx| 日韩欧美网址| 中文在线永久免费观看| 欧美人妖巨大在线| 婷婷电影在线观看| 伊人久久在线观看| 久久久不卡网国产精品二区| 国产91久久久| 91精品国产自产在线观看永久| 中文亚洲免费| 久久久久久久久久久久久久免费看 |