The Agentic Engineering Playbook
Engineers no longer write code — they design environments where agents do. A practical guide to agent legibility, automated invariants, and treating AI as first-class teammates.
Updated by Alex Sorokoletov
Agent output quality is set less by the model than by the harness around it: project guides, permissions, context strategy, configuration, and feedback loops.
Guides below cover the full path from first setup to multi-agent fleets, each backed by production use. Release-by-release analysis of the tools themselves lives in the version trackers. Anthropic documents the underlying files in the Claude Code settings reference; the guides cover what that reference leaves out.
The job shifts from writing code to designing the environment agents write it in. Legibility, automated invariants, and review discipline decide output quality more than any prompt.
Engineers no longer write code — they design environments where agents do. A practical guide to agent legibility, automated invariants, and treating AI as first-class teammates.
A concise CLAUDE.md, scoped permissions, and slash-command automation cut more friction than a model upgrade. The exact files and settings:
Install Claude Code with the native installer (curl -fsSL https://claude.ai/install.sh | bash, or irm https://claude.ai/install.ps1 | iex on Windows) or with npm install -g @anthropic-ai/claude-code on Node.js 22+. Native installs update themselves; run claude update to update now.
Claude Code costs $20 a month on Claude Pro ($17 a month billed annually), the cheapest plan that includes it; Max is $100 and Ultra $200. With an API key you pay per token: from $0.10 input and $0.50 output per million tokens on Haiku 5.5 to $4 and $20 on Opus 5.5. OpenRouter and Bedrock global endpoints list the same token prices; Bedrock in-region endpoints add 10%.
Install Codex CLI with curl -fsSL https://chatgpt.com/codex/install.sh | sh on macOS, Linux and WSL, the install.ps1 command in Windows PowerShell, npm install -g @openai/codex or brew install --cask codex. Then run codex and sign in with ChatGPT or an API key.
Install OpenCode with curl -fsSL https://opencode.ai/v2/install | bash or npm install -g @opencode/cli (OpenCode 2), or npm install -g opencode-ai for the 1.x line. On Windows use npm, the standalone zip or WSL. Add a provider key with /connect or opencode auth login.
Claude Code, the terminal-native, agentic coding assistant, gets exponentially more useful when you give it a concise project guide (CLAUDE.md), set sensible permissions & environment via settings.json, and automate routine actions with slash-command files. This guide packs all three into copy-ready snippets: stack-specific CLAUDE.md templates, a JIRA-driven custom workflow, permission hygiene tips, and a reflection command that continuously sharpens your guide.
Anthropic's "Building always-on agents" guide (Nov 13, 2026) splits an always-on agent into an event inbox, timers, memory, permissions and an outbox. Claude Code already has a part for each: channels and GitHub or API triggers, /loop and scheduled tasks, auto memory, auto mode and the PreToolUse defer decision, and PushNotification or a two-way channel.
I've been using the official schema from Anthropic for Claude Code settings, but one thing was missing: autocomplete for environment variables. So I built an improved schema with 50+ env vars, inline documentation, and full IntelliSense support. Plus, I'm launching a new 'Extras' section for downloadable productivity tools.
Sessions degrade before the token limit — quality drops around 70-75% capacity. Compaction has dials; most engineers never touch them.
Context window mismanagement is the number one productivity killer in Claude Code. This guide shows you how to recognize context degradation, why it happens around 70-75% capacity, and the exact strategies top engineers use to maintain peak Claude Code performance throughout long coding sessions.
Code Mode makes Claude write JavaScript that runs several tool calls in one step and returns only the output it needs. Turn it on with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in v2.1.323 or later; block it for an organization with "0" in managed settings.
Every @import in a root CLAUDE.md loads in every session, whatever the task. A CLAUDE.md in a subdirectory loads only when Claude touches a file there. Moving one 29 KB service-only doc behind a nested CLAUDE.md cut startup memory by 41%.
The Artifact tool publishes HTML pages to claude.ai, and its schema takes about 12k tokens in every interactive Claude Code session. One deny rule removes it: measured 42.5k to 30.3k at startup on v2.1.322.
A Markdown file in .claude/rules/ with a paths: list loads only when Claude reads, writes or edits a matching file. Rules shipped in v2.0.64, but loading on Write, Edit and Bash cat arrived in v2.1.288 to v2.1.293. An @import inside a path-scoped rule loads at launch and defeats the scope; symlink instead.
Control when Claude Code compacts your conversation history. Covers the ~83% cap bug, recommended values by use case, related compaction env vars, and troubleshooting. The definitive guide to CLAUDE_AUTOCOMPACT_PCT_OVERRIDE.
Claude Code compacts a 200K+ token conversation left idle for about 54 minutes, before its one-hour prompt cache expires. Turn it off with "idleCompaction": false in settings.json (v2.1.290+), or raise the threshold with CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS.
/context shows "Context is N% full. Auto-compact will soon summarize older messages. Run /compact now to choose what's kept." once the conversation reaches 80% of its auto-compact window. v2.1.327 also raises that window for a conversation whose fixed load is too big for it (autoCompactRaisedForLoad).
Interactive Claude Code sessions on a subscription can write a 5-minute prompt cache while requesting one hour. That is cache keepalive: Claude Code renews the cache every 30 seconds while you are active. Set "promptCacheTtl": "1h" to get one-hour writes instead.
The /usage breakdown in Claude Code scans the sessions saved on your machine for the last 24 hours and 7 days and shows what used most of your plan limits: cache misses, long context, subagents, max effort, parallel sessions, skills, plugins and MCP servers. Run /usage, press d or w, and press f to apply the fixes. The bars above it show the 5-hour session limit and the weekly limits.
Background agents in an interactive Claude Code session gets a 3-5 word progress label, refreshed on a 30-second timer, and each refresh can be a model call. CLAUDE_CODE_FORK_SUBAGENT=0 stops the labels for Agent-tool launches, and it also turns off fork agents and forced background launches.
Claude Code ships hundreds of environment variables; most never reach the docs. The full reference, plus fixes for the common proxy and Bedrock failures.
CLAUDE_CODE_ATTRIBUTION_HEADER controls the x-anthropic-billing-header in Claude Code API requests. Setting it to 0 fixes Bedrock 400 errors and broken prompt caching with proxies like claude-code-router and liteLLM. Plus: the critical difference between this env var and git attribution settings.
--client-data-url points Claude Code at a signed configuration document on downloads.claude.ai with per-model settings. Claude Code exits when the document has no entry for your model; from v2.1.302, --allow-other-models starts it without that model's settings.
With CLAUDE_CODE_USE_VERTEX=1 and CLAUDE_CODE_SKIP_VERTEX_AUTH=1, Claude Code does not re-run apiKeyHelper when a gateway answers 401. Keep CLAUDE_CODE_API_KEY_HELPER_TTL_MS well below the token lifetime, resend once after an idle gap, or point the gateway at Claude Code's Anthropic API mode.
Claude Code v2.1.314 adds response comparison: on some turns it may show two answers to one message and ask which is better. Turn it off with "responseComparisonEnabled": false in settings.json, or with CLAUDE_CODE_DISABLE_RESPONSE_COMPARISON=1.
Fable 5.2 missing from the Claude Code /model picker or the VS Code extension? DISABLE_TELEMETRY also turns off feature flags, so the picker shows Fable 5.1. Fix it with /model claude-fable-5-2, a modelPicker row, or by unsetting DISABLE_TELEMETRY.
Claude Code 2.1.323 removed the subagentStatusLine setting. The key still loads, but its command never runs, so custom agent rows fall back to the default look. Pin 2.1.322 to keep them, or show subagent data in your main statusLine.
/plugin enable cc-plugin-you-should-know@builtin turns on a side agent that re-reads long turns every 6 steps and flags what you might miss. It needs v2.1.287+, the first-party API and feature flags; each check bills tokens. How to turn it on and off, and why it says it isn't installed.
The claude.ai Meetings connector fails in Claude Code because its sign-in never asks for user:projects:read, and /login asks for the same scopes again. Use Meetings in claude.ai or Claude Desktop, and deny mcp__claude_ai_Meetings so Claude stops calling it.
The /goal command sets a completion condition and Claude keeps working toward it without a prompt each turn. A separate model checks the condition after every turn, so the session stops at the goal instead of asking "should I also fix this?". Clear it with /goal clear.
Type /plan or press Shift+Tab to put Codex CLI in Plan mode: it explores, asks questions and proposes a plan without editing files. Auto review (approvals_reviewer = "auto_review", or --approve-for-me) sends approval prompts to the codex-auto-review model. Auto mode is workspace-write plus on-request.
What a coding agent can leak and where: your account email in request headers, secrets saved into permission rules and committed, and the certificate settings behind a corporate proxy.
"Yes, and don't ask again" saves the approved command as a permission rule in .claude/settings.local.json. A password typed into that command lands in the file, and the file gets committed when the repo has no .gitignore entry for it. How to find it, remove it, rotate it, and stop it.
Claude Code gives the model your account email in every session signed in with a Claude account, and the model sometimes writes it into a User-Agent as a contact address. Update to v2.1.317+, keep the built-in privacy check on, and add a PreToolUse hook that blocks your address.
Claude Code trusts the bundled and system CA stores. Behind a TLS-inspecting proxy, add its root with NODE_EXTRA_CA_CERTS. From v2.1.303, Claude Code refuses the four eMudhra emSign roots from every store, so hosts chained to them fail with SELF_SIGNED_CERT_IN_CHAIN.
ip_reminder is a copyright reminder that Anthropic's API adds to some turns after the request leaves Claude Code. Claude Code 2.1.322 did not add it, it is not in any Claude Code release, and no setting turns it off.
An MCP server's instructions, tool descriptions and tool results all reach Claude as text, so a server can ask Claude to keep something from you. RunPod's server and Notion's hosted server did that in November 2026. How to find it in your transcripts, deny one MCP tool, and flag such text with PostToolUse and PostToolUseFailure hooks.
Debug flags, log directories, and undocumented switches show what the agent actually did — not what it reported.
Claude Code versions 2.0.22 through 2.0.25 had nasty bugs. Instead of waiting for a fix, I dug into the source code and found powerful undocumented environment variables for debugging, autocompaction, and log control.
Claude Code v2.1.317 shows "Your own Claude Code hooks aren't running in this session" when the program that started it set CLAUDE_CODE_RESTRICT_PERSONAL_CONFIG and CLAUDE_CODE_PERSONAL_HOOKS_OFF. Start claude yourself without those variables to get your hooks back.
Codex shows "stream disconnected before completion" when the model response ends before response.completed and 5 automatic retries fail. The text after the colon names the cause. For a custom provider, raise stream_max_retries and stream_idle_timeout_ms in config.toml.
One well-harnessed agent is table stakes. Parallel fleets compound the leverage and introduce failure modes single sessions never hit.
Gas Town is Steve Yegge's toolkit for running multiple AI coding agents in parallel. I tried it. Here's what happened: the Mayor, the polecats, the freaky feeling, and 20+ tasks on a $100 Claude plan.
The environment built around a coding agent: project guides like CLAUDE.md, permission allowlists, environment variables, a context management strategy, and the feedback loops — tests, linters, crash reports — that let the agent verify its own work. Harness quality, not model choice, separates reliable agent output from unpredictable output.
Context quality drops before the technical token limit — noticeably around 70-75% capacity. System prompts and accumulated conversation consume the budget, and each compaction dilutes earlier context. One task per context, deliberate /clear and /compact usage, and tuned compaction thresholds keep sessions sharp.
Build and test commands, tech stack constraints, coding conventions, and project rules the agent cannot infer from code. Every line costs context in every session — keep it concise and split details into referenced docs the agent loads on demand.
permissions.allow patterns in settings.json — global in ~/.claude/settings.json, per-project in .claude/settings.json. Tools exist that scan session history and propose a safe allowlist in bulk instead of hand-writing patterns.
They work, but they are internals: any release can change or remove them without notice. Use them for debugging and tuning, track releases if one becomes load-bearing, and prefer documented settings when an equivalent exists.
We test the tools so you don't have to. Browse the full blog or get in touch to talk about your team's setup.