AGENTS.md and RULES.md — files that GitHub Copilot, Cursor, Claude, and other AI tools read to align their suggestions with your project’s specific stack, conventions, and security requirements.
What the Context Factory generates
AGENTS.md
Defines the AI agent’s role, stack, responsibilities, and the Golden Rules it must follow. Copilot and Claude read this file to understand what kind of project they are working on and what constraints apply.
RULES.md
Encodes your project’s coding standards, naming conventions, security rules, and prohibited patterns. AI tools use this to produce code that is immediately consistent with your architecture without manual correction.
AGENTS.md describes your actual tech stack and domain — not a generic template.
How it ties into the Guided Architectural Workflow
The Context Factory output is the last step of a six-phase process:AGENTS.md is written, the LLM has access to 22 prior documents in its RAG context window — the tech stack decisions, security policies, testing strategy, and roadmap are all known. This eliminates the hallucination risk that comes from generating role definitions before the architecture is decided.
Context directory structure
All documents generated by the workflow — including the Context Factory outputs — are written into thecontext/ directory at the root of your project:
AGENTS.md format
AGENTS.md follows a structured format that AI tools can parse reliably. The generated file includes:
- Agent identity — name, role, and primary stack (populated from
TECH_STACK_DECISION) - Key capabilities — responsibilities mapped to the architecture layers defined in
PROJECT_STRUCTURE_MAP - Golden Rules — behaviour constraints derived from
SECURITY_PRIVACY_POLICYandARCH_DECISION_RECORDS - Prohibited actions — hard restrictions on cloud calls, hardcoding, and framework coupling
- Testing strategy — coverage targets and TDD cycle from
TESTING_STRATEGY - CI/CD pipeline rules — pre-commit hooks and quality gates from
CI_CD_PIPELINE
TECH_STACK_DECISION selected Flutter and FastAPI, AGENTS.md will list those as the target stack and enforce their specific conventions.
RULES.md format
RULES.md encodes the project’s development standards as machine-readable rules. It is generated from TECH_STACK_DECISION, ARCH_DECISION_RECORDS, and SECURITY_PRIVACY_POLICY. Typical sections include:
- Design rules — component boundaries, layer dependencies, naming conventions
- Code style — formatter settings, linting rules, language-specific idioms
- Security rules — input sanitization requirements, prohibited APIs, secret handling
- Git workflow — branching strategy, commit message format, PR process
Triggering Context Factory generation
Context Factory documents are generated through the same chat interface as every other workflow step. When you reach Phase 6, send a request with the correspondingdoc_type:
AGENTS.md content, starting with the path line:
**Path:** header. Once saved, the document becomes part of project_context for all subsequent requests, ensuring future documents remain consistent with the agent definition.