Search by

yousefhatem12 / lara-orcest

yousefhatem12

Prompt-driven multi-agent orchestration for Laravel with specialized roles, stateful graph execution, automated tests, and safe Git workflows.

v0.3.1 2026-11-26 11:52 UTC

This package is auto-updated.

Last update: 2026-11-26 11:55:20 UTC


README

LaraOrcest Logo

LaraOrcest

Prompt-driven multi-agent orchestration for Laravel with specialized roles, stateful graph execution, automated tests, Swagger/OpenAPI generation, and safe Git workflows.

Tests Status Docs Deployment Latest Version on Packagist Software License

Vision • Documentation • Quickstart • Use Cases • Agent Roster • Graph Lifecycle • Key Features • Setup • LLM Proxy • Sandboxed Tools • Technical Spec

🎬 Video Overview (Silent Graphical Walkthrough)

A concise 24-second silent explainer video demonstrating LaraOrcest's LangGraph-style stateful directed graph, 9 CrewAI-style pod roles, parallel wave execution, defense-in-depth security guardrails, and Artisan CLI workflows:


Silent graphical overview (no audio track) • 720p HD @ 30fps • 24s
▶️ Direct MP4 Video • 📖 Interactive Docs Site

Note

This graphical walkthrough is intentionally silent (no audio track). You can also watch it with interactive chapters on the LaraOrcest Documentation Site.

📚 Documentation & Guides

Comprehensive guides and runnable examples are available in docs/ and examples/:

Guide Description Link
Documentation Home Architecture overview, CrewAI + LangGraph paradigms, zero Python vision docs/index.md
Quickstart Guide Composer path repository setup, .env configuration, dry-run, and resume docs/quickstart.md
Architecture & Engine RunState, checkpointer, EdgeRule, parallel scheduler, and Project Memory docs/architecture.md
Agents & Model Routing 9 core agents, web_scraping_agent, swagger_agent, per-agent model routing docs/agents.md
Safety, Sandboxing & HITL Sandboxed tools, PathGuard, and Human-in-the-Loop review gates docs/safety-and-hitl.md
Real-World Use Cases End-to-end feature delivery, two-site scraping, LiteLLM proxy, HITL flow, and multi-vendor DDD platform docs/use-cases.md
Practical Examples Sample .env, LiteLLM config.yaml, prompt templates, DDD workflows, and PHP scripts examples/

🌐 Documentation Website (VitePress)

LaraOrcest includes a modern, responsive documentation website built with VitePress that directly serves the docs/ pages:

# Install docs tooling
npm install

# Start local hot-reloading dev server (http://localhost:5173)
npm run docs:dev

# Build static production bundle into docs/.vitepress/dist
npm run docs:build

# Preview built production bundle locally
npm run docs:preview

🚀 Automated GitHub Pages Deployment

