Conversation
…ider categories (#296) When the user accepts a provider category in the ``_step_provider_dirs`` wizard step, append a matching ``NamespacePolicyRule`` to ``namespace.rules`` so auto-discovered Claude-projects memory dirs stop collapsing to the ``default`` namespace: claude-memory ~/.claude/projects/*/memory/** -> claude:{ancestor:1} claude-plans ~/.claude/plans/** -> claude-plans codex ~/.codex/memories/** -> codex ``{ancestor:1}`` (shipped in #306) picks the project-id folder above the generic ``memory`` basename; single-dir categories use literal namespaces. Labels stay flat pending RFC #304's decision on the vendor/product hierarchy wire format. Dedup is by ``path_glob`` with ``~`` expansion on both sides so re-runs are idempotent regardless of whether earlier edits used the literal ``~`` or the expanded absolute path. User-authored rules with the same ``path_glob`` but a different ``namespace`` win — the wizard skips the preset and surfaces the skip in the pre-write banner so the decision isn't silent. ``namespace.rules`` stays in ``_FRESH_PRESERVE_KEYS``, and the wizard marks the key as wizard-touched only when proposals were considered, keeping ``--fresh`` semantics intact. Pre-write banner lists proposed rules with ``+`` and dedup-skipped rules with ``⏭``, plus an all-skipped one-liner so the user always sees what the wizard considered. Banner is emitted in both interactive and ``--include-provider`` paths. The flag-driven path only registers a rule when the category had detected dirs on this machine — parity with the interactive step skipping empty categories keeps config clean of dead rules. Co-Authored-By: Claude <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
mm initnow appends matchingNamespacePolicyRuleentries tonamespace.ruleswhen the user accepts a provider category. Auto-discoveredClaude-projects memory dirs stop collapsing to the
defaultnamespace —the acute shape of #296, finishing direction (3) after #306 landed
direction (2) (
{ancestor:N}placeholder primitive).Preset table (deliberately flat pending RFC #304):
path_globnamespaceclaude-memory~/.claude/projects/*/memory/**claude:{ancestor:1}claude-plans~/.claude/plans/**claude-planscodex~/.codex/memories/**codexKey decisions (settled in design thread)
~(matches what the usertyped and what the current wizard writes), compare after
expanduser()on both sides.
~/.codex/memories/**and/Users/foo/.codex/memories/**are the same rule for idempotency.
path_glob+ differentnamespace→ user rule wins, wizard skips, banner surfaces the skip with
⏭._rule_matches_existing()is a standalone helper so RFC RFC: nested provider/product hierarchy for memory_dir categorization #304 can reuseit.
--include-providerregisters thesame rules as the interactive prompt, but only when the category had
detected dirs on this machine (parallel to the interactive step
skipping empty categories).
--dry-run: pre-write banner lists proposed(
+) and skipped (⏭) rules in both paths. Full--dry-runsupportfor
mm initis a separate scope — follow-up issue to file once thislands. The banner is the foundation.
Scope boundary
{ancestor:1}via_VALID_PRESET_PLACEHOLDERS+ a test, so extending the table beyondthe three rows above gets an explicit review rather than a silent edit.
Revisit when RFC RFC: nested provider/product hierarchy for memory_dir categorization #304 settles the hierarchy format.
namespace.rulesstays in_FRESH_PRESERVE_KEYS. The wizard marksthe key as wizard-touched only when proposals were considered, so the
Preserved block doesn't flag merged rules as leftover on clean re-runs.
mm inittopick up the presets. Keeps the wizard as the single opt-in surface and
avoids the "silent policy" failure mode flagged in prior RFCs.
Test plan
ruff check+ruff format --checkcleanpytest -m "not ollama"— 1900 pass, 0 regressionsmypyclean on init_cmd.pydecline, write-path merge, re-run idempotency, user-rule
preservation on same-glob-diff-namespace, dedup normalizes
expanduser,
--include-providerparity (dirs present + absent),banner states (proposed+skipped / silent / all-skipped),
placeholder vocabulary lock.
Closes #296.