Skip to content

[0.38] feat(claude): converge Claude instructions on AGENTS.md - #4005

Merged
Daniel Meppiel (danielmeppiel) merged 33 commits into
mainfrom
danielmeppiel-bookish-funicular
Nov 22, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 33 commits into
mainfrom
danielmeppiel-bookish-funicular

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

feat(claude): converge Claude instructions on AGENTS.md

TL;DR. The Claude target now gets always-on (applyTo: "**" or none) and single-directory (src/test/**) instructions through the same root and nested AGENTS.md that Copilot and Codex get; file-type globs stay in .claude/rules/ with paths:. Every CLAUDE.md APM writes imports @AGENTS.md, so both load on every Claude Code version. Existing users are never broken: a hand-authored CLAUDE.md without the import keeps the old .claude/rules/ layout and gets a one-line fix hint, and APM never overwrites user files.

Issue and approved scope

Issue: Fixes #3939

Human scope-approval comment: #3939 (comment) (apm-scope:v1, review contact Daniel Meppiel (@danielmeppiel); scripts/governance/eligibility.cjs → record-present).

Completes the issue: lifecycle tests for root + nested AGENTS.md and the @AGENTS.md import, unchanged file-type rules, upgrade note, compile/target docs, apm-usage skill, one CHANGELOG line. Out of scope (per record) and untouched: new primitives/frontmatter, other targets' output, CLAUDE.local.md.

Problem (WHY)

  • Claude Code reads AGENTS.md natively since v2.1.277, but the official memory docs say "By default, Claude reads AGENTS.md only when you have no CLAUDE.md in your working directory or above it", and recommend "putting an @AGENTS.md import in a CLAUDE.md next to it" otherwise.
  • APM's Claude target wrote every instruction to .claude/rules/, so always-on and directory guidance behaved differently on Claude than on every other harness (Let authors target native context files (root or nested CLAUDE.md/AGENTS.md), not just .claude/rules #1807).
  • The same doc says nested files need care: a subdirectory's AGENTS.md loads natively only while no root CLAUDE.md counts, so once APM writes a root CLAUDE.md, nested AGENTS.md needs its own importing CLAUDE.md.
  • Older Claude Code (< 2.1.277) and sessions with the built-in plugin disabled read CLAUDE.md only — the import is the only path that works everywhere.

Approach (WHAT)

Instruction applyTo Before (Claude) After (Claude, project scope)
none / ** / **/* .claude/rules/<n>.md (unconditional) root AGENTS.md
one literal dir, e.g. src/test/**, docs/**/* .claude/rules/<n>.md (paths:) exactly <dir>/AGENTS.md — pinned, never hoisted (stays in .claude/rules/ if the dir is missing or the project is single-file)
file-type / wildcard dir / lists, e.g. **/*.py, src/**/*.py .claude/rules/<n>.md (paths:) unchanged
root CLAUDE.md constitution + deps + "Project Standards" @AGENTS.md + dependency @imports (constitution only as fallback)
nested CLAUDE.md instructions @AGENTS.md next to each generated nested AGENTS.md

Safety rails (the migration contract):

  • Blocker: a hand-authored root CLAUDE.md that does not import @AGENTS.md, or a hand-authored root AGENTS.md APM may not write into (no managed_section), keeps every instruction in .claude/rules/ (old behavior) and warns once with the fix (add '@AGENTS.md' to CLAUDE.md).
  • A hand-authored CLAUDE.md that already imports @AGENTS.md is left alone silently. APM never overwrites hand-authored files (existing protection owner unchanged).
  • User scope (-g, ~/.claude) is unchanged — Claude does not read ~/AGENTS.md.
  • No scope widening: a Claude-only compile pins each routed directory instruction to exactly <dir>/AGENTS.md, even where the shared optimizer would hoist it to the root; --single-agents leaves directory instructions out of the root file with a warning.
  • No silent gap after install: when install routes an instruction (local .apm/ ones included) that no compiled AGENTS.md carries yet, it prints Run 'apm compile' to update AGENTS.md / CLAUDE.md.; a no-op reinstall after compile stays quiet, and an edited routed instruction asks again.
  • apm pack --format apm keeps shipping them: APM-format bundles carry deployed files and their consumers do not compile, so the pack renders each routed Claude instruction as .claude/rules/<n>.md through the install projection (InstructionIntegrator.render_agents_md_routed_rules) and records it in the bundle lockfile via DeploymentLedgerCodec; bytes equal a legacy-layout install's (tests/integration/test_claude_agents_md_pack_lifecycle.py, fails on 4b2eeed2). Bundle consumers converging on AGENTS.md is Bundle installs keep the legacy .claude/rules layout instead of converging on AGENTS.md #4034.
  • …and so does the default plugin-format pack, gated on the producer's install targets: the plugin pack maps the same rendered rules to instructions/<n>.md (bytes equal the legacy layout's; before this, a dependency whose only content was a routed instruction made apm pack refuse with a stale-install error). Claude is active only when the producer's install resolves it (targets: in apm.yml, else harness detection), never from the folder-detected pack target, so a targets: [copilot] producer with a stray .claude/ ships no Claude rules. A recorded Claude deployment in the lockfile wins (covers install --target claude on a .claude/ + .cursor/ project without targets:); with no record and ambiguous folders, pack prints [!] Skipped N Claude rule(s)... with the fix instead of dropping them silently (test_claude_agents_md_pack_lifecycle.py; both new cases fail on 3221f0e8).
  • Claude-only compile drops instructions already delivered by a deployed .claude/rules/<n>.md from AGENTS.md (no double context; an edited rule that install kept stays authoritative). Multi-target compiles keep the shared AGENTS.md complete, as before.

