Agents Documentation
Defines mandatory structure, headings, and validation rules for agent markdown files in a multi-agent repository.
What this file does
Defines mandatory structure, headings, and validation rules for agent markdown files in a multi-agent repository.
When to use it
- Standardising agent documentation across a team or monorepo
- Enforcing required sections and heading order in markdown files
- Automating validation of agent file paths and YAML metadata
- Onboarding new agents with a consistent template and versioning
Assumes this stack
Agents Documentation
Overview
This document defines the rules and structure for agent files in the Agent Factory repository. All agents MUST follow these rules to ensure consistency and maintainability.
Rules for Agent Files
MUST Requirements
-
Flexible File Structure: Agent files MUST be stored under the
agents/directory and MAY be nested in subdirectories. Allfile_pathvalues inagents.yamlMUST point to existing files.- Test: Verify all agent file paths defined in
agents.yamlexist - Pass: Every referenced file exists
- Fail: Any referenced file is missing
- Test: Verify all agent file paths defined in
-
Required Headings: All agent files MUST include the following headings in order:
## Purpose- What the agent does## Inputs- What data/parameters the agent requires## Outputs- What the agent produces## Behavior- How the agent operates## Constraints- Limitations and boundaries- Test: Parse markdown files and verify all headings are present
- Pass: All required headings exist in the correct order
- Fail: Any required heading is missing or out of order
-
Tags: All agent files MUST have at least one tag defined in the agents.yaml file
- Test: Verify each agent in agents.yaml has tags array with at least one entry
- Pass: All agents have 1+ tags
- Fail: Any agent has zero tags
-
Unique IDs: All agents MUST have a unique identifier in agents.yaml
- Test: Check for duplicate IDs in agents.yaml
- Pass: All IDs are unique
- Fail: Duplicate IDs found
-
File Path Validation: All agent file_path values in agents.yaml MUST point to existing files
- Test: Check that all referenced files exist
- Pass: All files exist
- Fail: Any referenced file is missing
-
No Fabrication: Agent documentation MUST NOT fabricate citations, results, or data. All references MUST be verifiable.
- Test: Manual review or citation validation
- Pass: All citations are verifiable
- Fail: Fabricated or unverifiable citations found
SHOULD Requirements
- Descriptive Names: Agent names SHOULD be descriptive and clearly indicate their purpose
- Version Control: Agents SHOULD include semantic version numbers
- Examples: Agent documentation SHOULD include usage examples
- Change History: Changes to agents SHOULD be documented in CHANGELOG.md
MAY Requirements
- Additional Metadata: Agents MAY include additional custom metadata fields
- External Resources: Agents MAY reference external documentation or resources
- Diagrams: Agent documentation MAY include diagrams or flowcharts
- Performance Notes: Agents MAY document performance characteristics
Agent File Template
# Agent Name
## Purpose
Describe what this agent does and why it exists.
## Inputs
- Input 1: Description and format
- Input 2: Description and format
## Outputs
- Output 1: Description and format
- Output 2: Description and format
## Behavior
Describe how the agent processes inputs to produce outputs.
1. Step 1
2. Step 2
3. Step 3
## Constraints
- Constraint 1: Description
- Constraint 2: Description
## Tags
Tags are defined in agents.yaml and help categorize this agent.
## Version History
- v1.0.0 (2026-01-28): Initial version
Validation Process
To validate agent files, run the following checks:
-
Structure Check: Verify all referenced agent files exist
grep 'file_path:' agents.yaml | awk '{print $2}' | tr -d '"' | while read -r path; do [ -f "$path" ] || echo "FAIL: Missing $path" done -
Heading Check: Verify required headings exist in correct order
for file in agents/*.md; do # Check presence of all required headings grep -q "## Purpose" "$file" && grep -q "## Inputs" "$file" && grep -q "## Outputs" "$file" && grep -q "## Behavior" "$file" && grep -q "## Constraints" "$file" || echo "FAIL: Missing headings in $file" # Check heading order (Purpose < Inputs < Outputs < Behavior < Constraints) purpose_line=$(grep -n "^## Purpose" "$file" | cut -d: -f1) inputs_line=$(grep -n "^## Inputs" "$file" | cut -d: -f1) outputs_line=$(grep -n "^## Outputs" "$file" | cut -d: -f1) behavior_line=$(grep -n "^## Behavior" "$file" | cut -d: -f1) constraints_line=$(grep -n "^## Constraints" "$file" | cut -d: -f1) [ "$purpose_line" -lt "$inputs_line" ] && [ "$inputs_line" -lt "$outputs_line" ] && [ "$outputs_line" -lt "$behavior_line" ] && [ "$behavior_line" -lt "$constraints_line" ] || echo "FAIL: Headings out of order in $file" done -
YAML Validation: Validate agents.yaml structure
# Requires yq or similar YAML parser yq eval '.agents[].id' agents.yaml | sort | uniq -d | grep . && echo "FAIL: Duplicate IDs" || echo "PASS"
Adding New Agents
To add a new agent:
- Ensure the
agents/directory exists (create it if needed:mkdir -p agents) - Define the agent in
agents.yamlwith all required fields - Create the agent markdown file under
agents/(subdirectories allowed) - Ensure all required headings are present
- Add appropriate tags from the allowed list
- Run validation tests
- Document the addition in
decisions.md
Note: The agents/ directory MUST exist before you reference agent files in agents.yaml. If you define an agent in agents.yaml before creating the directory, the validation script will report an error.
Modifying Existing Agents
When modifying agents:
- Update the agent definition in
agents.yamlif metadata changes - Update the markdown file with changes
- Increment the version number
- Document changes in the agent's version history
- Record the decision in
decisions.md
Append-Only Files
The following files are append-only and MUST NOT have content removed or modified (only additions at the end):
specs.md- Technical specifications and requirementsagent_runs.md- Log of agent execution runsdecisions.md- Architectural and design decisions
Markdown Output Preference
All agent outputs and documentation SHOULD be in Markdown format for consistency and readability.
What's inside
6 MUST rules, 4 SHOULD rules, 4 MAY rules, a template, 3 validation scripts, and an append-only policy
Change this for your project
- Replace
agents/with your own agent directory path - Replace
agents.yamlwith your own metadata filename - Replace
decisions.mdwith your own append-only file name
Where it goes
Save as AGENTS.md in your repository root. Read by Codex, Cursor and other agents that follow the AGENTS.md convention.
Worth borrowing
- Separating MUST, SHOULD, and MAY requirements to clarify enforcement levels
- Embedding test pass/fail criteria directly alongside each rule
Related Documents
Browser-only development
Guides AI assistants on an Electron + React + TypeScript desktop app for browsing and organizing AI-generated images locally.
Claude Agents — Reference & Recommendations
Catalogues 40+ Claude agents and marketing skills for building a cat adoption charity landing page, with a ready-to-paste prompt and backend API reference.
Golden DKG Prototype -- Master Plan
Defines an 8-phase implementation plan for a Rust prototype of the Golden non-interactive DKG protocol using BLS12-381 and tokio.
Swarms Examples Index
Lists 60+ example scripts for building single and multi-agent systems with the Swarms framework, organized by category and use case.