|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +This file provides guidance to AI agents when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Symfony AI monorepo with independent packages for AI integration in PHP applications. Each component in `src/` has its own composer.json, tests, and dependencies. |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +### Core Components |
| 12 | +- **Platform** (`src/platform/`): Unified AI platform interface (OpenAI, Anthropic, Azure, Gemini, VertexAI) |
| 13 | +- **Agent** (`src/agent/`): AI agent framework for user interaction and task execution |
| 14 | +- **Store** (`src/store/`): Data storage abstraction with vector database support |
| 15 | +- **MCP SDK** (`src/mcp-sdk/`): Model Context Protocol SDK for agent-tool communication |
| 16 | + |
| 17 | +### Integration Bundles |
| 18 | +- **AI Bundle** (`src/ai-bundle/`): Symfony integration for Platform, Store, and Agent |
| 19 | +- **MCP Bundle** (`src/mcp-bundle/`): Symfony integration for MCP SDK |
| 20 | + |
| 21 | +### Supporting Directories |
| 22 | +- **Examples** (`examples/`): Standalone usage examples |
| 23 | +- **Demo** (`demo/`): Full Symfony web application demo |
| 24 | +- **Fixtures** (`fixtures/`): Shared multi-modal test fixtures |
| 25 | + |
| 26 | +## Essential Commands |
| 27 | + |
| 28 | +### Testing |
| 29 | +```bash |
| 30 | +# Component-specific testing |
| 31 | +cd src/platform && vendor/bin/phpunit |
| 32 | +cd src/agent && vendor/bin/phpunit |
| 33 | +cd src/ai-bundle && vendor/bin/phpunit |
| 34 | +cd demo && vendor/bin/phpunit |
| 35 | +``` |
| 36 | + |
| 37 | +### Code Quality |
| 38 | +```bash |
| 39 | +# Fix code style (always run after changes) |
| 40 | +vendor/bin/php-cs-fixer fix |
| 41 | + |
| 42 | +# Static analysis (component-specific) |
| 43 | +cd src/platform && vendor/bin/phpstan analyse |
| 44 | +``` |
| 45 | + |
| 46 | +### Development Tools |
| 47 | +```bash |
| 48 | +# Link components for development |
| 49 | +./link /path/to/project |
| 50 | + |
| 51 | +# Run examples |
| 52 | +cd examples && php anthropic/chat.php |
| 53 | + |
| 54 | +# Demo application |
| 55 | +cd demo && symfony server:start |
| 56 | +``` |
| 57 | + |
| 58 | +## Code Standards |
| 59 | + |
| 60 | +### PHP Conventions |
| 61 | +- Follow Symfony coding standards with `@Symfony` PHP CS Fixer rules |
| 62 | +- Use project-specific exceptions instead of global ones (`\RuntimeException`, `\InvalidArgumentException`) |
| 63 | +- Define array shapes for parameters and return types |
| 64 | +- Add `@author` tags to new classes |
| 65 | +- Always add newlines at end of files |
| 66 | + |
| 67 | +### Testing Guidelines |
| 68 | +- Use **PHPUnit 11+** with component-specific configurations |
| 69 | +- Prefer `MockHttpClient` over response mocking |
| 70 | +- Use `self::assert*` or `$this->assert*` in tests |
| 71 | +- No void return types for test methods |
| 72 | +- Leverage shared fixtures in `/fixtures` for multi-modal content |
| 73 | +- Always fix risky tests |
| 74 | + |
| 75 | +### Git & Commits |
| 76 | +- Never mention AI assistance in commits or PR descriptions |
| 77 | +- Sign commits with GPG |
| 78 | +- Use conventional commit messages |
| 79 | + |
| 80 | +### Variable Naming |
| 81 | +- Name MessageBus variables as `$bus` (not `$messageBus`) |
| 82 | + |
| 83 | +## Component Dependencies |
| 84 | + |
| 85 | +- Agent → Platform (AI communication) |
| 86 | +- AI Bundle → Platform + Agent + Store (integration) |
| 87 | +- MCP Bundle → MCP SDK (integration) |
| 88 | +- Store: standalone (often used with Agent for RAG) |
| 89 | + |
| 90 | +## Development Workflow |
| 91 | + |
| 92 | +1. Each `src/` component is independently versioned |
| 93 | +2. Use `@dev` versions for internal dependencies during development |
| 94 | +3. Run PHP-CS-Fixer after code changes |
| 95 | +4. Test component-specific changes in isolation |
| 96 | +5. Use monorepo structure for shared development workflow |
0 commit comments