Skip to content

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

@vlsi

Description

@vlsi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/featureNew capability, new flag, new primitive.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions