跪拜 Guibai
← All articles
Artificial Intelligence

The Five-Layer Harness That Makes Claude Code Work at Million-Line Scale

By 冬哥聊AI ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Most teams treat Claude Code as a model-upgrade problem, but at scale the bottleneck is the harness that gives the agent navigational context and tool access. Skipping the five-layer setup means context windows burn on blind exploration, and without an agent manager the configuration rots as the codebase evolves.

Summary

Claude Code navigates the file system directly instead of relying on stale RAG indexes, but blind searching exhausts its context window fast. The fix is a five-layer harness that provides direction, prevents errors, loads specialized knowledge on demand, packages configurations for distribution, and connects to external tools like Jira and CI/CD. Two auxiliary capabilities—LSP for semantic code understanding and Subagents for parallel task decomposition—further extend what the agent can handle without blowing up the context budget.

Three configuration patterns emerge from successful large-scale deployments: keep CLAUDE.md concise and layered so the agent always knows where to look, review and prune configuration rules every three to six months as models improve, and assign a dedicated agent manager to maintain the toolchain. Without this role, CLAUDE.md bloats, Skills fragment, and Hooks conflict.

Six engineering trade-offs define the architect's job: commit fully to file-system navigation instead of hedging with RAG, treat CLAUDE.md as a fixed overhead to minimize, use Hooks for continuous learning rather than just guardrails, size Skills around identifiable work scenarios, restrict MCP connections to data sources directly relevant to code changes, and mandate an agent manager once the user base crosses roughly 50 developers.

Takeaways
Claude Code skips RAG indexing and navigates the live file system with grep and file reads, avoiding index drift but requiring upfront navigational clues.
The five harness layers must be built in order: CLAUDE.md (direction), Hooks (error prevention and learning), Skills (on-demand expertise), Plugins (packaging), and MCP (external tool connections).
CLAUDE.md should contain only navigation clues, hard constraints, and tacit knowledge—every extra line is a tax on the context window every session.
Hooks should capture failure patterns and reverse-precipitate them into new rules or Skills, turning the system into a dynamic learning loop.
Skills use progressive disclosure: Claude sees only a title and description until a task matches, keeping the context window free of irrelevant expertise.
LSP gives Claude semantic code understanding (definition jumping, type inference), while Subagents parallelize complex tasks and return only summaries to the main agent.
Three configuration patterns matter at scale: start Claude from a subdirectory to narrow scope, review CLAUDE.md rules every 3–6 months as models improve, and assign an agent manager to maintain the toolchain.
Six architectural trade-offs include committing to file-system navigation over RAG, minimizing CLAUDE.md fixed overhead, sizing Skills by scenario identifiability, and restricting MCP to code-relevant data sources.
Conclusions

Anthropic's five-layer prescription reframes Claude Code from a model product into a systems-integration problem—the model is the engine, but the harness is the chassis and navigation.

The insistence on a dedicated agent manager role mirrors the historical emergence of SRE and data-governance leads: new tool paradigms create new operational roles, and teams that skip this step hit a chaos ceiling around 50 users.

Progressive disclosure in Skills is a context-window optimization disguised as a knowledge-management pattern—its real job is preventing the fixed overhead of CLAUDE.md from ballooning into variable overhead.

The advice to prune CLAUDE.md as models improve inverts the typical assumption that configuration only accumulates; stronger models can make old rules actively harmful by constraining capabilities that no longer need hand-holding.

Recommending subdirectory startup rather than monorepo-root startup is a cheap architectural lever that shrinks the search space before the agent even runs, yet most teams never think to do it.

Concepts & terms
Harness
The scaffolding built around an AI coding agent—configuration files, hooks, skills, plugins, and tool connections—that directs its general capabilities toward a specific codebase. Distinct from the model itself.
Progressive Disclosure
A pattern where specialized knowledge is loaded only when a task matches a skill's trigger signals, rather than being pre-loaded into every session's context window. Keeps fixed context overhead low.
LSP (Language Server Protocol)
A protocol that gives Claude Code semantic understanding of code—definition jumping, reference finding, and type inference—instead of relying solely on text-pattern matching like grep.
Subagents
Parallel worker agents that Claude Code spawns to handle subtasks independently. Each subagent returns only a summary to the main agent, preserving the main context window for decision-making rather than raw data ingestion.
Agent Manager
An emerging operational role responsible for maintaining an AI coding toolchain: curating CLAUDE.md, abstracting team pitfalls into Skills, coordinating Hooks, packaging Plugins, and driving periodic configuration reviews.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