Repository navigation
fix(claude): keep documented command frontmatter on .claude/commands (#3067) - #3748
Abhishek Acharya (abhishekacharya200) wants to merge 2 commits into
Conversation
…icrosoft#3067) Claude Code documents that command files accept the skill frontmatter except name and paths, but the command transform kept only description, allowed-tools, model, argument-hint and input. On the claude target it now also keeps when_to_use, disable-model-invocation, user-invocable, disallowed-tools, effort, context, agent, background, shell, and an authored arguments when there is no input. Inline hooks stay withheld with their own warning until they go through executable consent. Cursor and Grok output is unchanged.
There was a problem hiding this comment.
🟡 Changes recommended
Authored arguments can trigger uncaught TypeErrors that abort integration when diagnostics are enabled, and empty or rejected input incorrectly preserves arguments despite the required input precedence.
2 open issues
What changed in this PR
Repairs Claude command deployment so supported non-hook frontmatter survives APM’s prompt transformation, addressing #3067 while keeping hook consent work separate in #3227.
Changes:
- Adds Claude-only metadata preservation and authored
argumentspassthrough. - Keeps inline hooks withheld with a dedicated consent warning, without changing other targets.
- Adds regression tests and updates authoring documentation and the changelog.
| File | Description |
|---|---|
tests/unit/integration/test_command_integrator.py |
Tests Claude metadata, argument precedence, hook warnings, and unchanged Cursor output. |
src/apm_cli/integration/command_integrator.py |
Adds Claude-specific preservation rules and hook-withholding diagnostics. |
packages/apm-guide/.apm/skills/apm-usage/package-authoring.md |
Documents preserved fields and the inline-hook limitation. |
docs/src/content/docs/producer/author-primitives/prompts.md |
Explains Claude command frontmatter handling. |
docs/src/content/docs/producer/author-primitives/hooks-and-commands.md |
Updates command preservation guidance. |
CHANGELOG.md |
Records the metadata repair and remaining hook limitation. |
Review effort: Balanced
| claude_metadata["arguments"] = input_names | ||
| if "argument-hint" not in claude_metadata: | ||
| claude_metadata["argument-hint"] = " ".join(f"<{name}>" for name in input_names) | ||
| elif is_claude and "arguments" in post.metadata: |
| claude_metadata["argument-hint"] = " ".join(f"<{name}>" for name in input_names) | ||
| elif is_claude and "arguments" in post.metadata: | ||
| # No 'input' mapping: keep the author's native Claude 'arguments'. | ||
| claude_metadata["arguments"] = post.metadata["arguments"] |
|
Thank you Abhishek Acharya (@abhishekacharya200) for grounding this in the Claude Code frontmatter reference. This PR links #3067, which has a current maintainer scope record (#3067 (comment)). Inline hooks stay tracked separately in #3227, as agreed on the issue. Outstanding before human review:
CI has not run on this fork head yet. A maintainer has to approve the workflow runs after you push. This is a triage recommendation only, not merge approval. Generated by autopilot-pr-triage-worker. This comment is AI-generated and may contain errors. |
|
Thanks again Abhishek Acharya (@abhishekacharya200). We'd like this fix in 0.38.0. On top of the triage notes above (rebase, the two open review findings, and the docs move), there is one new requirement since you opened the PR:
Can you push a rebased head by Mon 2026-11-23? If you can't get to it in time, just say so: a maintainer will carry your commits forward in a follow-up PR with your authorship and a This comment is AI-generated on behalf of the 0.38 release team and may contain errors. |
|
Thanks Abhishek Acharya (@abhishekacharya200)! This branch conflicted with |
|
Thanks Abhishek Acharya (@abhishekacharya200)! The branch couldn't be updated in place (the main merge touches workflow files), so this work continues in #4910, which keeps your commits and authorship. Closing in favor of #4910. |
…icrosoft#3067) Claude Code documents that command files accept the skill frontmatter except name and paths, but the command transform kept only description, allowed-tools, model, argument-hint and input. On the claude target it now also keeps when_to_use, disable-model-invocation, user-invocable, disallowed-tools, effort, context, agent, background, shell, and an authored arguments when there is no input. Inline hooks stay withheld with their own warning until they go through executable consent. Cursor and Grok output is unchanged. Cherry-picked from 9db3413 (microsoft#3748, by @abhishekacharya200) onto main; the dropped-key notice follows microsoft#4182 (verbose info), and the deleted author-primitives doc pages are ported in the next commit. Co-authored-by: abhishekacharya200 <[email protected]> Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Description
Installing a prompt for Claude dropped command frontmatter that Claude Code supports. The command transform kept only
description,allowed-tools,model,argument-hintandinput, so the repro in #3067 (disable-model-invocation,when_to_use,effort) ended up as a warning and a.claude/commands/p.mdwith onlydescription.Claude Code documents that a command file "accepts the same fields except
nameandpaths" (frontmatter reference). On theclaudetarget the command now also keepswhen_to_use,disable-model-invocation,user-invocable,disallowed-tools,effort,context,agent,backgroundandshell, plus an authoredargumentswhen there is noinput:(input:still wins when both are set).hooksis still withheld, as decided on the issue, now with its own warning saying Claude Code supports it but APM does not yet run frontmatter hooks through executable consent, so the command may not behave as authored. Hook support is tracked in [FEATURE] Harness-specific consent for frontmatter hooks (Claude-first) #3227.nameandpathsare still dropped with the existing warning.metadata,licenseandcompatibilityare still dropped, since Claude Code accepts them but doesn't act on them. Happy to keep them too if you prefer.Docs (prompts, hooks-and-commands, apm-guide) and CHANGELOG are updated.
Issue and approved scope
Issue: Fixes #3067
Human scope-approval comment: #3067 (comment) (hook split: #3067 (comment))
Does this PR complete the issue, or what remains? It completes the non-hook metadata repair. Inline
hooksremain withheld and are tracked in #3227.Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
New
TestClaudeNativeCommandFrontmatterintests/unit/integration/test_command_integrator.py: documented keys kept on Claude, authoredarguments,inputprecedence,name/pathsdropped, hooks withheld warning, Cursor output unchanged. 3 of them fail on main.test_command_integrator.pyandtests/integration/test_command_integrator_hermetic.py: 121 passed. Wider install/integration unit runs show no new failures (the existing Windows symlink failures are the same on main).ruff check,ruff format --check, pylint R0801 andlint_architecture_boundaries.pypass.Spec conformance (OpenAPM v0.1)