Repository navigation
Labels
area/hooksHook deployment, consent and harness hook formatspillar/consumePillar: install any agent package into any harness, reproduciblystatus/acceptedHuman scope approval; verify the issue's approval record and review contact before work.type/bugSomething does not work as documented.
Milestone
Description
Summary
When a package is installed from a Claude plugin, apm correctly rewrites
${CLAUDE_PLUGIN_ROOT} inside hook commands, but leaves the same variable
untouched inside slash commands. The variable is not set under the APM
deployment model, so every deployed command that references it is broken.
Reproduced with openai/codex-plugin-cc (8 slash commands, all affected).
Environment
- APM CLI 0.33.0
- Claude Code 2.1.291
- Rocky Linux 9.4 x86_64
Reproduction
~/.apm/apm.yml:
dependencies:
apm:
- git: openai/codex-plugin-cc
ref: main
path: plugins/codex
apm install -g --force --only apm
Source (plugins/codex/commands/status.md)
!`node "${CLAUDE_PLUGIN_ROOT}/scripts/codex-companion.mjs" status "$ARGUMENTS"`
Deployed (~/.claude/commands/status.md)
!`node "${CLAUDE_PLUGIN_ROOT}/scripts/codex-companion.mjs" status "$ARGUMENTS"`
Identical — the variable survives deployment. The scripts themselves are
deployed correctly, to ~/.claude/hooks/codex/scripts/.
What happens at runtime
CLAUDE_PLUGIN_ROOT is set by the Claude Code plugin loader. Under APM
there is no plugin load, so the variable is empty and the argument expands to:
/scripts/codex-companion.mjs (does not exist)
For commands, this surfaces before the command even runs, as a permission-check
failure:
Shell command permission check failed for pattern
"!`node "${CLAUDE_PLUGIN_ROOT}/scripts/codex-companion.mjs" status ""`":
A variable in braces in this command can't be checked before it runs
The permission checker cannot resolve a braced variable ahead of time and
therefore refuses the command. Even if it were permitted, the path would
resolve outside the deployed tree.
Why hooks are unaffected
apm already has the rewriting logic for hooks — it is just not applied to
commands. Evidence, from apm_cli:
┌───────────────────────────────────┬────────────────────────────────┐
│ file │ CLAUDE_PLUGIN_ROOT occurrences │
├───────────────────────────────────┼────────────────────────────────┤
│ deps/plugin_parser.py │ 7 (parsing) │
├───────────────────────────────────┼────────────────────────────────┤
│ integration/hook_command_paths.py │ 1 (hook commands only) │
├───────────────────────────────────┼────────────────────────────────┤
│ integration/command_integrator.py │ 0 │
└───────────────────────────────────┴────────────────────────────────┘
Deployed hook command, correctly rewritten:
{"command": "node \"/home/xa/.claude/hooks/codex/scripts/session-lifecycle-hook.mjs\" SessionStart"}
Source of the same hook:
{"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/session-lifecycle-hook.mjs\" SessionStart"}
Impact
Any migrated Claude plugin whose slash commands reference
${CLAUDE_PLUGIN_ROOT} breaks on install. With openai/codex-plugin-cc,
8 of 8 commands are affected (status, review, rescue, result,
cancel, transfer, setup, adversarial-review), and none of them work.
Suggested fix
Apply the same rewrite to command bodies that hooks already get. The deployed
scripts live under <deploy_root>/hooks/<package>/scripts/…, so the
substitution target is the same one hook_command_paths.py computes — either
an absolute path or ${CLAUDE_PROJECT_DIR}/….
Note that the rewrite has to happen inside the command's Markdown body, not
only in frontmatter: the reference sits in an executable !`…` line in the
body.
Follow-up
While reviewing this, I noticed a second question worth checking: a Claude
plugin's commands are namespaced by the plugin name (/codex:status), while
APM deploys them flat into .claude/commands/. After migration the command is
invoked as /status and /review. Whether that is intended is a separate
question — mentioning it only because it affects the same package.Metadata
Metadata
Assignees
Labels
area/hooksHook deployment, consent and harness hook formatspillar/consumePillar: install any agent package into any harness, reproduciblystatus/acceptedHuman scope approval; verify the issue's approval record and review contact before work.type/bugSomething does not work as documented.
Type
Projects
- StatusShow more project fieldsDone
Activity
danielmeppiel commentedon Oct 7, 2026
Decision: approve
Area: project
Scope: Accept this Claude global/user installation failure as a bounded regression child of #3094's native-plugin program. Keep the plugin intact and load it through a supported Claude native route, so Claude knows which plugin each command belongs to and resolves its bundled scripts correctly. This accepts fixing the reported bug, not the suggested rewrite of loose command Markdown.
Done when: Pin the plugin revision and Claude version and reproduce the reported failure. Demonstrate actual native command loading and invocation with the manifest-selected commands, complete plugin resources, correct plugin-root substitution and native namespacing consistent with #1120. Cover the reported global/user scope without duplicate loose commands or hooks. Use lifecycle regression coverage for install/reinstall and ownership-aware update/removal; preserve selected source identity, user-owned state, explicit disables and native permission/trust requirements. Successful file copying or registration alone is not proof that the command works. Keep ordinary standalone primitives working and document the qualified versions, scopes and remaining limitations. Sequence this with #3094's native-route design and qualification rather than creating a second installation mechanism.
Out of scope: Extending the current loose-command text rewrite as this issue's approved solution; treating the copied hook directory as a universal plugin root; general Markdown or shell substitution; bypassing permission checks or native consent; automatic activation; a new standalone-command naming policy; changing #3169's explicit-empty command selection; promising native support for every harness at once. An interim compatibility patch needs a separate bounded decision. No implementation dispatch from this decision session, blocked-delivery restart, PR/merge approval, immediate workaround promise or release commitment.
Review contact: Daniel Meppiel (@danielmeppiel)
Reason: The command effectively says "run the helper inside my plugin folder." When APM deploys it as a loose command, the native plugin context is missing. Claude's reference says plugin-root references are substituted inside command Markdown when it loads; they are not ordinary environment variables exported to Bash-tool commands. Replacing the text might help this example, but would continue reconstructing a plugin from separated pieces. #3094 already selects intact native loading, #2824 covers related resource-layout failures, and #1120 covers native coexistence. Add this concrete case to that work rather than reopen the architecture direction. Current-source inspection supports this explanation; a fresh runtime reproduction remains required. Recorded by Copilot after Daniel Meppiel (@danielmeppiel) explicitly agreed to this bounded scope and relationship, with Daniel as review contact.
test(claude): cover native command selection and sibling lifecycle
Merge public native plugin foundation into command qualification
fix(claude): fold the review panel and support plugin bin/ natively