Implementation (HOW)

File Change
compilation/claude_agents_md.py (new) Single owner: routes_to_agents_md(applyTo, project_root) (classifier + directory exists / not single-file), directory_scope, pin_directory_placements, without_directory_instructions, claude_agents_md_blocker (hand-authored root files, with the matching fix text), @AGENTS.md import detection, Claude-only rule dedup.
integration/instruction_integrator.py _claude_rule_sources filters .claude/rules/ sources at project scope and records routed sources (agents_md_routed); routing and blocker read the live project root (drift replay passes a scratch root via deployment_frame).
compilation/agents_compiler.py Claude is an AGENTS.md consumer; records written AGENTS.md paths; _compile_claude_md now emits @AGENTS.md shims, keeps the protection/--clean paths, warns when a protected CLAUDE.md lacks the import. Net −50 lines (file stays under the 2100 guard).
compilation/claude_formatter.py format_agents_md_imports replaces the instruction-carrying format_distributed.
core/target_detection.py, install/phases/finalize.py, commands/compile/cli.py should_compile_agents_md("claude"); post-install compile hint fires for Claude dependency instructions and whenever install routed any instruction (local included); --force-instructions help text.
.apm/architecture/owners/install-deployment.json, scripts/architecture_linter/checks/install_claude_agents_md_routing.py New owner record + static guard (install-deployment-claude-agents-md-routing): owner functions defined once; install filter must be exactly routes_to_agents_md(applyTo, live_root) (catches ... or True); compile must call the pin / single-file / shim helpers. Two mutation cases.

Diagrams

Where one instruction lands for a Claude project after apm install && apm compile:

flowchart LR
    I["instruction applyTo"] --> R{"routes_to_agents_md"}
    R -->|"file-type glob"| RULES[".claude/rules/name.md (paths:)"]
    R -->|"** or one literal dir"| B{"claude_agents_md_blocker"}
    B -->|"hand-authored CLAUDE.md without import"| RULES
    B -->|"clear"| A["root or nested AGENTS.md"]
    A --> C["CLAUDE.md beside it: @AGENTS.md"]
Loading

Decision for Daniel: multi-target placement trade-off

  • What happens: in [claude, copilot] / [claude, codex] projects the shared AGENTS.md keeps the optimizer's placement, so a directory (or file-type) instruction can be hoisted into the root AGENTS.md that the root CLAUDE.md imports and load in every Claude session; with compilation.strategy: single-file a directory instruction is also kept in .claude/rules/, so it appears twice.
  • Why it is out of scope here: fixing it changes the other targets' AGENTS.md output, which the approved record excludes; this PR pins only Claude-only compiles and documents the multi-target behavior (compile docs, targets matrix, migration note).
  • Options: (1) accept as documented; (2) pin Claude-routed directory instructions to <dir>/AGENTS.md even in multi-target compiles, changing Copilot/Codex placement; (3) keep directory (and file-type) rules in .claude/rules/ and out of the imported scope when the project is multi-target.

