Repository navigation
[0.38] feat(bundle): Claude bundle installs converge on AGENTS.md (#4034) - #4071
Closed
Daniel Meppiel (danielmeppiel) wants to merge 8 commits into
Closed
Daniel Meppiel (danielmeppiel) wants to merge 8 commits into
Daniel Meppiel (danielmeppiel) wants to merge 8 commits into
Conversation
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-4034-bundle-agents-md
branch
3 times, most recently
from
November 20, 2026 05:19
015a567 to
0fd257a
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-bookish-funicular
branch
from
November 20, 2026 07:44
b397d04 to
b2fa03b
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-4034-bundle-agents-md
branch
from
November 20, 2026 07:56
0fd257a to
de531f5
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-bookish-funicular
branch
2 times, most recently
from
November 21, 2026 08:48
4af4d40 to
e46b72c
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-4034-bundle-agents-md
branch
from
November 21, 2026 08:54
de531f5 to
24b4c47
Compare
This was referenced Nov 21, 2026
…am for #4034 Co-authored-by: Copilot App <[email protected]> # Conflicts: # CONFORMANCE.md
`apm install <bundle>` into a project-scope Claude target routes each plugin-native instruction through the #3939 owner (routes_to_agents_md with the live project root, claude_agents_md_blocker): routed instructions are staged as compile input under apm_modules/<slug>/.apm/instructions/ (the the Claude rule projection (applyTo -> paths:) through the #4007 per-target render seam. A hand-authored CLAUDE.md without the import keeps every rule with the #3939 warning; non-discoverable names keep their rendered rule. The install-deployment-claude-agents-md-routing guard and owner record cover the bundle consumer, with a mutation case. Co-authored-by: copilot-swe-agent[bot] <[email protected]> (cherry picked from commit 4a6b858)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> (cherry picked from commit 5a919a8)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> (cherry picked from commit 24b4c47)
….md rule (#4034) Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
…er seam Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-4034-bundle-agents-md
branch
from
November 21, 2026 12:13
24b4c47 to
9dbfac6
Compare
Collaborator
Author
|
Closing per the 0.38 feature-cut ruling (no draft PRs, rule 16): this feature is not in 0.38.0. The branch is kept; it reopens as a ready PR when resumed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
TL;DR. On a project-scope Claude target,
apm install <bundle>now places instructions the way a package install does since #3939. Always-on and directory instructions are staged asapm compileinput, so they land in theAGENTS.mdthatCLAUDE.mdimports. Path-scoped instructions become.claude/rules/files withpaths:, rendered by the existing Claude rule projection instead of copied verbatim withapplyTo:. A hand-authoredCLAUDE.mdwithout@AGENTS.mdkeeps the legacy layout and gets the #3939 warning.Important
Fixes #4034; lands after #4005 and #4007. Stacked PR: the base is
danielmeppiel-bookish-funicular(#4005 @d01029a5, the #3939 routing); retarget tomainonce #4005 lands. The branch merges the final #4007 head7d9015b5(the per-target bundle render seam), so until #4007 lands this diff also shows #4007's commits. This PR's own work is the commits after mergeea204822.Problem.
instructions/<n>is copied verbatim to.claude/rules/<n>.md, keepingapplyTo:, which Claude Code ignores. As a result, every bundle rule loads in every session, and bundle installs diverge from package installs after [FEATURE] Claude target: converge instructions on AGENTS.md #3939.AGENTS.md, but delivered as a bundle it goes to.claude/rules/. Same content, two layouts.Issue and approved scope
Issue: Fixes #4034
Human scope-approval comment: #4034 (comment) (
scripts/governance/eligibility.cjsat trusted main67936cd7:record-present,contact_confirmation_needed: false)This PR completes the issue. Outside it, per the record: routing semantics (#3939), #3686, agent rendering (#3714/#4007), multi-target placement (pending Daniel), user scope, lockfile schema, and
apm packoutput.Record interpretation
The record's Done-when says "
apm prunestay byte-stable". This PR reads it through the existing, tested compile-only bundle contract (#1207/#3705;test_local_bundle_compile_only_targets_lifecycle.py: "apm prunestill clears it"). It is not a new contract. Proposed amended phrase:The lifecycle test asserts exactly that:
.claude/rules/py.md,AGENTS.md,src/AGENTS.mdandCLAUDE.mdare unchanged after prune, and the lockfile drops onlylocal_staged_files.Note
Rebuilt on #4005 @
d01029a5+ #4007 @7d9015b5(head9dbfac68). The 3 #4034 commits were replayed on top; conflicts inservices.py(the_render_fmtdispatch now carries #4007's final Codex branch) andreference/cli/install.mdwere resolved. #4005's newer rule (a directory instruction routes only where compile can deliver<dir>/AGENTS.md) applies to bundles unchanged, because the bundle routing calls the sameroutes_to_agents_md(apply_to, project_root)owner; the install doc now says so. #4007's two bypass mutations were repointed to the_render_fmtseam. The earlierservices.pyLOC and$APM_HOMElifecycle failures were fixed in #4007.Local evidence on
9dbfac68: lint chain clean (ruff 0.15.12 check/format, pylint R0801, auth signals, complexity ratchet, taxonomy--changed, architecture boundaries, assertion-quality ratchet).pytestlocal-bundle, Claude AGENTS.md, agent integrator, owner-rule and bypass mutations, architecture runner: all passed. Lifecycletest_local_bundle_claude_agents_md_lifecycle.py,test_local_bundle_codex_agents_lifecycle.py,test_local_bundle_manifest_targets_lifecycle.py: 17 passed. CONFORMANCE regenerated.Approach
routes_to_agents_md(applyTo, live project root)plusclaude_agents_md_blocker(warned once per install). User scope never routes.apm_modules/<slug>/.apm/instructions/<source name>, recorded inlocal_staged_fileswith hashes (#3718), so drift,--frozenand prune follow the compile-only contract.InstructionIntegrator._convert_to_claude_rules(applyTo->paths:), dispatched through #4007'sbundle_render_format_idseam (claude_rulesadded to_RENDERED_PLUGIN_FORMAT_IDS)..claude/rules/files asinstructions/<n>.md. Any source withpaths:is copied as packed (byte-identical to main), never re-rendered or staged, even next toapplyTo: Claude Code reads onlypaths:, and re-rendering would strip or replace it. APM-format sources (nopaths:), with or withoutapplyTo, keep #3939 routing.instructions/<n>.instructions.md(flat) is staged. Any other name keeps its rendered rule, so content is never lost.Implementation
install/local_bundle_instructions.py(new)ClaudeBundleRouting: per-install blocker,staged(),stage_tail(),rendered().render_claude_bundle_rule()delegates to the integrator projection.install/services.pyintegrate_local_bundleasksClaudeBundleRoutingwhether to stage, and stages under the source name (not the loweredrules/path). The Codex dispatch reuses the computed render format. The LOC budget (1205) is still met.install/local_bundle_paths.pyclaude_rulesis a rendered format.compilation/claude_agents_md.py,integration/instruction_integrator.pyclaude_agents_md_blocker_warning()is shared by package and bundle installs (same text).install_claude_agents_md_routing.pyguard +install-deployment.jsonintegrate_local_bundle->_ClaudeBundleRouting;_stages->routes_to_agents_md;__init__->claude_agents_md_blocker; renderer ->_convert_to_claude_rules. The owner record lists the new consumer, and a mutation case removes the owner verdict.marketplace_package_and_registration.py(#4007 guard)_render_fmtdispatch.Trade-offs
apm pruneclears Claude bundle staging, as it does for Codex, Gemini and OpenCode ([BUG] apm pack -> install #1207/[BUG] Installing a bundle for Codex, Gemini or OpenCode always failsapm audit --ciwith missing deployed files #3705, asserted bytest_local_bundle_compile_only_targets_lifecycle.py: "apm prunestill clears it"). Deployed.claude/rules/files and the compiledAGENTS.md/CLAUDE.mdstay byte-identical, and the lockfile only dropslocal_staged_files. Keeping staging through prune for Claude only would fork the staging contract. Note for the record: its "apm prune stays byte-stable" is met for deployed and compiled files, and staging follows the existing contract.apm compilecannot discover would silently drop it.AGENTS.md. That is pending Daniel's decision.Validation
6ff4188csrc (test_local_bundle_claude_agents_md_lifecycle.py)assert ['py.md', 'src.md', 'style.md'] == ['py.md']; the hand-authored control is also red (verbatimapplyTo:copy, no warning). The Copilot/Cursor/Codex controls are green on base (unchanged behavior).7 passedtests/integration/test_*bundle*,test_pack*,test_unpack*,tests/unit/bundle,tests/unit/install)3497 passed, 1 skipped (excludingtest_unix_install_ownership.pyandtest_cache_pin, which are root/gpg environment-only)APM_E2E_TESTS=1905 passed, 2 skipped, 1 xfailed, 1 failed. The failure istest_compile_permission_denied(chmod does not deny as uid 0 in this sandbox).tests/unit+tests/spec_conformance28725 passed. The 81 failures are git-transport, network, installer and gpg tests that fail identically on base6ff4188c(same IDs, re-run in a base worktree).-k "claude or matrix or order or registry or bundle")89 passedruff check,ruff format --check, pylint R0801,lint-auth-signals.sh, file lengthscripts/lint_architecture_boundaries.py --root .Scenario evidence
test_claude_bundle_install_then_compile_converges_on_agents_mdCLAUDE.mdis never broken or overwrittentest_hand_authored_claude_md_keeps_rendered_bundle_rules--frozen,audit --ciandpruneare deterministictest_claude_packed_bundle_rules_deploy_byte_identical[paths-only, paths-and-applyTo](red on8c0ed150and015a5679respectively)test_other_targets_deploy_the_bundle_as_before[copilot,cursor,codex](exact file sets; green on base)Updated tests (intended behavior change)
test_local_bundle_manifest_targets_lifecycle.pyapplyTo: "**"instruction is now staged atapm_modules/bundler/.apm/instructions/glob.instructions.mdinstead of.claude/rules/glob.md. The path-scopedpyrule stays in.claude/rules/py.md, and the test assertsglob.mdis absent. No assertion was removed.How to test
APM_E2E_TESTS=1 uv run --extra dev pytest tests/integration/test_local_bundle_claude_agents_md_lifecycle.pyinstructions/{style,src,py}.instructions.md(**,src/**,**/*.py). Install it into atargets: [claude]project that has asrc/directory; only.claude/rules/py.mdappears and install prints theapm compilehint.apm compile:AGENTS.mdandsrc/AGENTS.mdcarrystyleandsrc, and eachCLAUDE.mdis@AGENTS.md.CLAUDE.mdand reinstall: all 3 rules land in.claude/rules/withpaths:, with the [FEATURE] Claude target: converge instructions on AGENTS.md #3939 warning.Type of change
Testing
Changelog
## [Unreleased]inCHANGELOG.md(bottom of### Changed).Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed (after the [0.38] feat(install): render bundle agents to Codex TOML at install (#3714) #4007 merge).req-tg-007(targets-matrix.mdpost-install compile classification), so there is no spec amendment.Docs re-home after #3996
consumer/deploy-a-bundle.md.claude/rules/withpaths:, hand-authoredCLAUDE.mdkeeps legacy plus warning)reference/cli/install.md(bundle install section; this page is removed in #3996)producer/pack-a-bundle.mdAGENTS.md, so pack output is the same for every consumerreference/cli/pack.md,## Description(this page is removed in #3996)reference/cli/install.mdreference/cli/install.md(same page)producer/compile/#claude-code-deduplicationreference/targets-matrix.md(Claude rows), sinceproducer/compile.mdis removed in #3996apm-usage/commands.md,apm-usage/package-authoring.mdCo-authored-by: Copilot [email protected]