C Claude Code Internals
| EN | ES

实用技巧

10 个从阅读 Claude Code 源代码中得出的可操作技巧。这些反映了塑造工具行为的深思熟虑的架构决策。

10 技巧 ~512K 分析的代码行 第 11 节 ANALYSIS.md
i 这些是如何发现的
这些技巧来自分析 Claude Code 源代码中的约 1,884 个 TypeScript 文件。 了解内部工作原理让你更有意地使用工具,通过理解实际架构而不是猜测。
标准技巧 值得额外关注 谨慎使用
01

Use CLAUDE.md: it shapes everything

CLAUDE.md is the first thing loaded into context and guides all of Claude's behavior. Put it at the repo root. Every rule, convention, or piece of context you write there is applied automatically on every session.

Section 1: System Prompt
02

The memory system is persistent across sessions

Claude saves things between sessions in ~/.claude/projects/<slug>/memory/. You can ask it to remember facts, preferences, or decisions and it will retrieve them in future conversations automatically.

Section 4: Memory System
03

Explore agents use Haiku: delegate searches to them

The Explore agent uses the cheaper and faster Haiku model (not your main model). For simple codebase searches, asking Claude to use the Explore agent saves tokens and money compared to the main model doing the same search.

Section 3: Agent System
04

/fast costs 6x more for the same model

Warning

Fast mode does not switch to a different model. It uses the same Opus 4.6 but with priority throughput. The cost jumps from $5/Mtok to $30/Mtok input, a 6x premium. Use it only when speed is genuinely worth the price.

Section 7: Costs
05

Auto-compact triggers at ~13K tokens from the limit

When ~13,000 tokens remain before your context limit, Claude automatically forks an agent to summarize the conversation. You can run /compact manually before hitting the limit to get a cleaner, more controlled compression.

Section 6: Context & Compaction
06

bypassPermissions skips ALL safety checks

Danger

This permission mode auto-approves every single tool call, including destructive ones like file deletion or git force-push. Only use it in fully trusted, isolated environments where you have reviewed what will run.

Section 5: Permissions
07

The YOLO classifier blocks curl, wget and ssh in auto mode

In auto permission mode, a 2-stage AI classifier blocks certain commands considered high-risk: curl, wget, ssh, git, kubectl, aws, and more. If you need these in auto mode, you must approve them manually or configure explicit allow rules.

Section 5: Permissions
08

MEMORY.md has a hard 200-line limit

Warning

The MEMORY.md index file is always loaded into context. If it exceeds 200 lines or 25KB, it is silently truncated and the excess entries simply disappear. Keep the index concise and never write memory content directly into it, only pointers to individual files.

Section 4: Memory System
09

You can define fully custom agents in markdown files

Custom agents are defined in .md files with YAML frontmatter specifying tools, model, and permission mode. Claude loads them automatically. You can build specialized agents with restricted tool sets for safer, more focused tasks.

Section 3: Agent System
10

The Verification Agent always runs in the background

The built-in Verification Agent runs after implementations and always emits a structured verdict: PASS, FAIL, or PARTIAL. It appears in red in the terminal to stand out. This makes it useful as an automated quality gate in CI/CD workflows.

Section 3: Agent System