Trade-offs

  • Directory pinning is Claude-only. In multi-target compiles the shared AGENTS.md keeps the optimizer's placement (other targets' output unchanged), so Claude reads it exactly as Codex does.
  • Single literal directory only. Lists and wildcard directories (src/**/*.py) stay path-scoped rules so their scope is never widened to a whole folder.
  • Install/compile split. Like Codex, always-on instructions now need apm compile; the post-install hint and the upgrade note cover it. Rejected: auto-compiling during install (compile stays explicit).
  • Root CLAUDE.md is written whenever AGENTS.md is, even on 2.1.277+ where it is redundant — required for older versions and for nested files (see Problem).
  • Multi-target (claude + others) keeps the shared AGENTS.md complete, so file-type instructions also appear always-on for Claude there; avoiding that would change other targets' output (out of scope).
  • Local bundles deploy pre-rendered files outside the integrator and keep the legacy .claude/rules/ layout (no loss; follow-up candidate).

Benefits

  1. Same package, same AGENTS.md on Claude, Copilot, Codex: one artifact to review and commit.
  2. Always-on guidance loads at session start on Claude instead of only when a matching file is touched (Let authors target native context files (root or nested CLAUDE.md/AGENTS.md), not just .claude/rules #1807 cases A and B).
  3. Zero overwrite of user files; projects with a hand-authored CLAUDE.md see no behavior change until they add one import line.
  4. Routing decided once and guarded by a static architecture rule plus a mutation test.

Validation

Lint chain (CI mirror)
uv run --extra dev ruff check src/ tests/ scripts/...      -> All checks passed!
uv run --extra dev ruff format --check ...                  -> 2464 files already formatted
pylint R0801 ...                                            -> rated 10.00/10
bash scripts/lint-auth-signals.sh                           -> [+] auth-signal lint clean
bash scripts/lint-architecture-boundaries.sh                -> clean
Tests
uv run --extra dev pytest tests/unit/compilation tests/unit/integration tests/unit/core \
  tests/unit/install tests/unit/commands tests/test_distributed_compilation.py -n auto
-> all Claude/compile/integration tests pass; remaining failures are environmental and fail identically on
   origin/main (test_unix_install_ownership, auth/gpg-signing, cache_pin)
uv run --extra dev pytest tests/unit/compilation/test_claude_agents_md.py      -> 32 passed
uv run --extra dev pytest tests/integration/test_architecture_owner_rule_mutations.py -k claude_agents_md -> 3 passed
APM_E2E_TESTS=1 pytest -m 'lifecycle_smoke and not lifecycle_merge_group' tests/integration -n 8
-> all Claude-related lifecycle tests pass after the updates below; the 20 remaining local failures
   (marketplace refresh, unix installer shells, hook external cwd) fail identically on origin/main
pytest tests/integration tests/spec_conformance (Claude-related files) -n 8
-> branch-only failures all triaged below; no remaining branch-only failure
pytest tests/integration/test_drift_check.py -> 41 passed (incl. new d4 routing replay)

Note

Pre-existing flake (not this PR): Build & Test Shard 1 job 136029540890 failed tests/unit/scripts/test_architecture_skill_layout_guard.py::test_audit_targets_must_recover_the_recorded_layout with cannot inventory repository: ... apm_modules/_local/autopilot-pr-triage-scheduler/... No such file — a repo-root apm_modules file vanishing mid-run. It passes locally and on rerun; none of this PR's new or changed tests touch the repository root (all use tmp_path), and the production changes only read apm.yml / CLAUDE.md / AGENTS.md.

Updated tests (intended behavior change)

Each test below asserted the pre-#3939 layout for an applyTo: "**" / directory instruction on Claude. None was weakened: either the fixture became path-scoped so the original .claude/rules/ assertion still runs, or the assertion now checks the new AGENTS.md / @AGENTS.md paths.

Per-test decision
Test Decision
test_project_self_audit_lifecycle, test_required_lifecycle_state_machine (lock-provenance, mixed-primitives), test_lock_e2e contraction, test_local_install (#714 root primitives, four-hyphen, multi-target preflight), test_config_surface_lifecycle_contract (saved / unset target), test_case_only_rename_lifecycle, test_unicode_space_paths_lifecycle, test_unquoted_lockfile_version_lifecycle, test_local_single_file_matrix (Claude), test_drift_check b7/d1/d2 Fixture instruction made path-scoped (**/*.md, src/**/*.py, …) so the test keeps observing a .claude/rules/ deployment; assertions unchanged.
test_user_authored_name_collision_lifecycle --force collision now seeded on the path-scoped py.md (the global instruction no longer targets .claude/rules/global.md); user files still byte-checked at every step.
test_compile_nested_context_protection_lifecycle docs/AGENTS.md still protected; no docs/CLAUDE.md write is attempted while it is hand-authored; after hand-back, docs/CLAUDE.md is protected and the compile warns to add @AGENTS.md; new src/CLAUDE.md import check.
test_claude_dependency_import_lifecycle Asserts the root CLAUDE.md imports @AGENTS.md; dependency-import resolution checks unchanged for the remaining imports.
test_global_claude_dedup_lifecycle::test_project_and_global_native_rules_do_not_cross_scope Project content asserted in AGENTS.md (imported by CLAUDE.md); user scope keeps native rules; cross-scope byte checks unchanged.
test_prune_deployment_ledger_e2e Fixture rules path-scoped so each package keeps a .claude/rules/ ledger row; prune/ledger assertions unchanged.
test_compile_claude_single_h1, test_compile_clean_nested_worktree Instruction/constitution content asserted in AGENTS.md; CLAUDE.md asserted to import @AGENTS.md (single H1 kept).
test_target_manifest_upgrade_lifecycle Models #3939's one-time move exactly like #3866's MCP move: rows/files of routed .claude/rules/ files (computed with routes_to_agents_md) leave on first install; nothing changes after.
New: test_drift_check::test_d4_claude_agents_md_routing_replays_clean[False/True] Drift replay honors routing with and without a hand-authored CLAUDE.md (fails if the blocker reads the scratch root).

Note

Pre-existing gap surfaced (not changed here): local .apm/ content that deploys no file (hooks-only, and now Claude projects whose own instructions are all always-on) writes no apm.lock.yaml, so apm audit --ci skips drift replay for merged root hooks. test_drift_check::b7 keeps its intent with a path-scoped rule; the gap is flagged for a follow-up.

Scenario evidence

Scenario Test Principle
Root + nested AGENTS.md, @AGENTS.md imports, file-type rule not duplicated tests/unit/compilation/test_claude_agents_md.py::TestCompileShims::test_root_and_nested_agents_md_with_claude_imports portability
Install keeps only file-type rules; user scope keeps all test_claude_agents_md.py::TestInstallRouting portability
Hand-authored CLAUDE.md blocks routing, warns once, never overwritten TestInstallRouting::test_blocked_project_keeps_every_rule_and_warns_once, TestCompileShims::test_hand_authored_claude_md_without_import_warns safety
Drift replay reads the live project's blocker TestInstallRouting::test_replay_reads_blocker_from_live_project, tests/integration/test_drift_check.py::test_d4_* reproducibility
Directory rule never hoisted; single-file keeps it out of root; missing dir / single-file project keep the rule TestCompileShims::test_widely_matching_directory_glob_is_pinned_not_hoisted, test_single_file_compile_keeps_directory_rules_out_of_root, TestInstallRouting::test_directory_rule_stays_when_directory_is_missing, test_single_file_project_keeps_directory_rule safety
Compile hint after install for routed local instructions tests/unit/install/phases/test_finalize_user_compile.py::test_hint_fired_for_local_claude_instructions_routed_to_agents_md safety
Installed CLI: targets: [claude] with **, src/** (hoist-prone tree), **/*.py → hint, root + src/AGENTS.md, @AGENTS.md shims, py.md unchanged; hand-authored CLAUDE.md opt-in tests/integration/test_claude_agents_md_lifecycle.py portability
--force-instructions puts every instruction in AGENTS.md tests/unit/compilation/test_compile_no_dedup_flag.py control
Upgrade from main: stale .claude/rules/style.md retired, edited rule kept with warning manual run below safety

Manual upgrade check: project installed with origin/main, then apm install + apm compile on this branch → style.md (applyTo: "**") retired, AGENTS.md + CLAUDE.md (@AGENTS.md) written, python.md (**/*.py) unchanged; an edited style.md is kept (Kept user-edited file .claude/rules/style.md) and compile leaves that instruction out of AGENTS.md.

How to test

  • In an empty dir: .claude/, apm.yml with targets: [claude], three .apm/instructions (**, src/test/**, **/*.py), files under src/test/ and src/app/.
  • apm install → only .claude/rules/python.md.
  • apm compile → AGENTS.md, src/test/AGENTS.md, and a CLAUDE.md beside each containing @AGENTS.md.
  • Replace CLAUDE.md with # notes, rerun apm install → one warning, all three rules back in .claude/rules/, CLAUDE.md untouched.

Frozen replay of a pre-#3939 lock (fixed in 70b0a74)

  • apm install --frozen on a project whose lock still records an always-on .claude/rules/<n>.md deleted it (it now routes to AGENTS.md) and then refused: the lock recorded a file missing from disk. --frozen never rewrites the lock, so stale-file cleanup now keeps such files with their lock claim (FrozenDisposition.retain_stale_files) and prints Left N file(s) recorded in apm.lock.yaml that this APM version no longer deploys, because --frozen does not change apm.lock.yaml: ... Run 'apm install' to re-render them for this version. A normal install migrates them.
  • Regression trap: test_legacy_lock_upgrade_lifecycle.py::test_c4_frozen_install_of_untouched_pre036_project_writes_nothing (fails before: exit 1 after deleting the rule).
  • Re-pinned upgrade cells (C5, history upgrade from 0.35.1/0.36.0/unstamped/unknown) to drop exactly the routed rule; J01-J03 goldens regenerated (compile hint, one fewer instruction file).

Landing order

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass (environmental failures identical on origin/main)
  • Added tests for new functionality

Changelog

  • One line in one section under ## [Unreleased] (upgrade notes, bottom of section).
  • N/A

Spec conformance (OpenAPM v0.1)

  • N/A -- no spec text change. req-tg-007 delegates target classification to the companion targets matrix, which now lists claude as requiring post-install compilation.

Docs re-home after #3996 (done)

Rebased onto v0.37.0 (2e01e131); the docs commit now targets #3996's layout:

Old page (removed by #3996) Content now in
producer/compile.md (Claude routing note, claude row) producer/write-primitives.md (one paragraph), consumer/choose-harnesses.mdx (Claude tab lists AGENTS.md + CLAUDE.md, since the sample package's design-standards is applyTo: "**"), reference/cli/compile.md (unchanged paragraph)
troubleshooting/migration.md (upgrade note) consumer/update-and-refresh.mdx, section "Claude: instructions move to AGENTS.md (0.38)"; reference/targets-matrix.md links to it
consumer/install-packages.md qualifier dropped: #3996 removed that paragraph

Tests added on main by the 0.37 stack that encode the old routing were moved to a path-scoped instruction, with the same assertions: test_compile_clean_last_primitive_2130.py::test_claude_native_rules_compile_reports_once and test_frozen_deployed_hash_lifecycle.py (.claude/rules/global.md -> .claude/rules/py.md).

Co-authored-by: Copilot [email protected]

Always-on and single-directory instructions reach Claude Code through the
compiled AGENTS.md; every CLAUDE.md APM writes imports @AGENTS.md so both
load on every Claude Code version. File-type globs stay in .claude/rules/.
Hand-authored root CLAUDE.md without the import (or hand-authored AGENTS.md)
keeps the legacy .claude/rules/ layout and warns; user scope is unchanged.

Refs #3939

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
A frozen replay of a pre-#3939 lock deleted the always-on .claude/rules/
file Claude now loads from AGENTS.md, then refused because the lock
recorded a file missing from disk. --frozen never rewrites the lock, so
stale-file cleanup now keeps such files with their lock claim and names
them; a normal install migrates them. Re-pin the upgrade and receipt
lifecycle cells to the AGENTS.md routing.

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Both bundle formats admit unverified live-cache instructions, bypassing source-lock provenance and allowing post-install edits to alter packaged guidance without changing the source lock.

5 open issues
What changed in this PR

This PR brings Claude project instructions onto APM's shared AGENTS.md compilation path, addressing #3939 while retaining native rules for file-type globs and preserving user-authored context files.

Changes:

  • Routes always-on and directory instructions into root or nested AGENTS.md, with importing CLAUDE.md files and explicit compile guidance.
  • Adds migration handling, frozen-install retention, and bundle rendering for routed instructions.
  • Updates architecture guards, regression coverage, conformance records, and migration documentation.
File Description
tests/​unit/​scripts/​test_architecture_runner.py Registers the routing guard in the expected inventory.
tests/​unit/​integration/​test_instruction_integrator.py Tests routed instructions and native-rule fallback.
tests/​unit/​install/​phases/​test_finalize_compile_hint.py Expects Claude compile guidance.
tests/​unit/​core/​test_target_detection_logic.py Includes Claude in AGENTS compilation.
tests/​unit/​core/​test_remediation_w3_deps_compilation_catalog.py Records executed Claude remediation proofs.
tests/​unit/​compilation/​test_token_overhead_opt_in.py Exercises attribution on importing context files.
tests/​unit/​compilation/​test_stale_claude_md_cleanup_1729.py Updates deduplication and cleanup expectations.
tests/​unit/​compilation/​test_project_root_context_protection.py Updates nested context protection assertions.
tests/​unit/​compilation/​test_global_instructions_1072.py Checks global guidance through imported AGENTS content.
tests/​unit/​compilation/​test_compile_target_flag.py Checks Claude's paired context outputs.
tests/​unit/​compilation/​test_compile_no_dedup_flag.py Tests AGENTS instruction deduplication overrides.
tests/​unit/​compilation/​test_compile_cli_surface.py Updates Claude target classification.
tests/​unit/​compilation/​test_compile_clean_last_primitive_2130.py Keeps cleanup coverage on a path-scoped rule.
tests/​unit/​compilation/​test_claude_dependency_roots.py Uses the new formatter while preserving dependency checks.
tests/​unit/​compilation/​test_agents_compiler_coverage.py Updates instruction and constitution assertions.
tests/​spec_conformance/​test_manifest_reqs.py Adds Claude post-install compile coverage.
tests/​spec_conformance/​test_lockfile_reqs.py Preserves dependency-import checks with the new formatter.
tests/​quality/​promise-catalog.json Adds the Claude routing promise.
tests/​quality/​complexity_baseline.json Removes the simplified compiler's complexity allowance.
tests/​lifecycle/​scenarios/​test_history_upgrade.py Checks retirement of legacy Claude rules.
tests/​lifecycle/​journeys/​goldens/​J03/​02.txt Adds frozen-install compile guidance.
tests/​lifecycle/​journeys/​goldens/​J02/​03.txt Updates the deployed-file scan count.
tests/​lifecycle/​journeys/​goldens/​J02/​02.txt Updates frozen-install output.
tests/​lifecycle/​journeys/​goldens/​J01/​06.txt Adds reinstall compile guidance.
tests/​lifecycle/​journeys/​goldens/​J01/​04.txt Updates deployment counts and compile guidance.
tests/​integration/​test_user_authored_name_collision_lifecycle.py Keeps collision coverage on a native rule.
tests/​integration/​test_unquoted_lockfile_version_lifecycle.py Uses a path-scoped deployment fixture.
tests/​integration/​test_unicode_space_paths_lifecycle.py Preserves native-rule path coverage.
tests/​integration/​test_target_manifest_upgrade_lifecycle.py Accounts for routed-rule retirement during upgrades.
tests/​integration/​test_required_lifecycle_state_machine.py Parameterizes scope for deployment-sensitive scenarios.
tests/​integration/​test_remediation_advice_lifecycle.py Adds blocker and single-file remediation scenarios.
tests/​integration/​test_prune_deployment_ledger_e2e.py Preserves per-package native-rule ledger coverage.
tests/​integration/​test_project_self_audit_lifecycle.py Keeps audit assertions on deployed rules.
tests/​integration/​test_lock_e2e.py Parameterizes instruction scope for lock coverage.
tests/​integration/​test_local_single_file_matrix.py Uses a file-type glob for Claude deployment checks.
tests/​integration/​test_local_install.py Updates native-rule fixtures across install scenarios.
tests/​integration/​test_legacy_lock_upgrade_lifecycle.py Checks frozen retention and normal migration.
tests/​integration/​test_global_claude_dedup_lifecycle.py Checks project AGENTS content separately from user rules.
tests/​integration/​test_frozen_dropped_target_lifecycle.py Keeps dropped-target coverage on native rules.
tests/​integration/​test_frozen_deployed_hash_lifecycle.py Moves integrity checks to a path-scoped rule.
tests/​integration/​test_file_primitive_receipt_lifecycle.py Preserves instruction deployment receipt coverage.
tests/​integration/​test_drift_check.py Tests routing replay against live project blockers.
tests/​integration/​test_config_surface_lifecycle_contract.py Updates deployment-sensitive configuration fixtures.
tests/​integration/​test_compile_nested_context_protection_lifecycle.py Checks nested imports and user-file protection.
tests/​integration/​test_compile_clean_nested_worktree.py Checks imported content and worktree exclusion.
tests/​integration/​test_compile_claude_single_h1.py Checks headings across paired context files.
tests/​integration/​test_cleanup_deployment_evidence_lifecycle.py Retains dropped-target cleanup evidence coverage.
tests/​integration/​test_claude_dependency_import_lifecycle.py Separates AGENTS imports from dependency imports.
tests/​integration/​test_claude_agents_md_pack_lifecycle.py Adds bundle preservation and target-selection scenarios.
tests/​integration/​test_claude_agents_md_lifecycle.py Adds routing, compile-hint, and opt-in lifecycle tests.
tests/​integration/​test_case_only_rename_lifecycle.py Keeps rename coverage on a deployed rule.
tests/​integration/​test_architecture_owner_rule_mutations.py Adds routing and blocker bypass mutations.
src/​apm_cli/​integration/​instruction_integrator.py Filters routed sources and exposes legacy rule rendering.
src/​apm_cli/​integration/​cleanup.py Adds rendered evidence for retiring legacy rules.
src/​apm_cli/​install/​service.py Defines frozen stale-file retention.
src/​apm_cli/​install/​phases/​finalize.py Emits compile hints for Claude routed instructions.
src/​apm_cli/​install/​phases/​cleanup.py Retains stale locked files during frozen installs.
src/​apm_cli/​core/​target_detection.py Makes Claude an AGENTS consumer.
src/​apm_cli/​core/​remediation.py Adds Claude migration remediation entries.
src/​apm_cli/​core/​command_logger.py Reports frozen stale-file retention.
src/​apm_cli/​compilation/​claude_formatter.py Generates importing CLAUDE files instead of instruction copies.
src/​apm_cli/​compilation/​claude_agents_md.py Centralizes routing, blockers, placement, and deduplication.
src/​apm_cli/​compilation/​agents_compiler.py Connects AGENTS outputs to Claude imports.
src/​apm_cli/​commands/​compile/​cli.py Updates deduplication override help.
src/​apm_cli/​bundle/​plugin_exporter.py Adds routed instructions to plugin bundles.
src/​apm_cli/​bundle/​packer.py Adds rendered rules and bundle lockfile claims.
src/​apm_cli/​bundle/​claude_routed_rules.py Selects and writes routed rules for packing.
scripts/​architecture_linter/​checks/​registry_module_ownership.py Tightens the unowned-module ceiling.
scripts/​architecture_linter/​checks/​install_deployment_analyzers.py Registers the Claude routing analyzer.
scripts/​architecture_linter/​checks/​install_claude_agents_md_routing.py Guards routing ownership and consumer calls.
packages/​apm-guide/​.apm/​skills/​apm-usage/​workflow.md Lists the paired Claude context artifacts.
packages/​apm-guide/​.apm/​skills/​apm-usage/​commands.md Documents routing, compilation, and migration behavior.
docs/​src/​content/​docs/​reference/​targets-matrix.md Updates Claude outputs and compile requirements.
docs/​src/​content/​docs/​reference/​cli/​compile.md Documents imported context and deduplication behavior.
docs/​src/​content/​docs/​producer/​write-primitives.md Explains Claude instruction destinations.
docs/​src/​content/​docs/​consumer/​update-and-refresh.mdx Adds the Claude migration procedure and caveats.
docs/​src/​content/​docs/​consumer/​choose-harnesses.mdx Updates the Claude output example.
CONFORMANCE.md Updates compile-guidance coverage counts.
CONFORMANCE.json Records the new conformance test.
CHANGELOG.md Adds the Claude upgrade note.
.apm/​architecture/​unowned-modules.json Removes the newly owned Claude formatter.
.apm/​architecture/​owners/​install-deployment.json Registers the Claude instruction-routing owner.

Review effort: Balanced

Comment thread src/apm_cli/bundle/packer.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

PGM: refreshing merge ref after main-red fix #4777 (no head change).

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit c02224d into main Nov 22, 2026
153 of 158 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-bookish-funicular branch November 22, 2026 18:39
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
…SOURCE instruction

#4005 routes Claude '**' instructions to AGENTS.md through compile, so the M-SOURCE instruction uses a file-type glob (as test_file_routing does on main) and keeps a per-file rule on every deployed target the other-file oracle checks. The user-scope native-plugin row reports ~/.claude and the install output when Claude settings are missing.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
…ew (#4787)

- pack renders routed rules only from sources the canonical deployment
  source plan admits (item 1);
- compile records each routed instruction's scope and body fingerprint per
  AGENTS.md (with the file digest); install compares it through one
  CompiledCoverage per root, so link rewriting stays quiet and applyTo or
  body edits remind (items 2, 4, 7);
- managed_section mode validates its markers through the managed-section
  owner before the route opens (item 3);
- compile --root checks directory placements under the source root (item 5);
- AGENTS.md outputs are recorded only once written, and no CLAUDE.md shim
  is written after a failed AGENTS.md batch (item 6).

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
…4005)

A '**' instruction under targets: [claude] never becomes a .claude rule; install asks for apm compile, which writes it to AGENTS.md beside a CLAUDE.md importing @AGENTS.md (P-OWN-claude-agents-md-instruction-routing).

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
…md-routing

[0.38] fix(compile): Claude AGENTS.md routing follow-ups from the #4005 review (#4787)
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 22, 2026
…t instruction

#4805 makes compile record which routed instructions each Claude AGENTS.md carries under APM home (.apm/compiled-agents-md, core/agents_md_compile_record.py), so nothing new lands in the repository. I5 now admits that one prefix for a non-read-only compile only. A dry-run compile, and every other command, stays forbidden from writing it. Fixes test_claude_routes_an_always_on_instruction_to_agents_md.

On main d8b37cb (#4805), the kit packages' '**' instruction no longer reaches .claude/rules for Claude in the M-SOURCE context pass. That is the #4005 contract (always-on guidance routes to AGENTS.md through compile), so the spine's rule-evidence oracle was stale for an always-on instruction. The kit instruction is now path-scoped ('**/*.py'), like M-SOURCE's own packages, so .claude/rules/<pkg>.md stays a deterministic, strictly checked destination; test_file_routing covers the '**' route. Fixes test_source_spine_covers_every_form_and_op.

Co-authored-by: Copilot App <[email protected]>
Jason 'Jay' Jack (jasonjack-jay) pushed a commit to jasonjack-jay/Agent-Package-Manager that referenced this pull request Nov 23, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
test(lifecycle): J08/J09 follow #4005 (Claude instructions converge on AGENTS.md)
Antonin Rouxel (Antonin-Rouxel-LaPoste-BGPN) pushed a commit to anrouxel/apm that referenced this pull request Nov 23, 2026
…onverge on AGENTS.md)

microsoft#4005 stopped deploying .claude/rules/<name>.md, so prune and a dropped
claude target no longer clean it: J08 step 3 cleans 3 paths and prints
the compile hint, J09 step 3 cleans 1. Nightly dispatch 45068563849 (main
76be7b6) failed both journeys on all three OSes at step 3.

Co-authored-by: Copilot App <[email protected]>
(cherry picked from commit f32346b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Claude target: converge instructions on AGENTS.md

2 participants