agentleFS
scottweissscottweiss/claude-codex-mcp-starter/AGENTS.md

claude-codex-mcp-starter

AGENTS.md39 starsChanged 9 months agoMITView on GitHub

This document defines how AI assistants collaborate effectively in your codebase. Use this template when delegating tasks between agents:

  • Reads credentials
  • Deletes or force-pushes
  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

12 rules. About 1 is common, 10 are distinctive, and 1 is very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use each agent's strengths where they shine

    line 8
  2. Distinctive:

    When delegating between agents:

    line 39
  3. Distinctive:

    Use this template when delegating tasks between agents:

    line 55
  4. Distinctive:

    Always use consistent path references:

    line 201
  5. Distinctive:

    Before marking task complete:

    line 230
  6. Distinctive:

    Commits: No auto-commits/branches unless explicitly requested

    line 281
  7. Very specific:

    Non-interactive: Use codex exec for scripted/CI workflows

    line 283
  8. Distinctive:

    When available, MCP (Model Context Protocol) servers provide direct integration:

    line 292
  9. Distinctive:

    Testing MCP Availability: Run a simple echo command to verify MCP servers are accessible in your environment.

    line 306
  10. Distinctive:

    Complexity: Keep functions simple

    line 338
  11. Common:

    Security: No exposed secrets/vulnerabilities

    line 342
  12. Distinctive:

    Update templates based on learnings

    line 351

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md — Multi-Agent Collaboration Guide

This document defines how AI assistants collaborate effectively in your codebase.

Goals

  • Eliminate confusion about paths, environment, and contracts
  • Use each agent's strengths where they shine
  • Provide repeatable handoffs and validation gates
  • Maintain transparent collaboration for users

Roles & Strengths

Primary Orchestrator (Claude Code)

  • Architecture and requirements analysis
  • Endpoint discovery and contract mapping
  • Security and privacy review
  • Refactor planning and design
  • Risk assessment and validation
  • Complex reasoning and debugging

Implementation Specialist (Codex/GPT)

  • Focused implementation
  • Surgical edits aligned with style
  • Test generation
  • Lint and type fixes
  • Small migrations
  • Keeping changes minimal

Code Generation (Aider)

  • Large-scale file modifications
  • Pattern-based transformations
  • Repository-wide updates
  • Boilerplate generation

Collaboration Visibility

Announcement Format

When delegating between agents:

🤝 Working with [Agent] on: [task description]
   Reason: [why this agent is suited for this]
   Expected outcome: [what will be delivered]

Progress Tracking

During collaboration:

  • 🔄 [Agent] implementing... - Work in progress
  • ✅ [Agent] completed: [summary] - Task done
  • 🔍 Reviewing output... - Validation phase
  • ⚠️ Adjusting: [issue] - Corrections needed

Handoff Template

Use this template when delegating tasks between agents:

task:
  description: "Brief task description"
  agent: "target-agent-name"
  
context:
  environment: "development|staging|production"
  constraints: ["list", "of", "constraints"]
  dependencies: ["required", "services"]
  
files:
  modify: ["path/to/file1.ts", "path/to/file2.py"]
  create: ["path/to/newfile.ts"]
  delete: ["path/to/obsolete.ts"]
  
contracts:
  endpoints:
    - method: "POST"
      path: "/api/resource"
      request: "{ field: type }"
      response: "{ field: type }"
  
plan:
  - step: "First action"
    acceptance: "What success looks like"
  - step: "Second action"
    acceptance: "What success looks like"
    
validation:
  commands:
    - "npm test"
    - "npm run lint"
  expected: "All tests passing, no lint errors"
  
sandbox:
  filesystem: "read-only|workspace-write|full-access"
  network: "restricted|approved|full"
  approval: "always|on-failure|never"

Example Handoff

🤝 Working with Codex on: JWT refresh token implementation
   Reason: Standard API endpoint following established patterns
   Expected outcome: Endpoint, service method, and tests

task:
  description: "Add refresh token endpoint"
  agent: "codex"
  
context:
  environment: "development"
  constraints: ["FastAPI patterns", "80% test coverage"]
  
files:
  modify: 
    - "api/routers/auth.py"
    - "core/services/auth_service.py"
  create:
    - "tests/test_auth_refresh.py"
    
contracts:
  endpoints:
    - method: "POST"
      path: "/api/auth/refresh"
      request: "{ refresh_token: string }"
      response: "{ access_token: string, expires_in: number }"
      
plan:
  - step: "Implement service method"
    acceptance: "Validates token, generates new access token"
  - step: "Add router endpoint"
    acceptance: "Follows FastAPI patterns, proper error handling"
  - step: "Write tests"
    acceptance: "Unit and integration tests, 80%+ coverage"
    
validation:
  commands:
    - "pytest tests/test_auth_refresh.py"
    - "npm run lint"
  expected: "All tests pass, no lint errors"

🔄 Codex implementing...
✅ Codex completed: JWT refresh endpoint with tests
🔍 Reviewing Codex output...

Collaboration Workflows

1. Sequential Pipeline

Most common for feature implementation:

Claude → Codex → Claude → User
Design → Build → Review → Deliver

2. Parallel Divide & Conquer

For independent components:

     Claude → [Business Logic]
    ↙      ↘
User         → Merge → User
    ↘      ↗
     Codex → [UI/Tests/Docs]

3. Consensus for Risky Changes

For critical modifications:

Claude + Codex → Design Options → Select Best → Implement → Review

4. Debug Team

For complex issues:

Claude: Root cause analysis
  ↓
Codex: Implement fix
  ↓
Claude: Validate security
  ↓
Codex: Add regression tests

Path Discipline

Project Structure

# Define your project structure
paths:
  source: "./src"           # Main source code
  tests: "./tests"          # Test files
  docs: "./docs"            # Documentation
  config: "./config"        # Configuration files
  
# Container paths if using Docker
container:
  app: "/app"
  data: "/data"
  logs: "/var/log/app"

Path References in Handoffs

Always use consistent path references:

  • Relative from project root: ./src/components/Button.tsx
  • Absolute when needed: /app/src/components/Button.tsx
  • Include both host and container paths for Docker projects

Validation Gates

Common Commands

# Testing
npm test                    # Run all tests
npm run test:unit          # Unit tests only
npm run test:integration   # Integration tests
npm run test:e2e           # End-to-end tests
npm run coverage           # Test coverage report

# Code Quality
npm run lint               # Lint code
npm run lint:fix          # Auto-fix lint issues
npm run format             # Format code
npm run typecheck          # Type checking

# Build & Deploy
npm run build              # Production build
npm run dev                # Development server
npm run preview            # Preview production build

Success Criteria

Before marking task complete:

  • ✅ All tests passing
  • ✅ Linting clean
  • ✅ Type checks pass
  • ✅ Coverage meets minimum (e.g., 80%)
  • ✅ Documentation updated
  • ✅ No console errors
  • ✅ Performance acceptable

Do's and Don'ts

Do's

  • ✅ Use real API endpoints
  • ✅ Follow existing patterns
  • ✅ Maintain test coverage
  • ✅ Document complex logic
  • ✅ Validate before handoff
  • ✅ Keep changes minimal
  • ✅ Preserve code style

Don'ts

  • ❌ Mock data when APIs exist
  • ❌ Skip tests "for now"
  • ❌ Ignore lint warnings
  • ❌ Break existing features
  • ❌ Change API contracts without approval
  • ❌ Hardcode environment values
  • ❌ Hide errors with try/catch

Agent-Specific Notes

Codex CLI Mode Specifics

Installation:

  • npm install -g @openai/codex (npm)
  • brew install --cask codex (Homebrew, macOS)

Authentication:

  • Sign in with ChatGPT (Plus/Pro/Team/Edu/Enterprise): run codex, select "Sign in with ChatGPT"
  • API key: set OPENAI_API_KEY environment variable

Default Configuration:

  • Filesystem: workspace-write (can modify project files)
  • Network: Restricted (requires approval for npm install, etc.)
  • Approvals: on-request (prompts for destructive operations)

How Codex Operates:

  • Preambles: Shows brief description before each tool use
  • Plans: Maintains visible step list for multi-step tasks
  • Reading: Processes ~250 lines per chunk, uses rg for search
  • Editing: Applies minimal diffs via apply_patch
  • Commits: No auto-commits/branches unless explicitly requested
  • Validation: Runs tests in non-interactive mode proactively
  • Non-interactive: Use codex exec for scripted/CI workflows

Requires Approval For:

  • Destructive operations (rm -rf, git reset --hard)
  • Network operations (npm install, pip install)
  • Docker commands
  • Writing outside workspace

MCP Server Integration

When available, MCP (Model Context Protocol) servers provide direct integration:

# MCP server configuration example
mcp_servers:
  codex:
    capabilities: ["code", "test", "docs"]
    sandbox: "workspace-write"
    approval_policy: "on-request"
    
  playwright:
    capabilities: ["browser", "e2e"]
    sandbox: "read-only"

Testing MCP Availability: Run a simple echo command to verify MCP servers are accessible in your environment.

Tool Integration Patterns

# Define tool capabilities for each assistant
assistants:
  claude:
    capabilities: ["architecture", "debugging", "review"]
    tools: ["read", "write", "search", "test"]
    
  codex:
    capabilities: ["implementation", "docs", "refactor"]
    tools: ["code_generation", "test_generation"]
    model: "gpt-5.3"
    
  copilot:
    capabilities: ["autocomplete", "suggestions"]
    tools: ["inline_completion"]

CLI Bridge Pattern

For projects with CLI tools:

# Use project CLI wrapper for consistent operations
./project-cli command --option
# Or use MCP servers when available for direct integration

Quality Metrics

Track these across collaborations:

  • Coverage: Maintain minimum (80%+)
  • Complexity: Keep functions simple
  • Duplication: DRY principle
  • Dependencies: Minimize and audit
  • Performance: Profile critical paths
  • Security: No exposed secrets/vulnerabilities

Continuous Improvement

After Each Collaboration

  1. What worked well?
  2. What could improve?
  3. Were handoffs clear?
  4. Did validation catch issues?
  5. Update templates based on learnings

Template Evolution

This is a living document. Update it with:

  • New patterns that work
  • Common pitfalls discovered
  • Better handoff formats
  • Improved validation steps

Customize this template for your specific project and team needs

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.