Laravel Tackle: Run an AI Coding Agent Inside Your Laravel Application
Laravel AI #Laravel #AI #Artisan #Composer Package #AI Agent

Laravel Tackle: Run an AI Coding Agent Inside Your Laravel Application

4 min read Mohamed Said Mohamed Said

What Is Laravel Tackle?

Laravel Tackle, created by Jordan Dalton, is an AI coding agent that runs as a set of Artisan commands inside your Laravel application. Because it boots with the framework, it has direct access to the tools you already use: route listing, Telescope exceptions, database queries, and Laravel Pint for formatting after edits.

Safety controls — path restrictions, Artisan allowlists, and per-session spend limits — are enforced in PHP code, not in a prompt. The package is built on laravel/ai and defaults to Claude, but AI_CODE_PROVIDER lets you switch to OpenAI, Gemini, Groq, or a local model via Ollama.

Installation

Tackle requires PHP 8.3 and Laravel 12 or 13.

composer require jordandalton/laravel-tackle

php artisan vendor:publish --provider="Laravel\Ai\AiServiceProvider"
php artisan vendor:publish --tag="tackle-config"

Add your API key to .env:

ANTHROPIC_API_KEY=sk-ant-...

To use a local Ollama model instead:

AI_CODE_PROVIDER=ollama
AI_CODE_MODEL=deepseek-coder-v2
AI_CODE_PRICE_INPUT=0
AI_CODE_PRICE_OUTPUT=0

Tip: Commit or stash your work before the first session. The agent edits files in place unless worktree mode is enabled.

Available Agents

Tackle ships several focused agents:

  • ai:code — interactive REPL with plan mode, slash commands, image attachments, and persistent history
  • ai:run — non-interactive, single-task execution with --output=json for pipelines
  • ai:fix — targeted fix from a pasted exception, a Sentry issue (--sentry=ID), or a GitHub issue (--issue=N)
  • ai:review — reads a diff or pull request and posts inline review comments with severity levels
  • ai:upgrade — migrates a Composer package across a major version using the package's own upgrade guide
  • Self-healer — watches for failed queue jobs and scheduled tasks, patches code in an isolated worktree, and opens a pull request
  • Tackle Remote — a companion package serving the same harness as a mobile browser UI

Safety Boundaries

All limits live in config/tackle.php and cannot be overridden by a prompt:

return [
    'budget_usd' => env('AI_CODE_BUDGET', 1.00),
    'shell' => [
        'local'      => env('AI_CODE_SHELL', 'approve'),
        'production' => env('AI_CODE_SHELL', 'off'),
    ],
    'artisan_allowlist' => [
        'local'      => ['make:*', 'migrate:*', 'db:seed', 'route:list', 'test'],
        'production' => ['route:list'],
    ],
    'protected_paths' => ['.env', '.env.*', 'storage/*', 'vendor/*', '.git/*'],
];

protected_paths blocks reads as well as writes, so the agent cannot read your .env. The budget is a hard stop — the session aborts when estimated spend crosses the limit, with a warning at 80%.

Self-Healing Queue Jobs

Enable self-healing with AI_CODE_HEALING_ENABLED=true, publish the migration, and start a worker on the healer queue. When a job fails, Tackle dispatches a healing agent that applies a minimal fix, runs your test suite, and either opens a pull request or merges directly in patch mode.

You can opt specific jobs out with an attribute:

use Tackle\Attributes\Healable;

#[Healable(false)]
class IssueRefund implements ShouldQueue
{
    public function handle(): void
    {
        // Skipped by the healer entirely.
    }
}

All healing attempts are logged to a tackle_healing_log table, queryable via php artisan tackle:healing-log.

MCP Server

Tackle can expose its Laravel-aware tools over MCP so external editors like Claude Code, Cursor, or Zed can call ListRoutes, QueryDatabase, ReadTelescopeEntry, and RunLarastan against your app:

claude mcp add tackle -- php artisan tackle:mcp

The exposed tool set defaults to read and analysis tools only — no file writes, no shell access.

Key Takeaways

  • Safety rules are PHP code, not prompt instructions — they cannot be talked around
  • Six specialised agents cover coding, fixing, reviewing, upgrading, and self-healing
  • Worktree mode keeps edits isolated until you review the diff
  • TACKLE.md lets you encode project conventions, boundaries, and gotchas for every session
  • MCP support lets external editors use the same Laravel-aware tools
  • Currently at v1.27.3, MIT-licensed, on GitHub at JordanDalton/laravel-tackle

Source: Laravel Tackle on Laravel News

Found this useful?

Frequently Asked Questions

3 questions
Q01 What PHP and Laravel versions does Laravel Tackle require?
Laravel Tackle requires PHP 8.3 and either Laravel 12 or Laravel 13.
Q02 How does Laravel Tackle prevent the AI agent from accessing sensitive files like .env?
The `protected_paths` setting in `config/tackle.php` blocks both reads and writes to listed paths such as `.env`, `storage/*`, and `vendor/*`. These restrictions are enforced in PHP before any tool runs and cannot be overridden by a prompt.
Q03 Can Laravel Tackle automatically fix failed queue jobs without human intervention?
Yes. With `AI_CODE_HEALING_ENABLED=true`, Tackle listens for `JobFailed` events, runs a healing agent in an isolated git worktree, executes your test suite, and either opens a pull request or merges the fix directly in `patch` mode. Jobs can be excluded from healing using the `#[Healable(false)]` attribute.

Continue reading

More Articles

View all