docs: update CLAUDE.md to be package-specific

Rewrite CLAUDE.md from generic Core PHP Framework template to reflect
actual core-agentic package: MCP tools, AI provider system, models,
and package structure.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-01-28 14:02:45 +00:00
parent adcc163775
commit 577118f7f2

132
CLAUDE.md
View file

@ -1,66 +1,110 @@
# Core PHP Framework Project # CLAUDE.md
## Architecture This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Modular monolith using Core PHP Framework. Modules live in `app/Mod/{Name}/Boot.php`. ## Package Overview
**Event-driven registration:** `host-uk/core-agentic` is a Laravel package providing AI agent orchestration, MCP (Model Context Protocol) tools, and multi-agent collaboration support. Namespace: `Core\Mod\Agentic\`.
```php
class Boot
{
public static array $listens = [
WebRoutesRegistering::class => 'onWebRoutes',
ApiRoutesRegistering::class => 'onApiRoutes',
AdminPanelBooting::class => 'onAdminPanel',
];
}
```
## Commands ## Commands
```bash ```bash
composer run dev # Dev server (if configured) composer run lint # Format with Laravel Pint
php artisan serve # Laravel dev server composer run test # Run tests with Pest
npm run dev # Vite ./vendor/bin/pest --filter=AgentPlan # Run specific test
./vendor/bin/pint --dirty # Format changed files
php artisan test # All tests # CLI tools (when installed in a host application)
php artisan make:mod Blog # Create module php artisan plan:create my-feature --title="Feature X"
php artisan plan:list --status=active
php artisan plan:show my-plan --markdown
php artisan plan:check my-plan
php artisan agentic:generate batch-001
``` ```
## Module Structure ## Architecture
``` ### Boot System (Event-Driven)
app/Mod/Blog/ Package registers via Laravel service provider with event-driven lazy loading:
├── Boot.php # Event listeners
├── Models/ # Eloquent models ```php
├── Routes/ // Boot.php - responds to Core framework events
│ ├── web.php # Web routes public static array $listens = [
│ └── api.php # API routes AdminPanelBooting::class => 'onAdminPanel',
├── Views/ # Blade templates ConsoleBooting::class => 'onConsole',
├── Livewire/ # Livewire components McpToolsRegistering::class => 'onMcpTools',
├── Migrations/ # Database migrations ];
└── Tests/ # Module tests
``` ```
## Packages ### MCP Tools Structure
Tools live in `Mcp/Tools/Agent/` organised by domain:
| Package | Purpose | | Directory | Tools |
|---------|---------| |-----------|-------|
| `host-uk/core` | Core framework, events, module discovery | | `Plan/` | `PlanCreate`, `PlanGet`, `PlanList`, `PlanUpdateStatus`, `PlanArchive` |
| `host-uk/core-admin` | Admin panel, Livewire modals | | `Phase/` | `PhaseGet`, `PhaseUpdateStatus`, `PhaseAddCheckpoint` |
| `host-uk/core-api` | REST API, scopes, rate limiting, webhooks | | `Session/` | `SessionStart`, `SessionEnd`, `SessionLog`, `SessionHandoff`, `SessionResume` |
| `host-uk/core-mcp` | Model Context Protocol for AI agents | | `State/` | `StateGet`, `StateSet`, `StateList` |
| `Task/` | `TaskUpdate`, `TaskToggle` |
| `Content/` | `ContentGenerate`, `ContentBatchGenerate`, `ContentBriefCreate` |
| `Template/` | `TemplateList`, `TemplatePreview`, `TemplateCreatePlan` |
All tools extend `AgentTool` base class which provides:
- Input validation helpers (`requireString`, `optionalInt`, `requireEnum`)
- Circuit breaker protection via `withCircuitBreaker()`
- Standardised response format (`success()`, `error()`)
### AI Provider System
`AgenticManager` provides unified access to AI providers:
```php
$ai = app(AgenticManager::class);
$ai->claude()->generate($prompt); // Anthropic Claude
$ai->gemini()->generate($prompt); // Google Gemini
$ai->openai()->generate($prompt); // OpenAI
$ai->provider('gemini')->generate($prompt); // By name
```
### Key Models
| Model | Purpose |
|-------|---------|
| `AgentPlan` | Work plans with phases and status tracking |
| `AgentPhase` | Plan phases with tasks and checkpoints |
| `AgentSession` | Agent execution sessions with handoff support |
| `WorkspaceState` | Key-value state shared between agents |
| `AgentApiKey` | API key management with IP whitelisting |
## Conventions ## Conventions
- UK English (colour, organisation, centre) - UK English (colour, organisation, centre)
- `declare(strict_types=1);` in all PHP files
- Type hints on all parameters and return types
- PSR-12 coding style (Laravel Pint) - PSR-12 coding style (Laravel Pint)
- Pest for testing - Pest for testing
- Livewire + Flux Pro for UI
## Package Structure
```
├── Boot.php # Service provider + event listeners
├── Mcp/
│ ├── Tools/Agent/ # MCP tool implementations
│ ├── Prompts/ # MCP prompt definitions
│ └── Servers/ # MCP server configurations
├── Models/ # Eloquent models
├── Services/ # Business logic services
├── Middleware/ # API authentication
├── View/
│ ├── Blade/admin/ # Admin panel views
│ └── Modal/Admin/ # Livewire components
├── Jobs/ # Queue jobs for async work
├── Console/Commands/ # Artisan commands
└── Tests/ # Pest test suites
```
## Dependencies
Requires `host-uk/core` which provides the event system and MCP infrastructure.
## License ## License
- `Core\` namespace and vendor packages: EUPL-1.2 (copyleft) EUPL-1.2 (European Union Public Licence)
- `app/Mod/*`, `app/Website/*`: Your choice (no copyleft)
See LICENSE for full details.