gabriel / muse public
feat patch fix/agent-config-canonical-path #2 / 3
AI Agent gabriel · 11 days ago · Jul 7, 2026 · Diff

feat: auto-migrate legacy .muse/agent.md to .museagent.md on init/sync

Completes Phase 2's migration requirement, which the previous commit skipped. Without this, any repo that ran 'muse agent-config init' before issue #78's fix would hit a confusing 'no agent.md found' error after upgrading, or silently get a fresh default overwriting their real customized rules.

_migrate_legacy_agent_md() moves (not copies) content from the old location to the new one -- the old location must not linger. Wired into both run_init and run_sync (the latter also checks the workspace root, since sync reads both scopes). A successful migration counts as init's existing-file success case, not the --force-required error case -- the migrated file achieving init's goal shouldn't be treated as a collision.

ACFG_04/05 verify migration triggers correctly from both init and sync.

sha256:8adda2b05fc89cbb8e81ab3d2104cbbd23ff35a5b1908f0eb534680077f7ac97 sha
+4 ~6 symbols
sha256:c5bbb64023818975de826db1653a71ec00dd8680eaed6de4ae08566b8ac35847 snapshot
+4
symbols added
~6
symbols modified
0
dead code introduced
Semantic Changes 10 symbols
~ muse/cli/commands/agent_config.py .py 2 symbols added, 5 symbols modified
+ _migrate_legacy_agent_md function function _migrate_legacy_agent_md L541–566
+ _muse_dir import import _muse_dir L72–72
~ tests/test_cmd_agent_config.py .py 2 symbols added, 1 symbol modified
+ test_ACFG_04_legacy_muse_dir_agent_md_migrated_on_init method method test_ACFG_04_legacy_muse_dir_agent_md_migrated_on_init L346–359
+ test_ACFG_05_legacy_muse_dir_agent_md_migrated_on_sync method method test_ACFG_05_legacy_muse_dir_agent_md_migrated_on_sync L361–373

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:8adda2b05fc89cbb8e81ab3d2104cbbd23ff35a5b1908f0eb534680077f7ac97 --body "your comment"