Skip to content

AI Context

Release Evidence: Canonical Route Migration

Section titled “Release Evidence: Canonical Route Migration”

A 59-second grounded release evidence walkthrough documenting the migration of this guide to the canonical ai-context route, merged into origin/main (commit 6f2bcb7, merge 0968c74 via PR #55).

MP4 video · Story manifest · English captions

Release Audit Summary: Commit 6f2bcb7 is merged into origin/main (PR #55). All 130 site pages build cleanly with 0 diagnostic issues (npx astro check: PASS). All three language routes (/guides/ai-context/, /en/guides/ai-context/, /hr/guides/ai-context/) share verified canonical and hreflang links. Edge production deployment remains a separate verification step.

A comprehensive template for getting started with context engineering: the discipline of preparing context for AI coding assistants so they have the information necessary to get the job done end to end.

Context engineering provides AI coding assistants with documentation, examples, rules, and validation criteria, rather than just a task prompt.

Terminal window
# 1. Work in the project or repository you will actually maintain
cd your-project
# 2. Create the always-loaded project contract
# Edit AGENTS.md with project-specific rules and navigation
# 3. Add examples (highly recommended)
# Place relevant code examples in the examples/ folder
# 4. Create your initial feature request
# Edit INITIAL.md with your feature requirements
# 5. Write a plan before implementation
# Record the scope, files, dependencies, and acceptance checks
# 6. Implement and verify the plan
# Use your coding agent's normal planning and execution workflow

Context Engineering goes beyond traditional prompt engineering:

Prompt Engineering:

  • Focuses on clever wording and specific phrasing
  • Limited to how you phrase a task
  • Like giving someone a sticky note

Context Engineering:

  • A complete system for providing comprehensive context
  • Includes documentation, examples, rules, patterns, and validation
  • Like writing a full screenplay with all the details
  1. Reduces AI Failures: Most agent failures aren’t model failures - they’re context failures
  2. Ensures Consistency: AI follows your project patterns and conventions
  3. Enables Complex Features: AI can handle multi-step implementations with proper context
  4. Self-Correcting: Validation loops allow AI to fix its own mistakes
your-project/
├── .agent/
│ ├── skills/ # Reusable agent procedures
│ └── commands/ # Optional harness-specific commands
├── PRPs/
│ ├── templates/
│ │ └── prp_base.md # Base template for PRPs
│ └── EXAMPLE_multi_agent_prp.md # Example of a complete PRP
├── examples/ # Your code examples (critical!)
├── AGENTS.md # Project rules and navigation
├── INITIAL.md # Template for feature requests
├── INITIAL_EXAMPLE.md # Example feature request
└── README.md # This file

This template does not cover retrieval-augmented generation (RAG) or tool integration in detail.

AGENTS.md is the project-level operating contract for coding agents. It is vendor-neutral: the same file can guide Hermes, Codex, Zot, or another agent without making the repository depend on one model provider or editor.

Keep it short enough to load on every task. Include:

  • Project identity and boundaries: what the repository owns, what it does not own, and which architecture documents are authoritative.
  • Repository map: the important directories, binaries, services, and source-of-truth files.
  • Working rules: inspect before editing, preserve unrelated work, use review branches, and never push directly to main.
  • Validation gates: the exact formatter, tests, builds, linters, and local link or metadata checks required before claiming success.
  • Platform constraints: supported operating systems, toolchain differences, and host-specific rules that an agent must not infer.
  • Documentation routing: where architecture decisions, operations, plans, and reusable procedures belong.

Put long explanations in focused documentation and reusable procedures in .agent/skills/. Use nested AGENTS.md files only when a subtree needs stricter or more specific rules. The root file should route the agent to those sources, not duplicate them.

A useful minimal starting point is:

# Project Rules
## Identity
- What this repository owns
- Canonical architecture and decision documents
## Workflow
- Read the relevant files before editing
- Work on a review branch; never push directly to `main`
- Preserve unrelated changes and secrets
## Validation
- Exact commands for formatting, tests, builds, and documentation checks
## Routing
- Architecture: `docs/wiki/`
- Plans and handoffs: `docs/plans/` and `docs/`
- Reusable agent procedures: `.agent/skills/`

Treat AGENTS.md as a routing layer and safety boundary, not as a personal diary or a second copy of the whole project manual.

Edit INITIAL.md to describe what you want to build:

## FEATURE:
[Describe what you want to build - be specific about functionality and requirements]
## EXAMPLES:
[List any example files in the examples/ folder and explain how they should be used]
## DOCUMENTATION:
[Include links to relevant documentation, APIs, or MCP server resources]
## OTHER CONSIDERATIONS:
[Mention any gotchas, specific requirements, or things AI assistants commonly miss]

See INITIAL_EXAMPLE.md for a complete example.

You can use a PRP (Product Requirements Prompt), a task brief, or an ordinary implementation plan. The format matters less than the contents:

  • Complete context and documentation
  • Implementation steps with validation
  • Error handling patterns
  • Test requirements

They are similar to PRDs (Product Requirements Documents) but are crafted more specifically to instruct an AI coding assistant.

Use the planning mechanism provided by your coding agent, or write the plan as a reviewed Markdown file:

Terminal window
# Example only: keep the plan in the repository's normal plans directory
cp INITIAL.md plans/feature-name.md

If your harness supports reusable commands, keep their instructions under .agent/commands/ or package them as a skill. Do not put provider-specific assumptions into AGENTS.md.

The planning step should:

  1. Read your feature request
  2. Research the codebase for patterns
  3. Search for relevant documentation
  4. Name the files to change and the checks that will prove the work complete

The implementation phase then follows the reviewed plan, records deviations, and runs the stated checks. A plan is useful only when it ends with evidence: tests, builds, rendered output, or another concrete acceptance result.

The coding agent will:

  1. Read all context from the plan
  2. Create a detailed implementation plan
  3. Execute each step with validation
  4. Run tests and fix any issues
  5. Ensure all success criteria are met

FEATURE: Be specific and comprehensive

  • ❌ “Build a web scraper”
  • ✅ “Build an async web scraper using BeautifulSoup that extracts product data from e-commerce sites, handles rate limiting, and stores results in PostgreSQL”

EXAMPLES: Use the examples/ folder

  • Place relevant code patterns in examples/
  • Reference specific files and patterns to follow
  • Explain what aspects should be mimicked

DOCUMENTATION: Include all relevant resources

  • API documentation URLs
  • Library guides
  • MCP server documentation
  • Database schemas

OTHER CONSIDERATIONS: Capture important details

  • Authentication requirements
  • Rate limits or quotas
  • Common pitfalls
  • Performance requirements

A good planning pass follows this process:

  1. Research Phase

    • Analyzes your codebase for patterns
    • Searches for similar implementations
    • Identifies conventions to follow
  2. Documentation Gathering

    • Fetches relevant API docs
    • Includes library documentation
    • Adds gotchas and quirks
  3. Blueprint Creation

    • Creates step-by-step implementation plan
    • Includes validation gates
    • Adds test requirements
  4. Quality Check

    • Scores confidence level (1-10)
    • Ensures all context is included
  1. Load context: Read the plan, relevant source, and local rules
  2. Implement: Change the smallest correct set of files
  3. Validate: Run the exact tests, builds, and documentation gates
  4. Review: Inspect the diff for scope, security, and stale references
  5. Iterate: Fix failures rather than weakening the checks
  6. Complete: Report evidence and remaining uncertainty

See PRPs/EXAMPLE_multi_agent_prp.md for a complete example of what gets generated.

The examples/ folder is critical for success. AI coding assistants perform much better when they can see patterns to follow.

  1. Code Structure Patterns

    • How you organize modules
    • Import conventions
    • Class/function patterns
  2. Testing Patterns

    • Test file structure
    • Mocking approaches
    • Assertion styles
  3. Integration Patterns

    • API client implementations
    • Database connections
    • Authentication flows
  4. CLI Patterns

    • Argument parsing
    • Output formatting
    • Error handling
examples/
├── README.md # Explains what each example demonstrates
├── cli.py # CLI implementation pattern
├── agent/ # Agent architecture patterns
│ ├── agent.py # Agent creation pattern
│ ├── tools.py # Tool implementation pattern
│ └── providers.py # Multi-provider pattern
└── tests/ # Testing patterns
├── test_agent.py # Unit test patterns
└── conftest.py # Pytest configuration
  • Don’t assume the AI knows your preferences
  • Include specific requirements and constraints
  • Reference examples liberally
  • More examples = better implementations
  • Show both what to do AND what not to do
  • Include error handling patterns
  • PRPs include test commands that must pass
  • AI will iterate until all validations succeed
  • This helps catch problems before you consider the implementation complete
  • Include official API docs
  • Add MCP server resources
  • Reference specific documentation sections
  • Add your conventions
  • Include project-specific rules
  • Define validation and review gates
  • Link to detailed documentation instead of duplicating it