Skip to content

fix(claude): install intact user plugins through Claude settings, owned by the lock - #3290

Merged
Daniel Meppiel (danielmeppiel) merged 87 commits into
mainfrom
danielmeppiel-native-hook-delivery
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 87 commits into
mainfrom
danielmeppiel-native-hook-delivery

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Reshaped per the 2026-11-19 #3094 design record and brief. Claude only, user scope.

apm install --global --target claude now installs an eligible Claude plugin intact. Its hooks (#3191, process.env.CLAUDE_PLUGIN_ROOT) and commands (#3181, ${CLAUDE_PLUGIN_ROOT}) find their own bundled files. APM never runs the claude CLI.

  1. Resolve, lock, scan and approve the plugin as before; ~/.apm/apm_modules keeps the fetched source.
  2. Copy exactly the plugin files (native_plugin_files: native bundle minus .git, root apm.yml and root .apm/) to ~/.agents/plugins/<plugin>/, and generate ~/.agents/plugins/.claude-plugin/marketplace.json.
  3. Declare it in Claude's settings.json (CLAUDE_CONFIG_DIR honored) with only extraKnownMarketplaces.<apm-u-hash> (directory) and enabledPlugins["<plugin>@<apm-u-hash>"]: true.

Ownership comes only from apm.lock.yaml. Each entry carries a native_plugin record {name, root, fingerprint, marketplace{name,path}} (the loading harness follows from the entry's targets); settings keys and roots are derived from the previous and next lock. There is no receipt file.

  • APM writes true only when a key is absent, and keeps an explicit false, foreign entries and edited roots.
  • A missing previous lock, a moved or renamed binding, or a foreign same-name marketplace is reported and changes nothing.
  • Lock plus settings form one rollback unit: a failed declaration restores the previous lock and removes roots this run created.

MCP and LSP servers (.mcp.json, .lsp.json, mcpServers, lspServers) are supported. Claude loads them from the plugin; the whole-plugin approval covers them; every declared MCP server goes through the org MCP checks (policy_checks.mcp_policy_checks, the one composition the install gate also uses). APM's MCP/LSP writers skip the Claude runtime for a natively routed dependency (native_service_runtimes) and retire any loose Claude entry they wrote earlier; other targets still get APM's copy.

Refusals:

  • Parked (not deployed, not declared, one warning, exit 0): unapproved executables, an MCP server org policy blocks (enforcement: block; warn reports and enables), or declared plugin dependencies. Never a loose fallback.
  • Fail closed (as before): partial skill subsets, symlinks, bin/, unknown manifest capabilities, manifest or server paths outside the plugin, and case-folded name collisions.

Approval pin portability: the approval binds paths and bytes (#3989 compute_native_plugin_pin); the mode-including root digest still gates source, deployed copy and lock. Spec amendment 0.1.66 (revises req-na-005 in place; no count change) is folded here once #3989 lands.

Dropped: claude_plugins/client.py (CLI driving), the Claude version allow-list, the apm-registration.json ledger and the disabled default. Registrations from earlier heads of this PR are migrated by a guarded cleanup.

Area Files
Harness-neutral layer (Copilot reuses it in #3921) src/apm_cli/native_plugins/{record,layout,settings}.py
Claude owner claude_plugins/registrar.py (reconcile_claude_plugins, verify_claude_native_cache), claude_plugins/admission.py (park, refusals)
Lock deps/lockfile.py (native_plugin field), install/phases/lockfile.py (records, carry-forward across a one-shot --target without Claude)
Wiring install/phases/claude_plugins.py, commands/uninstall/cli.py (pre-mutation snapshot and lock restore)
Digest utils/content_hash.py (native_plugin_files, compute_native_plugin_hash; #3918 hosts the canonical copy when it lands)
Guards architecture owner registry, Claude/Copilot ownership checks and sorted mutation cases

Merge order: #3929 (landed) -> #3918 -> this PR. When #3918 merges I switch the hooks bool to security.trust.admit_native_plugin(allow_executables, package_keys, plugin_root) and import its hasher. Until then the interim approval is the legacy allowExecutables hooks bool, and no new approval path is added.

Issue and approved scope

Issue: Fixes #3191; Fixes #3181

Human scope-approval comment: #3191 (comment) (reshape, supersedes the CLI-driven route); companion record #3181 (comment). Review contact: Daniel Meppiel (@danielmeppiel).

Does this PR complete the issue? Yes, once the human runtime witness passes on this head; its recipe was sent to the coordinator. The #3094 design study observed a settings-only SessionStart on real Claude 2.1.322. The command and UserPromptSubmit witness at 4624e7f used the earlier CLI route, so neither is evidence for this head. Out of scope: project scope and Copilot (#3921), Codex (#3920), the plugin dependency resolver, README.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Validation at the pushed head (macOS arm64):

  • uvx [email protected] check and format --check over the CI lint scope: passed (2454 files).
  • pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ scripts/...: 10.00/10.
  • bash scripts/lint-auth-signals.sh and bash scripts/lint-architecture-boundaries.sh: clean. The 2100-line and relative_to guards: clean.
  • APM_E2E_TESTS=1 pytest tests/integration/test_claude_native_hook_lifecycle.py: 7 passed. Covers two plugins whose real node hooks resolve per-plugin roots, user false and foreign keys preserved, a one-shot --target codex keeping Claude declarations, --frozen, audit tamper and mode drift, both failure-and-recovery paths, and a trap claude on PATH that is never run.
  • pytest tests/spec_conformance/test_native_activation_profile_reqs.py tests/unit/install/test_claude_native_*.py: passed. The req-na-001/006 waivers are skipped.
  • pytest tests/unit tests/spec_conformance -n 8: 29017 passed, 14 failed. Each failure was rerun in isolation:
    • 2 lockfile contract tests, now updated and passing.
    • Load-timing flakes that pass alone: installer shell tests, test_ci_topology and test_targets_phase.
    • 2 that also fail without this PR's code paths: the Azure DevOps credential-helper hang and test_is_tool_available.
  • CI: CI and Spec conformance green at 5b902f828. This head adds only the CHANGELOG line.
  • Real apm install -g obra/superpowers (22f0b46) in an isolated HOME:
    • The plugin installed intact under ~/.agents/plugins/superpowers with no apm.yml, .apm/ or .git, and all 4 hook files present.
    • Settings held only the two keys.
    • Uninstall left empty sections and no plugins root.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md: user-visible effect first, 25 words or fewer, ending with (#PR); breaking changes only under upgrade notes; no Highlights; see .github/instructions/changelog.instructions.md.
  • 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. Section 5.2 gains the native_plugin row (fields, plus install/frozen/restore/audit timing), cited from req-na-002 and req-na-004. The req-na-002 digest exclusion is stated as unconditional (oci-rec-d1-1). No new anchors (amendment 0.1.65, docs(spec): add the OpenAPM native plugin activation profile (#3919) #3929).
  • Manifest edit: not needed (no new requirement IDs).
  • Test edit: tests/spec_conformance/test_native_activation_profile_reqs.py binds req-na-002 (known-answer digest vector and deployment), 003 (two keys, no subprocess), 004 (all 11 oracle cases, no receipt), 005 (parked, not declared) and 007 (per-APM-home name, binding refusal). req-na-001 (disclosure after the runtime witness) and 006 ([FEATURE] Codex: retire the app-server registration route; explicit split install #3920) stay waived.
  • CONFORMANCE.{md,json} regenerated via uv run --extra dev python -m tests.spec_conformance.gen_statement and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

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

Register new plugins disabled via the qualified native CLI, preserve activation, and reconcile owned metadata from locked sources. Authenticated runtime qualification remains pending.

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

Copilot-Session: 6c656434-efdf-444d-bb89-27407cbc7c44
Read saved lock state, preserve parser-normalized legacy plugin types, and retain selector/preflight ownership while suppressing loose projection.

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

Copilot-Session: 6c656434-efdf-444d-bb89-27407cbc7c44
Cover user-hook migration, standalone and replay controls, full-source safety, interrupted ownership recovery and native transport metadata exclusion. Document qualified metadata versus pending runtime execution.

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

Copilot-Session: 6c656434-efdf-444d-bb89-27407cbc7c44
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 6c656434-efdf-444d-bb89-27407cbc7c44
Fold independent PR3290 panel findings and observed CI failures. Exercise installed APM hook metadata lifecycle without native hook execution. Preserve canonical empty survivors until native cleanup succeeds, keep target-aware diagnostics, and document the missing runtime witnesses.

Metadata protocol fixture extracted from Daniel Meppiel's command lifecycle test in commit 41bdcf1, preserving its metadata-only boundary.

Co-authored-by: Daniel Meppiel <[email protected]>

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a

# Conflicts:
#	src/apm_cli/install/drift.py
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Refuse unsupported automatic migration through the existing hook owner.
Exercise req-lk-021 byte preservation and malformed-state refusal with
real component conformance cases; keep native runtime qualification open.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve retained-hook compliance and the canonical native replay seam.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Keep existing package and lockfile hash semantics unchanged. Provide one canonical raw-content and Git executable-bit fingerprint for native consumers.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Exercise complete publisher assets, Git executable bits, transport exclusions, symlink refusal, and unchanged historical package hashes without any native runtime.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Use the sole canonical native fingerprint API for admission, retained ownership, readback and read-only audit. Bind remote attestations to saved source pins, refuse unfingerprinted legacy adoption, and retain recoverable removal intent. Normalize local replay inputs only in scratch.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Exercise missing pins, independently callable pre-write checks, mixed-version removal recovery, normalization stability and real local CLI audit. Keep the pre-existing local MCP consistency diagnostic distinct from native drift evidence. Document audit scope and retained fingerprint boundaries.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Fold the independent CEO synthesis follow-up without weakening the generic MCP source-admission contract. Raw local legacy plugins can retain a separate config-consistency failure while their native fingerprint is healthy.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
@danielmeppiel

Daniel Meppiel (danielmeppiel) commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups - qualified draft publication only

DRAFT / NATIVE ACCEPTANCE HOLD. Actual Claude SessionStart, SubagentStart and UserPromptSubmit witnesses and native consent remain absent. Successful CI is not native, specification or release readiness. Keep PR3290 draft and issue3191 open.

Current head: 0d4ee8095f43c241995b30c5c3b83a3c4fe50f0b; integrated base: 53ccf06d11dd2d675e8ea8c3e2523a6d321c1b79.
This ancestry-preserving continuation integrates landed Codex behavior with the prior Claude foundation. It preserves separate native registrars, queues, ledgers, canonical source-plan/hash ownership and default hashing semantics.

Independent delta disposition

Seven genuine specialists reviewed the frozen initial merge tree: architecture, supply-chain, coverage, performance, DevX, documentation and authentication. Later folds were separately qualified at the exact published head. The genuine CEO stance is ship_with_followups for qualified draft publication, not permission to merge.

  • Folded lazy Claude phase loading and existing both-target installed-CLI lifecycle coverage.
  • Preserved both native/static catalogs and retained-hook conformance; fixed only the merged statement budget and wrapped-output assertion without weakening their contracts.
  • The CEO rejected proposed loose projection from an opaque Codex bundle because it contradicts canonical suppression of all loose projections.
  • Retained factual corrections: e69283b was the earlier Claude head, not Codex; remote CI was observed after publication, not before it. Original specialist/CEO returns remain preserved. No new panel ran for this metadata closeout.

Exact-head qualification

610 focused tests (including 68 quality cases), 31 static cases, six existing official Codex metadata/content cases, and 348 conformance cases passed; two conformance cases skipped. All ten local lint/architecture/strict guards passed.

Sixteen Claude/shared mutations produced 40 failures; 41 producer Codex/API mutants produced 46 test-call failures; two additional static disablings produced 15. All 81 distinct failed IDs passed after restoration. Five Codex failures are downstream contract exceptions, not literal assertions; none are setup/import errors or skips. API source bytes remained unchanged; in-memory mutations are disclosed.

Owner precision: five deterministically detected owners map to 13 executed current-head functional IDs. Actual completion status remains blocked, so canonical verify_completion skips terminal-owner enforcement. The separately disclosed advisory-status projection is an architecture-only probe, not an actual terminal gate or readiness pass.

Observed CI

Fresh exact-head REST reads confirm successful CI 39470640291, Spec conformance 39470640316 and Merge Gate 39470640367. CI job evidence includes both Linux shards/Coverage, Windows gates, lint, architecture and APM/lifecycle/binary smoke. CodeQL, Docs, NOTICE and eligibility workflows also succeeded.

Original yellow-CI completion, validation, publication and handoff receipts remain untouched. This green observation is additive; historical e69283b results and its needs_discussion stance are not relabelled.

Remaining boundaries

#3181 alone owns native runtime investigation under the existing consent boundary. Metadata responses and substituted Claude transport do not supply runtime witnesses. No new trust, activation, credential use or native action occurred.

Unproven replay optimization, cross-dependency failure isolation and unrelated raw-local missing-manifest MCP consistency remain outside this repair. Native acceptance itself is still an unmet original criterion, not deferred or waived.

Cumulative counts remain 6 outer / 3 Copilot rounds / 2 CI recoveries, under the authorized session-only budget override. This metadata closeout adds no iteration or recovery. GitHub reports MERGEABLE / BLOCKED; the PR remains draft/open, with no auto-merge, reviewer request, merge or issue closure.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

Preserve both native registrars, selected-format admission, audit replay and cleanup. Retain canonical native hashing and source-plan authority; cover combined target selection and defer the Claude phase import.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
The exact merged candidate emitted the required user-scope refusal, but Rich wrapped the phrase across a line. Normalize diagnostic whitespace while retaining the failure, wording and unchanged-native-state assertions.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Keep dynamic function lookup through the existing pure lockfile_state owner. This removes a redundant function-local import and restores the unchanged 200-statement budget after the native merge, without changing cleanup or refusal behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Share prepared native admission with batch skill preflight, verify local locks against the original source image, and inspect raw local MCP declarations in disposable validated snapshots. Keep Claude audit verification isolated from loose deployment replay and preserve independent cache fingerprints.

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

Copilot-Session: 6c656434-efdf-444d-bb89-27407cbc7c44
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Oct 21, 2026
Integrate published #3290 d23d1ac and main 7e20 while preserving the independent #3181 command contracts and contributor ancestry. Native runtime acceptance remains unmet; this merge does not grant consent.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 583dd1bc-30be-41e1-b45e-a1dd8988136e
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Published d23d1acca67e569352ae89022f0cc8fcb7e42f31 on this same draft PR, preserving 0d4ee809 ancestry and merging main 7e20e044.

The resumed repair shares native admission with batch skill preflight, preserves same-name personal loose skills, checks local locks against original source snapshots, validates raw local MCP declarations in disposable scratch, and keeps complete Claude audit verification out of loose-deployment replay. The command companion #3291 consumed this public foundation; no private producer patch was required.

Evidence: 424 functional and 120 static passes on the merged working tree; full conformance 517 passed / 2 skipped; 46 exact-head functional cases bind all 8 detected owners; full current lint mirror and strict guards pass. Four process-memory guard mutations produced 10 intended failures with zero errors before restoration.

Current CI, spec conformance, and Merge Gate are successful at this head. The original lifecycle job completed 394 tests successfully, with 13 skips, then hit its 10-minute job deadline. Its one isolated retry passed in 511.37 seconds / 9:05 total job time. No timeout, selection or source was changed. The original cancellation remains recorded; historical 6/3/2 is preserved, with cumulative CI recoveries now 3.

Acceptance remains blocked, not ready to merge. Normal native consent for the isolated owned fixture session is still absent. Actual Claude Code 2.1.291 SessionStart, SubagentStart and UserPromptSubmit execution, distinct effective roots/resources, and runtime lifecycle-state witnesses must follow that consent through the designated runtime owner. No native probe, trust bypass or activation occurred here. Metadata, substituted transport, conformance and green CI do not replace those witnesses. Keep this PR draft and #3191 open; final qualification/merge stays with the coordinating maintainer.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

Resolve two conflicts while keeping main's behavior and this PR's native
Claude registration owner:

- uninstall: keep main's _persist_uninstall_lockfile (symlink refusal,
  committed-claim binding, profile-scoped updates) and extend it with
  defer_empty_removal so an empty last-package lock is still retained until
  Claude native cleanup converges, then removed.
- mcp_config_view: adopt main's #3540 redirect to the install-synthesized
  apm_modules/_local manifest for local Claude plugins (with missing-manifest
  warning and frozen cold-cache deferral). Drop the superseded scratch
  snapshot and retarget the marketplace-integrations-claude-ownership
  static guard and its mutation cases to main's redirect.

Co-authored-by: Copilot App <[email protected]>
- Route uninstall lock persistence through main's guarded
  _persist_uninstall_lockfile call; a small helper persists survivors,
  converges native registrations, then removes an empty last-package lock,
  keeping uninstall() within its statement budget.
- Extract _queue_native_claude so integrate_package_primitives stays
  within the C901 limit after combining main's changes.
- Align the local Claude MCP read-only test with main's #3540 semantics:
  without the install-synthesized manifest, servers stay uncollected and the
  publisher source is never mutated.

Co-authored-by: Copilot App <[email protected]>
Fold delta-panel follow-ups on the merge resolution:

- _persist_lock_then_resync_native takes deploy_root, modules_dir and
  scope explicitly instead of forwarding **kwargs.
- Unit traps for _persist_uninstall_lockfile defer_empty_removal branches
  and for removing an empty last-package lock only after native resync
  converges (mutation-break: no-defer -> 3 failures, unlink-before-resync
  -> 2 failures).

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

Daniel Meppiel (danielmeppiel) commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Native Claude check (10 minutes)

This is the merge gate for #3181: Claude Code itself must load the plugin APM registered and run its namespaced command, with ${CLAUDE_PLUGIN_ROOT} resolving to the intact plugin. An agent cannot pass Claude's trust prompt, so this needs one human run. Everything happens in a throwaway HOME, so your real ~/.claude and ~/.apm are not touched.

Requirements: macOS or Linux, git, node + npm, uv, python3, and a Claude login (or ANTHROPIC_API_KEY). The fixture is the #3291 plugin tests/fixtures/native_claude_commands: its manifest selects one command, selected/status.md, which runs node "${CLAUDE_PLUGIN_ROOT}/scripts/context.mjs", which reads a bundled resource file.

1. Isolated tools (about 3 minutes)

export CHECK="$(mktemp -d /tmp/apm-native-claude-check.XXXXXX)"
export SHA="$(git ls-remote https://github.com/microsoft/apm refs/heads/danielmeppiel-claude-command-qualification | cut -f1)"
echo "check dir: $CHECK  stack head: $SHA"

# Claude Code 2.1.291 is the only version APM's native route is qualified for.
npm install --silent --prefix "$CHECK/npm" @anthropic-ai/[email protected]
# APM from the #3290 + #3291 stack head.
if ! { uv venv -q "$CHECK/apm-venv" && uv pip install -q --python "$CHECK/apm-venv/bin/python" "git+https://github.com/microsoft/apm@$SHA"; }; then
  # Fallback if uv cannot resolve from your index: run the stack source with
  # the .venv of an existing microsoft/apm checkout.
  export APM_REPO="$HOME/Repos/awd-cli"
  git -C "$APM_REPO" fetch -q origin danielmeppiel-claude-command-qualification
  git -C "$APM_REPO" worktree add -q --detach "$CHECK/apm-src" "$SHA"
  mkdir -p "$CHECK/apm-venv/bin"
  printf '#!/bin/sh\nPYTHONPATH="%s/apm-src/src" exec "%s/.venv/bin/python" -m apm_cli.entrypoint "$@"\n' "$CHECK" "$APM_REPO" > "$CHECK/apm-venv/bin/apm"
  chmod +x "$CHECK/apm-venv/bin/apm"
fi
"$CHECK/apm-venv/bin/apm" --version   # the version line ends with the first 9 chars of $SHA

2. Isolated HOME and CLAUDE_CONFIG_DIR

export REAL_HOME="$HOME"
export HOME="$CHECK/home"
export CLAUDE_CONFIG_DIR="$CHECK/home/.claude"
export PATH="$CHECK/npm/node_modules/.bin:$CHECK/apm-venv/bin:$PATH"
mkdir -p "$HOME/.apm" "$CHECK/work"
claude --version     # expect: 2.1.291 (Claude Code)

3. Install the fixture plugin globally with APM

cat > "$HOME/.apm/apm.yml" <<EOF
name: native-claude-check
version: 1.0.0
targets: [claude]
dependencies:
  apm:
    - git: microsoft/apm
      ref: $SHA
      path: tests/fixtures/native_claude_commands
EOF
(cd "$CHECK/work" && apm install -g --target claude --only apm)

Expected output includes:

1 native Claude plugin(s) registered; existing activation preserved. New plugins
are disabled. Review and enable them in Claude; restart or reload plugins there.
claude plugin list --json
ls "$CLAUDE_CONFIG_DIR/commands" 2>&1    # expect: No such file or directory (no loose copies)

Expected: exactly one entry, "id": "apm-command-context@apm-claude", "scope": "user", "enabled": false, with readFromFolder ending in .apm/apm_modules/microsoft/apm/tests/fixtures/native_claude_commands.

4. Your consent: enable the plugin

APM never enables plugins. You do that:

claude plugin enable apm-command-context@apm-claude --scope user

5. Run the namespaced command in a real session

cd "$CHECK/work"
APM_COMMAND_PROBE_MARKER="$CHECK/witness.jsonl" claude

In Claude:

  1. Accept the folder trust prompt and log in if asked (the config is fresh).
  2. Type /apm-command-context:. The menu must offer status and must NOT offer unselected.
  3. Run /apm-command-context:status qualified-3181. Approve the node command if Claude asks.
  4. Claude prints JSON like this. The root is your $CHECK path, so it will differ. Claude loads the plugin in place from APM's apm_modules (readFromFolder), not from its plugin cache (confirmed on real 2.1.322, 2026-11-19):
{"root":"<CHECK>/home/.apm/apm_modules/microsoft/apm/tests/fixtures/native_claude_commands","resource":"APM_NATIVE_COMMAND_CONTEXT","argument":"qualified-3181"}
  1. Type /exit.

6. Verify the witness (proof of success)

python3 - "$CHECK" <<'PY'
import json, pathlib, sys
check = pathlib.Path(sys.argv[1]).resolve()
rows = [json.loads(l) for l in (check / "witness.jsonl").read_text().splitlines() if l.strip()]
assert len(rows) == 1, rows
row = rows[0]
assert row["resource"] == "APM_NATIVE_COMMAND_CONTEXT", row
assert row["argument"] == "qualified-3181", row
root = pathlib.Path(row["root"]).resolve()
assert root.is_relative_to(check / "home"), root
assert (root / "scripts/context.mjs").is_file() and (root / "resources/identity.txt").is_file(), root
print("[+] NATIVE CLAUDE CHECK PASSED")
print("    root:", root)
PY

Success means the script prints [+] NATIVE CLAUDE CHECK PASSED, Claude showed the same JSON, and the menu had status but no unselected. Paste the two printed lines plus the claude plugin list --json output into this PR.

Failure looks like one of these: /apm-command-context:status is missing from the menu, unselected is offered, the JSON has an empty or wrong resource, root is outside $CHECK/home, or the witness file is missing. If Claude printed the JSON but no witness file exists, paste the JSON anyway; the env var may not reach the command shell.

Heads-up from the agent dry run: claude plugin details apm-command-context@apm-claude reports Skills (0). A plain plugin with no APM involved shows the same thing when its command is declared through a manifest commands path, while default commands/ files are counted. That could be a details blind spot or a real loading gap. This step settles it.

7. Clean up

(cd "$CHECK/work" && apm uninstall -g microsoft/apm/tests/fixtures/native_claude_commands)
claude plugin list --json      # expect: []
export HOME="$REAL_HOME"; unset CLAUDE_CONFIG_DIR
[ -n "${APM_REPO:-}" ] && git -C "$APM_REPO" worktree remove --force "$CHECK/apm-src"
rm -rf "$CHECK"

Then open a new shell so PATH is clean again.

What the agent already verified at stack head 73a2550d0 (no trust, enable, or session): with real Claude 2.1.291 and an isolated HOME and CLAUDE_CONFIG_DIR, step 3 registered apm-command-context@apm-claude disabled at user scope, created no loose commands, and step 7 removed the registration and the empty lock. On this machine the uv pip install path failed to resolve dependencies, and the step 1 fallback worked.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Refs #3948. The 12 link-target changes the CDO moved out of #3996, plus
the two #3290 links to the retired installing-from-marketplaces anchor.
Prose unchanged.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
A project that targets Claude or Copilot installs an eligible Claude plugin,
or an Agent Plugin, intact: the approved root is copied to the committed
.agents/plugins/<plugin>/, .agents/plugins/.claude-plugin/marketplace.json is
generated, and the marketplace is declared with the relative path
./.agents/plugins under apm-p-<hash(apm.yml name)> in .claude/settings.json
and/or .github/copilot/settings.json, following each dependency's targets.

- Move #3290's reconcile out of the Claude registrar into the shared
  native_plugins owner (reconcile, binding, harnesses, claimants) and reuse
  its record, layout and settings writer. Ownership stays lock-only; all
  settings files are one rollback unit with the deployed roots.
- Pin Copilot CLI 1.0.112's observed file precedence (.github/copilot over
  .claude) and refuse a foreign same-name marketplace in any file a harness
  reads.
- Project locks record a path+bytes digest (interim helper, byte-identical
  to #3989's compute_native_plugin_pin; swap on rebase).
- Move the Copilot Agent Plugin route onto the shared owner; copilot_plugins
  now only migrates a legacy apm-registration.json registration.
- Keep req-tg-013 claimant selection, split install with a warning for
  ineligible plugins at project scope, and refusal of plugins that declare
  dependencies.
- Wire install, uninstall, prune, approve and audit replay; retarget the
  ownership guard and owner registry.

Fixes #3921

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
A project that targets Claude or Copilot installs an eligible Claude plugin,
or an Agent Plugin, intact: the approved root is copied to the committed
.agents/plugins/<plugin>/, .agents/plugins/.claude-plugin/marketplace.json is
generated, and the marketplace is declared with the relative path
./.agents/plugins under apm-p-<hash(apm.yml name)> in .claude/settings.json
and/or .github/copilot/settings.json, following each dependency's targets.

- Move #3290's reconcile out of the Claude registrar into the shared
  native_plugins owner (reconcile, binding, harnesses, claimants) and reuse
  its record, layout and settings writer. Ownership stays lock-only; all
  settings files are one rollback unit with the deployed roots.
- Pin Copilot CLI 1.0.112's observed file precedence (.github/copilot over
  .claude) and refuse a foreign same-name marketplace in any file a harness
  reads.
- Project locks record a path+bytes digest (interim helper, byte-identical
  to #3989's compute_native_plugin_pin; swap on rebase).
- Move the Copilot Agent Plugin route onto the shared owner; copilot_plugins
  now only migrates a legacy apm-registration.json registration.
- Keep req-tg-013 claimant selection, split install with a warning for
  ineligible plugins at project scope, and refusal of plugins that declare
  dependencies.
- Wire install, uninstall, prune, approve and audit replay; retarget the
  ownership guard and owner registry.

Fixes #3921

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Refs #3948. Wave 3 of the 0.37 docs sweep, stacked on #3290:
- lockfile-spec: native_plugin record row (name, root, fingerprint,
  marketplace; no harnesses)
- uninstall: extraKnownMarketplaces cleanup and the real recovery hint
- apm-usage/commands.md: global uninstall of native plugins, Claude
  user-plugin pins, hook keys on the publisher file, deprecated
  apm install --update, copilot/minimal compile fallback
- cache.md: mark apm install --update deprecated
- targets.md: apm update instead of apm deps update

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Refs #3948. The 12 link-target changes the CDO moved out of #3996, plus
the two #3290 links to the retired installing-from-marketplaces anchor.
Prose unchanged.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Base automatically changed from danielmeppiel-0-37-owner-hardening-c to main November 20, 2026 06:40
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit d8eb528 into main Nov 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants