{"slug": "the-300-line-instruction-budget-what-actually-fits-in-your-agent-config", "title": "The 300-line instruction budget: what actually fits in your agent config", "summary": "A developer proposes a hard ceiling of roughly 300 lines for always-on agent instruction files such as CLAUDE.md, arguing that selective attention and per-request token spend cause long configs to be quietly ignored. The budget breaks down into categories like project identity, hard commands, non-negotiables, and architecture map, with file-scoped rules moved to glob-scoped configs and a CI check that fails when the always-on file exceeds the limit.", "body_md": "Ask five developers what belongs in a CLAUDE.md and you will get five files between 40 and 900 lines. The useful question is not \"what can I put in\" but \"what does the model actually follow past line N\". This article is the working answer we use: a hard ceiling around 300 lines of always-on instructions, and a budget for how to spend them.\n\nTwo mechanisms work against long instruction files:\n\n**Selective attention.** Instruction-following degrades as instruction count grows, and it degrades non-uniformly. Rules near the top and bottom of the file get followed more reliably than rules in the middle. A model given 40 constraints will violate several under cognitive load (a big refactor, an ambiguous requirement); a model given 10 will usually hold all 10. The failure is quiet: nothing tells you the model ignored rule 34. You just find the `console.log` in your PR anyway.\n\n**Token spend per request.** Always-on config is loaded into every single interaction. A 900-line CLAUDE.md is roughly 8-10k tokens. That is real context window, and in long sessions it crowds out the actual code under discussion. In agentic tools that run for dozens of turns, that cost multiplies.\n\nThe number is a working ceiling, not physics. It comes out at roughly 2,400 tokens for typical rule density, which leaves the bulk of a 200k-token window for code and conversation, and it is short enough that selective attention stays manageable. What matters more than the exact number: it must be a number. Without a ceiling, config grows to fill all available good intentions.\n\n| Budget | Lines | Content | \n|---|---|---|\n| Project identity | 10-20 | What the project is, runtime versions, package manager | \n| Hard commands | 15-25 | Build, test, lint, dev server commands, exactly as runnable | \n| Non-negotiables | 10-15 | The 5-10 rules that are genuinely always true (never commit secrets, never edit generated dirs) | \n| Architecture map | 30-50 | Directory layout with one-line \"what lives here\" per area | \n| Conventions | 40-60 | Naming, error handling, import style, test style | \n| Workflow rules | 20-30 | When to run tests, how to handle migrations, PR expectations | \n| Imports/pointers | 10-20 | `@docs/..` references to deep context loaded on demand | \n| Slack | ~50 | Growth room before you are forced to cut | \n\nThat totals 185-270 lines of core content plus slack. If you are over budget, you do not have a config problem, you have a scoping problem: rules that only apply to some files are sitting in a file that loads for all files.\n\nMost of what people write in CLAUDE.md is file-scoped by nature. Move it out:\n\n| You wrote | It actually is | Where it goes | \n|---|---|---|\n| \"API routes must return ProblemDetails\" | Applies to `src/api/**` | Glob-scoped rule | \n| \"Use testcontainers for integration tests\" | Applies to test files | Glob-scoped rule | \n| \"Component props use `interface` not`type` \" | Applies to `*.tsx` | Glob-scoped rule | \n| \"Explain the ADR process before schema changes\" | Rarely needed | On-demand doc, referenced by pointer | \n| \"Always respond in Portuguese\" | Meta-instruction | Top of file, 1 line (this one IS always-on) | \n| Your full API style guide, 120 lines | Mostly dead weight | A doc; import the 10-line summary | \n\nCursor rules give you an escape hatch the single-file formats lack: `globs` frontmatter scopes a rule to matching paths, so it only loads when relevant files are in play. That is how you keep the always-on file small without throwing away specific knowledge. See our teardown of the four config formats for where each format breaks, including the failure mode where a wrong glob means the rule never fires and nothing warns you.\n\nA budget only works if something checks it:\n\n``` bash\n#!/usr/bin/env bash\n# fail CI if always-on config grows past budget\nLINES=$(cat AGENTS.md CLAUDE.md | grep -cv '^\\s*$')\nif [ \"$LINES\" -gt 300 ]; then\n  echo \"Agent config is $LINES lines (budget: 300). Cut or scope rules.\"\n  exit 1\nfi\n```\n\nThree lines of bash. Teams that adopt a budget without a check grow past it within two months, usually during a deadline sprint when someone needs the agent to stop making the same mistake and slaps a rule at the bottom of the file. That is fine, occasionally. The check exists so it stays occasional.\n\nWe hold every kit in AgentConfig Studio under this 300-line ceiling by validation, not by policy: the harness fails a kit whose CLAUDE.md exceeds the budget, and file-scoped knowledge moves into glob-scoped rules instead. If you want config that arrives pre-budgeted for your stack, the [AgentConfig Studio on Gumroad, all 12 kits](https://piekwerk.gumroad.com/l/agentconfig-studio) lists what fits in each of the 12 kits.", "url": "https://wpnews.pro/news/the-300-line-instruction-budget-what-actually-fits-in-your-agent-config", "canonical_source": "https://dev.to/piekwerk/the-300-line-instruction-budget-what-actually-fits-in-your-agent-config-34gk", "published_at": "2026-09-17 06:01:05+00:00", "updated_at": "2026-09-17 06:23:23.243514+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools", "large-language-models"], "entities": ["Cursor"], "alternates": {"html": "https://wpnews.pro/news/the-300-line-instruction-budget-what-actually-fits-in-your-agent-config", "markdown": "https://wpnews.pro/news/the-300-line-instruction-budget-what-actually-fits-in-your-agent-config.md", "text": "https://wpnews.pro/news/the-300-line-instruction-budget-what-actually-fits-in-your-agent-config.txt", "jsonld": "https://wpnews.pro/news/the-300-line-instruction-budget-what-actually-fits-in-your-agent-config.jsonld"}}