Problem
When ~/.claude/CLAUDE.md is edited directly (the natural workflow), claude-sync auto-commit does not detect the changes if the file's structure has changed. It compares fragment content hashes against the old fragment store, so reorganizations, renamed sections, and new sections are invisible.
Steps to Reproduce
- Have a synced CLAUDE.md with fragments in
~/.claude-sync/claude-md/
- Edit
~/.claude/CLAUDE.md directly: reorganize sections, rename headings, add new sections
- Run
claude-sync auto-commit --if-changed
- Observe: the commit message references other changes (e.g., "update MCP servers") but the CLAUDE.md restructuring is not captured
claude-sync push does not include the CLAUDE.md changes
- The fragment store retains the old structure with stale section names
Expected Behavior
auto-commit should detect when the assembled CLAUDE.md has diverged from what the fragment store would produce, and either:
- Re-fragment the live file back into the sync store, or
- Flag the divergence so the user can resolve it
Current Workaround
Manually update each fragment file in ~/.claude-sync/claude-md/, create/delete fragment files for renamed/new/removed sections, update manifest.yaml, and update the claude_md.include list in config.yaml. This is error-prone and tedious.
Proposed Solution
Add a claude-sync claude-md import command (or similar) that:
- Reads the live
~/.claude/CLAUDE.md
- Splits it back into fragments by heading structure
- Updates
manifest.yaml with the new fragment inventory
- Updates
config.yaml's claude_md.include list
- Removes orphaned fragment files
This would close the round-trip: pull assembles fragments into CLAUDE.md, import disassembles CLAUDE.md back into fragments.
Alternatively, auto-commit could compare the assembled output of the current fragments against the live file and trigger re-fragmentation when they diverge.
Context
This came up while reorganizing a global CLAUDE.md into logical groups (Style & Principles, Tools & Environment, Git & Output, Workflow) and adding a new Python Zen section. The restructuring required manually updating 15+ fragment files, the manifest, and the config.
Problem
When
~/.claude/CLAUDE.mdis edited directly (the natural workflow),claude-sync auto-commitdoes not detect the changes if the file's structure has changed. It compares fragment content hashes against the old fragment store, so reorganizations, renamed sections, and new sections are invisible.Steps to Reproduce
~/.claude-sync/claude-md/~/.claude/CLAUDE.mddirectly: reorganize sections, rename headings, add new sectionsclaude-sync auto-commit --if-changedclaude-sync pushdoes not include the CLAUDE.md changesExpected Behavior
auto-commitshould detect when the assembled CLAUDE.md has diverged from what the fragment store would produce, and either:Current Workaround
Manually update each fragment file in
~/.claude-sync/claude-md/, create/delete fragment files for renamed/new/removed sections, updatemanifest.yaml, and update theclaude_md.includelist inconfig.yaml. This is error-prone and tedious.Proposed Solution
Add a
claude-sync claude-md importcommand (or similar) that:~/.claude/CLAUDE.mdmanifest.yamlwith the new fragment inventoryconfig.yaml'sclaude_md.includelistThis would close the round-trip:
pullassembles fragments into CLAUDE.md,importdisassembles CLAUDE.md back into fragments.Alternatively,
auto-commitcould compare the assembled output of the current fragments against the live file and trigger re-fragmentation when they diverge.Context
This came up while reorganizing a global CLAUDE.md into logical groups (Style & Principles, Tools & Environment, Git & Output, Workflow) and adding a new Python Zen section. The restructuring required manually updating 15+ fragment files, the manifest, and the config.