Bug Description
apm compile silently omits instruction files that have no applyTo frontmatter field from the generated AGENTS.md output. The optimizer reports them as placed (rel: 100% at ./AGENTS.md), but the compiled file does not contain their content.
Environment
- APM version: 0.8.10 and 0.11.0 (pip installed)
- Python version: 3.13
- OS: Linux (NixOS)
Steps to Reproduce
# 1. Create a fresh test project
mkdir -p /tmp/apm-bug/.apm/instructions
cd /tmp/apm-bug
# 2. Write minimal apm.yml
cat > apm.yml << 'EOF'
name: test-bug
version: 1.0.0
type: hybrid
target: opencode
EOF
# 3. Create a global instruction (no applyTo)
cat > .apm/instructions/global.instructions.md << 'EOF'
---
description: Global instruction without applyTo
---
This should appear in AGENTS.md.
EOF
# 4. Create a scoped instruction (has applyTo)
cat > .apm/instructions/scoped.instructions.md << 'EOF'
---
description: Scoped instruction with applyTo
applyTo: "*.md"
---
This appears in AGENTS.md for *.md files.
EOF
# 5. Compile
apm compile -t all
Expected Behavior
AGENTS.md should contain both instructions:
- The global instruction (applied to all files)
- The scoped instruction (applied to
*.md files)
Actual Behavior
$ apm compile -t all
[*] Starting context compilation...
...
Optimizing placements...
Pattern Source Co… Placement Metrics
──────────────────────────────────────────────────────────────────────
(global) global.instr… 1/1 ./AGENTS.md rel: 100%
*.md scoped.instr… 0/1 ./AGENTS.md rel: 0%
Generated 1 AGENTS.md file
The optimizer says the global instruction is placed at ./AGENTS.md with rel: 100%, but the actual file only contains the scoped instruction:
$ cat AGENTS.md
# AGENTS.md
<!-- Generated by APM CLI from distributed .apm/ primitives -->
<!-- Source: local -->
## Files matching `*.md`
<!-- Source: local .apm/instructions/scoped.instructions.md -->
This appears in AGENTS.md for *.md files.
The global instruction's content is completely absent.
Additional Context
- Adding
applyTo: "**" to the global instruction makes it appear in the output — so the compiler can handle it, but only when an explicit pattern is present.
- This affects all targets (AGENTS.md and CLAUDE.md).
- Verified on both apm-cli 0.8.10 (nixpkgs) and 0.11.0 (pip).
- No existing issues found for this specific behavior after searching the issue tracker.
Suspected Location
Likely in the compile/optimizer logic where instructions without an applyTo pattern are classified as (global) but then dropped during file generation. The optimizer's placement matrix includes them but the actual file writer appears to skip them.
Bug Description
apm compilesilently omits instruction files that have noapplyTofrontmatter field from the generatedAGENTS.mdoutput. The optimizer reports them as placed (rel: 100%at./AGENTS.md), but the compiled file does not contain their content.Environment
Steps to Reproduce
Expected Behavior
AGENTS.mdshould contain both instructions:*.mdfiles)Actual Behavior
The optimizer says the global instruction is placed at
./AGENTS.mdwithrel: 100%, but the actual file only contains the scoped instruction:The global instruction's content is completely absent.
Additional Context
applyTo: "**"to the global instruction makes it appear in the output — so the compiler can handle it, but only when an explicit pattern is present.Suspected Location
Likely in the compile/optimizer logic where instructions without an
applyTopattern are classified as(global)but then dropped during file generation. The optimizer's placement matrix includes them but the actual file writer appears to skip them.