Background
Finding from the PR #2547 review round (pre-existing behavior, both scopes and both tools): fromInstructions merges the existing instructions array with the newly generated list by union (dedupe + sort), so an entry registered for a since-deleted non-root rule persists in opencode.json / kilo.jsonc forever. A user's hand-written entry for the same file in a different spelling (e.g. .config/opencode/memories/x.md vs the stripped memories/x.md at global scope) also coexists as a duplicate, loading the file twice.
Details
OpencodeMcp.fromInstructions (src/features/mcp/opencode-mcp.ts): new Set([...existingInstructions, ...normalizedInstructions]).
- The kilo counterpart shares the pattern.
- Deleting a rule from
.rulesync/rules/ removes the memories file (orphan deletion) but never the registered path, leaving a dangling instructions entry OpenCode then fails to load or silently ignores.
Solution / Next Steps
Scope the union: rulesync owns entries that point under its managed rules directories (.opencode/memories/, .kilo/rules/, global memories/) — rebuild that subset from the current generate and preserve only entries outside those roots verbatim. Mirrors how other adapters scope managed-name ownership (e.g. Rovo Dev's disabledMcpServers handling in PR #2545).
Background
Finding from the PR #2547 review round (pre-existing behavior, both scopes and both tools):
fromInstructionsmerges the existinginstructionsarray with the newly generated list by union (dedupe + sort), so an entry registered for a since-deleted non-root rule persists inopencode.json/kilo.jsoncforever. A user's hand-written entry for the same file in a different spelling (e.g..config/opencode/memories/x.mdvs the strippedmemories/x.mdat global scope) also coexists as a duplicate, loading the file twice.Details
OpencodeMcp.fromInstructions(src/features/mcp/opencode-mcp.ts):new Set([...existingInstructions, ...normalizedInstructions])..rulesync/rules/removes the memories file (orphan deletion) but never the registered path, leaving a dangling instructions entry OpenCode then fails to load or silently ignores.Solution / Next Steps
Scope the union: rulesync owns entries that point under its managed rules directories (
.opencode/memories/,.kilo/rules/, globalmemories/) — rebuild that subset from the current generate and preserve only entries outside those roots verbatim. Mirrors how other adapters scope managed-name ownership (e.g. Rovo Dev'sdisabledMcpServershandling in PR #2545).