Skip to content
Series
38 posts

Claude Code Deep Dives

Posts in the Claude Code Deep Dives series

How Claude Code Works: The Agentic Loop, Built-in Tools, and Two Safety Rails

Claude Code runs an agentic loop — gather context, take action, verify results — until the task is done. This entry to the series breaks down its five tool categories, the model/harness split, and the two safety rails: checkpoints and permission modes.

The .claude Directory, Explained: settings, rules, skills, and auto memory

Claude Code splits its configuration across the project `.claude/` folder and your home directory — 20+ file locations. Only two mental models matter: settings merge across layers and are enforced; CLAUDE.md and rules concatenate into context as guidance. And every file is committed, gitignored, or Claude-written.

How to manage Claude Code sessions: --continue, --resume, /branch, and JSONL transcripts

Claude Code writes every session line by line to a JSONL file under ~/.claude/projects/, kept for 30 days by default. This post breaks down --continue vs --resume, session naming rules, /branch fork semantics, and transcript export and cleanup settings.

Claude Code Checkpointing Deep Dive: Snapshots, the Rewind Menu, and Tracking Boundaries

Checkpointing is not git commits: Claude Code snapshots your files before every user prompt, keeps the 100 most recent per session, and deletes them after 30 days. This piece breaks down the five rewind menu options, the tracking boundaries (bash, subagents, symlinks), and how checkpoints divide labor with git.

Claude Code Workflows in Practice: Official Best Practices from Explore to Commit

Anthropic's official Claude Code best practices boil down to one constraint: manage the context window. This post reorganizes their guidance into a working loop — explore, plan mode, implement with a runnable check, verify, commit — plus prompt techniques, when to /clear vs rewind, and the five failure patterns they call out.

Claude Code settings.json Complete Guide: Five Scopes, Merge Rules, and the Keys That Matter

Claude Code reads settings from five levels — managed settings, CLI flags, project local, shared project, and user — where plain values are overridden by higher levels while list keys like permissions.allow merge across scopes. This guide covers each file's role, the allow/deny/ask rule syntax, and how to verify your settings with /status and claude doctor.

How Much Autonomy to Give Claude Code: Permission Modes, the Auto Mode Classifier, and Allow/Deny Rules

Claude Code ships six permission modes; day to day you cycle Manual, Accept edits, Plan, and Auto with Shift+Tab. On Pro/Max/Team plans, eligible interactive terminal and VS Code sessions start in auto mode by default, with a background classifier reviewing most actions and blocking force pushes, `curl | bash`, production deploys, and more by default. This post covers the four-mode spectrum, permission rule syntax, and organization-level trust config.

Claude Code Permission Modes Explained: Five Modes from Default to Auto

Claude Code has five permission modes: default (confirm each step), acceptEdits (auto-accept edits), plan (read-only planning), auto (background AI classifier review), and bypassPermissions (YOLO, skip everything). Switch with Shift+Tab or configure via settings.json. Auto mode is the sweet spot — no step-by-step confirmations, but with safety guardrails.

How Claude Code Remembers Your Project: CLAUDE.md Layers, Imports, Rules, and Auto Memory

Every Claude Code session starts with a clean context window. Three memory mechanisms carry knowledge across sessions: CLAUDE.md files loaded every session, .claude/rules/ files that load conditionally via paths frontmatter, and auto memory Claude writes itself. All CLAUDE.md layers are concatenated into context — not inherited by override. This guide covers layer behavior, @path imports, monorepo strategies with nested CLAUDE.md, and sharing one instruction file across tools via @AGENTS.md.

How to manage Claude Code's context window: startup content, per-feature costs, and the compaction trio

Claude Code loads the system prompt, MEMORY.md, CLAUDE.md, MCP tool names, and skill descriptions before you type your first word. This post breaks down the startup context, what each of six extension features costs, and how to control auto-compaction with /compact, /autocompact, and autoCompactWindow.

How prompt caching shapes Claude Code's speed and bill: prefix matching, invalidation triggers, and hit rate

Claude Code's prompt caching works by exact prefix matching: a cache read bills at roughly 10% of the standard input rate, but switching models, changing effort, enabling fast mode, toggling MCP servers, or denying an entire tool forces the next turn to reprocess everything. The TTL defaults to five minutes; the main conversation and a few helper requests on a subscription get one hour.

Claude Code Hooks: A Complete Guide to Event-Driven AI Control

Hooks are Claude Code's event system. They trigger shell commands, HTTP requests, MCP tools, or LLM evaluations automatically before/after tool execution, when a prompt is submitted, or when a task ends. Use them to block dangerous operations, run automated reviews, inject context, or write audit logs.

Claude Code Skills: A Complete Guide to Turning Repetitive Workflows into Single Commands

A Skill is an SOP written for AI. Define the steps in a Markdown file and Claude follows them. No coding required, no frameworks to learn — just write down what an experienced person would do.

How Claude Code connects to external tools: MCP scopes, transports, and auth

