techlist.io

Anthropic/Large Language Models

4 posts

Anthropic2026-04-233 min readCurated summary

An update on Claude Code quality reports

Anthropic investigated reports that Claude's responses had worsened in Claude Code, the Claude Agent SDK, and Claude Cowork over the past month. The company traced them to three separate changes in the product layer, not the API or inference layer, and resolved all three by April 20 (v2.1.116). Anthropic says it never intentionally degrades its models, and it is resetting usage limits for all subscribers. ## Default Reasoning Effort Lowered to Medium - On March 4, Claude Code's default effort changed from high to medium to reduce long latency that sometimes made the UI appear frozen. - In internal evals, medium was slightly less intelligent but much faster, with fewer long thinking tails and lower usage. - Users reported that Claude Code felt less intelligent. Design changes to surface the effort setting didn't stop most users from keeping medium. - Anthropic reversed the change on April 7. Opus 4.7 now defaults to xhigh effort, and other models default to high. ## Idle Session Thinking Cleared on Every Turn - A March 26 change was meant to clear old reasoning after a session had been idle for over an hour, reducing the cost of resuming it. It used the `clear_thinking_20251015` API header with `keep:1`. - A bug caused the clearing to happen on every turn for the rest of the session instead of once. Follow-up messages sent during a tool use also dropped the current turn's reasoning. - The result was a Claude that seemed forgetful, repetitive, and odd in its tool choices. Constant cache misses also likely drained usage limits faster than expected. - Two unrelated experiments hid the bug during testing, and it passed code reviews, unit tests, and end-to-end tests. Fixed April 10 in v2.1.101. - When back-tested, Opus 4.7 found the bug in Code Review when given the full repositories for context, while Opus 4.6 did not. Anthropic is adding support for more repositories as review context. ## Verbosity Limits in the System Prompt - Opus 4.7 tends to be verbose. To counter this, a system prompt addition capped text between tool calls at 25 words and final responses at 100 words, unless the task needed more detail. - The change shipped with Opus 4.7 on April 16. A broader ablation study later showed a 3% drop for both Opus 4.6 and 4.7, and the prompt was reverted on April 20. ## Process Changes Going Forward - More internal staff will use the public Claude Code build rather than pre-release builds. - Anthropic will ship its improved internal Code Review tool to customers. - Every system prompt change will get a per-model eval suite, ongoing line-by-line ablations, and new review tooling. Model-specific changes will be gated to their target models. - Changes that could trade off against intelligence will go through soak periods, broader evals, and gradual rollouts. - Anthropic launched @ClaudeDevs on X and will post matching updates in GitHub threads. Anthropic credited users who submitted reports through `/feedback` or posted reproducible examples online for helping identify the problems.

Anthropic2025-09-295 min readCurated summary

Effective context engineering for AI agents

Anthropic argues that context engineering is the natural successor to prompt engineering. Instead of only writing better instructions, engineers must curate the full set of tokens an LLM sees during inference, because models have a finite "attention budget" that degrades as context grows. As agents run longer, they need strategies such as just-in-time retrieval, compaction, structured note-taking, and sub-agent architectures to keep that context small and high-signal. ## From Prompt Engineering to Context Engineering - Prompt engineering focuses on writing and organizing instructions, particularly system prompts. - Context engineering covers everything that lands in the context window during inference: system prompts, tools, external data, message history, and more. - Agents that run in loops generate new information every turn, so context must be continually curated and refined. ## Why Context Is a Finite Resource - **Context rot:** As the token count grows, a model's ability to accurately recall information from its context declines. This happens across all models, though degradation rates vary. - **Architectural limits:** Transformers let every token attend to every other token, creating n² pairwise relationships, which stretches attention thin as context grows. - **Training skew:** Models see shorter sequences more often in training, so they have less experience with long-range dependencies. - **Gradual degradation:** Techniques like position encoding interpolation extend context length with some loss in positional precision. The result is a performance gradient, not a hard cliff. ## Anatomy of Effective Context - **System prompts:** Aim for the "right altitude," between brittle hardcoded logic and vague high-level guidance. Organize sections with XML tags or Markdown headers, and start with a minimal prompt, then add instructions based on observed failures. - **Tools:** Keep tool sets minimal and non-overlapping, since a human who can't pick the right tool can't expect an agent to either. Tools should return token-efficient output and have clear, unambiguous parameters. - **Examples:** Curate a small set of diverse, canonical few-shot examples instead of listing every edge case in the prompt. ## Retrieval: From Pre-Loading to Just-in-Time Context - Anthropic defines an agent simply as "LLMs autonomously using tools in a loop." - Embedding-based retrieval before inference is common, but agents increasingly use "just-in-time" retrieval. They keep lightweight identifiers such as file paths, stored queries, or links, and load data on demand with tools. - Claude Code analyzes large databases by writing targeted queries and using commands like `head` and `tail`, without loading full datasets into context. - Metadata such as folder names, file names, and timestamps helps agents infer purpose and relevance. A `test_utils.py` in `tests/` means something different from one in `src/core_logic/`. - **Progressive disclosure:** Agents build understanding incrementally, with each step informing the next. - **Trade-offs:** Runtime exploration is slower and needs good tool design and heuristics, or agents can waste context on dead ends. - **Hybrid approach:** Claude Code drops `CLAUDE.md` files into context up front and uses `glob` and `grep` for on-demand retrieval. Less dynamic domains like legal or finance may suit this hybrid model well. ## Context Engineering for Long-Horizon Tasks Tasks like large migrations or extended research exceed the context window, so Anthropic recommends three techniques. Waiting for bigger windows isn't enough, since context pollution and relevance problems persist at every size. ### Compaction - Summarize a conversation nearing the context limit and start a new window with the summary. - Claude Code preserves architectural decisions, unresolved bugs, and implementation details, discards redundant tool outputs, and keeps the five most recently accessed files. - Tune the compaction prompt first for recall, then for precision. - **Tool result clearing** is a light-touch form of compaction: once a tool result is deep in history, the raw output is often no longer needed. ### Structured Note-Taking - The agent writes persistent notes outside the context window and reloads them later, such as a to-do list or a `NOTES.md` file. - Claude playing Pokémon tracked training progress over thousands of steps, mapped explored regions, and kept combat notes, then resumed multi-hour sequences after context resets. - The memory tool, released in public beta with Sonnet 4.5, supports file-based storage for knowledge that persists across sessions. ### Sub-agent Architectures - A lead agent coordinates a high-level plan while specialized sub-agents handle focused tasks in clean context windows. - Each sub-agent may use tens of thousands of tokens but returns a condensed summary, often 1,000–2,000 tokens. - This pattern substantially outperformed single-agent systems on complex research tasks. ### Choosing an Approach - **Compaction:** Extensive back-and-forth conversations. - **Note-taking:** Iterative development with clear milestones. - **Multi-agent architectures:** Complex research where parallel exploration pays off. ## Conclusion The guiding principle is to find the smallest set of high-signal tokens that makes the desired outcome most likely. Anthropic expects smarter models to need less prescriptive engineering, but treating context as a finite resource will stay central to building reliable agents. Its advice is to "do the simplest thing that works."

Anthropic2025-04-186 min readCurated summary

Claude Code Best Practices

