Skip to content

[FEATURE] apm find — trace a file back to the package that brought it #1156

Closed

Description

Is your feature request related to a problem? Please describe.

When inspecting a deployed APM workspace, I often need to know which package contributed a given file, so I can decide where to edit/update it.

Today, when a user or agent wants to update a skill / command / instruction, there's no straightforward way to find which package owns it. Users end up grepping the whole dependency tree by hand. A first-class provenance command makes "edit the right source" a one-liner and unblocks agents that need to make upstream-aware edits.

Describe the solution you'd like

apm find .claude/commands/troubleshooting-triage.md

→ should report the package name (and ideally the dependency path) that brought this command in.

Describe alternatives you've considered

I considered analyzing apm_modules contents, however, it looks more like a workaround.

Files to support

Provenance lookup should work for any file APM materializes:

  • skills (.claude/skills/...)
  • commands (.claude/commands/...)
  • agents (.claude/agents/...)
  • hooks (.claude/hooks/..., settings entries)
  • AGENTS.md / CLAUDE.md (multi-source — see below)

Detail levels

The command should expose progressive verbosity:

  1. Default — just the package name(s):
    acme/triage-tools
    
  2. --source — package + origin it was resolved from (OCI registry URL, git ref, local path):
    acme/triage-tools  (oci://ghcr.io/acme/triage-tools:1.4.2)
    
  3. --path — full dependency chain showing how the package entered the closure:
    root → acme/[email protected] → acme/[email protected]
      source: oci://ghcr.io/acme/triage-tools:1.4.2
    

For local dependencies, the source should be the filesystem path (e.g. ../packages/triage-tools).

Multi-contributor files

AGENTS.md and CLAUDE.md are typically assembled from multiple packages. apm find should list all contributing packages, ideally with the section/range each one contributed:

apm find AGENTS.md
acme/team-bundle      lines 1–24
acme/triage-tools     lines 25–60
<workspace>           lines 61–end

Out of scope (for now)

  • Reverse lookup across remote registries (only resolved/installed deps).
  • Diffing across versions — purely "who put this here".

Activity

  1. added
    type/feature
    on May 6, 2026
  2. added
    status/needs-triage
    on May 6, 2026
  3. removed
    status/needs-triage
    on May 14, 2026
  4. github-actions commented on May 29, 2026

    @github-actions

    Triage decision

    accept

    Proposed labels

    theme/portability
    area/cli
    type/feature
    status/accepted
    priority/high
    

    Milestone

    null

    Suggested next action

    Implement apm find with the three verbosity levels (default, --source, --path) reading from apm.lock.yaml provenance data, with multi-contributor handling for AGENTS.md and CLAUDE.md.

    Suggested issue comment

    Thank you for this proposal! Provenance lookup ("which package owns this file?") is exactly the kind of first-class debugging tool that makes a package manager trustworthy. The npm ls / pip show mental model is the right analogy.
    
    We are accepting this as a priority feature. The three verbosity levels you described (default package name, --source with origin URL, --path with full dependency chain) map well to the apm.lock.yaml structure, which already records content hashes and source refs per deployed file.
    
    A few implementation notes to consider:
    - The provenance index lives in apm.lock.yaml; apm find should not need a network call for the default case.
    - Multi-contributor files (AGENTS.md, CLAUDE.md) require scanning all lockfile entries that contributed to that path and listing all contributors with their section ranges.
    - The command should exit non-zero if the file is not tracked by any installed package, so it is scriptable in CI.
    
    See the lockfile spec at (microsoft.github.io/redacted) for the provenance data model. If you would like to implement this, a PR is welcome.

    Per-lens notes (collapsed)

    DevX UX Expert -- User-Need Reviewer

    This is a first-class debugging command that every package manager needs: "what owns this file?" The progressive verbosity design (default -> --source -> --path) is excellent -- it scales from quick identification to full audit without overwhelming the default output. The multi-contributor file handling (AGENTS.md, CLAUDE.md are assembled from multiple packages) is a thoughtful edge case that most package managers get wrong. The apm find path surface is area/cli and maps cleanly to the lockfile provenance data. High UX value; relatively low complexity since the data is already in the lockfile.

    Supply Chain Security Expert -- Risk-Surface Reviewer

    Provenance transparency is a security positive -- it makes it trivially easy for users to audit which package brought in any deployed file, supporting the detect-then-remediate workflow for compromised upstream packages. No new attack surface introduced. The --source flag exposing OCI registry URLs and git refs is safe (these are already in the lockfile). No theme/security needed; theme/portability is correct.

    OSS Growth Hacker -- Contributor-Tone Reviewer

    Activated -- vlsi has NONE association against microsoft/apm, indicating this may be one of their first direct interactions with the project. The reply should be warm and concrete, name a clear next step (implement it or comment with questions), and link to the lockfile spec so they have a starting point. The suggested comment above does this. Note: the feature proposal is sophisticated (multi-contributor file handling, dependency chain tracing), so the author is technically capable -- warmth here is about welcoming a new contributor, not simplifying the technical framing.

    Python Architect -- Architecture Reviewer

    Not activated -- apm find is an additive read-only command that queries the existing lockfile data structure. No new module, no schema change, no cross-cutting design decision required. The lockfile already has the provenance records; the implementation is a new CLI command + a lockfile-reading utility function.

    Doc Writer -- Documentation Reviewer

    Activated. A new apm find command needs a full entry in the CLI reference ((microsoft.github.io/redacted), including the three verbosity levels, the exit code contract (non-zero for untracked files), and an example for multi-contributor files. area/docs-site should ride as a secondary label on the implementing PR. The suggested comment links to the lockfile spec, which is the right starting-point reference for an implementer.

    APM CEO -- Triage Arbiter

    Provenance lookup is table stakes for a trustworthy package manager. This command directly supports the "edit the right source" developer workflow and the supply-chain audit story. It is additive, read-only, well-specified, and immediately implementable from existing lockfile data. Accepting as priority/high. The NONE author_association makes warmth in the reply important -- this contributor is new to the project and has submitted a well-reasoned feature proposal. No open minor milestone exists to assign; milestone set to null pending a new release milestone being opened.

    {
      "decision": "accept",
      "decision_detail": "",
      "theme": "theme/portability",
      "areas": ["area/cli"],
      "type": "type/feature",
      "status": "status/accepted",
      "priority": "priority/high",
      "preserved_labels": [],
      "milestone": null,
      "next_action": "Implement apm find reading from apm.lock.yaml provenance data with three verbosity levels and multi-contributor file support.",
      "comment_markdown": "Thank you for this proposal! Provenance lookup ('which package owns this file?') is exactly the kind of first-class debugging tool that makes a package manager trustworthy. The npm ls / pip show mental model is the right analogy.\n\nWe are accepting this as a priority feature. The three verbosity levels you described (default package name, --source with origin URL, --path with full dependency chain) map well to the apm.lock.yaml structure, which already records content hashes and source refs per deployed file.\n\nA few implementation notes to consider:\n- The provenance index lives in apm.lock.yaml; apm find should not need a network call for the default case.\n- Multi-contributor files (AGENTS.md, CLAUDE.md) require scanning all lockfile entries that contributed to that path and listing all contributors with their section ranges.\n- The command should exit non-zero if the file is not tracked by any installed package, so it is scriptable in CI.\n\nSee the lockfile spec at (microsoft.github.io/redacted) for the provenance data model. If you would like to implement this, a PR is welcome."
    }

    Triage status: agentic proposal pending human ratification.
    Silence is approval. Maintainers can:

    • Override any label or milestone above by editing it directly --
      human edits are authoritative and will not be reverted on
      subsequent runs.
    • Re-trigger triage by applying the status/needs-triage label, or
      by removing status/triaged to enroll the issue in the next
      daily sweep.

    Posted by the Triage Panel workflow. See .apm/skills/apm-triage-panel for the panel skill.

    Generated by Triage Panel · sonnet46 5.4M · ◷

  5. added
    area/cli
    priority/high
    status/accepted
    status/triaged
    on May 29, 2026
  6. added
    status/shepherding
    on Jun 3, 2026
  7. moved this from Todo to In Progress in APM Roadmapon Jun 3, 2026
  8. removed
    status/shepherding
    on Jun 3, 2026
  9. added a commit that references this issue on Jun 3, 2026
    ee2d80c
  10. moved this from In Progress to Done in APM Roadmapon Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/clipriority/highstatus/acceptedstatus/triagedtype/feature

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions