What the agent does
The agent reads the issue and then the panel it names. In a project shaped like filamentphp/demo, composer.json is on Laravel 12 with filament/filament 5, the Spatie media library, settings and tags plugins, Octane, Sanctum, Pest 3 with pestphp/pest and Larastan, Pint and Rector in dev, and a test:pest script that runs pest --parallel. The Shop domain lives in app/Models/Shop: Order has number, total_price, status cast to the OrderStatus enum with New, Processing, Shipped, Delivered and Cancelled, shipping_price, shipping_method and notes, soft deletes, a customer relation, orderItems with qty and unit_price per item and a product, payments with a currency and a method, and a morphed address with country, street, city, state and zip. The resource is app/Filament/Resources/Shop/Orders/OrderResource.php with OrderForm, OrdersTable, a PaymentsRelationManager and ListOrders, CreateOrder and EditOrder pages. OrdersTable already has an ActionGroup of record actions named process, ship, deliver, cancel and delete, each firing a Notification, and EditOrder has header actions for replicate, delete, restore and force delete. The panel in AdminPanelProvider enables databaseNotifications() and runs in SPA mode. Tests live under tests/Filament/Resources/Shop/Orders/Pages/ and use Livewire::test(ListOrders::class) with TestAction::make('process')->table($record) and assertNotified(), with Pest.php applying RefreshDatabase and an authenticated user to everything under tests/Filament.
The issue asks for a downloadable invoice per order. The agent adds barryvdh/laravel-dompdf with composer require, since the project has no PDF library and that package renders Blade to PDF without a browser. It writes resources/views/pdf/invoice.blade.php, a single-page template with the shop name, the order number and date, the customer name and the morphed address, one row per orderItems entry with product name, qty, unit_price and the line total, the shipping_price and shipping_method, the total_price, and a payments block listing each payment's method, currency and amount. It adds app/Services/Shop/InvoicePdf.php with one method that eager-loads customer, address, orderItems.product and payments, renders the view through the DomPDF facade and returns the PDF bytes, so the table action, the edit page and any later mail job share one implementation.
In OrdersTable it adds Action::make('invoice') to the existing ActionGroup, with a document icon, visible for every status except Cancelled, whose closure returns response()->streamDownload() with the bytes and a filename built from the order number. The same action is added to EditOrder::getActions() so a reviewer looking at one order can download it from the header. Nothing in OrderForm, the model or the migrations changes, and the action sends no notification because the download itself is the feedback.
Tests follow the existing files. In tests/Filament/Resources/Shop/Orders/Pages/ListOrdersTest.php the agent adds a case that creates an order with items and a payment through the factories, calls TestAction::make('invoice')->table($record) and asserts a file download whose name contains the order number, and a case that asserts the action is hidden for a cancelled order. A new tests/Unit/InvoicePdfTest.php renders the Blade view for a factory order and asserts the number, each product name and the total appear in the HTML before DomPDF sees it. The agent runs composer test:pest, composer test:phpstan and vendor/bin/pint --test until all three pass, then pushes a branch and opens a pull request that quotes the issue and links back to it. The repository's tests.yml runs composer test:pest on PHP 8.4 with SQLite for every pull request, so the new cases run there too.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "A Linear issue labelled agent says: \"Add an Invoice download to orders. From the orders table and the edit page an admin should download a PDF with the order number, customer and address, each item with quantity and unit price, shipping, total and payments.\" Do the work in this repository: add barryvdh/laravel-dompdf, a Blade invoice template, one InvoicePdf service that renders it, an invoice action in the orders table action group and in the EditOrder header actions, hidden for cancelled orders, Pest tests for the download and the hidden state plus a unit test of the rendered view, run composer test:pest, test:phpstan and pint, and open a pull request that links back to the issue.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request on its own branch. The diff touches composer.json and composer.lock for the PDF package, adds resources/views/pdf/invoice.blade.php and app/Services/Shop/InvoicePdf.php, changes app/Filament/Resources/Shop/Orders/Tables/OrdersTable.php and Pages/EditOrder.php for the action, and adds the Pest cases. The description quotes the issue, shows the fields the invoice carries and the filename pattern, and links the Linear issue so the tracker shows the pull request.
The checks are the proof. The repository's tests workflow runs the Pest suite on the pull request, and the session's trajectory at GET /o/{org}/sessions/{id}/messages keeps each composer test:pest, phpstan and pint invocation with its output, so a reviewer sees the download assertion pass and Larastan stay clean rather than reading that they did.
Before merging, a reviewer checks that the template reads amounts from the stored unit_price and total_price rather than recomputing them, that the payments block handles an order with no payment, and that the action's visibility matches what the shop wants for cancelled orders. A reviewer running the demo locally with composer setup opens an order, clicks the invoice action and reads the PDF.
Run it on every Linear issue labelled agent
Sign in to Linear once with POST /me/connections {"type": "app", "name": "linear"} and finish the authorize_url in the console. Add an automation to the Project with this prompt and a linear trigger on linear.issue.labeled, filtered to the agent label; labelling an issue appends it after the prompt and starts a run in the Project's repository, and the pull request links back to the issue. An automation run has its own max_runs_per_hour cap and is not tied to an API key.
From your own server, send POST /o/{org}/sessions with the repository in resources and the issue URL https://linear.app/<workspace>/issue/ENG-42 beside it, read through your Linear connection. Give the key a webhook_url and Rush POSTs run.completed with session_url when the turn ends, so your server can post the pull request link on the issue.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
An invoice feature touches a package install, a Blade template, two Filament pages and the test suite, and in this project the suite runs in parallel with PHPStan and Pint behind it. On Rush the run does all of that in its own cloud sandbox with PHP, Composer and the SQLite database the tests use, iterates until the three checks pass, and your local vendor directory and database are not touched.
Labelled issues arrive in batches, and each becomes its own sandbox and its own pull request with the diff, the Linear link and a trajectory that keeps every test run. The proof of the change is the change itself plus the tests workflow the repository already runs.
Frequently asked questions
Which PDF library does it add?
barryvdh/laravel-dompdf, because it renders a Blade view to PDF in process with no headless browser, which suits the project's test workflow on SQLite and PHP 8.4. If your prompt names Browsershot or Snappy instead, the agent uses that and the pull request says what it requires on the host.
Where does the invoice get its numbers?
From the stored columns: qty and unit_price on each order item, shipping_price and total_price on the order, and the amount on each payment. The template does not recompute the total, so an invoice matches what the admin panel shows, and the unit test asserts the stored total appears.
Can I email the invoice to the customer later?
Yes. The rendering lives in one InvoicePdf service that returns bytes, so a mailable or a queued job can attach the same output without duplicating the template. The pull request names that entry point.
How is a file download tested in Filament?
With Livewire's testing helpers the project already uses: the case calls TestAction::make('invoice')->table($record) on ListOrders and asserts a file download with the order number in its name. A second case asserts the action is hidden on a cancelled order, matching how the existing tests check the process and ship actions.
Does it change the order form or the database?
No. The invoice is read-only over existing columns and relations, so there is no migration and OrderForm is untouched. The only writes are the new files, the two action registrations and the Composer dependency.