symfony/ai-symfony-mate-extension
Symfony Bridge provides container introspection and profiler data access tools for Symfony AI Mate, letting AI-powered workflows inspect services, wiring, and runtime debug information directly from the Symfony container.
Prerequisites. A Symfony app (6.4/7.x) on PHP 8.2+, a local dev environment with symfony/web-profiler-bundle installed, and an AI Mate client/agent that can connect to your app's tool server. No dependents and a thin README mean you should treat the package as "read the source before trusting the docs."
Minimal steps.
composer require --dev symfony/ai-symfony-mate-extension:0.14.0
Confirm the actual package name on Packagist — this bridge lives in the symfony/ai monorepo and may be published as a split package or shipped via the parent.config/bundles.php:
return [
// ...
Symfony\AI\SymfonyMateExtension\SymfonyMateExtension::class => ['dev' => true, 'test' => true],
];
Prefer Flex's when@dev config blocks over unconditional registration..env inspection, and profiler access should be separate flags, since profiler data is optional and often unavailable, and env inspection should be opt-in on shared setups.bin/console debug:container --tag=ai.tool # tag name may differ — check the source
bin/console list # look for an AI Mate / tool-listing command
symfony-dotenv-check (added in 0.14.0): it is read-only, has no runtime prerequisites, and answers a question you can verify by hand. Then move to container questions.Where to look first.
symfony/ai main repository, not just this bridge — the bridge is a thin adapter and the tool abstractions live upstream.config/services.php / config/services.yaml inside the extension: it tells you exactly what is registered, under which service IDs, and with which tags. This is also where per-tool feature flags live.symfony-service-detail, which grew in 0.14.0.bin/console debug:config <extension_alias> after registration to see the real alias and defaults.First use case. Ask the agent to run symfony-dotenv-check: "Compare .env, .env.local, and .env.test, and tell me which keys are defined in one but missing from the others, and which keys look unused." This exercises the newest tool end-to-end, is read-only, and the result is trivially cross-checkable with grep/diff. Then follow with the container smoke test: "List every service tagged kernel.event_subscriber, show the class and the file where it is defined, and flag any that are private or inlined" — and compare against debug:container --tag=kernel.event_subscriber.
Treat the capability families as separate workflows. Container introspection answers "what is wired how"; .env inspection answers "which configuration is even reachable"; profiler access answers "what happened during that request." Mixing them in a single prompt produces vague answers. Sequence the prompts, and use the env tool as the first step of any "why is config wrong" investigation.
Container introspection patterns. In 0.14.0, symfony-service-detail reports definition flags and constructor arguments, which changes what is worth asking:
App\Service\Foo, show its definition flags — public/private, lazy, shared, abstract, synthetic, autowired, autoconfigured, deprecated — and explain which of them change behavior at runtime."App\Service\Foo and identify which of them are references to other services versus inline scalars."App\Contract\PaymentGateway, and is it the one autowired into CheckoutHandler?"App\Service\Foo be autowired? List candidate services and their aliases."app.scheduled_task, and what priority do they have?".env inspection patterns.
.env but not in .env.example?" — cheap, catches documentation rot on every PR.config/ are absent from .env.test and from the environment variables declared in CI?".env that no config file references.".env, .env.local, .env.test, and .env.local.php if present."Ask about key presence and key sets, not values. If the tool's output ever includes a value, that is a bug worth reporting upstream.
Profiler patterns.
abc123, list every DB query over 50 ms with its caller."app.expensive, and what are their constructor arguments?" — now answerable in one hop thanks to service-detail's constructor args.Agent-instruction integration. Add a short block to AGENTS.md/system prompt:
Use symfony-dotenv-check for questions about which config keys exist; never
paste .env values into chat. Use container tools for wiring questions and
profiler tools for runtime questions. For a service whose behavior you don't
understand, ask for its definition flags and constructor arguments before
guessing at a file path. Never modify files based on tool output without
confirming with the developer.
This measurably reduces the agent guessing at file paths instead of querying the compiled container.
Extension points. The valuable long-term pattern is contributing your own domain tools alongside the built-ins: a class with an invokable method, registered as a service with the same tool tag the bridge uses. Good candidates are things the agent cannot infer from source alone — feature-flag state, tenant resolution rules, queue depth. Keep them read-only.
Integration with tests. Profiler data is also produced by functional tests using KernelBrowser with the profiler enabled. If your CI agent runs tests, it can inspect profiles from a failing test run rather than requiring a live browser — a useful pattern for "why is this test's query count high." Likewise, run symfony-dotenv-check in CI as a key-set linter rather than as an agent tool.
symfony-dotenv-check reads files, not resolved configuration.
.env.local.php (if composer dump-env was run) → .env.$APP_ENV.local → .env.$APP_ENV → .env.local → .env. A file-based checker can report a key "missing" when it is actually baked into .env.local.php or injected by the platform. Always ask which files the tool considers in scope.%env(bool:FOO)%, %env(json:FOO)%, default: prefixes, and Symfony Secrets vault entries are resolution-time concerns. A checker sees the raw declaration; it cannot tell you whether the value parses..env before pointing a remote agent at it.Container introspection reflects the compiled container — and now, also the definition.
symfony-service-detail reports definition flags and constructor arguments from the service definition, which is pre-compilation-pass. A service can be public in the definition and still be removed or inlined in the compiled container. If the flags disagree with what actually resolves, cross-check with debug:container --show-private.dev, the container is rebuilt on config changes but not always on every request; a stale var/cache/dev container produces stale answers. Clear when in doubt.Profiler data is fragile and short-lived.
framework.profiler.dsn, filesystem by default). cache:clear, cache:pool:clear, and container rebuilds can orphan or wipe tokens. Always pass a fresh token.Environment and bundling quirks.
when@dev only. A dev-only bridge that leaks into prod can break cache:warmup or add unnecessary compile-time work.web-profiler-bundle, don't install it in prod just to satisfy autoloading — split the profiler capability behind a config flag or a separate install.symfony-dotenv-check is genuinely useful in CI, but only if it is a dev dependency available there; don't let a "safe inspection" tool become a production autoload requirement.Version and maturity expectations. This is a pre-1.0 package moving fast: 0.14.0 added two capabilities to an existing tool and introduced a whole new tool in a single minor release. Pin an exact version, read the changelog before bumping, and avoid building workflows that depend on a specific tool name, argument name, or config key without a test that catches breakage. Issues still belong upstream in the main symfony/ai repo (the README redirects there).
Output size and token bloat. Container dumps, constructor arguments, and full query logs are enormous. Always constrain prompts with filters — specific service IDs, tag names, token, time thresholds, limits, and for the env tool a specific key prefix. If the bridge offers pagination or filtering, prefer it over asking for "all services."
Security posture. Profiler payloads routinely contain request bodies, cookies, auth headers, and session data; .env files contain credentials by definition. In a shared or remote-agent setup, treat profiler access as equivalent to granting shell access to logs, and treat env access as equivalent to reading the secrets store. Keep both local, and never commit profiler dumps, .env output, or agent transcripts containing them.
Debugging the bridge itself.
config/bundles.php, the tool tag is applied (debug:container --tag=...), the relevant capability flag is on, and the AI Mate client is pointed at the right endpoint.var/log/dev.log; argument validation failures from the agent usually surface as a tool-side exception, not a client error.How can I help you explore Laravel packages today?