AGENTS.md Guide
AGENTS.md is Carry Code’s project-level rule configuration file that allows AI to work according to your project’s standards.
What is AGENTS.md?
Section titled “What is AGENTS.md?”AGENTS.md (Agent Rules) is a Markdown file placed in the project root that defines:
- 📝 Code standards - Your project’s coding style
- 🚫 Restrictions - Prohibited operations
- ✅ Best practices - Recommended approaches
- 🛠️ Tool preferences - Tools and tech stack to use
Why Use AGENTS.md?
Section titled “Why Use AGENTS.md?”| Advantage | Description |
|---|---|
| 🤖 Project-specific | Each project can have different rules |
| 👥 Team sharing | Team members automatically use the same standards |
| 📋 Auto-enable | AI reads automatically, no manual config needed |
| 📁 Version control - Rules can be committed to Git |
Create AGENTS.md
Section titled “Create AGENTS.md”Location
Section titled “Location”Create AGENTS.md in the project root:
your-project/├── AGENTS.md # ← Place here├── src/├── package.json└── ...AGENTS.md Format
Section titled “AGENTS.md Format”Basic Structure
Section titled “Basic Structure”# Project Rules
## Code Style- Use 2-space indentation- Use TypeScript, avoid any type- Functions must have comments
## Naming Conventions- Variables use camelCase- Constants use UPPER_SNAKE_CASE- Class names use PascalCase
## Prohibitions- Don't modify files in config directory- Don't use eval()- Don't commit sensitive information
## Best Practices- Prefer using const- Errors must be caught and handled- API interfaces must have type definitions
## Git Commit Standards- Use Conventional Commits format- Run tests before committingAdvanced Format
Section titled “Advanced Format”---name: my-project-rulesdescription: My project rulesversion: 1.0.0---
# Project Rules
...Detailed Configuration Examples
Section titled “Detailed Configuration Examples”TypeScript Project
Section titled “TypeScript Project”# TypeScript Project Rules
## Code Style- Use 2-space indentation- Enable strict mode- Never use `any` type- Use native TypeScript types
## File Organization- Components in `src/components/`- Utility functions in `src/utils/`- Type definitions in `src/types/`
## Naming Conventions- Components use PascalCase- Hooks use use prefix- Utility functions use camelCase
## Prohibitions- No `any` types- No `// @ts-ignore`- No direct DOM manipulation- No .env file commitsReact Project
Section titled “React Project”# React Project Rules
## Component Standards- Use function components- Use Hooks- Component files use .tsx extension
## State Management- Internal state use useState- Global state use Context or Redux
## Styles- Use CSS Modules- Avoid inline stylesPython Project
Section titled “Python Project”# Python Project Rules
## Code Style- Follow PEP 8- Use Black for formatting- Use type hints
## Package Management- Use Poetry or pipenv- requirements.txt must lock versions
## Testing- Use pytest- Test files in tests/ directoryHow AI Uses AGENTS.md
Section titled “How AI Uses AGENTS.md”When you ask AI to help, it automatically:
- Detects file - Checks if AGENTS.md exists in project root
- Reads rules - Parses file content
- Applies rules - Generates code according to rules
- Observes restrictions - Avoids triggering prohibited items
Example
Section titled “Example”Assume you set these rules:
## Prohibitions- Don't use var for variable declarationWhen you ask AI to write code:
You: Help me write a JavaScript function
AI will automatically use const or let, not var.
AGENTS.md vs /rule
Section titled “AGENTS.md vs /rule”| Feature | AGENTS.md | /rule |
|---|---|---|
| Scope | Current project | Global |
| Location | Project root | ~/.carry/rules/ |
| Version control | Committed with project | Local |
| Priority | Highest | Lower |
Multiple Rule Files
Section titled “Multiple Rule Files”Carry Code reads rules in priority order:
- AGENTS.md (project root) - Highest priority
- Project-level rules (
.carry/rules/) - User-level rules (
~/.carry/rules/)
Common AGENTS.md Examples
Section titled “Common AGENTS.md Examples”Minimal Configuration
Section titled “Minimal Configuration”# Project Rules
## Code Style- Use 2-space indentationFull Configuration
Section titled “Full Configuration”# My Project Rules
## Code Style- Use 2-space indentation- Use TypeScript- Functions must have JSDoc comments
## Naming Conventions- Variables use camelCase- Constants use UPPER_SNAKE_CASE
## Prohibitions- Don't use eval()- Don't commit .env
## Best Practices- Errors must be caught- Code must have testsQ: Will AGENTS.md affect all conversations?
Section titled “Q: Will AGENTS.md affect all conversations?”Only affects conversations in the current project.
Q: How to view current project rules?
Section titled “Q: How to view current project rules?”AI will indicate loaded rules at the start of the conversation.
Q: Can I skip creating AGENTS.md?
Section titled “Q: Can I skip creating AGENTS.md?”Yes. Without it, AI works in the default way.
Q: Do team members need to configure individually?
Section titled “Q: Do team members need to configure individually?”No. Just commit AGENTS.md to Git, and all team members will automatically use the same rules.
Next Steps
Section titled “Next Steps”- Approval Modes - Control AI permissions
- Command Reference - All commands
- FAQ - More help