|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is the Symfony AI monorepo containing multiple components and bundles that integrate AI capabilities into PHP applications. The project is organized as a collection of independent packages under the `src/` directory, each with their own composer.json, tests, and dependencies. |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +### Core Components |
| 12 | +- **Platform** (`src/platform/`): Unified interface to AI platforms (OpenAI, Anthropic, Azure, Gemini, VertexAI, etc.) |
| 13 | +- **Agent** (`src/agent/`): Framework for building AI agents that interact with users and perform tasks |
| 14 | +- **Store** (`src/store/`): Data storage abstraction with indexing and retrieval for vector databases |
| 15 | +- **MCP SDK** (`src/mcp-sdk/`): SDK for Model Context Protocol enabling agent-tool communication |
| 16 | + |
| 17 | +### Integration Bundles |
| 18 | +- **AI Bundle** (`src/ai-bundle/`): Symfony integration for Platform, Store, and Agent components |
| 19 | +- **MCP Bundle** (`src/mcp-bundle/`): Symfony integration for MCP SDK |
| 20 | + |
| 21 | +### Supporting Directories |
| 22 | +- **Examples** (`examples/`): Standalone examples demonstrating component usage across different AI platforms |
| 23 | +- **Demo** (`demo/`): Full Symfony web application showcasing components working together |
| 24 | +- **Fixtures** (`fixtures/`): Shared test fixtures for multi-modal testing (images, audio, PDFs) |
| 25 | + |
| 26 | +## Development Commands |
| 27 | + |
| 28 | +### Testing |
| 29 | +Each component has its own test suite. Run tests for specific components: |
| 30 | +```bash |
| 31 | +# Platform component |
| 32 | +cd src/platform && vendor/bin/phpunit |
| 33 | + |
| 34 | +# Agent component |
| 35 | +cd src/agent && vendor/bin/phpunit |
| 36 | + |
| 37 | +# AI Bundle |
| 38 | +cd src/ai-bundle && vendor/bin/phpunit |
| 39 | + |
| 40 | +# Demo application |
| 41 | +cd demo && vendor/bin/phpunit |
| 42 | +``` |
| 43 | + |
| 44 | +### Code Quality |
| 45 | +The project uses PHP CS Fixer with Symfony coding standards: |
| 46 | +```bash |
| 47 | +# Fix code style issues |
| 48 | +vendor/bin/php-cs-fixer fix |
| 49 | + |
| 50 | +# Check specific directories |
| 51 | +vendor/bin/php-cs-fixer fix src/platform/ |
| 52 | +``` |
| 53 | + |
| 54 | +Static analysis with PHPStan (component-specific): |
| 55 | +```bash |
| 56 | +cd src/platform && vendor/bin/phpstan analyse |
| 57 | +``` |
| 58 | + |
| 59 | +### Development Linking |
| 60 | +Use the `./link` script to symlink local development versions: |
| 61 | +```bash |
| 62 | +# Link components to external project |
| 63 | +./link /path/to/project |
| 64 | + |
| 65 | +# Copy instead of symlink |
| 66 | +./link --copy /path/to/project |
| 67 | + |
| 68 | +# Rollback changes |
| 69 | +./link --rollback /path/to/project |
| 70 | +``` |
| 71 | + |
| 72 | +### Running Examples |
| 73 | +Examples are self-contained and can be run individually: |
| 74 | +```bash |
| 75 | +cd examples |
| 76 | +php anthropic/chat.php |
| 77 | +php openai/function-calling.php |
| 78 | +``` |
| 79 | + |
| 80 | +Many examples require environment variables (see `.env` files in example directories). |
| 81 | + |
| 82 | +### Demo Application |
| 83 | +The demo is a full Symfony application: |
| 84 | +```bash |
| 85 | +cd demo |
| 86 | +composer install |
| 87 | +symfony server:start |
| 88 | +``` |
| 89 | + |
| 90 | +## Component Dependencies |
| 91 | + |
| 92 | +Components are designed to work independently but have these relationships: |
| 93 | +- Agent depends on Platform for AI communication |
| 94 | +- AI Bundle integrates Platform, Agent, and Store |
| 95 | +- MCP Bundle provides MCP SDK integration |
| 96 | +- Store is standalone but often used with Agent for RAG applications |
| 97 | + |
| 98 | +## Testing Architecture |
| 99 | + |
| 100 | +Each component uses: |
| 101 | +- **PHPUnit 11+** for testing framework |
| 102 | +- Component-specific `phpunit.xml.dist` configurations |
| 103 | +- Shared fixtures in `/fixtures` for multi-modal content |
| 104 | +- MockHttpClient pattern preferred over response mocking |
| 105 | + |
| 106 | +## Development Notes |
| 107 | + |
| 108 | +- Each component in `src/` is a separate Composer package with its own dependencies |
| 109 | +- Use `@dev` versions for internal component dependencies during development |
| 110 | +- Components follow Symfony coding standards and use `@Symfony` PHP CS Fixer rules |
| 111 | +- The monorepo structure allows independent versioning while maintaining shared development workflow |
0 commit comments