Laravel Necromancer scans your bootstrapped application and produces a structured manifest of 18 artifact types — routes, models, jobs, events, policies, and more — so AI coding agents always have an accurate picture of your application.
$ php artisan necromancer:doctor
Laravel Necromancer — AI Readability Score
──────────────────────────────────────────
Score: 74%
Route Clarity ████████░░ 82% (12/15 named · 14/15 controller-backed)
Model Expressiveness ██████░░░░ 61% (3/5 casts · 4/5 fillable · 2/5 relationships)
Authorization Coverage ███████░░░ 70% (2/3 policies · 8/12 write routes with auth)
Validation Coverage ████████░░ 80% (8/10 write routes with FormRequest)
Async Clarity ████████░░ 83% (4/5 jobs configured · 4/4 events with listeners)
Codebase Vocabulary ██████░░░░ 63% (5/8 commands described · 1/1 backed enums)
Test Presence ████████░░ 80% (4/5 models · 3/3 jobs)
Tip: run necromancer:audit for a detailed findings list.
The manifest covers 18 artifact types across the full Laravel application structure. Every artifact carries a source field with file, line, and hash for precise citations and stale detection.
Necromancer follows a scan-first workflow — every other command reads the manifest produced by
necromancer:scan.
necromancer:scan
Bootstraps the application and writes the necromancer.json manifest. Re-run whenever your application changes. Supports partial scans and CI drift detection.
php artisan necromancer:scan
php artisan necromancer:scan --only=routes,models
php artisan necromancer:scan --diff --fail-on-drift # CI gate
necromancer:map
Terminal-based pretty-printer of the manifest inventory. Read-only; never writes to disk. Shows a stale-manifest warning if source files are newer than the manifest.
php artisan necromancer:map php artisan necromancer:map --type=routes php artisan necromancer:map --type=models
necromancer:audit
Scored AI-readability report (0–100). Findings grouped by severity: error (−10), warning (−5), suggestion (−1). Checks unnamed routes, missing model casts, dead events, unconfigured jobs, and more.
php artisan necromancer:audit php artisan necromancer:audit --format=markdown --output=audit.md php artisan necromancer:audit --fail-on=error # exit 1 on errors (CI) php artisan necromancer:audit --fail-on=warning # exit 1 on warnings or errors
necromancer:doctor
Seven-dimension AI readability percentage dashboard with progress bars. Dimensions: Route Clarity, Model Expressiveness, Authorization Coverage, Validation Coverage, Async Clarity, Codebase Vocabulary, Test Presence.
php artisan necromancer:doctor
php artisan necromancer:doctor --json
php artisan necromancer:doctor --min-score=80 # exit 1 when score < 80 (CI)
php artisan necromancer:doctor --only=route-clarity
necromancer:generate
Produces NECROMANCER.md — a full Markdown context file for AI coding agents. When Laravel Boost is installed, writes to .ai/guidelines/necromancer.md automatically.
php artisan necromancer:generate php artisan necromancer:generate --only=routes,models php artisan necromancer:generate --except=listeners,validation_rules php artisan necromancer:generate --output=.ai/context/app.md --force
necromancer:ask
Natural-language codebase Q&A. The manifest is injected verbatim into the AI's context — answers are grounded in your actual application, not the model's prior knowledge. Requires laravel/ai.
php artisan necromancer:ask "What routes require authentication?"
php artisan necromancer:ask # interactive prompt
php artisan necromancer:ask "..." --provider=anthropic --model=claude-sonnet-4-5
necromancer:prompt
Builds a ready-to-paste AI prompt grounded in the most relevant manifest entries for your question. Keyword-searches the manifest, ranks artifacts by relevance, and outputs a prompt block with file:line citations.
php artisan necromancer:prompt "Where is tenant isolation enforced?" php artisan necromancer:prompt "billing" --top=5 php artisan necromancer:prompt "auth" --no-ai --output=prompt.txt
necromancer:infer
Generates Architecture Decision Records (ADRs) from the manifest using AI. Evaluates nine architectural dimensions (async-processing, authorization, event-driven, api-design, data-modeling, command-scheduling, form-validation, external-services, architecture-pattern). A critic agent reviews and filters the initial ADRs. Requires laravel/ai.
php artisan necromancer:infer php artisan necromancer:infer --dry-run # print without writing files php artisan necromancer:infer --temperature=0 --max-critic-rounds=2 php artisan necromancer:infer --locale=it # add Italian translation php artisan necromancer:infer --fresh # clear cache and re-infer
necromancer:diff
Compares the current manifest against a branch or snapshot. Shows added, removed, and modified routes, models, jobs, events, listeners, policies, and other artifacts. With --review, an AI agent summarises the architectural impact and surfaces risks.
php artisan necromancer:diff main php artisan necromancer:diff main --review --format=markdown php artisan necromancer:diff --base-manifest=snapshots/before.json
necromancer:benchmark
Measures how much Necromancer's generated context improves AI accuracy, hallucination rate, and token cost. Runs a task suite in three conditions — no context, manual AGENTS.md, and Necromancer-generated NECROMANCER.md — and reports results side by side. Use --generate-suite to scaffold a grounded task suite from the current manifest before running the benchmark.
php artisan necromancer:benchmark php artisan necromancer:benchmark --generate-suite # scaffold tasks from manifest → config/benchmark-tasks.php php artisan necromancer:benchmark --generate-suite --suite-output=custom/tasks.php php artisan necromancer:benchmark --no-judge # automated checks only php artisan necromancer:benchmark --format=markdown --output=benchmark.md
Three steps from zero to AI-readable codebase.
composer require --dev robertogallea/laravel-necromancer
The service provider is auto-discovered — no manual registration needed. Optionally publish the configuration:
php artisan vendor:publish --tag=necromancer-config
Build the manifest. Re-run whenever your application changes.
php artisan necromancer:scan
Check AI-readability and generate the Markdown context file.
php artisan necromancer:audit php artisan necromancer:generate
Add these steps to your pipeline to enforce manifest freshness and AI-readability quality gates.
- name: Check manifest is up to date run: php artisan necromancer:scan --diff --fail-on-drift - name: Fail on AI-readability errors run: php artisan necromancer:audit --fail-on=error - name: Enforce minimum AI readability score run: php artisan necromancer:doctor --min-score=80
When laravel/mcp is installed, Necromancer exposes the manifest as read-only tools via a
laravel-necromancer MCP server handle — auto-configured in .mcp.json on first run.
query_routes
List routes, optionally filtered by method or name/URI pattern.
query_models
List Eloquent models, optionally filtered by class name.
query_artifacts
List artifacts of any type, optionally filtered by JSON substring. Use when you know the artifact type.
search_artifacts
Full-text search across all artifact types. Use when you need to search across types.
{
"mcpServers": {
"laravel-necromancer": {
"command": "php",
"args": ["artisan", "mcp:start", "necromancer"]
}
}
}
Necromancer reads PHP 8 attributes as primary data sources alongside class properties. Codebases using the attribute-based API introduced in Laravel 11+ are fully supported.
| Subsystem | Attributes | Manifest fields |
|---|---|---|
| Routing |
#[Authorize]
|
authorization |
| Eloquent |
#[ObservedBy]
#[UsePolicy]
#[ScopedBy]
#[UseFactory]
#[UseEloquentBuilder]
#[Scope]
|
observers,
policy,
global_scopes,
factory,
custom_builder,
scopes
|
| Queue |
#[Queue]
#[Connection]
#[Tries]
#[Timeout]
#[Backoff]
#[MaxExceptions]
|
all job queue config fields |
| Console |
#[Aliases]
|
aliases |
| FormRequest |
#[StopOnFirstFailure]
#[ErrorBag]
|
stop_on_first_failure,
error_bag
|
.env or raw configuration values// config/necromancer.php
'exclude' => [
'routes' => ['horizon.*', 'telescope.*', 'debugbar.*'],
'models' => [],
'tests' => [],
],