Extension commands aren't rendered as skills for non-active skills-mode agents on add/install/upgrade
Summary
Extension commands are not rendered as skills for an explicitly installed skills-mode agent unless that agent is the active one. They are rendered as command files instead. This affects extension add, integration install, and integration upgrade. Only integration switch renders them as skills because it makes the target the active agent first.
This is about parity for integrations that are already being registered in skills mode. It is not asking to change multi-install safety rules or make unsafe multi-install automatic.
Root cause
init-options.json tracks a single active agent (ai) and one ai_skills flag. There is no per-agent skills tracking. Extension skill rendering is scoped to that active agent:
register_enabled_extensions_for_agent(src/specify_cli/extensions.py) computesskills_mode_activefromactive_agent == agent_name and is_ai_skills_enabled(init_options), so a non-active target never takes the skills path._register_extension_skills/_get_skills_dirresolve the skills dir and frontmatter frominit_options["ai"](the active agent), not the target agent.register_commands_for_all_agents(used byextension add) has the same active-agent scoping.
So for any skills-mode agent that is not active, extensions fall back to command files.
Steps to reproduce
specify init --here --integration claude
specify extension add git
specify integration install copilot --integration-options "--skills" --force
--force is intentional here because this reproduction uses an integration that is not declared multi-install-safe today; this issue is about the files produced after the user explicitly opts into that multi-install path.
Inspect .specify/extensions/.registry and the filesystem:
extensions.git.registered_commandscontainscopilot(registered as commands)..github/agents/speckit.git.feature.agent.mdexists..github/skills/speckit-git-feature/SKILL.mddoes not exist.
Compare with specify integration switch copilot --integration-options "--skills", which does produce .github/skills/speckit-git-feature/SKILL.md because it activates the target agent before registering.
Expected
A skills-mode agent should receive extension skills matching how its own core commands are scaffolded, when that agent is being explicitly registered or refreshed. This should provide parity with switch for add / install / upgrade, without changing which integrations are considered multi-install-safe.
Proposed direction
Make extension skill rendering agent-aware: derive the skills directory and frontmatter from the target agent's config rather than the active-agent init-options, so register_commands_for_all_agents and register_enabled_extensions_for_agent can render skills for any skills-mode agent that is already in the registration path.
This is separate from #2886, which only wires install / upgrade to call register_enabled_extensions_for_agent for parity with switch in the common active-agent case.
Scope / acceptance criteria
Keep the fix narrowly scoped to parity with switch:
- A target agent installed or upgraded in skills mode receives extension commands as
SKILL.mdfiles even when another agent remains active. For integrations that are not multi-install-safe, this applies only after the user explicitly opts into that path with--force. extension addapplies the same target-agent-aware behavior when registering commands for all detected agents.- Skills are rendered from the target agent integration config, including skills directory, frontmatter, argument handling, and post-processing, not from
init-options["ai"]. - Default command-file registration for non-skills-mode agents remains unchanged.
- Do not change any integration's multi-install safety status or make unsafe multi-install automatic.
- Avoid introducing a broad per-agent state model unless it is required for the narrow parity fix.
For the reproduction above, the target agent should end up with .github/skills/speckit-git-feature/SKILL.md, and should not receive .github/agents/speckit.git.feature.agent.md for that extension command.
Follow-up to #2886.
Before anyone invests in this, I want to confirm scope and preferred direction, since the fix touches shared skill-rendering code.
Which would you prefer?
- Parity via target-agent-aware rendering — derive the skills directory and frontmatter from the agent being registered rather than from
init-options["ai"], soinstall/upgrade/extension addrender skills for a skills-mode agent the same wayswitchalready does. Scoped per the acceptance criteria above: no change to any integration's multi-install safety, and no broad per-agent state model. - Block or warn on the forced multi-install of a skills-mode agent instead of writing command files — simpler, no rendering changes.
- Status quo — keep the active-agent scoping; the command-file fallback for a non-active skills-mode agent stays documented as a known limitation (see #2949).
If (1) is in scope I'll open a PR along those lines. I'd rather agree the direction first than send a large change that may not match what you want.
I would prefer to make it so that the commands are generally unaware of multi-integration as it is NOT the reponsibility of the other commands to deal with that. So if a user installs an extension or preset in one integration it will not install it for the other integration(s) until the user switches. That way nothing needs to entangle itself onto the other commands, but rather the specify integration use command triggers the rescaffolding?
I would like to pick this up following the direction you outlined on 2026-06-16. Plan:
extension add/integration install|upgradestop writing command files for non-active integrations (register_commands_for_all_agentsgoes active-only). Multi-integration awareness leaves the individual commands entirely.specify integration usebecomes the single rescaffold point: on switch it renders enabled extensions for the target integration in its own mode (skills for skills-mode agents, command files otherwise), extending what #2949 started.- Tests pin both behaviors plus the reported case: skills-mode agent installed but not active gets nothing until
use, then gets skills, not command files.
@mnriem does this match what you had in mind before I start?
For the single active integration scenario nothing should change. Meaning everything should work as it currently does. For multi integrations specify integration use should be the ONLY way an inactive integration gets a previously installed activated. Note that this should already be the case and if not that needs to be fixed. If this needs further clarifications in the docs we should add that
Thanks for the clarification. That trims the plan a lot.
Revised approach:
- Add regression tests for what already works in single-active mode (extension add / integration install / integration upgrade write command files, integration use activates a previously installed integration).
- If integration use does not already activate a previously-installed inactive integration (multi-integration setup), fix that so it does; that is the only new behavior.
- No other renderer changes. Docs get a short note that integration use is the single activation point for multi-integration setups.
Will open a PR once the regression tests confirm the current behavior and pin the fixed path.
Verified the current behavior on main before writing anything. Findings:
integration use already activates a previously installed inactive integration. It sets the default and re-registers enabled extensions for the target (_register_extensions_for_agent in src/specify_cli/integrations/_query_commands.py), and tests pin it: test_install_defers_extension_commands_until_use and test_install_skills_mode_secondary_agent_defers_extension_artifacts in tests/integrations/test_integration_subcommand.py. Nothing to fix there.
Two places diverge from "use is the only activation path". Both verified empirically on a project with claude active and codex installed but inactive:
extension add gitregisters the extension for every detected agent, including the inactive codex.register_commands_for_all_agentsis detection-based, not active-only.integration upgrade codex(inactive) back-fills enabled extensions for codex. This was explicitly requested in #2886 ("full parity").
Which do you want?
- A. Docs note only. Current behavior stands; document that
usere-registers extensions when switching the default. Smallest change. - B. Active-only
extension add. New extensions register for the active integration only; inactive ones pick them up onuse. Matches your 2026-06-16 comment, changes behavior a fair number of tests pin today. - C. Also drop the inactive-upgrade back-fill. Reverses what #2886 asked for, so I would not touch it without your explicit call.
I can implement any of these. Since B and C reverse maintainer-requested behavior, I want your pick before opening a PR.
For single active integration it should be that the extension add registers the new extension. For multi agent integration it should only register for the currently active integration (effectively treating it as single active integration). When user switches integration by using specify integration use it should be scaffolding out again (effectively re-registering extensions and presets). The upgrade backfill should not be needed. Note that specify integration switch should obviously also do it as you are effectively uninstalling and installing another integration. Upgrade should only touch the active integration as it should be so that another use/switch then scaffolds it out again
Clear, thanks. Implementing exactly that:
extension addregisters commands for the active integration only (skills pass is already active-scoped).integration upgradedrops the enabled-extensions back-fill for non-active integrations;use/switchremain the rescaffold points.- Regression tests for both, plus the existing single-active flows staying untouched.
PR coming.