Claude Code connects to external tools via MCP (Model Context Protocol), with manual configuration split across three scopes: team-shared .mcp.json, personal local/user entries in ~/.claude.json, and enterprise managed config — not settings.json. This post covers claude mcp add/login flows, the transport landscape (SSE is deprecated), and tool search lazy loading.

How Claude Code Sub-agents Work: Context Isolation, Frontmatter Definitions, Background Execution, and Permission Inheritance

Sub-agents are specialized assistants that work in their own context window: a single Markdown file defines their system prompt, tools, and model. Claude delegates automatically based on the description field, or you can @-mention to force one. This post breaks down the frontmatter schema, background execution and nested spawning, permission inheritance rules, and when not to use them.

Claude Code Plugins & Marketplaces: Packaging Skills, Hooks, and MCP into One Installable Unit

Plugins add distribution, not new capabilities: they collect skills, agents, hooks, and MCP settings scattered across .claude/ into one manifest-backed directory that marketplaces can install, update, and version-pin. This post covers plugin structure, the minimal build flow, publishing a marketplace, and dependency version constraints.

Claude Code's Three-Layer Quality Defense: Hooks, Skills, and Instruction Files

Hooks are automated safety nets (blocking bad commits), Skills are interactive workflows (running checks + auto-fixing), and instruction files (CLAUDE.md / AGENTS.md) are behavioral guidelines. Each layer operates independently, but together they enable an AI agent to automatically run lint, typecheck, and build checks before every commit.

Headless and the Agent SDK: From claude -p to Programmatic Agents

claude -p turns Claude Code from an interactive terminal session into a command you can embed in scripts and CI: pipe data in, get structured JSON out with --output-format json, and skip most auto-discovery with --bare. This post focuses on CLI usage, then covers the four signals that mean it's time to switch to the Python or TypeScript Agent SDK.

Claude Code in CI/CD: @claude on GitHub Actions and the GitLab MR Flow

Put Claude Code into GitHub Actions with anthropics/claude-code-action: /install-github-app sets everything up in one command, @claude in a PR or issue comment gets bugs fixed, branches pushed, and PR creation links returned; Bedrock/Vertex/Foundry backends switch via one input with OIDC and no stored keys; the GitLab CI/CD integration (beta) mirrors it as a single .gitlab-ci.yml job where every change flows through a merge request.

How Claude Code Reviews Your PRs: Multi-Agent Analysis, REVIEW.md, and ultrareview

After GitHub PR review is configured, a fleet of agents reviews PRs according to the repo's trigger mode — 20 minutes on average, about $15–25 per review, with findings posted as inline comments on the offending lines. For larger changes, /code-review ultra launches a cloud deep review that reports independently verified bugs in 5–10 minutes at roughly $5–25 per run; Pro/Max plans include 3 free runs.

Claude Code Channels: External Events, Reply Tools, and Sender Gating

Channels are a special kind of MCP server that push CI failures, monitoring alerts, and Telegram messages directly into a running Claude Code session — and Claude can answer back through the same channel via a reply tool. This post breaks down the channel contract, two-way replies, security gates, and install requirements.

Claude Code Routines: Complete Guide to Cloud Automation — Setup, Triggers, and Real-World Examples

Routines is Claude Code's cloud automation system (formerly Cloud Scheduled Tasks). Beyond cron scheduling, you can trigger runs via API endpoint or GitHub events — scan issues, review PRs, run checks, open PRs — all while your computer is off.

Claude Code /loop: Turning AI into a Background Worker with Native Scheduling (v2.1.72+)

/loop is Claude Code's native cron feature — set schedules in plain English and let Claude monitor, auto-fix PRs, and run recurring tasks in the background. Session-scoped and expires after 7 days; for cross-session scheduling, use Routines or Desktop scheduled tasks.

How to Choose Claude Code's Multi-Agent Options: Subagents, Agent View, Agent Teams, Dynamic Workflows

The official docs split Claude Code's parallel work into 4 approaches: subagents delegate inside one session, agent view lets you supervise background sessions yourself, agent teams coordinate workers through a lead, and dynamic workflows run scripted fleets of subagents with cross-checks; file collisions are always handled by worktrees. Includes a translated comparison table and a three-question decision guide.

Claude Code Agent Teams in Practice: Team Lead, Point-to-Point Messaging, and a Shared Task Board

Agent Teams lets multiple full Claude Code sessions work as one team: a team lead assigns work while teammates each run their own context window, coordinating through point-to-point messaging and a shared task list. This post covers the three key differences from sub-agents, the trade-off between teammateMode display modes, and why token cost scales linearly with team size.

Managing Multiple Claude Code Sessions: Agent View, Dispatch, State Monitoring, and Cross-Session Messaging

`claude agents` gives you one screen listing every background session, with Needs input, Ready for review, Working, Completed, and related states managed in one table. Press Space to peek, Enter to attach. Combined with cross-session messaging (ListAgents / SendMessage, v2.1.224+), sessions can also message each other; same-machine delivery uses a local socket and never touches Anthropic servers.

