PHP-first implementation guide and executable reference
Status: normative engineering direction with deliberately limited example code.
Platform baseline
Use PHP 8.4+, Debian, Caddy/HTTPS, PHP-FPM and CLI workers under systemd/cron for the economical single-host control plane. SQLite WAL + FTS5 is acceptable for one-writer/low-concurrency operation with disciplined transactions, indexes, migrations, busy timeouts and backup. sqlite-vec is optional retrieval acceleration, not an authorization oracle. Python/FastAPI, llama.cpp and vLLM are worker/runtime adapters—not a demand that the control plane adopt Python or permanently load GPUs.
Reference code shipped
reference/php/Planner.php: deterministic qualification of fictional candidates and simulated microcredit costs; no network access.reference/php/CaptureStudio.php: exact byte-for-byte evidence copy and hash, bounded literal template inference, 3 generated parameter variants, suggestion queue and test manifest; no chat-app access or model call.reference/php/cli.php:planandcapturedemonstrations using checked-in fixtures; output JSON for inspection.reference/tests/test_reference.php: negative, fidelity, no-side-effect and routing tests.
Try:
php reference/php/cli.php plan examples/task-small.json
php reference/php/cli.php plan examples/task-ultra.json
php reference/php/cli.php capture examples/capture-template.json /tmp/maistro-capture
php reference/tests/test_reference.php
The reference uses strings, unit-labeled fictional prices and no supplier SDK, credential store, queue, background process, or model. It must never be confused with a production GPU tool. Capture originals in an operator-controlled local folder, not a public web root.
Candidate implementation skeleton
Use route handlers strictly for auth and planning; a supervised CLI dispatcher for queue work; a transactional outbox for remote side effects; a separate guardian process and trust domain; SQLite migrations managed under Git; signed release registry for approved static rules. Production PHP never eval()s generated code. Templates use reviewed strtr()-style engines with typed allowlists, not freeform PHP script execution. Protect user strings via context-specific escaping in each consuming interface.
Offline and portable output
A promoted package contains manifest.json, typed schema, reference fixtures and hashes, signed review evidence, deterministic PHP function or DSL table, dependency lock and rollback instructions. All model-specific components must be optional unless required by a declared capability. An offline profile cannot silently fetch missing dependency artifacts.
Runtime risks to test
Race conditions in SQLite outbox, process termination, double dispatch, integer overflow in billing, stale provider prices, unauthenticated event source, PHP serialization gadgets, path traversal in evidence ingestion, regex denial-of-service, Unicode normalization mismatch, HTML context escaping and rule drift. Use PHP static analysis, PHPUnit/property tests, dependency scans and explicit integration tests before deployment.