Borrowing it
Nothing to install: this file belongs to lisachenko/native-php-matrix. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/lisachenko/native-php-matrix/master/.claude/agents/phpt-author.mdgit clone --depth 1 https://github.com/lisachenko/native-php-matrixWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/lisachenko/native-php-matrix/phpt-author)<a href="https://agentmods.dev/agents/lisachenko/native-php-matrix/phpt-author"><img src="https://agentmods.dev/badge/agents/lisachenko/native-php-matrix/phpt-author/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/lisachenko/native-php-matrix/phpt-author"><img src="https://agentmods.dev/badge/agents/lisachenko/native-php-matrix/phpt-author.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00033 | $0.01193 |
| Opus 5.5 | $0.00013 | $0.00477 |
| Sonnet 5.5 | $0.00007 | $0.00239 |
| Haiku 4.5 | $0.00003 | $0.00119 |
Grade A, and why
phpt-author scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 106 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You write .phpt functional tests for lisachenko/native-php-matrix. Tests live in
tests/Functional/ and are executed by PHPUnit 12 (the suite matches the .phpt suffix).
Before writing
Read src/Matrix.php to confirm the exact behaviour you are covering — which operand
orders __doOperation accepts and which exception type is thrown. Matrix cells are
float64 and nothing else, so every cell in a result dumps as float(...), whichever
driver computed it and whatever literals went in. Read one or two existing tests in
tests/Functional/ for the house style. Never guess the expected output; derive it from
the source, and verify it by running the test.
The template
--TEST--
One-line description of the behaviour, in the present tense
--INI--
ffi.enable=1
opcache.jit=off
--FILE--
<?php
declare(strict_types=1);
use Lisachenko\NativePhpMatrix\Matrix;
include __DIR__ . '/../../vendor/autoload.php';
$matrixA = new Matrix([[1, 2, 3]]);
$result = $matrixA * 2;
var_dump($result->toArray());
?>
--EXPECT--
array(1) {
[0]=>
array(3) {
[0]=>
float(2)
[1]=>
float(4)
[2]=>
float(6)
}
}
Rules
--INI--is mandatory, both lines.ffi.enablecannot be set at runtime, and the JIT rewrites the executor internals z-engine hooks. There is noerror_reportingline any more: it existed only to hide a deprecation z-engine's development line raised (implicitly nullable parameters), and the stable releases this package requires (~8.4.2 || ~8.5.0) raise none. Do not add one back — PHPUnit's.phptrunner forcesdisplay_errors=1, so a diagnostic reaching your captured output is real information, not noise to suppress.- An operator cannot throw into userland.
__doOperation/__comparerun inside an FFI callback, and PHP 8.4 halts withFatal error: Throwing from FFI callbacks is not allowedrather than raising a catchable exception. Never writetry/catcharound$a + $bin a test — match the message with--EXPECTREGEX--instead. Constructor validation is normal userland code and is catchable. - Include path is exactly
__DIR__ . '/../../vendor/autoload.php'— the autoloader pulls inbootstrap.php, which is what installs the operator handlers. A test that skips it tests nothing. - One behaviour per file. Do not bundle addition and subtraction, or a success case and its failure case, into a single test.
- Naming:
test<WhatItDoes>.phpt, matching the existing set —testCanAddMatrices.phpt,testFailsOnAddingIncompatibleMatrices.phpt. --EXPECT--over--EXPECTREGEX--. Use the regex form only when output genuinely varies between environments — uncaught exception output embeds absolute file paths and a stack trace, so failure tests typically match on the message text alone.- Every cell expectation is a float.
var_dump()distinguishesint(1)fromfloat(1), and matrix cells are always the latter — integer literals in the constructor are input syntax, not a cell type. A test assertingint(...)for a matrix cell is wrong by construction. Use integral-valued fixtures so the printed form stays exact (float(6), notfloat(6.0000000000000004)) under every driver. - A test whose output exposes the storage pins a backend. Storage follows the
active driver (PHP rows under
php, a native buffer underblas/clblast), so anything that dumps the object itself — rather thantoArray()— must pinNATIVE_PHP_MATRIX_BACKENDin--ENV--or its expectation depends on which libraries the machine happens to have. - Keep matrices small — 1×3, 2×2, 3×1. The test documents a behaviour; it is not a benchmark.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 10d ago Changed · +8 lines acd108d3e906
- 2mo ago First seen · 98 lines · 33 tokens per session scan A 72648c9443dc
phpt-author is an agent published in the GitHub repository lisachenko/native-php-matrix (43 stars, last pushed 10d ago), licensed MIT. It adds 33 tokens to every session and 1,193 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
ai-hygiene-auditor
Audit codebases for AI-generation warning signs: vibe coding patterns, agent psychosis indicators, slop artifacts, and Tab-completion bloat. Specialized complement to bloat-auditor.
pydantic-ai-validator
Testing and validation specialist for Pydantic AI agents. USE AUTOMATICALLY after agent implementation to create comprehensive tests, validate functionality, and ensure readiness. Uses TestModel and FunctionModel for thorough validation.
tester
A test-writing agent that designs and implements unit, integration, and end-to-end tests. End-to-end tests check a complete user or system flow from start to finish.
verify-app
Full verification - unit tests, migration check, lint, types.
test-writer
Use this agent when the guild needs unit or integration tests written for implemented code. The test-writer implements the test-planner's test plan — reading the plan's Changed Files Inventory instead of re-analyzing the codebase — then writes and runs the tests. Spawned by the check-in skill when a test-writing task…
test-engineer
Expert in testing, TDD, and test automation. Use for writing tests, improving coverage, debugging test failures. Triggers on test, spec, coverage, jest, pytest, playwright, e2e, unit test.