fix(kyberforge): apply the #273 review to the apm 0.39.3 refresh

- apm-workflow and apm-orchestrate always pass --project to uv run,
  because uv run outside the project silently runs the PATH apm. The
  agent now checks that the reported version equals the pin, or is
  0.39.2 or later where nothing pins it, not only that it exits 0.
- A pin is a quoted apm-cli or apm_cli requirement plus a uv.lock,
  matching the SessionStart hook, in apm-install, uv-pin.md and
  apm-workflow.
- uv-pin.md spells the hook's exact invocation and its environment
  check, and says scripts always pass --project.
- instructions-author and its research note: a Claude rule leaves
  .claude/rules/ only when compile actually wrote it into AGENTS.md;
  install-then-compile dedups it.
- prompt-author: Kiro strips every key with a warning, not silently.
- Record the 0.39.3 executables findings in approvals-and-executables.md
  and the output-profile and type-routing facts in cli-reference.md, and
  cite those digests.
- forge's routing table notes that Kiro gets the body only.

Refs: #273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-12-02 12:35:19 +00:00
1 parent c68b67301a
commit e6d680a4c5
14 files changed
+49 -26

No files matched your search

@@ -4,6 +4,7 @@ source_keys:
- apm-v0-39-3-source
- apm-v0-39-3-changelog
- apm-v0-39-3-docs
- apm-cli-0-39-3-experiments
---
How apm 0.39.3 decides whether a package's executables may be deployed. Executables means hooks, MCP servers, `bin`, LSP servers, canvas extensions and native plugins. This also covers what `apm approve` writes and which `apm audit --ci` checks enforce it. Read from the v0.39.3 source, CHANGELOG and docs, and not run. Claims are marked **source** or **doc**.
@@ -84,3 +85,12 @@ executables:
- a blocking org policy applies;
- installed files differ from `apm.lock.yaml`.
- **Source:** `apm deny [PACKAGES] --user/-g` writes deny entries.
## Observed on 0.39.3 (holocron#273)
Run with the repo-pinned apm 0.39.3 in a throwaway project, with a local `./pkg` dependency shipping one SessionStart hook.
- **No `executables:` block.** `apm approve --list` prints `Executable-trust gate disabled -- executables need no approval (org policy still applies)`, and the hook deploys (`hooks[+:gate-disabled]`).
- **Bare-name grant.** An allow key `pkg#1.0.0`, which is not the package identity `./pkg`, parks the hook: install prints `1 package(s) have executable primitives parked pending approval; install completed without deploying them`, deletes the previously deployed script, writes no `.claude/settings.json` entry and exits 0. `apm approve --list` shows `hooks[x:default-deny]`.
- **`#version` is ignored.** An allow key `./pkg#9.9.9` admits the installed `./pkg` at 1.0.0: the hook deploys and install exits 0.
- In this repo, the full-identity type-level grants deploy both hooks, and every install warns `executable approvals are not pinned to content`.
@@ -199,3 +199,13 @@ apm config list
apm config unset <key>
apm experimental enable registries
```
## Marketplace outputs and package-type routing (source, re-read under holocron#273)
- `apm_cli/marketplace/output_profiles.py` registers three marketplace output profiles in `MARKETPLACE_OUTPUTS`:
- `claude`, writing `.claude-plugin/marketplace.json`;
- `codex`, writing `.agents/plugins/marketplace.json`, which requires a `category` on every package;
- `copilot`, writing `.github/plugin/marketplace.json`.
apm 0.28.0 had only `claude` and `codex`.
- `get_effective_type()` in `apm_cli/integration/skill_package_routing.py` derives the content type from the detected package type: a Claude skill, hybrid, skill bundle or marketplace plugin routes as a skill, and everything else as instructions. It never reads the `type:` declared in `apm.yml`, as in 0.28.0.
@@ -100,7 +100,7 @@ Observed with the repo-pinned apm 0.39.3 in throwaway packages outside the repo.
- **Unquoted or broken frontmatter fails install.** `applyTo: **/*.py` unquoted, or `description: [broken`, makes `apm install` exit 1 with `Rejected frontmatter in <file>` and deploy nothing. No transaction change is committed. Compile still prints `Failed to parse`, skips the file and exits 0; `--validate` counts it out. The silent widening above no longer happens on install.
- **Claude compile layout.** `apm compile --target claude` writes `AGENTS.md` with the instruction bodies and a `CLAUDE.md` that holds only `@AGENTS.md` under the generated header. Compile also warns `applyTo for '<name>' matched no files` when a pattern matches nothing in the project.
- **Dedup is per instruction.** Compile omits only the instructions already deployed to `.claude/rules/`. A nested or newly added instruction still reaches `AGENTS.md`, and when every instruction is deployed no `CLAUDE.md` is written. `--force-instructions` puts all of them in. When the compile also serves a target with no dedup (codex), `AGENTS.md` carries every instruction.
- **Unscoped rules move to `AGENTS.md`.** Install first deploys an unscoped rule to `.claude/rules/<n>.md` with no frontmatter. Once a compiled `AGENTS.md` carries it, the next install deletes that file and prints `Retired .claude/rules/<n>.md: AGENTS.md now carries it for Claude Code`. A `**/*.py` rule stays in `.claude/rules/`.
- **Unscoped rules move to `AGENTS.md` only when compile wrote them there.** Install deploys an unscoped rule to `.claude/rules/<n>.md` with no frontmatter, and a later compile dedups it, so it stays. It moves only when compile actually wrote it into `AGENTS.md`: compile before install, `--force-instructions`, or a no-dedup target in the same compile. The next install then deletes that file and prints `Retired .claude/rules/<n>.md: AGENTS.md now carries it for Claude Code`. A `**/*.py` rule stays in `.claude/rules/`.
- **Hand-authored collisions are skipped on Claude too.** A hand-written `.claude/rules/<n>.md` or `.github/instructions/<n>.instructions.md` is kept, with `files skipped -- local files exist, not managed by APM`, exit 0. `apm install --force` overwrites it. The 0.28.0 silent overwrite on Claude is gone.
- **Stale cleanup covers every rule target.** Renaming a source deletes the old file on antigravity, claude, copilot, cursor, grok-build, kiro and windsurf.
- **Per-target transforms.** Unchanged from 0.28.0 except: Cursor writes several patterns as one comma-separated `globs:` string, not a list; Antigravity writes `trigger: always_on` for an unscoped rule.
@@ -153,7 +153,7 @@ Note: `releasing.md`'s `--check-clean`/`--check-versions` scope, `apm pack` exit
- **instructions:** the Claude compile layout, per-instruction dedup, an unscoped rule's retirement from `.claude/rules/`, unquoted and broken frontmatter on install and compile, hand-authored collisions, stale cleanup, the per-target transforms for ten targets, and the empty-package compile;
- **prompts:** Claude-native key survival on claude versus cursor and opencode, the `--verbose` dropped-keys message, `hooks` withholding, malformed YAML, input names, collisions, hand-edited deployed files, the Kiro prompt surface and hidden-character scanning;
- **executables:** a bare-name grant parking a hook, a full-identity grant with a different `#version` deploying it, and the gate-disabled message.
- **Contributing files:** instructions-gotchas.md, prompt-gotchas.md
- **Contributing files:** instructions-gotchas.md, prompt-gotchas.md, approvals-and-executables.md
- **Status:** `extracted`
## context7-microsoft-apm-0-39-3