feat: Deploy agents to .claude/agents/ during install#95
Open
feat: Deploy agents to .claude/agents/ during install#95
Conversation
…ode target Co-authored-by: danielmeppiel <51440732+danielmeppiel@users.noreply.github.com>
… target Add integrate_package_agents_claude() to AgentIntegrator that deploys .agent.md and .chatmode.md files to .claude/agents/ as .md files. Update install flow to call Claude agent integration when integrate_claude is True. Add sync_integration_claude() for cleanup. Add gitignore support. Include 16 new unit tests for Claude agent integration. Co-authored-by: danielmeppiel <51440732+danielmeppiel@users.noreply.github.com>
Co-authored-by: danielmeppiel <51440732+danielmeppiel@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update compile to deploy agents and skills for Claude Code
feat: Deploy agents to .claude/agents/ during install
Feb 23, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the install-time integration pipeline so that package agent files are also deployed into Claude Code’s native discovery directory (.claude/agents/), ensuring Claude can find installed sub-agents (in addition to the existing VSCode/Copilot .github/agents/ integration).
Changes:
- Add Claude agent deployment support to
AgentIntegrator(target filename mapping to*-apm.md, sync cleanup,.gitignorehelper). - Wire Claude agent integration into both cached and freshly-downloaded install paths, and include
.claude/agentscleanup in uninstall sync. - Update Claude target description + documentation + add unit tests for Claude agent integration.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Bumps local editable apm-cli version reference to 0.7.3. |
| tests/unit/integration/test_agent_integrator.py | Adds unit tests covering .claude/agents integration behavior and naming. |
| src/apm_cli/integration/agent_integrator.py | Implements Claude agent integration (.claude/agents/) + cleanup + .gitignore helper. |
| src/apm_cli/core/target_detection.py | Updates Claude target output description to include .claude/agents/ and .claude/skills/. |
| src/apm_cli/cli.py | Calls Claude agent integration during install and cleans Claude agents during uninstall sync. |
| docs/integrations.md | Documents Claude agent integration and updates Claude integration narrative. |
| docs/cli-reference.md | Updates CLI reference to include Claude agent integration mapping and example output. |
Comments suppressed due to low confidence (2)
docs/integrations.md:352
- In the Claude cleanup section, the Uninstall bullet says it removes only the package's agents and commands, but
apm uninstallalso cleans up/re-integrates skills (and other APM-managed primitives) as part of the sync step. Adjust this bullet so it doesn’t imply skills are left behind.
- **Install**: Adds agents, commands, and skills for new packages
- **Uninstall**: Removes only that package's agents and commands
- **Update**: Refreshes commands when package version changes
src/apm_cli/cli.py:1663
total_agents_integratedis used as a single counter for both VSCode agents (.github/agents) and Claude agents (.claude/agents). When both integrations are active (target=all), the same package agent will be counted twice, and this shared counter is also used to decide whether to update.gitignorefor Claude agents. Consider tracking separate counters (e.g.,total_vscode_agents_integratedandtotal_claude_agents_integrated) or renaming/adjusting the logic so counts and.gitignoreupdates reflect what was actually integrated per target.
if claude_agent_result.files_integrated > 0:
total_agents_integrated += (
claude_agent_result.files_integrated
)
_rich_info(
f" └─ {claude_agent_result.files_integrated} agents integrated → .claude/agents/"
)
total_links_resolved += claude_agent_result.links_resolved
- Fix docs table: commands pattern is *-apm.md not *.md
- Remove trailing whitespace in TestClaudeAgentIntegration
- Guard integrate_package_agents_claude() on uninstall behind
Path('.claude').exists() to prevent creating .claude/ in
non-Claude projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 New Feature
Description
apm installnow deploys agent files (.agent.md,.chatmode.md) to.claude/agents/as native Claude sub-agents when Claude integration is active. Previously, agents were only deployed to.github/agents/— Claude Code never discovered them.Changes Made
AgentIntegrator:integrate_package_agents_claude(),sync_integration_claude(),get_target_filename_claude(),update_gitignore_for_integrated_agents_claude()cli.py: Both cached and fresh-download integration paths now call Claude agent integration whenintegrate_claudeis True; uninstall sync cleans.claude/agents/and re-integratestarget_detection.py: Updated Claude target descriptionTestClaudeAgentIntegration(812 total pass)integrations.mdandcli-reference.mdKey design decisions:
.mdextension (not.agent.md) per Claude Code spec-apmsuffix convention preserved for tracking/cleanup.claude/skills/via existing T7 compatibility — no changes neededTesting
Checklist
enhancementorfeaturelabel to this PROriginal prompt
This section details on the original issue you should resolve
<issue_title>[FEATURE] Compile should deploy agents and skills to .claude/ for Claude Code target</issue_title>
<issue_description>## Summary
apm compile --target claudecurrently only generates distributedCLAUDE.mdfiles from instructions. It does not deploy agents or skills fromapm_modules/into.claude/agents/or.claude/skills/. These primitives are left stranded inapm_modules/and never reach Claude Code's native discovery directories.Current behavior
After compile,
.claude/contains no agents or skills from installed packages. Claude Code never discovers them.Desired behavior
apm compile --target claudeshould produce a complete, ready-to-use.claude/directory:One command. Everything deployed. Claude Code picks it up on next session.
Why this belongs in compile, not install
1. Install fetches. Compile deploys.
apm installshould do one job: resolve dependencies and populateapm_modules/. This mirrorsnpm installpopulatingnode_modules/without modifying the app's source tree.apm compileis whereapm_modules/content gets transformed and placed for the target platform. This is the step that understands target-specific output layouts.2. Different targets need different output layouts
The same
.apm/package contents need to land in different places depending on the target:--target vscode--target claude.apm/agents/.github/agents/.claude/agents/.apm/skills/.github/skills/.claude/skills/.apm/instructions/AGENTS.md(distributed)CLAUDE.md(distributed)Target awareness is a compile-time concern. The package format (
.apm/) is target-agnostic by design.3. Claude Code's architecture requires discrete files, not merged markdown
Claude Code manages context through on-demand agent spawning. This is fundamentally different from tools that pre-load all instructions:
.claude/agents/) are self-contained context capsules. Claude reads the description, spawns the agent into a fresh context window only when a request matches. The main thread stays lean..claude/skills/) are specialized capabilities that Claude discovers and activates on demand.CLAUDE.md) are lightweight, always-loaded guidance.Agents and skills are discrete primitives — they should be placed as individual files, not merged into CLAUDE.md. The current compile treats everything as instructions to merge. It should recognize the different primitive types and handle each appropriately for the target.
4. Enables a clean rebuild cycle
apm compile --target claude --clean # wipe and regenerate from apm_modules/This makes
.claude/a derived artifact — fully reproducible fromapm.yml+apm_modules/. Similar to how build output is regenerated from source and dependencies.Reproduction steps
Principle
Match the output format to how the target platform actually consumes it. Claude Code consumes agents as files in a directory, not as blocks in a markdown document. Compile should respect that.</issue_description>
<agent_instructions>Please consider the current existing integration implementation with .github and with .claude, and add support for skills and agents for claude. GitHub Agentic Workflows (workflows) are defined here: https://github.github.com/gh-aw/</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@danielmeppiel That's right - it should be `apm install` integrating the primitives into `.claude` in the same way it happens today for `.github`. Reason to put it into install is because I'd rather deprecate the `compile` command ASAP in favor of a configurable, single `install` command that just works. I'd argue that's better UX than having to tap into two different commands.For reference:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.