Skip to content
MLA 023 Inside a Coding Agent: Skills, Hooks, MCP episode artwork

Apr 13, 2025 31 min

MLA 023 Inside a Coding Agent: Skills, Hooks, MCP

from Machine Learning Guide

Inside a coding agent: context is the budget, skills load on demand, hooks enforce rules, subagents get fresh windows and MCP tools cost tokens. What belongs in CLAUDE.md, and the settings that guard against a PocketOS-style deletion. Links Notes and resources at ocdevel.com/mlg/mla-23 Join the free MLG group: listen to my other AI shows, ask me questions, and talk with other listeners How a coding agent uses its context window Each turn sends the whole conversation back to the model, so every file read and test log stays in the window until you compact or clear. The instruction file, skill descriptions and MCP tool names cost tokens on every request. Skill bodies, subagent work and hooks cost nothing until used. /context shows the breakdown. Rules said only in chat can be lost to compaction; rules in the root CLAUDE.md are reloaded. What to put in CLAUDE.md or AGENTS.md Put in what the model can't derive and needs every time: exact build and test commands, conventions that differ from the default, invisible boundaries, mistakes it made twice. Leave out codebase tours: Evaluating AGENTS.md found context files raised cost over 20% without generally improving success, and overviews didn't help. Claude Code now reads AGENTS.md when no CLAUDE.md exists. The memory docs suggest under 200 lines per file. Claude Code skills vs MCP vs plugins vs subagents A skill is a folder with a SKILL.md: its description loads at startup, and its body loads when a task matches. The Agent Skills format works in Claude Code, Codex and OpenCode. Anthropic's features overview sorts the rest: outside systems connect through MCP or a CLI, noisy side tasks go to subagents, must-happen steps become hooks, and a setup shared across repositories becomes a plugin. How to stop an AI agent deleting your database In the PocketOS incident, a Cursor agent found an unscoped Railway token in an unrelated file and deleted a production volume, backups included. Keep production credentials out of the agent's reach, scope tokens, add deny rules, turn on the sandbox, and store backups elsewhere. Permission rules match command text, so a script can get around them. The sandbox is the OS-level boundary, and it's off by default. Claude Code hooks A hook is a program run at a loop event, and it fires whether or not the model remembers the rule. In Claude Code hooks, exit code 2 blocks and exit code 1 doesn't. Add lint and typecheck after every edit, and a Stop hook that holds the turn while tests fail. Subagents and worktrees A subagent runs in a fresh window and returns only a summary. Use one for noisy reads and fresh-eyes review. Each spends its own tokens; agent teams in plan mode run about 7x a normal session. Worktrees give each agent its own checkout. What is an MCP server, and what does it cost? An MCP server exposes tools to the agent over stdio or HTTP. Loading every tool up front is expensive: five servers took about 55K tokens in Anthropic's tool-use tests. Tool search cut that overhead 85% and is now on by default in Claude Code. Prefer a CLI like gh or aws where one exists. The protocol itself: MLA 28. Memory and moving between tools Claude Code's auto memory is a local per-repo folder of notes; Codex memories are opt-in. Required rules still belong in the instruction file. AGENTS.md and skills carry over between tools, while hooks and permissions have to be set up again in each one. The full course on this topic is Gnothi's Claude Code, next to the Agentic AI Course, at ocdevel.com/courses. More in the resources. Next: MLA 24, on specs, verification and the review loop.

Episode details come from the podcast's RSS feed.

Embed this episode

Ready to play

MLA 023 Inside a Coding Agent: Skills, Hooks, MCP

0:00 31:37

No transcript yet.

Requests help us decide what to transcribe next.

Frequently asked questions

How long is this episode of Machine Learning Guide?

This episode is 31 minutes long.

When was this Machine Learning Guide episode published?

This episode was published on April 13, 2025.

Can I download this Machine Learning Guide episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.