The documentation site deploys automatically to GitHub Pages on every push to main touching docs/** via the Deploy Documentation workflow.

To enable GitHub Pages in your repository:

  1. Go to Settings > Pages in your GitHub repository.
  2. Under Build and deployment > Source, choose GitHub Actions.
  3. Push to main (or run manually via Actions > Deploy Documentation > Run workflow).
  4. Your documentation site will be live at https://<username>.github.io/<repository>/!

Vision & Core Philosophy

LaraOrcest brings role-based multi-agent pods (CrewAI style) and stateful directed graphs with bounded feedback loops (LangGraph style) natively into Laravel applications via Composer—with zero Python dependencies or external microservices.

In modern software development, writing high-quality Laravel features requires more than a single LLM prompt. It requires:

  1. Requirements Analysis: Uncovering domain invariants, authorization boundaries, and edge cases before writing code.
  2. Product Prioritization: Scoping requirements into incremental, testable backlog tasks with clear acceptance criteria.
  3. Architectural Planning: Designing migrations, models, form requests, controllers, policies, routes, and tests conforming to Laravel conventions.
  4. Git Branch Isolation: Isolating changes on a dedicated feature branch (orcest/...) to keep main clean and safe.
  5. Database & Backend Engineering: Generating migrations, Eloquent relationships, and form-request-validated controllers.
  6. Swagger & OpenAPI Documentation: Creating standardized OpenAPI 3.0+ specifications and API documentation for endpoints.
  7. Automated QA & Cyclic Bug Fixing: Generating comprehensive feature/unit tests and iterating in a bounded loop until tests pass.
  8. Staff Reviewer Audit: Inspecting code diffs against PSR-12, security standards, and business specifications before committing.

LaraOrcest automates this entire lifecycle inside your existing Laravel codebase under strict sandboxed security guardrails.

Built-in Agent Roster

LaraOrcest includes a fixed roster of specialized agents, each with dedicated responsibilities, scoped tool access, structured JSON output schemas, and state field ownership:

Agent Key Role Goal Allowed Tools Output State Field
business_analyst Laravel Domain & Systems Analyst Analyzes prompt and codebase to produce unambiguous requirements, entities, business rules, and edge cases. file_reader requirements_spec
product_manager Technical Product Manager Breaks down the specification into ordered tasks with testable acceptance criteria. file_reader backlog
web_scraping_agent Intelligent Web Scraping & Ingestion Specialist Extracts and normalizes data from target website URLs and dispatches unified payloads to destination endpoints. file_reader scraping_results
architect Senior Laravel Software Architect Designs clean, idiomatic architecture mapping tasks to migrations, models, controllers, requests, routes, and tests. file_reader, codebase_inspector technical_plan
git_agent Source Control & Release Hygiene Agent Creates and isolates changes on a feature branch (orcest/...), verifies clean working trees, and manages milestone commits. git_command git_state
package_manager_agent Laravel Package Manager & Project Bootstrapper Discloses target Laravel/package versions in terminal, bootstraps fresh Laravel skeletons, installs Composer packages, and scaffolds directories inside targetProjectPath. composer_runner, directory_scaffolder, file_reader, patch_writer, codebase_inspector, artisan_runner artifacts, metadata.package_manager
database_agent Laravel Database & Eloquent Specialist Generates normalized migrations, factories, relationships, and Eloquent models scoped to database/ and app/Models/. file_reader, patch_writer, artisan_runner artifacts
backend_agent Laravel Backend & API Engineer Implements form requests, controllers, actions, and API routes scoped to app/, routes/, and config/. file_reader, patch_writer, artisan_runner artifacts
swagger_agent Laravel Swagger & OpenAPI Documentation Specialist Generates comprehensive OpenAPI 3.0+ / Swagger specifications (JSON/YAML) and endpoints documentation scoped to docs/ and storage/api-docs/. file_reader, patch_writer, artisan_runner artifacts, metadata.swagger_documentation
qa_agent Automated QA & Test Engineer Writes comprehensive feature/unit tests in tests/ based on acceptance criteria and executes php artisan test. file_reader, patch_writer, test_runner test_results
fixer_agent Root-Cause Bug Fixer & Debugger Diagnoses failing tests or reviewer findings and applies targeted patches within max_fix_attempts. file_reader, patch_writer, artisan_runner, test_runner artifacts, guardrails.fix_attempts
reviewer_agent Code Quality & Security Reviewer Audits changes against requirements, security standards, and test results, approving or requesting revisions. file_reader, git_command reviews

Directed Graph & Workflow Lifecycle

Workflows in LaraOrcest execute deterministically through GraphEngine, evaluating conditional EdgeRule transitions against RunState:

  [Start Prompt]
        │
        ▼
 business_analyst
        │
        ▼
 product_manager ──(if scraping requested)──► web_scraping_agent ──► [Complete or Proceed]
        │                                                                   │
        ▼                                                                   ▼
    architect ◄─────────────────────────────────────────────────────────────┘
        │
        ▼
    git_agent (isolates branch orcest/...)
        │
        ▼
 package_manager_agent (bootstraps target project, packages & structure)
        │
        ▼
 database_agent (migrations & models)
        │
        ▼
  backend_agent (controllers, form requests & routes)
        │
        ▼
 [Swagger Requested?] ──(yes)──► swagger_agent (OpenAPI 3.0+ specs in docs/)
        │                                  │
        └──────────────(no)────────────────┘
        │
        ▼
     qa_agent (generates tests & runs php artisan test)
        │
        ▼
 [Tests Pass or Dry-Run?]
  /                   \
 / (yes)               \ (no & canAttemptFix)
▼                       ▼
reviewer_agent ◄─── fixer_agent (applies targeted patches & retries QA)
 /           \
/ (approved)  \ (revise & canFix)
▼              └──► fixer_agent
[TERMINAL_COMPLETED]
 │
 ▼ (if not dry_run)
Automated Milestone Commit

Key Features

1. Swagger & OpenAPI Documentation Agent (SwaggerAgent)

Automates complete API documentation for generated and existing Laravel endpoints:

  • Comprehensive OpenAPI 3.0+ Generation: Inspects implemented routes (routes/api.php), API controllers, Form Requests, resources, models, and technical plans using FileReaderTool to generate or incrementally update OpenAPI 3.0+ specifications in JSON or YAML.
  • Form Request & Validation Rule Inference: Automatically analyzes Form Requests and validation rules to generate detailed request body schemas, required properties, and path/query parameters with data types and descriptions.
  • Accurate Schemas, Tags & Realistic Error Responses: Groups operations with tags, documents 200/201 success responses, and includes realistic JSON examples for standard HTTP error codes (400, 401, 403, 404, 422, 500).
  • Flexible Target Locations: Outputs specs directly to docs/swagger.json, docs/swagger.yaml, storage/api-docs/api-docs.json (L5-Swagger compliant), openapi.json, or custom paths via config('lara-orcest.swagger.output_path') or --swagger-path.
  • Intent-Driven & Conditional Execution: Activates automatically when Swagger/OpenAPI intent is detected in the prompt (e.g. "make swagger documentation for backend"), via --swagger in Artisan, conditionally when API endpoints exist with conditional_activation enabled, or globally via config('lara-orcest.swagger.auto_generate'). Bypassed safely in non-API runs or with --no-swagger.
  • Per-Agent Model Support: Can be routed to specialized reasoning or coding models via config('lara-orcest.llm.agent_models.swagger_agent').
  • Dedicated Pipeline: Use DefaultGraphBuilder::buildSwaggerPipeline() for lightweight standalone API documentation generation (backend_agent -> swagger_agent -> completed).

2. Intelligent Web Scraping & Ingestion (WebScrapingAgent)

Automates web data extraction and destination API dispatch:

  • Guided by Business Analysis: Uses domain entities and acceptance criteria to extract structured payloads from two target websites.
  • Strict Two-URL Validation: Requires exactly two valid HTTP/HTTPS URLs (source_urls), failing fast with clear diagnostics if invalid.
  • Sanitization & SSRF Guardrails: Strips scripts, styles, SVGs, and comments while bounding payload size. Strictly blocks SSRF, loopback, and cloud metadata targets (169.254.169.254).
  • Dry-Run & Safe Dispatch: Records preview payloads in --dry-run mode; dispatches HTTP payloads with configurable retry budgets and redacted headers in standard runs.
  • Dedicated Pipeline: Use DefaultGraphBuilder::buildScrapingPipeline() for standalone scraping runs (business_analyst -> product_manager -> web_scraping_agent -> completed).

3. Parallel & Sub-Graph Wave Execution

Deterministic concurrent task scheduling for complex features:

  • ParallelNode & SubGraphNode: Embed composite parallel waves or nested child graphs into any execution plan.
  • Conflict-Free Scheduling (ParallelScheduler): Identifies independent tasks whose prerequisites (depends_on) are satisfied and whose file scopes (scope_paths) do not collide.
  • Scope Conflict Detection (ScopeConflictDetector): Detects overlapping file mutations across branches and halts execution before corrupting state.
  • Git Mutation Serialization: Isolates Git branch creation and commits into serialized single-task waves with file locking (withGitLock).
  • Safe State Merging (RunState::mergeParallelStates): Combines token counts, step counts, and test diagnostics across parallel branches cleanly.

4. Human-in-the-Loop (HITL) Review & Approval Gates

Balance full automation with developer oversight:

  • Interactive Review Gates (--interactive):
    • after_plan: Pauses execution after requirements and architecture are designed, allowing developers to audit tasks and routes before files are created.
    • before_commit: Pauses execution after tests pass and code review succeeds, allowing inspection of diffs before final Git milestone commits.
  • Autonomous Execution (--no-human-review): Bypasses all review gates for automated CI/CD or overnight runs.
  • CLI Approvals (orcest:approve): Review, approve, or reject paused runs with optional feedback notes directly from the command line.

5. Project Memory & Codebase Index (Memorilla Architecture)

Persistent project knowledge store that grows with your codebase:

  • Separation of Indexing from Recall: The persistent store (.lara-orcest/memory.json) maintains structured sections (codebase_index, conventions, decisions, pitfalls). Instead of bloating prompts with raw code, agent-scoped recall (recallForContext) selects only the most relevant context slice.
  • Incremental Growth: Automatically indexes newly created models, controllers, migrations, and routes. Captures technical decisions and resolves bugs diagnosed by FixerAgent as reusable pitfalls.
  • Deduplication & Secret Sanitization: Caps entries to max_items and strictly redacts API keys, tokens, and passwords.
  • Budget Control: Configurable character budget (max_context_chars, default: 2500). Can be bypassed per-run via --no-memory.

6. Multi-Lingual Mail Templates & Localization

Includes production-ready notification templates and Mailables:

  • Supported Locales: English (en), Hindi (hi), and Chinese (zh) with JSON translations in lang/ and resources/lang/.
  • Pre-Built Mailables: WelcomeMail, VerifyAccountMail, PasswordResetMail, TwoFactorRecoveryMail, OtpCodeMail, MeetingReminderMail, and MeetingNotificationMail.
  • Responsive Blade Layout: Standard responsive email layout in resources/views/emails/layouts/default.blade.php.

7. Sandboxed Tools & Security Guardrails

Prompts are treated as untrusted inputs with strict sandbox boundaries:

  • PathGuard: Resolves paths strictly inside projectRoot, blocks symlink escapes, and enforces global deny patterns (.env, .git, vendor, node_modules, storage/logs, *.key).
  • FileReaderTool: Safe line slicing (offset, max_lines) and byte limits (max_bytes).
  • PatchWriterTool: Atomic file creation, search-and-replace, safe deletion, and unified diff generation with dry-run support.
  • ArtisanRunnerTool: Executes allow-listed make:* commands and test commands; blocks dangerous flags (--force, --drop-views, --seed) and shell metacharacters.
  • TestRunnerTool: Executes php artisan test --without-tty with timeouts and structured failure parsing.
  • GitCommandTool: Manages branches, staging, and commits while blocking destructive commands (push --force, reset --hard) and direct commits to protected branches (main, master, production, staging).

8. Modular Skills & Hierarchical Agent Pods

Natively organizes specialized agents into hierarchical Lead and Sub-Agent teams (Pods) with progressive disclosure skills:

  • SkillRegistry & Progressive Disclosure: Markdown skills (resources/skills/*.md and .lara-orcest/skills/*.md) inject lightweight summaries during planning and resolve full instruction blocks only when relevant, keeping token usage lean.
  • Discovery & Planning Pod:
    • business_analyst leads domain_rules_agent with the business-requirements-analysis skill to extract invariants, edge cases, and state transitions.
    • product_manager leads backlog_splitter_agent with the backlog-task-decomposition skill to produce atomic tasks with explicit depends_on graphs and least-privilege scope_paths.
    • Conditional web_scraping_agent extracts structured data from two URLs using HttpFetchTool and HttpDispatchTool under SSRF guardrails and dry-run preview mode.
  • Architecture Pod:
    • architect leads ddd_boundary_agent, schema_planner_agent, and api_contract_agent.
    • Driven by dedicated skills: laravel-modular-ddd-architecture, relational-schema-indexing, and rest-api-contract-design.
    • Sub-agents utilize CodebaseInspectorTool for read-only workspace, model, migration, route, and symbol inspection without mutating files.
    • Runs in parallel waves when teams.parallel_sub_agents is enabled, synthesizing a comprehensive technical_plan in RunState.
  • PackageManager Pod (Phase B):
    • package_manager_agent leads laravel_installer_agent, dependency_resolver_agent, and structure_scaffolder_agent.
    • Driven by dedicated skills: laravel-project-bootstrapping, composer-dependency-management, and laravel-directory-scaffolding.
    • Pre-flights target workspace (targetProjectPath), bootstraps fresh Laravel skeleton idempotently, resolves and installs Composer packages, and scaffolds modular DDD directory structures.
    • Utilizes sandboxed ComposerRunnerTool and DirectoryScaffolderTool with PathGuard boundary protection.
  • Database Pod (Phase C):
    • database_agent leads migration_agent, model_eloquent_agent, and seeder_agent.
    • Driven by dedicated skills: laravel-safe-migrations, eloquent-models-and-factories, and idempotent-database-seeders.
    • Executes against WorkspaceContext::$targetProjectPath in 3 distinct waves based on strict dependsOn() dependencies:
      • Wave 0: migration_agent (scoped strictly to database/migrations/**).
      • Wave 1: model_eloquent_agent (scoped strictly to app/Models/**, app/Domains/**/Models/**, database/factories/**).
      • Wave 2: seeder_agent (scoped strictly to database/seeders/**).
    • Automatically records generated database artifacts into RunState::$artifacts with normalized paths relative to targetProjectPath and respects --dry-run non-destructive previews.
  • Backend Pod (Phase C):
    • backend_agent leads request_validation_agent, service_action_agent, and controller_resource_agent.
    • Driven by dedicated skills: laravel-form-requests-authorization, service-action-workflows, and controllers-resources-routes.
    • Executes against WorkspaceContext::$targetProjectPath in 3 distinct waves based on strict dependsOn() dependencies:
      • Wave 0: request_validation_agent (scoped strictly to app/Http/Requests/**, app/Policies/**).
      • Wave 1: service_action_agent (scoped strictly to app/Services/**, app/Actions/**, app/Events/**).
      • Wave 2: controller_resource_agent (scoped strictly to app/Http/Controllers/**, app/Http/Resources/**, routes/**).
    • Enforces thin controller design delegating to Action classes, wrapped with JsonResource transformers and clean routes/api.php endpoints.
  • Quality & Release Pod (Phase C):
    • qa_agent leads feature_test_agent and fixer_agent inside targetProjectPath.
      • Driven by laravel-feature-testing and root-cause-test-fixing skills.
      • feature_test_agent generates complete Feature & Unit tests scoped strictly to tests/**.
      • Validates target test binaries (pest, phpunit, artisan) and runs TestRunnerTool; if tests fail and fix attempts remain, triggers fixer_agent for surgical root-cause debugging.
    • reviewer_agent leads swagger_agent and git_agent inside targetProjectPath.
      • Driven by openapi-swagger-spec and safe-git-release skills.
      • Generates OpenAPI 3.0+ documentation in docs/swagger.json and coordinates with git_agent to branch (orcest/...) and commit verified milestones.
  • Single-Agent Fallback & Dry-Run Continuity:
    • When lara-orcest.teams.enabled = false, all pods fall back gracefully to lead agents executing single-agent workflows.
    • Full --dry-run simulation mode is supported across every pod without mutating disk or git repository state.

Standalone Control Plane CLI (bin/lara-orcest Above Laravel)

LaraOrcest functions as an autonomous Standalone Control Plane that sits outside and above Laravel applications. It controls external Laravel projects by passing --target=/path/to/project:

# 1. Initialize configuration for an external target project
bin/lara-orcest init /path/to/target-laravel-app

# 2. Run multi-agent feature delivery against the target project
bin/lara-orcest build "Implement invoice billing with Stripe webhooks" --target=/path/to/target-laravel-app

# 3. Dry-run preview without modifying files or git branches
bin/lara-orcest build "Add multi-tenant team management" --target=/path/to/target-laravel-app --dry-run

# 4. Resume an interrupted or paused run
bin/lara-orcest build --resume=<run_id> --target=/path/to/target-laravel-app

# 5. Inspect execution status, checkpoints, and delegations
bin/lara-orcest status
bin/lara-orcest status <run_id>

Installation & Setup

LaraOrcest can be installed as a Composer dependency or operated as a standalone repository above your Laravel applications.

1. Standard Installation (via Composer & Packagist)

Install LaraOrcest into your Laravel application or development tooling using Composer:

composer require yousefhatem12/lara-orcest

If you plan to use LaraOrcest exclusively for development, prototyping, and automated feature delivery:

composer require yousefhatem12/lara-orcest --dev

Once installed, the standalone control-plane CLI binary is immediately available at vendor/bin/lara-orcest:

# Initialize workspace config (.lara-orcest/)
./vendor/bin/lara-orcest init

# Orchestrate a feature against your application
./vendor/bin/lara-orcest build "Create an invoice billing API with Stripe webhooks"

2. Standalone Control Plane Repository (Managing External Projects)

You can also run LaraOrcest completely separate from your target application as a dedicated control plane:

git clone https://github.com/yousefhatem12/LaraOrcest.git
cd LaraOrcest
composer install

# Point directly to any external Laravel project on your machine
bin/lara-orcest init /path/to/target-laravel-app
bin/lara-orcest build "Build multi-tenant Task API" --target=/path/to/target-laravel-app

3. Publish Configuration & Migrations (When Embedded)

When embedding inside a host Laravel application container:

Publish the package configuration file to config/lara-orcest.php:

php artisan vendor:publish --tag=lara-orcest-config

Publish checkpointer migrations for database persistence (optional, JSON filesystem is the default):

php artisan vendor:publish --tag=lara-orcest-migrations
php artisan migrate

4. Pre-Release & Local Development Alternatives

If you are developing against or testing LaraOrcest locally or before its initial Packagist index:

Option A: Local Development via Composer path Repository

Link a local clone of LaraOrcest on your machine using Composer's path repository inside your Laravel app's composer.json:

"repositories": [
    {
        "type": "path",
        "url": "../LaraOrcest",
        "options": {
            "symlink": true
        }
    }
],
"require-dev": {
    "yousefhatem12/lara-orcest": "*@dev"
}

Then update dependencies in your Laravel app:

composer update yousefhatem12/lara-orcest

Option B: GitHub VCS Repository (Branch / Dev-Main)

Install directly from the GitHub repository via a Composer VCS repository before Packagist publication:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/yousefhatem12/LaraOrcest.git"
    }
]

Then require the branch with development stability:

composer require yousefhatem12/lara-orcest:dev-main --dev

LLM Proxy & LiteLLM Integration

LaraOrcest communicates with AI models using an OpenAI-compatible HTTP driver (OpenAiCompatibleHttpDriver). This allows pointing directly to any local or self-hosted LLM proxy—such as LiteLLM, vLLM, Ollama, or OpenRouter—with zero Python inside your Laravel application.

Connecting via .env

Add the following to your application's .env:

# Default LLM driver
LARA_ORCEST_LLM=openai_compatible

# LiteLLM Proxy / OpenAI-Compatible Endpoint
LARA_ORCEST_LLM_BASE_URL=http://localhost:4000/v1
LARA_ORCEST_LLM_API_KEY=sk-litellm-proxy-key
LARA_ORCEST_LLM_MODEL=gpt-4o-mini
LARA_ORCEST_LLM_TIMEOUT=60
LARA_ORCEST_LLM_RETRIES=2

# Per-Agent Model Routing Overrides (Optional)
LARA_ORCEST_MODEL_ARCHITECT=claude-3-5-sonnet
LARA_ORCEST_MODEL_REVIEWER_AGENT=o3-mini
LARA_ORCEST_MODEL_BACKEND_AGENT=gpt-4o-mini
LARA_ORCEST_MODEL_SWAGGER_AGENT=gpt-4o-mini
LARA_ORCEST_MODEL_DATABASE_AGENT=gpt-4o-mini
LARA_ORCEST_MODEL_WEB_SCRAPING_AGENT=gpt-4o-mini

Usage & Examples

1. Standalone Control Plane CLI (bin/lara-orcest) — Primary Mode

Run LaraOrcest as an autonomous control plane that sits above Laravel, managing any target Laravel workspace from the outside without requiring a host Laravel installation:

Initialize Workspace

# Initialize a workspace configuration pointing to a target Laravel project
bin/lara-orcest init /path/to/my-laravel-app

# Or initialize the current directory as the target project
bin/lara-orcest init

Orchestrate a Feature

# Run multi-agent pipeline against the managed target Laravel workspace
bin/lara-orcest build "Implement REST API for invoice billing with Stripe webhooks" --target=/path/to/my-laravel-app

# Dry-run mode: Preview requirements, backlog, code diffs, and test runs without mutating disk or Git
bin/lara-orcest build "Add two-factor authentication" --target=/path/to/my-laravel-app --dry-run

# Interactive Human-in-the-Loop review gates
bin/lara-orcest build "Create subscription billing" --target=/path/to/my-laravel-app --interactive

# Fully autonomous mode bypassing human review gates
bin/lara-orcest build "Create subscription billing" --target=/path/to/my-laravel-app --no-human-review

# Resume an interrupted or paused run
bin/lara-orcest build --resume=run_a1b2c3d4e5f6 --target=/path/to/my-laravel-app

Inspect Status & Delegation Checkpoints

# Inspect all runs and active workspace target path
bin/lara-orcest status --target=/path/to/my-laravel-app

# Inspect full details for a specific run ID (artifacts, tests, reviews, tokens, git branch)
bin/lara-orcest status run_a1b2c3d4e5f6 --target=/path/to/my-laravel-app

# Machine-readable JSON output
bin/lara-orcest status run_a1b2c3d4e5f6 --json

Approve or Reject a Paused Run

# Approve a paused run at its active review gate and resume execution
bin/lara-orcest approve run_a1b2c3d4e5f6 --note="Plan approved"

# Reject and terminate execution cleanly
bin/lara-orcest approve run_a1b2c3d4e5f6 --reject --note="Revise data model"

2. Embedded Laravel Artisan Commands — In-App Compatibility

Build a Feature

# Build a feature from a prompt
php artisan orcest:build "Create a task management API with projects, assignments, and status updates"

# Build with Swagger/OpenAPI documentation generation
php artisan orcest:build "Create customer invoicing API" --swagger

# Bypass Swagger documentation generation
php artisan orcest:build "Create internal queue worker" --no-swagger

# Dry-run mode: Preview requirements, backlog, code diffs, and test runs without altering disk or Git
php artisan orcest:build "Add two-factor authentication" --dry-run

# Interactive Human-in-the-Loop review (pauses after plan & before commit)
php artisan orcest:build "Create subscription billing" --interactive

# Fully autonomous mode (bypasses all human review gates)
php artisan orcest:build "Create subscription billing" --no-human-review

# Bypass project memory recall and consolidation
php artisan orcest:build "Create temporary export" --no-memory

# Bypass web scraping agent even if URLs are present in prompt
php artisan orcest:build "Import products from catalog" --no-scrape

# Set custom guardrail limits
php artisan orcest:build "Implement complex report" --max-steps=30 --max-fix-attempts=2

# Route to a specific configured LLM driver (e.g. fake, openai, anthropic, ollama)
php artisan orcest:build "Create user profile API" --llm=openai_compatible

# Resume an interrupted or paused run from its last checkpoint
php artisan orcest:build --resume=run_a1b2c3d4e5f6

Approve or Reject a Paused Run

# Approve a paused run at its active gate and resume execution
php artisan orcest:approve run_a1b2c3d4e5f6

# Approve with an audit or feedback note
php artisan orcest:approve run_a1b2c3d4e5f6 --note="Architecture approved by lead"

# Reject and terminate execution cleanly without committing changes
php artisan orcest:approve run_a1b2c3d4e5f6 --reject --note="Missing RBAC authorization policies"

Inspect Execution Runs & Status

# List recent execution runs in a formatted table
php artisan orcest:status

# Inspect full details for a specific run ID (artifacts, tests, reviews, tokens, git branch)
php artisan orcest:status run_a1b2c3d4e5f6

3. Programmatic Usage via Facade (Orcest or Orchestrator)

use Yousef\LaraOrcest\Facades\Orcest;
use Yousef\LaraOrcest\Graph\DefaultGraphBuilder;
use Yousef\LaraOrcest\State\RunState;

// 1. Run a full feature workflow with Swagger documentation
$state = Orcest::run('Implement order status update API and make swagger documentation for backend', [
    'dry_run' => false,
    'swagger' => true,
    'max_fix_attempts' => 3,
    'on_step' => function (RunState $state, string $node, string $message) {
        logger()->info("[Step {$state->guardrails['step_count']}] Node: {$node} - {$message}");
    },
]);

if ($state->isCompleted()) {
    echo "Feature built successfully!\n";
    echo "Git Branch: {$state->gitState['feature_branch']}\n";
    echo "Artifacts: " . count($state->artifacts) . "\n";
    
    // Check generated Swagger documentation
    if ($state->hasSwaggerDocs()) {
        $spec = $state->getSwaggerSpec();
        echo "OpenAPI Version: {$spec['openapi']}\n";
    }
}

// 2. Standalone Swagger Pipeline (backend_agent -> swagger_agent -> completed)
$swaggerEngine = DefaultGraphBuilder::buildSwaggerPipeline(
    llm: app(\Yousef\LaraOrcest\LLM\LlmManager::class)->driver()
);
$swaggerState = $swaggerEngine->run(RunState::create('Generate OpenAPI documentation for TaskController'));

// 3. Standalone Web Scraping Pipeline (BA -> PM -> WebScraper -> completed)
$scrapingState = Orcest::run('Extract electronics catalog from alpha and beta vendors', [
    'web_scraping' => [
        'source_urls' => ['https://site-a.com/catalog', 'https://site-b.com/catalog'],
        'target_endpoint' => 'https://api.my-app.com/v1/catalog-ingest',
        'method' => 'POST',
        'stop_after_scraping' => true,
    ],
]);
$results = $scrapingState->getScrapingResults();
echo "Scraping Status: " . $results['dispatch']['status'] . "\n";

// 4. Resume, approve, or reject paused runs
$resumedState = Orcest::resume('run_a1b2c3d4e5f6');
$approvedState = Orcest::approve('run_a1b2c3d4e5f6', 'Lead signed off');
$rejectedState = Orcest::reject('run_a1b2c3d4e5f6', 'Needs additional test cases');

// 5. Inspect status and project memory
$allRuns = Orcest::status();
$memory = Orcest::memory();
$codebaseIndex = $memory->getIndex();

How to Test LaraOrcest

LaraOrcest provides multiple layers of automated testing and developer verification:

1. Running the Automated Test Suite (PHPUnit)

Run all package unit and feature tests:

# Run the complete test suite (236+ tests)
./vendor/bin/phpunit

# Run with testdox format for readable output
./vendor/bin/phpunit --testdox

2. Testing Specific Feature Suites

You can execute targeted test suites to verify individual subsystems:

# Test Swagger / OpenAPI Documentation Agent
./vendor/bin/phpunit tests/Unit/SwaggerAgentTest.php
./vendor/bin/phpunit tests/Feature/SwaggerFeatureTest.php

# Test Web Scraping & Ingestion Agent
./vendor/bin/phpunit tests/Unit/WebScrapingAgentTest.php
./vendor/bin/phpunit tests/Feature/WebScrapingFeatureTest.php

# Test Parallel Execution & Scope Conflict Detection
./vendor/bin/phpunit tests/Unit/ParallelExecutionTest.php
./vendor/bin/phpunit tests/Unit/ParallelSchedulerTest.php
./vendor/bin/phpunit tests/Unit/ScopeConflictDetectorTest.php

# Test Human-in-the-Loop Review Gates
./vendor/bin/phpunit tests/Unit/HumanInTheLoopTest.php
./vendor/bin/phpunit tests/Feature/HumanInTheLoopFeatureTest.php

# Test Project Memory & Codebase Index (Memorilla)
./vendor/bin/phpunit tests/Unit/ProjectMemoryStoreTest.php
./vendor/bin/phpunit tests/Feature/ProjectMemoryFeatureTest.php

# Test Multi-Lingual Mail Templates & Localization
./vendor/bin/phpunit tests/Feature/LocalizationAndNotificationTemplatesTest.php

# Test Sandboxed Tools & Security Boundaries
./vendor/bin/phpunit tests/Unit/PathGuardSecurityTest.php
./vendor/bin/phpunit tests/Unit/ArtisanRunnerToolEnhancedTest.php
./vendor/bin/phpunit tests/Unit/GitCommandToolEnhancedTest.php
./vendor/bin/phpunit tests/Unit/PatchWriterToolEnhancedTest.php
./vendor/bin/phpunit tests/Unit/FileReaderToolEnhancedTest.php
./vendor/bin/phpunit tests/Unit/TestRunnerToolEnhancedTest.php

# Test Agent Turn Execution & Error Handling
./vendor/bin/phpunit tests/Unit/AgentsExecutionTest.php
./vendor/bin/phpunit tests/Unit/CyclicFixLoopTest.php

3. Testing Safely Without LLM API Costs (--llm=fake)

Use the built-in deterministic FakeDriver to run tests and command simulations with zero token cost and zero network calls:

# Test feature orchestration with fake LLM driver in dry-run mode
php artisan orcest:build "Create user profile API with swagger documentation" --llm=fake --dry-run

# Test Swagger documentation generation with fake driver
php artisan orcest:build "Create customer invoice endpoints" --llm=fake --swagger --dry-run

# Test interactive review gates with fake driver
php artisan orcest:build "Create payment gateway" --llm=fake --interactive --dry-run

4. Testing in a Real Laravel Application

To test end-to-end integration inside an active Laravel project:

  1. Dry-Run Preview:

    php artisan orcest:build "Create a Category CRUD with migration, model, controller, and tests" --dry-run

    Inspect the output to verify:

    • Requirements specification generated by business_analyst.
    • Backlog acceptance criteria generated by product_manager.
    • Architecture plan generated by architect.
    • Code previews for migrations, models, controllers, and tests.
  2. Full Execution (Live Feature Branch):

    php artisan orcest:build "Create a Category CRUD with migration, model, controller, and tests" --swagger

    Verify that:

    • Git branch orcest/category-crud is created automatically.
    • Migration database/migrations/*_create_categories_table.php is generated.
    • Eloquent model app/Models/Category.php is created.
    • Controller app/Http/Controllers/Api/CategoryController.php is created.
    • Swagger documentation is written to docs/swagger.json.
    • Tests in tests/Feature/CategoryApiTest.php pass.
    • Milestone commit is recorded cleanly on the feature branch.

Sandboxed Tools & Security Guardrails

LaraOrcest enforces strict security boundaries at the tool layer. Prompts are treated as untrusted inputs; tools validate and restrict every disk, command, and Git operation:

1. PathGuard & Root Boundary (PathGuard)

  • Resolves all paths strictly relative to base_path().
  • Rejects path traversal (../) and detects symlinks escaping outside the project root.
  • Global Denylist: Blocks read/write access to sensitive files and directories:
    • Environment: .env, .env.*
    • Version Control: .git, .git/**
    • Dependencies: vendor, vendor/**, node_modules, node_modules/**
    • Logs & Caches: storage/logs/**, bootstrap/cache/**, storage/oauth*
    • Secrets & Certificates: *.key, *.pem, *.crt
  • Per-Agent Allow-Lists:
    • database_agent: restricted to database/ and app/Models/
    • backend_agent: restricted to app/, routes/, and config/
    • swagger_agent: restricted to docs/, storage/api-docs/, public/, routes/, and config/
    • qa_agent: restricted strictly to tests/
    • fixer_agent: restricted to app/, database/, routes/, and tests/

2. File Reader Tool (FileReaderTool)

  • Safe read-only inspection of single files with line slicing (offset, max_lines), byte capping (max_bytes), and existence checking.
  • Directory tree inspection with pattern filtering (e.g. pattern: "*.php"), automatically excluding vendor and log directories.

3. Patch Writer Tool (PatchWriterTool)

  • Supports atomic file creation (write), targeted search-and-replace (replace), and safe file removal (delete).
  • Search-and-replace verifies that target substrings exist before modification.
  • Generates unified diffs (diff) and records artifacts into RunState::$artifacts.
  • Honors $state->isDryRun() without mutating disk.

4. Artisan Command Runner (ArtisanRunnerTool)

  • Executes allow-listed commands via Symfony\Component\Process\Process ([PHP_BINARY, 'artisan', $cmd, ...$args]) inside projectRoot.
  • Approved Commands: make:migration, make:model, make:controller, make:request, make:test, make:factory, make:seeder, make:resource, make:policy, make:rule, make:class, make:enum, make:interface, make:trait, route:list, migrate:status, test.
  • Strictly blocks dangerous flags (--force, --drop-views, --drop-types, --seed) and shell metacharacters (|, ;, &, `, $, <, >, \n).

5. Automated Test Runner (TestRunnerTool)

  • Runs test suites via php artisan test --without-tty with configurable process timeouts.
  • Parses output into structured diagnostics: passed, exit_code, duration, summary, failures, and timed_out (handling exit code 124).

6. Git Operations (GitCommandTool)

  • Restricted fixed commands: status, current_branch, branch, create_branch, diff, stage_files, and commit.
  • Blocks destructive commands (push --force, reset --hard, clean -fd) and direct commits to protected branches (main, master, production, staging).
  • Redacts credentials matching https://*@ to https://[REDACTED_CREDENTIALS]@.

State Persistence & Checkpointing

LaraOrcest persists execution state after each step and terminal event, allowing runs to be inspected or resumed without losing progress:

  • JSON Driver (Default): Saves states to storage/app/orcest/checkpoints/{run_id}.json. Uses atomic file writes (writing to temporary staging files before renaming) to prevent corruption.
  • Database Driver: Persists states in the orcest_runs database table via Laravel's query builder.
  • Configurable Storage: Configure driver, file path, and table under config/lara-orcest.php:
    'checkpoint' => [
        'driver' => env('LARA_ORCEST_CHECKPOINTER', 'json'), // 'json' or 'database'
        'path' => env('LARA_ORCEST_CHECKPOINT_DIR', null),   // defaults to storage/app/orcest/checkpoints
        'table' => 'orcest_runs',
    ],

Configuration Reference

Key configuration options available in config/lara-orcest.php:

return [
    // Enable or disable package globally
    'enabled' => (bool) env('LARA_ORCEST_ENABLED', true),

    // LLM Proxy & Provider settings
    'llm' => [
        'default' => env('LARA_ORCEST_LLM', 'openai_compatible'),
        'drivers' => [
            'openai_compatible' => [
                'base_url' => env('LARA_ORCEST_LLM_BASE_URL', 'https://api.openai.com/v1'),
                'api_key' => env('LARA_ORCEST_LLM_API_KEY', env('OPENAI_API_KEY')),
                'model' => env('LARA_ORCEST_LLM_MODEL', 'gpt-4o-mini'),
                'timeout' => (int) env('LARA_ORCEST_LLM_TIMEOUT', 60),
                'retries' => (int) env('LARA_ORCEST_LLM_RETRIES', 2),
            ],
        ],
        // Per-agent model routing
        'agent_models' => [
            'architect' => env('LARA_ORCEST_MODEL_ARCHITECT'),
            'reviewer_agent' => env('LARA_ORCEST_MODEL_REVIEWER_AGENT'),
            'backend_agent' => env('LARA_ORCEST_MODEL_BACKEND_AGENT'),
            'swagger_agent' => env('LARA_ORCEST_MODEL_SWAGGER_AGENT'),
            'database_agent' => env('LARA_ORCEST_MODEL_DATABASE_AGENT'),
            'web_scraping_agent' => env('LARA_ORCEST_MODEL_WEB_SCRAPING_AGENT'),
        ],
    ],

    // Guardrail budgets
    'execution' => [
        'max_steps' => (int) env('LARA_ORCEST_MAX_STEPS', 40),
        'max_fix_attempts' => (int) env('LARA_ORCEST_MAX_FIX_ATTEMPTS', 3),
        'dry_run' => (bool) env('LARA_ORCEST_DRY_RUN', false),
        'process_timeout' => (int) env('LARA_ORCEST_PROCESS_TIMEOUT', 120),
    ],

    // Parallel & sub-graph execution
    'graph' => [
        'parallel' => [
            'enabled' => (bool) env('LARA_ORCEST_PARALLEL_ENABLED', true),
            'max_concurrency' => (int) env('LARA_ORCEST_MAX_CONCURRENCY', 4),
        ],
    ],

    // Human-in-the-Loop review gates
    'human_in_the_loop' => [
        'enabled' => (bool) env('LARA_ORCEST_HITL_ENABLED', false),
        'skip_review' => (bool) env('LARA_ORCEST_SKIP_HUMAN_REVIEW', false),
        'gates' => [
            'after_plan' => (bool) env('LARA_ORCEST_GATE_AFTER_PLAN', true),
            'before_commit' => (bool) env('LARA_ORCEST_GATE_BEFORE_COMMIT', true),
        ],
    ],

    // Hierarchical Lead + Sub-Agent Teams (Pods)
    'teams' => [
        'enabled' => (bool) env('LARA_ORCEST_TEAMS_ENABLED', true),
        'parallel_sub_agents' => (bool) env('LARA_ORCEST_PARALLEL_SUB_AGENTS', true),
        'max_sub_agents_per_lead' => (int) env('LARA_ORCEST_MAX_SUB_AGENTS_PER_LEAD', 5),
    ],

    // Modular Agent Skills & Progressive Disclosure
    'skills' => [
        'enabled' => (bool) env('LARA_ORCEST_SKILLS_ENABLED', true),
        'allow_custom' => (bool) env('LARA_ORCEST_ALLOW_CUSTOM_SKILLS', true),
        'max_active_skills' => (int) env('LARA_ORCEST_MAX_ACTIVE_SKILLS', 5),
        'path' => env('LARA_ORCEST_SKILLS_PATH', null),
        'custom_path' => env('LARA_ORCEST_CUSTOM_SKILLS_PATH', '.lara-orcest/skills'),
    ],

    // Swagger / OpenAPI documentation
    'swagger' => [
        'enabled' => (bool) env('LARA_ORCEST_SWAGGER_ENABLED', true),
        'conditional_activation' => (bool) env('LARA_ORCEST_SWAGGER_CONDITIONAL', false),
        'auto_generate' => (bool) env('LARA_ORCEST_SWAGGER_AUTO_GENERATE', false),
        'title' => env('LARA_ORCEST_SWAGGER_TITLE', 'Laravel Application API Documentation'),
        'version' => env('LARA_ORCEST_SWAGGER_VERSION', '1.0.0'),
        'openapi_version' => env('LARA_ORCEST_SWAGGER_OPENAPI_VERSION', '3.0.3'),
        'output_format' => env('LARA_ORCEST_SWAGGER_FORMAT', 'json'), // 'json', 'yaml', or 'both'
        'output_path' => env('LARA_ORCEST_SWAGGER_PATH', 'docs/swagger.json'),
    ],

    // Project memory & codebase index (Memorilla architecture)
    'memory' => [
        'enabled' => (bool) env('LARA_ORCEST_MEMORY_ENABLED', true),
        'path' => env('LARA_ORCEST_MEMORY_PATH', '.lara-orcest/memory.json'),
        'max_context_chars' => (int) env('LARA_ORCEST_MEMORY_MAX_CHARS', 2500),
        'max_items' => (int) env('LARA_ORCEST_MEMORY_MAX_ITEMS', 15),
        'auto_index' => (bool) env('LARA_ORCEST_MEMORY_AUTO_INDEX', true),
    ],

    // Web scraping & ingestion
    'web_scraping' => [
        'enabled' => (bool) env('LARA_ORCEST_SCRAPE_ENABLED', true),
        'timeout' => (int) env('LARA_ORCEST_SCRAPE_TIMEOUT', 30),
        'retries' => (int) env('LARA_ORCEST_SCRAPE_RETRIES', 2),
        'retry_sleep' => (int) env('LARA_ORCEST_SCRAPE_RETRY_SLEEP', 100),
        'max_response_size' => (int) env('LARA_ORCEST_SCRAPE_MAX_SIZE', 500_000),
        'max_content_chars' => (int) env('LARA_ORCEST_SCRAPE_MAX_CHARS', 10_000),
        'allowed_schemes' => ['http', 'https'],
        'allow_private_ips' => (bool) env('LARA_ORCEST_SCRAPE_ALLOW_PRIVATE_IPS', false),
        'default_endpoint' => env('LARA_ORCEST_SCRAPE_DEFAULT_ENDPOINT'),
        'default_method' => env('LARA_ORCEST_SCRAPE_DEFAULT_METHOD', 'POST'),
        'user_agent' => env('LARA_ORCEST_SCRAPE_USER_AGENT', 'Mozilla/5.0 (compatible; LaraOrcestScraper/1.0; +https://github.com/yousefhatem/LaraOrcest)'),
    ],

    // Git hygiene & safety
    'git' => [
        'enabled' => (bool) env('LARA_ORCEST_GIT_ENABLED', true),
        'feature_branch_prefix' => env('LARA_ORCEST_BRANCH_PREFIX', 'orcest/'),
        'protected_branches' => ['main', 'master', 'production', 'staging'],
        'auto_commit' => (bool) env('LARA_ORCEST_AUTO_COMMIT', true),
        'auto_push' => false,
    ],

    // Sandboxed tools boundaries
    'tools' => [
        'max_read_size' => 1_000_000, // 1MB
        'deny_paths' => ['.env', '.git', 'vendor', 'node_modules', 'storage/logs', '*.key'],
        'process_timeout' => 120,
    ],

    // Checkpoint persistence
    'checkpoint' => [
        'driver' => env('LARA_ORCEST_CHECKPOINTER', 'json'),
        'path' => env('LARA_ORCEST_CHECKPOINT_DIR', null),
        'table' => 'orcest_runs',
    ],
];

Testing & Quality Assurance

LaraOrcest is built with test-driven discipline and maintains 100% passing test suites across both Unit and Feature test suites.

Running Tests Locally

# Run the complete test suite via Composer script
composer test

# Run tests directly with PHPUnit
./vendor/bin/phpunit

# Run specific test suites
composer test:unit
composer test:feature

All tests execute deterministically in isolated sandbox environments using LARA_ORCEST_LLM=fake and LARA_ORCEST_CHECKPOINTER=json, requiring zero live LLM API keys or external network requests.

Continuous Integration (GitHub Actions)

Every push and pull_request to main triggers the automated CI pipeline (.github/workflows/tests.yml):

  • PHP Matrix: Validates compatibility across PHP 8.2, 8.3, and 8.4.
  • Composer Strictness: Runs composer validate --strict and installs optimized dependencies with caching.
  • Test Suite: Executes 328 automated unit and feature tests with 1,940+ assertions.
  • Docs Build Verification: Verifies VitePress documentation site compilation (npm run docs:build) to catch broken links or invalid markdown before merging.
  • GitHub Pages Deployment: Verified documentation changes on main automatically deploy to GitHub Pages via .github/workflows/docs.yml.

License

LaraOrcest is open-sourced software licensed under the MIT License.