Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add agents/lisachenko/native-php-matrix/phpt-authorgit clone --depth 1 https://github.com/lisachenko/native-php-matrixWhat 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 | $0.00033 | $0.01041 |
| Opus 5 | $0.00016 | $0.00521 |
| Sonnet 5 | $0.00007 | $0.00208 |
| Haiku 4.5 | $0.00003 | $0.00104 |
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 2d 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 — 98 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, which exception type is thrown, and whether the result
elements come out as int or float. 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]=>
int(2)
[1]=>
int(4)
[2]=>
int(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.- Types matter.
var_dump()distinguishesint(1)fromfloat(1). PHP's/returns anintonly when the division is exact;**with a negative or fractional exponent returnsfloat. Get this right or the test is worthless. - 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.
- 2d 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 13d ago), licensed MIT. It adds 33 tokens to every session and 1,041 once invoked, about $0.0002 per session on Opus 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
xberg-developer
Route cross-cutting Xberg work to the repository's task-specific architecture and workflow skills.
extraction-engineer
Route document extraction work to format, MIME, pipeline, PDF, safety, corpus, and benchmark guidance.
ocr-engineer
Route OCR backend, preprocessing, geometry, caching, table, and quality work to focused Xberg skills.
plugin-engineer
Route plugin trait, registry, lifecycle, Python bridge, OCR backend, and binding work to focused skills.
crawl-engineer
Web crawling pipeline development.
Demonstrate
Agent for demonstrating VS Code features.