Claude Code is deliberately low-level and unopinionated, which makes it a flexible, scriptable, and safe tool but also gives it a learning curve. This Anthropic post collects patterns that work for internal teams and external engineers across many codebases. It covers how to configure the environment, extend Claude's tools, structure common workflows, and run multiple Claude instances in parallel. The author presents these as starting points to experiment with, not fixed rules. ## Customizing Your Setup - **CLAUDE.md files** are loaded automatically at the start of a conversation. They are a good place to record common bash commands, core files and utilities, code style, testing instructions, repository etiquette, environment quirks, and project-specific warnings. The format is free, but the files should be concise and readable. - **Placement** can vary. A root-level CLAUDE.md should be checked into git for team sharing, while CLAUDE.local.md is git-ignored for personal notes. Parent directories suit monorepos, child directories load on demand, and `~/.claude/CLAUDE.md` applies to every session. `/init` generates a starter file. - **Tuning** matters because these files become part of the prompt. Pressing `#` adds an instruction to CLAUDE.md, and emphasis such as "IMPORTANT" or "YOU MUST" can improve adherence. - **Tool permissions** are conservative by default. You can allow tools through the "Always allow" prompt option, the `/permissions` command, `.claude/settings.json` or `~/.claude.json`, or the `--allowedTools` flag. Examples include `Edit` and `Bash(git commit:*)`. - **GitHub integration** works best with the `gh` CLI installed, though the GitHub API or an MCP server also works. ## Giving Claude More Tools - **Bash tools:** Claude inherits your shell environment. Tell it about custom tools with usage examples, ask it to run `--help`, or document them in CLAUDE.md. - **MCP servers:** Claude Code can act as both MCP server and client. Servers can be configured per project, globally, or in a checked-in `.mcp.json` so a whole team gets them. The `--mcp-debug` flag helps diagnose configuration problems. - **Custom slash commands:** Markdown prompt templates in `.claude/commands` (shared via git) or `~/.claude/commands` (personal) become slash commands. The `$ARGUMENTS` keyword passes input through, so a `fix-github-issue.md` template can be invoked as `/project:fix-github-issue 1234`. ## Common Workflows - **Explore, plan, code, commit:** Have Claude read relevant files without writing code, then ask for a plan. Phrases like "think," "think hard," "think harder," and "ultrathink" map to increasing thinking budgets. Save the plan as a document or issue, implement it while checking the solution, then commit and open a PR. The research and planning steps are the most important, since they keep Claude from jumping straight to code. Subagents help verify details without consuming main-context space. - **Test-driven development:** Have Claude write tests from expected input/output pairs, confirm they fail, and commit them. Then have it write code that passes the tests without modifying them, iterating until they pass. Independent subagents can check for overfitting. Clear targets like tests or mockups make iteration effective. - **Visual iteration:** Give Claude a way to take screenshots (for example, through the Puppeteer MCP server) and a visual mock to match. Output typically improves noticeably after two or three iterations. - **Safe YOLO mode:** `--dangerously-skip-permissions` removes approval prompts, which suits tasks like fixing lint errors. The author recommends running it only in a container without internet access because of risks such as data loss and prompt-injection-driven exfiltration. - **Codebase Q&A:** Claude can answer onboarding questions about logging, endpoints, edge cases, or why a particular call was made, without special prompting. - **Git and GitHub:** Many Anthropic engineers use Claude for over 90% of their git work, including history searches, commit messages, rebase conflicts, PR creation, addressing simple review comments, fixing failing builds, and triaging issues. - **Jupyter notebooks:** Keep Claude Code and the `.ipynb` file open side by side in VS Code. Claude can read outputs, including images, and polish notebooks by asking for "aesthetically pleasing" visualizations. ## Optimizing Your Workflow - **Specific instructions** get better results. For example, "write a new test case for foo.py covering the logged-out edge case, avoid mocks" beats "add tests for foo.py." - **Context inputs** include pasted or dragged screenshots (on macOS, `cmd+ctrl+shift+4` copies a screenshot to the clipboard for `ctrl+v`), file paths, tab-completed file references, and URLs. Domains can be allowlisted through `/permissions`. - **Course correction** works through several controls: asking for a plan before code, pressing Escape to interrupt, double-tapping Escape to edit an earlier prompt, and asking Claude to undo changes. - **Context hygiene** comes from running `/clear` between tasks so irrelevant history doesn't crowd out the current work. - **Checklists and scratchpads** help with large tasks. For example, have Claude write lint errors into a Markdown checklist, then work through them one by one. - **Data input** can be pasted, piped (`cat foo.txt | claude`), pulled through bash or MCP tools, or read from files and URLs. ## Headless Mode and Automation - The `-p` flag runs Claude non-interactively for CI, pre-commit hooks, and build scripts. `--output-format stream-json` streams JSON output. Headless sessions do not persist. - Examples include GitHub-triggered issue triage that applies labels, and using Claude as a subjective linter to catch typos, stale comments, and misleading names. ## Multi-Claude Workflows - **Separate writer and reviewer:** One Claude writes code, then a fresh instance (after `/clear` or in another terminal) reviews it. A similar split works for tests and implementation. Scratchpads let instances pass information to each other. - **Multiple checkouts:** Some engineers run 3–4 checkouts in separate terminal tabs, each with its own task. - **Git worktrees:** `git worktree add ../project-feature-a feature-a` creates an isolated working directory for each independent task, avoiding merge conflicts. Tips include consistent naming, one terminal tab per worktree, iTerm2 notifications, and cleanup with `git worktree remove`. - **Headless fan-out and pipelines:** A script can generate a task list (such as 2,000 files to migrate) and call `claude -p` for each item with restricted `--allowedTools`. Alternatively, `claude -p ... --json` can feed into the next step of a data pipeline. The `--verbose` flag helps debugging. ## Getting Started The most practical starting point is a short, shared CLAUDE.md, followed by the explore-plan-code-commit loop with specific prompts and frequent `/clear`. The author encourages adapting these patterns to your own workflow. The post is by Boris Cherny and notes that it is no longer maintained in favor of the official Claude Code documentation.

Anthropic2024-12-196 min readCurated summary

Building effective AI agents

