Anthropic Just Dropped a Masterclass on Building Agent Harnesses — Deep Dive

Cole Medin ~28:10 Watch on YouTube ↗

Overview

Cole Medin breaks down Anthropic's blog post on using Claude Code in large codebases. The key thesis: the harness (AI layer) matters as much as the model. He covers 7 strategies for building an effective AI layer, demonstrates each with a concrete demo codebase, and shares a Claude plugin that bundles the most useful strategies for immediate use.

1 The Problem — Large Codebases ▶ 0:00

Coding agent tutorials rarely address large codebases (tens to hundreds of thousands of lines). Strategies that work for simple projects fail as complexity grows. Anthropic published an article covering how Claude Code is used in enterprise environments: multi-million line monorepos, legacy systems, distributed architectures spanning dozens of repos.

Key insight: Claude Code uses agentic search — no RAG, no indexing, no semantic search. It navigates codebases like an engineer would, using CLI tools (grep, directory structure). Trade-off: works best when it has enough starting context to know where to look.

2 The Core Thesis — Harness > Model ▶ 2:58

The harness matters as much as the model. The "AI layer" is a third component of every codebase alongside code and tests. It includes: global rules, skills, MCP servers, sub-agents, hooks, LSP, and plugins. Each of the 7 components maps to a strategy.

Diagram concept: Code + Tests + AI Layer = Modern Codebase

3 Strategy 1 — Lean & Layered Global Rules ▶ 4:17

Global rules (CLAUDE.md) are the foundation — they dictate behavior the entire session.

Pro tip: Initialize Claude Code in a subdirectory when you know exactly where to work (from a Jira ticket/GitHub issue). This scopes the working directory and loads only relevant rules.

4 Strategy 2 — Codebase Maps ▶ 8:08

When the directory structure doesn't tell the whole story, build a codebase map in your global rules: outline subdirectories with brief descriptions. This helps Claude discover which slice of the codebase to focus on based on the current task.

5 Strategy 3 — Self-Improving Hooks ▶ 10:30

Hooks are usually used defensively (blocking edits to certain directories). But their more valuable use is continuous improvement.

Two hook types demonstrated:

"It's really bad when your CLAUDE.md goes stale." The stop hook creates a self-reflection process that constantly proposes updates.

6 Strategy 4 — Path-Scoped Skills ▶ 15:23

Skills = reusable workflows loaded on demand (progressive disclosure). In large codebases, you may have dozens or hundreds of task types.

Critical feature most people miss: skills can be scoped to specific paths using the path parameter. Example: an "add API routes" skill only activates when editing files in the API services directory.

Distinction: Global rules (CLAUDE.md) = conventions and rules. Skills = workflows and processes.

7 Strategy 5 — LSP via MCP Server ▶ 17:17

For massive codebases (100K+ lines), grep alone is slow and token-inefficient. Solution: expose a Language Server Protocol through a local MCP server.

This gives Claude the same navigation developers have in their IDE:

Demo ▶ 19:44: "Find every place monthlyTotalSense is referenced" — using where_is and find_references tools instead of grep. Result: 1 definition, 2 references with precise locations.

8 Strategy 6 — Sub-Agents for Exploration ▶ 21:59

Use sub-agents to split exploration from editing. Exploration tasks (web research, codebase discovery) can consume hundreds of thousands of tokens. If the primary session does this, the context window is bloated before editing even begins.

9 Strategy 7 — The Claude Plugin ▶ 24:15

Cole built a Claude plugin bundling the key strategies for immediate use in any codebase:

Installation: /plugin marketplace add <repo-path>/tooling then /plugin install helpline-ai-layer@helpline-tooling

Alternative: clone the demo repo, point Claude Code at it, and say "help me understand these strategies and incorporate them for my codebase."

10 Enterprise Adoption Advice ▶ 26:23

Anthropic's advice for organizations:

🎯 Key Takeaways

  1. The harness (AI layer) matters as much as the model itself
  2. Keep global rules lean — studies prove bloated rules hurt performance
  3. Layer rules with subdirectory CLAUDE.md files for progressive disclosure
  4. Use stop hooks for self-improving CLAUDE.md maintenance
  5. Scope skills to specific paths — don't overwhelm with irrelevant context
  6. LSP via MCP gives Claude IDE-level navigation for large codebases
  7. Sub-agents should handle exploration; keep the primary session for editing
  8. A dedicated team should champion AI layer adoption for organizations
  9. "A focused agent is a performant agent" — context engineering is about just the right things
  10. The AI layer is now the third component of every modern codebase

⏱ Timestamp Index

▶ 0:00 Introduction: the large codebase problem
▶ 0:47 Anthropic's blog post overview
▶ 2:01 Agentic search: how Claude navigates
▶ 2:58 Core thesis: harness > model
▶ 3:31 The AI layer diagram: 7 components
▶ 4:17 Strategy 1: Lean & layered global rules
▶ 5:54 Subdirectory CLAUDE.md files
▶ 7:03 Initializing in subdirectories
▶ 8:08 Strategy 2: Codebase maps
▶ 10:30 Strategy 3: Hooks for self-improvement
▶ 11:57 Start hook demo: Git context loading
▶ 12:54 Stop hook demo: CLAUDE.md updates
▶ 15:23 Strategy 4: Path-scoped skills
▶ 16:30 Rules vs workflows distinction
▶ 17:17 Strategy 5: LSP via MCP server
▶ 19:44 MCP server demo: symbol search
▶ 21:59 Strategy 6: Sub-agents for exploration
▶ 24:15 Strategy 7: The Claude plugin
▶ 26:23 Enterprise adoption advice
▶ 27:52 Conclusion