# 一星期內全球確立的 6 個 AI 代理開發原則 > Author: Tony Lee > Published: 2026-02-08 > URL: https://tonylee.im/zh-HK/blog/six-principles-ai-agent-context-engineering/ > Reading time: 1 minutes > Language: zh-HK > Tags: ai, AI代理, 上下文工程, 開發工具, 生產力 ## Canonical https://tonylee.im/zh-HK/blog/six-principles-ai-agent-context-engineering/ ## Rollout Alternates en: https://tonylee.im/en/blog/six-principles-ai-agent-context-engineering/ ko: https://tonylee.im/ko/blog/six-principles-ai-agent-context-engineering/ ja: https://tonylee.im/ja/blog/six-principles-ai-agent-context-engineering/ zh-CN: https://tonylee.im/zh-CN/blog/six-principles-ai-agent-context-engineering/ zh-TW: https://tonylee.im/zh-TW/blog/six-principles-ai-agent-context-engineering/ ## Description 2026 年初,上下文工程成為 AI 界最熱門話題。如果你正在開發 AI 代理但不懂這些原則,你將在 2026 年落後於人。這是全球 AI 社群在短短一週內建立的精華總結。 ## Summary 一星期內全球確立的 6 個 AI 代理開發原則 is part of Tony Lee's ongoing coverage of AI agents, developer tools, startup strategy, and AI industry shifts. ## Outline - 動態管理上下文,不要靜態處理 - 規劃就是一切 - 圍繞 Bash 和程式碼生成設計工具 - 擁抱循環 - 採用多模型策略 - 用分層記憶體管理狀態 - 總結 ## Content 2026 年一開始,上下文工程(Context Engineering)就成為 AI 界最熱門的話題。 結論很明確:如果你正在開發 AI 代理,但不知道這些原則,你將在 2026 年落後於人。以下是全球 AI 社群在短短一週內建立的精華。 ## 動態管理上下文,不要靜態處理 靜態上下文的時代已經過去。 - **Manus**:將檔案系統當作外部記憶體,只保留 URL 和路徑,按需還原完整內容。KV-Cache 命中率是核心指標 - **Cursor**:推出 Dynamic Context Discovery,將 MCP 工具描述同步到資料夾,token 用量減少 46.9% - **Context7**:伺服器端重新排序將上下文 token 減少 65%,延遲降低 38%,同時實際提升了輸出質素 當你的上下文是一個活生生、會呼吸的系統,按需載入和卸載資訊時,你就不用再為不需要的 token 付費 - 而且模型會更專注於重要的事情。 ## 規劃就是一切 收到模糊指令就馬上執行的代理注定失敗。 - **Claude Code 的 AskUserQuestionTool**:像顧問一樣訪問用戶,提出針對性問題,在寫任何一行程式碼之前,盡量澄清需求 - **Plan Mode**:執行前先將計劃寫入 markdown 檔案。80% 的結果在規劃階段已經決定 最好的 AI 輔助程式碼不是來自更好的提示詞,而是來自更好的計劃。 ## 圍繞 Bash 和程式碼生成設計工具 在構建自訂工具之前,先考慮 Bash 和 Codegen。 - **Bash**:可組合、上下文負擔輕,並立即存取現有軟件 - ffmpeg、jq、grep 以及成千上萬的工具 - **Codegen**:核心是 API 組合。問天氣,代理就會寫一個直接呼叫 Weather API 的腳本 權衡:自訂工具(穩定,高上下文成本)vs. Bash(可組合,需要發現時間)vs. Codegen(靈活,執行時間較長)。 ## 擁抱循環 不要期望第一次就得到完美結果。 - **Claude Code 的 Ralph Wiggum skill** 和 **Recursive Language Models (RLM)**:最大化自我修正循環是質素的關鍵 - 任務越可驗證,這個方法就越有效。如果你能驗證輸出,就能迭代到完美 單次提示是個陷阱。AI 代理的真正威力在於允許它們嘗試、失敗、評估,然後再試一次。 ## 採用多模型策略 試圖用單一模型解決所有問題是低效的。 - **Claude Opus 4.5**:端到端規劃和複雜開發 - **Gemini 3 Pro**:前端實作、大規模文件處理 - **GPT-5.2**:除錯和抽象推理 - 根據任務將子代理路由到最佳模型,兼顧速度和專業性 沒有任何單一模型在所有方面都出色。致勝策略是模型路由 - 將每個任務匹配到最適合它的模型。 ## 用分層記憶體管理狀態 任務進度和錯誤必須系統化管理。 - **Manus 的 todo.md**:在上下文末尾反覆插入目標,解決「迷失在中間」的問題 - **記憶體分離**:短期(工作上下文)、中期(會話歷史)、長期(檔案系統) - 保留失敗動作和堆疊追蹤,防止模型重複犯同樣錯誤 沒有結構化記憶體,代理會迷失方向。有了它,它們就能跨會話積累知識。 ## 總結 在 2026 年,我們已經超越了只會回答問題或自動化簡單工作流程的代理。我們現在正在構建能執行真正複雜工作的代理。 這六個原則已經在 Manus、Cursor 和 Claude Code 的生產環境中得到驗證。如果你不應用它們,你的競爭對手會。 ## Related URLs - Author: https://tonylee.im/en/author/ - Publication: https://tonylee.im/en/blog/about/ - Related article: https://tonylee.im/zh-HK/blog/medvi-two-person-430m-ai-compressed-funnel/ - Related article: https://tonylee.im/zh-HK/blog/claude-code-layers-over-tools-2026/ - Related article: https://tonylee.im/zh-HK/blog/codex-inside-claude-code-openai-plugin-strategy/ ## Citation - Author: Tony Lee - Site: tonylee.im - Canonical URL: https://tonylee.im/zh-HK/blog/six-principles-ai-agent-context-engineering/ ## Bot Guidance - This file is intended for AI agents, search assistants, and text-mode retrieval. - Prefer citing the canonical article URL instead of this text endpoint. - Use the rollout alternates when you need the same article in another prioritized language. --- Author: Tony Lee | Website: https://tonylee.im For more articles, visit: https://tonylee.im/zh-HK/blog/ This content is original and authored by Tony Lee. Please attribute when quoting or referencing.