This post, from Anthropic, argues that the most effective LLM agent systems are built from simple, composable patterns rather than complex frameworks. It distinguishes predefined workflows from autonomous agents and advises starting with the simplest solution, adding complexity only when measured results justify it. The authors cover five workflow patterns, when to use full agents, and how to design tools for them. ### Workflows Versus Agents - Workflows orchestrate LLMs and tools through predefined code paths. - Agents let the LLM dynamically direct its own processes and tool usage, keeping control over how it accomplishes tasks. - Both are grouped as "agentic systems," but the distinction is architecturally important. ### When to Use Agents and Frameworks - Agentic systems often trade latency and cost for better task performance, so the tradeoff must be justified. - Workflows suit well-defined tasks that need predictability, while agents suit open-ended problems that need flexibility and model-driven decisions at scale. - Many applications only need a single LLM call optimized with retrieval and in-context examples. - Frameworks such as the Claude Agent SDK, Strands Agents SDK, Rivet, and Vellum simplify setup, but their abstractions can hide prompts and responses, making debugging harder and tempting developers to add unnecessary complexity. - The authors recommend starting with LLM APIs directly, and understanding the framework's underlying code if you do use one. ### The Augmented LLM Building Block - The foundation of agentic systems is an LLM enhanced with retrieval, tools, and memory, which it can use actively by generating search queries, selecting tools, and deciding what to retain. - Key considerations are tailoring these capabilities to the use case and exposing them through a clear, well-documented interface. - The Model Context Protocol is one way to integrate third-party tools using a simple client implementation. ### Core Workflow Patterns - **Prompt chaining:** Decomposes a task into sequential LLM calls, with optional programmatic "gates" between steps. It trades latency for accuracy. Examples include writing marketing copy and then translating it, or drafting an outline, checking it against criteria, and then writing the document. - **Routing:** Classifies an input and sends it to a specialized follow-up task, which separates concerns and allows specialized prompts. Examples include directing customer service queries to different processes, or sending simple questions to a smaller model like Claude Haiku 4.5 and hard ones to Claude Sonnet 4.5. - **Parallelization:** Runs LLM calls simultaneously and aggregates the outputs programmatically, in two variations: - *Sectioning* splits a task into independent subtasks, such as running a guardrail model alongside the core response model, or evaluating different aspects of a model's output separately. - *Voting* runs the same task multiple times for diverse outputs, such as several prompts reviewing code for vulnerabilities. - **Orchestrator-workers:** A central LLM dynamically breaks down a task, delegates subtasks to worker LLMs, and synthesizes the results. Unlike parallelization, subtasks aren't predefined. This suits coding tasks where the required file changes depend on the input, and multi-source search. - **Evaluator-optimizer:** One LLM generates a response while another evaluates it and provides feedback in a loop. This works best when evaluation criteria are clear and iterative refinement measurably helps, as with literary translation or multi-round search. ### Agents in Production - Agents begin with a command or interactive discussion with the user, then plan and operate independently, checking "ground truth" from the environment, such as tool results or code execution, at each step. - They can pause for human feedback at checkpoints or blockers, and should include stopping conditions, such as a maximum number of iterations. - Structurally, agents are often just LLMs using tools in a loop, so the design of toolsets and their documentation is critical. - Agents suit open-ended problems where the number of steps is unpredictable, but their autonomy raises costs and the risk of compounding errors, so extensive sandbox testing and guardrails are essential. - Anthropic's own examples include a coding agent for SWE-bench tasks and the "computer use" reference implementation. ### Combining Patterns and Guiding Principles - The patterns are not prescriptive. They are starting points to shape and combine for specific use cases. - Success depends on measuring performance and iterating. Added complexity should only be kept when it demonstrably improves outcomes. - The authors suggest three principles for agents: keep the design simple, make planning steps transparent, and carefully craft the agent-computer interface (ACI) through thorough tool documentation and testing. ### Agents in Practice - **Customer support:** Suits agents because conversations need external data (customer records, order history, knowledge base articles), actions like refunds can be handled programmatically, and success is measurable through user-defined resolutions. Some companies charge only for successful resolutions. - **Coding agents:** Suit agents because solutions can be verified with automated tests, agents can iterate on test feedback, and output quality can be measured objectively. Anthropic's agent can solve real GitHub issues from SWE-bench Verified based on the pull request description alone, though human review remains essential. ### Prompt Engineering Your Tools - Tool definitions deserve as much prompt-engineering effort as the main prompts, since Claude invokes tools through structured tool-use blocks in the API. - Some formats are much harder for LLMs to produce than others. For example, diffs require counting lines in chunk headers before writing code, and code inside JSON requires escaping newlines and quotes. - Format guidelines: - Give the model enough tokens to reason before committing to an output. - Stick to formats common in internet text. - Avoid formatting overhead like line counting or string escaping. - Designing the agent-computer interface deserves as much care as the human-computer interface. Put yourself in the model's shoes, write documentation like a docstring for a junior developer (with examples, edge cases, and input requirements), test the tools on many inputs, and "poka-yoke" them so mistakes are harder to make. - In the SWE-bench agent, the team spent more time on tools than on the prompt. Requiring absolute file paths eliminated errors that occurred after the agent changed directories. ### Practical Takeaway Start with the simplest prompts and direct API calls, and measure results carefully. Add workflows or autonomous agents only when simpler approaches fall short, and invest heavily in tool design and testing, since they largely determine whether an agent succeeds.