How Claude Code Orchestrates Subagents at Scale: Dynamic Workflows, ultracode, and Rerunnable Scripts

Dynamic workflows let Claude write multi-agent orchestration as a JavaScript script that a runtime executes in the background — up to 1,000 agents per run, savable as a /<name> command. This piece covers trigger methods, the save-and-rerun flow, three fit scenarios (codebase audit, large migration, cross-checked research), and where they differ from Agent Teams.

How Claude Code Sees Your Browser: Chrome Integration, Console Debugging, and Form Automation

Claude Code gains browser control through the Claude in Chrome extension: read console logs and DOM state, click, type, upload files, record GIFs, and operate sites you're already signed into. The official prerequisites list Chrome, Edge, and Chromium-based browsers such as Brave, Arc, Vivaldi, and Opera, but WSL is not supported.

Delegating Coding Tasks from Slack: Claude Code in Slack and Claude Tag

A single @Claude in Slack turns a bug report into a cloud-run Claude Code session. But there are now two paths: Pro/Max stays on the original Claude Code in Slack (each session runs under an individual account), while new or migrating Team/Enterprise setups should look at Claude Tag (shared org identity, admin-configured access and spend). Check your plan before setting anything up.

How Claude Code Sandboxing Works: Sandboxed Bash, Network Allowlists, and the Threat Model of Six Isolation Approaches

Claude Code's built-in sandboxed Bash restricts every command at the OS level: writes are limited to the working directory plus session temp, while reads default to the entire machine; network traffic goes through a proxy allowlist that starts with zero domains. The switches live in the /sandbox panel and sandbox.enabled — there is no --sandbox flag. This post also compares sandbox runtime, dev containers, Docker, VMs, and Claude Code on the web to show when each heavier isolation tier earns its setup cost.

How to standardize Claude Code dev environments: devcontainer.json, CI consistency, and team rollout

Add Anthropic's official Dev Container Feature (`ghcr.io/anthropics/devcontainer-features/claude-code:1.0`) to `.devcontainer/devcontainer.json` and three steps—write the config, rebuild the container, run `claude` to sign in—put every teammate's Claude Code behind the same container definition. The same definition feeds GitHub Codespaces and CI; a five-step rollout gets the whole team there.

Managing Claude Code Costs: Token Tracking, Model Choice, Effort, and Team Analytics

Claude Code costs accumulate with context size: enterprise deployments average ~$13 per developer per active day and $150–250 per month. This post covers /usage and /insights tracking, six token-saving tactics, and a systematic answer to 'which model should I use': provider-dependent model aliases, effort levels, fast mode ($10/$50 per MTok for Opus 5/4.8), and the advisor tool.

Claude Code install and login troubleshooting: PATH, install sources, proxy, OAuth callback

Work through install and login failures in five steps: verify PATH on your OS, confirm there is only one installation, test downloads.claude.ai for a 200, recover failed OAuth callbacks by pasting the login code or using claude auth login, then finish with claude doctor.

Claude Code Runtime Troubleshooting Guide: CPU/Memory, Session Hangs, Auto-Compact Thrashing, Tables, Search Failures

Five classes of runtime fixes: diagnose high memory with /compact plus /heapdump; recover a hung session with Ctrl+C and claude --resume; write large tables to files instead of forcing terminal output; escape autocompact thrashing by reading files in chunks or running /compact with a focus; fix broken search by installing system ripgrep and setting USE_BUILTIN_RIPGREP=0.

Claude Code Config Not Taking Effect: Diagnosing with /context, /doctor, /mcp, and Error References

When CLAUDE.md rules are ignored, hooks never fire, or an MCP server shows no tools, the file usually didn't load, loaded from an unexpected location, or got overridden. This guide covers what the diagnostic entries (/context, /memory, /skills, /doctor, /mcp, and more) actually show, safe-mode bisection, and a table of six high-frequency error messages with fixes.

Claude Code Troubleshooting Index: Orders 33-35 on Install, Runtime, and Config Diagnosis

The original Claude Code troubleshooting collection has been split into orders 33-35: installation & login, runtime problems, and config diagnosis. This page is their index.

Claude Code Remote Control: Pick Up a Local Session from Any Device

Remote Control turns claude.ai/code or the Claude mobile app into a remote for your local Claude Code session: code still runs on your own machine, with MCP servers and local tools fully available, while transcript sync passes through Anthropic servers. This post covers startup, reconnection, push notifications, file delivery, and the security boundary.

Claude Code in the Cloud: on the web, --cloud/--teleport, and Steering from Mobile

Claude Code on the web runs tasks in cloud environments, Anthropic-managed VMs by default or self-hosted environments when routed there: authorize GitHub, dispatch from browser or mobile, start cloud sessions with --cloud, and pull them back local with --teleport. Research preview on Pro/Max/Team; no separate compute charge, but rate limits are shared.