- 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
10 KiB
topic, source_keys
| topic | source_keys | |||||||
|---|---|---|---|---|---|---|---|---|
| instructions-gotchas |
|
Surprising behaviours and source contradictions for the instructions primitive. The section "Re-run on 0.39.3" at the end records what changed when the experiments were repeated on the repo-pinned apm 0.39.3; where it disagrees with an earlier section, it wins. "Verified" means observed with the installed apm 0.28.0 in a throwaway directory outside the repo. Everything else is stated as sourced or inferred.
Verified failure modes
Unquoted glob silently widens scope
applyTo: **/*.py (unquoted) is a YAML alias error. Verified outcome:
apm compileandapm compile --validateprint "Failed to parse" and skip the file, exit 0; the validated-primitive count is one lower.apm installstill deploys the file, to.claude/rules/<name>.mdwith nopaths:frontmatter. A rule meant for Python files becomes an unconditional rule loaded in every session. Nothing errors.- Any frontmatter that is broken YAML (for example
description: [broken) behaves the same way. - Claude Code itself behaves consistently: invalid frontmatter is ignored and the rule loads without
paths.
Rule for the skill: always quote applyTo, and after scaffolding check that the deployed file has the expected paths:; a missing frontmatter block is the symptom.
Validation never fails
Missing description, missing applyTo and an empty body are warnings only. apm compile --validate prints "All primitives validated successfully" and exits 0 even for those, and shows none of the warnings. Only a real apm compile prints them. apm install and apm audit --ci print nothing about instruction content. The official docs call description and applyTo required; the binary does not enforce either. Any enforcement has to live in this repo's own checks.
Nested files: compile sees them, install does not
.apm/instructions/sub/x.instructions.md is folded into compiled root files but never deployed natively. A plain x.md (no .instructions infix) is ignored by both.
Compile writes nothing when native rules exist (Claude, Copilot, Antigravity)
apm compile --target claude after an install exits 0, prints "produced no output files" and creates no CLAUDE.md. Use --force-instructions or compile in a project with no native rules. A test that only checks the exit code passes without testing anything.
Compile duplicates content for the other targets
For cursor, windsurf, kiro, codex (and grok, opencode by source) compile still writes AGENTS.md even though native rules exist, so the same instruction reaches the agent twice.
Install overwrites hand-authored rule files
For claude, cursor, windsurf, kiro and antigravity, an existing file at the deployed path is replaced without warning. Copilot skips it and asks for --force.
Empty-source compile
In a package with no instruction primitives, plain apm compile --target claude prints "No instruction files found in .apm/ directory" and exits 1; apm compile --clean exits 0. This matches the apm-workflow compile reference. Exit 0 with no output is a different case: instructions exist but are already deployed natively (above).
Cursor-specific
- Install emits
globsplusdescriptionand neveralwaysApply. Per the Cursor docs a rule with only adescriptionis "Apply Intelligently", so an unscoped apm instruction does not become always-on in Cursor (inferred from docs plus verified output; Cursor runtime not tested). - Multiple globs are emitted as a YAML list (Kiro likewise). The Cursor docs show only a comma-separated string. Unverified whether Cursor honours the list form.
Claude-specific
descriptionis dropped, so it can never appear in a.claude/rules/file; do not rely on it for Claude Code. Source: the apm source transform and verified deployed output. The apm docs do not state this.- A rule with no
applyTobecomes a file with no frontmatter and loads at every launch, which costs context. Claude Code guidance is to keep each file short (under 200 lines). - The documented Claude
pathsbudget is 1,000 brace-expanded patterns and 4 MiB.
Contradictions between sources
| Point | Official apm docs | Installed 0.28.0 behaviour |
|---|---|---|
description |
Required | Warning only |
applyTo |
Listed as required and also as optional | Optional, warning only |
Instruction with no applyTo |
Folded into compiled root files instead of a per-file rule | Still deployed per-file on every rule-directory target (Claude: no frontmatter; Cursor: description only; Windsurf: always_on; Kiro: always) and also compiled |
| Grok deployed name | .grok/rules/<name>.md |
.grok/rules/<name>.instructions.md |
| Compile scope | Docs say compile "only handles instructions" | Consistent for content, but compile also emits GEMINI.md and honours the agents_md mode |
| Cursor and Windsurf at user scope | Two fetches of the docs disagreed | Source excludes both at user scope; the source was preferred |
An earlier version of this topic's schema file described missing description and empty content as errors and skip_instructions as a config flag; both were wrong for 0.28.0 (warnings; internal variable).
Unverified
- Whether Cursor accepts a YAML list for
globs. - Whether Copilot ignores unknown frontmatter keys such as
description; its docs list onlyapplyToandexcludeAgent. - Runtime behaviour of Windsurf, Kiro and Antigravity on the emitted frontmatter; no downstream docs were fetched.
- Windsurf user-scope global rules.
- The Context7 step was unavailable (invalid API key), so the registry carries no fresh Context7 pull. Doc pages were summarised by a smaller model before reaching this file and can be lossy.
- Apm versions other than 0.28.0 were not tested. 0.38.0 and 0.39.0 changed the Claude layout, moving
**- and directory-scoped rules intoAGENTS.mdonce compiled. The.claude/rules/items above may therefore not hold on 0.39.x. Seeinstructions-target-mapping.md, "Claude layout in 0.38 and later", andmigration-0-28-to-0-39.md.
What belongs in an instruction body
From the Claude Code memory docs (claude-code-memory-docs): instructions reach Claude as context, not enforced configuration, so adherence rises with specificity and falls with length and contradiction.
- Write rules concrete enough to verify: "Use 2-space indentation", "Run
npm testbefore committing", "API handlers live insrc/api/handlers/", not "Format code properly" or "Keep files organized". - Keep to facts Claude should hold every session: build commands, conventions, layout, "always do X" rules. The
/doctortrim check cuts what Claude can derive from the codebase (directory layouts, dependency lists, architecture overviews) and keeps pitfalls, rationale and conventions that differ from tool defaults. - A multi-step procedure, or guidance that matters for one task, belongs in a skill. Guidance that matters for one part of the codebase belongs in a path-scoped rule.
- Something that must happen at a fixed point (before every commit) or must be blocked is a hook or a
permissions.denyentry, never an instruction: "Settings rules are enforced by the client regardless of what Claude decides to do. CLAUDE.md instructions shape Claude's behavior but are not a hard enforcement layer." - Two instructions that contradict each other make Claude pick one arbitrarily, across user and project files and across rules.
- Under 200 lines per file; one topic per file.
Re-run on 0.39.3 (holocron#273)
Observed with the repo-pinned apm 0.39.3 in throwaway packages outside the repo.
- Unquoted or broken frontmatter fails install.
applyTo: **/*.pyunquoted, ordescription: [broken, makesapm installexit 1 withRejected frontmatter in <file>and deploy nothing. No transaction change is committed. Compile still printsFailed to parse, skips the file and exits 0;--validatecounts it out. The silent widening above no longer happens on install. - Claude compile layout.
apm compile --target claudewritesAGENTS.mdwith the instruction bodies and aCLAUDE.mdthat holds only@AGENTS.mdunder the generated header. Compile also warnsapplyTo for '<name>' matched no fileswhen 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 reachesAGENTS.md, and when every instruction is deployed noCLAUDE.mdis written.--force-instructionsputs all of them in. When the compile also serves a target with no dedup (codex),AGENTS.mdcarries every instruction. - Unscoped rules move to
AGENTS.mdonly when compile wrote them there. Install deploys an unscoped rule to.claude/rules/<n>.mdwith no frontmatter, and a later compile dedups it, so it stays. It moves only when compile actually wrote it intoAGENTS.md: compile before install,--force-instructions, or a no-dedup target in the same compile. The next install then deletes that file and printsRetired .claude/rules/<n>.md: AGENTS.md now carries it for Claude Code. A**/*.pyrule stays in.claude/rules/. - Hand-authored collisions are skipped on Claude too. A hand-written
.claude/rules/<n>.mdor.github/instructions/<n>.instructions.mdis kept, withfiles skipped -- local files exist, not managed by APM, exit 0.apm install --forceoverwrites 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 writestrigger: always_onfor an unscoped rule. - Empty package. With no
.apm/content, plain compile exits 1 withNo APM content found to compile. With skills but no instructions it is stillNo instruction files found in .apm/ directory, exit 1.--cleanexits 0 in both. - Unchanged:
--validatehides the warnings a real compile prints; a nested file is compiled but never deployed;descriptionis dropped on Claude.