Skip to content

feat(native): project-scope native plugins for Claude and Copilot (#3921, #3896) - #4559

Merged
Daniel Meppiel (danielmeppiel) merged 60 commits into
mainfrom
danielmeppiel-fix-3896-native-project
Nov 22, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 60 commits into
mainfrom
danielmeppiel-fix-3896-native-project

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

obra/superpowers could not be installed at project scope with its hooks approved (#3896). The plugin ships per-harness hook files (hooks/hooks.json for Claude, hooks/hooks-cursor.json named by .cursor-plugin/plugin.json). APM split it into primitives, which dropped that mapping, and the retired filename-routing guard (#3226) then refused the package. On main (0.37.0) this happens on the first install already, because the executables gate is opt-in.

The 2026-11-19 decision on #3094 rules out bringing per-file routing back. This PR therefore delivers the accepted fix, #3921: project-scope native plugins.

  • Install: at project scope, apm install deploys each approved Claude-format plugin whole to the committed .agents/plugins/<plugin>/.
  • Catalog: it generates the plugin catalog under a marketplace name unique to the repo.
  • Declaration: it declares the plugin with a relative path in .claude/settings.json and .github/copilot/settings.json, following the plugin's targets.
  • Fresh clones: a fresh clone loads the plugin in Claude Code and GitHub Copilot without APM.
  • Agent Plugins: they move onto the same owner at both scopes. Registrations in apm_modules/.github/plugin/apm-registration.json are migrated.
  • Ownership: it comes from the previous and next apm.lock.yaml.

This supersedes #4010, rebased onto main after v0.37.0 with authorship kept through commit trailers. Changes beyond #4010:

Change Why
apm approve treats a Claude plugin as native at both scopes (commands/approve.py) It pinned only hook files at project scope, so the approved plugin stayed parked. The new lifecycle cell caught it; the #4010 lane found it independently.
Uninstalling another package retires a survivor native plugin the gates no longer allow (commands/uninstall/engine.py) I4 regression against 0.37's #4446: the native root and declaration survived a deny, a revoke or an org deny. test_native_plugin_retirement_lifecycle caught it.
At project scope only a Claude-format plugin goes native; a root-only plugin.json (an apm pack bundle) deploys loose (claude_plugins/admission.py) req-mf-008 regression, found by the #4010 lane.
0.37 owners kept Catalog remedies for the new and moved messages: native-settings-invalid, native-plugin-update-held, claude-native-switch-loose-hooks-project. The kept-version line uses kept_note. The rollback uses restore_lockfile_bytes. Frozen native drift is scope-aware.
Size budgets Native lock fields moved to native_plugins/record.py (deps/lockfile.py at the 2100-line cap). The carry-forward moved to native_plugins/carry.py (install LOC budgets).
Spec #4010's provisional amendment renumbered 0.1.68 -> 0.1.74 (proposed, pending editor decision). Main already uses 0.1.68-0.1.73. CONFORMANCE regenerated.
Uninstall never rebuilds a native survivor loose (commands/uninstall/engine.py, native_plugins/scopes.py) Cross-review HIGH-2: uninstalling a sibling re-integrated a local native plugin's hooks loose beside the enabled plugin, so SessionStart ran twice. A harness the native_plugin record is declared to is never rebuilt loose; a local native plugin is restaged only when its source digest changed, so #4446's definition-change retirement still holds.
Agent Plugin names may carry interior dots; $schema is inert metadata; a skills: selection deploys loose at project scope (native_plugins/record.py, claude_plugins/admission.py) CI lifecycle cells: dotted Agent Plugin names (np.agent.plugin) stopped registering, a plugin with $schema was parked, and a skills: selection deployed nothing.
Architecture owners (install/phases/claude_plugins.py, .apm/architecture/owners/marketplace-plugins.json, linter anchor) The frozen read goes through InstallService.frozen_disposition; the native_declared stamp is written by the registered commit site; carry.py joins the native owner; install-commit-order anchors on the native activation phases.

Oracle decisions accepted by the 0.38 PM (S15); spec 0.1.73 lands per the D-a ruling, with editor review post-merge. (Main took 0.1.73 for #2903, so this amendment is now 0.1.74.)

Decisions taken without escalation (rule S15, recommended default):

Issue and approved scope

Issue: Fixes #3921. Refs #3896 (closed as a duplicate of #3094; this delivers its fix), #3094.

Human scope-approval comment: #3921 (apm-scope:v1 record by Daniel Meppiel (@danielmeppiel), 2026-11-19). It covers Claude and Copilot at project scope, and its Done-when includes "Superpowers installs intact with its hooks running".

Does this PR complete the issue, or what remains?

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass (the affected suites, run one file at a time, are listed below)
  • Added tests for new functionality (if applicable)

Lifecycle evidence (apm-lifecycle-tests):

promise: P-OWN-claude-native-plugin-registration -- an approved plugin is deployed intact to .agents/plugins/<plugin>/ and declared in each harness's project settings (source: #3921 scope record)
cell: OP=install,approve,uninstall SRC=git PRIM=plugin(hooks,skills) SCOPE=project TGT=claude,copilot GATE=on   owner: claude_plugins/registrar.py
instrument: today test -> tests/integration/test_native_project_plugin_lifecycle.py::test_multi_harness_plugin_installs_whole_at_project_scope (new: no project-scope native cell existed)
oracles: [I1, I2, I3, I6, I9, snapshot]  decisive: every plugin file byte-equal under .agents/plugins/sp-like/, both settings declare it
failing-before: APM_BINARY_PATH=<main c0c6e25d shim> pytest <node> -> exit=1 "hook filename target routing was removed" after approve
passing-after: APM_BINARY_PATH=.venv/bin/apm pytest <node> -> 1 passed
guard+mutation: n/a     ledger: 3896
hints executed: the hook script reads its skill through CLAUDE_PLUGIN_ROOT -> skill text printed

Real-package check on this branch (obra/superpowers#v7.0.2, targets: [claude, copilot], executables: {}):

  • install parks the plugin; apm approve exits 0 ("whole plugin");
  • the next install deploys .agents/plugins/superpowers/ with both hook files and both settings declarations;
  • a repeat install leaves the lock byte-identical;
  • audit --ci and install --frozen both exit 0;
  • apm uninstall removes only APM's entries, and audit --ci stays clean.

Local runs (pytest -p no:xdist, one file at a time, APM_E2E_TESTS=1):

Suite Result
test_native_project_plugin_lifecycle 1 passed
test_native_project_scope 29 passed
test_copilot_project_settings_precedence 9 passed
test_native_plugin_retirement_lifecycle 8 passed
test_approve_parked_native_plugin_lifecycle 6 passed
test_claude_native_hook_lifecycle 15 passed, 1 skipped
test_native_plugin_cache_audit 16 passed
test_native_plugin_audit_lifecycle 8 passed
test_frozen_native_service_lifecycle 15 passed
test_unmanaged_skill_preflight_matrix 27 passed
test_dependency_replacement_lifecycle 53 passed
test_marketplace_versioned_directory_lifecycle 8 passed
tests/lifecycle/security/test_gate_removal.py 168 passed, 16 xfailed
tests/lifecycle/machines/test_m_source.py 2 passed
tests/lifecycle/world/test_world.py (native cells) 5 passed
spec_conformance: native_activation_profile 22 passed, 2 skipped
spec_conformance: copilot_plugins 9 passed, 1 skipped
spec_conformance: marketplace_directory 2 passed
remediation catalog, block proofs, advice proof all passed
test_architecture_owner_rule_mutations (native, marketplace, registration subset) 228 passed

Lint mirror:

  • ruff check and ruff format --check (ruff 0.15.12): clean.
  • pylint R0801: 10.00.
  • lint-auth-signals.sh: OK.
  • Complexity ratchet (base main): clean.
  • tests.quality.taxonomy --changed: clean.
  • check_test_assertions.py: ratchet clean (no baseline growth).
  • Lifecycle generator and witnesses: up to date.
  • File lengths: under 2100.
  • The full architecture linter run was skipped (host load rule); the targeted remediation and registration rules are clean.

Known red on main, not from this PR: test_codex_native_plugin_lifecycle::test_git_pinned_install_and_missing_apm_cache_restore x2 (T1 owns it).

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md (Fixed). The PR number will be added after this PR is numbered.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated. Amendment 0.1.74 (proposed) revises req-na-002 (portable project-scope digest), req-na-004 (cross-target suppression) and criterion A5 in place, and updates Part C. No statement count change.
  • Manifest edit: n/a (no new or removed requirement)
  • Test edit: @pytest.mark.req tests extended in tests/spec_conformance/test_native_activation_profile_reqs.py and test_copilot_plugins_reqs.py
  • CONFORMANCE.{md,json} regenerated via python -m tests.spec_conformance.gen_statement and committed
  • N/A -- this PR does not change OpenAPM-observable behaviour.

Co-authored-by: copilot-swe-agent[bot] [email protected]

, #3896)

At project scope, `apm install` now deploys each approved Claude-format plugin
whole to the committed `.agents/plugins/<plugin>/`, generates the catalog
under a marketplace name unique to the repo, and declares it with a relative
path in `.claude/settings.json` and `.github/copilot/settings.json`, following
the plugin's targets. A fresh clone loads it in Claude Code and GitHub Copilot
without APM. Agent Plugins move onto the same owner at both scopes, and
`apm_modules/.github/plugin/apm-registration.json` registrations are migrated.
Ownership comes from the previous and next `apm.lock.yaml`.

This is the #3896 fix the 2026-11-19 decision chose: obra/superpowers ships
per-harness hook files, so splitting it into primitives tripped the retired
filename-routing guard (#3226) and every approved project install exited 1.
It now installs intact with its hooks.

Supersedes #4010 (rebased onto main after v0.37.0), with these changes:
- approve: a Claude plugin is native at both scopes, so `apm approve` pins
  the whole plugin at project scope too (it pinned only hook files, leaving
  the approved plugin parked).
- uninstall: a surviving native plugin the gates no longer allow loses its
  lock record, so the native owner retires its root and declarations (I4,
  as #4446 does for loose files).
- 0.37 owners kept: catalog remedies for the new and moved messages
  (native-settings-invalid, native-plugin-update-held, project-scope
  loose-hooks switch), kept_note for the kept-version line,
  restore_lockfile_bytes for the rollback, scope-aware native drift for
  --frozen; lock row parsing and serialization of native fields moved to
  native_plugins/record.py (deps/lockfile.py at the 2100-line cap).
- spec: provisional amendment renumbered 0.1.68 -> 0.1.73 (pending editor
  decision); CONFORMANCE regenerated.
- tests: new failing-before lifecycle cell for the superpowers shape;
  0.37 oracles that pinned project-scope split behavior re-pointed to the
  native surface (same promises); #4010 tests meet the AQ ceilings.

Out of scope: targets that include cursor still refuse (no native route
until #3922); Codex stays split (#3920).

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Copilot App <[email protected]>
- Plugin names may carry interior dots (Agent Plugin names such as
  acme.review); a leading or trailing dot is still refused (req-na-002).
- $schema is inert manifest metadata: it no longer parks a plugin.
- At project scope a skills: selection deploys loose, as a root-only
  plugin.json does; a whole-plugin load cannot honor it.
- Lifecycle cells re-pointed to the native surface with the same promise
  (S15, accepted by the 0.38 PM): Copilot enablement in the committed
  settings, the generalized native summary, the gate write set and the
  project-scope I1 digest. Split-route cells (export-patch, legacy
  classification, plugin-root MCP portability) keep their promise on the
  split route: cursor, or a root-only plugin.json.
- Quickstart: the committed paths get their own git add line; J02
  anchors the world-independent audit lines.

Co-authored-by: Copilot App <[email protected]>
…eview folds)

- Frozen read goes through InstallService.frozen_disposition; the
  native_declared stamp is written by the registered commit site.
- install-commit-order anchors on the native activation phases; carry.py
  joins the claude-native-plugin-registration owner; the manifest path
  goes through core.scope.manifest_file.
- Uninstall never rebuilds a survivor loose for a harness that loads it
  natively, and never restages a native plugin from its source (HIGH-2;
  hooks ran twice). Regression cell with approve --all.
- Generator citations and obligations regenerated after main moved.

Co-authored-by: Copilot App <[email protected]>
…t changed

#4446's definition-change retirement still re-judges a changed local
native plugin; an unchanged one is never re-copied or rebuilt loose.
The #3499 MCP-shape cell keeps the split route with a root plugin.json.
Docs: a skills: selection deploys loose at project scope.

Co-authored-by: Copilot App <[email protected]>
…l-fix-3896-native-project

# Conflicts:
#	docs/src/content/docs/specs/openapm-v0.1.md
#	tests/quality/lifecycle_obligations.json
Co-authored-by: Copilot App <[email protected]>
…l-fix-3896-native-project

# Conflicts:
#	tests/lifecycle/generator/rules.py
#	tests/quality/lifecycle_obligations.json

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delta review: fc6973e -> 1c81340 (standing 0.38 reviewer)

Verdict: CLEAN. No blocking findings. One spec-number collision to sort out at merge time (below).

Method: gh pr diff 4559, the PR-own commits since fc6973e (d3f8f2a, af54e06, 003275f, plus merges of main), and the changed owners, linter checks and tests. CI at 1c81340: Lint, Architecture Ratchet Contracts, Test Architecture Ratchets, Architecture Scaling, Build & Test, Spec tests and Lifecycle Smoke shards 1-4 are all green. The gate check was still pending when this was posted.

Prior findings

ID Status Evidence
HIGH-1 CI red / arch-linter Resolved The frozen read goes through InstallService.frozen_disposition(ctx).withhold_lockfile_writes (install/phases/claude_plugins.py:88-94). The lock write moved into run, which main already registers as a lockfile-write site (contracts_lockfile_write_authority.py:56,93), so the authority list did not grow. carry.py, scopes.py and uninstall.py joined the claude-native-plugin-registration selectors. scopes.py uses core.scope.manifest_file. test_native_project_scope.py uses the apm_engine_command fixture. All lifecycle shards pass.
HIGH-2 double-load on sibling uninstall Resolved The fix works at two levels. uninstall/engine.py:1499-1503 removes the harnesses that load the plugin natively (native_harnesses) from the survivor rebuild targets, so nothing is rebuilt loose for them. engine.py:1792 skips restaging an unchanged native plugin. The regression cell test_uninstalling_a_sibling_keeps_a_local_native_plugin_whole asserts that the settings, root bytes and lock row are unchanged, and that no loose hooks or skills are written.
MEDIUM approve --all step Resolved The cell runs approve --all, asserts a sha256: plugin pin, then runs install and uninstall. The closing audit --ci is left out on purpose because of open bug #4566 (uninstall writes apm.yml/.apm into the local source). That is acceptable: the fingerprint excludes the root apm.yml and .apm/ (utils/content_hash.py:153-159), so #4566 cannot make native_source_current return a false result.

P4 checklist

  1. native_source_current vs #4446 definition-changed semantics: resolved. scopes.py:85-104 compares the source with record.fingerprint using the same construction as the registrar (portable at project scope; compare registrar.py:139 portable=not user_scope). When the plugin has changed, it falls through to #4446's existing source-vs-materialized check, so a redefined native plugin is still re-copied and re-judged. The parametrized test_uninstalling_another_package_retires_a_disallowed_native_plugin (changed-definition case) covers this path, and it would have failed under d3f8's skip-all, which is why af54 relaxed it. Double-load cannot come back through this path, because loose rebuild targets are filtered separately (engine.py:1499).
  2. Loose skills: selection vs req-na-002: resolved. req-na-002 requires deploying "exactly the plugin root covered by the approval". A skills: subset is not the whole approved root, so it cannot be activated natively. Routing it to a loose deployment at project scope is the conforming choice, and af54 documents it.
  3. Commit-order anchor guard is real: resolved (stricter). install_entry_and_commit.py:214-218 now pins both _run_phase("codex_plugins" and _run_phase("claude_plugins" after transaction.release_deploy_targets(). Main pinned only copilot_plugins, and that phase has left the pipeline. pipeline.py:947,959-960 matches.
  4. Spec renumber to 0.1.74: consistent, but it COLLIDES with #4001. No stray 0.1.73 is attributed to this amendment: every remaining 0.1.73 belongs to #2903, which is on main. In-text cites at the req-na-002/004/005 revisions and in test_native_activation_profile_reqs.py all say 0.1.74. However, draft #4001 (#1925, --policy) also adds a 0.1.74 (proposed) row and a "0.1.64 and 0.1.74 proposals each add one MUST" count clause. Whichever PR lands second must renumber to 0.1.75, including the in-text "amendment 0.1.74" cites and the statement-count paragraph (openapm-v0.1.md:5703).

New findings (non-blocking)

  • LOW docs/src/content/docs/specs/openapm-v0.1.md:5699: the 0.1.74 row says "PR #4010". The implementation is this PR (#4559); #4010 is the open draft predecessor. Cite #4559, or both.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical issues can widen Claude skill selection and leave rejected native or legacy plugins enabled, while raw-byte fingerprints can falsely report drift after line-ending conversion.

4 open issues
What changed in this PR

This PR extends APM's native-plugin lifecycle to project-scope Claude Code and GitHub Copilot installs, addressing plugins such as Superpowers that depend on their complete directory layout.

Changes:

  • Deploys whole plugins to committed .agents/plugins/ directories with relative settings declarations.
  • Consolidates native registration, lockfile ownership, approval, migration and removal handling.
  • Updates lifecycle coverage, architecture checks, conformance reports and documentation.
File Description
tests/​unit/​install/​test_pipeline_ownership_snapshot.py Updates the reconciliation mock.
tests/​unit/​install/​test_claude_native_registration.py Adapts shared registration tests.
tests/​unit/​install/​test_claude_native_hooks.py Updates transition checks and diagnostics.
tests/​unit/​install/​test_claude_native_admission.py Covers project-scope admission and fallback.
tests/​unit/​install/​test_agent_plugin_deployment_boundary.py Checks new native deployment paths.
tests/​unit/​deps/​test_lockfile_field_properties.py Covers declaration-field round trips.
tests/​unit/​deps/​test_lockfile_consumer_contract.py Adds native declaration fixture data.
tests/​unit/​core/​test_remediation_w4_phases_targets_catalog.py Registers new remediation coverage.
tests/​unit/​core/​test_remediation_w3_plugins_runtime_catalog.py Renames settings remediation coverage.
tests/​unit/​copilot_plugins/​test_pr2705_ergonomics_units.py Removes retired registrar-specific tests.
tests/​unit/​copilot_plugins/​_builders.py Adds native-path fixture helpers.
tests/​spec_conformance/​test_native_activation_profile_reqs.py Tests project declarations, fingerprints and suppression.
tests/​quality/​lifecycle_obligations.json Refreshes generated evidence references.
tests/​lifecycle/​world/​test_world.py Checks native surfaces and bin consent.
tests/​lifecycle/​security/​test_gate_removal.py Tracks whole-plugin retirement surfaces.
tests/​lifecycle/​security/​gate_slices/​native.py Updates native gate-removal expectations.
tests/​lifecycle/​oracles.py Recognizes project-scope native ownership.
tests/​lifecycle/​machines/​test_m_gate.py Tests scope-aware native fingerprints.
tests/​lifecycle/​machines/​_gate_kit.py Includes native roots in expected writes.
tests/​lifecycle/​journeys/​consumer/​J02-team-onboarding.yaml Removes the fixed scan-count expectation.
tests/​lifecycle/​generator/​rules.py Refreshes source-line evidence references.
tests/​integration/​test_unmanaged_skill_preflight_matrix.py Checks unmanaged skills beside native plugins.
tests/​integration/​test_remediation_advice_lifecycle.py Updates settings recovery proof.
tests/​integration/​test_ownership_invariant_lifecycle.py Separates native and split-route expectations.
tests/​integration/​test_native_plugin_retirement_lifecycle.py Checks native root and declaration retirement.
tests/​integration/​test_native_plugin_cache_audit.py Covers source and deployed-copy tampering.
tests/​integration/​test_native_plugin_audit_lifecycle.py Checks committed registration and deployed content.
tests/​integration/​test_mcp_portable_approval_lifecycle.py Reads committed Copilot enablement.
tests/​integration/​test_lock_derived_expected_state_lifecycle.py Preserves split-route service fixtures.
tests/​integration/​test_export_patch_installed_packages_lifecycle.py Moves split-plugin scenarios to Cursor.
tests/​integration/​test_dependency_replacement_lifecycle.py Checks native replacement ownership and cleanup.
tests/​integration/​test_copilot_project_settings_precedence.py Adds Copilot settings-precedence checks.
tests/​integration/​test_claude_plugin_hook_approval_lifecycle.py Keeps split-hook coverage through Codex.
tests/​integration/​test_claude_plugin_flat_mcp_lifecycle.py Preserves split-route MCP parsing coverage.
tests/​integration/​test_claude_native_hook_lifecycle.py Updates shared-native diagnostic expectations.
tests/​integration/​test_bin_canvas_deny_diagnostics_lifecycle.py Updates native deployment summary expectations.
tests/​integration/​test_architecture_owner_rule_mutations.py Adapts native ownership mutation checks.
tests/​integration/​test_approve_parked_native_plugin_lifecycle.py Checks whole-plugin activation at both scopes.
tests/​fixtures/​lifecycle_bug_ledger.json Records the Superpowers regression coverage.
src/​apm_cli/​native_plugins/​uninstall.py Shares removal reconciliation and lock recovery.
src/​apm_cli/​native_plugins/​settings.py Supports relative declarations and target suppression.
src/​apm_cli/​native_plugins/​record.py Extends names and native lock-field serialization.
src/​apm_cli/​native_plugins/​carry.py Preserves unevaluated native dependency rows.
src/​apm_cli/​install/​template.py Skips deployment for carried native rows.
src/​apm_cli/​install/​services.py Routes native plugins by harness set.
src/​apm_cli/​install/​pipeline.py Consolidates final native activation phases.
src/​apm_cli/​install/​phases/​lockfile.py Records scope-aware ownership and carried state.
src/​apm_cli/​install/​phases/​copilot_plugins.py Retains capability setup; removes separate registration.
src/​apm_cli/​install/​phases/​claude_plugins.py Runs shared reconciliation and records declarations.
src/​apm_cli/​install/​native_plugin_admission.py Queues Agent Plugins through shared registration.
src/​apm_cli/​install/​drift.py Verifies lock-recorded native plugin content.
src/​apm_cli/​install/​deployment_plan.py Excludes native harnesses from loose projection.
src/​apm_cli/​install/​context.py Tracks carried native dependencies.
src/​apm_cli/​deps/​lockfile.py Persists native declaration metadata.
src/​apm_cli/​core/​remediation.py Updates native recovery guidance.
src/​apm_cli/​copilot_plugins/​constants.py Retains vocabulary needed for legacy migration.
src/​apm_cli/​copilot_plugins/​catalog.py Removes the separate Copilot catalog renderer.
src/​apm_cli/​copilot_plugins/​__init__.py Updates exports for shared ownership.
src/​apm_cli/​commands/​uninstall/​engine.py Adjusts native survivor rebuilding and retirement.
src/​apm_cli/​commands/​uninstall/​cli.py Delegates native removal reconciliation.
src/​apm_cli/​commands/​prune.py Adds lock-derived native cleanup and recovery.
src/​apm_cli/​commands/​install.py Surfaces native refusal messages directly.
src/​apm_cli/​commands/​deps/​cli.py Reports native plugins from the lockfile.
src/​apm_cli/​commands/​approve.py Recognizes Claude plugins at both scopes.
scripts/​architecture_linter/​checks/​marketplace_package_and_registration.py Updates shared ownership checks.
scripts/​architecture_linter/​checks/​install_entry_and_commit.py Updates native activation-order checks.
packages/​apm-guide/​.apm/​skills/​apm-usage/​workflow.md Explains committed native plugin loading.
packages/​apm-guide/​.apm/​skills/​apm-usage/​package-authoring.md Updates plugin routing and bin guidance.
packages/​apm-guide/​.apm/​skills/​apm-usage/​governance.md Updates native bin policy guidance.
docs/​src/​content/​docs/​troubleshooting/​index.md Explains native plugin discovery and activation.
docs/​src/​content/​docs/​reference/​policy-schema.md Updates bin deployment scope.
docs/​src/​content/​docs/​reference/​package-types.md Documents native and split routing.
docs/​src/​content/​docs/​reference/​lockfile-spec.md Documents native ownership and declaration fields.
docs/​src/​content/​docs/​reference/​cli/​uninstall.md Documents native cleanup and recovery.
docs/​src/​content/​docs/​reference/​cli/​pack.md Updates packed Agent Plugin installation guidance.
docs/​src/​content/​docs/​reference/​cli/​install.md Documents native deployment at both scopes.
docs/​src/​content/​docs/​reference/​cli/​audit.md Describes native source and copy verification.
docs/​src/​content/​docs/​reference/​cli/​approve.md Documents whole-plugin Claude approval.
docs/​src/​content/​docs/​quickstart.mdx Adds committed plugin and settings steps.
docs/​src/​content/​docs/​producer/​write-primitives.md Distinguishes native hooks from split hooks.
docs/​src/​content/​docs/​producer/​publish-to-a-marketplace.mdx Distinguishes producer and consumer catalog paths.
docs/​src/​content/​docs/​producer/​build-a-plugin.mdx Explains whole-plugin installation eligibility.
docs/​src/​content/​docs/​consumer/​installing-from-marketplaces.md Updates native marketplace installation guidance.
docs/​src/​content/​docs/​consumer/​install-packages.md Lists native files to commit.
docs/​src/​content/​docs/​consumer/​install-mcp-servers.md Explains native ownership of bundled servers.
docs/​src/​content/​docs/​consumer/​approve-executables.mdx Updates whole-plugin approval guidance.
docs/​src/​content/​docs/​concepts/​how-apm-works.md Updates generated-file commit guidance.
CONFORMANCE.md Refreshes coverage counts and waiver notes.
CONFORMANCE.json Refreshes machine-readable conformance evidence.
CHANGELOG.md Records the project-scope native plugin change.
.apm/​architecture/​owners/​marketplace-plugins.json Registers shared ownership and legacy migration boundaries.

Review effort: Balanced

Comment thread src/apm_cli/install/deployment_plan.py Resolved
Comment thread src/apm_cli/install/phases/lockfile.py Resolved
- Uninstall retires a surviving native plugin install would now park
  (revoked or changed pin, missing MCP grant, org MCP policy block):
  gate_retirements gains native_packages, judged by the whole-plugin
  trust admission and the shared MCP policy check.
- A per-target skill pairing (req-rs-018) that restricts a native
  harness counts as a selection: loose at project scope, parked with -g.
- Legacy Copilot registration retires for plugins this run evaluated and
  refused, so a withheld plugin stops loading live apm_modules bytes.
- Project scope writes .agents/plugins/.gitattributes (* -text): a
  core.autocrlf checkout keeps the pinned bytes.

Each has a failing-before test.

Co-authored-by: Copilot App <[email protected]>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delta review: ec90087 -> 2768abe (standing 0.38 reviewer)

Verdict: NOT CLEAN. The logic folds are sound, but this delta turns CI red in two places. There is also one parity gap in the new native retirement owner.

Blocking: CI red at 2768abe (both caused by this delta)

  • HIGH-A tests/lifecycle/generator/rules.py:265: the citation Ev("src/apm_cli/install/services.py", 836, "staged_files") is stale. The services.py edit (+1 skill_pairing=, -2 comment lines) moved the text to services.py:835. Lifecycle Smoke Shard 4 fails: test_generator_rules.py::test_every_rule_cites_code_that_still_says_it. Fix: change 836 to 835, then re-check the other services.py citations below line 252.
  • HIGH-B tests/unit/install/test_claude_native_hooks.py:161: test_a_per_target_skill_pairing_is_never_widened_to_a_whole_plugin trips AQ003_unobserved_outcome (observed 1, allowed 0) in Architecture Ratchet Contracts (tests/quality/test_quality_baselines.py). The test asserts only on the in-memory plan, with no output, exit code or durable state. Fix: assert an observable outcome, or prove this behavior at the integration level (an install with a diamond pairing that leaves the loose review skill and no .agents/plugins/<name>). Do not raise the baseline.

P4 question 1: does locked_native_retired match install's admission (update uses any(retirements))?

Mostly. One install park reason is missing.

  • Matches install:

    • The trust verdict is admit_native_plugin. It uses the same (pkg_key, pkg_key-without-#ref) key pair as plan_admission.py:82-83, and the same gate-off semantics: exec_trust_context_for_project with gate_enabled=False admits unless the plugin is transitive with MCP.
    • transitive comes from the lock depth, which is equivalent to install's graph depth (plan_admission.py:18-26).
    • The org MCP policy parks only under enforcement: block, as at admission.py:381-382, and native_policy_violation reuses _mcp_policy_violation instead of copying it.
    • one_off is omitted. That matches a flagless install and McpAdmission's loose transitive MCP, so a --trust-transitive-mcp one-off is retired on the next sibling uninstall and re-judged by update. That is consistent with how the loose case behaves.
  • For update, any(retirements) only decides whether the install pipeline re-runs, and install then makes the real decision. A false positive costs a no-op reconcile. Only a false negative matters, and there is one:

  • MEDIUM-C src/apm_cli/claude_plugins/admission.py:203-238: install also parks a native plugin that ships bin/ when org bin_deploy.deny_all or bin_deploy.deny names it (admission.py:390-396, fed by deployment_plan.py:198 bin_deploy_denial). locked_native_retired never checks this. After a bin_deploy tightening:

    • apm uninstall <sibling> keeps the plugin, with its live bin/, declared.
    • apm update with nothing to update does not re-run install. enforce_declared_policy judges dependency refs, not bin content.

    Fix: inside the try, or (bin_deploy_denial(info, policy) if (install_path / "bin").exists() else None), plus one more policy-bin-deny row in the test_native_plugin_retirement_lifecycle.py parametrization. Loose bin/ has the same gap on main, so this is not a regression. But the docstring promises "each native plugin install would now park", so fold it here.

P4 question 2: can the legacy Copilot retirement drop an entry this run did not evaluate?

No. Resolved.

  • ctx.native_rejected_names is filled only at evaluation sites in this run: queue_native_claude when parked with copilot in its harnesses (admission.py:467-468), and _record_rejected at native_plugin_admission.py:151,210.
  • _migratable still refuses unless copilot is in run_targets (registrar.py:494), so a narrowed --target, uninstall or prune never retires.
  • In the main path, missing = legacy.plugins - declared - rejected keeps the whole registration if any legacy plugin is neither declared now nor refused this run.
  • The new early branch (registrar.py:345-352) requires legacy.plugins <= rejected and still goes through _migratable.
  • dry_run returns before any of this (registrar.py:317).
  • Residual (LOW): rejected matches by plugin name, not by lock key. Two packages that ship the same plugin name, one refused and one legacy-registered, could retire the other's legacy entry. That is unlikely, and the native layer already refuses case-fold duplicate names.

Other folds

  • skill_pairing now reaches the native planners through _native_skill_selection (deployment_plan.py:48-65). That is correct, since any per-target restriction now counts as a selection. Its test needs the HIGH-B fix.
  • .agents/plugins/.gitattributes (* -text) is written only at project scope, only while plugins are declared, and is removed only when it holds APM's exact text (layout.py:92-103). The CRLF-clone cell proves that install --frozen and audit --ci both pass on an autocrlf checkout. Resolved.
  • Uninstall moved into native_plugins/uninstall.py::retire_disallowed_native_survivors, inside the registered owner. Keys retired by the native verdict are returned for rebuild under install's gate, and the warning is suppressed for keys already reported as denied or hooks-retired. Resolved.
  • Architecture linter anchor update (_migratable(..., rejected)): exact-text anchor, not weakened. Resolved.

Prior items from the fc6973e->1c813409 review remain resolved.

…fold delta review

- locked_native_retired also applies the org bin_deploy rule install
  parks a bin/ plugin with (Analyst MEDIUM), with a unit cell.
- The skill-pairing cell asserts the deployed skills (AQ003).
- Generator citations refreshed for the moved lines.

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	tests/lifecycle/generator/rules.py
#	tests/quality/lifecycle_obligations.json

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Receipt cleanup can leave a stale Cursor entry active and unaudited after the lockfile is deleted and the server declaration changes to Copilot-only.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread src/apm_cli/install/mcp/integration.py Resolved
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 577087e into main Nov 22, 2026
74 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-fix-3896-native-project branch November 22, 2026 21:16
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
…rate

Keeps main's _EXPECTED_KINDS (#4559, native plugins deploy whole at project scope) with train 6's bundle gating in deploys_what_the_model_allows.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	docs/src/content/docs/consumer/install-plugins.md
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
…arget is expected (#4559)

#4559 deploys a Claude plugin whole for claude and copilot at project scope and gives other targets APM's loose copy. Gemini deploys skills to the cross-tool .agents/skills root that copilot also reads, so with gemini current a parked native plugin's skill lands there and the copilot skill cell observes it. projected_cells now keeps a native package's claude/copilot skill cell only when a current non-whole-plugin target expects the same package's skill at that same root. Stale model, not a product regression: test_first_command_after_a_target_change[kinds-offline-multi-widened].

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
…lugin root (#4559)

#4559 deploys a Claude plugin whole to .agents/plugins/<plugin>/ at project scope, declared in each harness's settings and recorded as the lock's native_plugin (name, root, fingerprint). Earlier today the native-plugin row was switched to the pre-#4559 normalized layout (.claude/agents). It now asserts the agent with its text inside the plugin root, plus the native_plugin record naming that root, before and after compile. A CLI repro on main shows exactly that layout. Fixes test_compile_keeps_a_remote_package_file_primitive[native-plugin].

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
…4559)

The kinds-offline row installed p-native-claude-bin without --trust-bin, so the plugin stayed parked, and the #4559 projection let it pass without any native deployment while crediting SRC=native-plugin x TGT. The row now uses p-native-claude (no bin/), which deploys whole once approved. Before and after the target change it asserts the plugin's skill inside .agents/plugins/p-native-claude, and an enabledPlugins entry set to true in each current harness's settings (claude, copilot).

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
)

CI showed the git-served c-ndoc install parks the plugin ('Parked native plugin lifecycle/c-ndoc: not approved'). #4559 parks an unapproved Claude plugin at project scope too, so no deploy and no lock row was correct. The row now approves, then installs, then compiles, and asserts the whole plugin and its native_plugin record.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
… regenerate

Keeps #4843's native observation (a root half plus the enabledPlugins declaration half, native_gaps). Builds _surface_hits on train 5's entry-aware surfaces (JsonEntry, MergedHooks) and _observable. projected_cells keeps #4843's native projection plus the shared-root loose skill (#4559). #4751 fixed #4744, so the user-scope bin target-change cell drops its strict known and is required (known 9 -> 8, L15).

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
… ruling, #4894)

#4559 and #4808 deploy a trusted project-scope whole plugin with bin/, and prune can retire that root. So U-BIN-OPS no longer lists prune (premises and the tripwire test updated). Covering rows prune only loose packages, whose bin/ never deploys at project scope. A prune step there therefore visits no bin gate level, and its OP x SRC x PRIM absence witness stands. The five T1|OP=prune|PRIM=bin|GATE=<non-org> cells return as honest baseline (38 -> 43) until a whole-plugin prune row credits them (#4894).

Co-authored-by: Copilot App <[email protected]>
Jason 'Jay' Jack (jasonjack-jay) pushed a commit to jasonjack-jay/Agent-Package-Manager that referenced this pull request Nov 23, 2026
…eout

The slice was split by integration-suite durations, but each slice shard pays
the 40-80s mutation-test module baselines per worker, so install-path slices
reached the 15-minute limit on 3 shards (3 timeouts on microsoft#4003, 14m06s on microsoft#4559).
The shard count now comes from strategy.job-total, so the job name and the
--shard argument follow the matrix.

Fixes microsoft#4746

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Native plugins at project scope for Claude and Copilot

2 participants