Describe the bug
apm compile --target codex --single-agents creates AGENTS output, but it appends a Claude dry-run preview block to the end of the file.
Instead of producing only AGENTS content, the generated file ends with:
---
CLAUDE.md Preview: Would generate 1 files
CLAUDE.md
This reproduces on both:
- PyPI
apm-cli 0.8.11
- latest
main source at 522c24690ea2f42aea5a2d80441c742f0a67d607
To Reproduce
Steps to reproduce the behavior:
-
Create a minimal project with this layout:
codex-compile-repro/
├─ apm.yml
└─ packages/
├─ pkg-a/
│ ├─ apm.yml
│ └─ .apm/instructions/a.instructions.md
└─ pkg-b/
├─ apm.yml
└─ .apm/instructions/b.instructions.md
-
Use this root apm.yml:
name: codex-compile-repro
version: 1.0.0
dependencies:
apm:
- ./packages/pkg-a
- ./packages/pkg-b
mcp: []
scripts: {}
-
Put one simple instruction in each package:
---
applyTo: "**"
---
# Package A
- Rule from package A.
---
applyTo: "**"
---
# Package B
- Rule from package B.
-
Run:
apm install
apm compile --target codex --single-agents --output codex-single.md
-
Open codex-single.md
-
See that the file contains AGENTS content plus an appended Claude preview block
Expected behavior
apm compile --target codex --single-agents should write only AGENTS content
- Claude dry-run preview text should never be appended to the final AGENTS output
Environment (please complete the following information):
- OS: Windows
- Python Version: 3.14.3
- APM Version: 0.8.11
- VSCode Version (if relevant): N/A
Also reproduced against latest main source:
- commit:
522c24690ea2f42aea5a2d80441c742f0a67d607
Logs
Generated codex-single.md:
# AGENTS.md
<!-- Generated by APM CLI from .apm/ primitives -->
<!-- Build ID: 765b26c69877 -->
<!-- APM Version: 0.8.11 -->
## Files matching `**`
<!-- Source: packages/pkg-a/.apm/instructions/a.instructions.md -->
# Package A
- Rule from package A.
<!-- End source: packages/pkg-a/.apm/instructions/a.instructions.md -->
<!-- Source: packages/pkg-b/.apm/instructions/b.instructions.md -->
# Package B
- Rule from package B.
<!-- End source: packages/pkg-b/.apm/instructions/b.instructions.md -->
---
*This file was generated by APM CLI. Do not edit manually.*
*To regenerate: `specify apm compile`*
---
CLAUDE.md Preview: Would generate 1 files
CLAUDE.md
Additional context
This looks like the intermediate compile created inside the single-file CLI path is not preserving the original target.
Suspected flow:
- the CLI enters the single-file path
- it creates an intermediate dry-run
CompilationConfig(...)
- that intermediate config does not preserve
target=config.target
- so it falls back to the default target (
all)
_compile_claude_md() runs in dry-run mode and returns the literal preview string CLAUDE.md Preview: Would generate ...
- that preview text gets merged into the content that is later written as AGENTS output
This looks related to the Codex distributed compile routing issue, but the symptom and fix seem distinct enough that I split it out.
Describe the bug
apm compile --target codex --single-agentscreates AGENTS output, but it appends a Claude dry-run preview block to the end of the file.Instead of producing only AGENTS content, the generated file ends with:
This reproduces on both:
apm-cli 0.8.11mainsource at522c24690ea2f42aea5a2d80441c742f0a67d607To Reproduce
Steps to reproduce the behavior:
Create a minimal project with this layout:
Use this root
apm.yml:Put one simple instruction in each package:
Run:
Open
codex-single.mdSee that the file contains AGENTS content plus an appended Claude preview block
Expected behavior
apm compile --target codex --single-agentsshould write only AGENTS contentEnvironment (please complete the following information):
Also reproduced against latest
mainsource:522c24690ea2f42aea5a2d80441c742f0a67d607Logs
Generated
codex-single.md:Additional context
This looks like the intermediate compile created inside the single-file CLI path is not preserving the original target.
Suspected flow:
CompilationConfig(...)target=config.targetall)_compile_claude_md()runs in dry-run mode and returns the literal preview stringCLAUDE.md Preview: Would generate ...This looks related to the Codex distributed compile routing issue, but the symptom and fix seem distinct enough that I split it out.