How to Migrate Instructions, Rules, and Long-Term Memory When Switching AI Coding Assistants
Losing an AI coding assistant account is recoverable—losing your accumulated context is not. This article explains how to treat global instructions, project rules, and long-term memory as portable assets, why direct directory sharing between tools fails, and how to migrate safely using a "parse, normalize, render" pipeline with an intermediate representation.
1. Why Losing Your Account Isn’t the Worst Thing
Over the past year, many developers have had their AI coding tool accounts suspended without warning. Some switched to clean network environments, used dedicated payment methods, even set up browser fingerprint isolation—and still received an “automated review failed” notice one morning. Community threads keep piling up: some accounts lasted six months, some three, some barely six weeks. The risk-control logic behind these suspensions is complex and opaque—access points, system fingerprints, and usage patterns can all factor in. For individual users, rather than obsessing over risk-control details, it’s better to accept one reality: your account can disappear at any time. That’s the default assumption when using any third-party AI service.
An account can be re-registered; a subscription can be repurchased. But for heavy users, the truly hard-to-rebuild assets are of a different kind:
- Global instruction files: define the assistant’s behavior preferences, code style, response language, and more;
- Project-level rules: dozens of coding standards, directory conventions, and testing requirements tailored to specific repositories;
- Long-term memory: context the assistant accumulates through collaboration—project background, historical decisions, common pitfalls.
These aren’t built in a day. Their value lies in this: if you can carry this context intact into a new assistant environment, the new assistant picks up your workflow almost seamlessly; if you can’t, you start “training” it from scratch.
2. The Typical Storage Structure of Context Assets
Take mainstream CLI-based AI coding assistants as an example. These tools typically store user context in a hidden directory under the user’s home folder, structured roughly like this:
~/.assistant-home/├── CLAUDE-like.md # Global instructions (behavior, language, style)├── rules/ # Rules directory, often split by topic│ ├── coding-style.md│ ├── git-workflow.md│ └── testing.md├── memory/ # Long-term memory or project indexes│ ├── project-alpha.md│ └── project-beta.md└── settings.json # Tool-level config (model, permissions, endpoints)
Understanding this structure is the first step of migration. You need to be clear about the semantic differences among the three content types:
- Global instructions: apply to all sessions—essentially a system-level “personality setting,” usually a single Markdown file;
- Rules: finer-grained constraints organized by scenario; many tools support conditional loading (e.g., only active in specific directories);
- Memory: semi-structured free text recording knowledge accumulated through collaboration—the least standardized format, and the easiest to lose during migration.
3. The Real Challenge: Format Incompatibility
After switching to a new tool, many people’s first instinct is to have the new assistant “just read the old directory.” That path usually doesn’t work, for three reasons:
1. Different directory conventions. The new tool has its own config directory and file naming rules. Even if it can read the old path, its loading mechanism won’t automatically recognize it.
2. Incompatible storage formats. Even when everything is Markdown, tools structure memory entries differently: some use plain-text paragraphs, some use entries with metadata (timestamps, tags, project paths), some use JSON or YAML for structured fields. Pointing the new tool directly at old files leads to parse failures at best, or overwritten content at worst.
3. Routing configuration has side effects. Editing config files to point the new tool’s memory path at the old directory looks elegant, but the two sides write in different formats, causing write pollution—the new tool writes back in its own format and corrupts the old file structure. Not worth it.
4. The Right Approach: Parse Once, Render Twice
Since formats are incompatible, the only safe approach is explicit conversion: read the old format → parse into a semantic structure → write out in the new format. I wrote a sync script following this idea, with a four-step core workflow.
Step 1: Scan and classify. Walk the old directory and sort files into instructions, rules, and memory based on file type and content characteristics. Simple heuristics work for the classification logic:
def classify(path, text):if "memory" in str(path).lower():return "memory"if path.parent.name == "rules" or has_rule_frontmatter(text):return "rule"return "instruction"
Step 2: Semantic normalization. Parse the three content types into a unified intermediate representation (IR), for example:
{"type": "rule","scope": "global","globs": ["**/*.py"],"body": "All public functions must have docstrings; exceptions must be caught and logged","tags": ["python", "style"]}
The intermediate representation is the key to the whole approach: it turns “old format → new format” into “old format → IR → new format.” For any future migration to another tool, you only need to write a new renderer.
Step 3: Render to the target format. Generate files according to the new tool’s directory conventions, add the metadata headers the target tool requires to rule files, and merge/dedupe memory files (by semantic similarity or keyword matching, to avoid stacking duplicate entries).
Step 4: Validate and protect against write-back. After migration, run three kinds of checks: file-count reconciliation, spot checks on key keywords, and a “write-only, never read-back” confirmation on the target directory (to ensure the old directory wasn’t modified). Run a dry-run into a temporary directory first, spot-check manually, then write to disk.
5. Engineering Advice Beyond Migration
Based on this experience, a few suggestions for heavy users:
- Put context assets under version control. Manage your instructions, rules, and memory directories with Git and commit regularly. With this in place, account bans, accidental deletions, and tool switches are no longer disasters.
- Prune memory files regularly. Long-term memory keeps growing, and much of it becomes stale. Do a manual review monthly—delete obsolete entries, merge duplicates. This is both necessary prep before migration and improves the assistant’s day-to-day response quality.
- Use an intermediate format as the single source of truth. If you switch among multiple tools, maintain your rules as one neutral Markdown repository and use scripts to distribute them into each tool’s directory. Edit rules only at the source.
- Isolate sensitive information. When the migration script processes files, strip out secrets, internal network addresses, and similar sensitive content so they don’t follow your context into the new environment.
6. Conclusion
Tools get suspended and accounts get flagged by mistake—that’s beyond our control. But instructions, rules, and memory are fundamentally just plain files. With a backup habit in normal times and a “parse—normalize—render” methodology during migration, any switch can be done within an hour. Real peace of mind comes from treating context assets like code: versioned, structured, and rebuildable.
