Context is the information an AI coding agent needs to make a particular change in line with its purpose. Intent—what outcome is wanted and why—starts the selection process, but is not the whole context. Relevant domain rules, technical constraints, decisions, and verification criteria complete it. More information is not automatically better: an entire codebase or policy collection can consume the agent’s limited context window while obscuring the decisions that matter. section 1.1.2 section 1.3
Put guidance where its scope belongs:
- Keep the user need, feature-specific rule, boundary, and demonstration of success in the feature specification. section 3.3
- Keep recurring stack choices, conventions, business rules, and architectural constraints in standing context, so they need not be restated for every feature. section 3.3.1 section 4.2.1
- Move practices shared across projects into reusable skills rather than copying them into every project’s guidance. Add new standing rules as repeated experience justifies them. section 4.2.5 section 4.3.4
Listing 2.6 Example openspec config.yaml for URL Shortener
schema: spec-driven context: | Tech stack: Node.js Domain: URL shortener Conventions: Simple, dependency-free, and use built-in modules.
A small project configuration shows context made persistent: the URL shortener’s domain, Node.js stack, and dependency-free convention are supplied at the start of each agent session. section 2.4.3
A missing rule in an expiring-link change
Suppose issued shortcodes must never be reassigned. While links remain permanently stored, the database design may enforce that rule without explicit code. If an agent is asked directly to add link expiration using only the implementation as context, it may miss the reassignment ban. Revise the specification before regenerating the change; a direct fix would leave the decision in code or conversation history instead of durable context. section 3.1 section 3.1.2
Treat context as a maintained engineering artifact, not a large prompt assembled once. Extract important decisions before conversation compaction can lose them, make them available when needed, and use implementation gaps to find what the specification or workflow failed to carry. This lets later sessions work from recorded intent rather than reconstructing it from old exchanges. section 1.3 section 3.4





























