Repository navigation
Description
Is your feature request related to a problem? Please describe.
#1341 asked to make the cosmetic compile comments opt-in in generated CLAUDE.md and AGENTS.md. The implementing PR #1584 flipped compilation.source_attribution to default false and gated those comments in claude_formatter.py (plus copilot-instructions.md), but the distributed AGENTS.md path was never covered.
On v0.28.0 the APM Version comment and the trailing footer are still emitted unconditionally there, so projects compiling for AGENTS.md-reading targets (codex, opencode, gemini, ...) keep paying that token cost in every session with no way to opt out.
Reproduced on apm 0.28.0 (e041462):
# apm.yml
name: bannertest
version: 1.0.0
targets:
- codex
compilation:
source_attribution: false # also the default since #1584$ apm compile --target codex
$ cat AGENTS.md
# AGENTS.md
<!-- Generated by APM CLI from distributed .apm/ primitives -->
<!-- Build ID: f4429da3a4a0 -->
<!-- APM Version: 0.28.0 -->
## Files matching `**`
Demo rule body.
---
*This file was generated by APM CLI. Do not edit manually.*
*To regenerate: `apm compile`*The same project compiled with --target claude honours the default correctly and emits only the load-bearing lines:
$ apm compile --target claude
$ cat CLAUDE.md
# CLAUDE.md
<!-- Generated by APM CLI -->
<!-- Build ID: 9c31e7202c55 -->
## Project Standards
...Describe the solution you'd like
Gate the two cosmetic blocks in DistributedAgentsCompiler._generate_agents_content on source_attribution, exactly as the Claude path already does:
src/apm_cli/compilation/distributed_compiler.py:655--<!-- APM Version: ... -->src/apm_cli/compilation/distributed_compiler.py:680-682-- the---/*This file was generated by APM CLI. Do not edit manually.*/*To regenerate: apm compile*footer
Reference implementation: src/apm_cli/compilation/claude_formatter.py:299-300 and :338-343.
The flag value already reaches this code path, so the change looks self-contained: agents_compiler.py:571 passes source_attribution into distributed_config, and distributed_compiler.py:180 reads it into placement.source_attribution, where it currently only drives the <!-- Sources: --> line and the per-instruction source comments.
Load-bearing lines that should stay unconditional
Mirroring the Claude path, these two should keep being emitted regardless of the flag:
AGENTS_MD_GENERATED_MARKER(distributed_compiler.py:653) --_find_orphaned_agents_filesonly ever deletes files bearing it (_file_has_apm_marker,distributed_compiler.py:783-796), so dropping it would makeapm compile --cleansilently stop cleaning orphanedAGENTS.md.BUILD_ID_PLACEHOLDER(distributed_compiler.py:654) -- normalized away by drift detection (utils/normalization.py:22).
Describe alternatives you've considered
- Setting
compilation.source_attribution: falseinapm.yml-- verified to have no effect on this path (it is already the default). - No CLI flag,
apm configkey, or environment variable covers it;apm compile --helpon 0.28.0 exposes nothing equivalent. - Post-processing
AGENTS.mdafter compile -- clobbered by the nextapm compile(verified), and stripping the header marker breaks--cleanas described above.
Additional context
apm 0.28.0 (e041462), macOS arm64. All line numbers above are against tag v0.28.0.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Aug 20, 2026
Triage Verdict -- #2634: [FEATURE] Extend opt-in source attribution to AGENTS.md
Panel Summary
DevX UX Expert: This is a correctness bug masquerading as a feature request:
source_attribution: falseis explicitly documented as the way to suppress cosmetic token-consuming comments, it works on every target except AGENTS.md targets (codex,opencode,gemini), and the user has no workaround. Developers targeting agent runtimes with tight context windows are being penalized unconditionally. The asymmetry between Claude output and AGENTS.md output for the sameapm.ymlflag value is a user trust violation -- the config saysfalseand the behavior istrue.Supply Chain Security Expert: No security surface. The
AGENTS_MD_GENERATED_MARKERandBUILD_ID_PLACEHOLDERmust remain unconditional (the issue author correctly identifies this) because orphan detection and drift detection are coupled to their presence. Gating only the cosmetic version comment and the human-readable footer is safe.Python Architect: The fix is precisely scoped: in
DistributedAgentsCompiler._generate_agents_content, wrap the<!-- APM Version: ... -->line and the---/*This file was generated...*/*To regenerate...*footer block inif placement.source_attribution:guards. Thesource_attributionvalue is already plumbed through toplacement.source_attribution-- this is purely a missing guard, no plumbing change needed. Reference implementation:claude_formatter.py:299-300and:338-343.Doc Writer: The
compilation.source_attributiondocs should note that suppression applies to all compile targets including AGENTS.md targets once fixed; a one-line addendum to the compilation reference page suffices.APM CEO (Arbiter): ACCEPT. This is a confirmed bug -- a parity gap introduced when #1584 implemented #1341 for the Claude path but left the distributed AGENTS.md path uncovered. The reporter has done the full root-cause analysis, identified the exact lines to change, confirmed which lines must remain unconditional, and verified on v0.28.0. The fix is a ~5-line guarded block. The flag already exists, the user explicitly set it, and it is silently ignored on a documented code path. This should land as a bug fix in the next patch.
Decision
Verdict: ACCEPT
Type:
type/bugArea(s):
area/cli,area/distributionTheme(s): none
Priority:
priority/highMilestone: none at this time
Next action: Wrap the
<!-- APM Version: ... -->comment and the trailing---/ generated-by footer in_generate_agents_contentinsideif placement.source_attribution:guards, mirroringclaude_formatter.py:299-300and:338-343, and add a test asserting thatsource_attribution: falsesuppresses both blocks across all non-Claude compile targets.fix(compile): honour source_attribution on the AGENTS.md path (micros…