AI 编程 4.0 · 优秀 2026-03-21 · 文章

你不知道的 Claude Code:架构、治理与工程实践

Tw93基于半年深度使用Claude Code的踩坑总结。提出六层架构模型,核心洞察:Claude Code不是'回答'而是反复循环的代理过程(收集上下文→采取行动→验证结果)。上下文治理是关键——200K上下文中固定开销约15-20K(MCP工具定义是最大隐形杀手,5个Server占25K tokens即12.5%)。提出上下文分层加载策略:CLAUDE.md常驻→rules按路径加载→Skills按需加载→Subagents隔离加载→Hooks不进上下文。

打开原文回到归档

你不知道的 Claude Code:架构、治理与工程实践

摘要

Tw93基于半年深度使用Claude Code的踩坑总结。提出六层架构模型,核心洞察:Claude Code不是'回答'而是反复循环的代理过程(收集上下文→采取行动→验证结果)。上下文治理是关键——200K上下文中固定开销约15-20K(MCP工具定义是最大隐形杀手,5个Server占25K tokens即12.5%)。提出上下文分层加载策略:CLAUDE.md常驻→rules按路径加载→Skills按需加载→Subagents隔离加载→Hooks不进上下文。

正文

twitter/thread ┌─────────────────────┬─────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬───────┬──────────┬──────────────────────────────────────────────────────────┐ │ Id │ Author │ Text │ Likes │ Retweets │ Url │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2032091246588518683 │ HiTw93 │ https://t.co/RTkJ3NQKeS │ 8529 │ 1936 │ https://x.com/HiTw93/status/2032091246588518683 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2040199026381816023 │ jumppshot │ @HiTw93 @readwise save thread │ 0 │ 0 │ https://x.com/jumppshot/status/2040199026381816023 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2039988636981104916 │ Sherlock_aiX │ @HiTw93 可以听的帖子太棒了! │ 0 │ 0 │ https://x.com/Sherlock_aiX/status/2039988636981104916 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2039275365504315855 │ QiQiQ666 │ @HiTw93 Claude Code uses very good articles │ 0 │ 0 │ https://x.com/QiQiQ666/status/2039275365504315855 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2037794476723482798 │ Poyang_rex │ @HiTw93 赞,我最近也在写一份 ClaudeCode 的使用总结,学到了很多使用技巧.不过我做的项目比较杂,有时候会遇到特定版本要求的移动端项目,需要重新写一份规则,对于 UI 层,业务层,基架层要做单独的"观测-决策-执行-反馈"的流程.我是把全量日志都保存下来,以便我溯源. │ 2 │ 0 │ https://x.com/Poyang_rex/status/2037794476723482798 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2037783563068911952 │ fgur673757 │ @HiTw93 又学到了 │ 0 │ 0 │ https://x.com/fgur673757/status/2037783563068911952 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2036986343595880914 │ shyb11265660 │ @HiTw93 mark │ 0 │ 0 │ https://x.com/shyb11265660/status/2036986343595880914 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2036721954036797580 │ 1117xu │ @HiTw93 写的太好了 │ 0 │ 0 │ https://x.com/1117xu/status/2036721954036797580 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2036718598740472106 │ lc_yyst │ @HiTw93 Prompt caching references the entire prompt - tools, system, and messages (in that order) up to and including the block designated with cache_control. │ 1 │ 0 │ https://x.com/lc_yyst/status/2036718598740472106 │ │ │ │ │ │ │ │ │ │ │ 应该是这个顺序? │ │ │ │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2036653830763659692 │ sakanastar_ │ @HiTw93 入门学习中,读了几遍,获益匪浅~ │ 0 │ 0 │ https://x.com/sakanastar_/status/2036653830763659692 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2036244077424037982 │ winfredwangg │ @HiTw93 您好,可以请问下“开一个 Claude 写计划,再开一个 Codex 以"高级工程师"身份审这个计划,让 AI 审 AI” 这是怎么做到吗,是让codex去claude写计划的文件夹去看计划文件吗?谢谢 │ 0 │ 0 │ https://x.com/winfredwangg/status/2036244077424037982 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2035994116757369100 │ liu42922102 │ @HiTw93 @grok 总结该文章重点发给我 │ 0 │ 0 │ https://x.com/liu42922102/status/2035994116757369100 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2035774544913608795 │ tt1026615779035 │ @HiTw93 很受教,想问下有没有国内 │ 0 │ 0 │ https://x.com/tt1026615779035/status/2035774544913608795 │ │ │ │ 公众号或者开源博客能关注呀 │ │ │ │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2035748420787556773 │ muskwarren53808 │ @HiTw93 这文章就不需要给人读了,就是给机器读的 │ 0 │ 0 │ https://x.com/muskwarren53808/status/2035748420787556773 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2035637479135756449 │ qiekeliang │ @HiTw93 这两篇真是深度看的最好的文章了,不清楚工程基础根本没法发挥cc最大的价值 │ 0 │ 0 │ https://x.com/qiekeliang/status/2035637479135756449 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2035604007348322359 │ nutunboboji │ @HiTw93 已认真拜读,思路和描述都很清晰的好文章。顺道问一下 codex 也可以遵循这套理论吗? │ 0 │ 0 │ https://x.com/nutunboboji/status/2035604007348322359 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2035593237210312815 │ telnh1 │ @HiTw93 先点赞,观摩下 │ 0 │ 0 │ https://x.com/telnh1/status/2035593237210312815 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼──────────────────────────────────────────────────────────┤ │ 2035541772508762517 │ harrysoog │ @HiTw93 @grok 对于没深入用claude的小白,通俗易懂的解释下这篇文章厉害之处是给出什么实践洞察?如何少走弯路? │ 0 │ 0 │ https://x.com/harrysoog/status/2035541772508762517 │ ├─────────────────────┼─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────┼──────────┼─────────────...

*(Content truncated to 15000 characters)*