Skip to content

[FEATURE] Reduce token overhead in generated CLAUDE.md/AGENTS.md by disabling debug-only comments by default #1341

Closed

Description

Is your feature request related to a problem? Please describe.

apm compile injects several hardcoded comments into every generated CLAUDE.md / AGENTS.md:

# CLAUDE.md
<!-- Generated by APM CLI -->
<!-- Build ID: __BUILD_ID__ -->
<!-- APM Version: 0.8.10 -->
...
<!-- Source: dependency:Owner/pkg/ai-packages/foo apm_modules/.../skill-xxx.instructions.md -->

These files are loaded into the agent's context on every session, so each comment costs tokens for the entire conversation. Source attribution and build metadata are useful for humans debugging a compile, but the
agent itself does not benefit from knowing which dependency a given instruction came from.

In a project with many dependencies, the <!-- Source: ... --> lines alone can add up to a non-trivial share of the loaded context.

Describe the solution you'd like

  1. Default compilation.source_attribution to false instead of true. The current default optimizes for debugging at the cost of every runtime session.
  2. Make the other hardcoded comments in _generate_claude_content (claude_formatter.py:256-267) — Generated by APM CLI, APM Version, and the trailing *This file was generated by APM CLI...* footer —
    opt-in as well, behind the same flag or a related one.
  3. Surface attribution via apm compile --debug (or --verbose / --trace, which already exists), so people who need it can still get it on demand.

Describe alternatives you've considered

  • Setting compilation.source_attribution: false in apm.yml — works for the Source: comments, but doesn't remove the other hardcoded headers/footer, and requires every consumer to opt out manually.
  • Post-processing CLAUDE.md after apm compile — fragile and gets clobbered on every rebuild.
  • A separate --minimal / --no-comments flag — viable, but reusing the existing --verbose / --debug axis seems cleaner.

Additional context

Relevant code: src/apm_cli/compilation/claude_formatter.py:256-267 (header block) and :307 (source attribution line). The source_attribution flag already exists in CompilationConfig
(agents_compiler.py:56) and apm.yml schema — the proposal is to flip the default and extend coverage to the other comments.

Activity

  1. added
    type/feature
    on May 15, 2026
  2. added
    status/needs-triage
    on May 16, 2026
  3. github-actions commented on May 30, 2026

    @github-actions

    Triage decision

    accept

    Proposed labels

    theme/portability
    area/cli
    type/feature
    status/accepted
    priority/low
    

    Milestone

    0.14.0

    Suggested next action

    Flip compilation.source_attribution default to false in CompilationConfig and extend the flag to cover the hardcoded header/footer block in claude_formatter.py, surfacing attribution via --verbose/--debug.

    Suggested issue comment

    Thanks for the detailed investigation, `@vlsi` -- pinpointing the exact lines in `claude_formatter.py` and `agents_compiler.py` is exactly the kind of grounded report that makes this easy to act on.
    
    The panel accepts this. Token overhead on every agent session is a real cost, and defaulting to attribution-off is the right ergonomic choice for production use. The key changes:
    
    1. Flip `compilation.source_attribution` default to `false` in `CompilationConfig` (`agents_compiler.py:56`).
    2. Gate the hardcoded header/footer block at `claude_formatter.py:256-267` behind the same flag (or a closely related one).
    3. Surface attribution via `apm compile --verbose` / `--debug`, consistent with the existing verbosity axis.
    
    A CHANGELOG note and a short update to the compilation config docs will round out the PR. If you would like to open a PR, the path is clear from your analysis.

    Per-lens notes (collapsed)

    DevX UX Expert -- User-Need Reviewer

    Token overhead in compiled context files is a real, measurable cost for every agent session with many dependencies. The request correctly identifies that source attribution serves debugging (one-off use), not runtime (every session). The proposal to make debug output opt-in via existing --verbose/--debug flags is consistent with the APM CLI mental model. The source_attribution flag already exists -- this is a default-flip plus scope extension, not a new mechanism.

    Supply Chain Security Expert -- Risk-Surface Reviewer

    No risk-surface implication. This is a compilation output formatting change with no effect on lockfile integrity, marketplace trust, MCP config, or auth. The source_attribution field affects human-readable comments only, not the security-relevant parts of compiled output.

    OSS Growth Hacker -- Contributor-Tone Reviewer

    Author has NONE association -- first-time contributor with a well-researched report including specific file and line references. The reply acknowledges the investigation depth and gives a concrete next step (PR path is clear from the analysis). Tone is collegial and action-oriented.

    Python Architect -- Architecture Reviewer

    Not activated -- the change is contained to claude_formatter.py and agents_compiler.py with an existing config flag; no cross-module design decision is needed. One note: flipping the default is a behavior change that could surprise users who rely on the comments for debugging -- a CHANGELOG entry and a migration note in the docs are warranted but do not require a design phase.

    Doc Writer -- Documentation Reviewer

    Yes, docs work is implied. The compilation.source_attribution reference in the apm.yml schema docs and the compilation guide will need a short update to document the new default and the --verbose escape hatch. area/docs-site is not added as a secondary label since the doc change is minor and will naturally accompany the PR.

    APM CEO -- Triage Arbiter

    Accept at priority/low. The token savings are real but not urgent -- this is a quality-of-life improvement that does not block any use case. Milestone 0.14.0 keeps it in the active queue without elevating it above bug fixes. The implementation is straightforward and the contributor has done the discovery work.

    {
      "decision": "accept",
      "decision_detail": "",
      "theme": "theme/portability",
      "areas": ["area/cli"],
      "type": "type/feature",
      "status": "status/accepted",
      "priority": "priority/low",
      "preserved_labels": [],
      "milestone": "0.14.0",
      "next_action": "Flip compilation.source_attribution default to false and extend the flag to cover the hardcoded header/footer block in claude_formatter.py.",
      "comment_markdown": "Thanks for the detailed investigation, `@vlsi`. The panel accepts this at priority/low."
    }

    Triage status: agentic proposal pending human ratification.
    Silence is approval. Maintainers can:

    • Override any label or milestone above by editing it directly --
      human edits are authoritative and will not be reverted on
      subsequent runs.
    • Re-trigger triage by applying the status/needs-triage label, or
      by removing status/triaged to enroll the issue in the next
      daily sweep.

    Posted by the Triage Panel workflow. See .apm/skills/apm-triage-panel for the panel skill.

    Generated by Triage Panel · sonnet46 7.9M · ◷

  4. added
    area/cli
    priority/low
    status/accepted
    status/triaged
    and removed
    status/needs-triage
    on May 30, 2026
  5. added this to the 0.14.0 milestone on May 30, 2026
  6. added
    status/shepherding
    on Jun 2, 2026
  7. moved this from Todo to In Progress in APM Roadmapon Jun 2, 2026
  8. removed
    status/shepherding
    on Jun 2, 2026
  9. moved this from In Progress to Done in APM Roadmapon Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/clipriority/lowstatus/acceptedstatus/triagedtype/feature

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions