Skip to content

[BUG] apm pack fails to find sub-directory-prefixed skills (--skill productivity/grill-me) — apm.lock.yaml skill_subset paths don't match flattened .apm/skills layout #2171

Description

@desaiuditd

Describe the bug

When a git dependency declares skills inside category subdirectories (e.g. mattpocock/skills organizes skills under skills/productivity/ and skills/engineering/), installing with the subdirectory-prefixed skill name succeeds, but the subsequent apm pack fails. It errors that the skills recorded in apm.lock.yaml (skill_subset: productivity/grill-me, productivity/grilling) were not found among the package's installed files.

This happens because apm_modules/<pkg>/.apm/skills/ stores the installed skill files in a flattened layout that drops the subdirectory prefix, so it no longer matches the skill_subset path recorded in the lockfile. Installing the same skills without the subdirectory prefix works as expected.

To Reproduce

Steps to reproduce the behavior:

  1. Add a git dependency whose skills live under category subfolders, using the subdir-prefixed names:
    apm install mattpocock/skills#bc4cf90 --skill productivity/grill-me --skill productivity/grilling
  2. This generates an apm.yml with:
    dependencies:
      apm:
        - git: mattpocock/skills
          ref: bc4cf90
          skills:
            - productivity/grill-me
            - productivity/grilling
  3. Run:
    apm pack
  4. See error:
    Error: Cannot pack dependency mattpocock/skills: the skills recorded in apm.lock.yaml (skill_subset: productivity/grill-me, productivity/grilling) were not found among its installed files.
    Run 'apm install' to re-deploy the expected skills, then pack again.
    

Expected behavior

apm pack should succeed when skills are declared and installed with subdirectory prefixes, correctly matching them against the installed files under apm_modules/<pkg>/.apm/skills/. Alternatively, if subdirectory prefixes aren't meant to be supported, apm install should reject or normalize them at install time rather than allowing a lockfile state that later breaks apm pack.

Environment (please complete the following information):

  • OS: MacOS
  • Python Version: 3.14.6
  • APM Version: 0.24.0

Additional context

If I don't add the sub-dir prefix while installing the skills, i.e.,

apm install mattpocock/skills#bc4cf90 --skill grill-me --skill grilling

all works as expected.

I'm not sure where the root cause and bug lies:

  • apm may need to support skill installation with subdir prefixes end-to-end.
  • The mattpocock/skills repo's subdirectory layout may not be a supported/expected structure. In that case, I can report this in that repo.
  • Even when a skill author uses subdirectories, apm may always expect the subdir prefix to be omitted at install time — meaning this could be user/documentation error rather than a bug, needing clarification.

One possible reason I can think of, and what I observed is that,
after running apm install, apm_modules directory is populated with the package files.
APM adds internal .apm directory for it in apm_modules/mattpocock/skills.
But skills kept in apm_modules/mattpocock/skills/.apm/skills path don't follow the subdir structure from the original source.

Click to expand and see the screenshot. Image

Maybe due to this mismatch, apm pack is not able to recognize the subdir prefix? 🤔 🤷🏻‍♂️
This is just a guess at the moment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/package-authoringapm pack/unpack, plugin authoring, vendoring guidance, bundle format.priority/highShips in current or next milestonestatus/acceptedDirection approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.type/bugSomething does not work as documented.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions